UNPKG

openchemlib

Version:
16 lines 1.1 MB
var pl=class{copyMolecule(Z){let Bt=Z.getIDCodeAndCoordinates();navigator.clipboard.writeText(`${Bt.idCode} ${Bt.coordinates}`)}pasteMolecule(){return null}};var US="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",zo=new Uint8Array(256);for(let w=0;w<US.length;w++)zo[US.charCodeAt(w)]=w;function LS(w){let Z=w.length*.75,Bt=w.length,ot,Ft=0,p1,Rt,y1,i1;w.at(-1)==="="&&(Z--,w.at(-2)==="="&&Z--);let s1=new ArrayBuffer(Z),o1=new Uint8Array(s1);for(ot=0;ot<Bt;ot+=4)p1=zo[w.charCodeAt(ot)],Rt=zo[w.charCodeAt(ot+1)],y1=zo[w.charCodeAt(ot+2)],i1=zo[w.charCodeAt(ot+3)],o1[Ft++]=p1<<2|Rt>>4,o1[Ft++]=(Rt&15)<<4|y1>>2,o1[Ft++]=(y1&3)<<6|i1&63;return s1}function Cl(w){return w.toString(16).padStart(2,"0")}var T9=globalThis.devicePixelRatio||1;var O2=class{constructor(Z){this.ctx=Z,this.ctx.textAlign="left",this.ctx.textBaseline="top",this.currentFontSize=12,this.currentFont="12px sans-serif",this.ctx.font=this.currentFont,this.currentColor="#000000",this.currentLineWidth=1,this.canvasCache=new Map}clearRect(Z,Bt,ot,Ft){this.ctx.clearRect(Z,Bt,ot,Ft)}getBackgroundRGB(){return 16777215}getForegroundRGB(){return 0}getSelectionBackgroundRGB(){return 12310268}getLineWidth(){return this.currentLineWidth}setRGB(Z){let Bt=Z>>>16&255,ot=Z>>>8&255,Ft=Z>>>0&255;this.currentColor=`#${Cl(Bt)}${Cl(ot)}${Cl(Ft)}`,this.ctx.fillStyle=this.currentColor,this.ctx.strokeStyle=this.currentColor}setFont(Z,Bt,ot){this.currentFontSize=Z,this.currentFont=`${Bt?"bold":""} ${ot?"italic":""} ${Z}px sans-serif`,this.ctx.font=this.currentFont}getFontSize(){return this.currentFontSize}getBounds(Z){let Bt=this.ctx.measureText(Z);return{x:Bt.actualBoundingBoxLeft,y:Bt.actualBoundingBoxAscent,width:Bt.actualBoundingBoxRight,height:Bt.actualBoundingBoxAscent}}drawString(Z,Bt,ot){this.ctx.fillText(ot,Z,Bt)}drawCenteredString(Z,Bt,ot){this.ctx.textAlign="center",this.ctx.textBaseline="middle",this.ctx.fillText(ot,Z,Bt),this.ctx.textAlign="left",this.ctx.textBaseline="top"}setLineWidth(Z){this.currentLineWidth=Z,this.ctx.lineWidth=Z}fillRectangle(Z,Bt,ot,Ft){this.ctx.fillRect(Z,Bt,ot,Ft)}fillCircle(Z,Bt,ot){let Ft=ot/2;this.ctx.beginPath(),this.ctx.arc(Z+Ft,Bt+Ft,Ft,0,2*Math.PI),this.ctx.fill()}drawLine(Z,Bt,ot,Ft){this.ctx.beginPath(),this.ctx.moveTo(Z,Bt),this.ctx.lineTo(ot,Ft),this.ctx.stroke()}drawPolygon(Z){this.ctx.beginPath(),this.ctx.moveTo(Z.getX(0),Z.getY(0));for(let Bt=1;Bt<Z.getSize();Bt++)this.ctx.lineTo(Z.getX(Bt),Z.getY(Bt));this.ctx.stroke()}drawRectangle(Z,Bt,ot,Ft){this.ctx.strokeRect(Z,Bt,ot,Ft)}fillPolygon(Z){this.ctx.beginPath(),this.ctx.moveTo(Z.getX(0),Z.getY(0));for(let Bt=1;Bt<Z.getSize();Bt++)this.ctx.lineTo(Z.getX(Bt),Z.getY(Bt));this.ctx.fill()}drawImage(Z,Bt,ot,Ft,p1,Rt,y1,i1,s1){if(arguments.length!==9)throw new Error(`drawImage call with ${arguments.length} arguments unimplemented`);let o1=this.canvasCache.get(Z);if(!o1){o1=document.createElement("canvas");let n0=Z.imageData;o1.width=n0.width,o1.height=n0.height;let N0=o1.getContext("2d");N0.globalAlpha=0,N0.putImageData(n0,0,0),this.canvasCache.set(Z,o1)}this.ctx.drawImage(o1,Bt,ot,Ft,p1,Rt,y1,i1,s1)}isDarkBackground(){return!1}};var Hl=class{constructor(Z,Bt){this.canvasElement=Z,this.changeListener=Bt,this.drawContext=new O2(this.canvasElement.getContext("2d"))}getBackgroundRGB(){return 16777215}getCanvasWidth(){return this.canvasElement.width}getCanvasHeight(){return this.canvasElement.height}getDrawContext(){return this.drawContext}onChange(Z,Bt){this.changeListener?.({what:Z,isUserEvent:Bt})}getClipboardHandler(){return new pl}};var JPt=` /* We can customize editor styles here. */ `,Oc;function sS(){if(Oc)return Oc;let w=new CSSStyleSheet;return w.replaceSync(JPt),Oc=w,w}function Gc(w,Z,Bt){let ot=-1;function Ft(Rt,y1,i1=0){y1.button>0||Z.fireMouseEvent(Rt,y1.button+1,i1,Math.round(y1.offsetX*T9),Math.round(y1.offsetY*T9),y1.shiftKey,y1.ctrlKey,y1.altKey,y1.button===2)}w.addEventListener("pointerdown",Rt=>{ot===-1&&(ot=Rt.pointerId,Ft(Bt.MOUSE_EVENT_PRESSED,Rt))});function p1(Rt){ot===Rt.pointerId&&(ot=-1,Ft(Bt.MOUSE_EVENT_RELEASED,Rt))}return document.addEventListener("pointerup",p1),w.addEventListener("click",Rt=>{Ft(Bt.MOUSE_EVENT_CLICKED,Rt,Rt.detail)}),w.addEventListener("pointerenter",Rt=>{Ft(Bt.MOUSE_EVENT_ENTERED,Rt)}),w.addEventListener("pointerleave",Rt=>{Ft(Bt.MOUSE_EVENT_EXITED,Rt)}),w.addEventListener("pointermove",Rt=>{ot!==-1?ot===Rt.pointerId&&Ft(Bt.MOUSE_EVENT_DRAGGED,Rt):Ft(Bt.MOUSE_EVENT_MOVED,Rt)}),()=>{document.removeEventListener("pointerup",p1)}}function yS(w,Z,Bt,ot,Ft){let p1=typeof navigator<"u"&&navigator.platform==="MacIntel",Rt=i1=>p1&&i1.metaKey||!p1&&i1.ctrlKey;function y1(i1,s1){let o1=zPt(s1,ot);o1!==null&&Bt.fireKeyEvent(i1,o1,s1.altKey,s1.ctrlKey,s1.shiftKey,Rt(s1))}Z.addEventListener("keydown",i1=>{Rt(i1)&&i1.key==="c"||Rt(i1)&&i1.key==="v"||y1(ot.KEY_EVENT_PRESSED,i1)}),Z.addEventListener("keyup",i1=>{y1(ot.KEY_EVENT_RELEASED,i1)}),w.addEventListener("paste",i1=>{let s1=i1.clipboardData.getData("text"),o1=Ft.fromText(s1);o1&&o1.getAllAtoms()>0&&Bt.addPastedOrDropped(o1)})}function zPt(w,Z){switch(w.key){case"Control":return Z.KEY_CTRL;case"Alt":return Z.KEY_ALT;case"Shift":return Z.KEY_SHIFT;case"Delete":case"Backspace":return Z.KEY_DELETE;case"F1":return Z.KEY_HELP;case"Escape":return Z.KEY_ESCAPE;case"Enter":return Z.KEY_ENTER;default:return w.key.length===1?w.key.codePointAt(0):null}}var Ml=class{constructor(Z){this.canvasElement=Z,this.drawContext=new O2(this.canvasElement.getContext("2d"))}setDimensions(Z,Bt){this.canvasElement.width=Z,this.canvasElement.style.width=`${Z/T9}px`,this.canvasElement.height=Bt,this.canvasElement.style.height=`${Bt/T9}px`}getDrawContext(){return this.drawContext}getBackgroundRGB(){return 16777215}getForegroundRGB(){return 0}};var lS={"chain.png":"url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAQAAABKfvVzAAAB2UlEQVR4XmNgGJmAkYGJgQULZGXAhCygIGICQg4GdjTIARRDh5xAEQwNKYzXeK4xY1Oez3SNfz8TmoYUxq+6m9bfqLjDI4tmfhzLff9VR17FoWhwZXpkOm2v1C+79+cbD4gga8lneuhrfdv6/+ItSBpSGB+bTDos9IfzP9N/k3cX6+7wwByWz/TWR/E1w/+kO+8j4BpSGL9rz9wh+Efs14TF3heY/tu/vlF2hxtkSxzLY2/FVyz/om69jT0G8kM6QyNDM9MT41nbZX9y/J/ct1/4iU7aIYb/9q8uVx0UbmF64mV7i/1/0s0HSVM5dRgYrjB84/8U+bh80iH+34z/17Xc51ZhUGX8qpkK1GL6+krltyClVyz/c+69C57CwQsK1v+Sl9rdvgr8Z/7P9WvKxNs8fsD44ABqeWLkdYHhv9sL8e+s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T4/GJSU0jHde3T2KtMxYnA8X5tvT5cp2eehDLnVxrPPoLgWpx4Hd+8Lp/Zx7boYoe/g40eDtViIF6Se+xPX8qPl96DqECImrRMOY2fg3e1atwd16UX1cR75wEXr4VmGdxL52atbpX2HnxfTenfiJcelKr9CjvQp/IMWJ57AO62ndOKk7890/iSWBU4XaZc0AAAAASUVORK5CYII=)","fist.png":"url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAQAAABKfvVzAAABj0lEQVR4Xu2S3yuDYRTHz7IZsfdCUrYLG4VCpJV6d0mS/A1zg79ArRArP4q5s4ulVousFCn/gX/g5WK7wkZMzIXMxjZ793XeMdn7vpM/wDn1PD1P53PO95znIfq3rwmYyU5tZPr7PJYoTjGaZ8xB1t+xZQqyP60iAEeWsThFGKpqbiE9CRECrnCHLnTAj17QbLV4E3mFXALbcOAGSXRiClnMgZLkZR/QYg0UEpDBDuxI4IHzT6OADdRiEK2gE12gBWmWE8Yj7weQIGOT650zaoiqAVtjDx2KeEWR8xZ4lUt+jEWkWJxJBYgkWa7NLy5WXWl5FilzhfoKwEAzzkwYI3DhTQUoVYpYR10FYCTPaDbJ2heQUwGfR0kFELmt6Utu9Jmz6dmFpmmR7v141w1XBiCBNFNacyKmCxT59kgHGBIQ4g7UkpRzESuwaCoQ+YZxqwGUGaUwrvvStqazLeRLj/bTZUTQB5rQfg1jjac9e8qAzFgZKbDMALpj1Kz3Z0WKjiGIfex++x6H98PgK4d/APiDpdwStyBoAAAAAElFTkSuQmCC)","hand.png":"url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAQAAABKfvVzAAAB50lEQVR4Xq2TwUsUcRzF3yy52TboHiKVLBCElb1479g5kgKPCkKs4ME6eAiiP0GELileStew6NLJq5Sihw6BG2VlECymB2PVXd10Zl7vN+OuOjNLl35fZhiY+fzee9/vb4D/tAow9fafu90BsqrvnXzNBwSTTBAZ2I3BkSbeYBMzLHNRn9/nEFHCvYZAutDHDf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2au31i24QK35cEhpriQAzbUp92AS1GKqI7odL5F1jM9bzV7KzoyVLvfbDhKAoYZ4wGp/NFKU8Br6scS9VrM7Fw8a56/8A271ovb0pkF9m2UPy2AWGd/k4sYdpal/7+fH4cTxvaPsGo6C3EXysWYWQafIR2cqSnFyV237CM6ADOowyM8Si+xkkCsztB2RIYZCFT2QB1mYVdwSSSza/N85nD1qDl27cyA76EQ1k6bqtESiRagrXFsdyBxQq+ySnfIhtbJ6gHX2bBprQvmAHwKH/GDBmRCDyibP4Od/HLcNZ0KcCSnkmLQsKEd4mmvfgTMhybGCb0zI4RPb1bSbUtnDUvHz4yGJ7BUWx2+5Iu7Rc33AhQAAAABJRU5ErkJggg==)"};var Jc=Object.create(null),hS=3/4,Vl=class{constructor(Z){this.HOTSPOT_32=Z.HOTSPOT_32,this.IMAGE_NAME_32=Z.IMAGE_NAME_32,this.cPointerCursor=Z.cPointerCursor,this.cTextCursor=Z.cTextCursor}getCursor(Z){if(Jc[Z])return Jc[Z];if(this.IMAGE_NAME_32[Z])return this.buildCursor(Z);switch(Z){case this.cPointerCursor:return"default";case this.cTextCursor:return"text";default:throw new Error(`Unknown cursor: ${Z}`)}}buildCursor(Z){let Bt=this.IMAGE_NAME_32[Z],Ft=`${lS[Bt]} ${this.HOTSPOT_32[Z*2]*hS} ${this.HOTSPOT_32[Z*2+1]*hS}, default`;return Jc[Z]=Ft,Ft}};var El=class{constructor(Z,Bt){this.title=Z,this.rootElement=Bt,this.elements=[],this.dialogElement=null}setLayout(Z,Bt){this.hLayout=TS(Z),this.vLayout=`${TS(Bt)} auto`}add(Z,Bt,ot,Ft,p1){this.elements.push({component:Z,x:Bt,y:ot,x2:Ft,y2:p1})}createTextField(Z,Bt){return new Yc(Z,Bt)}createLabel(Z){return new zc(Z)}createComboBox(){return new Kc}createCheckBox(Z){return new Xc(Z)}setEventConsumer(Z){this.consumer=Z}showMessage(Z){window.alert(Z)}showDialog(Z){let Bt=document.createElement("dialog"),ot=this.rootElement.getBoundingClientRect();Object.assign(Bt.style,{position:"absolute",marginBlock:0,left:`${ot.left}px`,right:`${document.body.parentElement.clientWidth-ot.right}px`,top:`${this.rootElement.offsetTop+30}px`}),this.dialogElement=Bt,this.rootElement.getRootNode().append(Bt);let Ft=document.createElement("form");Ft.style.display="grid",Ft.style.gridTemplateColumns=this.hLayout,Ft.style.gridTemplateRows=this.vLayout,Ft.addEventListener("submit",i1=>{i1.preventDefault(),this.consumer.fireOk(),Z()}),Bt.append(Ft);for(let{component:i1,x:s1,y:o1,x2:n0,y2:N0}of this.elements){let M0=document.createElement("div");n0===void 0?(M0.style.gridColumn=`${s1+1} / ${s1+2}`,M0.style.gridRow=`${o1+1} / ${o1+2}`):(M0.style.gridColumn=`${s1+1} / ${n0+2}`,M0.style.gridRow=`${o1+1} / ${N0+2}`),M0.append(i1.getElement()),Ft.append(M0)}let p1=document.createElement("div");Object.assign(p1.style,{display:"flex",flexDirection:"row-reverse",gap:"15px",gridColumn:"1 / -1",gridRow:"-1"}),Ft.append(p1);let Rt=document.createElement("button");Rt.type="submit",Rt.textContent="OK",p1.append(Rt);let y1=document.createElement("button");y1.type="button",y1.textContent="Cancel",y1.addEventListener("click",()=>{this.consumer.fireCancel(),Z()}),p1.append(y1),Bt.showModal(),Bt.addEventListener("cancel",()=>{this.consumer.fireCancel(),Z()})}disposeDialog(){this.dialogElement!==null&&(this.dialogElement.remove(),this.dialogElement=null)}},G2=class{setEventHandler(Z){this.eventHandler=Z}fireEvent(Z,Bt){this.eventHandler(Z,Bt)}},zc=class extends G2{constructor(Z){super(),this.element=document.createElement("label"),this.setText(Z)}setText(Z){this.element.textContent=Z}getElement(){return this.element}},Yc=class extends G2{constructor(){super(),this.element=document.createElement("input"),this.element.type="text"}setText(Z){this.element.value=Z}getText(){return this.element.value}getElement(){return this.element}},Kc=class extends G2{constructor(){super(),this.element=document.createElement("select"),this.element.addEventListener("change",()=>{this.fireEvent(2,this.element.selectedIndex)})}setEnabled(Z){this.element.disabled=!Z}addItem(Z){let Bt=document.createElement("option");Bt.textContent=Z,this.element.append(Bt)}getSelectedIndex(){return this.element.selectedIndex}setSelectedIndex(Z){this.element.selectedIndex=Z}setSelectedItem(Z){let Bt=this.element.options;for(let ot=0;ot<Bt.length;ot++)Bt[ot].textContent===Z&&(this.element.selectedIndex=ot)}getSelectedItem(){return this.element.options[this.element.selectedIndex].textContent}removeAllItems(){this.element.innerHTML=""}setEditable(){}getElement(){return this.element}},Xc=class extends G2{constructor(Z){super();let Bt=document.createElement("label"),ot=document.createElement("input");ot.type="checkbox",ot.addEventListener("change",()=>{this.fireEvent(3,ot.checked?1:0)}),Bt.append(ot),Bt.append(Z),this.element=Bt,this.checkBox=ot}setEnabled(Z){this.checkBox.disabled=!Z}isSelected(){return this.checkBox.checked}setSelected(Z){this.checkBox.checked=Z}getElement(){return this.element}};function TS(w){return w.map(Z=>Z>0?`${Z}px`:"auto").join(" ")}var Yo=class{constructor(Z){this.imageData=Z,this.dataView=new DataView(Z.data.buffer)}getWidth(){return this.imageData.width}getHeight(){return this.imageData.height}getRGB(Z,Bt){let ot=this.dataView.getInt32((Bt*this.imageData.width+Z)*4,!1);return(ot&255)<<24|ot>>>8}setRGB(Z,Bt,ot){let Ft=ot>>>24&255,p1=ot<<8|Ft;this.dataView.setInt32((Bt*this.imageData.width+Z)*4,p1,!1)}toDataURL(){let Z=document.createElement("canvas"),Bt=Z.getContext("2d");return Z.width=this.imageData.width,Z.height=this.imageData.height,Bt.putImageData(this.imageData,0,0),Z.toDataURL("image/png")}};var Sl=class{constructor(Z,Bt,ot){this.canvasElement=Z,this.dialogRoot=Bt,this.JavaEditorArea=ot}register(Z){this.javaUiHelper=Z,this.cursorManager=new Vl(this.JavaEditorArea,Z)}grabFocus(){this.canvasElement.focus({preventScroll:!0})}setCursor(Z){this.canvasElement.style.cursor=this.cursorManager.getCursor(Z)}showHelpDialog(){}createImage(Z,Bt){let ot=new ImageData(Z,Bt);return new Yo(ot)}createImageFromBase64(Z,Bt,ot){ot=ot.replaceAll(/%\d+%/g,y1=>"A".repeat(Number(y1.slice(1,-1))));let Ft=LS(ot),p1=new Uint8ClampedArray(Ft),Rt=new ImageData(p1,Z,Bt);return new Yo(Rt)}createDialog(Z){return new El(Z,this.dialogRoot)}runLater(Z){typeof requestAnimationFrame=="function"?requestAnimationFrame(Z):typeof setImmediate=="function"?setImmediate(Z):setTimeout(Z,0)}};function cS(w,Z,Bt,ot,Ft,p1,Rt,y1){let{readOnly:i1=!1,initialMode:s1="molecule",initialFragment:o1=!1}=Z,n0=document.createElement("div");n0.dataset.openchemlibCanvasEditor="true",Object.assign(n0.style,{width:"100%",height:"100%",display:"flex",flexDirection:"row",alignItems:"start",backgroundColor:"white",touchAction:"none",userSelect:"none",webkitUserSelect:"none"});let N0=n0.attachShadow({mode:"open"});N0.adoptedStyleSheets=[sS()];let M0=null;i1||(M0=document.createElement("canvas"),N0.append(M0));let Se=document.createElement("div");Object.assign(Se.style,{width:"100%",height:"100%"}),N0.append(Se);let Xe=document.createElement("canvas");Xe.tabIndex=0,Object.assign(Xe.style,{outline:"none"}),Se.append(Xe),w.append(n0);let dA=new p1(new Sl(Xe,Se,ot)),JP=new ot(YPt(s1,ot),new Hl(Xe,Bt),dA);if(o1)if(s1==="molecule"){let pA=new Rt(0,0);pA.setFragment(!0),JP.setMolecule(pA)}else{let pA=y1.create();pA.setFragment(!0),JP.setReaction(pA)}dA.setEditorArea(JP);let J2=i1?null:new Ft(JP,new Ml(M0),dA);function z2(pA){Xe.style.width=`${pA.width}px`,Xe.width=Math.floor(pA.width*T9),Xe.style.height=`${pA.height}px`,Xe.height=Math.floor(pA.height*T9),pA.width>0&&pA.height>0&&JP.repaint()}let Ko=Se.getBoundingClientRect();z2(Ko);let Y2=new ResizeObserver(([pA])=>{z2(pA.contentRect)});Y2.observe(Se);let K2=null,X2=null,Z2=null;i1||(K2=Gc(Xe,JP,ot),X2=yS(Se,Xe,JP,ot,Rt),Z2=Gc(M0,J2,ot));function Xo(){n0.remove(),Y2.disconnect(),K2?.(),X2?.(),Z2?.()}return{editorArea:JP,toolbar:J2,uiHelper:dA,destroy:Xo}}function YPt(w,Z){switch(w){case"molecule":return 0;case"reaction":return Z.MODE_REACTION|Z.MODE_MULTIPLE_FRAGMENTS;default:throw new Error(`Invalid initial mode: ${w}`)}}function wS(w,Z,Bt,ot,Ft){class p1{#t;#e;#P;#n;#f;#r;constructor(y1,i1={}){let{editorArea:s1,toolbar:o1,uiHelper:n0,destroy:N0}=cS(y1,i1,M0=>this.#i(M0),w,Z,Bt,ot,Ft);this.#t=s1,this.#e=o1,this.#P=n0,this.#n=null,this.#f={[w.EDITOR_EVENT_MOLECULE_CHANGED]:"molecule",[w.EDITOR_EVENT_SELECTION_CHANGED]:"selection",[w.EDITOR_EVENT_HIGHLIGHT_ATOM_CHANGED]:"highlight-atom",[w.EDITOR_EVENT_HIGHLIGHT_BOND_CHANGED]:"highlight-bond"},this.#r=N0}getMode(){return this.#A(),this.#t.getMode()&w.MODE_REACTION!==0?"reaction":"molecule"}setMolecule(y1){this.#A(),this.#t.setMolecule(y1)}getMolecule(){return this.#A(),this.#t.getMolecule()}setReaction(y1){this.#A(),this.#t.setReaction(y1)}getReaction(){return this.#A(),this.#t.getReaction()}setOnChangeListener(y1){this.#A(),this.#n=y1}removeOnChangeListener(){this.#A(),this.#n=null}clearAll(){this.#A(),this.#t.clearAll()}destroy(){this.#A(),this.#r(),this.#t=null,this.#e=null,this.#P=null,this.#n=null,this.#r=null}get isDestroyed(){return!this.#t}moleculeChanged(){this.#A(),this.#t.moleculeChanged()}#A(){if(this.isDestroyed)throw new Error("CanvasEditor has been destroyed")}#i(y1){if(!this.#n)return;let{what:i1,isUserEvent:s1}=y1;this.#n({type:this.#f[i1],isUserEvent:s1})}}return p1}function gS(w,Z,Bt,ot){class Ft extends HTMLElement{static MODE=Object.freeze(Object.create({MOLECULE:"molecule",REACTION:"reaction"}));static observedAttributes=Object.freeze(["idcode","fragment","mode","readonly"]);#t={idcode:"",fragment:!1,mode:Ft.MODE_MOLECULE,readonly:!1};get idcode(){return this.#t.idcode}set idcode(Rt){this.#t.idcode=String(Rt),this.setAttribute("idcode",this.#t.idcode)}get fragment(){return this.#t.fragment}set fragment(Rt){this.#t.fragment=!!Rt,this.#t.fragment?this.setAttribute("fragment",""):this.removeAttribute("fragment")}get mode(){return this.#t.mode}set mode(Rt){this.#t.mode=String(Rt),this.setAttribute("mode",this.#t.mode)}get readonly(){return this.#t.readonly}set readonly(Rt){this.#t.readonly=!!Rt,this.#t.readonly?this.setAttribute("readonly",""):this.removeAttribute("readonly")}setMolecule(Rt){this.fragment=Rt.isFragment(),this.idcode=`${Rt.getIDCode()} ${Rt.getIDCoordinates()}`,this.#e.setMolecule(Rt)}getMolecule(){return this.#e.getMolecule()}setReaction(Rt){this.fragment=Rt.isFragment(),this.idcode=ot.encode(Rt,{keepAbsoluteCoordinates:!0,mode:ot.INCLUDE_MAPPING|ot.INCLUDE_COORDS|ot.RETAIN_REACTANT_AND_PRODUCT_ORDER})??"",this.#e.setReaction(Rt)}getReaction(){return this.#e.getReaction()}clearAll(){this.#e.clearAll(),this.idcode=""}moleculeChanged(){this.#e.moleculeChanged()}#e;#P(){this.#e||(this.#e=new w(this,{readOnly:this.readonly,initialMode:this.mode}),this.#e.setOnChangeListener(this.#o),requestIdleCallback(()=>this.#n()))}#n(){switch(this.mode){case Ft.MODE.MOLECULE:return this.#r();case Ft.MODE.REACTION:return this.#A();default:throw new Error(`Mode ${this.mode} is not supported`)}}#f(Rt){let y1=Rt.indexOf(" ");if(y1===-1)return Z.fromIDCode(Rt);let i1=Rt.slice(0,y1),s1=Rt.slice(y1+1);return Z.fromIDCode(i1,s1)}#r(){let Rt=this.#f(this.idcode);Rt.setFragment(this.fragment),this.#e.setMolecule(Rt)}#A(){let Rt=ot.decode(this.idcode,{ensureCoordinates:!0})??Bt.create();Rt.setFragment(this.fragment),this.#e.setReaction(Rt)}#i=!1;#Q(Rt){this.#i=!0;try{Rt()}finally{this.#i=!1}}#o=Rt=>{let y1=this.idcode,i1=this.fragment;this.#Q(()=>{if(Rt.type==="molecule")switch(this.mode){case Ft.MODE.MOLECULE:{let o1=this.getMolecule();this.idcode=`${o1.getIDCode()} ${o1.getIDCoordinates()}`,this.fragment=o1.isFragment();break}case Ft.MODE.REACTION:{let o1=this.getReaction();this.idcode=ot.encode(o1,{keepAbsoluteCoordinates:!0,mode:ot.INCLUDE_MAPPING|ot.INCLUDE_COORDS|ot.RETAIN_REACTANT_AND_PRODUCT_ORDER}),this.fragment=o1.isFragment();break}default:throw new Error(`Unsupported mode ${this.mode}`)}});let s1=new CustomEvent("change",{detail:Rt,bubbles:!0});if(this.dispatchEvent(s1),Rt.mode==="molecule"){if(this.idcode!==y1){let o1=new CustomEvent("idcode-changed",{detail:this.idcode,bubbles:!0});this.dispatchEvent(o1)}if(this.fragment!==i1){let o1=new CustomEvent("fragment-changed",{detail:this.fragment,bubbles:!0});this.dispatchEvent(o1)}}};#D(){this.#e&&(this.#e.destroy(),this.#e=void 0)}#u(){this.#D(),this.#P()}connectedCallback(){this.#t={idcode:this.getAttribute("idcode")||"",fragment:this.hasAttribute("fragment"),mode:this.getAttribute("mode")||Ft.MODE.MOLECULE,readonly:this.hasAttribute("readonly")},this.#P()}disconnectedCallback(){this.#D()}adoptedCallback(){this.connectedCallback()}attributeChangedCallback(Rt,y1,i1){if(!this.#e||this.#i)return;(()=>{switch(Rt){case"idcode":return this.#t.idcode=String(i1),()=>this.#n();case"fragment":return this.#t.fragment=i1!==null,()=>this.#n();case"mode":return this.#t.mode=String(i1),()=>this.#u();case"readonly":return this.#t.readonly=i1!==null,()=>this.#u();default:throw new Error("unsupported attribute change")}})()()}}return Ft}function Zc(w){let{GenericEditorArea:Z,GenericEditorToolbar:Bt,GenericUIHelper:ot,Molecule:Ft,Reaction:p1,ReactionEncoder:Rt}=w,y1=wS(Z,Bt,ot,Ft,p1);function i1(){let s1=customElements.get("openchemlib-editor");if(s1)return s1;let o1=gS(y1,Ft,p1,Rt);customElements.define("openchemlib-editor",o1);let n0=document.createElement("style");return n0.id="openchemlib-editor-default-style",n0.innerHTML=` /* dynamicaly added from openchemlib registerCustomElement with low priority */ openchemlib-editor:defined { display: block; height: 400px; width: 600px; } `,document.head.prepend(n0),o1}w.CanvasEditor=y1,w.registerCustomElement=i1,delete w.GenericEditorArea,delete w.GenericEditorToolbar,delete w.GenericUIHelper}function dS(w){w.prototype.changeCustomLabelPosition=function(Bt){switch(Bt){case"superscript":for(let ot=0;ot<this.getAllAtoms();ot++){let Ft=this.getAtomCustomLabel(ot);Ft&&!Ft.startsWith("]")&&this.setAtomCustomLabel(ot,`]${Ft}`)}break;case"normal":for(let ot=0;ot<this.getAllAtoms();ot++){let Ft=this.getAtomCustomLabel(ot);Ft?.startsWith("]")&&this.setAtomCustomLabel(ot,Ft.slice(1))}break;case"auto":for(let ot=0;ot<this.getAllAtoms();ot++){let Ft=this.getAtomCustomLabel(ot);Ft&&(this.getAtomLabel(ot)==="C"?Ft.startsWith("]")&&this.setAtomCustomLabel(ot,Ft.slice(1)):Ft.startsWith("]")||this.setAtomCustomLabel(ot,`]${Ft}`))}break;case void 0:break;default:break}}}function BS(w){w.prototype.getNextCustomAtomLabel=function(Bt){let ot=Bt||"1",Ft=new Set;for(let Rt=0;Rt<this.getAllAtoms();Rt++){let y1=this.getAtomCustomLabel(Rt);y1&&Ft.add(y1)}let p1=0;for(;Ft.has(ot)&&p1++<100;)ot=KPt(ot);return ot}}function KPt(w){let Z=w.match(/(\d+)/);if(Z){let ot=Number.parseInt(Z[1],10);return w.replace(/(\d+)/,(ot+1).toString())}let Bt=w.match(/([a-yA-Y])([^a-zA-Z]*)$/);if(Bt){let ot=Bt[1],Ft=String.fromCodePoint(ot.codePointAt(0)+1);return Ft==="Z"||Ft==="z"?"1":w.replace(/([a-yA-Y])([^a-zA-Z]*)$/,`${Ft}$2`)}return"1"}function vS(w){let Z=w.fromMolfile;w.fromMolfile=function(ot,Ft={}){let{customLabelPosition:p1}=Ft,Rt=Z.call(this,ot),y1=ot.includes(`\r `)?`\r `:` `,i1=ot.split(y1);if(i1.length<4||!i1[3].includes("V2000"))return Rt;let s1=i1.slice(4+Rt.getAllAtoms()+Rt.getAllBonds());for(let o1=0;o1<s1.length;o1++){let n0=s1[o1];if(n0.startsWith("A ")){let N0=Number(n0.slice(3)),M0=s1[o1+1]?.trim();o1++,!Number.isNaN(N0)&&N0<=Rt.getAllAtoms()&&M0&&!Rt.getAtomCustomLabel(N0-1)&&Rt.setAtomCustomLabel(N0-1,M0)}if(n0.startsWith("V ")){let N0=n0.split(" ").filter(Boolean);if(N0.length>=3){let M0=Number(N0[1]),Se=N0.slice(2).join(" ");!Number.isNaN(M0)&&M0<=Rt.getAllAtoms()&&!Rt.getAtomCustomLabel(M0-1)&&Rt.setAtomCustomLabel(M0-1,Se)}}if(n0.startsWith("M ZZC")){let N0=Number(n0.slice(7,10).trim()),M0=n0.slice(10).trim();N0&&M0&&Rt.setAtomCustomLabel(N0-1,M0)}}return Rt.changeCustomLabelPosition(p1),Rt}}var XPt=["M STY","M SLB","M SAL","M SDT","M SDD","M SED"];function FS(w){let Z=w.prototype.toMolfile;w.prototype.toMolfile=function(ot={}){let Ft=this.getCompactCopy(),{includeCustomAtomLabelsAsALines:p1=!1,includeCustomAtomLabelsAsVLines:Rt=!1,customLabelPosition:y1,removeCustomAtomLabels:i1=!1}=ot;Ft.changeCustomLabelPosition(y1);let s1=Z.call(Ft);if(!p1&&!Rt&&!i1)return s1;let o1=s1.includes(`\r `)?`\r `:` `,n0=s1.split(o1);if(i1&&(n0=n0.filter(Se=>!XPt.some(Xe=>Se.startsWith(Xe)))),n0.length<4||!n0[3].includes("V2000"))return s1;let N0=[];for(let Se=0;Se<Ft.getAllAtoms();Se++){let Xe=Ft.getAtomCustomLabel(Se);if(Xe){let dA=String(Se+1).padStart(3," ");p1&&N0.push(`A ${dA}`,Xe),Rt&&N0.push(`V ${dA} ${Xe}`)}}let M0=n0.findIndex(Se=>Se.startsWith("M END"));return M0===-1?s1:(n0.splice(M0,0,...N0),n0.join(o1))}}function kS(w){let Z=w.prototype.toRxn,Bt=w.prototype.toRxnV3;w.prototype.toRxn=function(Ft={}){return mS(this,Z,Ft)},w.prototype.toRxnV3=function(Ft={}){return mS(this,Bt,Ft)}}function mS(w,Z,Bt){let{programName:ot="",keepIdCode:Ft=!1}=Bt,p1=Z.call(w,ot);return Ft?p1:p1.replace(/^OCL_RXN_V1.0:.*$/m,"")}function bS(w){let Z=w.prototype.toSVG;w.prototype.toSVG=function(ot,Ft,p1,Rt){if(typeof ot!="number"||typeof Ft!="number")throw new Error("Molecule#toSVG requires width and height to be specified");Rt=Rt||{};let y1=Rt.factorTextSize||1,i1=Rt.autoCrop===!0,s1=Rt.autoCropMargin===void 0?5:Rt.autoCropMargin,o1=Z.call(this,ot,Ft,y1,i1,s1,p1,Rt),n0=/svg id="(.*)" xmlns/.exec(o1)[1];return o1=o1.replace("<style>",`<style> #${n0} text {font-family: sans-serif;}`),o1=o1.replace("line {",`#${n0} line {`),o1=o1.replace("polygon {",`#${n0} polygon {`),Rt.fontWeight&&(o1=o1.replaceAll("font-size=",`font-weight="${Rt.fontWeight}" font-size=`)),Rt.strokeWidth&&(o1=o1.replaceAll(/stroke-width="[^"]+"/g,`stroke-width="${Rt.strokeWidth}"`)),o1}}function RS(w){let{ConformerGenerator:Z,ForceFieldMMFF94:Bt,Molecule:ot,Reaction:Ft}=w;Z.prototype.molecules=function*(){let s1;for(;(s1=this.getNextConformerAsMolecule())!==null;)yield s1};let p1={maxIts:4e3,gradTol:1e-4,funcTol:1e-6},Rt=Bt.prototype._minimise;delete Bt.prototype._minimise,Bt.prototype.minimise=function(s1){return s1={...p1,...s1},Rt.call(this,s1.maxIts,s1.gradTol,s1.funcTol)},dS(ot),BS(ot),vS(ot),FS(ot),kS(Ft,ot),bS(ot);function y1(i1){if(!i1)return null;if(i1.includes("V2000")||i1.includes("V3000"))return ot.fromMolfile(i1);try{return ot.fromSmiles(i1)}catch{}try{return ot.fromIDCode(i1)}catch{}return null}ot.fromText=function(s1){let o1=y1(s1);return o1&&o1.getAllAtoms()>0?o1:null},ot.prototype.getOCL=function(){return w}}function af(){}function ZPt(w){let Z=w.document,Bt={},ot={userAgent:"webkit"},Ft=af;Ft.__moduleStartupDone=af;let p1=af,Rt,y1;function i1(){}function s1(){}function o1(){}function n0(){}function N0(){}function M0(){}function Se(){}function Xe(){}function dA(){}function JP(){}function J2(){}function z2(){}function Ko(){}function Y2(){}function K2(){}function X2(){}function Z2(){}function Xo(){}function pA(){}function cr(){}function tD(){}function Wc(){}function _c(){}function $c(){}function eD(){}function ql(){}function Il(){}function ac(){}function aPt(t){}function AD(){}function d1(){}function pS(){}function tw(){}function ew(){}function Aw(){}function gi(){}function xl(){}function D0(){}function nw(){}function Pw(){}function rw(){}function iw(){}function Zo(){}function fw(){}function Dw(){}function uw(){}function Qw(){}function ow(){}function Uw(){}function Lw(){}function Nl(){}function sw(){}function yw(){}function lw(){}function hw(){}function Tw(){}function cw(){}function ww(){}function gw(){}function dw(){}function Bw(){}function vw(){}function Fw(){}function mw(){}function CS(t,e){t.G=e}function HS(t,e){t.d=e}function MS(t,e){t.f=e}function VS(t,e){t.i=e}function ES(t,e){t.i=e}function Ol(t,e){t.I=e}function SS(t,e){t.T=e}function qS(t,e){t.S=e}function IS(t,e){t.O=e}function W2(t,e){t.P=e}function xS(t,e){t.f=e}function NS(t,e){t.n=e}function kw(t,e){t.p=e}function OS(t,e){t.b=e}function GS(t,e){t.e=e}function JS(t,e){t.r=e}function zS(t){t.a=t.b}function Wo(t){this.a=t}function c9(t){this.j=t}function bw(t){this.e=t}function Rw(t){this.e=t}function JA(t){this.b=t}function jw(t){this.a=t}function pw(t){this.a=t}function Cw(t){this.a=t}function Hw(t){this.a=t}function Mw(t){this.a=t}function Vw(t){this.a=t}function Ew(t){this.a=t}function Sw(t){this.a=t}function qw(t){this.a=t}function _2(t){this.a=t}function _o(t){this.a=t}function Iw(t){this.b=t}function nD(t){this.a=t}function $2(){this.i=0}function xw(){this.i=1}function Nw(){this.a=-1}function Gl(){this.b=-1}function di(t){this.a=t}function a2(t){this.a=t}function Jl(t){this.a=t}function zl(t){this.a=t}function Yl(t){this.a=t}function PD(t){this.a=t}function Kl(t){this.a=t}function Xl(t){this.c=t}function Zl(t){this.a=t}function rD(t){this.a=t}function iD(t){this.a=t}function wr(t){this.a=t}function gr(t){this.a=t}function Wl(t){this.b=t}function $o(t){this.b=t}function Ow(t){this.a=t}function Zt(t){this.c=t}function Gw(t){this.c=t}function Jw(t){this.a=t}function _l(t){this.a=t}function zw(t){this.c=t}function Yw(t){this.a=t}function Kw(t){this.a=t}function Xw(t){this.a=t}function Zw(t){this.a=t}function Ww(t){this.a=t}function _w(t){this.a=t}function YS(t,e){t.a=e}function KS(t,e){t.a=e}function XS(t,e){t.d=e}function ZS(t,e){t.e=e}function ao(t,e){t.n=e}function WS(t,e){t.T&=~e}function $w(t,e){t.C[e]=-1}function $l(t,e){mt(t.a,e)}function _S(t,e){mt(t.S,e)}function $S(t,e){au(t.a,e)}function aS(t,e){BO(t.a,e)}function tq(t,e){vO(t.a,e)}function al(t,e){mt(t.a,e)}function zP(t,e){mt(t.a,e)}function tU(t,e){LA(t.d,e)}function eq(t,e){aS(e,t.B)}function Aq(t,e){tq(e,t.v)}function nq(t,e){_q(e,t.f)}function Pq(t,e){t.H[e]=512}function rq(t,e,A){t.k[e]=A}function tu(){fU(this)}function f1(){Tu(this)}function LP(){ju(this)}function t3(t){fX(this,t)}function iq(t){return CK(t)}function fq(t){return qK(t)}function Dq(){return++VV}function aw(){this.a=new BU}function fD(){this.a=new f1}function t7(){this.a=new f1}function eu(){this.c=new f1}function e7(){m9.call(this)}function e3(){m9.call(this)}function dr(){m9.call(this)}function eU(){f1.call(this)}function A7(){f1.call(this)}function n7(){t7.call(this)}function A3(){t7.call(this)}function uq(t){t.a>0&&--t.a}function Qq(t,e){t.q=e,t.T=0}function oq(t,e){t.r=e,t.T=0}function n3(t,e){t.F[e]|=I0}function sP(t,e){t.u[e]|=u0}function Bi(t,e){t.length=e}function Uq(t,e){mt(t.c,e)}function rA(t,e){Mi(t.a,e)}function Lq(t){return t>>>0}function sq(t){return zr(t)}function yq(){return Ff(),s9}function P7(){this.b=new br}function r7(){this.a=new f1}function P3(){m9.call(this)}function i7(){m9.call(this)}function BA(){m9.call(this)}function r3(){m9.call(this)}function f7(){m9.call(this)}function D7(){LQ.call(this,0)}function c0(){c0=d1,Ou()}function lq(t){GE=t,Co=!0}function vi(t){xL(t),t.d=null}function hq(t){_A(),J1(),gn=t}function u7(){Fp(),this.b=Et}function i3(){this.a=new yD}function Q7(){this.a=new lP}function f3(){this.a=new lP}function DD(){this.a=new LP}function Au(t){this.a=Az(t)}function Tq(t){this.a=t,fi(t)}function w9(t){C1.call(this,t)}function o7(){e3.call(this)}function cq(t,e){rA(e,t.a.a)}function AU(t,e,A){t.k[e].a=A}function nU(t,e,A){t.k[e].b=A}function PU(t,e,A){t.k[e].c=A}function wq(t,e){return t.o[e]}function gq(t,e){return t.X[e]}function dq(t,e){return t.Y[e]}function uD(t,e){return t.e[e]}function U7(t,e){return t.J[e]}function b1(t,e){return t.s[e]}function ye(t,e){return t.A[e]}function y0(t,e){return t.B[e]}function X(t,e){return t.C[e]}function Ae(t,e){return t.G[e]}function l1(t,e){return t.H[e]}function Ht(t,e){return t.e[e]}function $1(t,e){return t.o[e]}function O(t,e){return t.j[e]}function Bq(t,e){return t.d[e]}function D3(t,e){return t.e[e]}function QD(t,e){return t.e[e]}function nu(t,e){return t.a[e]}function Br(t,e){return t.a[e]}function J0(t,e){return t.k[e]}function vq(t,e){return t.f[e]}function Pu(t,e){return t.b[e]}function L7(t,e){return t.b[e]}function s7(t,e){return t.c[e]}function Fq(t,e){return t.a[e]}function mq(t,e,A){e8(t.a,A,e)}function kq(t){IJ(t.a,t.c,t.b)}function y7(t){ba.call(this,t)}function l7(t){OU.call(this,t)}function h7(t){OU.call(this,t)}function T7(t){OU.call(this,t)}function c7(t){OU.call(this,t)}function w7(t){w9.call(this,t)}function g9(t){w9.call(this,t)}function g7(t){w9.call(this,t)}function d7(t){GL.call(this,t)}function oD(t){return L1(t),t}function Fi(t){return L1(t),t}function bq(t){return AP*t*t}function Rq(t,e){return t.db[e]}function jq(t){return Di(t),t.B}function pq(t){return Di(t),t.H}function Cq(t){return is(t,t.i)}function Hq(t,e){return dz(t,e)}function Mq(t,e){return uJ(t,e)}function UD(t,e){t.T|=248&(8|e)}function B7(t,e){t.g=new Ki(e)}function mi(t){t.b=null,t.c=0}function p8(t){w9.call(this,t)}function YP(t){w9.call(this,t)}function rU(t){w9.call(this,t)}function v7(t){w9.call(this,t)}function LD(t){w9.call(this,t)}function Vq(t){Bx(t,t.length)}function Eq(t){yx(t,t.length)}function Sq(t){lx(t,t.length)}function qq(t){vx(t,t.length)}function u3(t){Cu(t,t.length)}function iU(t){L1(t),this.a=t}function Q3(t){new f1,this.a=t}function F7(t){return 4e3*t*t}function Iq(t){return 8e3*t*t}function KP(t){return!!t&&t.b}function m7(t){return t.b==t.c}function o3(t,e){return t.a[e]}function d(t,e){return MB(t,e)}function k7(t){return Su(t,t.jb)}function kt(t,e){return t.J[e].a}function pt(t,e){return t.J[e].b}function vA(t,e){return t.J[e].c}function d0(t,e){return t.u[e]&3}function qe(t,e){return t.F[e]&3}function Bn(t,e){return t.w[e]<0}function sD(t,e,A){mD(t.k[e],A)}function xq(t,e){t.c=e,t.T&=-144}function fU(t){t.a=0,t.b=0,t.c=1}function b7(t){this.b=t,this.a=1}function U3(t){g9.call(this,t)}function FA(t){SA.call(this,t,0)}function R7(t){lD.call(this,t,0)}function zA(){J1(),X3.call(this)}function Nq(t){return _A(),_9(t)}function Oq(t){return _A(),a9(t)}function Gq(t){return t.c||cQ(t)}function vr(t,e){return t.k[e].a}function Fr(t,e){return t.k[e].b}function mr(t,e){return t.k[e].c}function j7(){j7=d1,_4=new i1}function L3(){L3=d1,$4=new ac}function ki(){ki=d1,Dl=new LP}function kr(){kr=d1,wo=!1}function p7(t){g9.call(this,t)}function XP(t){YP.call(this,t)}function s3(t){Au.call(this,t)}function DU(t){$o.call(this,t)}function C7(t){DU.call(this,t)}function H7(t){MU.call(this,t)}function M7(t){gB.call(this,t)}function y3(t){C8.call(this,t)}function l3(t){Zw.call(this,t)}function V7(t){pr.call(this,t)}function br(){a2.call(this,"")}function yD(){a2.call(this,"")}function ru(){a2.call(this,"")}function V0(){a2.call(this,"")}function E7(t){Tq.call(this,t.a)}function bi(){j3.call(this,null)}function S7(){this.a=0,this.b=0}function Jq(t,e){BI(t.b,t.a,e)}function iu(t,e){return bv(t,e)}function uU(t,e){return t<e?t:t-e}function K1(t,e){return e*t.c+t.b}function X1(t,e){return e*t.c+t.a}function h3(t,e){return N(t.j,e)}function q7(t,e){return N(t.k,e)}function T3(t,e){return Rq(t.d,e)}function zq(t,e){return wq(t.d,e)}function R0(t,e){return HU(t.d,e)}function Yq(t,e){return N(t.a,e)}function c3(t,e){return N(t.f,e)}function d9(t,e){return N(t.g,e)}function mA(t,e){return t.u[e]&48}function fu(t,e){return t.A[e]==0}function Kq(t,e){return Pf(t.d,e)}function Du(t){return cb(t,x5(t))}function I7(t){return t.l|t.m<<22}function Nn(t){return ut(t,7),t.p}function uu(t){return CU(t),t.n}function Xq(t,e){return t.a+=e,t}function w3(t,e){return t.a+=e,t}function E0(t,e,A){t.s[e]=A,t.T=0}function w0(t,e,A){t.H[e]=A,t.T=0}function x7(t,e){mt(t.f,e),t.d=-1}function N7(t,e){mt(t.g,e),t.d=-1}function Zq(){Ho!=0&&(Ho=0),Mo=-1}function g3(){g3=d1,hE=(ZT(),bo)}function C8(t){this.a=(L1(t),t)}function QU(t){this.a=new Ni(t)}function O7(t){this.a=new y7(t.a)}function Rr(t){this.b=t,this.a=0}function u(t,e){this.b=t,this.a=e}function lD(t,e){this.k=t,this.j=e}function iA(t,e){return t.a[e]&c1}function yP(t,e){return t.c[e]&c1}function Qu(t,e){return t.u[e]&448}function ou(t,e){return t.H[e]&127}function Wq(t,e){return t.C[e]==-1}function Ri(t,e){return X0[t.C[e]]}function oU(t,e){Ia.call(this,t,e)}function hD(t){AX.call(this,t,t.o)}function UU(){xO.call(this,new cr)}function TD(t,e){Uu.call(this,t,e)}function G7(t,e){this.b=t,this.a=e}function ZP(t,e){this.a=t,this.b=e}function Uu(t,e){this.a=t,this.b=e}function J7(t,e){this.a=t,this.b=e}function Ze(t,e){this.a=t,this.b=e}function z7(t,e){this.a=t,this.b=e}function Y7(t,e){this.a=t,this.b=e}function K7(t,e){this.a=t,this.b=e}function LU(t,e){this.b=t,this.a=e}function cD(t,e){this.b=t,this.a=e}function X7(t,e){this.a=t,this.b=e}function Z7(t,e){this.a=t,this.b=e}function sU(t,e){this.k=e,this.j=t}function d3(t,e){this.a=t,this.b=e}function ji(t,e){Uu.call(this,t,e)}function _q(t,e){FG(t.a,t.b,t.c,e)}function $q(t,e){QL(t.c,new Hw(e))}function W7(t,e,A){un(t,A),yn(t,e)}function We(t,e,A,n){t.w[e]=n?-A:A}function wD(t){return t.a.c+t.c.c}function Pn(t){this.b=t,this.a=-2}function _7(t){jD.call(this,t,0)}function $7(){gB.call(this,null)}function lP(){Ni.call(this,null)}function a7(){Al==null&&(Al=[])}function aq(){throw At(new BA)}function B3(){throw At(new BA)}function tI(t){throw new Error(t)}function eI(t,e){return t.exec(e)}function tg(t,e){return mt(t.a,e)}function eg(t,e){return Pf(t.a,e)}function z(t,e,A){return t.D[e][A]}function _(t,e,A){return t.i[e][A]}function xt(t,e,A){return t.k[e][A]}function CA(t,e,A){return t.n[e][A]}function AI(t,e){return t.H[e]==512}function v3(t,e){return N(t.a,e).a}function Ag(t,e){return N(t.a,e).b}function ng(t){return ln(t,1,t.c)>0}function nI(){return new aP(new i8)}function PI(t){return Array.from(t)}function rI(t){w.clearTimeout(t)}function Pg(){pr.call(this,null)}function rg(t){cp(),$a.call(this,t)}function ig(){g3(),Co||gL(),new Mj}function z1(){z1=d1,Ti=new ew}function yU(){yU=d1,Bl=new Pw}function lU(){lU=d1,H4=qA("X",32)}function fg(){fg=d1,Gf=(z1(),$A)}function Dg(){Dg=d1,v8=(z1(),$A)}function iI(t,e){hx(t),t.b.ad(e)}function hU(t,e){Vr(t,t.length,e)}function jr(t,e){Uu.call(this,t,e)}function Lu(t,e){Uu.call(this,t,e)}function ug(t,e){this.a=t,this.b=e}function hP(t,e){this.a=t,this.b=e}function Qg(t,e){this.a=t,this.b=e}function TU(t,e){this.c=t,this.d=e}function og(t,e){this.b=t,this.a=e}function Ug(t,e){this.b=t,this.a=e}function Lg(t,e){this.a=t,this.c=e}function sg(t,e){this.b=t,this.a=e}function cU(t,e){Uu.call(this,t,e)}function wU(t,e){return qU(t.a,e)}function E1(t,e){return G(t,e)>0}function pi(t,e){return G(t,e)<0}function su(t,e){return Bg(e,t.a)}function yg(t,e){return Bg(e,t.a)}function B9(t){return t.b=tv(t.a)}function lg(t,e){return t.a.get(e)}function fI(t){return t.B?t.B.t:1}function Ci(t){return typeof t===n9}function yu(t){return typeof t===h2}function H8(t){return typeof t===mf}function O1(t){return t??null}function F3(t,e){return t==e-1?0:t+1}function lu(t,e){return G(t,e)>=0}function t0(t,e){return G(t,e)==0}function hg(t,e){return G(t,e)<=0}function gt(t,e){return G(t,e)!=0}function DI(t,e){return _A(),Je(t,e)}function uI(t,e){return _A(),qA(t,e)}function QI(t,e){i6.call(this,t,0,e)}function Be(t,e,A){t.J[e].a=A,t.T&=7}function Ie(t,e,A){t.J[e].b=A,t.T&=7}function TP(t,e,A){t.J[e].c=A,t.T&=7}function m3(t,e,A){return t.e[e][A]}function k3(t,e,A){return t.f[e][A]}function Hi(t,e){return(t.u[e]&4)!=0}function gU(t,e){return(t.F[e]&4)!=0}function De(t,e){return t.i[e].length}function b3(t,e){return t.e[e]-t.j[e]}function dU(t,e){return(t.u[e]&8)!=0}function Tg(t,e){return O1(t)===O1(e)}function cg(t){return parseInt(t)||-1}function wg(t){this.b=t,this.c=!1}function pr(t){this.f=t,this.g=!0}function gg(){this.c=new lP,this.b=0}function R3(t){i8.call(this),this.e=t}function hu(t){$5(),wB.call(this,t,0)}function Tu(t){t.a=c(DP,A0,1,0,5,1)}function dg(t){return S0(t.l,t.m,t.h)}function oI(t,e,A){return C5(t.a,e,A)}function Bg(t,e){return t.toFixed(e)}function WP(t){return t?t.fd():null}function Cr(t){return t.a<t.c.size()}function o0(t){return typeof t===n9}function vg(){Co||gL(),this.a=new Mm}function BU(){Ff(),this.g=new qi,Lz()}function j3(t){this.d=new f1,this.c=t}function Mi(t,e){return t.a+=""+e,t}function Fg(t,e){return t.a+=""+e,t}function J(t,e){return t.a+=""+e,t}function cu(t,e){Xi(t,0,t.length,e)}function p3(t,e){dx(t.a,t.a.length,e)}function UI(t,e){return t.j[e]-EL(t,e)}function fA(t,e){return(t.F[e]&64)!=0}function wu(t,e){return(t.F[e]&48)>>4}function mg(t,e){return e==0?t.i:t.j}function M8(t){return wP(t,t.q,t.r,gn)}function LI(t,e){return j0(t.a[e][3])}function sI(t,e){return j0(t.a[e][2])}function kg(t,e){return j0(t.a[e][2])}function bg(t,e){return j0(t.a[e][1])}function yI(t,e,A){e8(t.f,A,e),t.d=-1}function lI(t,e,A){e8(t.g,A,e),t.d=-1}function _P(t,e,A){mt(t.a,new Ze(e,A))}function vU(t,e,A,n){t.a=e,t.b=A,t.c=n}function Rg(t,e,A,n){t.e=e,t.c=A,t.d=n}function gD(t,e,A,n){t.D[e][A]=n,t.T=0}function jg(t,e){this.b=eP(e),this.a=t}function pg(t,e){this.b=eP(e),this.a=t}function Cg(t,e){return t.a+=he(e),t}function Hg(t){ke(),vG.call(this,t)}function Mg(){Zw.call(this,"UTF-8")}function Vg(){Lu.call(this,"Tail",3)}function Eg(){Lu.call(this,"Head",1)}function Sg(t){iG.call(this,t,RN())}function C3(t){QI.call(this,t,new br)}function qg(t){uZ.call(this,t,new br)}function rn(t,e){return wP(t,t.q,t.r,e)}function Ig(t,e){return(t.u[e]&u0)!=0}function v9(t,e){return(t.u[e]&no)!=0}function V8(t