@datagrok/sequence-translator 1.1.0 → 1.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/package.js CHANGED
@@ -1,2 +1,2 @@
1
- var sequencetranslator;(()=>{"use strict";var t={622:(t,e,n)=>{n.d(e,{w:()=>r});class o{constructor(t){this.init(t)}init(t){this.fileContent=t.replace(/\r/g,""),this._atomCount=void 0,this._atomTypes=void 0,this._bondCount=void 0,this._bondTypes=void 0,this.xyzAtomCoordinates=void 0,this._pairsOfBondedAtoms=void 0}get atomCount(){return void 0===this._atomCount&&this.setAtomAndBondCounts(),this._atomCount}get bondCount(){return void 0===this._bondCount&&this.setAtomAndBondCounts(),this._bondCount}get x(){var t;return null!==(t=this.xyzAtomCoordinates)&&void 0!==t||(this.xyzAtomCoordinates=this.parseAtomCoordinates()),this.xyzAtomCoordinates.x}get y(){var t;return null!==(t=this.xyzAtomCoordinates)&&void 0!==t||(this.xyzAtomCoordinates=this.parseAtomCoordinates()),this.xyzAtomCoordinates.y}get z(){var t;return null!==(t=this.xyzAtomCoordinates)&&void 0!==t||(this.xyzAtomCoordinates=this.parseAtomCoordinates()),this.xyzAtomCoordinates.z}get atomTypes(){var t;return null!==(t=this._atomTypes)&&void 0!==t||(this._atomTypes=this.parseAtomTypes()),this._atomTypes}get pairsOfBondedAtoms(){var t;return null!==(t=this._pairsOfBondedAtoms)&&void 0!==t||(this._pairsOfBondedAtoms=this.parseBondedAtomPairs()),this._pairsOfBondedAtoms}get bondTypes(){var t;return null!==(t=this._bondTypes)&&void 0!==t||(this._bondTypes=this.parseBondTypes()),this._bondTypes}setAtomAndBondCounts(){const{atomCount:t,bondCount:e}=this.parseAtomAndBondCounts();this._atomCount=t,this._bondCount=e}getNextColumnIdx(t){for(;!this.isWhitespace(t);)++t;for(;this.isWhitespace(t);)++t;return t}shiftIdxToSpecifiedColumn(t,e){let n=t;const o=this.isWhitespace(n)?e:e-1;for(let t=0;t<o;t++)n=this.getNextColumnIdx(n);return n}parseAtomTypes(){const t=this.atomCount,e=new Array(t);let n=this.getAtomBlockIdx();for(let o=0;o<t;o++)n=this.shiftIdxToAtomType(n),e[o]=this.parseAtomType(n),n=this.getNextLineIdx(n);return e}parseAtomCoordinates(){const t=new Float32Array(this.atomCount),e=new Float32Array(this.atomCount),n=new Float32Array(this.atomCount);let o=this.getAtomBlockIdx();for(let r=0;r<this.atomCount;r++){o=this.shiftIdxToXColumn(o);for(const s of[t,e,n])s[r]=this.parseFloatValue(o),o=this.getNextColumnIdx(o);o=this.getNextLineIdx(o)}return{x:t,y:e,z:n}}parseBondedAtomPairs(){const t=new Array(this.bondCount);let e=this.getBondBlockIdx();for(let n=0;n<this.bondCount;n++){e=this.shiftIdxToBondedAtomsPair(e);const o=new Uint16Array(2);o[0]=this.parseIntValue(e),e=this.getNextColumnIdx(e),o[1]=this.parseIntValue(e),t[n]=o,e=this.getNextLineIdx(e)}return t}parseBondTypes(){const t=this.bondCount,e=new Uint16Array(t);let n=this.getBondBlockIdx();for(let o=0;o<t;o++)n=this.shiftIdxToBondType(n),e[o]=this.parseIntValue(n),n=this.getNextLineIdx(n);return e}isWhitespace(t){const e=this.fileContent[t];return" "===e||"\t"===e}getNextLineIdx(t){return"\n"!==this.fileContent[t]?this.fileContent.indexOf("\n",t)+1:t+1}parseFloatValue(t){return this.parseNumericValue(parseFloat,t)}parseIntValue(t){return this.parseNumericValue(parseInt,t)}parseNumericValue(t,e){let n=e+1;for(;!this.isWhitespace(n);)++n;return t(this.fileContent.substring(e,n))}}class r extends o{constructor(t){super(t),this.init(t)}init(t){super.init(t)}parseAtomType(t){let e=t,n=e;return this.isQuote(e)?(n=this.getNextIdenticalChar(e),e++):n=this.fileContent.indexOf(" ",n),this.fileContent.substring(e,n)}isQuote(t){const e=this.fileContent[t].charCodeAt(0);return 39===e||34===e}getNextIdenticalChar(t){const e=this.fileContent[t];return e?this.fileContent.indexOf(e,t+1):-1}isQuery(){return this.isQueryOrFragment(((t,e)=>{return 39===t||34===t||76===t&&!((n=this.fileContent.charCodeAt(e+1))>64&&n<91||n>96&&n<123);var n}))}isFragment(){return this.isQueryOrFragment((t=>82===t||42===t))}isQueryOrFragment(t){const e=this.atomCount;let n=this.getAtomBlockIdx();for(let o=0;o<e;o++){if(n=this.shiftIdxToAtomType(n),t(this.fileContent.charCodeAt(n),n))return!0;n=this.getNextLineIdx(n)}return!1}}},577:(t,e,n)=>{n.d(e,{u:()=>r});var o=n(622);class r extends o.w{constructor(t){super(t),this.init(t)}shiftIdxToAtomType(t){return this.shiftIdxToSpecifiedColumn(t,4)}getCountsLineIdx(){return this.fileContent.indexOf("M V30 COUNTS ")}getAtomBlockIdx(){let t=this.fileContent.indexOf("M V30 BEGIN ATOM");return t=this.getNextLineIdx(t),t}shiftIdxToXColumn(t){let e=this.shiftIdxToAtomType(t);return this.isQuote(e)?(e=this.getNextIdenticalChar(e),e=this.getNextColumnIdx(e),e):this.shiftIdxToSpecifiedColumn(t,5)}shiftIdxToBondedAtomsPair(t){return this.shiftIdxToSpecifiedColumn(t,5)}shiftIdxToBondType(t){return this.shiftIdxToSpecifiedColumn(t,4)}getBondBlockIdx(){return this.getNextLineIdx(this.fileContent.indexOf("M V30 BEGIN BOND"))}static validate(t){return-1!==t.indexOf("V3000")&&-1!==t.indexOf("M END")}parseAtomAndBondCounts(){let t=this.fileContent.indexOf("M V30 COUNTS ")+14,e=this.fileContent.indexOf(" ",t+1);const n=parseInt(this.fileContent.substring(t,e));return t=e+1,e=this.fileContent.indexOf(" ",t+1),{atomCount:n,bondCount:parseInt(this.fileContent.substring(t,e))}}}},61:(t,e,n)=>{n.d(e,{gw:()=>r}),n(469),n(976);var o;function r(t){return e=this,n=void 0,r=function*(){yield new Promise((e=>setTimeout(e,t)))},new((o=void 0)||(o=Promise))((function(t,s){function i(t){try{l(r.next(t))}catch(t){s(t)}}function a(t){try{l(r.throw(t))}catch(t){s(t)}}function l(e){var n;e.done?t(e.value):(n=e.value,n instanceof o?n:new o((function(t){t(n)}))).then(i,a)}l((r=r.apply(e,n||[])).next())}));var e,n,o,r}!function(t){t.notNull=function(t,e){if(null==t)throw new Error(`${null==e?"Value":e} not defined`)}}(o||(o={}))},604:(t,e,n)=>{function o(t){var e;return"string"==typeof t||t instanceof String?t:"$thrownJsError"in t?o(t.$thrownJsError):t instanceof Error?null!==(e=t.stack)&&void 0!==e?e:t.message:t.toString()}n.d(e,{O:()=>o})},973:(t,e,n)=>{n.d(e,{Z:()=>a});var o=n(537),r=n.n(o),s=n(645),i=n.n(s)()(r());i.push([t.id,".colored-text-input > textarea {\n width: 100%;\n -webkit-text-fill-color: transparent;\n background-color: transparent;\n position: relative;\n z-index: 1;\n resize: none;\n height: 22px; /* Fine tuned value to avoid \"jumping\" of the textarea upon autoresize */\n}\n\n.colored-text-input > div {\n /* The values here are fine tuned to those of the ui.input textarea in order\n * to achieve precise overlap */\n overflow: auto;\n position: absolute;\n pointer-events: none;\n cursor: text;\n z-index: 0;\n max-width: 100%;\n padding: 2px;\n line-height: normal;\n font-family: 'Roboto Mono', 'Roboto Mono Local', monospace;\n font-size: 12px;\n color: transparent;\n white-space: pre-wrap;\n word-wrap: break-word;\n}\n","",{version:3,sources:["webpack://./src/view/css/colored-text-input.css"],names:[],mappings:"AAAA;EACE,WAAW;EACX,oCAAoC;EACpC,6BAA6B;EAC7B,kBAAkB;EAClB,UAAU;EACV,YAAY;EACZ,YAAY,EAAE,wEAAwE;AACxF;;AAEA;EACE;iCAC+B;EAC/B,cAAc;EACd,kBAAkB;EAClB,oBAAoB;EACpB,YAAY;EACZ,UAAU;EACV,eAAe;EACf,YAAY;EACZ,mBAAmB;EACnB,0DAA0D;EAC1D,eAAe;EACf,kBAAkB;EAClB,qBAAqB;EACrB,qBAAqB;AACvB",sourcesContent:[".colored-text-input > textarea {\n width: 100%;\n -webkit-text-fill-color: transparent;\n background-color: transparent;\n position: relative;\n z-index: 1;\n resize: none;\n height: 22px; /* Fine tuned value to avoid \"jumping\" of the textarea upon autoresize */\n}\n\n.colored-text-input > div {\n /* The values here are fine tuned to those of the ui.input textarea in order\n * to achieve precise overlap */\n overflow: auto;\n position: absolute;\n pointer-events: none;\n cursor: text;\n z-index: 0;\n max-width: 100%;\n padding: 2px;\n line-height: normal;\n font-family: 'Roboto Mono', 'Roboto Mono Local', monospace;\n font-size: 12px;\n color: transparent;\n white-space: pre-wrap;\n word-wrap: break-word;\n}\n"],sourceRoot:""}]);const a=i},284:(t,e,n)=>{n.d(e,{Z:()=>a});var o=n(537),r=n.n(o),s=n(645),i=n.n(s)()(r());i.push([t.id,"/* Naming convention: class names should begin with st and tab name (main, axo, sdf) to avoid naming collitions */\n.st-main-input-table {\n width: 100%;\n}\n\n.st-main-input-table td:has(textarea) {\n width: 100%;\n padding-right: 20px;\n}\n\n.st-main-input-table td:has(select) {\n min-width: 120px;\n vertical-align: top;\n}\n\n.st-main-output-table {\n margin-top: 20px;\n margin-right: 20px;\n margin-bottom: 10px;\n}\n\n.st-main-output-table table {\n width: 100%;\n table-layout: fixed;\n}\n\n/* .st-main-output-table table tbody tr td { */\n/* max-width: 20%; */\n/* } */\n\n.st-main-output-table td {\n padding-top: 6px;\n padding-bottom: 6px;\n}\n.st-main-output-table tr:nth-child(even) {\n background-color: var(--grey-1);\n}\n\n.st-main-output-table td:nth-child(odd) {\n width: 120px;\n vertical-align: top;\n}\n\n.st-main-output-table td a {\n overflow-wrap: break-word;\n}\n","",{version:3,sources:["webpack://./src/view/css/main-tab.css"],names:[],mappings:"AAAA,iHAAiH;AACjH;EACE,WAAW;AACb;;AAEA;EACE,WAAW;EACX,mBAAmB;AACrB;;AAEA;EACE,gBAAgB;EAChB,mBAAmB;AACrB;;AAEA;EACE,gBAAgB;EAChB,kBAAkB;EAClB,mBAAmB;AACrB;;AAEA;EACE,WAAW;EACX,mBAAmB;AACrB;;AAEA,8CAA8C;AAC9C,sBAAsB;AACtB,MAAM;;AAEN;EACE,gBAAgB;EAChB,mBAAmB;AACrB;AACA;EACE,+BAA+B;AACjC;;AAEA;EACE,YAAY;EACZ,mBAAmB;AACrB;;AAEA;EACE,yBAAyB;AAC3B",sourcesContent:["/* Naming convention: class names should begin with st and tab name (main, axo, sdf) to avoid naming collitions */\n.st-main-input-table {\n width: 100%;\n}\n\n.st-main-input-table td:has(textarea) {\n width: 100%;\n padding-right: 20px;\n}\n\n.st-main-input-table td:has(select) {\n min-width: 120px;\n vertical-align: top;\n}\n\n.st-main-output-table {\n margin-top: 20px;\n margin-right: 20px;\n margin-bottom: 10px;\n}\n\n.st-main-output-table table {\n width: 100%;\n table-layout: fixed;\n}\n\n/* .st-main-output-table table tbody tr td { */\n/* max-width: 20%; */\n/* } */\n\n.st-main-output-table td {\n padding-top: 6px;\n padding-bottom: 6px;\n}\n.st-main-output-table tr:nth-child(even) {\n background-color: var(--grey-1);\n}\n\n.st-main-output-table td:nth-child(odd) {\n width: 120px;\n vertical-align: top;\n}\n\n.st-main-output-table td a {\n overflow-wrap: break-word;\n}\n"],sourceRoot:""}]);const a=i},865:(t,e,n)=>{n.d(e,{Z:()=>a});var o=n(537),r=n.n(o),s=n(645),i=n.n(s)()(r());i.push([t.id,"/* Naming convention: class names should begin with st and tab name (main, axo, sdf) to avoid naming collitions */\n\n.st-sdf-body {\n padding-right: 20px;\n}\n\n.st-sdf-input-form {\n text-align: right;\n vertical-align: top;\n min-width: 95px;\n}\n\n.st-sdf-direction-choice label {\n min-width: 100px;\n float: right;\n}\n\n.st-sdf-direction-choice div {\n justify-content: right;\n}\n\n.st-sdf-text-input-td { /* Style for td containing textarea */\n width: 100%;\n}\n\n.st-sdf-mol-img {\n margin-right: 30px;\n float: right;\n}\n\n.st-sdf-bool-button-block {\n justify-content: right;\n margin-bottom: 10px;\n}\n\n.st-sdf-bottom {\n flex-direction: row-reverse;\n padding-top: 20px;\n}\n","",{version:3,sources:["webpack://./src/view/css/sdf-tab.css"],names:[],mappings:"AAAA,iHAAiH;;AAEjH;EACE,mBAAmB;AACrB;;AAEA;EACE,iBAAiB;EACjB,mBAAmB;EACnB,eAAe;AACjB;;AAEA;EACE,gBAAgB;EAChB,YAAY;AACd;;AAEA;EACE,sBAAsB;AACxB;;AAEA,wBAAwB,qCAAqC;EAC3D,WAAW;AACb;;AAEA;EACE,kBAAkB;EAClB,YAAY;AACd;;AAEA;EACE,sBAAsB;EACtB,mBAAmB;AACrB;;AAEA;EACE,2BAA2B;EAC3B,iBAAiB;AACnB",sourcesContent:["/* Naming convention: class names should begin with st and tab name (main, axo, sdf) to avoid naming collitions */\n\n.st-sdf-body {\n padding-right: 20px;\n}\n\n.st-sdf-input-form {\n text-align: right;\n vertical-align: top;\n min-width: 95px;\n}\n\n.st-sdf-direction-choice label {\n min-width: 100px;\n float: right;\n}\n\n.st-sdf-direction-choice div {\n justify-content: right;\n}\n\n.st-sdf-text-input-td { /* Style for td containing textarea */\n width: 100%;\n}\n\n.st-sdf-mol-img {\n margin-right: 30px;\n float: right;\n}\n\n.st-sdf-bool-button-block {\n justify-content: right;\n margin-bottom: 10px;\n}\n\n.st-sdf-bottom {\n flex-direction: row-reverse;\n padding-top: 20px;\n}\n"],sourceRoot:""}]);const a=i},645:t=>{t.exports=function(t){var e=[];return e.toString=function(){return this.map((function(e){var n="",o=void 0!==e[5];return e[4]&&(n+="@supports (".concat(e[4],") {")),e[2]&&(n+="@media ".concat(e[2]," {")),o&&(n+="@layer".concat(e[5].length>0?" ".concat(e[5]):""," {")),n+=t(e),o&&(n+="}"),e[2]&&(n+="}"),e[4]&&(n+="}"),n})).join("")},e.i=function(t,n,o,r,s){"string"==typeof t&&(t=[[null,t,void 0]]);var i={};if(o)for(var a=0;a<this.length;a++){var l=this[a][0];null!=l&&(i[l]=!0)}for(var c=0;c<t.length;c++){var u=[].concat(t[c]);o&&i[u[0]]||(void 0!==s&&(void 0===u[5]||(u[1]="@layer".concat(u[5].length>0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=s),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),r&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=r):u[4]="".concat(r)),e.push(u))}},e}},537:t=>{t.exports=function(t){var e=t[1],n=t[3];if(!n)return e;if("function"==typeof btoa){var o=btoa(unescape(encodeURIComponent(JSON.stringify(n)))),r="sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(o),s="/*# ".concat(r," */");return[e].concat([s]).join("\n")}return[e].join("\n")}},803:(t,e)=>{var n;!function(){var o=e||{}||this||window;void 0===(n=function(){return o}.apply(e,[]))||(t.exports=n),o.default=o;var r="http://www.w3.org/2000/xmlns/",s="http://www.w3.org/2000/svg",i=/url\(["']?(.+?)["']?\)/,a={woff2:"font/woff2",woff:"font/woff",otf:"application/x-font-opentype",ttf:"application/x-font-ttf",eot:"application/vnd.ms-fontobject",sfnt:"application/font-sfnt",svg:"image/svg+xml"},l=function(t){return t instanceof HTMLElement||t instanceof SVGElement},c=function(t){if(!l(t))throw new Error("an HTMLElement or SVGElement is required; got "+t)},u=function(t){return new Promise((function(e,n){l(t)?e(t):n(new Error("an HTMLElement or SVGElement is required; got "+t))}))},h=function(t,e,n){var o=t.viewBox&&t.viewBox.baseVal&&t.viewBox.baseVal[n]||null!==e.getAttribute(n)&&!e.getAttribute(n).match(/%$/)&&parseInt(e.getAttribute(n))||t.getBoundingClientRect()[n]||parseInt(e.style[n])||parseInt(window.getComputedStyle(t).getPropertyValue(n));return null==o||isNaN(parseFloat(o))?0:o},d=function(t){for(var e=window.atob(t.split(",")[1]),n=t.split(",")[0].split(":")[1].split(";")[0],o=new ArrayBuffer(e.length),r=new Uint8Array(o),s=0;s<e.length;s++)r[s]=e.charCodeAt(s);return new Blob([o],{type:n})},p={},f=null,m=function(t,e){var n=e||{},o=n.selectorRemap,r=n.modifyStyle,s=n.modifyCss,l=n.fonts,c=n.excludeUnusedCss,u=s||function(t,e){return(o?o(t):t)+"{"+(r?r(e):e)+"}\n"},h=[],d=void 0===l,m=l||[];return(f||(f=Array.from(document.styleSheets).map((function(t){try{return{rules:t.cssRules,href:t.href}}catch(e){return console.warn("Stylesheet could not be loaded: "+t.href,e),{}}})))).forEach((function(e){var n=e.rules,o=e.href;n&&Array.from(n).forEach((function(e){if(void 0!==e.style)if(function(t,e){if(e)try{return t.querySelector(e)||t.parentNode&&t.parentNode.querySelector(e)}catch(t){console.warn('Invalid CSS selector "'+e+'"',t)}}(t,e.selectorText))h.push(u(e.selectorText,e.style.cssText));else if(d&&e.cssText.match(/^@font-face/)){var n=function(t,e){var n=t.cssText.match(i),o=n&&n[1]||"";if(o&&!o.match(/^data:/)&&"about:blank"!==o){var r,s,l=o.startsWith("../")?e+"/../"+o:o.startsWith("./")?e+"/."+o:o;return{text:t.cssText,format:(r=l,s=Object.keys(a).filter((function(t){return r.indexOf("."+t)>0})).map((function(t){return a[t]})),s?s[0]:(console.error("Unknown font format for "+r+". Fonts may not be working correctly."),"application/octet-stream")),url:l}}}(e,o);n&&m.push(n)}else c||h.push(e.cssText)}))})),function(t){return Promise.all(t.map((function(t){return new Promise((function(e,n){if(p[t.url])return e(p[t.url]);var o=new XMLHttpRequest;o.addEventListener("load",(function(){var n=function(t){for(var e="",n=new Uint8Array(t),o=0;o<n.byteLength;o++)e+=String.fromCharCode(n[o]);return window.btoa(e)}(o.response),r=t.text.replace(i,'url("data:'+t.format+";base64,"+n+'")')+"\n";p[t.url]=r,e(r)})),o.addEventListener("error",(function(n){console.warn("Failed to load font from: "+t.url,n),p[t.url]=null,e(null)})),o.addEventListener("abort",(function(n){console.warn("Aborted loading font from: "+t.url,n),e(null)})),o.open("GET",t.url),o.responseType="arraybuffer",o.send()}))}))).then((function(t){return t.filter((function(t){return t})).join("")}))}(m).then((function(t){return h.join("\n")+t}))},g=function(){if(!navigator.msSaveOrOpenBlob&&!("download"in document.createElement("a")))return{popup:window.open()}};o.prepareSvg=function(t,e,n){c(t);var o=e||{},i=o.left,a=void 0===i?0:i,l=o.top,u=void 0===l?0:l,d=o.width,p=o.height,f=o.scale,g=void 0===f?1:f,A=o.responsive,b=void 0!==A&&A,C=o.excludeCss,v=void 0!==C&&C;return function(t){return Promise.all(Array.from(t.querySelectorAll("image")).map((function(t){var e,n=t.getAttributeNS("http://www.w3.org/1999/xlink","href")||t.getAttribute("href");return n?((e=n)&&0===e.lastIndexOf("http",0)&&-1===e.lastIndexOf(window.location.host)&&(n+=(-1===n.indexOf("?")?"?":"&")+"t="+(new Date).valueOf()),new Promise((function(e,o){var r=document.createElement("canvas"),s=new Image;s.crossOrigin="anonymous",s.src=n,s.onerror=function(){return o(new Error("Could not load "+n))},s.onload=function(){r.width=s.width,r.height=s.height,r.getContext("2d").drawImage(s,0,0),t.setAttributeNS("http://www.w3.org/1999/xlink","href",r.toDataURL("image/png")),e(!0)}}))):Promise.resolve(null)})))}(t).then((function(){var o=t.cloneNode(!0);o.style.backgroundColor=(e||{}).backgroundColor||t.style.backgroundColor;var i=function(t,e,n,o){if("svg"===t.tagName)return{width:n||h(t,e,"width"),height:o||h(t,e,"height")};if(t.getBBox){var r=t.getBBox(),s=r.x,i=r.y;return{width:s+r.width,height:i+r.height}}}(t,o,d,p),l=i.width,c=i.height;if("svg"!==t.tagName){if(!t.getBBox)return void console.error("Attempted to render non-SVG element",t);null!=o.getAttribute("transform")&&o.setAttribute("transform",o.getAttribute("transform").replace(/translate\(.*?\)/,""));var f=document.createElementNS("http://www.w3.org/2000/svg","svg");f.appendChild(o),o=f}if(o.setAttribute("version","1.1"),o.setAttribute("viewBox",[a,u,l,c].join(" ")),o.getAttribute("xmlns")||o.setAttributeNS(r,"xmlns",s),o.getAttribute("xmlns:xlink")||o.setAttributeNS(r,"xmlns:xlink","http://www.w3.org/1999/xlink"),b?(o.removeAttribute("width"),o.removeAttribute("height"),o.setAttribute("preserveAspectRatio","xMinYMin meet")):(o.setAttribute("width",l*g),o.setAttribute("height",c*g)),Array.from(o.querySelectorAll("foreignObject > *")).forEach((function(t){t.setAttributeNS(r,"xmlns","svg"===t.tagName?s:"http://www.w3.org/1999/xhtml")})),!v)return m(t,e).then((function(t){var e=document.createElement("style");e.setAttribute("type","text/css"),e.innerHTML="<![CDATA[\n"+t+"\n]]>";var r=document.createElement("defs");r.appendChild(e),o.insertBefore(r,o.firstChild);var s=document.createElement("div");s.appendChild(o);var i=s.innerHTML.replace(/NS\d+:href/gi,'xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href');if("function"!=typeof n)return{src:i,width:l,height:c};n(i,l,c)}));var A=document.createElement("div");A.appendChild(o);var C=A.innerHTML;if("function"!=typeof n)return{src:C,width:l,height:c};n(C,l,c)}))},o.svgAsDataUri=function(t,e,n){return c(t),o.prepareSvg(t,e).then((function(t){var e=t.src,o=t.width,r=t.height,s="data:image/svg+xml;base64,"+window.btoa(decodeURIComponent(encodeURIComponent('<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [<!ENTITY nbsp "&#160;">]>'+e).replace(/%([0-9A-F]{2})/g,(function(t,e){var n=String.fromCharCode("0x"+e);return"%"===n?"%25":n}))));return"function"==typeof n&&n(s,o,r),s}))},o.svgAsPngUri=function(t,e,n){c(t);var r=e||{},s=r.encoderType,i=void 0===s?"image/png":s,a=r.encoderOptions,l=void 0===a?.8:a,u=r.canvg,h=function(t){var e=t.src,o=t.width,r=t.height,s=document.createElement("canvas"),a=s.getContext("2d"),c=window.devicePixelRatio||1;s.width=o*c,s.height=r*c,s.style.width=s.width+"px",s.style.height=s.height+"px",a.setTransform(c,0,0,c,0,0),u?u(s,e):a.drawImage(e,0,0);var h=void 0;try{h=s.toDataURL(i,l)}catch(t){if("undefined"!=typeof SecurityError&&t instanceof SecurityError||"SecurityError"===t.name)return void console.error("Rendered SVG images cannot be downloaded in this browser.");throw t}return"function"==typeof n&&n(h,s.width,s.height),Promise.resolve(h)};return u?o.prepareSvg(t,e).then(h):o.svgAsDataUri(t,e).then((function(t){return new Promise((function(e,n){var o=new Image;o.onload=function(){return e(h({src:o,width:o.width,height:o.height}))},o.onerror=function(){n("There was an error loading the data URI as an image on the following SVG\n"+window.atob(t.slice(26))+"Open the following link to see browser's diagnosis\n"+t)},o.src=t}))}))},o.download=function(t,e,n){if(navigator.msSaveOrOpenBlob)navigator.msSaveOrOpenBlob(d(e),t);else{var o=document.createElement("a");if("download"in o){o.download=t,o.style.display="none",document.body.appendChild(o);try{var r=d(e),s=URL.createObjectURL(r);o.href=s,o.onclick=function(){return requestAnimationFrame((function(){return URL.revokeObjectURL(s)}))}}catch(t){console.error(t),console.warn("Error while getting object URL. Falling back to string URL."),o.href=e}o.click(),document.body.removeChild(o)}else n&&n.popup&&(n.popup.document.title=t,n.popup.location.replace(e))}},o.saveSvg=function(t,e,n){var r=g();return u(t).then((function(t){return o.svgAsDataUri(t,n||{})})).then((function(t){return o.download(e,t,r)}))},o.saveSvgAsPng=function(t,e,n){var r=g();return u(t).then((function(t){return o.svgAsPngUri(t,n||{})})).then((function(t){return o.download(e,t,r)}))}}()},379:t=>{var e=[];function n(t){for(var n=-1,o=0;o<e.length;o++)if(e[o].identifier===t){n=o;break}return n}function o(t,o){for(var s={},i=[],a=0;a<t.length;a++){var l=t[a],c=o.base?l[0]+o.base:l[0],u=s[c]||0,h="".concat(c," ").concat(u);s[c]=u+1;var d=n(h),p={css:l[1],media:l[2],sourceMap:l[3],supports:l[4],layer:l[5]};if(-1!==d)e[d].references++,e[d].updater(p);else{var f=r(p,o);o.byIndex=a,e.splice(a,0,{identifier:h,updater:f,references:1})}i.push(h)}return i}function r(t,e){var n=e.domAPI(e);return n.update(t),function(e){if(e){if(e.css===t.css&&e.media===t.media&&e.sourceMap===t.sourceMap&&e.supports===t.supports&&e.layer===t.layer)return;n.update(t=e)}else n.remove()}}t.exports=function(t,r){var s=o(t=t||[],r=r||{});return function(t){t=t||[];for(var i=0;i<s.length;i++){var a=n(s[i]);e[a].references--}for(var l=o(t,r),c=0;c<s.length;c++){var u=n(s[c]);0===e[u].references&&(e[u].updater(),e.splice(u,1))}s=l}}},569:t=>{var e={};t.exports=function(t,n){var o=function(t){if(void 0===e[t]){var n=document.querySelector(t);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(t){n=null}e[t]=n}return e[t]}(t);if(!o)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");o.appendChild(n)}},216:t=>{t.exports=function(t){var e=document.createElement("style");return t.setAttributes(e,t.attributes),t.insert(e,t.options),e}},565:(t,e,n)=>{t.exports=function(t){var e=n.nc;e&&t.setAttribute("nonce",e)}},795:t=>{t.exports=function(t){var e=t.insertStyleElement(t);return{update:function(n){!function(t,e,n){var o="";n.supports&&(o+="@supports (".concat(n.supports,") {")),n.media&&(o+="@media ".concat(n.media," {"));var r=void 0!==n.layer;r&&(o+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),o+=n.css,r&&(o+="}"),n.media&&(o+="}"),n.supports&&(o+="}");var s=n.sourceMap;s&&"undefined"!=typeof btoa&&(o+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(s))))," */")),e.styleTagTransform(o,t,e.options)}(e,t,n)},remove:function(){!function(t){if(null===t.parentNode)return!1;t.parentNode.removeChild(t)}(e)}}}},589:t=>{t.exports=function(t,e){if(e.styleSheet)e.styleSheet.cssText=t;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(t))}}},29:(t,e,n)=>{n.d(e,{NI:()=>r,mc:()=>o});const o=["A","G","C","U","T"];var r;!function(t){t.HELM="HELM",t.AXOLABS="Axolabs"}(r||(r={}))},895:(t,e,n)=>{n.d(e,{BX:()=>o,Dv:()=>a,VV:()=>l,Xz:()=>c,a_:()=>r,dz:()=>i,pl:()=>s});const o="System:AppData/SequenceTranslator",r="monomer-lib.json",s="System:AppData/SequenceTranslator",i="axolabs-style.json",a="formats-to-helm.json",l="codes-to-symbols.json",c="linkers.json"},996:(t,e,n)=>{n.d(e,{BF:()=>l,Rv:()=>a,VO:()=>u,al:()=>i,iA:()=>c});var o=n(976),r=n(895);const s=new o.FileSource(r.pl);let i,a,l,c;async function u(){[i,a,l,c].every((t=>void 0!==t))||(i=await h(r.dz),a=await h(r.Dv),l=await h(r.VV),c=await h(r.Xz))}async function h(t){let e;try{e=JSON.parse(await s.readAsText(t))}catch(e){const n=e.hasOwnProperty("message")?e.message:e.toString();throw new Error(`Error loading json from ${t}:`+n)}return e}},669:(t,e,n)=>{function o(t){return t.sort(((t,e)=>e.length-t.length))}function r(t,e){const n=document.createElement("a");n.setAttribute("href","data:text/plain;charset=utf-8,"+e),n.setAttribute("download",t),n.click()}n.d(e,{L:()=>r,x:()=>o})},397:(t,e,n)=>{n.d(e,{A:()=>i});var o=n(976),r=n(559),s=n(996);class i{constructor(){const t=r._package.monomerLib;if(null===t)throw new Error("SequenceTranslator: monomer library is null");this.lib=t,this.allMonomers=this.getAllMonomers()}lib;static instance;allMonomers;formatMonomerForViewer(t){const e={};return e.name=t.symbol,e.symbol=t.symbol,e.molfile=t.molfile,e}getAllMonomers(){const t=this.lib.getPolymerTypes();let e=[];for(const n of t){const t=this.lib.getMonomerSymbolsByType(n).map((t=>this.lib.getMonomer(n,t))).filter((t=>null!==t));e=e.concat(t)}return e}getMonomer(t){const e=this.lib.getMonomer("RNA",t);if(void 0===e)throw new Error(`SequenceTranslator: no monomer with symbol ${t}`);return e}static getInstance(){return void 0===i.instance&&(i.instance=new i),i.instance}getMolfileBySymbol(t){return this.getMonomer(t).molfile}getNaturalAnalogBySymbol(t){const e=this.getMonomer(t).naturalAnalog;if(!e)throw new Error(`ST: no natural analog for ${t}`);return e}isModification(t){return!!this.getMolfileBySymbol(t).includes("MODIFICATION")}getCodeToSymbolMap(t){return new Map(Object.entries(s.BF[t]))}getCodesByFormat(t){return Object.keys(s.BF[t])}getTableForViewer(){const t=this.allMonomers.map((t=>this.formatMonomerForViewer(t)));return o.DataFrame.fromObjects(t)}getCodesToWeightsMap(){const t=new Map;return Object.entries(s.BF).forEach((([e,n])=>{Object.entries(n).forEach((([e,n])=>{const o=this.getMonomer(n).meta?.molecularWeight;t.set(e,o)}))})),t}}},837:(t,e,n)=>{function o(t,e=!0){let n="\nDatagrok macromolecule handler\n\n";n+=" 0 0 0 0 0 0 999 V3000\n",n+="M V30 BEGIN CTAB\n";let o="",a="",l="";const c=[];let u=0,h=0,d=0;if(t.antiStrands.length>0)for(let e=0;e<t.antiStrands.length;e++)t.antiStrands[e]=r(t.antiStrands[e]);let p=!1;const f=t.senseStrands.concat(t.antiStrands);let m=0;for(let e=0;e<f.length;e++){f[e]=f[e].replaceAll("(-\nM V30 ","(").replaceAll("-\nM V30 ","").replaceAll(" )",")");const n=s(f[e]),r=i(f[e]);if(e>=t.senseStrands.length?!1===p&&(p=!0,d=0):m=Math.min(m,Math.min(...r.y.filter((t=>t<0)))),p){const t=Math.min(...r.x)-d,e=Math.max(...r.y)+5;for(let e=0;e<r.x.length;e++)r.x[e]-=t;for(let t=0;t<r.y.length;t++)r.y[t]-=e-m}let l=f[e].indexOf("M V30 BEGIN ATOM");l=f[e].indexOf("\n",l);let g=l,A=l;for(let t=0;t<n.natom;t++){g=f[e].indexOf("V30",g)+4,A=f[e].indexOf(" ",g);const n=parseInt(f[e].substring(g,A))+u;f[e]=f[e].slice(0,g)+n+f[e].slice(A),g=f[e].indexOf(" ",g)+1,g=f[e].indexOf(" ",g)+1,A=f[e].indexOf(" ",g);let o=Math.round(1e4*r.x[t])/1e4;f[e]=f[e].slice(0,g)+o+f[e].slice(A),g=f[e].indexOf(" ",g)+1,A=f[e].indexOf(" ",g),o=Math.round(1e4*r.y[t])/1e4,f[e]=f[e].slice(0,g)+o+f[e].slice(A),g=f[e].indexOf("\n",g)+1}const b=f[e].indexOf("M V30 END ATOM");o+=f[e].substring(l+1,b);let C=f[e].indexOf("M V30 BEGIN BOND");C=f[e].indexOf("\n",C),g=C,A=C;for(let t=0;t<n.nbond;t++){g=f[e].indexOf("V30",g)+4,A=f[e].indexOf(" ",g);const t=parseInt(f[e].substring(g,A))+h;f[e]=f[e].slice(0,g)+t+f[e].slice(A),g=f[e].indexOf(" ",g)+1,g=f[e].indexOf(" ",g)+1,A=f[e].indexOf(" ",g);let n=parseInt(f[e].substring(g,A))+u;f[e]=f[e].slice(0,g)+n+f[e].slice(A),g=f[e].indexOf(" ",g)+1,A=Math.min(f[e].indexOf("\n",g),f[e].indexOf(" ",g)),n=parseInt(f[e].substring(g,A))+u,f[e]=f[e].slice(0,g)+n+f[e].slice(A),g=f[e].indexOf("\n",g)+1}const v=f[e].indexOf("M V30 END BOND");a+=f[e].substring(C+1,v);let x=f[e].indexOf("M V30 MDLV30/STEABS ATOMS=(");for(;-1!==x;){x+=28;const t=f[e].indexOf(")",x);f[e].substring(x,t).split(" ").slice(1).forEach((t=>{c.push(parseInt(t)+u)})),x=t,x=f[e].indexOf("M V30 MDLV30/STEABS ATOMS=(",x)}u+=n.natom,h+=n.nbond,d+=Math.max(...r.x)+5}const g=Math.ceil(c.length/4);l+="M V30 MDLV30/STEABS ATOMS=("+c.length+" -\n";for(let t=0;t<g;t++){l+="M V30 ";const e=t+1===g?c.length-4*(g-1):4;for(let n=0;n<e;n++)l+=n+1===e?t===g-1?c[4*t+n]+")\n":c[4*t+n]+" -\n":c[4*t+n]+" "}return n+="M V30 COUNTS "+u+" "+h+" 0 0 0\n",n+="M V30 BEGIN ATOM\n",n+=o,n+="M V30 END ATOM\n",n+="M V30 BEGIN BOND\n",n+=a,n+="M V30 END BOND\n",e&&c.length>0?(n+="M V30 BEGIN COLLECTION\n",n+=l,n+="M V30 END COLLECTION\n"):n=n.replace(/ CFG=\d/g," "),n+="M V30 END CTAB\n",n+="M END",n}function r(t){const e=i(t),n=e.atomIndex.length,o=(Math.max(...e.x)+Math.min(...e.x))/2,r=(Math.max(...e.y)+Math.min(...e.y))/2;for(let t=0;t<n;t++)e.x[t]-=o,e.y[t]-=r;const s=Math.PI,a=Math.cos(s),l=Math.sin(s);for(let t=0;t<n;t++){const n=e.x[t];e.x[t]=n*a-e.y[t]*l,e.y[t]=n*l+e.y[t]*a}const c=Math.max(...e.y);for(let t=0;t<n;t++)e.x[t]+=o,e.y[t]-=c;let u=t.indexOf("M V30 BEGIN ATOM");u=t.indexOf("\n",u);let h=u;for(let o=0;o<n;o++)u=t.indexOf("V30",u)+4,u=t.indexOf(" ",u)+1,u=t.indexOf(" ",u)+1,h=t.indexOf(" ",u)+1,h=t.indexOf(" ",h),u=(t=t.slice(0,u)+e.x[o]+" "+e.y[o]+t.slice(h)).indexOf("\n",u)+1;return t}function s(t){let e=(t=t.replaceAll("\r","")).indexOf("COUNTS")+7,n=t.indexOf(" ",e);const o=parseInt(t.substring(e,n));return e=n+1,n=t.indexOf(" ",e),{natom:o,nbond:parseInt(t.substring(e,n))}}function i(t){const e=s(t);let n=t.indexOf("M V30 BEGIN ATOM");n=t.indexOf("\n",n);let o=n;const r=Array(e.natom),i=Array(e.natom),a=Array(e.natom),l=Array(e.natom);for(let s=0;s<e.natom;s++)n=t.indexOf("V30",n)+4,o=t.indexOf(" ",n),r[s]=parseInt(t.substring(n,o)),n=o+1,o=t.indexOf(" ",n),i[s]=t.substring(n,o),n=o+1,o=t.indexOf(" ",n),a[s]=parseFloat(t.substring(n,o)),n=o+1,o=t.indexOf(" ",n),l[s]=parseFloat(t.substring(n,o)),n=t.indexOf("\n",n)+1;return{atomIndex:r,atomType:i,x:a,y:l}}n.d(e,{$U:()=>i,v5:()=>o})},402:(t,e,n)=>{n.d(e,{K:()=>l});var o=n(669),r=n(397),s=n(996);class i{sequence;invert;codeMap;constructor(t,e=!1,n){this.sequence=t,this.invert=e,this.codeMap=n,this.lib=r.A.getInstance()}lib;parseSequence(){const t=this.parseRawSequence();return this.addLinkers(t)}addLinkers(t){const e=[];return t.forEach(((n,o)=>{const r=this.getSymbolForCode(n);o>0&&function(t){return s.iA.left.includes(t)}(r)&&e.pop(),e.push(r);const i=a(r),l=o===t.length-1,c=o+1<t.length&&a(this.getSymbolForCode(t[o+1]));i||function(t){return s.iA.right.includes(t)}(r)||c||l||e.push("p")})),e}getSymbolForCode(t){let e=this.codeMap.get(t);return e??=t,e}parseRawSequence(){const t=this.getAllCodesOfFormat(),e=[];let n=0;for(;n<this.sequence.length;){const o=t.find((t=>t===this.sequence.substring(n,n+t.length)));this.invert?e.unshift(o):e.push(o),n+=o.length}return e}getAllCodesOfFormat(){let t=Array.from(this.codeMap.keys());return(0,o.x)(t)}}function a(t){return s.iA.phosphate.includes(t)}class l{constructor(t,e=!1,n){this.lib=r.A.getInstance();const o=this.lib.getCodeToSymbolMap(n);this.parser=new i(t,e,o)}parser;lib;convert(){const t=this.parser.parseSequence(),e=[];return t.forEach(((t,n)=>{const o=this.getMonomerMolfile(t,n);e.push(o)})),this.getPolymerMolfile(e)}getMonomerMolfile(t,e){const n=this.lib.getMolfileBySymbol(t);return this.lib.isModification(t)?0===e?this.reflect(n):n:this.rotateNucleotidesV3000(n)}getPolymerMolfile(t){return this.linkV3000(t)}reflect(t){const e=this.extractAtomDataV3000(t),n=e.atomIndex.length,o=e.atomIndex.indexOf(1),r=e.atomIndex.indexOf(n),s=(e.x[r]+e.x[o])/2,i=(e.y[r]+e.y[o])/2;for(let t=0;t<n;t++)e.x[t]-=s,e.y[t]-=i;for(let t=0;t<n;t++)e.x[t]=-e.x[t];const a=e.x[o];for(let t=0;t<n;t++)e.x[t]-=a;let l=t.indexOf("M V30 BEGIN ATOM");l=t.indexOf("\n",l);let c=l;for(let o=0;o<n;o++)l=t.indexOf("V30",l)+4,l=t.indexOf(" ",l)+1,l=t.indexOf(" ",l)+1,c=t.indexOf(" ",l)+1,c=t.indexOf(" ",c),l=(t=t.slice(0,l)+e.x[o]+" "+e.y[o]+t.slice(c)).indexOf("\n",l)+1;return t}extractAtomDataV3000(t){const e=this.extractAtomsBondsNumbersV3000(t);let n=t.indexOf("M V30 BEGIN ATOM");n=t.indexOf("\n",n);let o=n;const r=Array(e.natom),s=Array(e.natom),i=Array(e.natom),a=Array(e.natom);for(let l=0;l<e.natom;l++)n=t.indexOf("V30",n)+4,o=t.indexOf(" ",n),r[l]=parseInt(t.substring(n,o)),n=o+1,o=t.indexOf(" ",n),s[l]=t.substring(n,o),n=o+1,o=t.indexOf(" ",n),i[l]=parseFloat(t.substring(n,o)),n=o+1,o=t.indexOf(" ",n),a[l]=parseFloat(t.substring(n,o)),n=t.indexOf("\n",n)+1;return{atomIndex:r,atomType:s,x:i,y:a}}extractAtomsBondsNumbersV3000(t){let e=(t=t.replaceAll("\r","")).indexOf("COUNTS")+7,n=t.indexOf(" ",e);const o=parseInt(t.substring(e,n));return e=n+1,n=t.indexOf(" ",e),{natom:o,nbond:parseInt(t.substring(e,n))}}rotateNucleotidesV3000(t){const e=this.extractAtomDataV3000(t),n=e.atomIndex.length,o=e.atomIndex.indexOf(1),r=e.atomIndex.indexOf(n);n>8&&this.fix5Prime(e,o,r);const s=(e.x[r]+e.x[o])/2,i=(e.y[r]+e.y[o])/2;for(let t=0;t<n;t++)e.x[t]-=s,e.y[t]-=i;let a=0;if(0===e.x[o])a=e.y[o]>e.y[r]?Math.PI/2:3*Math.PI/2;else if(0===e.y[o])a=e.x[o]>e.x[r]?Math.PI:0;else{const t=e.y[o]/e.x[o];a=t>0?e.x[o]>0?Math.PI-Math.atan(t):2*Math.PI-Math.atan(t):e.x[o]>0?-Math.PI-Math.atan(t):Math.atan(t)}const l=Math.cos(a),c=Math.sin(a);for(let t=0;t<n;t++){const n=e.x[t];e.x[t]=n*l-e.y[t]*c,e.y[t]=n*c+e.y[t]*l}const u=e.x[o];for(let t=0;t<n;t++)e.x[t]-=u;let h=t.indexOf("M V30 BEGIN ATOM");h=t.indexOf("\n",h);let d=h;for(let o=0;o<n;o++)h=t.indexOf("V30",h)+4,h=t.indexOf(" ",h)+1,h=t.indexOf(" ",h)+1,d=t.indexOf(" ",h)+1,d=t.indexOf(" ",d),h=(t=t.slice(0,h)+e.x[o]+" "+e.y[o]+t.slice(d)).indexOf("\n",h)+1;return t}linkV3000(t,e=!0){let n="\nDatagrok macromolecule handler\n\n";n+=" 0 0 0 0 0 0 999 V3000\n",n+="M V30 BEGIN CTAB\n";let o="",r="",s="";const i=[];let a=0,l=0,c=0;for(let e=0;e<t.length;e++){const n=t[e].includes("MODIFICATION")&&0===e;let s=0;n&&(s=this.extractAtomDataV3000(t[e]).atomIndex.length),t[e]=t[e].replaceAll("(-\nM V30 ","(").replaceAll("-\nM V30 ","").replaceAll(" )",")");const u=this.extractAtomsBondsNumbersV3000(t[e]),h=this.extractAtomDataV3000(t[e]);let d=t[e].indexOf("M V30 BEGIN ATOM");d=t[e].indexOf("\n",d);let p=d,f=d;for(let o=0;o<u.natom;o++)if(1!==h.atomIndex[o]||0===e){p=t[e].indexOf("V30",p)+4,f=t[e].indexOf(" ",p);let o=0;n?(o=parseInt(t[e].substring(p,f)),1===o?o=s:o===s&&(o=1),o+=a):o=parseInt(t[e].substring(p,f))+a,t[e]=t[e].slice(0,p)+o+t[e].slice(f),p=t[e].indexOf(" ",p)+1,p=t[e].indexOf(" ",p)+1,f=t[e].indexOf(" ",p);const r=c-h.x[0];let i=Math.round(1e4*(parseFloat(t[e].substring(p,f))+r))/1e4;t[e]=t[e].slice(0,p)+i+t[e].slice(f),p=t[e].indexOf(" ",p)+1,f=t[e].indexOf(" ",p),i=Math.round(1e4*parseFloat(t[e].substring(p,f)))/1e4,t[e]=t[e].slice(0,p)+i+t[e].slice(f),p=t[e].indexOf("\n",p)+1}else p=t[e].indexOf("M V30",p)-1,f=t[e].indexOf("\n",p+1),t[e]=t[e].slice(0,p)+t[e].slice(f);const m=t[e].indexOf("M V30 END ATOM");o+=t[e].substring(d+1,m);let g=t[e].indexOf("M V30 BEGIN BOND");g=t[e].indexOf("\n",g),p=g,f=g;for(let o=0;o<u.nbond;o++){p=t[e].indexOf("V30",p)+4,f=t[e].indexOf(" ",p);const o=parseInt(t[e].substring(p,f))+l;t[e]=t[e].slice(0,p)+o+t[e].slice(f),p=t[e].indexOf(" ",p)+1,p=t[e].indexOf(" ",p)+1,f=t[e].indexOf(" ",p);let r=0;n?(r=parseInt(t[e].substring(p,f)),1===r?r=s:r===s&&(r=1),r+=a):r=parseInt(t[e].substring(p,f))+a,t[e]=t[e].slice(0,p)+r+t[e].slice(f),p=t[e].indexOf(" ",p)+1,f=Math.min(t[e].indexOf("\n",p),t[e].indexOf(" ",p)),r=0,n?(r=parseInt(t[e].substring(p,f)),1===r?r=s:r===s&&(r=1),r+=a):r=parseInt(t[e].substring(p,f))+a,t[e]=t[e].slice(0,p)+r+t[e].slice(f),p=t[e].indexOf("\n",p)+1}const A=t[e].indexOf("M V30 END BOND");r+=t[e].substring(g+1,A);let b=t[e].indexOf("M V30 MDLV30/STEABS ATOMS=(");for(;-1!==b;){b+=28;const n=t[e].indexOf(")",b);t[e].substring(b,n).split(" ").slice(1).forEach((t=>{i.push(parseInt(t)+a)})),b=n,b=t[e].indexOf("M V30 MDLV30/STEABS ATOMS=(",b)}a+=u.natom-1,l+=u.nbond,c+=n?Math.max(...h.x):h.x[u.natom-1]-h.x[0]}const u=Math.ceil(i.length/4);s+="M V30 MDLV30/STEABS ATOMS=("+i.length+" -\n";for(let t=0;t<u;t++){s+="M V30 ";const e=t+1===u?i.length-4*(u-1):4;for(let n=0;n<e;n++)s+=n+1===e?t===u-1?i[4*t+n]+")\n":i[4*t+n]+" -\n":i[4*t+n]+" "}return a++,n+="M V30 COUNTS "+a+" "+l+" 0 0 0\n",n+="M V30 BEGIN ATOM\n",n+=o,n+="M V30 END ATOM\n",n+="M V30 BEGIN BOND\n",n+=r,n+="M V30 END BOND\n",e&&i.length>0?(n+="M V30 BEGIN COLLECTION\n",n+=s,n+="M V30 END COLLECTION\n"):n=n.replace(/ CFG=\d/g," "),n+="M V30 END CTAB\n",n+="M END",n}fix5Prime(t,e,n){const o=e+1,r=t.x[o],s=t.y[o],i=t.x[n]-r,a=t.y[n]-s,l=t.x[e]-r,c=t.y[e]-s,u=l*Math.cos(2*Math.PI/3)-c*Math.sin(2*Math.PI/3),h=l*Math.sin(2*Math.PI/3)+c*Math.cos(2*Math.PI/3),d=l-i,p=c-a,f=u-i,m=h-a;Math.sqrt(m*m+f*f)>=Math.sqrt(p*p+d*d)&&(t.x[e]=u+r,t.y[e]=h+s)}}},559:(t,e,n)=>{n.r(e),n.d(e,{_package:()=>Ee,demoDesignPattern:()=>Le,demoTranslateSequence:()=>Be,demoVisualizeDuplex:()=>Pe,getCodeToWeightsMap:()=>Oe,getMolfileFromGcrsSequence:()=>Me,initSequenceTranslatorLibData:()=>Se,linkStrands:()=>Ne,sequenceTranslatorApp:()=>Te,validateSequence:()=>Ie});var o=n(469),r=n(976);const s=ui;var i=n(11);const a=rxjs;var l=n(379),c=n.n(l),u=n(795),h=n.n(u),d=n(569),p=n.n(d),f=n(565),m=n.n(f),g=n(216),A=n.n(g),b=n(589),C=n.n(b),v=n(284),x={};x.styleTagTransform=C(),x.setAttributes=m(),x.insert=p().bind(null,"head"),x.domAPI=h(),x.insertStyleElement=A(),c()(v.Z,x),v.Z&&v.Z.locals&&v.Z.locals;const w=$;var y=n.n(w),E=n(29),T=n(397),S=n(669);class O{sequence;constructor(t){this.sequence=t,this.libWrapper=T.A.getInstance()}libWrapper;getInvalidCodeIndex(t){if(t===E.NI.HELM)return this.sequence.length;const e=["r","d"],n=(0,S.x)(this.libWrapper.getCodesByFormat(t));let o=0;for(;o<this.sequence.length;){const t=n.find((t=>t===this.sequence.substring(o,o+t.length)));if(!t)break;if(o>1&&E.mc.includes(this.sequence[o])&&e.includes(this.sequence[o-2]))break;if(e.includes(this.sequence[o+1])&&E.mc.includes(this.sequence[o])){o++;break}o+=t.length}return o===this.sequence.length&&(o=-1),o}isValidSequence(t){return-1===this.getInvalidCodeIndex(t)}}var I=n(996);class M{sequence;constructor(t){this.sequence=t,this.libWrapper=T.A.getInstance(),this.formats=Object.keys(I.Rv)}libWrapper;formats;getFormat(){if(this.sequence.startsWith("RNA"))return E.NI.HELM;const t=this.getListOfPossibleSynthesizersByFirstMatchedCode();if(0===t.length)return null;const e=new O(this.sequence),n=Array(t.length).fill(0);for(let o=0;o<t.length;++o){const r=t[o];n[o]=e.getInvalidCodeIndex(r)}const o=n.some((t=>-1===t))?-1:Math.max(...n);return t[n.indexOf(o)]}getListOfPossibleSynthesizersByFirstMatchedCode(){const t=this.sequence;let e=[];for(const n of this.formats){let o=(0,S.x)(this.libWrapper.getCodesByFormat(n)),r=0;for(let e=0;e<t.length;e++)if(")"===t[e]&&e!==t.length-1){r=e+1;break}o.some((e=>e===t.slice(r,r+e.length)))&&e.push(n)}return e}}function N(t){let e=0;const n=new M(t).getFormat();null!==n&&(e=new O(t).getInvalidCodeIndex(n));const o=e<0||""===t,r=s.span([]);y()(r).css("-webkit-text-fill-color","var(--grey-6)");const i=s.span([]);return y()(i).css("-webkit-text-fill-color","red"),o?r.innerHTML=t:(r.innerHTML=t.slice(0,e),i.innerHTML=t.slice(e)),[r,i]}var B=n(973),L={};L.styleTagTransform=C(),L.setAttributes=m(),L.insert=p().bind(null,"head"),L.domAPI=h(),L.insertStyleElement=A(),c()(B.Z,L),B.Z&&B.Z.locals&&B.Z.locals;class P{textInputBase;constructor(t,e,n=!0){this.textInputBase=t,this.textInputBase=t,this.painter=e,y()(this.root).addClass("colored-text-input"),n&&this.textInputBase.onInput((()=>{y()(this.textArea).css("height",0),y()(this.textArea).css("height",this.textArea.scrollHeight+"px")})),this.highlights=s.div([]),this.root.appendChild(this.highlights),this.colorize(),this.textInputBase.onInput((()=>this.colorize()))}highlights;painter;get textArea(){return this.textInputBase.root.getElementsByTagName("textarea").item(0)}get root(){return this.textInputBase.root}colorize(){const t=this.painter(this.textInputBase.value);this.highlights.innerHTML="",t.forEach((t=>this.highlights.appendChild(t)))}}var D=n(402);const k="<?>",_={LEFT:"RNA1{",RIGHT:"}$$$$"};class V{sequence;sourceFormat;constructor(t,e){this.sequence=t,this.sourceFormat=e}convertTo(t){const e=Object.keys(I.Rv);if(this.sourceFormat===E.NI.HELM&&e.includes(t))return R(this.sequence,t);if(e.includes(this.sourceFormat)&&t===E.NI.HELM)return q(this.sequence,this.sourceFormat);if([this.sourceFormat,t].every((t=>e.includes(t))))return R(q(this.sequence,this.sourceFormat),t);throw new Error(`ST: unsupported translation direction ${this.sourceFormat} -> ${t}`)}}function F(t){return t.map((t=>t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"))).map((t=>t.includes("(")||t.includes(")")?t:`(?<!\\([^()]*)${t}(?![^()]*\\))`)).join("|")}function H(t,e){return e.length-t.length}function R(t,e){const n=function(t){const e={};return Object.values(t).forEach((t=>{Object.entries(t).forEach((([t,n])=>{const o=n.replace(/\)p/g,")");void 0===e[o]?e[o]=[t]:e[o].push(t)}))})),Object.entries(e).forEach((([t,n])=>{const o=n.sort(H);e[t]=o[0]})),e}(I.Rv[e]),o=new RegExp(F(Object.values(_)),"g");let r=t.replace(o,"");const s=Object.keys(n).sort(H),i=new RegExp(F(s)+"|.","g");return r=r.replace(i,(t=>s.includes(t)?n[t]:"p"===t||"."===t?t:"?")).replace(/\?+/g,k).replace(/p\.|\./g,""),r=r.replace(/\/\//g,"/"),r}function q(t,e){const n=I.Rv[e],o=Object.assign({},...Object.values(n)),r=Object.keys(o).sort(H),s=new RegExp(F(r)+"|\\([^()]*\\)|.","g"),i=F(Array.from(new Set(Object.values(n.phosphateBackbone))).sort(H)),a=new RegExp(`p.(${i})`,"g");let l=t.replace(s,(t=>r.includes(t)?o[t]+".":"?"));return l=l.replace(/\?+/g,`${k}.`),l=l.slice(0,-1),"p"===l[l.length-1]&&(l=l.slice(0,-1)),l=l.replace(a,((t,e)=>e)),`${_.LEFT+l+_.RIGHT}`}var U,G=n(622);!function(t){t.HEADER="V2000",t[t.NUM_OF_HEADER_LINES=3]="NUM_OF_HEADER_LINES",t[t.NUM_OF_COUNTS_DIGITS=3]="NUM_OF_COUNTS_DIGITS",t[t.ATOM_TYPE_COL=4]="ATOM_TYPE_COL",t[t.FIRST_BONDED_ATOM_COL=1]="FIRST_BONDED_ATOM_COL",t[t.BOND_TYPE_COL=3]="BOND_TYPE_COL",t[t.RGP_SHIFT=8]="RGP_SHIFT",t.RGP_LINE="M RGP",t.A_LINE="A ",t.END="M END"}(U||(U={}));class j extends G.w{constructor(t){super(t)}static validate(t){return-1!==t.indexOf(U.HEADER)&&-1!==t.indexOf(U.END)}shiftIdxToAtomType(t){return this.shiftIdxToSpecifiedColumn(t,U.ATOM_TYPE_COL)}getCountsLineIdx(){let t=0;for(let e=0;e<U.NUM_OF_HEADER_LINES;++e)t=this.getNextLineIdx(t);return t}getAtomBlockIdx(){let t=this.getCountsLineIdx();return t=this.getNextLineIdx(t),t}shiftIdxToXColumn(t){return this.getNextColumnIdx(t)}shiftIdxToBondedAtomsPair(t){return this.shiftIdxToSpecifiedColumn(t,U.FIRST_BONDED_ATOM_COL)}shiftIdxToBondType(t){return this.shiftIdxToSpecifiedColumn(t,U.BOND_TYPE_COL)}getBondBlockIdx(){let t=this.getAtomBlockIdx();for(let e=0;e<this.atomCount;e++)t=this.getNextLineIdx(t);return t}parseAtomAndBondCounts(){let t=this.getCountsLineIdx(),e=t+U.NUM_OF_COUNTS_DIGITS;const n=parseInt(this.fileContent.substring(t,e));return t=e,e+=U.NUM_OF_COUNTS_DIGITS,{atomCount:n,bondCount:parseInt(this.fileContent.substring(t,e))}}}var W=n(577);class z{constructor(){}static getInstance(t){if(j.validate(t))return new j(t);if(W.u.validate(t))return new W.u(t);throw new Error("Malformed molfile")}}var Y=n(604);const X=class extends Error{constructor(t){super(t)}};class K{constructor(t){this.molblock=t}_validMolBlock;get molblock(){return this._validMolBlock}set molblock(t){try{this.validateMolBlock(t)}catch(e){e instanceof X&&(t="");const n=(0,Y.O)(e);console.error(n)}this._validMolBlock=t}validateMolBlock(t){if(""===t)throw new X("MoleculeImage: invalid molblock")}async drawMolBlockOnCanvas(t){try{await o.functions.call("Chem:canvasMol",{x:0,y:0,w:t.width,h:t.height,canvas:t,molString:this.molblock,scaffoldMolString:"",options:{normalizeDepiction:!1,straightenDepiction:!1}})}catch(t){const e=(0,Y.O)(t);console.error(e)}}getMoleculeDimensions(){const t=z.getInstance(this.molblock),e=Math.max(...t.x)-Math.min(...t.x);return{height:Math.max(...t.y)-Math.min(...t.y),width:e}}async zoomIn(){const t=s.dialog("Molecule"),e=s.div([],{style:{overflowX:"scroll"}}),n=.7*y()(window).height(),o=this.getMoleculeDimensions(),r=n/o.height,i=n,a=o.width*r,l=s.canvas(a,i);await this.drawMolBlockOnCanvas(l),e.appendChild(l),t.add(e).showModal(!0)}async drawMolecule(t,e,n){t.innerHTML="";const o=s.canvas(e*window.devicePixelRatio,n*window.devicePixelRatio);o.style.width=`${e}px`,o.style.height=`${n}px`,o.style.borderStyle="solid",o.style.borderColor="var(--grey-3)",o.style.borderWidth="thin",this.drawMolBlockOnCanvas(o),y()(o).on("click",(async()=>{await this.zoomIn()})),y()(o).on("mouseover",(()=>y()(o).css("cursor","grab"))),y()(o).on("mouseout",(()=>y()(o).css("cursor","default"))),t.append(o)}}var Z=n(50);class Q{constructor(){const t=Object.keys(I.Rv).concat(E.NI.HELM);this.moleculeImgDiv=s.block([]),this.outputTableDiv=s.div([]),this.formatChoiceInput=s.choiceInput("",E.NI.HELM,t,(async()=>{this.format=this.formatChoiceInput.value,this.updateTable(),await this.updateMolImg()})),this.sequenceInputBase=s.textInput("",i.T_,(()=>{this.onInput.next()})),this.init(),r.debounce(this.onInput,300).subscribe((async()=>{this.init(),this.formatChoiceInput.value=this.format,this.updateTable(),await this.updateMolImg()}))}onInput=new a.Subject;moleculeImgDiv;outputTableDiv;formatChoiceInput;sequenceInputBase;molfile;sequence;format;async getHtmlElement(){const t=new P(this.sequenceInputBase,N),e=s.button("Get Molfile",(()=>{this.saveMolfile()}),"Save sequence as Molfile V3000"),n=s.button("Copy SMILES",(()=>{this.copySmiles()}),"Copy SMILES for the sequence"),o={format:s.div([this.formatChoiceInput]),textInput:t.root},r=s.table([o],(t=>[t.format,t.textInput]));r.classList.add("st-main-input-table");const i=s.block([this.outputTableDiv,e,n]),a=s.box(s.div([r,i,this.moleculeImgDiv],{style:{paddingTop:"20px",paddingLeft:"20px"}}));return this.formatChoiceInput.value=this.format,this.updateTable(),await this.updateMolImg(),a}saveMolfile(){const t=new D.K(this.sequence,!1,this.formatChoiceInput.value).convert();(0,S.L)(this.sequence+".mol",encodeURIComponent(t))}copySmiles(){const t=r.chem.convert(this.molfile,r.chem.Notation.MolBlock,r.chem.Notation.Smiles);navigator.clipboard.writeText(t).then((()=>o.shell.info(Z.AU)))}updateTable(){this.outputTableDiv.innerHTML="";const t=this.format?new O(this.sequence).getInvalidCodeIndex(this.format):0,e=function(t,e,n){const o=Object.keys(I.Rv).concat([E.NI.HELM]);if(!t||-1!==e&&n!==E.NI.HELM)return{};if(!o.includes(n))throw new Error(`${n} format is not supported by SequenceTranslator`);const r=o.filter((t=>t!=n)).sort(((t,e)=>t.localeCompare(e))),s=new V(t,n),i=Object.fromEntries(r.map((t=>{let e;try{e=s.convertTo(t)}catch{e=null}return[t,e]})).filter((([t,e])=>e))),a=function(t,e){const n=new RegExp("\\([^()]*\\)","g"),o=t.match(n);return o?o.map((t=>{const n=t.replace(/[\[\]()]/g,"");return E.mc.includes(n)?n:e.getNaturalAnalogBySymbol(n)})).map((t=>t||k)).join(""):null}(i[E.NI.HELM],T.A.getInstance());return a&&(i.Nucleotides=a),i}(this.sequence,t,this.format),n=[];for(const t of Object.keys(e)){const r="indexOfFirstInvalidChar"in e?s.divH([]):s.link(e[t],(()=>navigator.clipboard.writeText(e[t]).then((()=>o.shell.info(Z.AU)))),Z.wm,"");n.push({format:t,sequence:r})}const r=s.table(n,(t=>[t.format,t.sequence]),["FORMAT","SEQUENCE"]);this.outputTableDiv.append(r),this.outputTableDiv.classList.add("st-main-output-table")}async updateMolImg(){const t=new K(this.molfile);await t.drawMolecule(this.moleculeImgDiv,500,170),y()(this.moleculeImgDiv).find("canvas").css("float","inherit")}init(){this.sequence=this.getFormattedSequence(),this.format=new M(this.sequence).getFormat(),this.molfile=this.getMolfile()}getFormattedSequence(){return this.sequenceInputBase.value.replace(/\s/g,"")}getMolfile(){if(!this.format)return"";if(this.format===E.NI.HELM){const t=new V(this.sequence,this.format).convertTo(E.NI.AXOLABS);return new D.K(t,!1,E.NI.AXOLABS).convert()}return new D.K(this.sequence,!1,this.format).convert()}}var J=n(865),tt={};tt.styleTagTransform=C(),tt.setAttributes=m(),tt.insert=p().bind(null,"head"),tt.domAPI=h(),tt.insertStyleElement=A(),c()(J.Z,tt),J.Z&&J.Z.locals&&J.Z.locals;var et=n(837);function nt(t,e){if(""===t)return"";const n=E.NI.AXOLABS;let o="";try{o=new D.K(t,e,n).convert()}catch(t){const e=(0,Y.O)(t);console.error(e)}return o}function ot(t,e,n,o){const r=[t,e,n].filter((t=>""!==t.strand));if(1===r.length)return nt(r[0].strand,r[0].invert);{const r=nt(t.strand,t.invert),s=[nt(e.strand,e.invert),nt(n.strand,n.invert)].filter((t=>""!==t));return(0,et.v5)({senseStrands:[r],antiStrands:s},o)}}const rt=["ss","as","as2"];class st{constructor(){this.onInput=new a.Subject,this.inputBase=Object.fromEntries(rt.map((t=>[t,s.textInput("",i.T_,(()=>{this.onInput.next()}))]))),this.useChiralInput=s.boolInput("Use chiral",!0),this.saveAllStrandsInput=s.boolInput("Save as one entity",!0),s.tooltip.bind(this.saveAllStrandsInput.root,"Save SDF with all strands in one molfile"),this.directionInversion=Object.fromEntries(rt.map((t=>[t,!1]))),this.moleculeImgDiv=s.block([]),y()(this.moleculeImgDiv).addClass("st-sdf-mol-img"),r.debounce(this.onInput,300).subscribe((async()=>{await this.updateMoleculeImg()}))}onInput;useChiralInput;saveAllStrandsInput;inputBase;directionInversion;moleculeImgDiv;async getHtmlDivElement(){const t=this.getTableInput(),e=this.getBoolInputsAndButton();await this.updateMoleculeImg();const n=s.divH([e,this.moleculeImgDiv]);y()(n).addClass("st-sdf-bottom");const o=s.divV([t,n]);return y()(o).addClass("st-sdf-body"),o}getBoolInputsAndButton(){const t=s.buttonsInput([s.bigButton("Save SDF",(()=>{const t=this.getStrandData();!function(t,e,n,r,s){const i=[t.strand,e.strand,n.strand].filter((t=>""!==t));if(0===i.length||1===i.length&&""===t.strand)o.shell.warning("Enter SS and AS/AS2 to save SDF");else{let a;if(s)a=ot(t,e,n,r)+"\n$$$$\n";else{const h=nt(t.strand,t.invert),d=nt(e.strand,e.invert),p=nt(n.strand,n.invert);a=h+"\n> <Sequence>\nSense Strand\n$$$$\n",d&&(a+=d+"\n> <Sequence>\nAnti Sense\n$$$$\n"),p&&(a+=p+"\n> <Sequence>\nAnti Sense 2\n$$$$\n")}const l=new Date;function c(t){return t>=10?t.toString():"0"+t.toString()}const u=l.getFullYear()+"-"+c(l.getMonth()+1)+"-"+c(l.getDate())+"_"+c(l.getHours())+"-"+c(l.getMinutes())+"-"+c(l.getSeconds());(0,S.L)(`SequenceTranslator-${u}.sdf`,encodeURIComponent(a))}}(t.ss,t.as,t.as2,this.useChiralInput.value,this.saveAllStrandsInput.value)}))]),e=[this.saveAllStrandsInput.root,this.useChiralInput.root,t],n=s.divV(e);for(const t of e)y()(t).addClass("st-sdf-bool-button-block");return n}getTableInput(){const t=Object.fromEntries(rt.map((t=>[t,new P(this.inputBase[t],N)]))),e=Object.fromEntries(rt.map((t=>[t,s.choiceInput(`${t.toUpperCase()} direction`,"5′ → 3′",["5′ → 3′","3′ → 5′"])])));rt.forEach((t=>{e[t].onChanged((()=>{this.directionInversion[t]="3′ → 5′"===e[t].value,this.onInput.next()}))}));const n=["Sense Strand","Anti Sense","Anti Sense 2"],o=new Map(rt.map(((t,e)=>[t,n[e]]))),r=Object.fromEntries(rt.map((t=>[t,s.label(o.get(t))]))),i=rt.map((n=>({label:r[n],textInput:t[n].root,choiceInput:e[n].root}))),a=s.table(i,(t=>[t.label,t.textInput,t.choiceInput]));y()(a).css("margin-top","10px");for(const t of rt){let n=r[t].parentElement;n.classList.add("st-sdf-input-form"),y()(n).css("padding-top","3px"),n=e[t].root.parentElement,n.classList.add("st-sdf-input-form","st-sdf-direction-choice"),n=this.inputBase[t].root.parentElement,n.classList.add("st-sdf-text-input-td")}return a}getStrandData(){return Object.fromEntries(rt.map((t=>[t,{strand:this.inputBase[t].value.replace(/\s*/g,""),invert:this.directionInversion[t]}])))}getMolfile(t,e,n){return ot(t,e,n,this.useChiralInput.value)}async updateMoleculeImg(){let t="";try{const e=this.getStrandData();t=this.getMolfile(e.ss,e.as,e.as2)}catch(t){const e=(0,Y.O)(t);console.error(e)}const e=new K(t);await e.drawMolecule(this.moleculeImgDiv,650,150),y()(this.moleculeImgDiv).find("canvas").css("float","inherit")}}const it="SequenceTranslator",at="400px",lt="SS",ct="AS",ut=[lt,ct],ht={[lt]:"Sense Strand",[ct]:"Antisense Strand"},dt="THREE_PRIME",pt="FIVE_PRIME",ft=[dt,pt],mt={[dt]:3,[pt]:5};function gt(t){return"(o)"===t.slice(-3)}function At(t){let e=0;for(;e<t.length&&gt(t[e]);)e++;return e===t.length-1?0:e}function bt(t,e){const n=document.createElement("canvas").getContext("2d");return n.font=String(e),2*n.measureText(t).width}function Ct(t,e){return gt(t[e])||!E.mc.includes(t[e])?"":t[e]}function vt(t){const e=I.al[t].color.match(/\d+/g).map((t=>Number(t)));return.299*e[0]+.587*e[1]+.114*e[2]>186?"#33333":"#ffffff"}function xt(t){return I.al[t].color}const wt={xmlns:"http://www.w3.org/2000/svg",render:function(t,e){const n=document.createElementNS(this.xmlns,"svg");return n.setAttribute("id","mySvg"),n.setAttribute("width",String(t)),n.setAttribute("height",String(e)),n},circle:function(t,e,n,o){const r=document.createElementNS(this.xmlns,"circle");return r.setAttribute("cx",String(t)),r.setAttribute("cy",String(e)),r.setAttribute("r",String(n)),r.setAttribute("fill",o),r},text:function(t,e,n,o,r){const s=document.createElementNS(this.xmlns,"text");return s.setAttribute("x",String(e)),s.setAttribute("y",String(n)),s.setAttribute("font-size",String(o)),s.setAttribute("font-weight","normal"),s.setAttribute("font-family","Arial"),s.setAttribute("fill",r),s.innerHTML=t,s},star:function(t,e,n){const o=document.createElementNS(this.xmlns,"polygon");return o.setAttribute("points",function(t,e){const n=Math.PI/5;let o="";for(let r=0;r<10;r++){const s=r%2==0?6:3;o+=`${t+Math.cos(r*n+60)*s},${e+Math.sin(r*n+60)*s} `}return o}(t,e)),o.setAttribute("fill",n),o}};function yt(t,e){const n=I.al[e].symbols.join("");return n.repeat(Math.floor(t/4))+n.slice(0,t%4)}async function Et(t){return await o.dapi.users.current().then((e=>{const[n,o]=function(t){let e=-1;for(let n=0;n<t.length;n++)if("("===t[n]){e=n;break}return-1===e?["",""]:t.slice(e+9,t.length-1).split(" ").slice(1)}(t);return e.firstName!==n||e.lastName!==o}))}function Tt(t){let e=t.length+1;for(let n=0;n<t.length;n++)if("("===t[n]){e=n;break}return t.slice(0,e-1)}function St(t,e,n,o,r,s){let i=-1,a=t.replace(/[AUGC]/g,(function(o){i++;const r=I.al,s=(Object.keys(r),r.RNA.symbols.indexOf(o));let a=r[e[i].value].symbols[s];return gt(e[i].value)&&(i<t.length/2&&!gt(e[i+1].value)?a=a+o+"f":i>t.length/2&&!gt(e[i-1].value)&&(a=o+"f"+a)),n[i].value?a+"s":a}));return 3===a.slice(0,5).split("mU").length&&(a="(uu)"+a.slice(4)),3===a.slice(a.length-7).split("mU").length&&(a=a.slice(0,a.length-4)+"(uu)"),o.value+(s?"s":"")+a+r.value}const Ot=15,It=30,Mt=17,Nt="red",Bt="var(--grey-6)",Lt="red",Pt="SS: 5'",Dt="AS: 3'",kt=Math.max(bt(Pt,Mt),bt(Dt,Mt)),_t=Math.max(bt("3'",Mt),bt("5'",Mt)),Vt=0+kt-5,Ft={TITLE:Ot,SS_INDICES:30,SS_CIRCLES:52.5,SS_TEXTS:60,AS_CIRCLES:97.5,AS_TEXTS:105,AS_INDICES:127.5,comment:t=>t?165:127.5,circlesInLegends:t=>t?142.5:90,textLegend:t=>t?147:Ft.AS_CIRCLES-3,svgHeight:t=>t?165:135};function Ht(t,e,n,o,r,s,i,a,l,c,u,h){function d(t){return Math.round((t+T)*M/(w.length+T)+6)}function p(t,e){return x+(A-t+e+1)*It}function f(t,e,n){return n<10||E.mc.includes(t[e])?-5:-10}n=n.reverse(),r=r.reverse();const m=At(n),g=At(o),A=Math.max(n.length-m,o.length-g),b=Math.max(m,g),C=It*(A+b),v=Math.max(bt(i,Mt),bt(c,Mt)),x=Math.max(bt(a,Mt),bt(l,Mt)),w=e?[...new Set(n.concat(o))]:[...new Set(n)],y=e?r.concat(s).includes(!0):r.includes(!0),T=y?1:0,S=m*It+p(-.5,0),O=g*It+p(-.5,0),I=Math.max(S,O)+v+It*b,M=kt+v+C+x+_t+It,N=wt.render(M,Ft.svgHeight(e));N.append(wt.text(Pt,0,Ft.SS_TEXTS,Mt,Bt),e?wt.text(Dt,0,Ft.AS_TEXTS,Mt,Bt):"",wt.text("3'",I,Ft.SS_TEXTS,Mt,Bt),e?wt.text("5'",I,Ft.AS_TEXTS,Mt,Bt):"",wt.text(a,Vt,Ft.SS_TEXTS,Mt,Lt),e?wt.text(l,Vt,Ft.AS_TEXTS,Mt,Lt):"",wt.text(i,S,Ft.SS_TEXTS,Mt,Lt),e?wt.text(c,O,Ft.AS_TEXTS,Mt,Lt):"",wt.text(u,0,Ft.comment(e),14,Bt),y?wt.star(Ot,Ft.circlesInLegends(e),Nt):"",y?wt.text("ps linkage",22,Ft.textLegend(e),14,Bt):"");const B=n.filter((t=>!gt(t))).length;let L=B;for(let t=n.length-1;t>-1;t--){const e=p(t,m)+f(n,n.length-t,B-L);gt(n[t])||L--;const o=!gt(n[t])&&h.includes(n[t])?String(B-L):"";N.append(wt.text(o,e,Ft.SS_INDICES,14,Bt),wt.circle(p(t,m),Ft.SS_CIRCLES,Ot,xt(n[t])),wt.text(Ct(n,t),e,Ft.SS_TEXTS,Mt,vt(n[t])),r[t]?wt.star(p(t,m)+Ot,Ft.SS_TEXTS+5,Nt):"")}N.append(r[n.length]?wt.star(p(n.length,m)+Ot,Ft.SS_TEXTS+5,Nt):"");const P=o.filter((t=>!gt(t))).length;if(e){let t=P;for(let e=o.length-1;e>-1;e--){gt(o[e])||t--;const n=p(e,g)+f(o,e,t+1),r=!gt(o[e])&&h.includes(o[e])?String(t+1):"";N.append(wt.text(r,n,Ft.AS_INDICES,14,Bt),wt.circle(p(e,g),Ft.AS_CIRCLES,Ot,xt(o[e])),wt.text(Ct(o,e),p(e,g)+f(o,e,t+1),Ft.AS_TEXTS,Mt,vt(o[e])),s[e]?wt.star(p(e,g)+Ot,Ft.AS_TEXTS+5,Nt):"")}N.append(s[o.length]?wt.star(p(o.length,g)+Ot,Ft.AS_TEXTS+5,Nt):"")}const D=`${t} for ${B}${e?`/${P}`:""}mer`;N.append(wt.text(D,15,Ft.TITLE,Mt,"black"));for(let t=0;t<w.length;t++)N.append(wt.circle(d(t),Ft.circlesInLegends(e),6,xt(w[t])),wt.text(w[t],d(t)+6+4,Ft.textLegend(e),14,Bt));return N}var Rt=n(803);class qt{get htmlDivElement(){function t(e){C[e].innerHTML="",v[e]=v[e].concat(Array(b[e]-x[e].length).fill(A)),x[e]=x[e].concat(Array(b[e]-x[e].length).fill(g));let o=0;for(let r=0;r<w[e].value;r++)v[e][r]=s.boolInput("",v[e][r].value,(()=>{i(),n()})),x[e][r]=s.choiceInput("",x[e][r].value,p,(e=>{m.includes(e)||(m.push(e),H.append(s.divText("",{style:{width:"25px"}}),s.boolInput(e,!0,(t=>{if(t)m.includes(e)||m.push(e);else{const t=m.indexOf(e,0);t>-1&&m.splice(t,1)}i()})).root)),t(ct),i(),n()})),y()(x[e][r].root).addClass("st-pattern-choice-input"),gt(x[e][r].value)||o++,C[e].append(s.divH([s.div([s.label(gt(x[e][r].value)?"":String(o))],{style:{width:"20px"}}),s.block75([x[e][r].root]),s.div([v[e][r]])],{style:{alignItems:"center"}}))}function e(){Object.values(w).every((t=>t.value<35))?(ut.forEach((e=>{w[e].value>b[e]&&(b[e]=w[e].value),t(e)})),i(),ut.forEach((t=>{""===O[t].value&&(S[t].value=yt(w[t].value,g.value))})),n()):s.dialog("Sequence length is out of range").add(s.divText("Sequence length should be less than "+35..toString()+" due to UI constrains.")).add(s.divText("Please change sequence length in order to define new pattern.")).show()}function n(){const t=[!0,j.value];ut.forEach(((e,n)=>{t[n]&&(B[e].value=St(S[e].value,x[e],v[e],N[e][pt],N[e][dt],M[e].value))}))}function i(){D.innerHTML="",D.append(s.span([Ht(Tt($.value),j.value,x[lt].slice(0,w[lt].value).map((t=>t.value)),x[ct].slice(0,w[ct].value).map((t=>t.value)),[M[lt].value].concat(v[lt].slice(0,w[lt].value).map((t=>t.value))),[M[ct].value].concat(v[ct].slice(0,w[ct].value).map((t=>t.value))),N[lt][dt].value,N[lt][pt].value,N[ct][dt].value,N[ct][pt].value,W.value,m)]))}async function a(t){const e=r.TaskBarProgressIndicator.create("Loading pattern...");await o.dapi.userDataStorage.get(it,!1).then((e=>{const n=JSON.parse(e[t]);g.value=function(t){const e={};let n=t[0],o=1;for(let r=0;r<t.length;r++){const s=t[r];null===e[s]?e[s]=1:e[s]++,e[s]>o&&(n=s,o=e[s])}return n}(n.asBases.concat(n.ssBases)),j.value=n.asBases.length>0,$.value=t;let o=["ssBases","asBases"];ut.forEach(((t,e)=>{x[t]=[];const r=o[e];for(let e=0;e<n[r].length;e++)x[t].push(s.choiceInput("",n[r][e],p))})),o=["ssPtoLinkages","asPtoLinkages"],ut.forEach(((t,e)=>{const r=o[e];M[t].value=n[r][0],v[t]=[];for(let e=1;e<n[r].length;e++)v[t].push(s.boolInput("",n[r][e]))})),o=["ssBases","asBases"],ut.forEach(((t,e)=>{w[t].value=n[o[e]].length}));const r=[["ssThreeModification","ssFiveModification"],["asThreeModification","asFiveModification"]];ut.forEach(((t,e)=>{ft.forEach(((o,s)=>{N[t][o].value=n[r[e][s]]}))})),W.value=n.comment})),e.close()}async function l(){const t=await async function(){return await o.dapi.users.current().then((t=>" (created by "+t.friendlyName+")"))}();return $.value=$.stringValue.includes("(created by ")?Tt($.value)+t:$.stringValue+t,o.dapi.userDataStorage.postValue(it,$.value,JSON.stringify({ssBases:x[lt].slice(0,w[lt].value).map((t=>t.value)),asBases:x[ct].slice(0,w[ct].value).map((t=>t.value)),ssPtoLinkages:[M[lt].value].concat(v[lt].slice(0,w[lt].value).map((t=>t.value))),asPtoLinkages:[M[ct].value].concat(v[ct].slice(0,w[ct].value).map((t=>t.value))),ssThreeModification:N[lt][dt].value,ssFiveModification:N[lt][pt].value,asThreeModification:N[ct][dt].value,asFiveModification:N[ct][pt].value,comment:W.value}),!1).then((()=>o.shell.info("Pattern '"+$.value+"' was successfully uploaded!")))}async function c(){o.dapi.userDataStorage.get(it,!1).then((async t=>{const e=[],n=[];for(const o of Object.keys(t))await Et(o)?n.push(o):e.push(o);let r=s.choiceInput("Load Pattern","",e,(t=>a(t)));const i=(await o.dapi.users.current()).friendlyName,l=s.choiceInput("",i,[i,"Other users"],(t=>{const u=t===i?e:n;r=s.choiceInput("Load Pattern","",u,(t=>a(t))),r.root.append(l.input),r.root.append(r.input),r.input.style.maxWidth="100px",r.setTooltip("Apply Existing Pattern"),V.innerHTML="",V.append(r.root),r.root.append(s.div([s.button(s.iconFA("trash-alt",(()=>{})),(async()=>{null===r.value?o.shell.warning("Choose pattern to delete"):await Et($.value)?o.shell.warning("Cannot delete pattern, created by other user"):await o.dapi.userDataStorage.remove(it,r.value,!1).then((()=>o.shell.info("Pattern '"+r.value+"' deleted"))),await c()}))],"ui-input-options"))}));r.root.append(l.input),r.root.append(r.input),r.input.style.maxWidth="100px",r.setTooltip("Apply Existing Pattern"),V.innerHTML="",V.append(r.root),r.root.append(s.div([s.button(s.iconFA("trash-alt",(()=>{})),(async()=>{null===r.value?o.shell.warning("Choose pattern to delete"):await Et($.value)?o.shell.warning("Cannot delete pattern, created by other user"):await o.dapi.userDataStorage.remove(it,r.value,!1).then((()=>o.shell.info("Pattern '"+r.value+"' deleted"))),await c()}))],"ui-input-options"))}))}async function u(){await o.dapi.userDataStorage.get(it,!1).then((t=>{if(Object.keys(t).includes($.value)){const t=s.dialog("Pattern already exists");y()(t.getButton("OK")).hide(),t.add(s.divText("Pattern name '"+$.value+"' already exists.")).add(s.divText("Replace pattern?")).addButton("YES",(async()=>{await o.dapi.userDataStorage.remove(it,$.value,!1).then((()=>l())),t.close()})).show()}else l()})),await c()}function h(t,e){const n=function(t){const e=q.value.getCol(t);let n=!0;for(let t=1;t<e.length;t++)if(e.get(t-1).length!==e.get(t).length&&0!==e.get(t).length){n=!1;break}if(!n){const n=s.dialog("Sequences lengths mismatch");y()(n.getButton("OK")).hide(),n.add(s.divText("The sequence length should match the number of Raw sequences in the input file")).add(s.divText("'ADD COLUMN' to see sequences lengths")).addButton("ADD COLUMN",(()=>{q.value.columns.addNewInt("Sequences lengths in "+t).init((t=>e.get(t).length)),o.shell.info("Column with lengths added to '"+q.value.name+"'"),n.close(),o.shell.v=o.shell.getTableView(q.value.name)})).show()}return e.get(0)!==w[lt].value&&s.dialog("Length was updated by value to from imported file").add(s.divText("Latest modifications may not take effect during translation")).onOK((()=>o.shell.info("Lengths changed"))).show(),n}(t),r=q.value.getCol(t).get(0);n&&r.length!==w[e].value&&(w[e].value=q.value.getCol(t).get(0).length),S[e].value=r}function d(t){const e=q.value.getCol(t);if(e.type!==r.TYPE.INT)o.shell.error("Column should contain integers only");else if(e.categories.filter((t=>""!==t)).length<e.toList().filter((t=>""!==t)).length){const t=(n=e.getRawData(),Array.from(new Set(n)).filter((t=>n.indexOf(t)!==n.lastIndexOf(t))));s.dialog("Non-unique IDs").add(s.divText("Press 'OK' to select rows with non-unique values")).onOK((()=>{q.value.selection.init((n=>t.indexOf(e.get(n))>-1)),o.shell.v=o.shell.getTableView(q.value.name),o.shell.info("Rows are selected in table '"+q.value.name+"'")})).show()}var n}const p=Object.keys(I.al),f=p[0],m=[f],g=s.choiceInput("Sequence Basis",f,p,(t=>{var e;e=t,ut.forEach((t=>{for(let n=0;n<x[t].length;n++)x[t][n].value=e})),i(),n()})),A=s.boolInput("Fully PTO",!0,(t=>{var e;ut.forEach((e=>{M[e].value=t})),e=t,ut.forEach((t=>{for(let n=0;n<v[t].length;n++)v[t][n].value=e})),i(),n()})),b=Object.fromEntries(ut.map((t=>[t,23]))),C=Object.fromEntries(ut.map((t=>[t,s.div([])]))),v=Object.fromEntries(ut.map((t=>[t,Array(23).fill(s.boolInput("",!0))]))),x=Object.fromEntries(ut.map((t=>[t,Array(23).fill(s.choiceInput("",f,p))]))),w=Object.fromEntries(ut.map((t=>{const n=s.intInput(`${t} Length`,23,(()=>e()));return n.setTooltip(`Length of ${ht[t].toLowerCase()}, including overhangs`),[t,n]}))),E=Object.fromEntries(ut.map((t=>[t,""]))),T=Object.fromEntries(ut.map((t=>[t,s.div([])]))),S=Object.fromEntries(ut.map((t=>[t,s.textInput(`${ht[t]}`,yt(w[t].value,g.value))]))),O=Object.fromEntries(ut.map((t=>{const e=s.choiceInput(`${ht[t]} Column`,"",[],(e=>{h(e,t),E[t]=e}));return T[t].append(e.root),[t,e]}))),M=Object.fromEntries(ut.map((t=>{const e=s.boolInput(`First ${t} PTO`,A.value,(()=>i()));return e.setTooltip(`ps linkage before first nucleotide of ${ht[t].toLowerCase()}`),[t,e]}))),N=Object.fromEntries(ut.map((t=>{const e=Object.fromEntries(ft.map((e=>{const o=s.stringInput(`${t} ${mt[e]}' Modification`,"",(()=>{i(),n()}));return o.setTooltip(`Additional ${t} ${mt[e]}' Modification`),[e,o]})));return[t,e]}))),B=Object.fromEntries(ut.map((t=>[t,s.textInput(" ",St(S[t].value,x[t],v[t],N[t][dt],N[t][pt],M[t].value))]))),L=Object.fromEntries(ut.map((t=>[t,s.panel([s.h1(`${ht[t]}`),s.divH([s.div([s.divText("#")],{style:{width:"20px"}}),s.block75([s.divText("Modification")]),s.div([s.divText("PTO")])]),C[t]],{style:{paddingTop:"12px"}})])));ut.forEach((t=>{S[t].input.style.resize="none",S[t].input.style.minWidth=at,B[t].input.style.resize="none",B[t].input.style.minWidth=at,B[t].input.disabled="true",B[t].root.append(s.div([s.button(s.iconFA("copy",(()=>{})),(()=>{navigator.clipboard.writeText(B[t].value).then((()=>o.shell.info("Sequence was copied to clipboard")))}))],"ui-input-options"))}));const P=s.div([]),D=s.div([]),k=s.div([]),_=s.div([]),V=s.div([]),F=s.div([]),H=s.divH([s.boolInput(f,!0,(t=>{if(t)m.includes(f)||m.push(f);else{const t=m.indexOf(f,0);t>-1&&m.splice(t,1)}i(),n()})).root]),R=s.div([w[ct].root]),q=s.tableInput("Tables",o.shell.tables[0],o.shell.tables,(t=>{ut.forEach((e=>{O[e]=s.choiceInput(`${e} Column`,"",t.columns.names(),(t=>{h(t,e),E[e]=t})),T[e].innerHTML="",T[e].append(O[e].root)}));const e=s.choiceInput("ID Column","",t.columns.names(),(t=>{d(t),U=t}));P.innerHTML="",P.append(e.root)}));let U="";const G=s.choiceInput("ID Column","",[],(t=>{d(t),U=t}));P.append(G.root),c();const j=s.boolInput("Create AS Strand",!0,(t=>{L[ct].hidden=!t,T[ct].hidden=!t,R.hidden=!t,F.hidden=!t,k.hidden=!t,M[ct].root.hidden=!t,i()}));j.setTooltip("Create antisense strand sections on SVG and table to the right");const $=s.textInput("Save As","Pattern Name",(()=>i()));$.setTooltip("Name Of New Pattern"),ft.forEach((t=>{F.append(N[ct][t].root)}));const W=s.textInput("Comment","",(()=>i())),z=s.button("Save",(()=>{if(""!==$.value)u().then((()=>o.shell.info("Pattern saved")));else{const t=s.stringInput("Enter Name","");s.dialog("Pattern Name").add(t.root).onOK((()=>{$.value=t.value,u().then((()=>o.shell.info("Pattern saved")))})).show()}})),Y=s.button("Convert Sequences",(()=>{const t=[!0,j.value];if(ut.some(((e,n)=>t[n]&&""===E[e])))o.shell.info("Please select table and columns on which to apply pattern");else if(ut.some((t=>w[t].value!==S[t].value.length))){const t=s.dialog("Length Mismatch");y()(t.getButton("OK")).hide(),t.add(s.divText("Length of sequences in columns doesn't match entered length. Update length value?")).addButton("YES",(()=>{ut.forEach((t=>{w[t].value=q.value.getCol(O[t].value).getString(0).length})),t.close()})).show()}else{""!==U&&function(t,e,n){const r="ID "+n,s=o.shell.table(t).columns;s.contains(r)&&s.remove(r);const i=s.byName(e);s.addNewString(r).init((t=>""===i.getString(t)?"":i.get(t)+"_"+n))}(q.value.name,U,Tt($.value));const t=[!0,j.value];ut.forEach(((e,n)=>{t[n]&&function(t,e,n,r,s,i,a){const l="Axolabs "+e,c=o.shell.table(t).columns;c.contains(l)&&c.remove(l);const u=c.byName(e);c.addNewString(l).init((t=>""===u.getString(t)?"":St(u.getString(t),n,r,s,i,a)))}(q.value.name,E[e],x[e],v[e],N[e][pt],N[e][dt],M[e].value)})),o.shell.v=o.shell.getTableView(q.value.name),o.shell.info((j.value?"Columns were":"Column was")+" added to table '"+q.value.name+"'"),n()}}));k.append(S[ct].root),k.append(B[ct].root),e();const X=s.div([s.h1("Conversion preview"),S[lt].root,B[lt].root,k],"ui-form"),K=s.div([s.h1("Convert options"),s.divH([q.root,T[lt]]),s.divH([T[ct],P]),s.buttonsInput([Y])],"ui-form"),Z=s.button("Download",(()=>Rt.saveSvgAsPng(document.getElementById("mySvg"),$.value,{backgroundColor:"white"}))),Q=s.panel([s.block([D],{style:{overflowX:"scroll"}}),Z,H,s.div([s.div([s.divH([s.h1("Pattern options")]),s.divH([s.div([w[lt].root,R,g.root,W.root,V,$.root,s.buttonsInput([z])],"ui-form"),s.div([j.root,A.root,M[lt].root,M[ct].root,N[lt][pt].root,N[lt][dt].root,F],"ui-form")],"ui-form")],"ui-form"),K,X],{style:{flexWrap:"wrap"}})]);return s.info([s.divText("\n How to define new pattern:",{style:{"font-weight":"bolder"}}),s.divText("1. Choose table and columns with sense and antisense strands"),s.divText("2. Choose lengths of both strands by editing checkboxes below"),s.divText("3. Choose basis and PTO status for each nucleotide"),s.divText("4. Set additional modifications for sequence edges"),s.divText("5. Press 'Convert Sequences' button"),s.divText("This will add the result column(s) to the right of the table")],"Create and apply Axolabs translation patterns."),s.splitH([s.div([_,Q]),s.box(s.divH([L[lt],L[ct]]),{style:{maxWidth:"360px"}})])}}async function Ut(t){try{const e={overflowX:"scroll"},n=s.div([],{style:e}),r=(0,et.$U)(t),i=.7*y()(window).height(),a=Math.max(...r.x)-Math.min(...r.x),l=Math.max(...r.y)-Math.min(...r.y),c=i/l,u=c*a,h=c*l,d=s.canvas(u*window.devicePixelRatio,h*window.devicePixelRatio);d.style.width=`${u}px`,d.style.height=`${h}px`,await async function(t,e){await o.functions.call("Chem:canvasMol",{x:0,y:0,w:t.width,h:t.height,canvas:t,molString:e,scaffoldMolString:"",options:{normalizeDepiction:!1,straightenDepiction:!1}})}(d,t),n.appendChild(d),s.dialog("Molecule").add(n).showModal(!0)}catch(t){const e=(0,Y.O)(t);console.error(e)}}class Gt{static async view(){const t=T.A.getInstance().getTableForViewer();t.name="Monomer Library";const e=o.shell.addTableView(t);e.grid.props.allowEdit=!1,e.grid.onCellDoubleClick.subscribe((async t=>{const e=t.cell.value;"Molecule"===t.tableColumn?.semType&&await Ut(e)}))}}class jt{constructor(){this.view=r.View.create(),this.urlRouter=new Wt(this.view),this.view.box=!0,this.view.name="Sequence Translator";const t=o.shell.windows;t.showProperties=!1,t.showToolbox=!1,t.showHelp=!1;const e=s.iconFA("book",Gt.view,"View monomer library");this.topPanel=[e],this.view.setRibbonPanels([this.topPanel]),this.tabs=new $t(new Q,new qt,new st,this.urlRouter)}view;tabs;topPanel;urlRouter;async createLayout(){const t=await this.tabs.getControl(),e=this.urlRouter.tabName;e&&(t.currentPane=t.getPane(e)),this.view.append(t),o.shell.addView(this.view)}}class $t{mainTab;axolabsTab;sdfTab;urlRouter;constructor(t,e,n,o){this.mainTab=t,this.axolabsTab=e,this.sdfTab=n,this.urlRouter=o}control=null;async getControl(){if(this.control)return this.control;const t=s.tabControl({[i.qt]:await this.mainTab.getHtmlElement(),[i.Iy]:this.axolabsTab.htmlDivElement,[i.sv]:await this.sdfTab.getHtmlDivElement()}),e=t.getPane(i.sv);s.tooltip.bind(e.header,"Get atomic-level structure for SS + AS/AS2 and save SDF");const n=t.getPane(i.qt);s.tooltip.bind(n.header,"Translate across formats");const o=t.getPane(i.Iy);return s.tooltip.bind(o.header,"Create modification pattern for SS and AS"),t.onTabChanged.subscribe((()=>{t.currentPane.name!==i.qt?this.urlRouter.searchParams.delete("seq"):(console.log("sequence:",this.mainTab.sequence),this.urlRouter.searchParams.set("seq",this.mainTab.sequence),console.log("searchParams:",Object.entries(this.urlRouter.searchParams))),this.urlRouter.updatePath(t)})),this.control=t,this.control}}class Wt{view;constructor(t){this.view=t,this.pathParts=window.location.pathname.split("/"),this.searchParams=new URLSearchParams(window.location.search)}searchParams;pathParts;get urlParamsString(){return Object.entries(this.searchParams).map((([t,e])=>`${t}=${encodeURIComponent(e)}`)).join("&")}updatePath(t){const e=Object.entries(this.searchParams).map((([t,e])=>`${t}=${encodeURIComponent(e)}`)).join("&");this.view.path=`/apps/SequenceTranslator/${t.currentPane.name}`,e&&(this.view.path+=`/?${e}`)}get tabName(){const t=this.pathParts.findIndex((t=>"SequenceTranslator"===t));return-1===t?"":this.pathParts[t+1]}}var zt=n(895);wu;class Yt{constructor(t,e,n){this.name=t,this.alphabet=e,this.cutoff=n}}class Xt extends Yt{constructor(t,e,n){super(t.name,t.alphabet,t.cutoff),this.freq=e,this.similarity=n}}const Kt=/(\[[A-Za-z0-9-_]+\]|.)/g,Zt=new class{constructor(){this.fasta={peptide:new Set(["G","L","Y","S","E","Q","D","N","F","A","K","R","H","C","V","P","W","I","M","T"]),dna:new Set(["A","C","G","T"]),rna:new Set(["A","C","G","U"])}}},Qt=[new Yt("PT",Zt.fasta.peptide,.5),new Yt("DNA",Zt.fasta.dna,.55),new Yt("RNA",Zt.fasta.rna,.55)],Jt=new Uint32Array(65536),te={gapOpen:8,gapExtend:2,scoringMatrix:[[4,-1,-2,-2,0,-1,-1,0,-2,-1,-1,-1,-1,-2,-1,1,0,-3,-2,0,-2,-1,0,-4],[-1,5,0,-2,-3,1,0,-2,0,-3,-2,2,-1,-3,-2,-1,-1,-3,-2,-3,-1,0,-1,-4],[-2,0,6,1,-3,0,0,0,1,-3,-3,0,-2,-3,-2,1,0,-4,-2,-3,3,0,-1,-4],[-2,-2,1,6,-3,0,2,-1,-1,-3,-4,-1,-3,-3,-1,0,-1,-4,-3,-3,4,1,-1,-4],[0,-3,-3,-3,9,-3,-4,-3,-3,-1,-1,-3,-1,-2,-3,-1,-1,-2,-2,-1,-3,-3,-2,-4],[-1,1,0,0,-3,5,2,-2,0,-3,-2,1,0,-3,-1,0,-1,-2,-1,-2,0,3,-1,-4],[-1,0,0,2,-4,2,5,-2,0,-3,-3,1,-2,-3,-1,0,-1,-3,-2,-2,1,4,-1,-4],[0,-2,0,-1,-3,-2,-2,6,-2,-4,-4,-2,-3,-3,-2,0,-2,-2,-3,-3,-1,-2,-1,-4],[-2,0,1,-1,-3,0,0,-2,8,-3,-3,-1,-2,-1,-2,-1,-2,-2,2,-3,0,0,-1,-4],[-1,-3,-3,-3,-1,-3,-3,-4,-3,4,2,-3,1,0,-3,-2,-1,-3,-1,3,-3,-3,-1,-4],[-1,-2,-3,-4,-1,-2,-3,-4,-3,2,4,-2,2,0,-3,-2,-1,-2,-1,1,-4,-3,-1,-4],[-1,2,0,-1,-3,1,1,-2,-1,-3,-2,5,-1,-3,-1,0,-1,-3,-2,-2,0,1,-1,-4],[-1,-1,-2,-3,-1,0,-2,-3,-2,1,2,-1,5,0,-2,-1,-1,-1,-1,1,-3,-1,-1,-4],[-2,-3,-3,-3,-2,-3,-3,-3,-1,0,0,-3,0,6,-4,-2,-2,1,3,-1,-3,-3,-1,-4],[-1,-2,-2,-1,-3,-1,-1,-2,-2,-3,-3,-1,-2,-4,7,-1,-1,-4,-3,-2,-2,-1,-2,-4],[1,-1,1,0,-1,0,0,0,-1,-2,-2,0,-1,-2,-1,4,1,-3,-2,-2,0,0,0,-4],[0,-1,0,-1,-1,-1,-1,-2,-2,-1,-1,-1,-1,-2,-1,1,5,-2,-2,0,-1,-1,0,-4],[-3,-3,-4,-4,-2,-2,-3,-2,-2,-3,-2,-3,-1,1,-4,-3,-2,11,2,-3,-4,-3,-2,-4],[-2,-2,-2,-3,-2,-1,-2,-3,2,-1,-1,-2,-1,3,-3,-2,-2,2,7,-1,-3,-2,-1,-4],[0,-3,-3,-3,-1,-2,-2,-3,-3,3,1,-2,1,-1,-2,-2,0,-3,-1,4,-3,-2,-1,-4],[-2,-1,3,4,-3,0,1,-1,0,-3,-4,0,-3,-3,-2,0,-1,-4,-3,-3,4,1,-1,-4],[-1,0,0,1,-3,3,4,-2,0,-3,-3,1,-1,-3,-1,0,-1,-3,-2,-2,1,4,-1,-4],[0,-1,-1,-1,-2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-2,0,0,-2,-1,-1,-1,-1,-1,-4],[-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,1]],alphabetIndexes:{A:0,R:1,N:2,D:3,C:4,Q:5,E:6,G:7,H:8,I:9,L:10,K:11,M:12,F:13,P:14,S:15,T:16,W:17,Y:18,V:19,B:20,Z:21,X:22,"*":23}};var ee;!function(t){t.HAMMING="Hamming",t.LEVENSHTEIN="Levenshtein",t.NEEDLEMANN_WUNSCH="Needlemann-Wunsch"}(ee||(ee={}));const ne={[ee.HAMMING]:function(){return(t,e)=>{let n=0;t.length!==e.length&&(n=Math.abs(t.length-e.length));let o=0;for(let n=0;n<Math.min(t.length,e.length);n++)t[n]!==e[n]&&o++;return o+=n,o/=Math.max(t.length,e.length),o}},[ee.LEVENSHTEIN]:function(){return(t,e)=>((t,e)=>{if(t.length<e.length){const n=e;e=t,t=n}return 0===e.length?t.length:t.length<=32?((t,e)=>{const n=t.length,o=e.length,r=1<<n-1;let s=-1,i=0,a=n,l=n;for(;l--;)Jt[t.charCodeAt(l)]|=1<<l;for(l=0;l<o;l++){let t=Jt[e.charCodeAt(l)];const n=t|i;t|=(t&s)+s^s,i|=~(t|s),s&=t,i&r&&a++,s&r&&a--,i=i<<1|1,s=s<<1|~(n|i),i&=n}for(l=n;l--;)Jt[t.charCodeAt(l)]=0;return a})(t,e):((t,e)=>{const n=e.length,o=t.length,r=[],s=[],i=Math.ceil(n/32),a=Math.ceil(o/32);for(let t=0;t<i;t++)s[t]=-1,r[t]=0;let l=0;for(;l<a-1;l++){let i=0,a=-1;const c=32*l,u=Math.min(32,o)+c;for(let e=c;e<u;e++)Jt[t.charCodeAt(e)]|=1<<e;for(let t=0;t<n;t++){const n=Jt[e.charCodeAt(t)],o=s[t/32|0]>>>t&1,l=r[t/32|0]>>>t&1,c=n|i,u=((n|l)&a)+a^a|n|l;let h=i|~(u|a),d=a&u;h>>>31^o&&(s[t/32|0]^=1<<t),d>>>31^l&&(r[t/32|0]^=1<<t),h=h<<1|o,d=d<<1|l,a=d|~(c|h),i=h&c}for(let e=c;e<u;e++)Jt[t.charCodeAt(e)]=0}let c=0,u=-1;const h=32*l,d=Math.min(32,o-h)+h;for(let e=h;e<d;e++)Jt[t.charCodeAt(e)]|=1<<e;let p=o;for(let t=0;t<n;t++){const n=Jt[e.charCodeAt(t)],i=s[t/32|0]>>>t&1,a=r[t/32|0]>>>t&1,l=n|c,h=((n|a)&u)+u^u|n|a;let d=c|~(h|u),f=u&h;p+=d>>>o-1&1,p-=f>>>o-1&1,d>>>31^i&&(s[t/32|0]^=1<<t),f>>>31^a&&(r[t/32|0]^=1<<t),d=d<<1|i,f=f<<1|a,u=f|~(l|d),c=d&l}for(let e=h;e<d;e++)Jt[t.charCodeAt(e)]=0;return p})(t,e)})(t,e)/Math.max(t.length,e.length)},[ee.NEEDLEMANN_WUNSCH]:function(t){return(e,n)=>{const{gapOpen:o,gapExtend:r,scoringMatrix:s,alphabetIndexes:i}={...te,...t},a=[new Array(e.length+1).fill(0),new Array(e.length+1).fill(0)],l=new Array(e.length+1).fill(!1),c=new Array(e.length+1).fill(!1);let u=0,h=1;for(let t=1;t<e.length+1;t++)a[0][t]=-o-(t-1)*r;for(let t=1;t<n.length+1;t++){a[h][0]=-o-(t-1)*r;for(let d=1;d<e.length+1;d++){const p=a[u][d-1]+s[i[e[d-1]]][i[n[t-1]]],f=a[u][d]-(l[d]?r:o),m=a[h][d-1]-(c[d-1]?r:o);a[h][d]=Math.max(p,m,f),a[h][d]===p?(l[d]=!1,c[d]=!1):a[h][d]===m?(l[d]=!1,c[d]=!0):(l[d]=!0,c[d]=!1)}u=h,h=(h+1)%2}const d=e.split("").map((t=>s[i[t]][i[t]])).reduce(((t,e)=>t+e),0),p=n.split("").map((t=>s[i[t]][i[t]])).reduce(((t,e)=>t+e),0),f=Math.max(d,p);return(f-a[u][e.length])/f}}},oe=new class{constructor(){this.uhTemp=`units-handler.${r.SEMTYPE.MACROMOLECULE}`}};class re{static setUnitsToFastaColumn(t){if(t.column.semType!==r.SEMTYPE.MACROMOLECULE||"fasta"!==t.column.getTag(r.TAGS.UNITS))throw new Error(`The column of notation 'fasta' must be '${r.SEMTYPE.MACROMOLECULE}'.`);t.column.setTag(r.TAGS.UNITS,"fasta"),re.setTags(t)}static setUnitsToSeparatorColumn(t,e){if(t.column.semType!==r.SEMTYPE.MACROMOLECULE||"separator"!==t.column.getTag(r.TAGS.UNITS))throw new Error(`The column of notation 'separator' must be '${r.SEMTYPE.MACROMOLECULE}'.`);if(!e)throw new Error("The column of notation 'separator' must have the separator tag.");t.column.setTag(r.TAGS.UNITS,"separator"),t.column.setTag("separator",e),re.setTags(t)}static setUnitsToHelmColumn(t){if(t.column.semType!==r.SEMTYPE.MACROMOLECULE)throw new Error(`The column of notation 'helm' must be '${r.SEMTYPE.MACROMOLECULE}'`);t.column.setTag(r.TAGS.UNITS,"helm"),re.setTags(t)}static setTags(t){const e=t.column.getTag(r.TAGS.UNITS),n=t.stats;if(Object.keys(n.freq).some((t=>t.length>1)),["fasta","separator"].includes(e)){if(0===Object.keys(n.freq).length)throw new Error("Alphabet is empty");const e=n.sameLength?"SEQ.MSA":"SEQ";t.column.setTag("aligned",e);const o=function(t,e,n="-"){const o=e.map((e=>{const o=function(t,e,n="-"){const o=new Set([...new Set(Object.keys(t)),...e]);o.delete(n);const r=[],s=[];for(const n of o)r.push(n in t?t[n]:0),s.push(e.has(n)?1:0);const i=new se(r),a=new se(s);return function(t,e){if(t.length!=e.length)throw new Error("The dimensionality of the vectors must match");let n=0;for(let o=0;o<t.length;o++)n+=t[o]*e[o];return n}(i,a)/(ie(i)*ie(a))}(t,e.alphabet,n);return new Xt(e,t,o)}));let r;const s=Math.max(...o.map((t=>t.similarity>t.cutoff?t.similarity:-1)));r=s>0?o.find((t=>t.similarity===s)).name:"UN";return r}(n.freq,Qt);if(t.column.setTag("alphabet",o),"UN"===o){const e=Object.keys(n.freq).length,o=Object.keys(n.freq).some((t=>t.length>1));t.column.setTag(".alphabetSize",e.toString()),t.column.setTag(".alphabetIsMultichar",o?"true":"false")}}}get units(){return this._units}get column(){return this._column}get notation(){return this._notation}get defaultGapSymbol(){return this._defaultGapSymbol}get separator(){const t=this.column.getTag("separator")??void 0;if("separator"===this.notation&&void 0===t)throw new Error(`Separator is mandatory for column '${this.column.name}' of notation '${this.notation}'.`);return t}get aligned(){const t=this.column.getTag("aligned");if(!t&&(this.isFasta()||this.isSeparator()))throw new Error("Tag aligned not set");return t}get alphabet(){const t=this.column.getTag("alphabet");if(!t&&(this.isFasta()||this.isSeparator()))throw new Error("Tag alphabet not set");return t}get helmCompatible(){return this.column.getTag(".isHelmCompatible")}getAlphabetSize(){if("helm"==this.notation||"UN"==this.alphabet){const t=this.column.getTag(".alphabetSize");let e;if(t)e=parseInt(t);else{const t=this.stats;e=Object.keys(t.freq).length}return e}switch(this.alphabet){case"PT":return 20;case"DNA":case"RNA":return 4;case"NT":return console.warn("Unexpected alphabet 'NT'."),4;default:throw new Error(`Unexpected alphabet '${this.alphabet}'.`)}}getAlphabetIsMultichar(){return"helm"===this.notation||"UN"===this.alphabet&&"true"===this.column.getTag(".alphabetIsMultichar")}get splitted(){if(null===this._splitted){const t=this.getSplitter(),e=this._column.length;this._splitted=new Array(e);const n=this._column.getRawData(),o=this._column.categories;for(let r=0;r<e;r++){const e=o[n[r]];this._splitted[r]=t(e)}}return this._splitted}get stats(){if(null===this._stats){const t={};let e=!0,n=null;for(const o of this.splitted){null==n?n=o.length:o.length!==n&&(e=!1);for(const e of o)e in t||(t[e]=0),t[e]+=1}this._stats={freq:t,sameLength:e}}return this._stats}isFasta(){return"fasta"===this.notation}isSeparator(){return"separator"===this.notation}isHelm(){return"helm"===this.notation}isRna(){return"RNA"===this.alphabet}isDna(){return"DNA"===this.alphabet}isPeptide(){return"PT"===this.alphabet}isMsa(){return!!this.aligned&&this.aligned.toUpperCase().includes("MSA")}isHelmCompatible(){return"true"===this.helmCompatible}getNotation(){if(this.units.toLowerCase().startsWith("fasta"))return"fasta";if(this.units.toLowerCase().startsWith("separator"))return"separator";if(this.units.toLowerCase().startsWith("helm"))return"helm";throw new Error(`Column '${this.column.name}' has unexpected notation '${this.units}'.`)}getNewColumn(t,e){const n=this.column,o=n.length,s=t.toLowerCase()+"("+n.name+")",i=n.dataFrame.columns.getUnusedName(s),a=r.Column.fromList("string",i,new Array(o).fill(""));if(a.semType=r.SEMTYPE.MACROMOLECULE,a.setTag(r.TAGS.UNITS,t),"separator"===t){if(!e)throw new Error("Notation 'separator' requires separator value.");a.setTag("separator",e)}a.setTag(r.TAGS.CELL_RENDERER,"Macromolecule");const l=n.getTag("aligned");l&&a.setTag("aligned",l);const c=n.getTag("alphabet");c&&a.setTag("alphabet",c);let u=n.getTag(".alphabetSize");u&&a.setTag(".alphabetSize",u);const h=n.getTag(".alphabetIsMultichar");return void 0!==h&&a.setTag(".alphabetIsMultichar",h),"helm"==t&&(u=this.getAlphabetSize().toString(),a.setTag(".alphabetSize",u)),a}static getNewColumn(t){const e=re.getOrCreate(t),n=e.notation;return e.getNewColumn(n)}static unitsStringIsValid(t){return t=t.toLowerCase(),["fasta","separator","helm"].some((e=>t.startsWith(e.toLowerCase())))}static getNewColumnFromParams(t,e,n){if(!re.unitsStringIsValid(n))throw new Error("Invalid format of 'units' parameter");const o=r.Column.fromList("string",e,new Array(t).fill(""));return o.semType=r.SEMTYPE.MACROMOLECULE,o.setTag(r.TAGS.UNITS,n),o}getSplitter(){return function(t){if(t.semType!==r.SEMTYPE.MACROMOLECULE)throw new Error(`Get splitter for semType "${r.SEMTYPE.MACROMOLECULE}" only.`);return function(t,e,n){if(t.toLowerCase().startsWith("fasta"))return fe;if(t.toLowerCase().startsWith("separator"))return me(e,void 0);if(t.toLowerCase().startsWith("helm"))return be;throw new Error(`Unexpected units ${t} .`)}(t.getTag(r.TAGS.UNITS),t.getTag("separator"))}(this._column)}getDistanceFunctionName(){if(!this.isFasta())throw new Error("Only FASTA notation is supported");if(this.isMsa())return ee.HAMMING;switch(this.alphabet){case"DNA":case"RNA":default:return ee.LEVENSHTEIN;case"PT":return ee.NEEDLEMANN_WUNSCH}}getDistanceFunction(){return ne[this.getDistanceFunctionName()]()}async checkHelmCompatibility(){if(this.column.tags.has(".isHelmCompatible"))return"true"===this.column.getTag(".isHelmCompatible");const t=(await Ce()).getBioLib().getMonomerSymbolsByType("PEPTIDE".toString()),e=new Set(t),n=me(this.separator);for(const t of this.column.categories){const o=n(t);for(const t of o)if(!e.has(t))return this.column.setTag(".isHelmCompatible","false"),!1}return this.column.setTag(".isHelmCompatible","true"),!0}constructor(t){this._splitted=null,this._stats=null,this._column=t;const e=this._column.getTag(r.TAGS.UNITS);if(null==e)throw new Error("Units are not specified in column");if(this._units=e,this._notation=this.getNotation(),this._defaultGapSymbol=this.isFasta()?re._defaultGapSymbolsDict.FASTA:this.isHelm()?re._defaultGapSymbolsDict.HELM:re._defaultGapSymbolsDict.SEPARATOR,!this.column.tags.has("aligned")||!this.column.tags.has("alphabet")||!this.column.tags.has(".alphabetIsMultichar")&&!this.isHelm()&&"UN"===this.alphabet)if(this.isFasta())re.setUnitsToFastaColumn(this);else if(this.isSeparator()){const e=t.getTag("separator");re.setUnitsToSeparatorColumn(this,e)}else{if(!this.isHelm())throw new Error(`Unexpected units '${this.column.getTag(r.TAGS.UNITS)}'.`);re.setUnitsToHelmColumn(this)}if(!this.column.tags.has(".alphabetIsMultichar"))if(this.isHelm())this.column.setTag(".alphabetIsMultichar","true");else if(["UN"].includes(this.alphabet))throw new Error(`For column '${this.column.name}' of alphabet '${this.alphabet}' tag '.alphabetIsMultichar' is mandatory.`)}static getOrCreate(t){return oe.uhTemp in t.temp||(t.temp[oe.uhTemp]=new re(t)),t.temp[oe.uhTemp]}}re._defaultGapSymbolsDict={HELM:"*",SEPARATOR:"",FASTA:"-"};class se extends Float32Array{}function ie(t){let e=0;for(let n=0;n<t.length;n++)e+=t[n]*t[n];return Math.sqrt(e)}class ae{static makePalette(t,e=!1,n=ae){const o={};return t.forEach((t=>{const n=t[0],r=t[1];n.forEach(((t,n)=>{o[t]=this.colourPalette[r][e?0:n]}))})),new n(o)}constructor(t){this._palette=t}get(t){return this._palette[t]}}ae.undefinedColor="rgb(100,100,100)",ae.colourPalette={orange:["rgb(255,187,120)","rgb(245,167,100)","rgb(235,137,70)","rgb(205, 111, 71)"],all_green:["rgb(44,160,44)","rgb(74,160,74)","rgb(23,103,57)","rgb(30,110,96)","rgb(60,131,95)","rgb(24,110,79)","rgb(152,223,138)","rgb(182, 223, 138)","rgb(152, 193, 138)"],all_blue:["rgb(31,119,180)","rgb(23,190,207)","rgb(122, 102, 189)","rgb(158,218,229)","rgb(141, 124, 217)","rgb(31, 120, 150)"],magenta:["rgb(162,106,192)","rgb(197,165,224)","rgb(208,113,218)"],red:["rgb(214,39,40)","rgb(255,152,150)"],st_blue:["rgb(23,190,207)","rgb(158,218,229)","rgb(31,119,180)"],dark_blue:["rgb(31,119,180)","rgb(31, 120, 150)"],light_blue:["rgb(23,190,207)","rgb(158,218,229)","rgb(108, 218, 229)","rgb(23,190,227)"],lilac_blue:["rgb(124,102,211)","rgb(149,134,217)","rgb(97, 81, 150)"],dark_green:["rgb(23,103,57)","rgb(30,110,96)","rgb(60,131,95)","rgb(24,110,79)"],green:["rgb(44,160,44)","rgb(74,160,74)"],light_green:["rgb(152,223,138)","rgb(182, 223, 138)","rgb(152, 193, 138)"],st_green:["rgb(44,160,44)","rgb(152,223,138)","rgb(39, 174, 96)","rgb(74,160,74)"],pink:["rgb(247,182,210)"],brown:["rgb(140,86,75)","rgb(102, 62, 54)"],gray:["rgb(127,127,127)","rgb(199,199,199)","rgb(196,156,148)","rgb(222, 222, 180)"],yellow:["rgb(188,189,34)"],white:["rgb(230,230,230)"]};class le extends ae{static get Lesk(){return void 0===this.lesk&&(this.lesk=this.makePalette([[["G","A","S","T"],"orange"],[["C","V","I","L","P","F","Y","M","W"],"all_green"],[["N","Q","H"],"magenta"],[["D","E"],"red"],[["K","R"],"all_blue"]],!1,le)),this.lesk}static get GrokGroups(){return void 0===this.grokGroups&&(this.grokGroups=this.makePalette([[["C","U"],"yellow"],[["G","P"],"red"],[["A","V","I","L","M","F","Y","W"],"all_green"],[["R","H","K"],"light_blue"],[["D","E"],"dark_blue"],[["S","T","N","Q"],"orange"]],!1,le)),this.grokGroups}static get RasMol(){return void 0===this.rasMol&&(this.rasMol=new le({D:"#E60A0A",E:"#E60A0A",C:"#E6E600",M:"#E6E600",K:"#145AFF",R:"#145AFF",S:"#FA9600",T:"#FA9600",F:"#3232AA",Y:"#3232AA",N:"#00DCDC",Q:"#00DCDC",G:"#EBEBEB",L:"#0F820F",V:"#0F820F",I:"#0F820F",A:"#C8C8C8",W:"#B45AB4",H:"#8282D2",P:"#DC9682",others:"#BEA06E"})),this.rasMol}get(t){const e=t in le.aaSynonyms?le.aaSynonyms[t]:t;return super.get(e)}}le.aaSynonyms={MeNle:"L",MeA:"A",MeG:"G",MeF:"F"};class ce{static getPalette(t="grok"){switch(t){case"grok":return le.GrokGroups;case"lesk":return le.Lesk;default:throw new Error(`ChemPalette: scheme \`${t}\` does not exist`)}}static getInnerOuter(t){let e=0,n="",o="";for(const r of t)"("==r?e++:")"==r?e--:e?n+=r:o+=r;return isNaN(parseInt(n))?[o,n]:[o,""]}static getColorAAPivot(t="",e="grok"){const n=this.getPalette(e);let[o,r]=this.getInnerOuter(t);if(o=o.length>6?`${o.slice(0,3)}...`:o,r=r.length>6?`${r.slice(0,3)}...`:r,1==t.length||"("==t[1]){const e=t[0]?.toUpperCase();return e in n?[n.get(e),e,r,1]:[this.undefinedColor,o,r,1]}if("d"==t[0]&&t[1]in n&&(2==t.length||"("==t[2])){const e=t[1]?.toUpperCase();return e in n?[n.get(e),e,r,2]:[this.undefinedColor,o,r,2]}if(t.substring(0,3)in this.AAFullNames&&(3==t.length||"("==t[3])){const e=this.AAFullNames[t.substring(0,3)];return e in n?[n.get(e),e,r,3]:[this.undefinedColor,o,r,3]}if(t[0]?.toLowerCase()==t[0]&&t.substring(1,3)in this.AAFullNames&&(4==t.length||"("==t[4])){const e=this.AAFullNames[t.substring(1,3)];return e in n?[n.get(e),e,r,4]:[this.undefinedColor,o,r,4]}return[this.undefinedColor,o,r,0]}}ce.SemType="Aminoacids",ce.SemTypeMultipleAlignment="AminoacidsMultipleAlignment",ce.undefinedColor="rgb(100,100,100)",ce.Names={G:"Glycine",L:"Leucine",Y:"Tyrosine",S:"Serine",E:"Glutamic acid",Q:"Glutamine",D:"Aspartic acid",N:"Asparagine",F:"Phenylalanine",A:"Alanine",K:"Lysine",R:"Arginine",H:"Histidine",C:"Cysteine",V:"Valine",P:"Proline",W:"Tryptophan",I:"Isoleucine",M:"Methionine",T:"Threonine"},ce.AASmiles={G:"NCC(=O)O",L:"N[C@H](CC(C)C)C(=O)O",Y:"NC(CC1=CC=C(O)C=C1)C(=O)O",S:"NC(CO)C(=O)O",E:"N[C@@H](CCC(O)=O)C(=O)O",Q:"N[C@@H](CCC(N)=O)C(=O)O",D:"N[C@@H](CC(O)=O)C(=O)O",N:"N[C@@H](CC(N)=O)C(=O)O",F:"NC(CC1=CC=CC=C1)C(=O)O",A:"N[C@H](C)C(=O)O",K:"NC(CCCCN)C(=O)O",R:"N[C@H](CCCNC(=N)C)C(=O)O",H:"NC(CC1=CN=C[N]1)C(=O)O",C:"N[C@@H](CS)C(=O)O",V:"NC(C(C)C)C(=O)O",P:"N(CCC1)C1C(=O)O",W:"N[C@@H](Cc1c2ccccc2n([H])c1)C(=O)O",I:"N[C@H]([C@H](C)CC)C(=O)O",M:"NC(CCSC)C(=O)O",T:"NC(C(O)C)C(=O)O"},ce.AASmilesTruncated={G:"*C*",L:"CC(C)C[C@H](*)*",Y:"C1=CC(=CC=C1CC(*)*)O",S:"OCC(*)C*",E:"*[C@@H](CCC(O)=O)*",Q:"*N[C@@H](CCC(N)=O)*",D:"*[C@@H](CC(O)=O)*",N:"*[C@@H](CC(N)=O)*",F:"C1=CC=C(C=C1)CC(*)*",A:"C[C@H](*)*",K:"C(CCN)CC(*)*",R:"*[C@H](CCCNC(=N)C)*",H:"C1=C(NC=N1)CC(*)*",C:"C([C@@H](*)*)S",V:"CC(C)C(*)*",P:"C1CCN(*)C1*",W:"*[C@@H](Cc1c2ccccc2n([H])c1)*",I:"CC[C@H](C)[C@H](*)*",M:"CSCCC(*)*",T:"CC(O)C(*)*"},ce.AAFullNames={Ala:"A",Arg:"R",Asn:"N",Asp:"D",Cys:"C",Gln:"Q",Glu:"E",Gly:"G",His:"H",Ile:"I",Leu:"L",Lys:"K",Met:"M",Phe:"F",Pro:"P",Ser:"S",Thr:"T",Trp:"W",Tyr:"Y",Val:"V"};class ue{}ue.SemType="Nucleotides",ue.SemTypeMultipleAlignment="NucleotidesMultipleAlignment",ue.Names={A:"Adenine",C:"Cytosine",G:"Guanine",T:"Thymine",U:"Uracil"};class he{static hashCode(t){let e=0;if(0===t.length)return e;for(let n=0;n<t.length;n++)e=(e<<5)-e+t.charCodeAt(n),e|=0;return e}}class de{}class pe extends de{static buildPalette(){return[].concat(...Object.values(ae.colourPalette))}get(t){const e=he.hashCode(t)%pe.palette.length;return function(t){if(null==t)return"rgb(100,100,100)";const e=r.Color.fromHtml(t),n=r.Color.g(e),o=r.Color.r(e),s=r.Color.b(e),i=Math.sqrt(Math.pow(0-o,2)+Math.pow(0-n,2)+Math.pow(0-s,2));return i>210?`rgb(${o/i*210},${n/i*210},${s/i*210})`:r.Color.toRgb(e)}(pe.palette[e])}}function fe(t){return t.toString().replace(Kt,".$1").slice(1).split(".").map((t=>t.startsWith("[")&&t.endsWith("]")?t.slice(1,-1):"-"===t?"":t))}function me(t,e){return n=>n.split(t,e)}pe.palette=pe.buildPalette();const ge=/(PEPTIDE1|DNA1|RNA1)\{([^}]+)}/g,Ae=/\[([^\[\]]+)]/g;function be(t){ge.lastIndex=0;const e=ge.exec(t.toString()),n=e?e[2]:null;return(n?n.split("."):[]).map((t=>{Ae.lastIndex=0;const e=Ae.exec(t);return e&&e.length>=2?e[1]:t}))}async function Ce(){const t=r.Func.find({package:"Bio",name:"getMonomerLibHelper"});if(0===t.length)throw new Error('Package "Bio" must be installer for MonomerLibraryHelper.');return(await t[0].prepare().call()).getOutputParamValue()}function ve(t){const e=t instanceof Error?t.message:t.toString(),n=t instanceof Error?t.stack:void 0;o.shell.error(e),Ee.logger.error(t.message,void 0,n)}var xe=n(61);async function we(t){let e,n;await(0,I.VO)(),await Ee.initMonomerLib();const o=new jt;await o.createLayout(),e=await o.tabs.getControl(),n=e.panes,e.currentPane=n[t]}class ye extends r.Package{_monomerLib;get monomerLib(){if(!this._monomerLib)throw new Error("ST: monomer lib not loaded");return this._monomerLib}async initMonomerLib(){if(void 0!==this._monomerLib)return;const t=r.TaskBarProgressIndicator.create("Initializing Sequence Translator monomer library ...");try{const e=await Ce();this._monomerLib=await e.readLibrary(zt.BX,zt.a_)}catch(t){const e=t.hasOwnProperty("message")?t.message:t.toString();throw new Error("Sequence Translator: Loading monomer library error: "+e)}finally{t.close()}}}const Ee=new ye;async function Te(){const t=r.TaskBarProgressIndicator.create("Loading Sequence Translator app ...");try{await Se();const e=new jt;await e.createLayout()}catch(t){const e=t.hasOwnProperty("message")?t.message:t.toString();throw o.shell.error("Loading Sequence Translator application error: "+e),t}finally{t.close()}}async function Se(){await(0,I.VO)(),await Ee.initMonomerLib()}function Oe(){const t=T.A.getInstance().getCodesToWeightsMap();return Object.fromEntries(t)}function Ie(t){const e=new O(t),n=new M(t).getFormat();return null!==n&&e.isValidSequence(n)}function Me(t,e){return new D.K(t,e,"GCRS").convert()}function Ne(t){return(0,et.v5)(t,!0)}async function Be(){await async function(){try{we(0)}catch(t){ve(t)}}()}async function Le(){await async function(){try{async function t(t,n,o){await(0,xe.gw)(3e3);const r=document.querySelectorAll(".st-pattern-choice-input > select");e=r.length;const s=r[o(n)];s.value=t;const i=new Event("input");s.dispatchEvent(i)}let e;we(1),["DNA","invAb","Z-New"].forEach((async(e,n)=>{t(e,n,(t=>2*t))})),["2'-O-Methyl","2'-Fluoro","2'-O-MOE"].forEach((async(n,o)=>{t(n,o,(t=>e-2-2*t))}))}catch(n){ve(n)}}()}async function Pe(){await async function(){try{await we(2)}catch(t){ve(t)}}()}},50:(t,e,n)=>{n.d(e,{AU:()=>o,wm:()=>r});const o="Copied",r="Copy sequence"},11:(t,e,n)=>{n.d(e,{Iy:()=>r,T_:()=>i,qt:()=>o,sv:()=>s});const o="SEQUENCE",r="PATTERN",s="DUPLEX",i="Afcgacsu"},976:t=>{t.exports=DG},469:t=>{t.exports=grok}},e={};function n(o){var r=e[o];if(void 0!==r)return r.exports;var s=e[o]={id:o,exports:{}};return t[o](s,s.exports,n),s.exports}n.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return n.d(e,{a:e}),e},n.d=(t,e)=>{for(var o in e)n.o(e,o)&&!n.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:e[o]})},n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),n.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.nc=void 0;var o=n(559);sequencetranslator=o})();
1
+ var sequencetranslator;(()=>{"use strict";var t={622:(t,e,n)=>{n.d(e,{w:()=>i});class o{constructor(t){this.init(t)}init(t){this.fileContent=t.replace(/\r/g,""),this._atomCount=void 0,this._atomTypes=void 0,this._bondCount=void 0,this._bondTypes=void 0,this.xyzAtomCoordinates=void 0,this._pairsOfBondedAtoms=void 0}get atomCount(){return void 0===this._atomCount&&this.setAtomAndBondCounts(),this._atomCount}get bondCount(){return void 0===this._bondCount&&this.setAtomAndBondCounts(),this._bondCount}get x(){var t;return null!==(t=this.xyzAtomCoordinates)&&void 0!==t||(this.xyzAtomCoordinates=this.parseAtomCoordinates()),this.xyzAtomCoordinates.x}get y(){var t;return null!==(t=this.xyzAtomCoordinates)&&void 0!==t||(this.xyzAtomCoordinates=this.parseAtomCoordinates()),this.xyzAtomCoordinates.y}get z(){var t;return null!==(t=this.xyzAtomCoordinates)&&void 0!==t||(this.xyzAtomCoordinates=this.parseAtomCoordinates()),this.xyzAtomCoordinates.z}get atomTypes(){var t;return null!==(t=this._atomTypes)&&void 0!==t||(this._atomTypes=this.parseAtomTypes()),this._atomTypes}get pairsOfBondedAtoms(){var t;return null!==(t=this._pairsOfBondedAtoms)&&void 0!==t||(this._pairsOfBondedAtoms=this.parseBondedAtomPairs()),this._pairsOfBondedAtoms}get bondTypes(){var t;return null!==(t=this._bondTypes)&&void 0!==t||(this._bondTypes=this.parseBondTypes()),this._bondTypes}setAtomAndBondCounts(){const{atomCount:t,bondCount:e}=this.parseAtomAndBondCounts();this._atomCount=t,this._bondCount=e}getNextColumnIdx(t){for(;!this.isWhitespace(t);)++t;for(;this.isWhitespace(t);)++t;return t}shiftIdxToSpecifiedColumn(t,e){let n=t;const o=this.isWhitespace(n)?e:e-1;for(let t=0;t<o;t++)n=this.getNextColumnIdx(n);return n}parseAtomTypes(){const t=this.atomCount,e=new Array(t);let n=this.getAtomBlockIdx();for(let o=0;o<t;o++)n=this.shiftIdxToAtomType(n),e[o]=this.parseAtomType(n),n=this.getNextLineIdx(n);return e}parseAtomCoordinates(){const t=new Float32Array(this.atomCount),e=new Float32Array(this.atomCount),n=new Float32Array(this.atomCount);let o=this.getAtomBlockIdx();for(let i=0;i<this.atomCount;i++){o=this.shiftIdxToXColumn(o);for(const r of[t,e,n])r[i]=this.parseFloatValue(o),o=this.getNextColumnIdx(o);o=this.getNextLineIdx(o)}return{x:t,y:e,z:n}}parseBondedAtomPairs(){const t=new Array(this.bondCount);let e=this.getBondBlockIdx();for(let n=0;n<this.bondCount;n++){e=this.shiftIdxToBondedAtomsPair(e);const o=new Uint16Array(2);o[0]=this.parseIntValue(e),e=this.getNextColumnIdx(e),o[1]=this.parseIntValue(e),t[n]=o,e=this.getNextLineIdx(e)}return t}parseBondTypes(){const t=this.bondCount,e=new Uint16Array(t);let n=this.getBondBlockIdx();for(let o=0;o<t;o++)n=this.shiftIdxToBondType(n),e[o]=this.parseIntValue(n),n=this.getNextLineIdx(n);return e}isWhitespace(t){const e=this.fileContent[t];return" "===e||"\t"===e}getNextLineIdx(t){return"\n"!==this.fileContent[t]?this.fileContent.indexOf("\n",t)+1:t+1}parseFloatValue(t){return this.parseNumericValue(parseFloat,t)}parseIntValue(t){return this.parseNumericValue(parseInt,t)}parseNumericValue(t,e){let n=e+1;for(;!this.isWhitespace(n);)++n;return t(this.fileContent.substring(e,n))}}class i extends o{constructor(t){super(t),this.init(t)}init(t){super.init(t)}parseAtomType(t){let e=t,n=e;return this.isQuote(e)?(n=this.getNextIdenticalChar(e),e++):n=this.fileContent.indexOf(" ",n),this.fileContent.substring(e,n)}isQuote(t){const e=this.fileContent[t].charCodeAt(0);return 39===e||34===e}getNextIdenticalChar(t){const e=this.fileContent[t];return e?this.fileContent.indexOf(e,t+1):-1}isQuery(){return this.isQueryOrFragment(((t,e)=>{return 39===t||34===t||76===t&&!((n=this.fileContent.charCodeAt(e+1))>64&&n<91||n>96&&n<123);var n}))}isFragment(){return this.isQueryOrFragment((t=>82===t||42===t))}isQueryOrFragment(t){const e=this.atomCount;let n=this.getAtomBlockIdx();for(let o=0;o<e;o++){if(n=this.shiftIdxToAtomType(n),t(this.fileContent.charCodeAt(n),n))return!0;n=this.getNextLineIdx(n)}return!1}}},577:(t,e,n)=>{n.d(e,{u:()=>i});var o=n(622);class i extends o.w{constructor(t){super(t),this.init(t)}shiftIdxToAtomType(t){return this.shiftIdxToSpecifiedColumn(t,4)}getCountsLineIdx(){return this.fileContent.indexOf("M V30 COUNTS ")}getAtomBlockIdx(){let t=this.fileContent.indexOf("M V30 BEGIN ATOM");return t=this.getNextLineIdx(t),t}shiftIdxToXColumn(t){let e=this.shiftIdxToAtomType(t);return this.isQuote(e)?(e=this.getNextIdenticalChar(e),e=this.getNextColumnIdx(e),e):this.shiftIdxToSpecifiedColumn(t,5)}shiftIdxToBondedAtomsPair(t){return this.shiftIdxToSpecifiedColumn(t,5)}shiftIdxToBondType(t){return this.shiftIdxToSpecifiedColumn(t,4)}getBondBlockIdx(){return this.getNextLineIdx(this.fileContent.indexOf("M V30 BEGIN BOND"))}static validate(t){return-1!==t.indexOf("V3000")&&-1!==t.indexOf("M END")}parseAtomAndBondCounts(){let t=this.fileContent.indexOf("M V30 COUNTS ")+14,e=this.fileContent.indexOf(" ",t+1);const n=parseInt(this.fileContent.substring(t,e));return t=e+1,e=this.fileContent.indexOf(" ",t+1),{atomCount:n,bondCount:parseInt(this.fileContent.substring(t,e))}}}},61:(t,e,n)=>{n.d(e,{gw:()=>i}),n(469),n(976);var o;function i(t){return e=this,n=void 0,i=function*(){yield new Promise((e=>setTimeout(e,t)))},new((o=void 0)||(o=Promise))((function(t,r){function s(t){try{l(i.next(t))}catch(t){r(t)}}function a(t){try{l(i.throw(t))}catch(t){r(t)}}function l(e){var n;e.done?t(e.value):(n=e.value,n instanceof o?n:new o((function(t){t(n)}))).then(s,a)}l((i=i.apply(e,n||[])).next())}));var e,n,o,i}!function(t){t.notNull=function(t,e){if(null==t)throw new Error(`${null==e?"Value":e} not defined`)}}(o||(o={}))},604:(t,e,n)=>{function o(t){var e;return"string"==typeof t||t instanceof String?t:"$thrownJsError"in t?o(t.$thrownJsError):t instanceof Error?null!==(e=t.stack)&&void 0!==e?e:t.message:t.toString()}n.d(e,{O:()=>o})},973:(t,e,n)=>{n.d(e,{Z:()=>a});var o=n(537),i=n.n(o),r=n(645),s=n.n(r)()(i());s.push([t.id,".colored-text-input > textarea {\n width: 100%;\n -webkit-text-fill-color: transparent;\n background-color: transparent;\n position: relative;\n z-index: 1;\n resize: none;\n height: 22px; /* Fine tuned value to avoid \"jumping\" of the textarea upon autoresize */\n}\n\n.colored-text-input > div {\n /* The values here are fine tuned to those of the ui.input textarea in order\n * to achieve precise overlap */\n overflow: auto;\n position: absolute;\n pointer-events: none;\n cursor: text;\n z-index: 0;\n max-width: 100%;\n padding: 2px;\n line-height: normal;\n font-family: 'Roboto Mono', 'Roboto Mono Local', monospace;\n font-size: 12px;\n color: transparent;\n white-space: pre-wrap;\n word-wrap: break-word;\n}\n","",{version:3,sources:["webpack://./src/view/css/colored-text-input.css"],names:[],mappings:"AAAA;EACE,WAAW;EACX,oCAAoC;EACpC,6BAA6B;EAC7B,kBAAkB;EAClB,UAAU;EACV,YAAY;EACZ,YAAY,EAAE,wEAAwE;AACxF;;AAEA;EACE;iCAC+B;EAC/B,cAAc;EACd,kBAAkB;EAClB,oBAAoB;EACpB,YAAY;EACZ,UAAU;EACV,eAAe;EACf,YAAY;EACZ,mBAAmB;EACnB,0DAA0D;EAC1D,eAAe;EACf,kBAAkB;EAClB,qBAAqB;EACrB,qBAAqB;AACvB",sourcesContent:[".colored-text-input > textarea {\n width: 100%;\n -webkit-text-fill-color: transparent;\n background-color: transparent;\n position: relative;\n z-index: 1;\n resize: none;\n height: 22px; /* Fine tuned value to avoid \"jumping\" of the textarea upon autoresize */\n}\n\n.colored-text-input > div {\n /* The values here are fine tuned to those of the ui.input textarea in order\n * to achieve precise overlap */\n overflow: auto;\n position: absolute;\n pointer-events: none;\n cursor: text;\n z-index: 0;\n max-width: 100%;\n padding: 2px;\n line-height: normal;\n font-family: 'Roboto Mono', 'Roboto Mono Local', monospace;\n font-size: 12px;\n color: transparent;\n white-space: pre-wrap;\n word-wrap: break-word;\n}\n"],sourceRoot:""}]);const a=s},284:(t,e,n)=>{n.d(e,{Z:()=>a});var o=n(537),i=n.n(o),r=n(645),s=n.n(r)()(i());s.push([t.id,"/* Naming convention: class names should begin with st and tab name (main, axo, sdf) to avoid naming collitions */\n.st-main-input-table {\n width: 100%;\n}\n\n.st-main-input-table td:has(textarea) {\n width: 100%;\n padding-right: 20px;\n}\n\n.st-main-input-table td:has(select) {\n min-width: 120px;\n vertical-align: top;\n}\n\n.st-main-output-table {\n margin-top: 20px;\n margin-right: 20px;\n margin-bottom: 10px;\n}\n\n.st-main-output-table table {\n width: 100%;\n table-layout: fixed;\n}\n\n/* .st-main-output-table table tbody tr td { */\n/* max-width: 20%; */\n/* } */\n\n.st-main-output-table td {\n padding-top: 6px;\n padding-bottom: 6px;\n}\n.st-main-output-table tr:nth-child(even) {\n background-color: var(--grey-1);\n}\n\n.st-main-output-table td:nth-child(odd) {\n width: 120px;\n vertical-align: top;\n}\n\n.st-main-output-table td a {\n overflow-wrap: break-word;\n}\n","",{version:3,sources:["webpack://./src/view/css/main-tab.css"],names:[],mappings:"AAAA,iHAAiH;AACjH;EACE,WAAW;AACb;;AAEA;EACE,WAAW;EACX,mBAAmB;AACrB;;AAEA;EACE,gBAAgB;EAChB,mBAAmB;AACrB;;AAEA;EACE,gBAAgB;EAChB,kBAAkB;EAClB,mBAAmB;AACrB;;AAEA;EACE,WAAW;EACX,mBAAmB;AACrB;;AAEA,8CAA8C;AAC9C,sBAAsB;AACtB,MAAM;;AAEN;EACE,gBAAgB;EAChB,mBAAmB;AACrB;AACA;EACE,+BAA+B;AACjC;;AAEA;EACE,YAAY;EACZ,mBAAmB;AACrB;;AAEA;EACE,yBAAyB;AAC3B",sourcesContent:["/* Naming convention: class names should begin with st and tab name (main, axo, sdf) to avoid naming collitions */\n.st-main-input-table {\n width: 100%;\n}\n\n.st-main-input-table td:has(textarea) {\n width: 100%;\n padding-right: 20px;\n}\n\n.st-main-input-table td:has(select) {\n min-width: 120px;\n vertical-align: top;\n}\n\n.st-main-output-table {\n margin-top: 20px;\n margin-right: 20px;\n margin-bottom: 10px;\n}\n\n.st-main-output-table table {\n width: 100%;\n table-layout: fixed;\n}\n\n/* .st-main-output-table table tbody tr td { */\n/* max-width: 20%; */\n/* } */\n\n.st-main-output-table td {\n padding-top: 6px;\n padding-bottom: 6px;\n}\n.st-main-output-table tr:nth-child(even) {\n background-color: var(--grey-1);\n}\n\n.st-main-output-table td:nth-child(odd) {\n width: 120px;\n vertical-align: top;\n}\n\n.st-main-output-table td a {\n overflow-wrap: break-word;\n}\n"],sourceRoot:""}]);const a=s},865:(t,e,n)=>{n.d(e,{Z:()=>a});var o=n(537),i=n.n(o),r=n(645),s=n.n(r)()(i());s.push([t.id,"/* Naming convention: class names should begin with st and tab name (main, axo, sdf) to avoid naming collitions */\n\n.st-sdf-body {\n padding-right: 20px;\n}\n\n.st-sdf-input-form {\n text-align: right;\n vertical-align: top;\n min-width: 95px;\n}\n\n.st-sdf-direction-choice label {\n min-width: 100px;\n float: right;\n}\n\n.st-sdf-direction-choice div {\n justify-content: right;\n}\n\n.st-sdf-text-input-td { /* Style for td containing textarea */\n width: 100%;\n}\n\n.st-sdf-mol-img {\n margin-right: 30px;\n float: right;\n}\n\n.st-sdf-bool-button-block {\n justify-content: right;\n margin-bottom: 10px;\n}\n\n.st-sdf-bottom {\n flex-direction: row-reverse;\n padding-top: 20px;\n}\n","",{version:3,sources:["webpack://./src/view/css/sdf-tab.css"],names:[],mappings:"AAAA,iHAAiH;;AAEjH;EACE,mBAAmB;AACrB;;AAEA;EACE,iBAAiB;EACjB,mBAAmB;EACnB,eAAe;AACjB;;AAEA;EACE,gBAAgB;EAChB,YAAY;AACd;;AAEA;EACE,sBAAsB;AACxB;;AAEA,wBAAwB,qCAAqC;EAC3D,WAAW;AACb;;AAEA;EACE,kBAAkB;EAClB,YAAY;AACd;;AAEA;EACE,sBAAsB;EACtB,mBAAmB;AACrB;;AAEA;EACE,2BAA2B;EAC3B,iBAAiB;AACnB",sourcesContent:["/* Naming convention: class names should begin with st and tab name (main, axo, sdf) to avoid naming collitions */\n\n.st-sdf-body {\n padding-right: 20px;\n}\n\n.st-sdf-input-form {\n text-align: right;\n vertical-align: top;\n min-width: 95px;\n}\n\n.st-sdf-direction-choice label {\n min-width: 100px;\n float: right;\n}\n\n.st-sdf-direction-choice div {\n justify-content: right;\n}\n\n.st-sdf-text-input-td { /* Style for td containing textarea */\n width: 100%;\n}\n\n.st-sdf-mol-img {\n margin-right: 30px;\n float: right;\n}\n\n.st-sdf-bool-button-block {\n justify-content: right;\n margin-bottom: 10px;\n}\n\n.st-sdf-bottom {\n flex-direction: row-reverse;\n padding-top: 20px;\n}\n"],sourceRoot:""}]);const a=s},645:t=>{t.exports=function(t){var e=[];return e.toString=function(){return this.map((function(e){var n="",o=void 0!==e[5];return e[4]&&(n+="@supports (".concat(e[4],") {")),e[2]&&(n+="@media ".concat(e[2]," {")),o&&(n+="@layer".concat(e[5].length>0?" ".concat(e[5]):""," {")),n+=t(e),o&&(n+="}"),e[2]&&(n+="}"),e[4]&&(n+="}"),n})).join("")},e.i=function(t,n,o,i,r){"string"==typeof t&&(t=[[null,t,void 0]]);var s={};if(o)for(var a=0;a<this.length;a++){var l=this[a][0];null!=l&&(s[l]=!0)}for(var c=0;c<t.length;c++){var u=[].concat(t[c]);o&&s[u[0]]||(void 0!==r&&(void 0===u[5]||(u[1]="@layer".concat(u[5].length>0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=r),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),i&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=i):u[4]="".concat(i)),e.push(u))}},e}},537:t=>{t.exports=function(t){var e=t[1],n=t[3];if(!n)return e;if("function"==typeof btoa){var o=btoa(unescape(encodeURIComponent(JSON.stringify(n)))),i="sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(o),r="/*# ".concat(i," */");return[e].concat([r]).join("\n")}return[e].join("\n")}},803:(t,e)=>{var n;!function(){var o=e||{}||this||window;void 0===(n=function(){return o}.apply(e,[]))||(t.exports=n),o.default=o;var i="http://www.w3.org/2000/xmlns/",r="http://www.w3.org/2000/svg",s=/url\(["']?(.+?)["']?\)/,a={woff2:"font/woff2",woff:"font/woff",otf:"application/x-font-opentype",ttf:"application/x-font-ttf",eot:"application/vnd.ms-fontobject",sfnt:"application/font-sfnt",svg:"image/svg+xml"},l=function(t){return t instanceof HTMLElement||t instanceof SVGElement},c=function(t){if(!l(t))throw new Error("an HTMLElement or SVGElement is required; got "+t)},u=function(t){return new Promise((function(e,n){l(t)?e(t):n(new Error("an HTMLElement or SVGElement is required; got "+t))}))},d=function(t,e,n){var o=t.viewBox&&t.viewBox.baseVal&&t.viewBox.baseVal[n]||null!==e.getAttribute(n)&&!e.getAttribute(n).match(/%$/)&&parseInt(e.getAttribute(n))||t.getBoundingClientRect()[n]||parseInt(e.style[n])||parseInt(window.getComputedStyle(t).getPropertyValue(n));return null==o||isNaN(parseFloat(o))?0:o},h=function(t){for(var e=window.atob(t.split(",")[1]),n=t.split(",")[0].split(":")[1].split(";")[0],o=new ArrayBuffer(e.length),i=new Uint8Array(o),r=0;r<e.length;r++)i[r]=e.charCodeAt(r);return new Blob([o],{type:n})},p={},f=null,m=function(t,e){var n=e||{},o=n.selectorRemap,i=n.modifyStyle,r=n.modifyCss,l=n.fonts,c=n.excludeUnusedCss,u=r||function(t,e){return(o?o(t):t)+"{"+(i?i(e):e)+"}\n"},d=[],h=void 0===l,m=l||[];return(f||(f=Array.from(document.styleSheets).map((function(t){try{return{rules:t.cssRules,href:t.href}}catch(e){return console.warn("Stylesheet could not be loaded: "+t.href,e),{}}})))).forEach((function(e){var n=e.rules,o=e.href;n&&Array.from(n).forEach((function(e){if(void 0!==e.style)if(function(t,e){if(e)try{return t.querySelector(e)||t.parentNode&&t.parentNode.querySelector(e)}catch(t){console.warn('Invalid CSS selector "'+e+'"',t)}}(t,e.selectorText))d.push(u(e.selectorText,e.style.cssText));else if(h&&e.cssText.match(/^@font-face/)){var n=function(t,e){var n=t.cssText.match(s),o=n&&n[1]||"";if(o&&!o.match(/^data:/)&&"about:blank"!==o){var i,r,l=o.startsWith("../")?e+"/../"+o:o.startsWith("./")?e+"/."+o:o;return{text:t.cssText,format:(i=l,r=Object.keys(a).filter((function(t){return i.indexOf("."+t)>0})).map((function(t){return a[t]})),r?r[0]:(console.error("Unknown font format for "+i+". Fonts may not be working correctly."),"application/octet-stream")),url:l}}}(e,o);n&&m.push(n)}else c||d.push(e.cssText)}))})),function(t){return Promise.all(t.map((function(t){return new Promise((function(e,n){if(p[t.url])return e(p[t.url]);var o=new XMLHttpRequest;o.addEventListener("load",(function(){var n=function(t){for(var e="",n=new Uint8Array(t),o=0;o<n.byteLength;o++)e+=String.fromCharCode(n[o]);return window.btoa(e)}(o.response),i=t.text.replace(s,'url("data:'+t.format+";base64,"+n+'")')+"\n";p[t.url]=i,e(i)})),o.addEventListener("error",(function(n){console.warn("Failed to load font from: "+t.url,n),p[t.url]=null,e(null)})),o.addEventListener("abort",(function(n){console.warn("Aborted loading font from: "+t.url,n),e(null)})),o.open("GET",t.url),o.responseType="arraybuffer",o.send()}))}))).then((function(t){return t.filter((function(t){return t})).join("")}))}(m).then((function(t){return d.join("\n")+t}))},g=function(){if(!navigator.msSaveOrOpenBlob&&!("download"in document.createElement("a")))return{popup:window.open()}};o.prepareSvg=function(t,e,n){c(t);var o=e||{},s=o.left,a=void 0===s?0:s,l=o.top,u=void 0===l?0:l,h=o.width,p=o.height,f=o.scale,g=void 0===f?1:f,A=o.responsive,v=void 0!==A&&A,b=o.excludeCss,C=void 0!==b&&b;return function(t){return Promise.all(Array.from(t.querySelectorAll("image")).map((function(t){var e,n=t.getAttributeNS("http://www.w3.org/1999/xlink","href")||t.getAttribute("href");return n?((e=n)&&0===e.lastIndexOf("http",0)&&-1===e.lastIndexOf(window.location.host)&&(n+=(-1===n.indexOf("?")?"?":"&")+"t="+(new Date).valueOf()),new Promise((function(e,o){var i=document.createElement("canvas"),r=new Image;r.crossOrigin="anonymous",r.src=n,r.onerror=function(){return o(new Error("Could not load "+n))},r.onload=function(){i.width=r.width,i.height=r.height,i.getContext("2d").drawImage(r,0,0),t.setAttributeNS("http://www.w3.org/1999/xlink","href",i.toDataURL("image/png")),e(!0)}}))):Promise.resolve(null)})))}(t).then((function(){var o=t.cloneNode(!0);o.style.backgroundColor=(e||{}).backgroundColor||t.style.backgroundColor;var s=function(t,e,n,o){if("svg"===t.tagName)return{width:n||d(t,e,"width"),height:o||d(t,e,"height")};if(t.getBBox){var i=t.getBBox(),r=i.x,s=i.y;return{width:r+i.width,height:s+i.height}}}(t,o,h,p),l=s.width,c=s.height;if("svg"!==t.tagName){if(!t.getBBox)return void console.error("Attempted to render non-SVG element",t);null!=o.getAttribute("transform")&&o.setAttribute("transform",o.getAttribute("transform").replace(/translate\(.*?\)/,""));var f=document.createElementNS("http://www.w3.org/2000/svg","svg");f.appendChild(o),o=f}if(o.setAttribute("version","1.1"),o.setAttribute("viewBox",[a,u,l,c].join(" ")),o.getAttribute("xmlns")||o.setAttributeNS(i,"xmlns",r),o.getAttribute("xmlns:xlink")||o.setAttributeNS(i,"xmlns:xlink","http://www.w3.org/1999/xlink"),v?(o.removeAttribute("width"),o.removeAttribute("height"),o.setAttribute("preserveAspectRatio","xMinYMin meet")):(o.setAttribute("width",l*g),o.setAttribute("height",c*g)),Array.from(o.querySelectorAll("foreignObject > *")).forEach((function(t){t.setAttributeNS(i,"xmlns","svg"===t.tagName?r:"http://www.w3.org/1999/xhtml")})),!C)return m(t,e).then((function(t){var e=document.createElement("style");e.setAttribute("type","text/css"),e.innerHTML="<![CDATA[\n"+t+"\n]]>";var i=document.createElement("defs");i.appendChild(e),o.insertBefore(i,o.firstChild);var r=document.createElement("div");r.appendChild(o);var s=r.innerHTML.replace(/NS\d+:href/gi,'xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href');if("function"!=typeof n)return{src:s,width:l,height:c};n(s,l,c)}));var A=document.createElement("div");A.appendChild(o);var b=A.innerHTML;if("function"!=typeof n)return{src:b,width:l,height:c};n(b,l,c)}))},o.svgAsDataUri=function(t,e,n){return c(t),o.prepareSvg(t,e).then((function(t){var e=t.src,o=t.width,i=t.height,r="data:image/svg+xml;base64,"+window.btoa(decodeURIComponent(encodeURIComponent('<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [<!ENTITY nbsp "&#160;">]>'+e).replace(/%([0-9A-F]{2})/g,(function(t,e){var n=String.fromCharCode("0x"+e);return"%"===n?"%25":n}))));return"function"==typeof n&&n(r,o,i),r}))},o.svgAsPngUri=function(t,e,n){c(t);var i=e||{},r=i.encoderType,s=void 0===r?"image/png":r,a=i.encoderOptions,l=void 0===a?.8:a,u=i.canvg,d=function(t){var e=t.src,o=t.width,i=t.height,r=document.createElement("canvas"),a=r.getContext("2d"),c=window.devicePixelRatio||1;r.width=o*c,r.height=i*c,r.style.width=r.width+"px",r.style.height=r.height+"px",a.setTransform(c,0,0,c,0,0),u?u(r,e):a.drawImage(e,0,0);var d=void 0;try{d=r.toDataURL(s,l)}catch(t){if("undefined"!=typeof SecurityError&&t instanceof SecurityError||"SecurityError"===t.name)return void console.error("Rendered SVG images cannot be downloaded in this browser.");throw t}return"function"==typeof n&&n(d,r.width,r.height),Promise.resolve(d)};return u?o.prepareSvg(t,e).then(d):o.svgAsDataUri(t,e).then((function(t){return new Promise((function(e,n){var o=new Image;o.onload=function(){return e(d({src:o,width:o.width,height:o.height}))},o.onerror=function(){n("There was an error loading the data URI as an image on the following SVG\n"+window.atob(t.slice(26))+"Open the following link to see browser's diagnosis\n"+t)},o.src=t}))}))},o.download=function(t,e,n){if(navigator.msSaveOrOpenBlob)navigator.msSaveOrOpenBlob(h(e),t);else{var o=document.createElement("a");if("download"in o){o.download=t,o.style.display="none",document.body.appendChild(o);try{var i=h(e),r=URL.createObjectURL(i);o.href=r,o.onclick=function(){return requestAnimationFrame((function(){return URL.revokeObjectURL(r)}))}}catch(t){console.error(t),console.warn("Error while getting object URL. Falling back to string URL."),o.href=e}o.click(),document.body.removeChild(o)}else n&&n.popup&&(n.popup.document.title=t,n.popup.location.replace(e))}},o.saveSvg=function(t,e,n){var i=g();return u(t).then((function(t){return o.svgAsDataUri(t,n||{})})).then((function(t){return o.download(e,t,i)}))},o.saveSvgAsPng=function(t,e,n){var i=g();return u(t).then((function(t){return o.svgAsPngUri(t,n||{})})).then((function(t){return o.download(e,t,i)}))}}()},379:t=>{var e=[];function n(t){for(var n=-1,o=0;o<e.length;o++)if(e[o].identifier===t){n=o;break}return n}function o(t,o){for(var r={},s=[],a=0;a<t.length;a++){var l=t[a],c=o.base?l[0]+o.base:l[0],u=r[c]||0,d="".concat(c," ").concat(u);r[c]=u+1;var h=n(d),p={css:l[1],media:l[2],sourceMap:l[3],supports:l[4],layer:l[5]};if(-1!==h)e[h].references++,e[h].updater(p);else{var f=i(p,o);o.byIndex=a,e.splice(a,0,{identifier:d,updater:f,references:1})}s.push(d)}return s}function i(t,e){var n=e.domAPI(e);return n.update(t),function(e){if(e){if(e.css===t.css&&e.media===t.media&&e.sourceMap===t.sourceMap&&e.supports===t.supports&&e.layer===t.layer)return;n.update(t=e)}else n.remove()}}t.exports=function(t,i){var r=o(t=t||[],i=i||{});return function(t){t=t||[];for(var s=0;s<r.length;s++){var a=n(r[s]);e[a].references--}for(var l=o(t,i),c=0;c<r.length;c++){var u=n(r[c]);0===e[u].references&&(e[u].updater(),e.splice(u,1))}r=l}}},569:t=>{var e={};t.exports=function(t,n){var o=function(t){if(void 0===e[t]){var n=document.querySelector(t);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(t){n=null}e[t]=n}return e[t]}(t);if(!o)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");o.appendChild(n)}},216:t=>{t.exports=function(t){var e=document.createElement("style");return t.setAttributes(e,t.attributes),t.insert(e,t.options),e}},565:(t,e,n)=>{t.exports=function(t){var e=n.nc;e&&t.setAttribute("nonce",e)}},795:t=>{t.exports=function(t){var e=t.insertStyleElement(t);return{update:function(n){!function(t,e,n){var o="";n.supports&&(o+="@supports (".concat(n.supports,") {")),n.media&&(o+="@media ".concat(n.media," {"));var i=void 0!==n.layer;i&&(o+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),o+=n.css,i&&(o+="}"),n.media&&(o+="}"),n.supports&&(o+="}");var r=n.sourceMap;r&&"undefined"!=typeof btoa&&(o+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(r))))," */")),e.styleTagTransform(o,t,e.options)}(e,t,n)},remove:function(){!function(t){if(null===t.parentNode)return!1;t.parentNode.removeChild(t)}(e)}}}},589:t=>{t.exports=function(t,e){if(e.styleSheet)e.styleSheet.cssText=t;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(t))}}},29:(t,e,n)=>{n.d(e,{NI:()=>i,mc:()=>o});const o=["A","G","C","U","T"];var i;!function(t){t.HELM="HELM",t.AXOLABS="Axolabs"}(i||(i={}))},895:(t,e,n)=>{n.d(e,{BX:()=>o,Dv:()=>a,VV:()=>l,Xz:()=>c,a_:()=>i,dz:()=>s,pl:()=>r});const o="System:AppData/SequenceTranslator",i="monomer-lib.json",r="System:AppData/SequenceTranslator",s="axolabs-style.json",a="formats-to-helm.json",l="codes-to-symbols.json",c="linkers.json"},996:(t,e,n)=>{n.d(e,{BF:()=>l,Rv:()=>a,VO:()=>u,al:()=>s,iA:()=>c});var o=n(976),i=n(895);const r=new o.FileSource(i.pl);let s,a,l,c;async function u(){[s,a,l,c].every((t=>void 0!==t))||(s=await d(i.dz),a=await d(i.Dv),l=await d(i.VV),c=await d(i.Xz))}async function d(t){let e;try{e=JSON.parse(await r.readAsText(t))}catch(e){const n=e.hasOwnProperty("message")?e.message:e.toString();throw new Error(`Error loading json from ${t}:`+n)}return e}},800:(t,e,n)=>{n.d(e,{$3:()=>i,DD:()=>o,s8:()=>r});const o={NUCLEOSIDE:"nucleoside",LINKAGE:"phosphateBackbone"},i="p",r="<?>"},112:(t,e,n)=>{n.d(e,{D:()=>l});var o=n(29),i=n(800),r=n(893),s=n(996),a=n(559);function l(t,e,n){const l=Object.keys(s.Rv).concat([o.NI.HELM]);if(!t||-1!==e&&n!==o.NI.HELM)return{};if(!l.includes(n))throw new Error(`${n} format is not supported by SequenceTranslator`);const c=l.filter((t=>t!=n)).sort(((t,e)=>t.localeCompare(e))),u=new r.I(t,n),d=Object.fromEntries(c.map((t=>{let e;try{e=u.convertTo(t)}catch{e=null}return[t,e]})).filter((([t,e])=>e))),h=function(t,e){const n=new RegExp("\\([^()]*\\)","g"),r=t.match(n);if(!r)return null;return r.map((t=>{const n=t.replace(/[\[\]()]/g,"");return o.mc.includes(n)?n:e.getNaturalAnalogBySymbol(n)})).map((t=>t||i.s8)).join("")}(n===o.NI.HELM?t:d[o.NI.HELM],a.A.getInstance());return h&&(d.Nucleotides=h),d}},893:(t,e,n)=>{n.d(e,{I:()=>a});var o=n(29),i=n(800),r=n(996);const s={LEFT:"RNA1{",RIGHT:"}$$$$"};class a{sequence;sourceFormat;constructor(t,e){this.sequence=t,this.sourceFormat=e}convertTo(t){const e=Object.keys(r.Rv);if(this.sourceFormat===o.NI.HELM&&e.includes(t))return u(this.sequence,t);if(e.includes(this.sourceFormat)&&t===o.NI.HELM)return d(this.sequence,this.sourceFormat);if([this.sourceFormat,t].every((t=>e.includes(t))))return u(d(this.sequence,this.sourceFormat),t);throw new Error(`ST: unsupported translation direction ${this.sourceFormat} -> ${t}`)}}function l(t){return t.map((t=>t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"))).map((t=>t.includes("(")||t.includes(")")?t:`(?<!\\([^()]*)${t}(?![^()]*\\))`)).join("|")}function c(t,e){return e.length-t.length}function u(t,e){const n=function(t){const e={};return Object.values(t).forEach((t=>{Object.entries(t).forEach((([t,n])=>{const o=n.replace(/\)p/g,")").replace(/\]p/g,"]");void 0===e[o]?e[o]=[t]:e[o].push(t)}))})),Object.entries(e).forEach((([t,n])=>{const o=n.sort(c);e[t]=o[0]})),e}(r.Rv[e]),o=new RegExp(l(Object.values(s)),"g");let a=t.replace(o,"");const u=Object.keys(n).sort(c),d=new RegExp(l(u)+"|.","g");return a=a.replace(d,(t=>u.includes(t)?n[t]:"p"===t||"."===t?t:"?")).replace(/\?+/g,i.s8).replace(/p\.|\./g,""),a=a.replace(/<empty>/g,""),a=a.replace(/\/\//g,"/"),a}function d(t,e){const n=r.Rv[e],o=Object.assign({},...Object.values(n)),a=Object.keys(o).sort(c),u=new RegExp(l(a)+"|\\([^()]*\\)|.","g"),d=l(Array.from(new Set(Object.values(n[i.DD.LINKAGE]))).sort(c)),h=new RegExp(`${i.$3}.(${d})`,"g");let p=t.replace(u,(t=>a.includes(t)?o[t]+".":"?"));return p=p.replace(/\?+/g,`${i.s8}.`),p=p.slice(0,-1),p[p.length-1]===i.$3&&(p=p.slice(0,-1)),p=p.replace(h,((t,e)=>e)),p=p.replace(/<empty>/g,""),`${s.LEFT+p+s.RIGHT}`}},669:(t,e,n)=>{function o(t){return t.sort(((t,e)=>e.length-t.length))}function i(t,e){const n=document.createElement("a");n.setAttribute("href","data:text/plain;charset=utf-8,"+e),n.setAttribute("download",t),n.click()}n.d(e,{L:()=>i,x:()=>o})},559:(t,e,n)=>{n.d(e,{A:()=>a});var o=n(976),i=n(563),r=n(29),s=n(996);class a{constructor(){const t=i._package.monomerLib;if(null===t)throw new Error("SequenceTranslator: monomer library is null");this.lib=t,this.allMonomers=this.getAllMonomers()}lib;static instance;allMonomers;formatMonomerForViewer(t){const e={};return e.name=t.symbol,e.symbol=t.symbol,e.molfile=t.molfile,this.getAllFormats().forEach((n=>{if(n===r.NI.HELM)return;const o=s.BF[n],i=Object.keys(o).filter((e=>o[e]===t.symbol));e[n]=i.join(", ")})),e}getAllMonomers(){const t=this.lib.getPolymerTypes();let e=[];for(const n of t){const t=this.lib.getMonomerSymbolsByType(n).map((t=>this.lib.getMonomer(n,t))).filter((t=>null!==t));e=e.concat(t)}return e}getMonomer(t){const e=this.lib.getMonomer("RNA",t);if(void 0===e)throw new Error(`SequenceTranslator: no monomer with symbol ${t}`);return e}static getInstance(){return void 0===a.instance&&(a.instance=new a),a.instance}getMolfileBySymbol(t){return this.getMonomer(t).molfile}getNaturalAnalogBySymbol(t){const e=this.getMonomer(t).naturalAnalog;if(!e)throw new Error(`ST: no natural analog for ${t}`);return e}isModification(t){return!!this.getMolfileBySymbol(t).includes("MODIFICATION")}getCodeToSymbolMap(t){return new Map(Object.entries(s.BF[t]))}getCodesByFormat(t){return Object.keys(s.BF[t])}getAllFormats(){return Object.keys(s.BF)}getTableForViewer(){const t=this.allMonomers.map((t=>this.formatMonomerForViewer(t)));return o.DataFrame.fromObjects(t)}getCodesToWeightsMap(){const t=new Map;return Object.entries(s.BF).forEach((([e,n])=>{Object.entries(n).forEach((([e,n])=>{const o=this.getMonomer(n).meta?.molecularWeight;t.set(e,o)}))})),t}}},947:(t,e,n)=>{n.d(e,{b:()=>s});var o=n(29),i=n(559),r=n(669);class s{sequence;constructor(t){this.sequence=t,this.libWrapper=i.A.getInstance()}libWrapper;getInvalidCodeIndex(t){if(t===o.NI.HELM)return this.sequence.length;const e=["r","d"],n=(0,r.x)(this.libWrapper.getCodesByFormat(t));let i=0;for(;i<this.sequence.length;){const t=n.find((t=>t===this.sequence.substring(i,i+t.length)));if(!t)break;if(i>1&&o.mc.includes(this.sequence[i])&&e.includes(this.sequence[i-2]))break;if(e.includes(this.sequence[i+1])&&o.mc.includes(this.sequence[i])){i++;break}i+=t.length}return i===this.sequence.length&&(i=-1),i}isValidSequence(t){return-1===this.getInvalidCodeIndex(t)}}},175:(t,e,n)=>{n.d(e,{$:()=>o});const o="p"},837:(t,e,n)=>{function o(t,e=!0){let n="\nDatagrok macromolecule handler\n\n";n+=" 0 0 0 0 0 0 999 V3000\n",n+="M V30 BEGIN CTAB\n";let o="",a="",l="";const c=[];let u=0,d=0,h=0;if(t.antiStrands.length>0)for(let e=0;e<t.antiStrands.length;e++)t.antiStrands[e]=i(t.antiStrands[e]);let p=!1;const f=t.senseStrands.concat(t.antiStrands);let m=0;for(let e=0;e<f.length;e++){f[e]=f[e].replaceAll("(-\nM V30 ","(").replaceAll("-\nM V30 ","").replaceAll(" )",")");const n=r(f[e]),i=s(f[e]);if(e>=t.senseStrands.length?!1===p&&(p=!0,h=0):m=Math.min(m,Math.min(...i.y.filter((t=>t<0)))),p){const t=Math.min(...i.x)-h,e=Math.max(...i.y)+5;for(let e=0;e<i.x.length;e++)i.x[e]-=t;for(let t=0;t<i.y.length;t++)i.y[t]-=e-m}let l=f[e].indexOf("M V30 BEGIN ATOM");l=f[e].indexOf("\n",l);let g=l,A=l;for(let t=0;t<n.natom;t++){g=f[e].indexOf("V30",g)+4,A=f[e].indexOf(" ",g);const n=parseInt(f[e].substring(g,A))+u;f[e]=f[e].slice(0,g)+n+f[e].slice(A),g=f[e].indexOf(" ",g)+1,g=f[e].indexOf(" ",g)+1,A=f[e].indexOf(" ",g);let o=Math.round(1e4*i.x[t])/1e4;f[e]=f[e].slice(0,g)+o+f[e].slice(A),g=f[e].indexOf(" ",g)+1,A=f[e].indexOf(" ",g),o=Math.round(1e4*i.y[t])/1e4,f[e]=f[e].slice(0,g)+o+f[e].slice(A),g=f[e].indexOf("\n",g)+1}const v=f[e].indexOf("M V30 END ATOM");o+=f[e].substring(l+1,v);let b=f[e].indexOf("M V30 BEGIN BOND");b=f[e].indexOf("\n",b),g=b,A=b;for(let t=0;t<n.nbond;t++){g=f[e].indexOf("V30",g)+4,A=f[e].indexOf(" ",g);const t=parseInt(f[e].substring(g,A))+d;f[e]=f[e].slice(0,g)+t+f[e].slice(A),g=f[e].indexOf(" ",g)+1,g=f[e].indexOf(" ",g)+1,A=f[e].indexOf(" ",g);let n=parseInt(f[e].substring(g,A))+u;f[e]=f[e].slice(0,g)+n+f[e].slice(A),g=f[e].indexOf(" ",g)+1,A=Math.min(f[e].indexOf("\n",g),f[e].indexOf(" ",g)),n=parseInt(f[e].substring(g,A))+u,f[e]=f[e].slice(0,g)+n+f[e].slice(A),g=f[e].indexOf("\n",g)+1}const C=f[e].indexOf("M V30 END BOND");a+=f[e].substring(b+1,C);let x=f[e].indexOf("M V30 MDLV30/STEABS ATOMS=(");for(;-1!==x;){x+=28;const t=f[e].indexOf(")",x);f[e].substring(x,t).split(" ").slice(1).forEach((t=>{c.push(parseInt(t)+u)})),x=t,x=f[e].indexOf("M V30 MDLV30/STEABS ATOMS=(",x)}u+=n.natom,d+=n.nbond,h+=Math.max(...i.x)+5}const g=Math.ceil(c.length/4);l+="M V30 MDLV30/STEABS ATOMS=("+c.length+" -\n";for(let t=0;t<g;t++){l+="M V30 ";const e=t+1===g?c.length-4*(g-1):4;for(let n=0;n<e;n++)l+=n+1===e?t===g-1?c[4*t+n]+")\n":c[4*t+n]+" -\n":c[4*t+n]+" "}return n+="M V30 COUNTS "+u+" "+d+" 0 0 0\n",n+="M V30 BEGIN ATOM\n",n+=o,n+="M V30 END ATOM\n",n+="M V30 BEGIN BOND\n",n+=a,n+="M V30 END BOND\n",e&&c.length>0?(n+="M V30 BEGIN COLLECTION\n",n+=l,n+="M V30 END COLLECTION\n"):n=n.replace(/ CFG=\d/g," "),n+="M V30 END CTAB\n",n+="M END",n}function i(t){const e=s(t),n=e.atomIndex.length,o=(Math.max(...e.x)+Math.min(...e.x))/2,i=(Math.max(...e.y)+Math.min(...e.y))/2;for(let t=0;t<n;t++)e.x[t]-=o,e.y[t]-=i;const r=Math.PI,a=Math.cos(r),l=Math.sin(r);for(let t=0;t<n;t++){const n=e.x[t];e.x[t]=n*a-e.y[t]*l,e.y[t]=n*l+e.y[t]*a}const c=Math.max(...e.y);for(let t=0;t<n;t++)e.x[t]+=o,e.y[t]-=c;let u=t.indexOf("M V30 BEGIN ATOM");u=t.indexOf("\n",u);let d=u;for(let o=0;o<n;o++)u=t.indexOf("V30",u)+4,u=t.indexOf(" ",u)+1,u=t.indexOf(" ",u)+1,d=t.indexOf(" ",u)+1,d=t.indexOf(" ",d),u=(t=t.slice(0,u)+e.x[o]+" "+e.y[o]+t.slice(d)).indexOf("\n",u)+1;return t}function r(t){let e=(t=t.replaceAll("\r","")).indexOf("COUNTS")+7,n=t.indexOf(" ",e);const o=parseInt(t.substring(e,n));return e=n+1,n=t.indexOf(" ",e),{natom:o,nbond:parseInt(t.substring(e,n))}}function s(t){const e=r(t);let n=t.indexOf("M V30 BEGIN ATOM");n=t.indexOf("\n",n);let o=n;const i=Array(e.natom),s=Array(e.natom),a=Array(e.natom),l=Array(e.natom);for(let r=0;r<e.natom;r++)n=t.indexOf("V30",n)+4,o=t.indexOf(" ",n),i[r]=parseInt(t.substring(n,o)),n=o+1,o=t.indexOf(" ",n),s[r]=t.substring(n,o),n=o+1,o=t.indexOf(" ",n),a[r]=parseFloat(t.substring(n,o)),n=o+1,o=t.indexOf(" ",n),l[r]=parseFloat(t.substring(n,o)),n=t.indexOf("\n",n)+1;return{atomIndex:i,atomType:s,x:a,y:l}}n.d(e,{$U:()=>s,v5:()=>o})},563:(t,e,n)=>{n.r(e),n.d(e,{_package:()=>ue,demoDesignPattern:()=>ve,demoTranslateSequence:()=>Ae,demoVisualizeDuplex:()=>be,getCodeToWeightsMap:()=>pe,getMolfileFromGcrsSequence:()=>me,initSequenceTranslatorLibData:()=>he,linkStrands:()=>ge,sequenceTranslatorApp:()=>de,translateOligonucleotideSequence:()=>Ce,validateSequence:()=>fe});var o=n(469),i=n(976);const r=ui;var s=n(11);const a=rxjs;var l=n(379),c=n.n(l),u=n(795),d=n.n(u),h=n(569),p=n.n(h),f=n(565),m=n.n(f),g=n(216),A=n.n(g),v=n(589),b=n.n(v),C=n(284),x={};x.styleTagTransform=b(),x.setAttributes=m(),x.insert=p().bind(null,"head"),x.domAPI=d(),x.insertStyleElement=A(),c()(C.Z,x),C.Z&&C.Z.locals&&C.Z.locals;const w=$;var y=n.n(w),E=n(947),I=n(669),O=n(29),S=n(559),T=n(996);class M{sequence;constructor(t){this.sequence=t,this.libWrapper=S.A.getInstance(),this.formats=Object.keys(T.Rv)}libWrapper;formats;getFormat(){if(this.sequence.startsWith("RNA"))return O.NI.HELM;const t=this.getListOfPossibleSynthesizersByFirstMatchedCode();if(0===t.length)return null;const e=new E.b(this.sequence),n=Array(t.length).fill(0);for(let o=0;o<t.length;++o){const i=t[o];n[o]=e.getInvalidCodeIndex(i)}const o=n.some((t=>-1===t))?-1:Math.max(...n);return t[n.indexOf(o)]}getListOfPossibleSynthesizersByFirstMatchedCode(){const t=this.sequence;let e=[];for(const n of this.formats){let o=(0,I.x)(this.libWrapper.getCodesByFormat(n)),i=0;for(let e=0;e<t.length;e++)if(")"===t[e]&&e!==t.length-1){i=e+1;break}o.some((e=>e===t.slice(i,i+e.length)))&&e.push(n)}return e}}function B(t){let e=0;const n=new M(t).getFormat();null!==n&&(e=new E.b(t).getInvalidCodeIndex(n));const o=e<0||""===t,i=r.span([]);y()(i).css("-webkit-text-fill-color","var(--grey-6)");const s=r.span([]);return y()(s).css("-webkit-text-fill-color","red"),o?i.innerHTML=t:(i.innerHTML=t.slice(0,e),s.innerHTML=t.slice(e)),[i,s]}var N=n(973),L={};L.styleTagTransform=b(),L.setAttributes=m(),L.insert=p().bind(null,"head"),L.domAPI=d(),L.insertStyleElement=A(),c()(N.Z,L),N.Z&&N.Z.locals&&N.Z.locals;class D{textInputBase;constructor(t,e,n=!0){this.textInputBase=t,this.textInputBase=t,this.painter=e,y()(this.root).addClass("colored-text-input"),n&&this.textInputBase.onInput((()=>{y()(this.textArea).css("height",0),y()(this.textArea).css("height",this.textArea.scrollHeight+"px")})),this.highlights=r.div([]),this.root.appendChild(this.highlights),this.colorize(),this.textInputBase.onInput((()=>this.colorize()))}highlights;painter;get textArea(){return this.textInputBase.root.getElementsByTagName("textarea").item(0)}get root(){return this.textInputBase.root}colorize(){const t=this.painter(this.textInputBase.value);this.highlights.innerHTML="",t.forEach((t=>this.highlights.appendChild(t)))}}var k=n(175);class P{sequence;invert;codeMap;constructor(t,e=!1,n){this.sequence=t,this.invert=e,this.codeMap=n,this.lib=S.A.getInstance()}lib;parseSequence(){const t=this.parseRawSequence();return this.addLinkers(t)}addLinkers(t){const e=[];return t.forEach(((n,o)=>{const i=this.getSymbolForCode(n);o>0&&function(t){return T.iA.left.includes(t)}(i)&&e.pop(),e.push(i);const r=V(i),s=o===t.length-1,a=o+1<t.length&&V(this.getSymbolForCode(t[o+1]));r||function(t){return T.iA.right.includes(t)}(i)||a||s||e.push(k.$)})),e}getSymbolForCode(t){let e=this.codeMap.get(t);return e??=t,e}parseRawSequence(){const t=this.getAllCodesOfFormat(),e=[];let n=0;for(;n<this.sequence.length;){const o=t.find((t=>t===this.sequence.substring(n,n+t.length)));this.invert?e.unshift(o):e.push(o),n+=o.length}return e}getAllCodesOfFormat(){let t=Array.from(this.codeMap.keys());return(0,I.x)(t)}}function V(t){return T.iA.phosphate.includes(t)}class F{constructor(t,e=!1,n){this.lib=S.A.getInstance();const o=this.lib.getCodeToSymbolMap(n);this.parser=new P(t,e,o)}parser;lib;convert(){const t=this.parser.parseSequence(),e=[];return t.forEach(((t,n)=>{const o=this.getMonomerMolfile(t,n);e.push(o)})),this.getPolymerMolfile(e)}getMonomerMolfile(t,e){const n=this.lib.getMolfileBySymbol(t);return this.lib.isModification(t)?0===e?this.reflect(n):n:this.rotateNucleotidesV3000(n)}getPolymerMolfile(t){return this.linkV3000(t)}reflect(t){const e=this.extractAtomDataV3000(t),n=e.atomIndex.length,o=e.atomIndex.indexOf(1),i=e.atomIndex.indexOf(n),r=(e.x[i]+e.x[o])/2,s=(e.y[i]+e.y[o])/2;for(let t=0;t<n;t++)e.x[t]-=r,e.y[t]-=s;for(let t=0;t<n;t++)e.x[t]=-e.x[t];const a=e.x[o];for(let t=0;t<n;t++)e.x[t]-=a;let l=t.indexOf("M V30 BEGIN ATOM");l=t.indexOf("\n",l);let c=l;for(let o=0;o<n;o++)l=t.indexOf("V30",l)+4,l=t.indexOf(" ",l)+1,l=t.indexOf(" ",l)+1,c=t.indexOf(" ",l)+1,c=t.indexOf(" ",c),l=(t=t.slice(0,l)+e.x[o]+" "+e.y[o]+t.slice(c)).indexOf("\n",l)+1;return t}extractAtomDataV3000(t){const e=this.extractAtomsBondsNumbersV3000(t);let n=t.indexOf("M V30 BEGIN ATOM");n=t.indexOf("\n",n);let o=n;const i=Array(e.natom),r=Array(e.natom),s=Array(e.natom),a=Array(e.natom);for(let l=0;l<e.natom;l++)n=t.indexOf("V30",n)+4,o=t.indexOf(" ",n),i[l]=parseInt(t.substring(n,o)),n=o+1,o=t.indexOf(" ",n),r[l]=t.substring(n,o),n=o+1,o=t.indexOf(" ",n),s[l]=parseFloat(t.substring(n,o)),n=o+1,o=t.indexOf(" ",n),a[l]=parseFloat(t.substring(n,o)),n=t.indexOf("\n",n)+1;return{atomIndex:i,atomType:r,x:s,y:a}}extractAtomsBondsNumbersV3000(t){let e=(t=t.replaceAll("\r","")).indexOf("COUNTS")+7,n=t.indexOf(" ",e);const o=parseInt(t.substring(e,n));return e=n+1,n=t.indexOf(" ",e),{natom:o,nbond:parseInt(t.substring(e,n))}}rotateNucleotidesV3000(t){const e=this.extractAtomDataV3000(t),n=e.atomIndex.length,o=e.atomIndex.indexOf(1),i=e.atomIndex.indexOf(n);n>8&&this.fix5Prime(e,o,i);const r=(e.x[i]+e.x[o])/2,s=(e.y[i]+e.y[o])/2;for(let t=0;t<n;t++)e.x[t]-=r,e.y[t]-=s;let a=0;if(0===e.x[o])a=e.y[o]>e.y[i]?Math.PI/2:3*Math.PI/2;else if(0===e.y[o])a=e.x[o]>e.x[i]?Math.PI:0;else{const t=e.y[o]/e.x[o];a=t>0?e.x[o]>0?Math.PI-Math.atan(t):2*Math.PI-Math.atan(t):e.x[o]>0?-Math.PI-Math.atan(t):Math.atan(t)}const l=Math.cos(a),c=Math.sin(a);for(let t=0;t<n;t++){const n=e.x[t];e.x[t]=n*l-e.y[t]*c,e.y[t]=n*c+e.y[t]*l}const u=e.x[o];for(let t=0;t<n;t++)e.x[t]-=u;let d=t.indexOf("M V30 BEGIN ATOM");d=t.indexOf("\n",d);let h=d;for(let o=0;o<n;o++)d=t.indexOf("V30",d)+4,d=t.indexOf(" ",d)+1,d=t.indexOf(" ",d)+1,h=t.indexOf(" ",d)+1,h=t.indexOf(" ",h),d=(t=t.slice(0,d)+e.x[o]+" "+e.y[o]+t.slice(h)).indexOf("\n",d)+1;return t}linkV3000(t,e=!0){let n="\nDatagrok macromolecule handler\n\n";n+=" 0 0 0 0 0 0 999 V3000\n",n+="M V30 BEGIN CTAB\n";let o="",i="",r="";const s=[];let a=0,l=0,c=0;for(let e=0;e<t.length;e++){const n=t[e].includes("MODIFICATION")&&0===e;let r=0;n&&(r=this.extractAtomDataV3000(t[e]).atomIndex.length),t[e]=t[e].replaceAll("(-\nM V30 ","(").replaceAll("-\nM V30 ","").replaceAll(" )",")");const u=this.extractAtomsBondsNumbersV3000(t[e]),d=this.extractAtomDataV3000(t[e]);let h=t[e].indexOf("M V30 BEGIN ATOM");h=t[e].indexOf("\n",h);let p=h,f=h;for(let o=0;o<u.natom;o++)if(1!==d.atomIndex[o]||0===e){p=t[e].indexOf("V30",p)+4,f=t[e].indexOf(" ",p);let o=0;n?(o=parseInt(t[e].substring(p,f)),1===o?o=r:o===r&&(o=1),o+=a):o=parseInt(t[e].substring(p,f))+a,t[e]=t[e].slice(0,p)+o+t[e].slice(f),p=t[e].indexOf(" ",p)+1,p=t[e].indexOf(" ",p)+1,f=t[e].indexOf(" ",p);const i=c-d.x[0];let s=Math.round(1e4*(parseFloat(t[e].substring(p,f))+i))/1e4;t[e]=t[e].slice(0,p)+s+t[e].slice(f),p=t[e].indexOf(" ",p)+1,f=t[e].indexOf(" ",p),s=Math.round(1e4*parseFloat(t[e].substring(p,f)))/1e4,t[e]=t[e].slice(0,p)+s+t[e].slice(f),p=t[e].indexOf("\n",p)+1}else p=t[e].indexOf("M V30",p)-1,f=t[e].indexOf("\n",p+1),t[e]=t[e].slice(0,p)+t[e].slice(f);const m=t[e].indexOf("M V30 END ATOM");o+=t[e].substring(h+1,m);let g=t[e].indexOf("M V30 BEGIN BOND");g=t[e].indexOf("\n",g),p=g,f=g;for(let o=0;o<u.nbond;o++){p=t[e].indexOf("V30",p)+4,f=t[e].indexOf(" ",p);const o=parseInt(t[e].substring(p,f))+l;t[e]=t[e].slice(0,p)+o+t[e].slice(f),p=t[e].indexOf(" ",p)+1,p=t[e].indexOf(" ",p)+1,f=t[e].indexOf(" ",p);let i=0;n?(i=parseInt(t[e].substring(p,f)),1===i?i=r:i===r&&(i=1),i+=a):i=parseInt(t[e].substring(p,f))+a,t[e]=t[e].slice(0,p)+i+t[e].slice(f),p=t[e].indexOf(" ",p)+1,f=Math.min(t[e].indexOf("\n",p),t[e].indexOf(" ",p)),i=0,n?(i=parseInt(t[e].substring(p,f)),1===i?i=r:i===r&&(i=1),i+=a):i=parseInt(t[e].substring(p,f))+a,t[e]=t[e].slice(0,p)+i+t[e].slice(f),p=t[e].indexOf("\n",p)+1}const A=t[e].indexOf("M V30 END BOND");i+=t[e].substring(g+1,A);let v=t[e].indexOf("M V30 MDLV30/STEABS ATOMS=(");for(;-1!==v;){v+=28;const n=t[e].indexOf(")",v);t[e].substring(v,n).split(" ").slice(1).forEach((t=>{s.push(parseInt(t)+a)})),v=n,v=t[e].indexOf("M V30 MDLV30/STEABS ATOMS=(",v)}a+=u.natom-1,l+=u.nbond,c+=n?Math.max(...d.x):d.x[u.natom-1]-d.x[0]}const u=Math.ceil(s.length/4);r+="M V30 MDLV30/STEABS ATOMS=("+s.length+" -\n";for(let t=0;t<u;t++){r+="M V30 ";const e=t+1===u?s.length-4*(u-1):4;for(let n=0;n<e;n++)r+=n+1===e?t===u-1?s[4*t+n]+")\n":s[4*t+n]+" -\n":s[4*t+n]+" "}return a++,n+="M V30 COUNTS "+a+" "+l+" 0 0 0\n",n+="M V30 BEGIN ATOM\n",n+=o,n+="M V30 END ATOM\n",n+="M V30 BEGIN BOND\n",n+=i,n+="M V30 END BOND\n",e&&s.length>0?(n+="M V30 BEGIN COLLECTION\n",n+=r,n+="M V30 END COLLECTION\n"):n=n.replace(/ CFG=\d/g," "),n+="M V30 END CTAB\n",n+="M END",n}fix5Prime(t,e,n){const o=e+1,i=t.x[o],r=t.y[o],s=t.x[n]-i,a=t.y[n]-r,l=t.x[e]-i,c=t.y[e]-r,u=l*Math.cos(2*Math.PI/3)-c*Math.sin(2*Math.PI/3),d=l*Math.sin(2*Math.PI/3)+c*Math.cos(2*Math.PI/3),h=l-s,p=c-a,f=u-s,m=d-a;Math.sqrt(m*m+f*f)>=Math.sqrt(p*p+h*h)&&(t.x[e]=u+i,t.y[e]=d+r)}}var _,H=n(112),q=n(622);!function(t){t.HEADER="V2000",t[t.NUM_OF_HEADER_LINES=3]="NUM_OF_HEADER_LINES",t[t.NUM_OF_COUNTS_DIGITS=3]="NUM_OF_COUNTS_DIGITS",t[t.ATOM_TYPE_COL=4]="ATOM_TYPE_COL",t[t.FIRST_BONDED_ATOM_COL=1]="FIRST_BONDED_ATOM_COL",t[t.BOND_TYPE_COL=3]="BOND_TYPE_COL",t[t.RGP_SHIFT=8]="RGP_SHIFT",t.RGP_LINE="M RGP",t.A_LINE="A ",t.END="M END"}(_||(_={}));class R extends q.w{constructor(t){super(t)}static validate(t){return-1!==t.indexOf(_.HEADER)&&-1!==t.indexOf(_.END)}shiftIdxToAtomType(t){return this.shiftIdxToSpecifiedColumn(t,_.ATOM_TYPE_COL)}getCountsLineIdx(){let t=0;for(let e=0;e<_.NUM_OF_HEADER_LINES;++e)t=this.getNextLineIdx(t);return t}getAtomBlockIdx(){let t=this.getCountsLineIdx();return t=this.getNextLineIdx(t),t}shiftIdxToXColumn(t){return this.getNextColumnIdx(t)}shiftIdxToBondedAtomsPair(t){return this.shiftIdxToSpecifiedColumn(t,_.FIRST_BONDED_ATOM_COL)}shiftIdxToBondType(t){return this.shiftIdxToSpecifiedColumn(t,_.BOND_TYPE_COL)}getBondBlockIdx(){let t=this.getAtomBlockIdx();for(let e=0;e<this.atomCount;e++)t=this.getNextLineIdx(t);return t}parseAtomAndBondCounts(){let t=this.getCountsLineIdx(),e=t+_.NUM_OF_COUNTS_DIGITS;const n=parseInt(this.fileContent.substring(t,e));return t=e,e+=_.NUM_OF_COUNTS_DIGITS,{atomCount:n,bondCount:parseInt(this.fileContent.substring(t,e))}}}var j=n(577);class U{constructor(){}static getInstance(t){if(R.validate(t))return new R(t);if(j.u.validate(t))return new j.u(t);throw new Error("Malformed molfile")}}var G=n(604);const W=class extends Error{constructor(t){super(t)}};class z{constructor(t){this.molblock=t}_validMolBlock;get molblock(){return this._validMolBlock}set molblock(t){try{this.validateMolBlock(t)}catch(e){e instanceof W&&(t="");const n=(0,G.O)(e);console.error(n)}this._validMolBlock=t}validateMolBlock(t){if(""===t)throw new W("MoleculeImage: invalid molblock")}async drawMolBlockOnCanvas(t){try{await o.functions.call("Chem:canvasMol",{x:0,y:0,w:t.width,h:t.height,canvas:t,molString:this.molblock,scaffoldMolString:"",options:{normalizeDepiction:!1,straightenDepiction:!1}})}catch(t){const e=(0,G.O)(t);console.error(e)}}getMoleculeDimensions(){const t=U.getInstance(this.molblock),e=Math.max(...t.x)-Math.min(...t.x);return{height:Math.max(...t.y)-Math.min(...t.y),width:e}}async zoomIn(){const t=r.dialog("Molecule"),e=r.div([],{style:{overflowX:"scroll"}}),n=.7*y()(window).height(),o=this.getMoleculeDimensions(),i=n/o.height,s=n,a=o.width*i,l=r.canvas(a,s);await this.drawMolBlockOnCanvas(l),e.appendChild(l),t.add(e).showModal(!0)}async drawMolecule(t,e,n){t.innerHTML="";const o=r.canvas(e*window.devicePixelRatio,n*window.devicePixelRatio);o.style.width=`${e}px`,o.style.height=`${n}px`,o.style.borderStyle="solid",o.style.borderColor="var(--grey-3)",o.style.borderWidth="thin",this.drawMolBlockOnCanvas(o),y()(o).on("click",(async()=>{await this.zoomIn()})),y()(o).on("mouseover",(()=>y()(o).css("cursor","grab"))),y()(o).on("mouseout",(()=>y()(o).css("cursor","default"))),t.append(o)}}var Y=n(50),X=n(893);class Z{constructor(){const t=Object.keys(T.Rv).concat(O.NI.HELM);this.moleculeImgDiv=r.block([]),this.outputTableDiv=r.div([]),this.formatChoiceInput=r.choiceInput("",O.NI.HELM,t,(async()=>{this.format=this.formatChoiceInput.value,this.updateTable(),await this.updateMolImg()})),this.sequenceInputBase=r.textInput("",s.T_,(()=>{this.onInput.next()})),this.init(),i.debounce(this.onInput,300).subscribe((async()=>{this.init(),this.formatChoiceInput.value=this.format,this.updateTable(),await this.updateMolImg()}))}onInput=new a.Subject;moleculeImgDiv;outputTableDiv;formatChoiceInput;sequenceInputBase;molfile;sequence;format;async getHtmlElement(){const t=new D(this.sequenceInputBase,B),e=r.button("Get SDF",(()=>{this.saveMolfile()}),"Save structure as SDF"),n=r.button("Copy SMILES",(()=>{this.copySmiles()}),"Copy SMILES for the sequence"),o={format:r.div([this.formatChoiceInput]),textInput:t.root},i=r.table([o],(t=>[t.format,t.textInput]));i.classList.add("st-main-input-table");const s=r.block([this.outputTableDiv,e,n]),a=r.box(r.div([i,s,this.moleculeImgDiv],{style:{paddingTop:"20px",paddingLeft:"20px"}}));return this.formatChoiceInput.value=this.format,this.updateTable(),await this.updateMolImg(),a}saveMolfile(){const t=new F(this.sequence,!1,this.formatChoiceInput.value).convert()+"\n$$$$";(0,I.L)(this.sequence+".sdf",encodeURIComponent(t))}copySmiles(){const t=i.chem.convert(this.molfile,i.chem.Notation.MolBlock,i.chem.Notation.Smiles);navigator.clipboard.writeText(t).then((()=>o.shell.info(Y.AU)))}updateTable(){this.outputTableDiv.innerHTML="";const t=this.format?new E.b(this.sequence).getInvalidCodeIndex(this.format):0,e=(0,H.D)(this.sequence,t,this.format),n=[];for(const t of Object.keys(e)){const i="indexOfFirstInvalidChar"in e?r.divH([]):r.link(e[t],(()=>navigator.clipboard.writeText(e[t]).then((()=>o.shell.info(Y.AU)))),Y.wm,"");n.push({format:t,sequence:i})}const i=r.table(n,(t=>[t.format,t.sequence]),["FORMAT","SEQUENCE"]);this.outputTableDiv.append(i),this.outputTableDiv.classList.add("st-main-output-table")}async updateMolImg(){const t=new z(this.molfile);await t.drawMolecule(this.moleculeImgDiv,500,170),y()(this.moleculeImgDiv).find("canvas").css("float","inherit")}init(){this.sequence=this.getFormattedSequence(),this.format=new M(this.sequence).getFormat(),this.molfile=this.getMolfile()}getFormattedSequence(){return this.sequenceInputBase.value.replace(/\s/g,"")}getMolfile(){if(!this.format)return"";if(this.format===O.NI.HELM){const t=new X.I(this.sequence,this.format).convertTo(O.NI.AXOLABS);return new F(t,!1,O.NI.AXOLABS).convert()}return new F(this.sequence,!1,this.format).convert()}}var K=n(865),Q={};Q.styleTagTransform=b(),Q.setAttributes=m(),Q.insert=p().bind(null,"head"),Q.domAPI=d(),Q.insertStyleElement=A(),c()(K.Z,Q),K.Z&&K.Z.locals&&K.Z.locals;var J=n(837);function tt(t,e){if(""===t)return"";const n=new M(t).getFormat();if(!n)return"";let o="";try{o=new F(t,e,n).convert()}catch(t){const e=(0,G.O)(t);console.error(e)}return o}function et(t,e,n,o){const i=[t,e,n].filter((t=>""!==t.strand));if(1===i.length)return tt(i[0].strand,i[0].invert);{const i=tt(t.strand,t.invert),r=[tt(e.strand,e.invert),tt(n.strand,n.invert)].filter((t=>""!==t));return(0,J.v5)({senseStrands:[i],antiStrands:r},o)}}const nt=["ss","as","as2"];class ot{constructor(){this.onInput=new a.Subject,this.onInvalidInput=new a.Subject,this.inputBase=Object.fromEntries(nt.map((t=>[t,r.textInput("","",(()=>{this.onInput.next()}))]))),this.useChiralInput=r.boolInput("Use chiral",!0),this.saveAllStrandsInput=r.boolInput("Save as one entity",!0),r.tooltip.bind(this.saveAllStrandsInput.root,"Save SDF with all strands in one molfile"),this.directionInversion=Object.fromEntries(nt.map((t=>[t,!1]))),this.moleculeImgDiv=r.block([]),y()(this.moleculeImgDiv).addClass("st-sdf-mol-img"),i.debounce(this.onInput,300).subscribe((async()=>{await this.updateMoleculeImg()})),i.debounce(this.onInvalidInput,1e3).subscribe((async()=>{o.shell.warning("Insert Sense strand")}))}onInput;onInvalidInput;useChiralInput;saveAllStrandsInput;inputBase;directionInversion;moleculeImgDiv;async getHtmlDivElement(){const t=this.getTableInput(),e=this.getBoolInputsAndButton();await this.updateMoleculeImg();const n=r.divH([e,this.moleculeImgDiv]);y()(n).addClass("st-sdf-bottom");const o=r.divV([t,n]);return y()(o).addClass("st-sdf-body"),o}getBoolInputsAndButton(){const t=r.buttonsInput([r.bigButton("Save SDF",(()=>{const t=this.getStrandData();!function(t,e,n,i,r){const s=[t.strand,e.strand,n.strand].filter((t=>""!==t));if(0===s.length||1===s.length&&""===t.strand)o.shell.warning("Enter SS and AS/AS2 to save SDF");else{let a;if(r)a=et(t,e,n,i)+"\n$$$$\n";else{const d=tt(t.strand,t.invert),h=tt(e.strand,e.invert),p=tt(n.strand,n.invert);a=d+"\n> <Sequence>\nSense Strand\n$$$$\n",h&&(a+=h+"\n> <Sequence>\nAnti Sense\n$$$$\n"),p&&(a+=p+"\n> <Sequence>\nAnti Sense 2\n$$$$\n")}const l=new Date;function c(t){return t>=10?t.toString():"0"+t.toString()}const u=l.getFullYear()+"-"+c(l.getMonth()+1)+"-"+c(l.getDate())+"_"+c(l.getHours())+"-"+c(l.getMinutes())+"-"+c(l.getSeconds());(0,I.L)(`SequenceTranslator-${u}.sdf`,encodeURIComponent(a))}}(t.ss,t.as,t.as2,this.useChiralInput.value,this.saveAllStrandsInput.value)}))]),e=[this.saveAllStrandsInput.root,this.useChiralInput.root,t],n=r.divV(e);for(const t of e)y()(t).addClass("st-sdf-bool-button-block");return n}getTableInput(){const t=Object.fromEntries(nt.map((t=>[t,new D(this.inputBase[t],B)]))),e=Object.fromEntries(nt.map(((t,e)=>{const n=0===e?"5′ → 3′":"3′ → 5′";return[t,r.choiceInput(`${t.toUpperCase()} direction`,n,["5′ → 3′","3′ → 5′"])]})));nt.forEach(((t,n)=>{e[t].onChanged((()=>{let o="3′ → 5′"===e[t].value;n>0&&(o=!o),this.directionInversion[t]=o,this.onInput.next()}))}));const n=["Sense Strand","Anti Sense","Anti Sense 2"],o=new Map(nt.map(((t,e)=>[t,n[e]]))),i=Object.fromEntries(nt.map((t=>[t,r.label(o.get(t))]))),s=nt.map((n=>({label:i[n],textInput:t[n].root,choiceInput:e[n].root}))),a=r.table(s,(t=>[t.label,t.textInput,t.choiceInput]));y()(a).css("margin-top","10px");for(const t of nt){let n=i[t].parentElement;n.classList.add("st-sdf-input-form"),y()(n).css("padding-top","3px"),n=e[t].root.parentElement,n.classList.add("st-sdf-input-form","st-sdf-direction-choice"),n=this.inputBase[t].root.parentElement,n.classList.add("st-sdf-text-input-td")}return a}getStrandData(){return Object.fromEntries(nt.map(((t,e)=>{let n=this.directionInversion[t];return[t,{strand:this.inputBase[t].value.replace(/\s*/g,""),invert:n}]})))}getMolfile(t,e,n){return""!==t.strand||""===e.strand&&""===n.strand?et(t,e,n,this.useChiralInput.value):(this.onInvalidInput.next(),"")}async updateMoleculeImg(){let t="";try{const e=this.getStrandData();t=this.getMolfile(e.ss,e.as,e.as2)}catch(t){const e=(0,G.O)(t);console.error(e)}const e=new z(t);await e.drawMolecule(this.moleculeImgDiv,650,150),y()(this.moleculeImgDiv).find("canvas").css("float","inherit")}}const it="SequenceTranslator",rt="400px",st="SS",at="AS",lt=[st,at],ct={[st]:"Sense strand",[at]:"Anti sense"},ut="THREE_PRIME",dt="FIVE_PRIME",ht=[ut,dt],pt={[ut]:3,[dt]:5};function ft(t){return"(o)"===t.slice(-3)}function mt(t){let e=0;for(;e<t.length&&ft(t[e]);)e++;return e===t.length-1?0:e}function gt(t,e){const n=document.createElement("canvas").getContext("2d");return n.font=String(e),2*n.measureText(t).width}function At(t,e){return ft(t[e])||!O.mc.includes(t[e])?"":t[e]}function vt(t){const e=T.al[t].color.match(/\d+/g).map((t=>Number(t)));return.299*e[0]+.587*e[1]+.114*e[2]>186?"#33333":"#ffffff"}function bt(t){return T.al[t].color}const Ct={xmlns:"http://www.w3.org/2000/svg",render:function(t,e){const n=document.createElementNS(this.xmlns,"svg");return n.setAttribute("id","mySvg"),n.setAttribute("width",String(t)),n.setAttribute("height",String(e)),n},circle:function(t,e,n,o){const i=document.createElementNS(this.xmlns,"circle");return i.setAttribute("cx",String(t)),i.setAttribute("cy",String(e)),i.setAttribute("r",String(n)),i.setAttribute("fill",o),i},text:function(t,e,n,o,i){const r=document.createElementNS(this.xmlns,"text");return r.setAttribute("x",String(e)),r.setAttribute("y",String(n)),r.setAttribute("font-size",String(o)),r.setAttribute("font-weight","normal"),r.setAttribute("font-family","Arial"),r.setAttribute("fill",i),r.innerHTML=t,r},star:function(t,e,n){const o=document.createElementNS(this.xmlns,"polygon");return o.setAttribute("points",function(t,e){const n=Math.PI/5;let o="";for(let i=0;i<10;i++){const r=i%2==0?6:3;o+=`${t+Math.cos(i*n+60)*r},${e+Math.sin(i*n+60)*r} `}return o}(t,e)),o.setAttribute("fill",n),o}};function xt(t,e){const n=T.al[e].symbols.join("");return n.repeat(Math.floor(t/4))+n.slice(0,t%4)}async function wt(t){return await o.dapi.users.current().then((e=>{const[n,o]=function(t){let e=-1;for(let n=0;n<t.length;n++)if("("===t[n]){e=n;break}return-1===e?["",""]:t.slice(e+9,t.length-1).split(" ").slice(1)}(t);return e.firstName!==n||e.lastName!==o}))}function yt(t){let e=t.length+1;for(let n=0;n<t.length;n++)if("("===t[n]){e=n;break}return t.slice(0,e-1)}function Et(t,e,n,o,i,r){let s=-1,a=t.replace(/[AUGC]/g,(function(o){s++;const i=T.al,r=(Object.keys(i),i.RNA.symbols.indexOf(o));let a=i[e[s].value].symbols[r];return ft(e[s].value)&&(s<t.length/2&&!ft(e[s+1].value)?a=a+o+"f":s>t.length/2&&!ft(e[s-1].value)&&(a=o+"f"+a)),n[s].value?a+"s":a}));return 3===a.slice(0,5).split("mU").length&&(a="(uu)"+a.slice(4)),3===a.slice(a.length-7).split("mU").length&&(a=a.slice(0,a.length-4)+"(uu)"),o.value+(r?"s":"")+a+i.value}const It=15,Ot=30,St=17,Tt="red",Mt="var(--grey-6)",Bt="red",Nt="SS: 5'",Lt="AS: 3'",Dt=Math.max(gt(Nt,St),gt(Lt,St)),kt=Math.max(gt("3'",St),gt("5'",St)),Pt=0+Dt-5,Vt={TITLE:It,SS_INDICES:30,SS_CIRCLES:52.5,SS_TEXTS:60,AS_CIRCLES:97.5,AS_TEXTS:105,AS_INDICES:127.5,comment:t=>t?165:127.5,circlesInLegends:t=>t?142.5:90,textLegend:t=>t?147:Vt.AS_CIRCLES-3,svgHeight:t=>t?165:135};function Ft(t,e,n,o,i,r,s,a,l,c,u,d){function h(t){return Math.round((t+E)*M/(w.length+E)+6)}function p(t,e){return x+(A-t+e+1)*Ot}function f(t,e,n){return n<10||O.mc.includes(t[e])?-5:-10}n=n.reverse(),i=i.reverse();const m=mt(n),g=mt(o),A=Math.max(n.length-m,o.length-g),v=Math.max(m,g),b=Ot*(A+v),C=Math.max(gt(s,St),gt(c,St)),x=Math.max(gt(a,St),gt(l,St)),w=e?[...new Set(n.concat(o))]:[...new Set(n)],y=e?i.concat(r).includes(!0):i.includes(!0),E=y?1:0,I=m*Ot+p(-.5,0),S=g*Ot+p(-.5,0),T=Math.max(I,S)+C+Ot*v,M=Dt+C+b+x+kt+Ot,B=Ct.render(M,Vt.svgHeight(e));B.append(Ct.text(Nt,0,Vt.SS_TEXTS,St,Mt),e?Ct.text(Lt,0,Vt.AS_TEXTS,St,Mt):"",Ct.text("3'",T,Vt.SS_TEXTS,St,Mt),e?Ct.text("5'",T,Vt.AS_TEXTS,St,Mt):"",Ct.text(a,Pt,Vt.SS_TEXTS,St,Bt),e?Ct.text(l,Pt,Vt.AS_TEXTS,St,Bt):"",Ct.text(s,I,Vt.SS_TEXTS,St,Bt),e?Ct.text(c,S,Vt.AS_TEXTS,St,Bt):"",Ct.text(u,0,Vt.comment(e),14,Mt),y?Ct.star(It,Vt.circlesInLegends(e),Tt):"",y?Ct.text("ps linkage",22,Vt.textLegend(e),14,Mt):"");const N=n.filter((t=>!ft(t))).length;let L=N;for(let t=n.length-1;t>-1;t--){const e=p(t,m)+f(n,n.length-t,N-L);ft(n[t])||L--;const o=!ft(n[t])&&d.includes(n[t])?String(N-L):"";B.append(Ct.text(o,e,Vt.SS_INDICES,14,Mt),Ct.circle(p(t,m),Vt.SS_CIRCLES,It,bt(n[t])),Ct.text(At(n,t),e,Vt.SS_TEXTS,St,vt(n[t])),i[t]?Ct.star(p(t,m)+It,Vt.SS_TEXTS+5,Tt):"")}B.append(i[n.length]?Ct.star(p(n.length,m)+It,Vt.SS_TEXTS+5,Tt):"");const D=o.filter((t=>!ft(t))).length;if(e){let t=D;for(let e=o.length-1;e>-1;e--){ft(o[e])||t--;const n=p(e,g)+f(o,e,t+1),i=!ft(o[e])&&d.includes(o[e])?String(t+1):"";B.append(Ct.text(i,n,Vt.AS_INDICES,14,Mt),Ct.circle(p(e,g),Vt.AS_CIRCLES,It,bt(o[e])),Ct.text(At(o,e),p(e,g)+f(o,e,t+1),Vt.AS_TEXTS,St,vt(o[e])),r[e]?Ct.star(p(e,g)+It,Vt.AS_TEXTS+5,Tt):"")}B.append(r[o.length]?Ct.star(p(o.length,g)+It,Vt.AS_TEXTS+5,Tt):"")}const k=`${t} for ${N}${e?`/${D}`:""}mer`;B.append(Ct.text(k,15,Vt.TITLE,St,"black"));for(let t=0;t<w.length;t++)B.append(Ct.circle(h(t),Vt.circlesInLegends(e),6,bt(w[t])),Ct.text(w[t],h(t)+6+4,Vt.textLegend(e),14,Mt));return B}var _t=n(803);class Ht{get htmlDivElement(){function t(e){b[e].innerHTML="",C[e]=C[e].concat(Array(v[e]-x[e].length).fill(A)),x[e]=x[e].concat(Array(v[e]-x[e].length).fill(g));let o=0;for(let i=0;i<w[e].value;i++)C[e][i]=r.boolInput("",C[e][i].value,(()=>{s(),n()})),x[e][i]=r.choiceInput("",x[e][i].value,p,(e=>{m.includes(e)||(m.push(e),H.append(r.divText("",{style:{width:"25px"}}),r.boolInput(e,!0,(t=>{if(t)m.includes(e)||m.push(e);else{const t=m.indexOf(e,0);t>-1&&m.splice(t,1)}s()})).root)),t(at),s(),n()})),y()(x[e][i].root).addClass("st-pattern-choice-input"),ft(x[e][i].value)||o++,b[e].append(r.divH([r.div([r.label(ft(x[e][i].value)?"":String(o))],{style:{width:"20px"}}),r.block75([x[e][i].root]),r.div([C[e][i]])],{style:{alignItems:"center"}}))}function e(){Object.values(w).every((t=>t.value<35))?(lt.forEach((e=>{w[e].value>v[e]&&(v[e]=w[e].value),t(e)})),s(),lt.forEach((t=>{""===S[t].value&&(O[t].value=xt(w[t].value,g.value))})),n()):r.dialog("Sequence length is out of range").add(r.divText("Sequence length should be less than "+35..toString()+" due to UI constrains.")).add(r.divText("Please change sequence length in order to define new pattern.")).show()}function n(){const t=[!0,U.value];lt.forEach(((e,n)=>{t[n]&&(N[e].value=Et(O[e].value,x[e],C[e],B[e][dt],B[e][ut],M[e].value))}))}function s(){k.innerHTML="",k.append(r.span([Ft(yt(G.value),U.value,x[st].slice(0,w[st].value).map((t=>t.value)),x[at].slice(0,w[at].value).map((t=>t.value)),[M[st].value].concat(C[st].slice(0,w[st].value).map((t=>t.value))),[M[at].value].concat(C[at].slice(0,w[at].value).map((t=>t.value))),B[st][ut].value,B[st][dt].value,B[at][ut].value,B[at][dt].value,W.value,m)]))}async function a(t){const e=i.TaskBarProgressIndicator.create("Loading pattern...");await o.dapi.userDataStorage.get(it,!1).then((e=>{const n=JSON.parse(e[t]);g.value=function(t){const e={};let n=t[0],o=1;for(let i=0;i<t.length;i++){const r=t[i];null===e[r]?e[r]=1:e[r]++,e[r]>o&&(n=r,o=e[r])}return n}(n.asBases.concat(n.ssBases)),U.value=n.asBases.length>0,G.value=t;let o=["ssBases","asBases"];lt.forEach(((t,e)=>{x[t]=[];const i=o[e];for(let e=0;e<n[i].length;e++)x[t].push(r.choiceInput("",n[i][e],p))})),o=["ssPtoLinkages","asPtoLinkages"],lt.forEach(((t,e)=>{const i=o[e];M[t].value=n[i][0],C[t]=[];for(let e=1;e<n[i].length;e++)C[t].push(r.boolInput("",n[i][e]))})),o=["ssBases","asBases"],lt.forEach(((t,e)=>{w[t].value=n[o[e]].length}));const i=[["ssThreeModification","ssFiveModification"],["asThreeModification","asFiveModification"]];lt.forEach(((t,e)=>{ht.forEach(((o,r)=>{B[t][o].value=n[i[e][r]]}))})),W.value=n.comment})),e.close()}async function l(){const t=await async function(){return await o.dapi.users.current().then((t=>" (created by "+t.friendlyName+")"))}();return G.value=G.stringValue.includes("(created by ")?yt(G.value)+t:G.stringValue+t,o.dapi.userDataStorage.postValue(it,G.value,JSON.stringify({ssBases:x[st].slice(0,w[st].value).map((t=>t.value)),asBases:x[at].slice(0,w[at].value).map((t=>t.value)),ssPtoLinkages:[M[st].value].concat(C[st].slice(0,w[st].value).map((t=>t.value))),asPtoLinkages:[M[at].value].concat(C[at].slice(0,w[at].value).map((t=>t.value))),ssThreeModification:B[st][ut].value,ssFiveModification:B[st][dt].value,asThreeModification:B[at][ut].value,asFiveModification:B[at][dt].value,comment:W.value}),!1).then((()=>o.shell.info("Pattern '"+G.value+"' was successfully uploaded!")))}async function c(){o.dapi.userDataStorage.get(it,!1).then((async t=>{const e=[],n=[];for(const o of Object.keys(t))await wt(o)?n.push(o):e.push(o);let i=r.choiceInput("Load pattern","",e,(t=>a(t)));const s=(await o.dapi.users.current()).friendlyName,l=r.choiceInput("",s,[s,"Other users"],(t=>{const u=t===s?e:n;i=r.choiceInput("Load pattern","",u,(t=>a(t))),i.root.append(l.input),i.root.append(i.input),i.input.style.maxWidth="100px",i.setTooltip("Apply Existing Pattern"),F.innerHTML="",F.append(i.root),i.root.append(r.div([r.button(r.iconFA("trash-alt",(()=>{})),(async()=>{null===i.value?o.shell.warning("Choose pattern to delete"):await wt(G.value)?o.shell.warning("Cannot delete pattern, created by other user"):await o.dapi.userDataStorage.remove(it,i.value,!1).then((()=>o.shell.info("Pattern '"+i.value+"' deleted"))),await c()}))],"ui-input-options"))}));i.root.append(l.input),i.root.append(i.input),i.input.style.maxWidth="100px",i.setTooltip("Apply Existing Pattern"),F.innerHTML="",F.append(i.root),i.root.append(r.div([r.button(r.iconFA("trash-alt",(()=>{})),(async()=>{null===i.value?o.shell.warning("Choose pattern to delete"):await wt(G.value)?o.shell.warning("Cannot delete pattern, created by other user"):await o.dapi.userDataStorage.remove(it,i.value,!1).then((()=>o.shell.info("Pattern '"+i.value+"' deleted"))),await c()}))],"ui-input-options"))}))}async function u(){await o.dapi.userDataStorage.get(it,!1).then((t=>{if(Object.keys(t).includes(G.value)){const t=r.dialog("Pattern already exists");y()(t.getButton("OK")).hide(),t.add(r.divText("Pattern name '"+G.value+"' already exists.")).add(r.divText("Replace pattern?")).addButton("YES",(async()=>{await o.dapi.userDataStorage.remove(it,G.value,!1).then((()=>l())),t.close()})).show()}else l()})),await c()}function d(t,e){const n=function(t){const e=R.value.getCol(t);let n=!0;for(let t=1;t<e.length;t++)if(e.get(t-1).length!==e.get(t).length&&0!==e.get(t).length){n=!1;break}if(!n){const n=r.dialog("Sequences lengths mismatch");y()(n.getButton("OK")).hide(),n.add(r.divText("The sequence length should match the number of Raw sequences in the input file")).add(r.divText("'ADD COLUMN' to see sequences lengths")).addButton("ADD COLUMN",(()=>{R.value.columns.addNewInt("Sequences lengths in "+t).init((t=>e.get(t).length)),o.shell.info("Column with lengths added to '"+R.value.name+"'"),n.close(),o.shell.v=o.shell.getTableView(R.value.name)})).show()}return e.get(0)!==w[st].value&&r.dialog("Length was updated by value to from imported file").add(r.divText("Latest modifications may not take effect during translation")).onOK((()=>o.shell.info("Lengths changed"))).show(),n}(t),i=R.value.getCol(t).get(0);n&&i.length!==w[e].value&&(w[e].value=R.value.getCol(t).get(0).length),O[e].value=i}function h(t){const e=R.value.getCol(t);if(e.type!==i.TYPE.INT)o.shell.error("Column should contain integers only");else if(e.categories.filter((t=>""!==t)).length<e.toList().filter((t=>""!==t)).length){const t=(n=e.getRawData(),Array.from(new Set(n)).filter((t=>n.indexOf(t)!==n.lastIndexOf(t))));r.dialog("Non-unique IDs").add(r.divText("Press 'OK' to select rows with non-unique values")).onOK((()=>{R.value.selection.init((n=>t.indexOf(e.get(n))>-1)),o.shell.v=o.shell.getTableView(R.value.name),o.shell.info("Rows are selected in table '"+R.value.name+"'")})).show()}var n}const p=Object.keys(T.al),f=p[0],m=[f],g=r.choiceInput("Sequence basis",f,p,(t=>{var e;e=t,lt.forEach((t=>{for(let n=0;n<x[t].length;n++)x[t][n].value=e})),s(),n()})),A=r.boolInput("Fully PTO",!0,(t=>{var e;lt.forEach((e=>{M[e].value=t})),e=t,lt.forEach((t=>{for(let n=0;n<C[t].length;n++)C[t][n].value=e})),s(),n()})),v=Object.fromEntries(lt.map((t=>[t,23]))),b=Object.fromEntries(lt.map((t=>[t,r.div([])]))),C=Object.fromEntries(lt.map((t=>[t,Array(23).fill(r.boolInput("",!0))]))),x=Object.fromEntries(lt.map((t=>[t,Array(23).fill(r.choiceInput("",f,p))]))),w=Object.fromEntries(lt.map((t=>{const n=r.intInput(`${ct[t]} length`,23,(()=>e()));return n.setTooltip(`Length of ${ct[t].toLowerCase()}, including overhangs`),[t,n]}))),E=Object.fromEntries(lt.map((t=>[t,""]))),I=Object.fromEntries(lt.map((t=>[t,r.div([])]))),O=Object.fromEntries(lt.map((t=>[t,r.textInput(`${ct[t]}`,xt(w[t].value,g.value))]))),S=Object.fromEntries(lt.map((t=>{const e=r.choiceInput(`${ct[t]} column`,"",[],(e=>{d(e,t),E[t]=e}));return I[t].append(e.root),[t,e]}))),M=Object.fromEntries(lt.map((t=>{const e=r.boolInput(`First ${t} PTO`,A.value,(()=>s()));return e.setTooltip(`ps linkage before first nucleotide of ${ct[t].toLowerCase()}`),[t,e]}))),B=Object.fromEntries(lt.map((t=>{const e=Object.fromEntries(ht.map((e=>{const o=r.stringInput(`${t} ${pt[e]}' Modification`,"",(()=>{s(),n()}));return o.setTooltip(`Additional ${t} ${pt[e]}' Modification`),[e,o]})));return[t,e]}))),N=Object.fromEntries(lt.map((t=>[t,r.textInput(" ",Et(O[t].value,x[t],C[t],B[t][ut],B[t][dt],M[t].value))]))),L=Object.fromEntries(lt.map((t=>[t,r.panel([r.h1(`${ct[t]}`),r.divH([r.div([r.divText("#")],{style:{width:"20px"}}),r.block75([r.divText("Modification")]),r.div([r.divText("PTO")])]),b[t]],{style:{paddingTop:"12px"}})])));lt.forEach((t=>{O[t].input.style.resize="none",O[t].input.style.minWidth=rt,N[t].input.style.resize="none",N[t].input.style.minWidth=rt,N[t].input.disabled="true";let e=r.div([r.button(r.iconFA("copy",(()=>{})),(()=>{navigator.clipboard.writeText(N[t].value).then((()=>o.shell.info("Sequence was copied to clipboard")))}))],"ui-input-options");e.style.height="inherit",N[t].root.append(e)}));const D=r.div([]),k=r.div([]),P=r.div([],"ui-form ui-form-wide"),V=r.div([]),F=r.div([]),_=r.div([]),H=r.divH([r.boolInput(f,!0,(t=>{if(t)m.includes(f)||m.push(f);else{const t=m.indexOf(f,0);t>-1&&m.splice(t,1)}s(),n()})).root]),q=r.div([w[at].root]),R=r.tableInput("Tables",o.shell.tables[0],o.shell.tables,(t=>{lt.forEach((e=>{S[e]=r.choiceInput(`${e} column`,"",t.columns.names(),(t=>{d(t,e),E[e]=t})),I[e].innerHTML="",I[e].append(S[e].root)}));const e=r.choiceInput("ID column","",t.columns.names(),(t=>{h(t),j=t}));D.innerHTML="",D.append(e.root)}));let j="";const $=r.choiceInput("ID column","",[],(t=>{h(t),j=t}));D.append($.root),c();const U=r.boolInput("Anti sense strand",!0,(t=>{L[at].hidden=!t,I[at].hidden=!t,q.hidden=!t,_.hidden=!t,P.hidden=!t,M[at].root.hidden=!t,s()}));U.setTooltip("Create antisense strand sections on SVG and table to the right");const G=r.textInput("Save as","Pattern name",(()=>s()));G.setTooltip("Name Of New Pattern"),ht.forEach((t=>{_.append(B[at][t].root)}));const W=r.textInput("Comment","",(()=>s())),z=r.bigButton("Save",(()=>{if(""!==G.value)u().then((()=>o.shell.info("Pattern saved")));else{const t=r.stringInput("Enter name","");r.dialog("Pattern Name").add(t.root).onOK((()=>{G.value=t.value,u().then((()=>o.shell.info("Pattern saved")))})).show()}})),Y=r.bigButton("Convert",(()=>{const t=[!0,U.value];if(lt.some(((e,n)=>t[n]&&""===E[e])))o.shell.info("Please select table and columns on which to apply pattern");else if(lt.some((t=>w[t].value!==O[t].value.length))){const t=r.dialog("Length Mismatch");y()(t.getButton("OK")).hide(),t.add(r.divText("Length of sequences in columns doesn't match entered length. Update length value?")).addButton("YES",(()=>{lt.forEach((t=>{w[t].value=R.value.getCol(S[t].value).getString(0).length})),t.close()})).show()}else{""!==j&&function(t,e,n){const i="ID "+n,r=o.shell.table(t).columns;r.contains(i)&&r.remove(i);const s=r.byName(e);r.addNewString(i).init((t=>""===s.getString(t)?"":s.get(t)+"_"+n))}(R.value.name,j,yt(G.value));const t=[!0,U.value];lt.forEach(((e,n)=>{t[n]&&function(t,e,n,i,r,s,a){const l="Axolabs "+e,c=o.shell.table(t).columns;c.contains(l)&&c.remove(l);const u=c.byName(e);c.addNewString(l).init((t=>""===u.getString(t)?"":Et(u.getString(t),n,i,r,s,a)))}(R.value.name,E[e],x[e],C[e],B[e][dt],B[e][ut],M[e].value)})),o.shell.v=o.shell.getTableView(R.value.name),o.shell.info((U.value?"Columns were":"Column was")+" added to table '"+R.value.name+"'"),n()}}));P.append(O[at].root),P.append(N[at].root),e();const X=r.div([r.h1("Conversion preview"),O[st].root,N[st].root,P],"ui-form ui-form-wide"),Z=r.block50([r.h1("Convert options"),R.root,I[st],I[at],D,r.buttonsInput([Y])]);Z.classList.add("ui-form");const K=r.button("Download",(()=>_t.saveSvgAsPng(document.getElementById("mySvg"),G.value,{backgroundColor:"white"}))),Q=r.panel([r.block([k],{style:{overflowX:"scroll"}}),K,H,r.div([r.div([r.divH([r.h1("Pattern options")]),r.divH([r.block([w[st].root,q,g.root,W.root,F,G.root,r.buttonsInput([z])],"ui-form"),r.block([U.root,A.root,M[st].root,M[at].root,B[st][dt].root,B[st][ut].root,_],"ui-form")])],"ui-form"),Z,X],{style:{flexWrap:"wrap"}})]);return r.info([r.divText("\n How to define new pattern:",{style:{"font-weight":"bolder"}}),r.divText("1. Choose table and columns with sense and antisense strands"),r.divText("2. Choose lengths of both strands by editing checkboxes below"),r.divText("3. Choose basis and PTO status for each nucleotide"),r.divText("4. Set additional modifications for sequence edges"),r.divText("5. Press 'Convert Sequences' button"),r.divText("This will add the result column(s) to the right of the table")],"Create and apply Axolabs translation patterns."),r.splitH([r.div([V,Q]),r.box(r.divH([L[st],L[at]]),{style:{maxWidth:"360px"}})])}}async function qt(t){try{const e={overflowX:"scroll"},n=r.div([],{style:e}),i=(0,J.$U)(t),s=.7*y()(window).height(),a=Math.max(...i.x)-Math.min(...i.x),l=Math.max(...i.y)-Math.min(...i.y),c=s/l,u=c*a,d=c*l,h=r.canvas(u*window.devicePixelRatio,d*window.devicePixelRatio);h.style.width=`${u}px`,h.style.height=`${d}px`,await async function(t,e){await o.functions.call("Chem:canvasMol",{x:0,y:0,w:t.width,h:t.height,canvas:t,molString:e,scaffoldMolString:"",options:{normalizeDepiction:!1,straightenDepiction:!1}})}(h,t),n.appendChild(h),r.dialog("Molecule").add(n).showModal(!0)}catch(t){const e=(0,G.O)(t);console.error(e)}}class Rt{static async view(){const t=S.A.getInstance().getTableForViewer();t.name="Monomer Library";const e=o.shell.addTableView(t);e.grid.props.allowEdit=!1,e.grid.onCellDoubleClick.subscribe((async t=>{const e=t.cell.value;"Molecule"===t.tableColumn?.semType&&await qt(e)}))}}class jt{constructor(){this.view=i.View.create(),this.urlRouter=new Ut(this.view),this.view.box=!0,this.view.name="Sequence Translator";const t=o.shell.windows;t.showProperties=!1,t.showToolbox=!1,t.showHelp=!1;const e=r.iconFA("book",Rt.view,"View monomer library");this.topPanel=[e],this.view.setRibbonPanels([this.topPanel]),this.tabs=new $t(new Z,new Ht,new ot,this.urlRouter)}view;tabs;topPanel;urlRouter;async createLayout(){const t=await this.tabs.getControl(),e=this.urlRouter.tabName;e&&(t.currentPane=t.getPane(e)),this.view.append(t),o.shell.addView(this.view)}}class $t{mainTab;axolabsTab;sdfTab;urlRouter;constructor(t,e,n,o){this.mainTab=t,this.axolabsTab=e,this.sdfTab=n,this.urlRouter=o}control=null;async getControl(){if(this.control)return this.control;const t=r.tabControl({[s.qt]:await this.mainTab.getHtmlElement(),[s.Iy]:this.axolabsTab.htmlDivElement,[s.sv]:await this.sdfTab.getHtmlDivElement()}),e=t.getPane(s.sv);r.tooltip.bind(e.header,"Get atomic-level structure for SS + AS/AS2 and save SDF");const n=t.getPane(s.qt);r.tooltip.bind(n.header,"Translate across formats");const o=t.getPane(s.Iy);return r.tooltip.bind(o.header,"Create modification pattern for SS and AS"),t.onTabChanged.subscribe((()=>{t.currentPane.name!==s.qt?this.urlRouter.searchParams.delete("seq"):this.urlRouter.searchParams.set("seq",this.mainTab.sequence),this.urlRouter.updatePath(t)})),this.control=t,this.control}}class Ut{view;constructor(t){this.view=t,this.pathParts=window.location.pathname.split("/"),this.searchParams=new URLSearchParams(window.location.search)}searchParams;pathParts;get urlParamsString(){return Object.entries(this.searchParams).map((([t,e])=>`${t}=${encodeURIComponent(e)}`)).join("&")}updatePath(t){const e=Object.entries(this.searchParams).map((([t,e])=>`${t}=${encodeURIComponent(e)}`)).join("&");this.view.path=`/apps/SequenceTranslator/${t.currentPane.name}`,e&&(this.view.path+=`/?${e}`)}get tabName(){const t=this.pathParts.findIndex((t=>"SequenceTranslator"===t));return-1===t?"":this.pathParts[t+1]}}var Gt,Wt,zt=n(895);wu;class Yt{constructor(t,e,n){this.name=t,this.alphabet=e,this.cutoff=n}}(Wt=Gt||(Gt={})).FASTA="fasta",Wt.SEPARATOR="separator",Wt.HELM="helm";const Xt=new class{constructor(){this.fasta={peptide:new Set(["G","L","Y","S","E","Q","D","N","F","A","K","R","H","C","V","P","W","I","M","T"]),dna:new Set(["A","C","G","T"]),rna:new Set(["A","C","G","U"])}}};new Yt("PT",Xt.fasta.peptide,.5),new Yt("DNA",Xt.fasta.dna,.55),new Yt("RNA",Xt.fasta.rna,.55);class Zt extends Float32Array{}class Kt{static makePalette(t,e=!1,n=Kt){const o={};return t.forEach((t=>{const n=t[0],i=t[1];n.forEach(((t,n)=>{o[t]=this.colourPalette[i][e?0:n]}))})),new n(o)}constructor(t){this._palette=t}get(t){return this._palette[t]}}Kt.undefinedColor="rgb(100,100,100)",Kt.colourPalette={orange:["rgb(255,187,120)","rgb(245,167,100)","rgb(235,137,70)","rgb(205, 111, 71)"],all_green:["rgb(44,160,44)","rgb(74,160,74)","rgb(23,103,57)","rgb(30,110,96)","rgb(60,131,95)","rgb(24,110,79)","rgb(152,223,138)","rgb(182, 223, 138)","rgb(152, 193, 138)"],all_blue:["rgb(31,119,180)","rgb(23,190,207)","rgb(122, 102, 189)","rgb(158,218,229)","rgb(141, 124, 217)","rgb(31, 120, 150)"],magenta:["rgb(162,106,192)","rgb(197,165,224)","rgb(208,113,218)"],red:["rgb(214,39,40)","rgb(255,152,150)"],st_blue:["rgb(23,190,207)","rgb(158,218,229)","rgb(31,119,180)"],dark_blue:["rgb(31,119,180)","rgb(31, 120, 150)"],light_blue:["rgb(23,190,207)","rgb(158,218,229)","rgb(108, 218, 229)","rgb(23,190,227)"],lilac_blue:["rgb(124,102,211)","rgb(149,134,217)","rgb(97, 81, 150)"],dark_green:["rgb(23,103,57)","rgb(30,110,96)","rgb(60,131,95)","rgb(24,110,79)"],green:["rgb(44,160,44)","rgb(74,160,74)"],light_green:["rgb(152,223,138)","rgb(182, 223, 138)","rgb(152, 193, 138)"],st_green:["rgb(44,160,44)","rgb(152,223,138)","rgb(39, 174, 96)","rgb(74,160,74)"],pink:["rgb(247,182,210)"],brown:["rgb(140,86,75)","rgb(102, 62, 54)"],gray:["rgb(127,127,127)","rgb(199,199,199)","rgb(196,156,148)","rgb(222, 222, 180)"],yellow:["rgb(188,189,34)"],white:["rgb(230,230,230)"]};class Qt extends Kt{static get Lesk(){return void 0===this.lesk&&(this.lesk=this.makePalette([[["G","A","S","T"],"orange"],[["C","V","I","L","P","F","Y","M","W"],"all_green"],[["N","Q","H"],"magenta"],[["D","E"],"red"],[["K","R"],"all_blue"]],!1,Qt)),this.lesk}static get GrokGroups(){return void 0===this.grokGroups&&(this.grokGroups=this.makePalette([[["C","U"],"yellow"],[["G","P"],"red"],[["A","V","I","L","M","F","Y","W"],"all_green"],[["R","H","K"],"light_blue"],[["D","E"],"dark_blue"],[["S","T","N","Q"],"orange"]],!1,Qt)),this.grokGroups}static get RasMol(){return void 0===this.rasMol&&(this.rasMol=new Qt({D:"#E60A0A",E:"#E60A0A",C:"#E6E600",M:"#E6E600",K:"#145AFF",R:"#145AFF",S:"#FA9600",T:"#FA9600",F:"#3232AA",Y:"#3232AA",N:"#00DCDC",Q:"#00DCDC",G:"#EBEBEB",L:"#0F820F",V:"#0F820F",I:"#0F820F",A:"#C8C8C8",W:"#B45AB4",H:"#8282D2",P:"#DC9682",others:"#BEA06E"})),this.rasMol}get(t){const e=t in Qt.aaSynonyms?Qt.aaSynonyms[t]:t;return super.get(e)}}Qt.aaSynonyms={MeNle:"L",MeA:"A",MeG:"G",MeF:"F"};class Jt{static getPalette(t="grok"){switch(t){case"grok":return Qt.GrokGroups;case"lesk":return Qt.Lesk;default:throw new Error(`ChemPalette: scheme \`${t}\` does not exist`)}}static getInnerOuter(t){let e=0,n="",o="";for(const i of t)"("==i?e++:")"==i?e--:e?n+=i:o+=i;return isNaN(parseInt(n))?[o,n]:[o,""]}static getColorAAPivot(t="",e="grok"){const n=this.getPalette(e);let[o,i]=this.getInnerOuter(t);if(o=o.length>6?`${o.slice(0,3)}...`:o,i=i.length>6?`${i.slice(0,3)}...`:i,1==t.length||"("==t[1]){const e=t[0]?.toUpperCase();return e in n?[n.get(e),e,i,1]:[this.undefinedColor,o,i,1]}if("d"==t[0]&&t[1]in n&&(2==t.length||"("==t[2])){const e=t[1]?.toUpperCase();return e in n?[n.get(e),e,i,2]:[this.undefinedColor,o,i,2]}if(t.substring(0,3)in this.AAFullNames&&(3==t.length||"("==t[3])){const e=this.AAFullNames[t.substring(0,3)];return e in n?[n.get(e),e,i,3]:[this.undefinedColor,o,i,3]}if(t[0]?.toLowerCase()==t[0]&&t.substring(1,3)in this.AAFullNames&&(4==t.length||"("==t[4])){const e=this.AAFullNames[t.substring(1,3)];return e in n?[n.get(e),e,i,4]:[this.undefinedColor,o,i,4]}return[this.undefinedColor,o,i,0]}}Jt.SemType="Aminoacids",Jt.SemTypeMultipleAlignment="AminoacidsMultipleAlignment",Jt.undefinedColor="rgb(100,100,100)",Jt.Names={G:"Glycine",L:"Leucine",Y:"Tyrosine",S:"Serine",E:"Glutamic acid",Q:"Glutamine",D:"Aspartic acid",N:"Asparagine",F:"Phenylalanine",A:"Alanine",K:"Lysine",R:"Arginine",H:"Histidine",C:"Cysteine",V:"Valine",P:"Proline",W:"Tryptophan",I:"Isoleucine",M:"Methionine",T:"Threonine"},Jt.AASmiles={G:"NCC(=O)O",L:"N[C@H](CC(C)C)C(=O)O",Y:"NC(CC1=CC=C(O)C=C1)C(=O)O",S:"NC(CO)C(=O)O",E:"N[C@@H](CCC(O)=O)C(=O)O",Q:"N[C@@H](CCC(N)=O)C(=O)O",D:"N[C@@H](CC(O)=O)C(=O)O",N:"N[C@@H](CC(N)=O)C(=O)O",F:"NC(CC1=CC=CC=C1)C(=O)O",A:"N[C@H](C)C(=O)O",K:"NC(CCCCN)C(=O)O",R:"N[C@H](CCCNC(=N)C)C(=O)O",H:"NC(CC1=CN=C[N]1)C(=O)O",C:"N[C@@H](CS)C(=O)O",V:"NC(C(C)C)C(=O)O",P:"N(CCC1)C1C(=O)O",W:"N[C@@H](Cc1c2ccccc2n([H])c1)C(=O)O",I:"N[C@H]([C@H](C)CC)C(=O)O",M:"NC(CCSC)C(=O)O",T:"NC(C(O)C)C(=O)O"},Jt.AASmilesTruncated={G:"*C*",L:"CC(C)C[C@H](*)*",Y:"C1=CC(=CC=C1CC(*)*)O",S:"OCC(*)C*",E:"*[C@@H](CCC(O)=O)*",Q:"*N[C@@H](CCC(N)=O)*",D:"*[C@@H](CC(O)=O)*",N:"*[C@@H](CC(N)=O)*",F:"C1=CC=C(C=C1)CC(*)*",A:"C[C@H](*)*",K:"C(CCN)CC(*)*",R:"*[C@H](CCCNC(=N)C)*",H:"C1=C(NC=N1)CC(*)*",C:"C([C@@H](*)*)S",V:"CC(C)C(*)*",P:"C1CCN(*)C1*",W:"*[C@@H](Cc1c2ccccc2n([H])c1)*",I:"CC[C@H](C)[C@H](*)*",M:"CSCCC(*)*",T:"CC(O)C(*)*"},Jt.AAFullNames={Ala:"A",Arg:"R",Asn:"N",Asp:"D",Cys:"C",Gln:"Q",Glu:"E",Gly:"G",His:"H",Ile:"I",Leu:"L",Lys:"K",Met:"M",Phe:"F",Pro:"P",Ser:"S",Thr:"T",Trp:"W",Tyr:"Y",Val:"V"};class te{}te.SemType="Nucleotides",te.SemTypeMultipleAlignment="NucleotidesMultipleAlignment",te.Names={A:"Adenine",C:"Cytosine",G:"Guanine",T:"Thymine",U:"Uracil"};class ee{static hashCode(t){let e=0;if(0===t.length)return e;for(let n=0;n<t.length;n++)e=(e<<5)-e+t.charCodeAt(n),e|=0;return e}}class ne{}class oe extends ne{static buildPalette(){return[].concat(...Object.values(Kt.colourPalette))}get(t){const e=ee.hashCode(t)%oe.palette.length;return function(t){if(null==t)return"rgb(100,100,100)";const e=i.Color.fromHtml(t),n=i.Color.g(e),o=i.Color.r(e),r=i.Color.b(e),s=Math.sqrt(Math.pow(0-o,2)+Math.pow(0-n,2)+Math.pow(0-r,2));return s>210?`rgb(${o/s*210},${n/s*210},${r/s*210})`:i.Color.toRgb(e)}(oe.palette[e])}}oe.palette=oe.buildPalette();new Uint32Array(65536);var ie,re;function se(t){const e=t instanceof Error?t.message:t.toString(),n=t instanceof Error?t.stack:void 0;o.shell.error(e),ue.logger.error(t.message,void 0,n)}(re=ie||(ie={})).HAMMING="Hamming",re.LEVENSHTEIN="Levenshtein",re.NEEDLEMANN_WUNSCH="Needlemann-Wunsch",ie.HAMMING,ie.LEVENSHTEIN,ie.NEEDLEMANN_WUNSCH,new class{constructor(){this.uhTemp=`units-handler.${i.SEMTYPE.MACROMOLECULE}`}},Gt.FASTA,Gt.SEPARATOR,Gt.HELM;var ae=n(61);async function le(t){let e,n;await(0,T.VO)(),await ue.initMonomerLib();const o=new jt;await o.createLayout(),e=await o.tabs.getControl(),n=e.panes,e.currentPane=n[t]}class ce extends i.Package{_monomerLib;get monomerLib(){if(!this._monomerLib)throw new Error("ST: monomer lib not loaded");return this._monomerLib}async initMonomerLib(){if(void 0!==this._monomerLib)return;const t=i.TaskBarProgressIndicator.create("Initializing Sequence Translator monomer library ...");try{const e=await async function(){const t=i.Func.find({package:"Bio",name:"getMonomerLibHelper"});if(0===t.length)throw new Error('Package "Bio" must be installed for MonomerLibHelper.');return(await t[0].prepare().call()).getOutputParamValue()}();this._monomerLib=await e.readLibrary(zt.BX,zt.a_)}catch(t){const e=t.hasOwnProperty("message")?t.message:t.toString();throw new Error("Loading monomer library: "+e)}finally{t.close()}}}const ue=new ce;async function de(){const t=i.TaskBarProgressIndicator.create("Loading Sequence Translator app ...");try{await he();const e=new jt;await e.createLayout()}catch(t){const e=t.hasOwnProperty("message")?t.message:t.toString();throw o.shell.error("Loading Sequence Translator application error: "+e),t}finally{t.close()}}async function he(){await(0,T.VO)(),await ue.initMonomerLib()}function pe(){const t=S.A.getInstance().getCodesToWeightsMap();return Object.fromEntries(t)}function fe(t){const e=new E.b(t),n=new M(t).getFormat();return null!==n&&e.isValidSequence(n)}function me(t,e){return new F(t,e,"GCRS").convert()}function ge(t){return(0,J.v5)(t,!0)}async function Ae(){await async function(){try{le(0)}catch(t){se(t)}}()}async function ve(){await async function(){try{async function t(t,n,o){await(0,ae.gw)(3e3);const i=document.querySelectorAll(".st-pattern-choice-input > select");e=i.length;const r=i[o(n)];r.value=t;const s=new Event("input");r.dispatchEvent(s)}let e;le(1),["DNA","invAb","Z-New"].forEach((async(e,n)=>{t(e,n,(t=>2*t))})),["2'-O-Methyl","2'-Fluoro","2'-O-MOE"].forEach((async(n,o)=>{t(n,o,(t=>e-2-2*t))}))}catch(n){se(n)}}()}async function be(){await async function(){try{await le(2)}catch(t){se(t)}}()}async function Ce(t,e,n){return await he(),new X.I(t,e).convertTo(n)}},50:(t,e,n)=>{n.d(e,{AU:()=>o,wm:()=>i});const o="Copied",i="Copy sequence"},11:(t,e,n)=>{n.d(e,{Iy:()=>i,T_:()=>s,qt:()=>o,sv:()=>r});const o="SEQUENCE",i="PATTERN",r="SDF",s="Afcgacsu"},976:t=>{t.exports=DG},469:t=>{t.exports=grok}},e={};function n(o){var i=e[o];if(void 0!==i)return i.exports;var r=e[o]={id:o,exports:{}};return t[o](r,r.exports,n),r.exports}n.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return n.d(e,{a:e}),e},n.d=(t,e)=>{for(var o in e)n.o(e,o)&&!n.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:e[o]})},n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),n.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.nc=void 0;var o=n(563);sequencetranslator=o})();
2
2
  //# sourceMappingURL=package.js.map