@datagrok/sequence-translator 1.2.6 → 1.2.9

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.
Files changed (102) hide show
  1. package/.eslintrc.json +5 -5
  2. package/CHANGELOG.md +12 -0
  3. package/dist/package-test.js +2 -1
  4. package/dist/package-test.js.LICENSE.txt +8 -0
  5. package/dist/package-test.js.map +1 -1
  6. package/dist/package.js +2 -1
  7. package/dist/package.js.LICENSE.txt +8 -0
  8. package/dist/package.js.map +1 -1
  9. package/files/pattern-app-data.json +80 -0
  10. package/package.json +21 -14
  11. package/src/{model → apps/common/model}/const.ts +1 -1
  12. package/src/{model/data-loading-utils → apps/common/model/data-loader}/const.ts +7 -2
  13. package/src/apps/common/model/data-loader/json-loader.ts +48 -0
  14. package/src/{model/data-loading-utils → apps/common/model/data-loader}/types.ts +13 -6
  15. package/src/{model → apps/common/model}/monomer-lib/lib-wrapper.ts +9 -12
  16. package/src/apps/common/model/oligo-toolkit-package.ts +30 -0
  17. package/src/{model → apps/common/model}/parsing-validation/format-detector.ts +5 -5
  18. package/src/{model → apps/common/model}/parsing-validation/format-handler.ts +18 -19
  19. package/src/{model → apps/common/model}/parsing-validation/sequence-validator.ts +1 -1
  20. package/src/apps/common/view/app-ui-base.ts +28 -0
  21. package/src/apps/common/view/combined-app-ui.ts +66 -0
  22. package/src/{view/utils → apps/common/view/components}/colored-input/colored-text-input.ts +1 -1
  23. package/src/{view/utils → apps/common/view/components}/draw-molecule.ts +1 -1
  24. package/src/{view/utils → apps/common/view/components}/molecule-img.ts +3 -3
  25. package/src/{view/const/ui.ts → apps/common/view/const.ts} +4 -4
  26. package/src/apps/common/view/isolated-app-ui.ts +43 -0
  27. package/src/{view/monomer-lib-viewer/viewer.ts → apps/common/view/monomer-lib-viewer.ts} +2 -2
  28. package/src/apps/common/view/utils.ts +29 -0
  29. package/src/apps/pattern/model/const.ts +121 -0
  30. package/src/apps/pattern/model/data-manager.ts +297 -0
  31. package/src/apps/pattern/model/event-bus.ts +470 -0
  32. package/src/apps/pattern/model/router.ts +46 -0
  33. package/src/apps/pattern/model/subscription-manager.ts +21 -0
  34. package/src/apps/pattern/model/translator.ts +68 -0
  35. package/src/apps/pattern/model/types.ts +52 -0
  36. package/src/apps/pattern/model/utils.ts +110 -0
  37. package/src/apps/pattern/view/components/bulk-convert/column-input.ts +69 -0
  38. package/src/apps/pattern/view/components/bulk-convert/table-controls.ts +37 -0
  39. package/src/apps/pattern/view/components/bulk-convert/table-input.ts +95 -0
  40. package/src/apps/pattern/view/components/edit-block-controls.ts +196 -0
  41. package/src/apps/pattern/view/components/left-section.ts +44 -0
  42. package/src/apps/pattern/view/components/load-block-controls.ts +198 -0
  43. package/src/apps/pattern/view/components/numeric-label-visibility-controls.ts +69 -0
  44. package/src/apps/pattern/view/components/right-section.ts +148 -0
  45. package/src/apps/pattern/view/components/strand-editor/dialog.ts +79 -0
  46. package/src/apps/pattern/view/components/strand-editor/header-controls.ts +105 -0
  47. package/src/apps/pattern/view/components/strand-editor/strand-controls.ts +159 -0
  48. package/src/apps/pattern/view/components/terminal-modification-editor.ts +127 -0
  49. package/src/apps/pattern/view/components/translation-examples-block.ts +139 -0
  50. package/src/{view/style/pattern-app.css → apps/pattern/view/style.css} +4 -0
  51. package/src/apps/pattern/view/svg-utils/const.ts +63 -0
  52. package/src/apps/pattern/view/svg-utils/dimensions-calculator.ts +498 -0
  53. package/src/apps/pattern/view/svg-utils/svg-display-manager.ts +45 -0
  54. package/src/apps/pattern/view/svg-utils/svg-element-factory.ts +82 -0
  55. package/src/apps/pattern/view/svg-utils/svg-renderer.ts +396 -0
  56. package/src/apps/pattern/view/svg-utils/utils.ts +37 -0
  57. package/src/apps/pattern/view/types.ts +14 -0
  58. package/src/apps/pattern/view/ui.ts +61 -0
  59. package/src/{model/structure-app → apps/structure/model}/mol-transformations.ts +3 -3
  60. package/src/{model/structure-app → apps/structure/model}/monomer-code-parser.ts +9 -10
  61. package/src/{model/structure-app → apps/structure/model}/oligo-structure.ts +4 -4
  62. package/src/{model/structure-app → apps/structure/model}/sequence-to-molfile.ts +2 -2
  63. package/src/{view/apps/oligo-structure.ts → apps/structure/view/ui.ts} +31 -17
  64. package/src/{model/translator-app → apps/translator/model}/conversion-utils.ts +25 -7
  65. package/src/{model/translator-app → apps/translator/model}/format-converter.ts +7 -12
  66. package/src/{view/const/oligo-translator.ts → apps/translator/view/const.ts} +2 -0
  67. package/src/apps/translator/view/ui.ts +547 -0
  68. package/src/demo/demo-st-ui.ts +12 -32
  69. package/src/package.ts +76 -56
  70. package/src/plugins/mermade.ts +9 -9
  71. package/src/polytool/const.ts +40 -0
  72. package/src/polytool/csv-to-json-monomer-lib-converter.ts +40 -0
  73. package/src/polytool/cyclized.ts +56 -0
  74. package/src/polytool/monomer-lib-handler.ts +115 -0
  75. package/src/polytool/transformation.ts +326 -0
  76. package/src/polytool/ui.ts +59 -0
  77. package/src/polytool/utils.ts +20 -0
  78. package/src/tests/const.ts +5 -5
  79. package/src/tests/formats-support.ts +6 -6
  80. package/src/tests/formats-to-helm.ts +5 -5
  81. package/src/tests/helm-to-nucleotides.ts +5 -5
  82. package/tsconfig.json +4 -10
  83. package/webpack.config.js +3 -0
  84. package/files/axolabs-style.json +0 -97
  85. package/src/model/data-loading-utils/json-loader.ts +0 -38
  86. package/src/model/pattern-app/const.ts +0 -33
  87. package/src/model/pattern-app/draw-svg.ts +0 -193
  88. package/src/model/pattern-app/helpers.ts +0 -96
  89. package/src/model/pattern-app/oligo-pattern.ts +0 -111
  90. package/src/view/app-ui.ts +0 -193
  91. package/src/view/apps/oligo-pattern.ts +0 -759
  92. package/src/view/apps/oligo-translator.ts +0 -184
  93. /package/src/{model → apps/common/model}/helpers.ts +0 -0
  94. /package/src/{model → apps/common/model}/monomer-lib/const.ts +0 -0
  95. /package/src/{view/utils → apps/common/view/components}/app-info-dialog.ts +0 -0
  96. /package/src/{view/utils → apps/common/view/components}/colored-input/input-painters.ts +0 -0
  97. /package/src/{view/style/colored-text-input.css → apps/common/view/components/colored-input/style.css} +0 -0
  98. /package/src/{view/utils → apps/common/view/components}/router.ts +0 -0
  99. /package/src/{model/structure-app → apps/structure/model}/const.ts +0 -0
  100. /package/src/{view/style/structure-app.css → apps/structure/view/style.css} +0 -0
  101. /package/src/{model/translator-app → apps/translator/model}/const.ts +0 -0
  102. /package/src/{view/style/translator-app.css → apps/translator/view/style.css} +0 -0
package/dist/package.js CHANGED
@@ -1,2 +1,3 @@
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 i of[t,e,n])i[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,i){function s(t){try{l(r.next(t))}catch(t){i(t)}}function a(t){try{l(r.throw(t))}catch(t){i(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((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})},490:(t,e,n)=>{n.d(e,{Z:()=>a});var o=n(537),r=n.n(o),i=n(645),s=n.n(i)()(r());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/style/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},753:(t,e,n)=>{n.d(e,{Z:()=>a});var o=n(537),r=n.n(o),i=n(645),s=n.n(i)()(r());s.push([t.id,"/* Naming convention: class names should begin with st and app name to avoid naming collitions */\n\n.st-structure-body {\n padding-right: 20px;\n}\n\n.st-structure-input-form {\n text-align: right;\n vertical-align: top;\n min-width: 95px;\n}\n\n.st-structure-direction-choice label {\n min-width: 100px;\n float: right;\n}\n\n.st-structure-direction-choice div {\n justify-content: right;\n}\n\n.st-structure-text-input-td { /* Style for td containing textarea */\n width: 100%;\n}\n\n.st-structure-mol-img {\n margin-right: 30px;\n float: right;\n}\n\n.st-structure-bool-button-block {\n justify-content: right;\n margin-bottom: 10px;\n}\n\n.st-structure-bottom {\n flex-direction: row-reverse;\n padding-top: 20px;\n}\n","",{version:3,sources:["webpack://./src/view/style/structure-app.css"],names:[],mappings:"AAAA,gGAAgG;;AAEhG;EACE,mBAAmB;AACrB;;AAEA;EACE,iBAAiB;EACjB,mBAAmB;EACnB,eAAe;AACjB;;AAEA;EACE,gBAAgB;EAChB,YAAY;AACd;;AAEA;EACE,sBAAsB;AACxB;;AAEA,8BAA8B,qCAAqC;EACjE,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 app name to avoid naming collitions */\n\n.st-structure-body {\n padding-right: 20px;\n}\n\n.st-structure-input-form {\n text-align: right;\n vertical-align: top;\n min-width: 95px;\n}\n\n.st-structure-direction-choice label {\n min-width: 100px;\n float: right;\n}\n\n.st-structure-direction-choice div {\n justify-content: right;\n}\n\n.st-structure-text-input-td { /* Style for td containing textarea */\n width: 100%;\n}\n\n.st-structure-mol-img {\n margin-right: 30px;\n float: right;\n}\n\n.st-structure-bool-button-block {\n justify-content: right;\n margin-bottom: 10px;\n}\n\n.st-structure-bottom {\n flex-direction: row-reverse;\n padding-top: 20px;\n}\n"],sourceRoot:""}]);const a=s},602:(t,e,n)=>{n.d(e,{Z:()=>a});var o=n(537),r=n.n(o),i=n(645),s=n.n(i)()(r());s.push([t.id,"/* Naming convention: class names should begin with st and app name to avoid naming collitions */\n.st-translator-input-table {\n /* width: 100%; */\n margin-right: 20px;\n}\n\n.st-translator-input-table td:has(textarea) {\n width: 100%;\n}\n\n.st-translator-input-table td:has(select) {\n min-width: 120px;\n vertical-align: top;\n}\n\n.st-translator-output-table {\n margin-top: 20px;\n margin-right: 20px;\n margin-bottom: 10px;\n}\n\n.st-translator-output-table table {\n width: 100%;\n table-layout: fixed;\n}\n\n/* .st-translator-output-table table tbody tr td { */\n/* max-width: 20%; */\n/* } */\n\n.st-translator-output-table td {\n padding-top: 6px;\n padding-bottom: 6px;\n}\n.st-translator-output-table tr:nth-child(even) {\n background-color: var(--grey-1);\n}\n\n.st-translator-output-table td:nth-child(odd) {\n width: 120px;\n vertical-align: top;\n}\n\n.st-translator-output-table td a {\n overflow-wrap: break-word;\n}\n","",{version:3,sources:["webpack://./src/view/style/translator-app.css"],names:[],mappings:"AAAA,gGAAgG;AAChG;EACE,iBAAiB;EACjB,kBAAkB;AACpB;;AAEA;EACE,WAAW;AACb;;AAEA;EACE,gBAAgB;EAChB,mBAAmB;AACrB;;AAEA;EACE,gBAAgB;EAChB,kBAAkB;EAClB,mBAAmB;AACrB;;AAEA;EACE,WAAW;EACX,mBAAmB;AACrB;;AAEA,oDAAoD;AACpD,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 app name to avoid naming collitions */\n.st-translator-input-table {\n /* width: 100%; */\n margin-right: 20px;\n}\n\n.st-translator-input-table td:has(textarea) {\n width: 100%;\n}\n\n.st-translator-input-table td:has(select) {\n min-width: 120px;\n vertical-align: top;\n}\n\n.st-translator-output-table {\n margin-top: 20px;\n margin-right: 20px;\n margin-bottom: 10px;\n}\n\n.st-translator-output-table table {\n width: 100%;\n table-layout: fixed;\n}\n\n/* .st-translator-output-table table tbody tr td { */\n/* max-width: 20%; */\n/* } */\n\n.st-translator-output-table td {\n padding-top: 6px;\n padding-bottom: 6px;\n}\n.st-translator-output-table tr:nth-child(even) {\n background-color: var(--grey-1);\n}\n\n.st-translator-output-table td:nth-child(odd) {\n width: 120px;\n vertical-align: top;\n}\n\n.st-translator-output-table td a {\n overflow-wrap: break-word;\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,r,i){"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!==i&&(void 0===u[5]||(u[1]="@layer".concat(u[5].length>0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),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),i="/*# ".concat(r," */");return[e].concat([i]).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/",i="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),r=new Uint8Array(o),i=0;i<e.length;i++)r[i]=e.charCodeAt(i);return new Blob([o],{type:n})},p={},m=null,g=function(t,e){var n=e||{},o=n.selectorRemap,r=n.modifyStyle,i=n.modifyCss,l=n.fonts,c=n.excludeUnusedCss,u=i||function(t,e){return(o?o(t):t)+"{"+(r?r(e):e)+"}\n"},d=[],h=void 0===l,g=l||[];return(m||(m=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 r,i,l=o.startsWith("../")?e+"/../"+o:o.startsWith("./")?e+"/."+o:o;return{text:t.cssText,format:(r=l,i=Object.keys(a).filter((function(t){return r.indexOf("."+t)>0})).map((function(t){return a[t]})),i?i[0]:(console.error("Unknown font format for "+r+". Fonts may not be working correctly."),"application/octet-stream")),url:l}}}(e,o);n&&g.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),r=t.text.replace(s,'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("")}))}(g).then((function(t){return d.join("\n")+t}))},f=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,m=o.scale,f=void 0===m?1:m,A=o.responsive,v=void 0!==A&&A,x=o.excludeCss,C=void 0!==x&&x;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"),i=new Image;i.crossOrigin="anonymous",i.src=n,i.onerror=function(){return o(new Error("Could not load "+n))},i.onload=function(){r.width=i.width,r.height=i.height,r.getContext("2d").drawImage(i,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 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 r=t.getBBox(),i=r.x,s=r.y;return{width:i+r.width,height:s+r.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 m=document.createElementNS("http://www.w3.org/2000/svg","svg");m.appendChild(o),o=m}if(o.setAttribute("version","1.1"),o.setAttribute("viewBox",[a,u,l,c].join(" ")),o.getAttribute("xmlns")||o.setAttributeNS(r,"xmlns",i),o.getAttribute("xmlns:xlink")||o.setAttributeNS(r,"xmlns:xlink","http://www.w3.org/1999/xlink"),v?(o.removeAttribute("width"),o.removeAttribute("height"),o.setAttribute("preserveAspectRatio","xMinYMin meet")):(o.setAttribute("width",l*f),o.setAttribute("height",c*f)),Array.from(o.querySelectorAll("foreignObject > *")).forEach((function(t){t.setAttributeNS(r,"xmlns","svg"===t.tagName?i:"http://www.w3.org/1999/xhtml")})),!C)return g(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 i=document.createElement("div");i.appendChild(o);var s=i.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 x=A.innerHTML;if("function"!=typeof n)return{src:x,width:l,height:c};n(x,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,i="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(i,o,r),i}))},o.svgAsPngUri=function(t,e,n){c(t);var r=e||{},i=r.encoderType,s=void 0===i?"image/png":i,a=r.encoderOptions,l=void 0===a?.8:a,u=r.canvg,d=function(t){var e=t.src,o=t.width,r=t.height,i=document.createElement("canvas"),a=i.getContext("2d"),c=window.devicePixelRatio||1;i.width=o*c,i.height=r*c,i.style.width=i.width+"px",i.style.height=i.height+"px",a.setTransform(c,0,0,c,0,0),u?u(i,e):a.drawImage(e,0,0);var d=void 0;try{d=i.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,i.width,i.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 r=h(e),i=URL.createObjectURL(r);o.href=i,o.onclick=function(){return requestAnimationFrame((function(){return URL.revokeObjectURL(i)}))}}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=f();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=f();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 i={},s=[],a=0;a<t.length;a++){var l=t[a],c=o.base?l[0]+o.base:l[0],u=i[c]||0,d="".concat(c," ").concat(u);i[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 m=r(p,o);o.byIndex=a,e.splice(a,0,{identifier:d,updater:m,references:1})}s.push(d)}return s}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 i=o(t=t||[],r=r||{});return function(t){t=t||[];for(var s=0;s<i.length;s++){var a=n(i[s]);e[a].references--}for(var l=o(t,r),c=0;c<i.length;c++){var u=n(i[c]);0===e[u].references&&(e[u].updater(),e.splice(u,1))}i=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 i=n.sourceMap;i&&"undefined"!=typeof btoa&&(o+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),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:()=>s,pl:()=>i});const o="System:AppData/SequenceTranslator",r="monomer-lib.json",i="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),r=n(895);const i=new o.FileSource(r.pl);let s,a,l,c;async function u(){[s,a,l,c].every((t=>void 0!==t))||(s=await d(r.dz),a=await d(r.Dv),l=await d(r.VV),c=await d(r.Xz))}async function d(t){let e;try{e=JSON.parse(await i.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)=>{n.d(e,{LR:()=>i,Y3:()=>s,xB:()=>r});var o=n(469);function r(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()}async function s(t,e,n="Oligo app"){try{return await t()}catch(t){const e=t.hasOwnProperty("message")?t.message:t.toString();throw o.shell.error(`${n} error: `+e),t}finally{e&&e()}}},559:(t,e,n)=>{n.d(e,{A:()=>a});var o=n(976),r=n(593),i=n(29),s=n(996);class a{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,this.getAllFormats().forEach((n=>{if(n===i.NI.HELM)return;const o=s.BF[n],r=Object.keys(o).filter((e=>o[e]===t.symbol));e[n]=r.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),r=n(559),i=n(669);class s{sequence;constructor(t){this.sequence=t,this.libWrapper=r.A.getInstance()}libWrapper;getInvalidCodeIndex(t){if(t===o.NI.HELM)return this.sequence.length;const e=["r","d"],n=(0,i.xB)(this.libWrapper.getCodesByFormat(t));let r=0;for(;r<this.sequence.length;){const t=n.find((t=>t===this.sequence.substring(r,r+t.length)));if(!t)break;if(r>1&&o.mc.includes(this.sequence[r])&&e.includes(this.sequence[r-2]))break;if(e.includes(this.sequence[r+1])&&o.mc.includes(this.sequence[r])){r++;break}r+=t.length}return r===this.sequence.length&&(r=-1),r}isValidSequence(t){return-1===this.getInvalidCodeIndex(t)}}},900:(t,e,n)=>{n.d(e,{$:()=>o});const o="p"},261:(t,e,n)=>{function o(t,e=!0){let n="\n Datagrok 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]=r(t.antiStrands[e]);let p=!1;const m=t.senseStrands.concat(t.antiStrands);let g=0;for(let e=0;e<m.length;e++){m[e]=m[e].replaceAll("(-\nM V30 ","(").replaceAll("-\nM V30 ","").replaceAll(" )",")");const n=i(m[e]),r=s(m[e]);if(e>=t.senseStrands.length?!1===p&&(p=!0,h=0):g=Math.min(g,Math.min(...r.y.filter((t=>t<0)))),p){const t=Math.min(...r.x)-h,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-g}let l=m[e].indexOf("M V30 BEGIN ATOM");l=m[e].indexOf("\n",l);let f=l,A=l;for(let t=0;t<n.natom;t++){f=m[e].indexOf("V30",f)+4,A=m[e].indexOf(" ",f);const n=parseInt(m[e].substring(f,A))+u;m[e]=m[e].slice(0,f)+n+m[e].slice(A),f=m[e].indexOf(" ",f)+1,f=m[e].indexOf(" ",f)+1,A=m[e].indexOf(" ",f);let o=Math.round(1e4*r.x[t])/1e4;m[e]=m[e].slice(0,f)+o+m[e].slice(A),f=m[e].indexOf(" ",f)+1,A=m[e].indexOf(" ",f),o=Math.round(1e4*r.y[t])/1e4,m[e]=m[e].slice(0,f)+o+m[e].slice(A),f=m[e].indexOf("\n",f)+1}const v=m[e].indexOf("M V30 END ATOM");o+=m[e].substring(l+1,v);let x=m[e].indexOf("M V30 BEGIN BOND");x=m[e].indexOf("\n",x),f=x,A=x;for(let t=0;t<n.nbond;t++){f=m[e].indexOf("V30",f)+4,A=m[e].indexOf(" ",f);const t=parseInt(m[e].substring(f,A))+d;m[e]=m[e].slice(0,f)+t+m[e].slice(A),f=m[e].indexOf(" ",f)+1,f=m[e].indexOf(" ",f)+1,A=m[e].indexOf(" ",f);let n=parseInt(m[e].substring(f,A))+u;m[e]=m[e].slice(0,f)+n+m[e].slice(A),f=m[e].indexOf(" ",f)+1,A=Math.min(m[e].indexOf("\n",f),m[e].indexOf(" ",f)),n=parseInt(m[e].substring(f,A))+u,m[e]=m[e].slice(0,f)+n+m[e].slice(A),f=m[e].indexOf("\n",f)+1}const C=m[e].indexOf("M V30 END BOND");a+=m[e].substring(x+1,C);let b=m[e].indexOf("M V30 MDLV30/STEABS ATOMS=(");for(;-1!==b;){b+=28;const t=m[e].indexOf(")",b);m[e].substring(b,t).split(" ").slice(1).forEach((t=>{c.push(parseInt(t)+u)})),b=t,b=m[e].indexOf("M V30 MDLV30/STEABS ATOMS=(",b)}u+=n.natom,d+=n.nbond,h+=Math.max(...r.x)+5}const f=Math.ceil(c.length/4);l+="M V30 MDLV30/STEABS ATOMS=("+c.length+" -\n";for(let t=0;t<f;t++){l+="M V30 ";const e=t+1===f?c.length-4*(f-1):4;for(let n=0;n<e;n++)l+=n+1===e?t===f-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 r(t){const e=s(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 i=Math.PI,a=Math.cos(i),l=Math.sin(i);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 i(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=i(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),a=Array(e.natom),l=Array(e.natom);for(let i=0;i<e.natom;i++)n=t.indexOf("V30",n)+4,o=t.indexOf(" ",n),r[i]=parseInt(t.substring(n,o)),n=o+1,o=t.indexOf(" ",n),s[i]=t.substring(n,o),n=o+1,o=t.indexOf(" ",n),a[i]=parseFloat(t.substring(n,o)),n=o+1,o=t.indexOf(" ",n),l[i]=parseFloat(t.substring(n,o)),n=t.indexOf("\n",n)+1;return{atomIndex:r,atomType:s,x:a,y:l}}n.d(e,{$U:()=>s,v5:()=>o})},544:(t,e,n)=>{n.d(e,{$3:()=>r,DD:()=>o,s8:()=>i});const o={NUCLEOSIDE:"nucleoside",LINKAGE:"phosphateBackbone"},r="p",i="<?>"},864:(t,e,n)=>{n.d(e,{D:()=>l});var o=n(29),r=n(544),i=n(456),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 i.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"),i=t.match(n);if(!i)return null;return i.map((t=>{const n=t.replace(/[\[\]()]/g,"");return o.mc.includes(n)?n:e.getNaturalAnalogBySymbol(n)})).map((t=>t||r.s8)).join("")}(n===o.NI.HELM?t:d[o.NI.HELM],a.A.getInstance());return h&&(d.Nucleotides=h),d}},456:(t,e,n)=>{n.d(e,{I:()=>u});var o=n(29),r=n(544),i=n(996);const s=(t,e)=>e.length-t.length;class a{constructor(){this.formats=this.getFormats()}formats;getFormatNames(){return this.formats.sort()}getCodesByFormat(t){if(this.validateFormat(t),this.isHelm(t))throw new Error("Codes cannot be obtained for HELM");return this.getFormatCodes(t)}getHelmToFormatDict(t){return this.validateFormat(t),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(s);e[t]=o[0]})),e}(i.Rv[t])}getFormatToHelmDict(t){this.validateFormat(t);const e=i.Rv[t];return Object.assign({},...Object.values(e))}getTargetFormatHelmCodes(t){this.validateFormat(t);const e=this.getHelmToFormatDict(t);return Object.keys(e).sort(s)}getTargetFormatHelmCodesRegExp(t){this.validateFormat(t);const e=this.getTargetFormatHelmCodes(t);return new RegExp(l(e)+"|.","g")}getFormatRegExp(t){if(this.validateFormat(t),this.isHelm(t))throw new Error("Helm RegExp can be built for non-HELM target formats");return this.getNonHelmFormatRegExp(t)}getPhosphateHelmCodesRegExp(t){this.validateFormat(t);const e=i.Rv[t],n=l(Array.from(new Set(Object.values(e[r.DD.LINKAGE]))).sort(s));return new RegExp(`${r.$3}.(${n})`,"g")}isValidFormat(t){return this.formats.includes(t)}getFormats(){return Object.keys(i.Rv)}validateFormat(t){if(!this.isValidFormat(t))throw new Error(`Invalid format: ${t}`)}isHelm(t){return t===o.NI.HELM}getFormatCodes(t){const e=this.getFormatToHelmDict(t);return Object.keys(e).sort(s)}getNonHelmFormatRegExp(t){const e=this.getCodesByFormat(t);return new RegExp(l(e)+"|\\([^()]*\\)|.","g")}}function l(t){return t.map((t=>t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"))).map((t=>t.includes("(")||t.includes(")")?t:`(?<!\\([^()]*)${t}(?![^()]*\\))`)).join("|")}const c={LEFT:"RNA1{",RIGHT:"}$$$$"};class u{sequence;sourceFormat;constructor(t,e){this.sequence=t,this.sourceFormat=e}formats=new a;convertTo(t){const e=this.formats.getFormatNames();if(this.sourceFormat===o.NI.HELM&&e.includes(t))return this.helmToFormat(this.sequence,t);if(e.includes(this.sourceFormat)&&t===o.NI.HELM)return this.formatToHelm(this.sequence,this.sourceFormat);if([this.sourceFormat,t].every((t=>e.includes(t)))){const e=this.formatToHelm(this.sequence,this.sourceFormat);return this.helmToFormat(e,t)}throw new Error(`ST: unsupported translation direction ${this.sourceFormat} -> ${t}`)}helmToFormat(t,e){const n=new RegExp(l(Object.values(c)),"g");let o=t.replace(n,"");const i=this.formats.getHelmToFormatDict(e),s=this.formats.getTargetFormatHelmCodes(e),a=this.formats.getTargetFormatHelmCodesRegExp(e);return o=o.replace(a,(t=>s.includes(t)?i[t]:"p"===t||"."===t?t:"?")).replace(/\?+/g,r.s8).replace(/p\.|\./g,""),o=o.replace(/<empty>/g,""),o=o.replace(/\/\//g,"/"),o}formatToHelm(t,e){const n=this.formats.getFormatToHelmDict(e),o=this.formats.getCodesByFormat(e),i=this.formats.getFormatRegExp(e),s=this.formats.getPhosphateHelmCodesRegExp(e);let a=t.replace(i,(t=>o.includes(t)?n[t]+".":"?"));return a=a.replace(/\?+/g,`${r.s8}.`),a=a.slice(0,-1),a[a.length-1]===r.$3&&(a=a.slice(0,-1)),a=a.replace(s,((t,e)=>e)),a=a.replace(/<empty>/g,""),`${c.LEFT+a+c.RIGHT}`}}},593:(t,e,n)=>{n.r(e),n.d(e,{_package:()=>pe,demoOligoPattern:()=>Oe,demoOligoStructure:()=>Ie,demoTranslateSequence:()=>Ee,getCodeToWeightsMap:()=>Ce,getMolfileFromGcrsSequence:()=>we,initSequenceTranslatorLibData:()=>xe,linkStrands:()=>ye,oligoPatternApp:()=>Ae,oligoStructureApp:()=>ve,oligoToolkitApp:()=>ge,oligoTranslatorApp:()=>fe,translateOligonucleotideSequence:()=>Se,validateSequence:()=>be});var o=n(976),r=n(469);const i=ui,s=rxjs;var a=n(379),l=n.n(a),c=n(795),u=n.n(c),d=n(569),h=n.n(d),p=n(565),m=n.n(p),g=n(216),f=n.n(g),A=n(589),v=n.n(A),x=n(602),C={};C.styleTagTransform=v(),C.setAttributes=m(),C.insert=h().bind(null,"head"),C.domAPI=u(),C.insertStyleElement=f(),l()(x.Z,C),x.Z&&x.Z.locals&&x.Z.locals;var b=n(947),w=n(669),y=n(29),E=n(559),O=n(996);class I{sequence;constructor(t){this.sequence=t,this.libWrapper=E.A.getInstance(),this.formats=Object.keys(O.Rv)}libWrapper;formats;getFormat(){if(this.sequence.startsWith("RNA"))return y.NI.HELM;const t=this.getListOfPossibleSynthesizersByFirstMatchedCode();if(0===t.length)return null;const e=new b.b(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,w.xB)(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}}const S=$;var T=n.n(S);function M(t){let e=0;const n=new I(t).getFormat();null!==n&&(e=new b.b(t).getInvalidCodeIndex(n));const o=e<0||""===t,r=i.span([]);T()(r).css("-webkit-text-fill-color","var(--grey-6)");const s=i.span([]);return T()(s).css("-webkit-text-fill-color","red"),o?r.innerHTML=t:(r.innerHTML=t.slice(0,e),s.innerHTML=t.slice(e)),[r,s]}var B=n(490),N={};N.styleTagTransform=v(),N.setAttributes=m(),N.insert=h().bind(null,"head"),N.domAPI=u(),N.insertStyleElement=f(),l()(B.Z,N),B.Z&&B.Z.locals&&B.Z.locals;class L{textInputBase;painter;constructor(t,e,n=!0){this.textInputBase=t,this.painter=e,T()(this.root).addClass("colored-text-input"),n&&this.textInputBase.onChanged((()=>{T()(this.textArea).css("height",0),T()(this.textArea).css("height",this.textArea.scrollHeight+"px")})),this.highlights=i.div([]),this.root.appendChild(this.highlights),this.colorize(),this.textInputBase.onChanged((()=>this.colorize()))}highlights;get textArea(){return this.textInputBase.root.getElementsByTagName("textarea").item(0)}get inputBase(){return this.textInputBase}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(900);class F{sequence;codeMap;constructor(t,e){this.sequence=t,this.codeMap=e}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 O.iA.left.includes(t)}(r)&&e.pop(),e.push(r);const i=V(r),s=o===t.length-1,a=o+1<t.length&&V(this.getSymbolForCode(t[o+1]));i||function(t){return O.iA.right.includes(t)}(r)||a||s||e.push(D.$)})),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)));e.push(o),n+=o.length}return e}getAllCodesOfFormat(){let t=Array.from(this.codeMap.keys());return(0,w.xB)(t)}}function V(t){return O.iA.phosphate.includes(t)}class k{invert;constructor(t,e=!1,n){this.invert=e,this.lib=E.A.getInstance();const o=this.lib.getCodeToSymbolMap(n);this.parser=new F(t,o)}parser;lib;convert(){const t=this.parser.parseSequence(),e=[];t.forEach(((t,n)=>{const o=this.getMonomerMolfile(t,n);e.push(o)}));let n=this.getPolymerMolfile(e);return this.invert&&(n=this.reflect(n),n=this.invertBondConfiguration(n)),n}invertBondConfiguration(t){const e=t.indexOf("M V30 BEGIN BOND"),n=t.indexOf("M V30 END BOND");let o=t.substring(e,n);return o=o.replace(/(CFG=)([13])/g,((t,e,n)=>"1"===n?`${e}3`:"3"===n?`${e}1`:t)),t.substring(0,e)+o+t.substring(n)}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),i=(e.x[r]+e.x[o])/2,s=(e.y[r]+e.y[o])/2;for(let t=0;t<n;t++)e.x[t]-=i,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 r=Array(e.natom),i=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),r[l]=parseInt(t.substring(n,o)),n=o+1,o=t.indexOf(" ",n),i[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:r,atomType:i,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),r=e.atomIndex.indexOf(n);n>8&&this.fix5Prime(e,o,r);const i=(e.x[r]+e.x[o])/2,s=(e.y[r]+e.y[o])/2;for(let t=0;t<n;t++)e.x[t]-=i,e.y[t]-=s;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 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="\n Datagrok macromolecule handler\n\n";n+=" 0 0 0 0 0 0 999 V3000\n",n+="M V30 BEGIN CTAB\n";let o="",r="",i="";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 i=0;n&&(i=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,m=h;for(let o=0;o<u.natom;o++)if(1!==d.atomIndex[o]||0===e){p=t[e].indexOf("V30",p)+4,m=t[e].indexOf(" ",p);let o=0;n?(o=parseInt(t[e].substring(p,m)),1===o?o=i:o===i&&(o=1),o+=a):o=parseInt(t[e].substring(p,m))+a,t[e]=t[e].slice(0,p)+o+t[e].slice(m),p=t[e].indexOf(" ",p)+1,p=t[e].indexOf(" ",p)+1,m=t[e].indexOf(" ",p);const r=c-d.x[0];let s=Math.round(1e4*(parseFloat(t[e].substring(p,m))+r))/1e4;t[e]=t[e].slice(0,p)+s+t[e].slice(m),p=t[e].indexOf(" ",p)+1,m=t[e].indexOf(" ",p),s=Math.round(1e4*parseFloat(t[e].substring(p,m)))/1e4,t[e]=t[e].slice(0,p)+s+t[e].slice(m),p=t[e].indexOf("\n",p)+1}else p=t[e].indexOf("M V30",p)-1,m=t[e].indexOf("\n",p+1),t[e]=t[e].slice(0,p)+t[e].slice(m);const g=t[e].indexOf("M V30 END ATOM");o+=t[e].substring(h+1,g);let f=t[e].indexOf("M V30 BEGIN BOND");f=t[e].indexOf("\n",f),p=f,m=f;for(let o=0;o<u.nbond;o++){p=t[e].indexOf("V30",p)+4,m=t[e].indexOf(" ",p);const o=parseInt(t[e].substring(p,m))+l;t[e]=t[e].slice(0,p)+o+t[e].slice(m),p=t[e].indexOf(" ",p)+1,p=t[e].indexOf(" ",p)+1,m=t[e].indexOf(" ",p);let r=0;n?(r=parseInt(t[e].substring(p,m)),1===r?r=i:r===i&&(r=1),r+=a):r=parseInt(t[e].substring(p,m))+a,t[e]=t[e].slice(0,p)+r+t[e].slice(m),p=t[e].indexOf(" ",p)+1,m=Math.min(t[e].indexOf("\n",p),t[e].indexOf(" ",p)),r=0,n?(r=parseInt(t[e].substring(p,m)),1===r?r=i:r===i&&(r=1),r+=a):r=parseInt(t[e].substring(p,m))+a,t[e]=t[e].slice(0,p)+r+t[e].slice(m),p=t[e].indexOf("\n",p)+1}const A=t[e].indexOf("M V30 END BOND");r+=t[e].substring(f+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);i+="M V30 MDLV30/STEABS ATOMS=("+s.length+" -\n";for(let t=0;t<u;t++){i+="M V30 ";const e=t+1===u?s.length-4*(u-1):4;for(let n=0;n<e;n++)i+=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+=r,n+="M V30 END BOND\n",e&&s.length>0?(n+="M V30 BEGIN COLLECTION\n",n+=i,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],i=t.y[o],s=t.x[n]-r,a=t.y[n]-i,l=t.x[e]-r,c=t.y[e]-i,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,m=u-s,g=d-a;Math.sqrt(g*g+m*m)>=Math.sqrt(p*p+h*h)&&(t.x[e]=u+r,t.y[e]=d+i)}}var P,H=n(864),_=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"}(P||(P={}));class R extends _.w{constructor(t){super(t)}static validate(t){return-1!==t.indexOf(P.HEADER)&&-1!==t.indexOf(P.END)}shiftIdxToAtomType(t){return this.shiftIdxToSpecifiedColumn(t,P.ATOM_TYPE_COL)}getCountsLineIdx(){let t=0;for(let e=0;e<P.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,P.FIRST_BONDED_ATOM_COL)}shiftIdxToBondType(t){return this.shiftIdxToSpecifiedColumn(t,P.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+P.NUM_OF_COUNTS_DIGITS;const n=parseInt(this.fileContent.substring(t,e));return t=e,e+=P.NUM_OF_COUNTS_DIGITS,{atomCount:n,bondCount:parseInt(this.fileContent.substring(t,e))}}}var j=n(577);class q{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 U=class extends Error{constructor(t){super(t)}};class W{constructor(t){this.molblock=t}_validMolBlock;get molblock(){return this._validMolBlock}set molblock(t){if(""!==t){try{this.validateMolBlock(t)}catch(e){e instanceof U&&(t="");const n=(0,G.O)(e);console.error(n)}this._validMolBlock=t}else this._validMolBlock=t}validateMolBlock(t){if(""===t)throw new U("MoleculeImage: invalid molblock")}async drawMolBlockOnCanvas(t){try{await r.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=q.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=i.dialog({title:"Molecule",showFooter:!1}),e=.7*T()(window).height(),n=this.getMoleculeDimensions(),o=e/n.height,r=e,s=n.width*o,a=i.canvas(s,r);await this.drawMolBlockOnCanvas(a);const l=i.block([a],{style:{overflowX:"scroll"}});t.add(l).showModal(!0),T()(t.root).find(".d4-dialog-contents").removeClass("ui-form"),T()(t.root).find(".d4-dialog-contents").removeClass("ui-panel"),T()(t.root).find(".d4-dialog-contents").addClass("ui-box"),T()(t.root).find(".d4-dialog-contents").css("padding","0")}async drawMolecule(t,e,n){t.innerHTML="";const o=i.canvas(e*window.devicePixelRatio,n*window.devicePixelRatio);o.style.width=`${e}px`,o.style.height=`${n}px`,o.style.cursor="zoom-in",this.drawMolBlockOnCanvas(o),o.addEventListener("click",(async()=>{await this.zoomIn()})),t.append(i.tooltip.bind(o,"Click to zoom"))}}var Y=n(713),z=n(511),X=n(456);class Z{constructor(){const t=Object.keys(O.Rv).concat(y.NI.HELM);this.moleculeImgDiv=i.div([]),this.moleculeImgDiv.className="mol-host",this.moleculeImgDiv.style.border="1px solid var(--grey-2)",this.moleculeImgDiv.style.borderRadius="1px",this.moleculeImgDiv.style.marginTop="12px",this.outputTableDiv=i.div([]),this.formatChoiceInput=i.choiceInput("",y.NI.HELM,t,(async()=>{this.format=this.formatChoiceInput.value,this.updateTable(),await this.updateMolImg()})),this.sequenceInputBase=i.textInput("",z.T,(()=>{this.onInput.next()})),this.init(),o.debounce(this.onInput,300).subscribe((async()=>{this.init(),this.formatChoiceInput.value=this.format,this.updateTable(),await this.updateMolImg()}))}onInput=new s.Subject;moleculeImgDiv;outputTableDiv;formatChoiceInput;sequenceInputBase;molfile;sequence;format;async getHtmlElement(){const t=new L(this.sequenceInputBase,M),e=i.button("Get SDF",(()=>{this.saveMolfile()}),"Save structure as SDF"),n=i.button("Copy SMILES",(()=>{this.copySmiles()}),"Copy SMILES for the sequence"),o=i.div([this.formatChoiceInput]),r=i.button(i.icons.delete((()=>{t.inputBase.value=""})),(()=>{}));i.tooltip.bind(r,"Clear input");const s={format:o,textInput:t.root,clearBtn:r},a=i.table([s],(t=>[t.format,t.textInput,t.clearBtn]));a.classList.add("st-translator-input-table");const l=i.block([this.outputTableDiv,e,n]),c=i.box(i.panel([a,l,i.block([i.box(this.moleculeImgDiv)])]));return this.formatChoiceInput.value=this.format,this.updateTable(),await this.updateMolImg(),c}saveMolfile(){const t=new k(this.sequence,!1,this.formatChoiceInput.value).convert()+"\n$$$$";(0,w.LR)(this.sequence+".sdf",encodeURIComponent(t))}copySmiles(){const t=o.chem.convert(this.molfile,o.chem.Notation.MolBlock,o.chem.Notation.Smiles);navigator.clipboard.writeText(t).then((()=>r.shell.info(Y.AU)))}updateTable(){this.outputTableDiv.innerHTML="";const t=this.format?new b.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 o="indexOfFirstInvalidChar"in e?i.divH([]):i.link(e[t],(()=>navigator.clipboard.writeText(e[t]).then((()=>r.shell.info(Y.AU)))),Y.wm,"");n.push({format:t,sequence:o})}const o=i.table(n,(t=>[t.format,t.sequence]),["FORMAT","SEQUENCE"]);this.outputTableDiv.append(o),this.outputTableDiv.classList.add("st-translator-output-table")}async updateMolImg(){const t=new W(this.molfile);await t.drawMolecule(this.moleculeImgDiv,500,170)}init(){this.sequence=this.getFormattedSequence(),this.format=new I(this.sequence).getFormat(),this.molfile=this.getMolfile()}getFormattedSequence(){return this.sequenceInputBase.value.replace(/\s/g,"")}getMolfile(){if(!this.format)return"";if(this.format===y.NI.HELM){const t=new X.I(this.sequence,this.format).convertTo(y.NI.AXOLABS);return new k(t,!1,y.NI.AXOLABS).convert()}return new k(this.sequence,!1,this.format).convert()}}var K=n(753),Q={};Q.styleTagTransform=v(),Q.setAttributes=m(),Q.insert=h().bind(null,"head"),Q.domAPI=u(),Q.insertStyleElement=f(),l()(K.Z,Q),K.Z&&K.Z.locals&&K.Z.locals;var J=n(261);function tt(t,e){if(""===t)return"";const n=new I(t).getFormat();if(!n)return"";let o="";try{o=new k(t,e,n).convert()}catch(t){const e=(0,G.O)(t);console.error(e)}return o}function et(t,e,n,o){const r=[t,e,n].filter((t=>""!==t.strand));if(1===r.length)return tt(r[0].strand,r[0].invert);{const r=tt(t.strand,t.invert),i=[tt(e.strand,e.invert),tt(n.strand,n.invert)].filter((t=>""!==t));return(0,J.v5)({senseStrands:[r],antiStrands:i},o)}}const nt=["ss","as","as2"];class ot{constructor(){this.onInput=new s.Subject,this.onInvalidInput=new s.Subject,this.inputBase=Object.fromEntries(nt.map((t=>[t,i.textInput("","",(()=>{this.onInput.next()}))]))),this.useChiralInput=i.boolInput("Use chiral",!0),this.saveAllStrandsInput=i.boolInput("Save as one entity",!0),i.tooltip.bind(this.saveAllStrandsInput.root,"Save SDF with all strands in one molfile"),this.directionInversion=Object.fromEntries(nt.map((t=>[t,!1]))),this.moleculeImgDiv=i.block([]),T()(this.moleculeImgDiv).addClass("st-structure-mol-img"),o.debounce(this.onInput,300).subscribe((async()=>{await this.updateMoleculeImg()})),o.debounce(this.onInvalidInput,1e3).subscribe((async()=>{r.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=i.divH([e,this.moleculeImgDiv]);T()(n).addClass("st-structure-bottom");const o=i.divV([t,n]);return T()(o).addClass("st-structure-body"),o}getBoolInputsAndButton(){const t=i.buttonsInput([i.bigButton("Save SDF",(()=>{const t=this.getStrandData();!function(t,e,n,o,i){const s=[t.strand,e.strand,n.strand].filter((t=>""!==t));if(0===s.length||1===s.length&&""===t.strand)r.shell.warning("Enter SS and optionally AS/AS2 to save SDF");else{let a;if(i)a=et(t,e,n,o)+"\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,w.LR)(`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=i.divV(e);for(const t of e)T()(t).addClass("st-structure-bool-button-block");return n}getTableInput(){const t=Object.fromEntries(nt.map((t=>[t,new L(this.inputBase[t],M)]))),e=Object.fromEntries(nt.map(((t,e)=>{const n=0===e?"5′ → 3′":"3′ → 5′";return[t,i.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]]))),r=Object.fromEntries(nt.map((t=>[t,i.label(o.get(t))]))),s=Object.fromEntries(nt.map((e=>{const n=i.icons.delete((()=>{t[e].inputBase.value=""})),o=i.button(n,(()=>{}));return i.tooltip.bind(o,`Clear ${e.toUpperCase()}`),[e,n]}))),a=nt.map((n=>({label:r[n],textInput:t[n].root,clear:s[n],choiceInput:e[n].root}))),l=i.table(a,(t=>[t.label,t.textInput,t.clear,t.choiceInput]));T()(l).css("margin-top","10px");for(const t of nt){let n=r[t].parentElement;n.classList.add("st-structure-input-form"),T()(n).css("padding-top","3px"),n=e[t].root.parentElement,n.classList.add("st-structure-input-form","st-structure-direction-choice"),n=this.inputBase[t].root.parentElement,n.classList.add("st-structure-text-input-td")}return l}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 et(t,e,n,this.useChiralInput.value)}async updateMoleculeImg(){let t="";try{const e=this.getStrandData();Object.values(e).some((t=>""!==t.strand))&&(t=this.getMolfile(e.ss,e.as,e.as2))}catch(t){const e=(0,G.O)(t);console.error(e)}const e=new W(t);await e.drawMolecule(this.moleculeImgDiv,650,150),T()(this.moleculeImgDiv).find("canvas").css("float","inherit")}}const rt="SequenceTranslator",it="SS",st="AS",at=[it,st],lt={[it]:"Sense strand",[st]:"Anti sense"},ct="THREE_PRIME",ut="FIVE_PRIME",dt=[ct,ut],ht={[ct]:3,[ut]:5};function pt(t){return"(o)"===t.slice(-3)}function mt(t){let e=0;for(;e<t.length&&pt(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 ft(t,e){return pt(t[e])||!y.mc.includes(t[e])?"":t[e]}function At(t){const e=O.al[t].color.match(/\d+/g).map((t=>Number(t)));return.299*e[0]+.587*e[1]+.114*e[2]>186?"#33333":"#ffffff"}function vt(t){return O.al[t].color}const xt={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 i=document.createElementNS(this.xmlns,"text");return i.setAttribute("x",String(e)),i.setAttribute("y",String(n)),i.setAttribute("font-size",String(o)),i.setAttribute("font-weight","normal"),i.setAttribute("font-family","Arial"),i.setAttribute("fill",r),i.innerHTML=t,i},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 i=r%2==0?6:3;o+=`${t+Math.cos(r*n+60)*i},${e+Math.sin(r*n+60)*i} `}return o}(t,e)),o.setAttribute("fill",n),o}};function Ct(t,e){const n=O.al[e].symbols.join("");return n.repeat(Math.floor(t/4))+n.slice(0,t%4)}async function bt(t){return await r.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 wt(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 yt(t,e,n,o,r,i){let s=-1,a=t.replace(/[AUGC]/g,(function(o){s++;const r=O.al,i=(Object.keys(r),r.RNA.symbols.indexOf(o));let a=r[e[s].value].symbols[i];return pt(e[s].value)&&(s<t.length/2&&!pt(e[s+1].value)?a=a+o+"f":s>t.length/2&&!pt(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+(i?"s":"")+a+r.value}const Et=15,Ot=30,It=17,St="red",Tt="var(--grey-6)",Mt="red",Bt="SS: 5'",Nt="AS: 3'",Lt=Math.max(gt(Bt,It),gt(Nt,It)),Dt=Math.max(gt("3'",It),gt("5'",It)),Ft=0+Lt-5,Vt={TITLE:Et,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 kt(t,e,n,o,r,i,s,a,l,c,u,d){function h(t){return Math.round((t+O)*M/(w.length+O)+6)}function p(t,e){return b+(A-t+e+1)*Ot}function m(t,e,n){return n<10||y.mc.includes(t[e])?-5:-10}n=n.reverse(),r=r.reverse();const g=mt(n),f=mt(o),A=Math.max(n.length-g,o.length-f),v=Math.max(g,f),x=Ot*(A+v),C=Math.max(gt(s,It),gt(c,It)),b=Math.max(gt(a,It),gt(l,It)),w=e?[...new Set(n.concat(o))]:[...new Set(n)],E=e?r.concat(i).includes(!0):r.includes(!0),O=E?1:0,I=g*Ot+p(-.5,0),S=f*Ot+p(-.5,0),T=Math.max(I,S)+C+Ot*v,M=Lt+C+x+b+Dt+Ot,B=xt.render(M,Vt.svgHeight(e));B.append(xt.text(Bt,0,Vt.SS_TEXTS,It,Tt),e?xt.text(Nt,0,Vt.AS_TEXTS,It,Tt):"",xt.text("3'",T,Vt.SS_TEXTS,It,Tt),e?xt.text("5'",T,Vt.AS_TEXTS,It,Tt):"",xt.text(a,Ft,Vt.SS_TEXTS,It,Mt),e?xt.text(l,Ft,Vt.AS_TEXTS,It,Mt):"",xt.text(s,I,Vt.SS_TEXTS,It,Mt),e?xt.text(c,S,Vt.AS_TEXTS,It,Mt):"",xt.text(u,0,Vt.comment(e),14,Tt),E?xt.star(Et,Vt.circlesInLegends(e),St):"",E?xt.text("ps linkage",22,Vt.textLegend(e),14,Tt):"");const N=n.filter((t=>!pt(t))).length;let L=N;for(let t=n.length-1;t>-1;t--){const e=p(t,g)+m(n,n.length-t,N-L);pt(n[t])||L--;const o=!pt(n[t])&&d.includes(n[t])?String(N-L):"";B.append(xt.text(o,e,Vt.SS_INDICES,14,Tt),xt.circle(p(t,g),Vt.SS_CIRCLES,Et,vt(n[t])),xt.text(ft(n,t),e,Vt.SS_TEXTS,It,At(n[t])),r[t]?xt.star(p(t,g)+Et,Vt.SS_TEXTS+5,St):"")}B.append(r[n.length]?xt.star(p(n.length,g)+Et,Vt.SS_TEXTS+5,St):"");const D=o.filter((t=>!pt(t))).length;if(e){let t=D;for(let e=o.length-1;e>-1;e--){pt(o[e])||t--;const n=p(e,f)+m(o,e,t+1),r=!pt(o[e])&&d.includes(o[e])?String(t+1):"";B.append(xt.text(r,n,Vt.AS_INDICES,14,Tt),xt.circle(p(e,f),Vt.AS_CIRCLES,Et,vt(o[e])),xt.text(ft(o,e),p(e,f)+m(o,e,t+1),Vt.AS_TEXTS,It,At(o[e])),i[e]?xt.star(p(e,f)+Et,Vt.AS_TEXTS+5,St):"")}B.append(i[o.length]?xt.star(p(o.length,f)+Et,Vt.AS_TEXTS+5,St):"")}const F=`${t} for ${N}${e?`/${D}`:""}mer`;B.append(xt.text(F,15,Vt.TITLE,It,"black"));for(let t=0;t<w.length;t++)B.append(xt.circle(h(t),Vt.circlesInLegends(e),6,vt(w[t])),xt.text(w[t],h(t)+6+4,Vt.textLegend(e),14,Tt));return B}var Pt=n(803);class Ht{get htmlDivElement(){function t(e){x[e].innerHTML="",C[e]=C[e].concat(Array(v[e]-b[e].length).fill(A)),b[e]=b[e].concat(Array(v[e]-b[e].length).fill(f));let o=0;for(let r=0;r<w[e].value;r++)C[e][r]=i.boolInput("",C[e][r].value,(()=>{s(),n()})),b[e][r]=i.choiceInput("",b[e][r].value,p,(e=>{g.includes(e)||(g.push(e),k.append(i.divText("",{style:{width:"25px"}}),i.boolInput(e,!0,(t=>{if(t)g.includes(e)||g.push(e);else{const t=g.indexOf(e,0);t>-1&&g.splice(t,1)}s()})).root)),t(st),s(),n()})),T()(b[e][r].root).addClass("st-pattern-choice-input"),pt(b[e][r].value)||o++,x[e].append(i.divH([i.div([i.label(pt(b[e][r].value)?"":String(o))],{style:{width:"20px"}}),i.block75([b[e][r].root]),i.div([C[e][r]])],{style:{alignItems:"center"}}))}function e(){Object.values(w).every((t=>t.value<35))?(at.forEach((e=>{w[e].value>v[e]&&(v[e]=w[e].value),t(e)})),s(),at.forEach((t=>{""===I[t].value&&(E[t].value=Ct(w[t].value,f.value))})),n()):i.dialog("Out of range").add(i.divText("Sequence length should be less than "+35..toString()+" due to UI constrains.")).onOK((()=>{Object.values(w).every((t=>t.value=34))})).onCancel((()=>{Object.values(w).every((t=>t.value=34))})).showModal(!1)}function n(){const t=[!0,j.value];at.forEach(((e,n)=>{t[n]&&(B[e].value=yt(E[e].value,b[e],C[e],M[e][ut],M[e][ct],S[e].value))}))}function s(){L.innerHTML="",L.append(i.span([kt(wt(q.value),j.value,b[it].slice(0,w[it].value).map((t=>t.value)),b[st].slice(0,w[st].value).map((t=>t.value)),[S[it].value].concat(C[it].slice(0,w[it].value).map((t=>t.value))),[S[st].value].concat(C[st].slice(0,w[st].value).map((t=>t.value))),M[it][ct].value,M[it][ut].value,M[st][ct].value,M[st][ut].value,$.value,g)]))}async function a(t){const e=o.TaskBarProgressIndicator.create("Loading pattern...");await r.dapi.userDataStorage.get(rt,!1).then((e=>{const n=JSON.parse(e[t]);f.value=function(t){const e={};let n=t[0],o=1;for(let r=0;r<t.length;r++){const i=t[r];null===e[i]?e[i]=1:e[i]++,e[i]>o&&(n=i,o=e[i])}return n}(n.asBases.concat(n.ssBases)),j.value=n.asBases.length>0,q.value=t;let o=["ssBases","asBases"];at.forEach(((t,e)=>{b[t]=[];const r=o[e];for(let e=0;e<n[r].length;e++)b[t].push(i.choiceInput("",n[r][e],p))})),o=["ssPtoLinkages","asPtoLinkages"],at.forEach(((t,e)=>{const r=o[e];S[t].value=n[r][0],C[t]=[];for(let e=1;e<n[r].length;e++)C[t].push(i.boolInput("",n[r][e]))})),o=["ssBases","asBases"],at.forEach(((t,e)=>{w[t].value=n[o[e]].length}));const r=[["ssThreeModification","ssFiveModification"],["asThreeModification","asFiveModification"]];at.forEach(((t,e)=>{dt.forEach(((o,i)=>{M[t][o].value=n[r[e][i]]}))})),$.value=n.comment})),e.close()}async function l(){const t=await async function(){return await r.dapi.users.current().then((t=>" (created by "+t.friendlyName+")"))}();return q.value=q.stringValue.includes("(created by ")?wt(q.value)+t:q.stringValue+t,r.dapi.userDataStorage.postValue(rt,q.value,JSON.stringify({ssBases:b[it].slice(0,w[it].value).map((t=>t.value)),asBases:b[st].slice(0,w[st].value).map((t=>t.value)),ssPtoLinkages:[S[it].value].concat(C[it].slice(0,w[it].value).map((t=>t.value))),asPtoLinkages:[S[st].value].concat(C[st].slice(0,w[st].value).map((t=>t.value))),ssThreeModification:M[it][ct].value,ssFiveModification:M[it][ut].value,asThreeModification:M[st][ct].value,asFiveModification:M[st][ut].value,comment:$.value}),!1).then((()=>r.shell.info("Pattern '"+q.value+"' was successfully uploaded!")))}async function c(){r.dapi.userDataStorage.get(rt,!1).then((async t=>{const e=[],n=[];for(const o of Object.keys(t))await bt(o)?n.push(o):e.push(o);let o=i.choiceInput("Load pattern","",e,(t=>a(t)));const s=(await r.dapi.users.current()).friendlyName,l=i.choiceInput("",s,[s,"Other users"],(t=>{const u=t===s?e:n;o=i.choiceInput("Load pattern","",u,(t=>a(t))),o.root.append(l.input),o.root.append(o.input),o.input.style.maxWidth="120px",o.input.style.marginLeft="12px",o.setTooltip("Apply Existing Pattern"),F.innerHTML="",F.append(o.root),o.root.append(i.div([i.button(i.iconFA("trash-alt",(()=>{})),(async()=>{null===o.value?r.shell.warning("Choose pattern to delete"):await bt(q.value)?r.shell.warning("Cannot delete pattern, created by other user"):await r.dapi.userDataStorage.remove(rt,o.value,!1).then((()=>r.shell.info("Pattern '"+o.value+"' deleted"))),await c()}))],"ui-input-options"))}));l.input.style.maxWidth="142px",o.root.append(l.input),o.root.append(o.input),o.input.style.maxWidth="100px",o.setTooltip("Apply Existing Pattern"),F.innerHTML="",F.append(o.root),o.root.append(i.div([i.button(i.iconFA("trash-alt",(()=>{})),(async()=>{null===o.value?r.shell.warning("Choose pattern to delete"):await bt(q.value)?r.shell.warning("Cannot delete pattern, created by other user"):await r.dapi.userDataStorage.remove(rt,o.value,!1).then((()=>r.shell.info("Pattern '"+o.value+"' deleted"))),await c()}))],"ui-input-options"))}))}async function u(){await r.dapi.userDataStorage.get(rt,!1).then((t=>{if(Object.keys(t).includes(q.value)){const t=i.dialog("Pattern already exists");T()(t.getButton("OK")).hide(),t.add(i.divText("Pattern name '"+q.value+"' already exists.")).add(i.divText("Replace pattern?")).addButton("YES",(async()=>{await r.dapi.userDataStorage.remove(rt,q.value,!1).then((()=>l())),t.close()})).show()}else l()})),await c()}function d(t,e){const n=function(t){const e=H.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=i.dialog("Sequences lengths mismatch");T()(n.getButton("OK")).hide(),n.add(i.divText("The sequence length should match the number of Raw sequences in the input file")).add(i.divText("'ADD COLUMN' to see sequences lengths")).addButton("ADD COLUMN",(()=>{H.value.columns.addNewInt("Sequences lengths in "+t).init((t=>e.get(t).length)),r.shell.info("Column with lengths added to '"+H.value.name+"'"),n.close(),r.shell.v=r.shell.getTableView(H.value.name)})).show()}return e.get(0).length!==w[it].value&&i.dialog("Length was updated by value to from imported file").add(i.divText("Latest modifications may not take effect during translation")).onOK((()=>r.shell.info("Lengths changed"))).show(),n}(t),o=H.value.getCol(t).get(0);n&&o.length!==w[e].value&&(w[e].value=H.value.getCol(t).get(0).length),E[e].value=o}function h(t){const e=H.value.getCol(t);if(e.type!==o.TYPE.INT)r.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))));i.dialog("Non-unique IDs").add(i.divText("Press 'OK' to select rows with non-unique values")).onOK((()=>{H.value.selection.init((n=>t.indexOf(e.get(n))>-1)),r.shell.v=r.shell.getTableView(H.value.name),r.shell.info("Rows are selected in table '"+H.value.name+"'")})).show()}var n}const p=Object.keys(O.al),m=p[0],g=[m],f=i.choiceInput("Sequence basis",m,p,(t=>{var e;e=t,at.forEach((t=>{for(let n=0;n<b[t].length;n++)b[t][n].value=e})),s(),n()})),A=i.boolInput("Fully PTO",!0,(t=>{var e;at.forEach((e=>{S[e].value=t})),e=t,at.forEach((t=>{for(let n=0;n<C[t].length;n++)C[t][n].value=e})),s(),n()}));A.captionLabel.classList.add("ui-label-right"),A.captionLabel.style.textAlign="left",A.captionLabel.style.maxWidth="100px",A.captionLabel.style.maxWidth="100px",A.captionLabel.style.minWidth="40px",A.captionLabel.style.width="auto";const v=Object.fromEntries(at.map((t=>[t,23]))),x=Object.fromEntries(at.map((t=>[t,i.div([])]))),C=Object.fromEntries(at.map((t=>[t,Array(23).fill(i.boolInput("",!0))]))),b=Object.fromEntries(at.map((t=>[t,Array(23).fill(i.choiceInput("",m,p))]))),w=Object.fromEntries(at.map((t=>{const n=i.intInput(`${lt[t]} length`,23,(()=>e()));return n.setTooltip(`Length of ${lt[t].toLowerCase()}, including overhangs`),[t,n]}))),y=Object.fromEntries(at.map((t=>[t,""]))),E=Object.fromEntries(at.map((t=>[t,i.textInput("",Ct(w[t].value,f.value))]))),I=Object.fromEntries(at.map((t=>{const e=i.choiceInput(`${lt[t]} column`,"",[],(e=>{d(e,t),y[t]=e}));return[t,e]}))),S=Object.fromEntries(at.map((t=>{const e=i.boolInput(`First ${t} PTO`,A.value,(()=>s()));return e.setTooltip(`ps linkage before first nucleotide of ${lt[t].toLowerCase()}`),e.captionLabel.classList.add("ui-label-right"),e.captionLabel.style.textAlign="left",e.captionLabel.style.maxWidth="100px",e.captionLabel.style.minWidth="40px",e.captionLabel.style.width="auto",[t,e]}))),M=Object.fromEntries(at.map((t=>{const e=Object.fromEntries(dt.map((e=>{const o=i.stringInput(`${t} ${ht[e]}' Modification`,"",(()=>{s(),n()}));return o.setTooltip(`Additional ${t} ${ht[e]}' Modification`),[e,o]})));return[t,e]}))),B=Object.fromEntries(at.map((t=>{const e=i.textInput("",yt(E[t].value,b[t],C[t],M[t][ct],M[t][ut],S[t].value));return e.input.style.minWidth="none",e.input.style.flexGrow="1",T()(e.root.lastChild).css("height","auto"),[t,e]}))),N=Object.fromEntries(at.map((t=>[t,i.block([i.h1(`${lt[t]}`),i.divH([i.div([i.divText("#")],{style:{width:"20px"}}),i.block75([i.divText("Modification")]),i.div([i.divText("PTO")])]),x[t]],{style:{paddingTop:"12px"}})])));at.forEach((t=>{E[t].input.style.resize="none",B[t].input.style.resize="none",E[t].input.style.minWidth="none",E[t].input.style.flexGrow="1",B[t].input.style.minWidth="none",B[t].input.style.flexGrow="1";let e=i.div([i.button(i.iconFA("copy",(()=>{})),(()=>{navigator.clipboard.writeText(B[t].value).then((()=>r.shell.info("Sequence was copied to clipboard")))}))],"ui-input-options");e.style.height="inherit",B[t].root.append(e)}));const L=i.div([]),D=i.div([],"ui-form ui-form-wide"),F=i.div([]),V=i.form([]),k=i.divH([i.boolInput(m,!0,(t=>{if(t)g.includes(m)||g.push(m);else{const t=g.indexOf(m,0);t>-1&&g.splice(t,1)}s(),n()})).root]),P=i.div([w[st].root]),H=function(t){const e=i.tableInput("Tables",t[0],t,(()=>{const t=e.value;if(null===t)return void console.warn("Table is null");const n=t.name;if(!r.shell.tableNames.includes(n)){const e=r.shell.v;r.shell.addTableView(t),r.shell.v=e}const o=t.columns.names();at.forEach((t=>{const e=o[0];d(e,t),y[t]=e;const n=i.choiceInput(`${lt[t]} column`,e,o,(e=>{d(e,t),y[t]=e,console.log(`clicked ${t} var:`,y[t])}));T()(I[t].root).replaceWith(n.root)})),_=o[0];const s=i.choiceInput("ID column",o[0],o,(t=>{h(t),_=t}));T()(R.root).replaceWith(s.root)}));return e}([]);let _="";const R=i.choiceInput("ID column","",[],(t=>{h(t),_=t}));c();const j=i.boolInput("Anti sense strand",!0,(t=>{N[st].hidden=!t,I[st].root.hidden=!t,P.hidden=!t,V.hidden=!t,D.hidden=!t,S[st].root.hidden=!t,s()}));j.setTooltip("Create antisense strand sections on SVG and table to the right");const q=i.textInput("Save as","Pattern name",(()=>s()));q.setTooltip("Name Of New Pattern"),dt.forEach((t=>{V.append(M[st][t].root)}));const $=i.textInput("Comment","",(()=>s())),G=i.bigButton("Save",(()=>{if(""!==q.value)u().then((()=>r.shell.info("Pattern saved")));else{const t=i.stringInput("Enter name","");i.dialog("Pattern Name").add(t.root).onOK((()=>{q.value=t.value,u().then((()=>r.shell.info("Pattern saved")))})).show()}}));q.addOptions(G);const U=i.bigButton("Convert",(()=>{const t=[!0,j.value];if(console.log("strand vars:",Object.values(y)),at.some(((e,n)=>t[n]&&""===y[e])))r.shell.info("Please select table and columns on which to apply pattern");else if(at.some((t=>w[t].value!==E[t].value.length))){const t=i.dialog("Length Mismatch");T()(t.getButton("OK")).hide(),t.add(i.divText("Length of sequences in columns doesn't match entered length. Update length value?")).addButton("YES",(()=>{at.forEach((t=>{w[t].value=H.value.getCol(I[t].value).getString(0).length})),t.close()})).show()}else{""!==_&&function(t,e,n){const o="ID "+n,i=r.shell.table(t).columns;i.contains(o)&&i.remove(o);const s=i.byName(e);i.addNewString(o).init((t=>""===s.getString(t)?"":s.get(t)+"_"+n))}(H.value.name,_,wt(q.value));const t=[!0,j.value];at.forEach(((e,n)=>{t[n]&&function(t,e,n,o,i,s,a){const l="Axolabs "+e,c=r.shell.table(t).columns;c.contains(l)&&c.remove(l);const u=c.byName(e);c.addNewString(l).init((t=>""===u.getString(t)?"":yt(u.getString(t),n,o,i,s,a)))}(H.value.name,y[e],b[e],C[e],M[e][ut],M[e][ct],S[e].value)})),r.shell.v=r.shell.getTableView(H.value.name),r.shell.info((j.value?"Columns were":"Column was")+" added to table '"+H.value.name+"'"),n()}}));D.append(E[st].root),D.append(B[st].root),e(),i.div([i.h1("Conversion preview"),E[it].root,B[it].root,D],"ui-form ui-form-wide"),i.block50([i.h1("Convert options"),H.root,I[it].root,I[st].root,R.root,i.buttonsInput([U])]).classList.add("ui-form");const W=i.link("Download",(()=>Pt.saveSvgAsPng(document.getElementById("mySvg"),q.value,{backgroundColor:"white"})),"Download pattern as PNG image",""),Y=i.link("Edit pattern",(()=>{i.dialog("Edit pattern").add(i.divV([i.h1("PTO"),i.divH([A.root,S[it].root,S[st].root],{style:{gap:"12px"}})])).add(i.divH([N[it],N[st]],{style:{gap:"24px"}})).onOK((()=>{r.shell.info("Saved")})).show()}),"Edit pattern","");return w[it].addCaption("Length"),i.splitH([i.box(i.div([i.h1("Pattern"),j.root,w[it],w[st],f.root,$.root,F,q.root,i.h1("Convert"),H.root,I[it],I[st],R.root,i.buttonsInput([U])],"ui-form"),{style:{maxWidth:"450px"}}),i.panel([L,k,i.divH([W,Y],{style:{gap:"12px",marginTop:"12px"}}),i.divH([i.divV([i.h1("Sense strand"),E[it].root,B[it].root],"ui-block"),i.divV([i.h1("Anti sense"),E[st],B[st]],"ui-block")],{style:{gap:"24px",marginTop:"24px"}}),i.h1("Additional modifications"),i.form([M[it][ut],M[it][ct]]),V],{style:{overflowX:"scroll",padding:"12px 24px"}})],{},!0)}}async function _t(t){try{const e={overflowX:"scroll"},n=i.div([],{style:e}),o=(0,J.$U)(t),s=.7*T()(window).height(),a=Math.max(...o.x)-Math.min(...o.x),l=Math.max(...o.y)-Math.min(...o.y),c=s/l,u=c*a,d=c*l,h=i.canvas(u*window.devicePixelRatio,d*window.devicePixelRatio);h.style.width=`${u}px`,h.style.height=`${d}px`,await async function(t,e){await r.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),i.dialog("Molecule").add(n).showModal(!0)}catch(t){const e=(0,G.O)(t);console.error(e)}}class Rt{static async view(){const t=E.A.getInstance().getTableForViewer();t.name="Monomer Library";const e=r.shell.addTableView(t);e.grid.props.allowEdit=!1,e.grid.onCellDoubleClick.subscribe((async t=>{const e=t.cell.value;"Molecule"===t.tableColumn?.semType&&await _t(e)}))}}class jt{appName;parentAppName;constructor(t,e){this.appName=t,this.parentAppName=e}async createAppLayout(){const t=o.TaskBarProgressIndicator.create(`Loading ${this.appName}...`);let e=r.shell.v?.root;e&&i.setUpdateIndicator(e,!0),await(0,w.Y3)((async()=>{await this.addView()}),(()=>t.close())),e&&i.setUpdateIndicator(e,!1)}}class qt extends jt{constructor(t){super(t),this.view=o.View.create(),this.setupView()}view;async addView(){await this.initView();const t=this.parentAppName?this.parentAppName+"/"+this.appName:this.appName;this.view.path=`/apps/${pe.name}/${t.replace(/\s/g,"")}/`,r.shell.addView(this.view)}async initView(){const t=await this.getHtml();this.view.append(t)}setupView(){this.view.box=!0,this.view.name=this.appName;const t=r.shell.windows;t.showProperties=!1,t.showToolbox=!1,t.showHelp=!1}getView(){return this.view}}class $t extends jt{constructor(t){super("Oligo Toolkit"),this.externalViewFactories=t;const e=this.getViewFactories();this.multiView=new o.MultiView({viewFactories:e})}multiView;externalViewFactories;getViewFactories(){function t(t){const e=new t(o.View.create());return e.initView(),()=>e.getView()}let e={TRANSLATOR:t(Wt),PATTERN:t(Yt),STRUCTURE:t(zt)};return this.externalViewFactories&&(e=Object.assign({},e,this.externalViewFactories)),e}getPath(){let t=this.multiView.tabs.currentPane.name;return t=t.charAt(0).toUpperCase()+t.substring(1).toLowerCase(),`/apps/${pe.name}/OligoToolkit/${t}`}setUrl(){this.multiView.path=this.getPath()}async addView(){this.multiView.tabs.onTabChanged.subscribe((()=>this.setUrl())),this.setUrl(),r.shell.addView(this.multiView)}}class Gt extends qt{constructor(t,e){super(t),this.layout=e}layout;getHtml(){return Promise.resolve(this.layout)}}class Ut{constructor(){}static getUI(t){switch(t){case"Oligo Translator":return new Wt;case"Oligo Pattern":return new Yt;case"Oligo Structure":return new zt;default:throw new Error(`Unknown app name: ${t}`)}}}class Wt extends qt{constructor(){super("Oligo Translator");const t=i.iconFA("book",Rt.view,"View monomer library");this.topPanel=[t],this.view.setRibbonPanels([this.topPanel]),this.ui=new Z}topPanel;ui;getHtml(){return this.ui.getHtmlElement()}}class Yt extends qt{constructor(){super("Oligo Pattern"),this.ui=new Ht}ui;getHtml(){return Promise.resolve(this.ui.htmlDivElement)}}class zt extends qt{constructor(){super("Oligo Structure"),this.ui=new ot}ui;getHtml(){return this.ui.getHtmlDivElement()}}var Xt,Zt,Kt=n(895);wu;class Qt{constructor(t,e,n){this.name=t,this.alphabet=e,this.cutoff=n}}(Zt=Xt||(Xt={})).FASTA="fasta",Zt.SEPARATOR="separator",Zt.HELM="helm";const Jt=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 Qt("PT",Jt.fasta.peptide,.5),new Qt("DNA",Jt.fasta.dna,.55),new Qt("RNA",Jt.fasta.rna,.55);class te extends Float32Array{}class ee{static makePalette(t,e=!1,n=ee){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]}}ee.undefinedColor="rgb(100,100,100)",ee.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 ne extends ee{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,ne)),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,ne)),this.grokGroups}static get RasMol(){return void 0===this.rasMol&&(this.rasMol=new ne({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 ne.aaSynonyms?ne.aaSynonyms[t]:t;return super.get(e)}}ne.aaSynonyms={MeNle:"L",MeA:"A",MeG:"G",MeF:"F"};class oe{static getPalette(t="grok"){switch(t){case"grok":return ne.GrokGroups;case"lesk":return ne.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]}}oe.SemType="Aminoacids",oe.SemTypeMultipleAlignment="AminoacidsMultipleAlignment",oe.undefinedColor="rgb(100,100,100)",oe.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"},oe.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"},oe.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(*)*"},oe.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 re{}re.SemType="Nucleotides",re.SemTypeMultipleAlignment="NucleotidesMultipleAlignment",re.Names={A:"Adenine",C:"Cytosine",G:"Guanine",T:"Thymine",U:"Uracil"};class ie{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 se{}class ae extends se{static buildPalette(){return[].concat(...Object.values(ee.colourPalette))}get(t){const e=ie.hashCode(t)%ae.palette.length;return function(t){if(null==t)return"rgb(100,100,100)";const e=o.Color.fromHtml(t),n=o.Color.g(e),r=o.Color.r(e),i=o.Color.b(e),s=Math.sqrt(Math.pow(0-r,2)+Math.pow(0-n,2)+Math.pow(0-i,2));return s>210?`rgb(${r/s*210},${n/s*210},${i/s*210})`:o.Color.toRgb(e)}(ae.palette[e])}}ae.palette=ae.buildPalette();new Uint32Array(65536);var le,ce;(ce=le||(le={})).HAMMING="Hamming",ce.LEVENSHTEIN="Levenshtein",ce.NEEDLEMANN_WUNSCH="Needlemann-Wunsch",le.HAMMING,le.LEVENSHTEIN,le.NEEDLEMANN_WUNSCH,new class{constructor(){this.uhTemp=`units-handler.${o.SEMTYPE.MACROMOLECULE}`}},Xt.FASTA,Xt.SEPARATOR,Xt.HELM;var ue=n(61);function de(){const t=i.textInput("","");return{coloredInput:new L(t,M),codes:O.BF}}class he extends o.Package{_monomerLib;get monomerLib(){if(!this._monomerLib)throw new Error("Monomer lib not loaded");return this._monomerLib}async initMonomerLib(){if(void 0!==this._monomerLib)return;const t=o.TaskBarProgressIndicator.create("Initializing Oligo Toolkit monomer library ...");await(0,w.Y3)((async()=>{const t=await async function(){const t=o.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 t.readLibrary(Kt.BX,Kt.a_)}),(()=>t.close()))}}const pe=new he;async function me(t){await xe();const e=Ut.getUI(t);await e.createAppLayout()}async function ge(){await xe();const t=await async function(){const t={"Mermadesynthesis:merMadeSynthesis":{tabName:"SYNTHESIZE",parameters:de()}},e={};for(const[n,o]of Object.entries(t)){let t;try{t=await r.functions.call(n,o.parameters);const i=new Gt(o.tabName,t);i.initView(),e[o.tabName]=()=>i.getView()}catch(t){console.warn(`Plugin ${n} not loaded, reason:`,t);continue}}return e}();if(!t)throw new Error("External app view factories not loaded");const e=new $t(t);await e.createAppLayout()}async function fe(){await me("Oligo Translator")}async function Ae(){await me("Oligo Pattern")}async function ve(){await me("Oligo Structure")}async function xe(){await(0,O.VO)(),await pe.initMonomerLib()}function Ce(){const t=E.A.getInstance().getCodesToWeightsMap();return Object.fromEntries(t)}function be(t){const e=new b.b(t),n=new I(t).getFormat();return null!==n&&e.isValidSequence(n)}function we(t,e){return new k(t,e,"GCRS").convert()}function ye(t){return(0,J.v5)(t,!0)}async function Ee(){await async function(){await(0,w.Y3)((async()=>fe()))}()}async function Oe(){await async function(){await(0,w.Y3)((async()=>{async function t(t,n,o){await(0,ue.gw)(3e3);const r=document.querySelectorAll(".st-pattern-choice-input > select");e=r.length;const i=r[o(n)];i.value=t;const s=new Event("input");i.dispatchEvent(s)}let e;await Ae(),["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))}))}))}()}async function Ie(){await async function(){await(0,w.Y3)((async()=>{await ve(),["Afcgacsu","Afcgacsu","Afcgacsu"].forEach((async(t,e)=>{await async function(t,e){await(0,ue.gw)(500);const n=document.querySelectorAll(".colored-text-input > textarea")[t];n.value=e;const o=new Event("input");n.dispatchEvent(o)}(e,t)}))}))}()}async function Se(t,e,n){return await xe(),new X.I(t,e).convertTo(n)}},713:(t,e,n)=>{n.d(e,{AU:()=>o,wm:()=>r});const o="Copied",r="Copy sequence"},511:(t,e,n)=>{n.d(e,{T:()=>o});const o="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 i=e[o]={id:o,exports:{}};return t[o](i,i.exports,n),i.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(593);sequencetranslator=o})();
1
+ /*! For license information please see package.js.LICENSE.txt */
2
+ var sequencetranslator;(()=>{var t={415:(t,e,n)=>{"use strict";n.d(e,{cb:()=>s}),n(328);var r=n(82);n(982),r.DataFrame.fromCsv('countries,fasta,smiles,molregno,LON,Zip Code,Street Address Line 1,ImageUrl,user_id,error_message,xray,flag,magnitude,CS-id,pdb_id,accel_a,time_offset,chart,fit,Questions,empty_number,empty_string\nBelgium,MSNFHNEHVMQFYRNNLKTKGVFGRQ,CC(C(=O)OCCCc1cccnc1)c2cccc(c2)C(=O)c3ccccc3,1480014,36.276729583740234,995042300,14016 ROUTE 31W,https://datagrok.ai/img/slides/access-db-connect.png,id,ErrorMessage,"COMPND \nATOM \nEND",flag,1,1,1QBS,1,1.23,<chart></chart>,"{""series"":[{""name"":""Run:2023-08-08"",""fitFunction"":""sigmoid"",""fitLineColor"":""#1f77b4"",""pointColor"":""#1f77b4"",""showPoints"":""points"",""parameters"":[2.497360340644872, 1.7058694986686864, 5.278052678195135, 0.16000320889028383],""points"":[{""x"":0.10000000149011612,""y"":2.374499797821045},{""x"":0.6000000238418579,""y"":2.6242473125457764},{""x"":1.100000023841858,""y"":2.367267608642578},{""x"":1.600000023841858,""y"":2.6723148822784424},{""x"":2.0999999046325684,""y"":2.6537344455718994},{""x"":2.5999999046325684,""y"":2.3651671409606934},{""x"":3.0999999046325684,""y"":2.5654284954071045},{""x"":3.5999999046325684,""y"":2.4160959720611572},{""x"":4.099999904632568,""y"":2.286726713180542},{""x"":4.599999904632568,""y"":2.5100042819976807},{""x"":5.099999904632568,""y"":1.6676985025405884},{""x"":5.599999904632568,""y"":0.680136501789093},{""x"":6.099999904632568,""y"":0.3391543924808502},{""x"":6.599999904632568,""y"":0.09038983285427094},{""x"":7.099999904632568,""y"":0.19802775979042053}]},{""name"":""Run:2023-08-08"",""fitLineColor"":""#ffbb78"",""pointColor"":""#ffbb78"",""showPoints"":""points"",""parameters"":[7.525235855508179, 1.3186911876809984, 5.335672608564294, 0.7860743343958098],""points"":[{""x"":0.10000000149011612,""y"":7.988070487976074},{""x"":0.6000000238418579,""y"":7.018453121185303},{""x"":1.100000023841858,""y"":8.115279197692871},{""x"":1.600000023841858,""y"":7.486658096313477},{""x"":2.0999999046325684,""y"":7.396438121795654},{""x"":2.5999999046325684,""y"":7.477052211761475},{""x"":3.0999999046325684,""y"":6.913095474243164},{""x"":3.5999999046325684,""y"":8.01385498046875},{""x"":4.099999904632568,""y"":6.985900402069092},{""x"":4.599999904632568,""y"":6.970335960388184},{""x"":5.099999904632568,""y"":5.448817253112793},{""x"":5.599999904632568,""y"":2.5534818172454834},{""x"":6.099999904632568,""y"":1.893947958946228},{""x"":6.599999904632568,""y"":0.6340042352676392},{""x"":7.099999904632568,""y"":0.8403874039649963}]}],""chartOptions"":{""xAxisName"":""Conc."",""yAxisName"":""Activity"",""title"":""Dose-Response curves""}}",text,100,abc\nBurundi,MDYKETLLMPKTDFPMRGGLPNKEPQIQEKW,COc1ccc2cc(ccc2c1)C(C)C(=O)Oc3ccc(C)cc3OC,1480015,36.276729583740234,995073444,80 STATE HIGHWAY 310,https://datagrok.ai/img/slides/access-db-connect.png,id,ErrorMessage,"COMPND \nATOM \nEND",flag,2,2,1ZP8,2,1.23,<chart></chart>,"{""series"":[{""name"":""Run:2023-08-08"",""fitFunction"":""sigmoid"",""fitLineColor"":""#1f77b4"",""pointColor"":""#1f77b4"",""showPoints"":""points"",""parameters"":[4.431460753103398, 2.1691498799246745, 5.266445597102774, 0.7825762827017926],""points"":[{""x"":0.10000000149011612,""y"":4.751083850860596},{""x"":0.6000000238418579,""y"":4.203000068664551},{""x"":1.100000023841858,""y"":4.415858745574951},{""x"":1.600000023841858,""y"":4.68414306640625},{""x"":2.0999999046325684,""y"":4.198400974273682},{""x"":2.5999999046325684,""y"":4.179222106933594},{""x"":3.0999999046325684,""y"":4.638473987579346},{""x"":3.5999999046325684,""y"":4.708553314208984},{""x"":4.099999904632568,""y"":4.291589260101318},{""x"":4.599999904632568,""y"":4.038082599639893},{""x"":5.099999904632568,""y"":3.4349939823150635},{""x"":5.599999904632568,""y"":1.2194708585739136},{""x"":6.099999904632568,""y"":1.1920831203460693},{""x"":6.599999904632568,""y"":0.5352635979652405},{""x"":7.099999904632568,""y"":0.3346920311450958}]},{""name"":""Run:2023-08-08"",""fitLineColor"":""#ffbb78"",""pointColor"":""#ffbb78"",""showPoints"":""points"",""parameters"":[2.339458017970126, -1.0734184310171178, 4.746332950550934, 0.2482416857595658],""points"":[{""x"":0.10000000149011612,""y"":0.2139337658882141},{""x"":0.6000000238418579,""y"":0.4269562065601349},{""x"":1.100000023841858,""y"":0.2441573292016983},{""x"":1.600000023841858,""y"":0.146635964512825},{""x"":2.0999999046325684,""y"":0.08818462491035461},{""x"":2.5999999046325684,""y"":0.2560656666755676},{""x"":3.0999999046325684,""y"":0.42434045672416687},{""x"":3.5999999046325684,""y"":0.37111231684684753},{""x"":4.099999904632568,""y"":0.5581737160682678},{""x"":4.599999904632568,""y"":1.183590054512024},{""x"":5.099999904632568,""y"":1.5629843473434448},{""x"":5.599999904632568,""y"":2.3211288452148438},{""x"":6.099999904632568,""y"":2.229961633682251},{""x"":6.599999904632568,""y"":2.2560226917266846},{""x"":7.099999904632568,""y"":2.2142398357391357}]}],""chartOptions"":{""xAxisName"":""Conc."",""yAxisName"":""Activity"",""title"":""Dose-Response curves""}}",text,,\nCameroon,MIEVFLFGIVLGLIPITLAGLFVTAYLQYRRGDQLDL,COc1ccc2cc(ccc2c1)C(C)C(=O)OCCCc3cccnc3,1480016,36.26095962524414,995153596,30-56 WHITESTONE EXPY,https://datagrok.ai/img/slides/access-db-connect.png,id,ErrorMessage,"COMPND \nATOM \nEND",flag,3,3,2BDJ,3,1.23,<chart></chart>,"{""series"":[{""name"":""Run:2023-08-08"",""fitFunction"":""sigmoid"",""fitLineColor"":""#1f77b4"",""pointColor"":""#1f77b4"",""showPoints"":""points"",""parameters"":[4.6760652578642325, 0.9046956320756703, 5.651408971856738, 0.07738846012184185],""points"":[{""x"":0.10000000149011612,""y"":4.32425594329834},{""x"":0.6000000238418579,""y"":4.668442249298096},{""x"":1.100000023841858,""y"":4.379785060882568},{""x"":1.600000023841858,""y"":5.0345139503479},{""x"":2.0999999046325684,""y"":4.878653526306152},{""x"":2.5999999046325684,""y"":4.3451313972473145},{""x"":3.0999999046325684,""y"":4.336992263793945},{""x"":3.5999999046325684,""y"":5.037430286407471},{""x"":4.099999904632568,""y"":5.0092692375183105},{""x"":4.599999904632568,""y"":4.151902675628662},{""x"":5.099999904632568,""y"":3.4066951274871826},{""x"":5.599999904632568,""y"":2.3732759952545166},{""x"":6.099999904632568,""y"":1.673728108406067},{""x"":6.599999904632568,""y"":0.48574790358543396},{""x"":7.099999904632568,""y"":0.2783052325248718}]},{""name"":""Run:2023-08-08"",""fitLineColor"":""#ffbb78"",""pointColor"":""#ffbb78"",""showPoints"":""points"",""parameters"":[2.938395863010111, -1.4658480661392117, 5.462702751996584, 0.3473139023615039],""points"":[{""x"":0.10000000149011612,""y"":0.4941710829734802},{""x"":0.6000000238418579,""y"":0.15323974192142487},{""x"":1.100000023841858,""y"":0.46373432874679565},{""x"":1.600000023841858,""y"":0.3370431363582611},{""x"":2.0999999046325684,""y"":0.5179030299186707},{""x"":2.5999999046325684,""y"":0.27899765968322754},{""x"":3.0999999046325684,""y"":0.22075064480304718},{""x"":3.5999999046325684,""y"":0.5789918899536133},{""x"":4.099999904632568,""y"":0.21169911324977875},{""x"":4.599999904632568,""y"":0.27857646346092224},{""x"":5.099999904632568,""y"":1.0906332731246948},{""x"":5.599999904632568,""y"":1.8520300388336182},{""x"":6.099999904632568,""y"":2.7177059650421143},{""x"":6.599999904632568,""y"":2.8680918216705322},{""x"":7.099999904632568,""y"":3.2413077354431152}]}],""chartOptions"":{""xAxisName"":""Conc."",""yAxisName"":""Activity"",""title"":""Dose-Response curves""}}",text,,\nCanada,MMELVLKTIIGPIVVGVVLRIVDKWLNKDK,CC(C(=O)NCCS)c1cccc(c1)C(=O)c2ccccc2,1480017,36.26095962524414,99515,30-56 WHITESTONE EXPY,https://datagrok.ai/img/slides/access-db-connect.png,id,ErrorMessage,"COMPND \nATOM \nEND",flag,4,4,1IAN,4,1.23,<chart></chart>,"{""series"":[{""name"":""Run:2023-08-08"",""fitFunction"":""sigmoid"",""fitLineColor"":""#1f77b4"",""pointColor"":""#1f77b4"",""showPoints"":""points"",""parameters"":[0.8597390975430008, 1.0957625732481946, 5.260537067987958, 0.07974187998177736],""points"":[{""x"":0.10000000149011612,""y"":0.8190152645111084},{""x"":0.6000000238418579,""y"":0.8421689867973328},{""x"":1.100000023841858,""y"":0.8740922212600708},{""x"":1.600000023841858,""y"":0.8924275040626526},{""x"":2.0999999046325684,""y"":0.8249067664146423},{""x"":2.5999999046325684,""y"":0.9327669143676758},{""x"":3.0999999046325684,""y"":0.8522974252700806},{""x"":3.5999999046325684,""y"":0.8174492716789246},{""x"":4.099999904632568,""y"":0.8394647240638733},{""x"":4.599999904632568,""y"":0.7139387726783752},{""x"":5.099999904632568,""y"":0.5561167597770691},{""x"":5.599999904632568,""y"":0.3276226818561554},{""x"":6.099999904632568,""y"":0.12479474395513535},{""x"":6.599999904632568,""y"":0.13006797432899475},{""x"":7.099999904632568,""y"":0.059702079743146896}]},{""name"":""Run:2023-08-08"",""fitLineColor"":""#ffbb78"",""pointColor"":""#ffbb78"",""showPoints"":""points"",""parameters"":[5.760930219582546, 1.6591793293833013, 4.667155929720851, 0.7858109544121652],""points"":[{""x"":0.10000000149011612,""y"":6.156993389129639},{""x"":0.6000000238418579,""y"":5.236701965332031},{""x"":1.100000023841858,""y"":6.010560512542725},{""x"":1.600000023841858,""y"":5.495512962341309},{""x"":2.0999999046325684,""y"":6.087770462036133},{""x"":2.5999999046325684,""y"":5.79986572265625},{""x"":3.0999999046325684,""y"":5.597546577453613},{""x"":3.5999999046325684,""y"":5.520902156829834},{""x"":4.099999904632568,""y"":5.360654354095459},{""x"":4.599999904632568,""y"":3.5539746284484863},{""x"":5.099999904632568,""y"":1.577236294746399},{""x"":5.599999904632568,""y"":1.0001264810562134},{""x"":6.099999904632568,""y"":0.9305797815322876},{""x"":6.599999904632568,""y"":0.6033638715744019},{""x"":7.099999904632568,""y"":0.4203685522079468}]}],""chartOptions"":{""xAxisName"":""Conc."",""yAxisName"":""Activity"",""title"":""Dose-Response curves""}}",text,,\nColombia,MDRTDEVSNHTHDKPTLTWFEEIFEEYHSPFHN,FC(F)(F)c1ccc(OC2CCNCC2)cc1,1480029,36.3309440612793,995152050,1 COURT HOUSE SQUARE,https://datagrok.ai/img/slides/access-db-connect.png,id,ErrorMessage,"COMPND \nATOM \nEND",flag,5,5,4UJ1,5,1.23,<chart></chart>,"{""series"":[{""name"":""Run:2023-08-08"",""fitFunction"":""sigmoid"",""fitLineColor"":""#1f77b4"",""pointColor"":""#1f77b4"",""showPoints"":""points"",""parameters"":[6.4995088314153655, 2.4270351004539914, 5.178659535348579, 0.625653346241577],""points"":[{""x"":0.10000000149011612,""y"":6.496231555938721},{""x"":0.6000000238418579,""y"":6.42543363571167},{""x"":1.100000023841858,""y"":7.040063858032227},{""x"":1.600000023841858,""y"":6.1115403175354},{""x"":2.0999999046325684,""y"":6.680728435516357},{""x"":2.5999999046325684,""y"":6.406774520874023},{""x"":3.0999999046325684,""y"":6.611269474029541},{""x"":3.5999999046325684,""y"":5.889094352722168},{""x"":4.099999904632568,""y"":6.75344705581665},{""x"":4.599999904632568,""y"":6.361435890197754},{""x"":5.099999904632568,""y"":4.1666975021362305},{""x"":5.599999904632568,""y"":1.172118902206421},{""x"":6.099999904632568,""y"":0.801048994064331},{""x"":6.599999904632568,""y"":0.4640021026134491},{""x"":7.099999904632568,""y"":0.0010357667924836278}]},{""name"":""Run:2023-08-08"",""fitLineColor"":""#ffbb78"",""pointColor"":""#ffbb78"",""showPoints"":""points"",""parameters"":[1.4734381347446401, 1.1649805188074196, 4.82958608866421, 0.09500545496710007],""points"":[{""x"":0.10000000149011612,""y"":1.5279096364974976},{""x"":0.6000000238418579,""y"":1.3559974431991577},{""x"":1.100000023841858,""y"":1.5246378183364868},{""x"":1.600000023841858,""y"":1.5567657947540283},{""x"":2.0999999046325684,""y"":1.4114240407943726},{""x"":2.5999999046325684,""y"":1.4045010805130005},{""x"":3.0999999046325684,""y"":1.4769829511642456},{""x"":3.5999999046325684,""y"":1.4875500202178955},{""x"":4.099999904632568,""y"":1.2991987466812134},{""x"":4.599999904632568,""y"":0.922961413860321},{""x"":5.099999904632568,""y"":0.6520044803619385},{""x"":5.599999904632568,""y"":0.15350978076457977},{""x"":6.099999904632568,""y"":0.1078903079032898},{""x"":6.599999904632568,""y"":0.17276449501514435},{""x"":7.099999904632568,""y"":0.14066608250141144}]}],""chartOptions"":{""xAxisName"":""Conc."",""yAxisName"":""Activity"",""title"":""Dose-Response curves""}}",text,,\nCosta Rica,MKSTKEEIQTIKTLLKDSRTAKYHKRLQIVL,CC(C)Cc1ccc(cc1)C(C)C(=O)N2CCCC2C(=O)OCCCc3ccccc3,1480018,36.3309440612793,995084218,4041 SOUTHWESTERN BLVD,https://datagrok.ai/img/slides/access-db-connect.png,id,ErrorMessage,"COMPND \nATOM \nEND",flag,6,6,2BPW,6,1.23,<chart></chart>,"{""series"":[{""name"":""Run:2023-08-08"",""fitFunction"":""sigmoid"",""fitLineColor"":""#1f77b4"",""pointColor"":""#1f77b4"",""showPoints"":""points"",""parameters"":[2.4833641843311227, -1.8945978742090062, 4.671127708092568, 0.24159861311815153],""points"":[{""x"":0.10000000149011612,""y"":0.0969524160027504},{""x"":0.6000000238418579,""y"":0.028483040630817413},{""x"":1.100000023841858,""y"":0.22087176144123077},{""x"":1.600000023841858,""y"":0.0068915546871721745},{""x"":2.0999999046325684,""y"":0.4305879771709442},{""x"":2.5999999046325684,""y"":0.44774115085601807},{""x"":3.0999999046325684,""y"":0.45346319675445557},{""x"":3.5999999046325684,""y"":0.2370593100786209},{""x"":4.099999904632568,""y"":0.4657953977584839},{""x"":4.599999904632568,""y"":1.155200719833374},{""x"":5.099999904632568,""y"":2.2294070720672607},{""x"":5.599999904632568,""y"":2.4311530590057373},{""x"":6.099999904632568,""y"":2.33846116065979},{""x"":6.599999904632568,""y"":2.608201026916504},{""x"":7.099999904632568,""y"":2.8136143684387207}]},{""name"":""Run:2023-08-08"",""fitLineColor"":""#ffbb78"",""pointColor"":""#ffbb78"",""showPoints"":""points"",""parameters"":[5.224573521642033, 1.4454033924198528, 5.6014197746076535, 0.2823216054197577],""points"":[{""x"":0.10000000149011612,""y"":4.95027494430542},{""x"":0.6000000238418579,""y"":5.1754679679870605},{""x"":1.100000023841858,""y"":5.276752948760986},{""x"":1.600000023841858,""y"":5.589294910430908},{""x"":2.0999999046325684,""y"":5.616994857788086},{""x"":2.5999999046325684,""y"":5.120813846588135},{""x"":3.0999999046325684,""y"":5.340766906738281},{""x"":3.5999999046325684,""y"":4.876471042633057},{""x"":4.099999904632568,""y"":4.94999361038208},{""x"":4.599999904632568,""y"":5.162564754486084},{""x"":5.099999904632568,""y"":4.399557590484619},{""x"":5.599999904632568,""y"":2.7977969646453857},{""x"":6.099999904632568,""y"":1.0229872465133667},{""x"":6.599999904632568,""y"":0.48275601863861084},{""x"":7.099999904632568,""y"":0.10408931970596313}]}],""chartOptions"":{""xAxisName"":""Conc."",""yAxisName"":""Activity"",""title"":""Dose-Response curves""}}",text,,\nCuba,MHAILRYFIRRLFYHIFYKIYSLISKKHQSLPSDVRQF,COc1ccc2c(c1)c(CC(=O)N3CCCC3C(=O)Oc4ccc(C)cc4OC)c(C)n2C(=O)c5ccc(Cl)cc5,1480019,36.33115768432617,995081928,1227 US HIGHWAY 11,https://datagrok.ai/img/slides/access-db-connect.png,id,ErrorMessage,"COMPND \nATOM \nEND",flag,7,7,1QBS,7,1.23,<chart></chart>,"{""series"":[{""name"":""Run:2023-08-08"",""fitFunction"":""sigmoid"",""fitLineColor"":""#1f77b4"",""pointColor"":""#1f77b4"",""showPoints"":""points"",""parameters"":[3.320838679713925, -1.2421619987316728, 4.831325425225256, 0.3236011098403072],""points"":[{""x"":0.10000000149011612,""y"":0.3727470338344574},{""x"":0.6000000238418579,""y"":0.12365014106035233},{""x"":1.100000023841858,""y"":0.48422467708587646},{""x"":1.600000023841858,""y"":0.2264465093612671},{""x"":2.0999999046325684,""y"":0.16821794211864471},{""x"":2.5999999046325684,""y"":0.3879014551639557},{""x"":3.0999999046325684,""y"":0.5470244884490967},{""x"":3.5999999046325684,""y"":0.3419053554534912},{""x"":4.099999904632568,""y"":0.7655120491981506},{""x"":4.599999904632568,""y"":1.2346516847610474},{""x"":5.099999904632568,""y"":2.453336715698242},{""x"":5.599999904632568,""y"":2.9565491676330566},{""x"":6.099999904632568,""y"":3.335299491882324},{""x"":6.599999904632568,""y"":3.240290880203247},{""x"":7.099999904632568,""y"":3.1107218265533447}]},{""name"":""Run:2023-08-08"",""fitLineColor"":""#ffbb78"",""pointColor"":""#ffbb78"",""showPoints"":""points"",""parameters"":[3.6401853521511094, 1.26211588875013, 5.399028074402744, 0.5089580830068091],""points"":[{""x"":0.10000000149011612,""y"":3.8585598468780518},{""x"":0.6000000238418579,""y"":3.6077206134796143},{""x"":1.100000023841858,""y"":3.855252265930176},{""x"":1.600000023841858,""y"":3.619039297103882},{""x"":2.0999999046325684,""y"":3.839388370513916},{""x"":2.5999999046325684,""y"":3.335283041000366},{""x"":3.0999999046325684,""y"":3.571141481399536},{""x"":3.5999999046325684,""y"":3.4155046939849854},{""x"":4.099999904632568,""y"":3.7316646575927734},{""x"":4.599999904632568,""y"":3.0680155754089355},{""x"":5.099999904632568,""y"":2.891066551208496},{""x"":5.599999904632568,""y"":1.6022753715515137},{""x"":6.099999904632568,""y"":0.7652576565742493},{""x"":6.599999904632568,""y"":0.6875326037406921},{""x"":7.099999904632568,""y"":0.5828871726989746}]}],""chartOptions"":{""xAxisName"":""Conc."",""yAxisName"":""Activity"",""title"":""Dose-Response curves""}}",text,,\nItaly,MSNFHNEHVMQFYRNNLKTKGVFGRQ,CC(C)Cc1ccc(cc1)C(C)C(=O)N2CCCC2C(=O)OCCO[N+](=O)[O-],1480020,36.33115768432617,99502,"168-46 91ST AVE., 2ND FLR",https://datagrok.ai/img/slides/access-db-connect.png,id,ErrorMessage,"COMPND \nATOM \nEND",flag,8,8,1ZP8,8,1.23,<chart></chart>,"{""series"":[{""name"":""Run:2023-08-08"",""fitFunction"":""sigmoid"",""fitLineColor"":""#1f77b4"",""pointColor"":""#1f77b4"",""showPoints"":""points"",""parameters"":[2.293592105923809, 1.3781586549141835, 5.1025898038676605, 0.03493851245291291],""points"":[{""x"":0.10000000149011612,""y"":2.1287283897399902},{""x"":0.6000000238418579,""y"":2.267972230911255},{""x"":1.100000023841858,""y"":2.398442506790161},{""x"":1.600000023841858,""y"":2.5130622386932373},{""x"":2.0999999046325684,""y"":2.3255116939544678},{""x"":2.5999999046325684,""y"":2.127340793609619},{""x"":3.0999999046325684,""y"":2.47259783744812},{""x"":3.5999999046325684,""y"":2.131181478500366},{""x"":4.099999904632568,""y"":2.090421438217163},{""x"":4.599999904632568,""y"":2.02299165725708},{""x"":5.099999904632568,""y"":1.1105059385299683},{""x"":5.599999904632568,""y"":0.4494485855102539},{""x"":6.099999904632568,""y"":0.1375635862350464},{""x"":6.599999904632568,""y"":0.036351121962070465},{""x"":7.099999904632568,""y"":0.1619771122932434}]},{""name"":""Run:2023-08-08"",""fitLineColor"":""#ffbb78"",""pointColor"":""#ffbb78"",""showPoints"":""points"",""parameters"":[5.953125499439879, 1.2528620255306528, 5.187637440149802, 0.3110348753260886],""points"":[{""x"":0.10000000149011612,""y"":5.6585283279418945},{""x"":0.6000000238418579,""y"":5.911152362823486},{""x"":1.100000023841858,""y"":5.924920082092285},{""x"":1.600000023841858,""y"":5.8469438552856445},{""x"":2.0999999046325684,""y"":5.929472923278809},{""x"":2.5999999046325684,""y"":6.190037727355957},{""x"":3.0999999046325684,""y"":6.236179828643799},{""x"":3.5999999046325684,""y"":6.141019344329834},{""x"":4.099999904632568,""y"":5.295210838317871},{""x"":4.599999904632568,""y"":5.265801906585693},{""x"":5.099999904632568,""y"":3.3722851276397705},{""x"":5.599999904632568,""y"":1.8299226760864258},{""x"":6.099999904632568,""y"":0.32690900564193726},{""x"":6.599999904632568,""y"":0.6274543404579163},{""x"":7.099999904632568,""y"":0.8441857099533081}]}],""chartOptions"":{""xAxisName"":""Conc."",""yAxisName"":""Activity"",""title"":""Dose-Response curves""}}",text,,\nRwanda,MPNSEPASLLELFNSIATQGELVRSLKAGNASK,CC(C)Cc1ccc(cc1)C(C)C(=O)N2CCCC2C(=O)OCCO,1480021,36.33137130737305,995037247,"168-46 91ST AVE., 2ND FLR",https://datagrok.ai/img/slides/access-db-connect.png,id,ErrorMessage,"COMPND \nATOM \nEND",flag,9,9,2BDJ,9,1.23,<chart></chart>,"{""series"":[{""name"":""Run:2023-08-08"",""fitFunction"":""sigmoid"",""fitLineColor"":""#1f77b4"",""pointColor"":""#1f77b4"",""showPoints"":""points"",""parameters"":[3.8209972202654474, 1.3779216716448506, 5.299882228439686, 0.06040645519069608],""points"":[{""x"":0.10000000149011612,""y"":3.7821109294891357},{""x"":0.6000000238418579,""y"":3.542433023452759},{""x"":1.100000023841858,""y"":3.7008674144744873},{""x"":1.600000023841858,""y"":3.717301607131958},{""x"":2.0999999046325684,""y"":4.024452209472656},{""x"":2.5999999046325684,""y"":4.013899326324463},{""x"":3.0999999046325684,""y"":3.945094347000122},{""x"":3.5999999046325684,""y"":3.866621971130371},{""x"":4.099999904632568,""y"":3.7461626529693604},{""x"":4.599999904632568,""y"":3.3454740047454834},{""x"":5.099999904632568,""y"":2.61944317817688},{""x"":5.599999904632568,""y"":0.999405026435852},{""x"":6.099999904632568,""y"":0.46259793639183044},{""x"":6.599999904632568,""y"":0.054134611040353775},{""x"":7.099999904632568,""y"":0.05711187422275543}]},{""name"":""Run:2023-08-08"",""fitLineColor"":""#ffbb78"",""pointColor"":""#ffbb78"",""showPoints"":""points"",""parameters"":[5.6318079657726035, 1.8495493770000595, 5.391793312471116, 0.17060707587348442],""points"":[{""x"":0.10000000149011612,""y"":5.458079814910889},{""x"":0.6000000238418579,""y"":5.554427146911621},{""x"":1.100000023841858,""y"":5.799983024597168},{""x"":1.600000023841858,""y"":5.364140033721924},{""x"":2.0999999046325684,""y"":5.864485740661621},{""x"":2.5999999046325684,""y"":5.4509806632995605},{""x"":3.0999999046325684,""y"":5.702574729919434},{""x"":3.5999999046325684,""y"":5.7314534187316895},{""x"":4.099999904632568,""y"":5.5123443603515625},{""x"":4.599999904632568,""y"":5.724395751953125},{""x"":5.099999904632568,""y"":4.354506969451904},{""x"":5.599999904632568,""y"":1.7307666540145874},{""x"":6.099999904632568,""y"":0.6305936574935913},{""x"":6.599999904632568,""y"":0.035183437168598175},{""x"":7.099999904632568,""y"":0.7575169205665588}]}],""chartOptions"":{""xAxisName"":""Conc."",""yAxisName"":""Activity"",""title"":""Dose-Response curves""}}",text,,\nSwitzerland,IRVVGRYLIEVWKAAGMDMDKVLFLWSSDEI,CN1CCC(CC1)Oc2ccc(cc2)C(F)(F)F,1480028,36.33137130737305,99504,92-11 179TH PLACE,https://datagrok.ai/img/slides/access-db-connect.png,id,ErrorMessage,"COMPND \nATOM \nEND",flag,9,10,1IAN,10,1.23,<chart></chart>,"{""series"":[{""name"":""Run:2023-08-08"",""fitFunction"":""sigmoid"",""fitLineColor"":""#1f77b4"",""pointColor"":""#1f77b4"",""showPoints"":""points"",""parameters"":[1.1190255865097471, 2.3163895161544437, 5.4968866182279195, 0.2035204047289052],""points"":[{""x"":0.10000000149011612,""y"":1.1057683229446411},{""x"":0.6000000238418579,""y"":1.1019697189331055},{""x"":1.100000023841858,""y"":1.0818607807159424},{""x"":1.600000023841858,""y"":1.062997817993164},{""x"":2.0999999046325684,""y"":1.046447515487671},{""x"":2.5999999046325684,""y"":1.1217249631881714},{""x"":3.0999999046325684,""y"":1.2166996002197266},{""x"":3.5999999046325684,""y"":1.215477705001831},{""x"":4.099999904632568,""y"":1.0581893920898438},{""x"":4.599999904632568,""y"":1.1747995615005493},{""x"":5.099999904632568,""y"":1.0181127786636353},{""x"":5.599999904632568,""y"":0.5344523191452026},{""x"":6.099999904632568,""y"":0.2569526433944702},{""x"":6.599999904632568,""y"":0.1912207305431366},{""x"":7.099999904632568,""y"":0.15060538053512573}]},{""name"":""Run:2023-08-08"",""fitLineColor"":""#ffbb78"",""pointColor"":""#ffbb78"",""showPoints"":""points"",""parameters"":[3.1038581025805785, 2.0032224204185245, 5.087602825989163, 0.13277988512492753],""points"":[{""x"":0.10000000149011612,""y"":3.0498509407043457},{""x"":0.6000000238418579,""y"":2.805217742919922},{""x"":1.100000023841858,""y"":3.3415253162384033},{""x"":1.600000023841858,""y"":3.0549843311309814},{""x"":2.0999999046325684,""y"":3.250074863433838},{""x"":2.5999999046325684,""y"":3.0432586669921875},{""x"":3.0999999046325684,""y"":3.265852451324463},{""x"":3.5999999046325684,""y"":2.9475724697113037},{""x"":4.099999904632568,""y"":3.1929898262023926},{""x"":4.599999904632568,""y"":2.7460060119628906},{""x"":5.099999904632568,""y"":1.6175861358642578},{""x"":5.599999904632568,""y"":0.3006608486175537},{""x"":6.099999904632568,""y"":0.3444803059101105},{""x"":6.599999904632568,""y"":0.015537971630692482},{""x"":7.099999904632568,""y"":0.5527358055114746}]}],""chartOptions"":{""xAxisName"":""Conc."",""yAxisName"":""Activity"",""title"":""Dose-Response curves""}}",text,,\n,,,,,,,,,,,,,,,,,,,,,').columns.add(r.Column.fromList(r.TYPE.BYTE_ARRAY,"BinaryImage",Array.from(new Uint8Array(11))));var i,o=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{u(r.next(t))}catch(t){o(t)}}function a(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))};function s(t){return o(this,void 0,void 0,(function*(){yield new Promise((e=>setTimeout(e,t)))}))}console.log.bind(console),console.info.bind(console),console.warn.bind(console),console.error.bind(console),function(t){t.notNull=function(t,e){if(null==t)throw new Error(`${null==e?"Value":e} not defined`)}}(i||(i={})),r.DataFrame.fromColumns([r.Column.fromStrings("col",["val1","val2","val3"])])},74:(t,e,n)=>{"use strict";n.d(e,{A:()=>a});var r=n(354),i=n.n(r),o=n(314),s=n.n(o)()(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/apps/common/view/components/colored-input/style.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},252:(t,e,n)=>{"use strict";n.d(e,{A:()=>a});var r=n(354),i=n.n(r),o=n(314),s=n.n(o)()(i());s.push([t.id,"/* Naming convention: class names should begin with st and app name to avoid naming collitions */\n\n.st-pattern-text-input > textarea {\n resize: none;\n}\n","",{version:3,sources:["webpack://./src/apps/pattern/view/style.css"],names:[],mappings:"AAAA,gGAAgG;;AAEhG;EACE,YAAY;AACd",sourcesContent:["/* Naming convention: class names should begin with st and app name to avoid naming collitions */\n\n.st-pattern-text-input > textarea {\n resize: none;\n}\n"],sourceRoot:""}]);const a=s},507:(t,e,n)=>{"use strict";n.d(e,{A:()=>a});var r=n(354),i=n.n(r),o=n(314),s=n.n(o)()(i());s.push([t.id,"/* Naming convention: class names should begin with st and app name to avoid naming collitions */\n\n.st-structure-body {\n padding-right: 20px;\n}\n\n.st-structure-input-form {\n text-align: right;\n vertical-align: top;\n min-width: 95px;\n}\n\n.st-structure-direction-choice label {\n min-width: 100px;\n float: right;\n}\n\n.st-structure-direction-choice div {\n justify-content: right;\n}\n\n.st-structure-text-input-td { /* Style for td containing textarea */\n width: 100%;\n}\n\n.st-structure-mol-img {\n margin-right: 30px;\n float: right;\n}\n\n.st-structure-bool-button-block {\n justify-content: right;\n margin-bottom: 10px;\n}\n\n.st-structure-bottom {\n flex-direction: row-reverse;\n padding-top: 20px;\n}\n","",{version:3,sources:["webpack://./src/apps/structure/view/style.css"],names:[],mappings:"AAAA,gGAAgG;;AAEhG;EACE,mBAAmB;AACrB;;AAEA;EACE,iBAAiB;EACjB,mBAAmB;EACnB,eAAe;AACjB;;AAEA;EACE,gBAAgB;EAChB,YAAY;AACd;;AAEA;EACE,sBAAsB;AACxB;;AAEA,8BAA8B,qCAAqC;EACjE,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 app name to avoid naming collitions */\n\n.st-structure-body {\n padding-right: 20px;\n}\n\n.st-structure-input-form {\n text-align: right;\n vertical-align: top;\n min-width: 95px;\n}\n\n.st-structure-direction-choice label {\n min-width: 100px;\n float: right;\n}\n\n.st-structure-direction-choice div {\n justify-content: right;\n}\n\n.st-structure-text-input-td { /* Style for td containing textarea */\n width: 100%;\n}\n\n.st-structure-mol-img {\n margin-right: 30px;\n float: right;\n}\n\n.st-structure-bool-button-block {\n justify-content: right;\n margin-bottom: 10px;\n}\n\n.st-structure-bottom {\n flex-direction: row-reverse;\n padding-top: 20px;\n}\n"],sourceRoot:""}]);const a=s},254:(t,e,n)=>{"use strict";n.d(e,{A:()=>a});var r=n(354),i=n.n(r),o=n(314),s=n.n(o)()(i());s.push([t.id,"/* Naming convention: class names should begin with st and app name to avoid naming collitions */\n.st-translator-input-table {\n /* width: 100%; */\n margin-right: 20px;\n}\n\n.st-translator-input-table td:has(textarea) {\n width: 100%;\n}\n\n.st-translator-input-table td:has(select) {\n min-width: 120px;\n vertical-align: top;\n}\n\n.st-translator-output-table {\n margin-top: 20px;\n margin-right: 20px;\n margin-bottom: 10px;\n}\n\n.st-translator-output-table table {\n width: 100%;\n table-layout: fixed;\n}\n\n/* .st-translator-output-table table tbody tr td { */\n/* max-width: 20%; */\n/* } */\n\n.st-translator-output-table td {\n padding-top: 6px;\n padding-bottom: 6px;\n}\n.st-translator-output-table tr:nth-child(even) {\n background-color: var(--grey-1);\n}\n\n.st-translator-output-table td:nth-child(odd) {\n width: 120px;\n vertical-align: top;\n}\n\n.st-translator-output-table td a {\n overflow-wrap: break-word;\n}\n","",{version:3,sources:["webpack://./src/apps/translator/view/style.css"],names:[],mappings:"AAAA,gGAAgG;AAChG;EACE,iBAAiB;EACjB,kBAAkB;AACpB;;AAEA;EACE,WAAW;AACb;;AAEA;EACE,gBAAgB;EAChB,mBAAmB;AACrB;;AAEA;EACE,gBAAgB;EAChB,kBAAkB;EAClB,mBAAmB;AACrB;;AAEA;EACE,WAAW;EACX,mBAAmB;AACrB;;AAEA,oDAAoD;AACpD,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 app name to avoid naming collitions */\n.st-translator-input-table {\n /* width: 100%; */\n margin-right: 20px;\n}\n\n.st-translator-input-table td:has(textarea) {\n width: 100%;\n}\n\n.st-translator-input-table td:has(select) {\n min-width: 120px;\n vertical-align: top;\n}\n\n.st-translator-output-table {\n margin-top: 20px;\n margin-right: 20px;\n margin-bottom: 10px;\n}\n\n.st-translator-output-table table {\n width: 100%;\n table-layout: fixed;\n}\n\n/* .st-translator-output-table table tbody tr td { */\n/* max-width: 20%; */\n/* } */\n\n.st-translator-output-table td {\n padding-top: 6px;\n padding-bottom: 6px;\n}\n.st-translator-output-table tr:nth-child(even) {\n background-color: var(--grey-1);\n}\n\n.st-translator-output-table td:nth-child(odd) {\n width: 120px;\n vertical-align: top;\n}\n\n.st-translator-output-table td a {\n overflow-wrap: break-word;\n}\n"],sourceRoot:""}]);const a=s},314:t=>{"use strict";t.exports=function(t){var e=[];return e.toString=function(){return this.map((function(e){var n="",r=void 0!==e[5];return e[4]&&(n+="@supports (".concat(e[4],") {")),e[2]&&(n+="@media ".concat(e[2]," {")),r&&(n+="@layer".concat(e[5].length>0?" ".concat(e[5]):""," {")),n+=t(e),r&&(n+="}"),e[2]&&(n+="}"),e[4]&&(n+="}"),n})).join("")},e.i=function(t,n,r,i,o){"string"==typeof t&&(t=[[null,t,void 0]]);var s={};if(r)for(var a=0;a<this.length;a++){var u=this[a][0];null!=u&&(s[u]=!0)}for(var l=0;l<t.length;l++){var c=[].concat(t[l]);r&&s[c[0]]||(void 0!==o&&(void 0===c[5]||(c[1]="@layer".concat(c[5].length>0?" ".concat(c[5]):""," {").concat(c[1],"}")),c[5]=o),n&&(c[2]?(c[1]="@media ".concat(c[2]," {").concat(c[1],"}"),c[2]=n):c[2]=n),i&&(c[4]?(c[1]="@supports (".concat(c[4],") {").concat(c[1],"}"),c[4]=i):c[4]="".concat(i)),e.push(c))}},e}},354:t=>{"use strict";t.exports=function(t){var e=t[1],n=t[3];if(!n)return e;if("function"==typeof btoa){var r=btoa(unescape(encodeURIComponent(JSON.stringify(n)))),i="sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(r),o="/*# ".concat(i," */");return[e].concat([o]).join("\n")}return[e].join("\n")}},982:function(t,e,n){var r;!function(e,i){var o={};!function(t){"use strict";t.__esModule=!0,t.digestLength=32,t.blockSize=64;var e=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);function n(t,n,r,i,o){for(var s,a,u,l,c,h,f,d,p,g,m,v,y;o>=64;){for(s=n[0],a=n[1],u=n[2],l=n[3],c=n[4],h=n[5],f=n[6],d=n[7],g=0;g<16;g++)m=i+4*g,t[g]=(255&r[m])<<24|(255&r[m+1])<<16|(255&r[m+2])<<8|255&r[m+3];for(g=16;g<64;g++)v=((p=t[g-2])>>>17|p<<15)^(p>>>19|p<<13)^p>>>10,y=((p=t[g-15])>>>7|p<<25)^(p>>>18|p<<14)^p>>>3,t[g]=(v+t[g-7]|0)+(y+t[g-16]|0);for(g=0;g<64;g++)v=(((c>>>6|c<<26)^(c>>>11|c<<21)^(c>>>25|c<<7))+(c&h^~c&f)|0)+(d+(e[g]+t[g]|0)|0)|0,y=((s>>>2|s<<30)^(s>>>13|s<<19)^(s>>>22|s<<10))+(s&a^s&u^a&u)|0,d=f,f=h,h=c,c=l+v|0,l=u,u=a,a=s,s=v+y|0;n[0]+=s,n[1]+=a,n[2]+=u,n[3]+=l,n[4]+=c,n[5]+=h,n[6]+=f,n[7]+=d,i+=64,o-=64}return i}var r=function(){function e(){this.digestLength=t.digestLength,this.blockSize=t.blockSize,this.state=new Int32Array(8),this.temp=new Int32Array(64),this.buffer=new Uint8Array(128),this.bufferLength=0,this.bytesHashed=0,this.finished=!1,this.reset()}return e.prototype.reset=function(){return this.state[0]=1779033703,this.state[1]=3144134277,this.state[2]=1013904242,this.state[3]=2773480762,this.state[4]=1359893119,this.state[5]=2600822924,this.state[6]=528734635,this.state[7]=1541459225,this.bufferLength=0,this.bytesHashed=0,this.finished=!1,this},e.prototype.clean=function(){for(var t=0;t<this.buffer.length;t++)this.buffer[t]=0;for(t=0;t<this.temp.length;t++)this.temp[t]=0;this.reset()},e.prototype.update=function(t,e){if(void 0===e&&(e=t.length),this.finished)throw new Error("SHA256: can't update because hash was finished.");var r=0;if(this.bytesHashed+=e,this.bufferLength>0){for(;this.bufferLength<64&&e>0;)this.buffer[this.bufferLength++]=t[r++],e--;64===this.bufferLength&&(n(this.temp,this.state,this.buffer,0,64),this.bufferLength=0)}for(e>=64&&(r=n(this.temp,this.state,t,r,e),e%=64);e>0;)this.buffer[this.bufferLength++]=t[r++],e--;return this},e.prototype.finish=function(t){if(!this.finished){var e=this.bytesHashed,r=this.bufferLength,i=e/536870912|0,o=e<<3,s=e%64<56?64:128;this.buffer[r]=128;for(var a=r+1;a<s-8;a++)this.buffer[a]=0;this.buffer[s-8]=i>>>24&255,this.buffer[s-7]=i>>>16&255,this.buffer[s-6]=i>>>8&255,this.buffer[s-5]=i>>>0&255,this.buffer[s-4]=o>>>24&255,this.buffer[s-3]=o>>>16&255,this.buffer[s-2]=o>>>8&255,this.buffer[s-1]=o>>>0&255,n(this.temp,this.state,this.buffer,0,s),this.finished=!0}for(a=0;a<8;a++)t[4*a+0]=this.state[a]>>>24&255,t[4*a+1]=this.state[a]>>>16&255,t[4*a+2]=this.state[a]>>>8&255,t[4*a+3]=this.state[a]>>>0&255;return this},e.prototype.digest=function(){var t=new Uint8Array(this.digestLength);return this.finish(t),t},e.prototype._saveState=function(t){for(var e=0;e<this.state.length;e++)t[e]=this.state[e]},e.prototype._restoreState=function(t,e){for(var n=0;n<this.state.length;n++)this.state[n]=t[n];this.bytesHashed=e,this.finished=!1,this.bufferLength=0},e}();t.Hash=r;var i=function(){function t(t){this.inner=new r,this.outer=new r,this.blockSize=this.inner.blockSize,this.digestLength=this.inner.digestLength;var e=new Uint8Array(this.blockSize);if(t.length>this.blockSize)(new r).update(t).finish(e).clean();else for(var n=0;n<t.length;n++)e[n]=t[n];for(n=0;n<e.length;n++)e[n]^=54;for(this.inner.update(e),n=0;n<e.length;n++)e[n]^=106;for(this.outer.update(e),this.istate=new Uint32Array(8),this.ostate=new Uint32Array(8),this.inner._saveState(this.istate),this.outer._saveState(this.ostate),n=0;n<e.length;n++)e[n]=0}return t.prototype.reset=function(){return this.inner._restoreState(this.istate,this.inner.blockSize),this.outer._restoreState(this.ostate,this.outer.blockSize),this},t.prototype.clean=function(){for(var t=0;t<this.istate.length;t++)this.ostate[t]=this.istate[t]=0;this.inner.clean(),this.outer.clean()},t.prototype.update=function(t){return this.inner.update(t),this},t.prototype.finish=function(t){return this.outer.finished?this.outer.finish(t):(this.inner.finish(t),this.outer.update(t,this.digestLength).finish(t)),this},t.prototype.digest=function(){var t=new Uint8Array(this.digestLength);return this.finish(t),t},t}();function o(t){var e=(new r).update(t),n=e.digest();return e.clean(),n}function s(t,e){var n=new i(t).update(e),r=n.digest();return n.clean(),r}function a(t,e,n,r){var i=r[0];if(0===i)throw new Error("hkdf: cannot expand more");e.reset(),i>1&&e.update(t),n&&e.update(n),e.update(r),e.finish(t),r[0]++}t.HMAC=i,t.hash=o,t.default=o,t.hmac=s;var u=new Uint8Array(t.digestLength);t.hkdf=function(t,e,n,r){void 0===e&&(e=u),void 0===r&&(r=32);for(var o=new Uint8Array([1]),l=s(e,t),c=new i(l),h=new Uint8Array(c.digestLength),f=h.length,d=new Uint8Array(r),p=0;p<r;p++)f===h.length&&(a(h,c,n,o),f=0),d[p]=h[f++];return c.clean(),h.fill(0),o.fill(0),d},t.pbkdf2=function(t,e,n,r){for(var o=new i(t),s=o.digestLength,a=new Uint8Array(4),u=new Uint8Array(s),l=new Uint8Array(s),c=new Uint8Array(r),h=0;h*s<r;h++){var f=h+1;a[0]=f>>>24&255,a[1]=f>>>16&255,a[2]=f>>>8&255,a[3]=f>>>0&255,o.reset(),o.update(e),o.update(a),o.finish(l);for(var d=0;d<s;d++)u[d]=l[d];for(d=2;d<=n;d++){o.reset(),o.update(l).finish(l);for(var p=0;p<s;p++)u[p]^=l[p]}for(d=0;d<s&&h*s+d<r;d++)c[h*s+d]=u[d]}for(h=0;h<s;h++)u[h]=l[h]=0;for(h=0;h<4;h++)a[h]=0;return o.clean(),c}}(o);var s=o.default;for(var a in o)s[a]=o[a];"object"==typeof t.exports?t.exports=s:void 0===(r=function(){return s}.call(o,n,o,t))||(t.exports=r)}()},543:function(t,e,n){var r;t=n.nmd(t),function(){var i,o="Expected a function",s="__lodash_hash_undefined__",a="__lodash_placeholder__",u=32,l=128,c=1/0,h=9007199254740991,f=NaN,d=4294967295,p=[["ary",l],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",u],["partialRight",64],["rearg",256]],g="[object Arguments]",m="[object Array]",v="[object Boolean]",y="[object Date]",b="[object Error]",A="[object Function]",C="[object GeneratorFunction]",w="[object Map]",x="[object Number]",_="[object Object]",S="[object Promise]",E="[object RegExp]",T="[object Set]",I="[object String]",N="[object Symbol]",O="[object WeakMap]",L="[object ArrayBuffer]",M="[object DataView]",B="[object Float32Array]",P="[object Float64Array]",R="[object Int8Array]",F="[object Int16Array]",D="[object Int32Array]",U="[object Uint8Array]",k="[object Uint8ClampedArray]",$="[object Uint16Array]",H="[object Uint32Array]",V=/\b__p \+= '';/g,j=/\b(__p \+=) '' \+/g,q=/(__e\(.*?\)|\b__t\)) \+\n'';/g,G=/&(?:amp|lt|gt|quot|#39);/g,W=/[&<>"']/g,z=RegExp(G.source),Y=RegExp(W.source),K=/<%-([\s\S]+?)%>/g,Q=/<%([\s\S]+?)%>/g,X=/<%=([\s\S]+?)%>/g,J=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Z=/^\w*$/,tt=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,et=/[\\^$.*+?()[\]{}|]/g,nt=RegExp(et.source),rt=/^\s+/,it=/\s/,ot=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,st=/\{\n\/\* \[wrapped with (.+)\] \*/,at=/,? & /,ut=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,lt=/[()=,{}\[\]\/\s]/,ct=/\\(\\)?/g,ht=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,ft=/\w*$/,dt=/^[-+]0x[0-9a-f]+$/i,pt=/^0b[01]+$/i,gt=/^\[object .+?Constructor\]$/,mt=/^0o[0-7]+$/i,vt=/^(?:0|[1-9]\d*)$/,yt=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,bt=/($^)/,At=/['\n\r\u2028\u2029\\]/g,Ct="\\ud800-\\udfff",wt="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",xt="\\u2700-\\u27bf",_t="a-z\\xdf-\\xf6\\xf8-\\xff",St="A-Z\\xc0-\\xd6\\xd8-\\xde",Et="\\ufe0e\\ufe0f",Tt="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",It="["+Ct+"]",Nt="["+Tt+"]",Ot="["+wt+"]",Lt="\\d+",Mt="["+xt+"]",Bt="["+_t+"]",Pt="[^"+Ct+Tt+Lt+xt+_t+St+"]",Rt="\\ud83c[\\udffb-\\udfff]",Ft="[^"+Ct+"]",Dt="(?:\\ud83c[\\udde6-\\uddff]){2}",Ut="[\\ud800-\\udbff][\\udc00-\\udfff]",kt="["+St+"]",$t="\\u200d",Ht="(?:"+Bt+"|"+Pt+")",Vt="(?:"+kt+"|"+Pt+")",jt="(?:['’](?:d|ll|m|re|s|t|ve))?",qt="(?:['’](?:D|LL|M|RE|S|T|VE))?",Gt="(?:"+Ot+"|"+Rt+")?",Wt="["+Et+"]?",zt=Wt+Gt+"(?:"+$t+"(?:"+[Ft,Dt,Ut].join("|")+")"+Wt+Gt+")*",Yt="(?:"+[Mt,Dt,Ut].join("|")+")"+zt,Kt="(?:"+[Ft+Ot+"?",Ot,Dt,Ut,It].join("|")+")",Qt=RegExp("['’]","g"),Xt=RegExp(Ot,"g"),Jt=RegExp(Rt+"(?="+Rt+")|"+Kt+zt,"g"),Zt=RegExp([kt+"?"+Bt+"+"+jt+"(?="+[Nt,kt,"$"].join("|")+")",Vt+"+"+qt+"(?="+[Nt,kt+Ht,"$"].join("|")+")",kt+"?"+Ht+"+"+jt,kt+"+"+qt,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Lt,Yt].join("|"),"g"),te=RegExp("["+$t+Ct+wt+Et+"]"),ee=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,ne=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],re=-1,ie={};ie[B]=ie[P]=ie[R]=ie[F]=ie[D]=ie[U]=ie[k]=ie[$]=ie[H]=!0,ie[g]=ie[m]=ie[L]=ie[v]=ie[M]=ie[y]=ie[b]=ie[A]=ie[w]=ie[x]=ie[_]=ie[E]=ie[T]=ie[I]=ie[O]=!1;var oe={};oe[g]=oe[m]=oe[L]=oe[M]=oe[v]=oe[y]=oe[B]=oe[P]=oe[R]=oe[F]=oe[D]=oe[w]=oe[x]=oe[_]=oe[E]=oe[T]=oe[I]=oe[N]=oe[U]=oe[k]=oe[$]=oe[H]=!0,oe[b]=oe[A]=oe[O]=!1;var se={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},ae=parseFloat,ue=parseInt,le="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,ce="object"==typeof self&&self&&self.Object===Object&&self,he=le||ce||Function("return this")(),fe=e&&!e.nodeType&&e,de=fe&&t&&!t.nodeType&&t,pe=de&&de.exports===fe,ge=pe&&le.process,me=function(){try{return de&&de.require&&de.require("util").types||ge&&ge.binding&&ge.binding("util")}catch(t){}}(),ve=me&&me.isArrayBuffer,ye=me&&me.isDate,be=me&&me.isMap,Ae=me&&me.isRegExp,Ce=me&&me.isSet,we=me&&me.isTypedArray;function xe(t,e,n){switch(n.length){case 0:return t.call(e);case 1:return t.call(e,n[0]);case 2:return t.call(e,n[0],n[1]);case 3:return t.call(e,n[0],n[1],n[2])}return t.apply(e,n)}function _e(t,e,n,r){for(var i=-1,o=null==t?0:t.length;++i<o;){var s=t[i];e(r,s,n(s),t)}return r}function Se(t,e){for(var n=-1,r=null==t?0:t.length;++n<r&&!1!==e(t[n],n,t););return t}function Ee(t,e){for(var n=null==t?0:t.length;n--&&!1!==e(t[n],n,t););return t}function Te(t,e){for(var n=-1,r=null==t?0:t.length;++n<r;)if(!e(t[n],n,t))return!1;return!0}function Ie(t,e){for(var n=-1,r=null==t?0:t.length,i=0,o=[];++n<r;){var s=t[n];e(s,n,t)&&(o[i++]=s)}return o}function Ne(t,e){return!(null==t||!t.length)&&ke(t,e,0)>-1}function Oe(t,e,n){for(var r=-1,i=null==t?0:t.length;++r<i;)if(n(e,t[r]))return!0;return!1}function Le(t,e){for(var n=-1,r=null==t?0:t.length,i=Array(r);++n<r;)i[n]=e(t[n],n,t);return i}function Me(t,e){for(var n=-1,r=e.length,i=t.length;++n<r;)t[i+n]=e[n];return t}function Be(t,e,n,r){var i=-1,o=null==t?0:t.length;for(r&&o&&(n=t[++i]);++i<o;)n=e(n,t[i],i,t);return n}function Pe(t,e,n,r){var i=null==t?0:t.length;for(r&&i&&(n=t[--i]);i--;)n=e(n,t[i],i,t);return n}function Re(t,e){for(var n=-1,r=null==t?0:t.length;++n<r;)if(e(t[n],n,t))return!0;return!1}var Fe=je("length");function De(t,e,n){var r;return n(t,(function(t,n,i){if(e(t,n,i))return r=n,!1})),r}function Ue(t,e,n,r){for(var i=t.length,o=n+(r?1:-1);r?o--:++o<i;)if(e(t[o],o,t))return o;return-1}function ke(t,e,n){return e==e?function(t,e,n){for(var r=n-1,i=t.length;++r<i;)if(t[r]===e)return r;return-1}(t,e,n):Ue(t,He,n)}function $e(t,e,n,r){for(var i=n-1,o=t.length;++i<o;)if(r(t[i],e))return i;return-1}function He(t){return t!=t}function Ve(t,e){var n=null==t?0:t.length;return n?We(t,e)/n:f}function je(t){return function(e){return null==e?i:e[t]}}function qe(t){return function(e){return null==t?i:t[e]}}function Ge(t,e,n,r,i){return i(t,(function(t,i,o){n=r?(r=!1,t):e(n,t,i,o)})),n}function We(t,e){for(var n,r=-1,o=t.length;++r<o;){var s=e(t[r]);s!==i&&(n=n===i?s:n+s)}return n}function ze(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r}function Ye(t){return t?t.slice(0,fn(t)+1).replace(rt,""):t}function Ke(t){return function(e){return t(e)}}function Qe(t,e){return Le(e,(function(e){return t[e]}))}function Xe(t,e){return t.has(e)}function Je(t,e){for(var n=-1,r=t.length;++n<r&&ke(e,t[n],0)>-1;);return n}function Ze(t,e){for(var n=t.length;n--&&ke(e,t[n],0)>-1;);return n}var tn=qe({À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"}),en=qe({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"});function nn(t){return"\\"+se[t]}function rn(t){return te.test(t)}function on(t){var e=-1,n=Array(t.size);return t.forEach((function(t,r){n[++e]=[r,t]})),n}function sn(t,e){return function(n){return t(e(n))}}function an(t,e){for(var n=-1,r=t.length,i=0,o=[];++n<r;){var s=t[n];s!==e&&s!==a||(t[n]=a,o[i++]=n)}return o}function un(t){var e=-1,n=Array(t.size);return t.forEach((function(t){n[++e]=t})),n}function ln(t){var e=-1,n=Array(t.size);return t.forEach((function(t){n[++e]=[t,t]})),n}function cn(t){return rn(t)?function(t){for(var e=Jt.lastIndex=0;Jt.test(t);)++e;return e}(t):Fe(t)}function hn(t){return rn(t)?function(t){return t.match(Jt)||[]}(t):function(t){return t.split("")}(t)}function fn(t){for(var e=t.length;e--&&it.test(t.charAt(e)););return e}var dn=qe({"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"}),pn=function t(e){var n,r=(e=null==e?he:pn.defaults(he.Object(),e,pn.pick(he,ne))).Array,it=e.Date,Ct=e.Error,wt=e.Function,xt=e.Math,_t=e.Object,St=e.RegExp,Et=e.String,Tt=e.TypeError,It=r.prototype,Nt=wt.prototype,Ot=_t.prototype,Lt=e["__core-js_shared__"],Mt=Nt.toString,Bt=Ot.hasOwnProperty,Pt=0,Rt=(n=/[^.]+$/.exec(Lt&&Lt.keys&&Lt.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"",Ft=Ot.toString,Dt=Mt.call(_t),Ut=he._,kt=St("^"+Mt.call(Bt).replace(et,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),$t=pe?e.Buffer:i,Ht=e.Symbol,Vt=e.Uint8Array,jt=$t?$t.allocUnsafe:i,qt=sn(_t.getPrototypeOf,_t),Gt=_t.create,Wt=Ot.propertyIsEnumerable,zt=It.splice,Yt=Ht?Ht.isConcatSpreadable:i,Kt=Ht?Ht.iterator:i,Jt=Ht?Ht.toStringTag:i,te=function(){try{var t=uo(_t,"defineProperty");return t({},"",{}),t}catch(t){}}(),se=e.clearTimeout!==he.clearTimeout&&e.clearTimeout,le=it&&it.now!==he.Date.now&&it.now,ce=e.setTimeout!==he.setTimeout&&e.setTimeout,fe=xt.ceil,de=xt.floor,ge=_t.getOwnPropertySymbols,me=$t?$t.isBuffer:i,Fe=e.isFinite,qe=It.join,gn=sn(_t.keys,_t),mn=xt.max,vn=xt.min,yn=it.now,bn=e.parseInt,An=xt.random,Cn=It.reverse,wn=uo(e,"DataView"),xn=uo(e,"Map"),_n=uo(e,"Promise"),Sn=uo(e,"Set"),En=uo(e,"WeakMap"),Tn=uo(_t,"create"),In=En&&new En,Nn={},On=Do(wn),Ln=Do(xn),Mn=Do(_n),Bn=Do(Sn),Pn=Do(En),Rn=Ht?Ht.prototype:i,Fn=Rn?Rn.valueOf:i,Dn=Rn?Rn.toString:i;function Un(t){if(ta(t)&&!js(t)&&!(t instanceof Vn)){if(t instanceof Hn)return t;if(Bt.call(t,"__wrapped__"))return Uo(t)}return new Hn(t)}var kn=function(){function t(){}return function(e){if(!Zs(e))return{};if(Gt)return Gt(e);t.prototype=e;var n=new t;return t.prototype=i,n}}();function $n(){}function Hn(t,e){this.__wrapped__=t,this.__actions__=[],this.__chain__=!!e,this.__index__=0,this.__values__=i}function Vn(t){this.__wrapped__=t,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=d,this.__views__=[]}function jn(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function qn(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function Gn(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function Wn(t){var e=-1,n=null==t?0:t.length;for(this.__data__=new Gn;++e<n;)this.add(t[e])}function zn(t){var e=this.__data__=new qn(t);this.size=e.size}function Yn(t,e){var n=js(t),r=!n&&Vs(t),i=!n&&!r&&zs(t),o=!n&&!r&&!i&&ua(t),s=n||r||i||o,a=s?ze(t.length,Et):[],u=a.length;for(var l in t)!e&&!Bt.call(t,l)||s&&("length"==l||i&&("offset"==l||"parent"==l)||o&&("buffer"==l||"byteLength"==l||"byteOffset"==l)||mo(l,u))||a.push(l);return a}function Kn(t){var e=t.length;return e?t[Gr(0,e-1)]:i}function Qn(t,e){return Mo(Ei(t),or(e,0,t.length))}function Xn(t){return Mo(Ei(t))}function Jn(t,e,n){(n!==i&&!ks(t[e],n)||n===i&&!(e in t))&&rr(t,e,n)}function Zn(t,e,n){var r=t[e];Bt.call(t,e)&&ks(r,n)&&(n!==i||e in t)||rr(t,e,n)}function tr(t,e){for(var n=t.length;n--;)if(ks(t[n][0],e))return n;return-1}function er(t,e,n,r){return cr(t,(function(t,i,o){e(r,t,n(t),o)})),r}function nr(t,e){return t&&Ti(e,Oa(e),t)}function rr(t,e,n){"__proto__"==e&&te?te(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n}function ir(t,e){for(var n=-1,o=e.length,s=r(o),a=null==t;++n<o;)s[n]=a?i:Sa(t,e[n]);return s}function or(t,e,n){return t==t&&(n!==i&&(t=t<=n?t:n),e!==i&&(t=t>=e?t:e)),t}function sr(t,e,n,r,o,s){var a,u=1&e,l=2&e,c=4&e;if(n&&(a=o?n(t,r,o,s):n(t)),a!==i)return a;if(!Zs(t))return t;var h=js(t);if(h){if(a=function(t){var e=t.length,n=new t.constructor(e);return e&&"string"==typeof t[0]&&Bt.call(t,"index")&&(n.index=t.index,n.input=t.input),n}(t),!u)return Ei(t,a)}else{var f=ho(t),d=f==A||f==C;if(zs(t))return Ai(t,u);if(f==_||f==g||d&&!o){if(a=l||d?{}:po(t),!u)return l?function(t,e){return Ti(t,co(t),e)}(t,function(t,e){return t&&Ti(e,La(e),t)}(a,t)):function(t,e){return Ti(t,lo(t),e)}(t,nr(a,t))}else{if(!oe[f])return o?t:{};a=function(t,e,n){var r,i=t.constructor;switch(e){case L:return Ci(t);case v:case y:return new i(+t);case M:return function(t,e){var n=e?Ci(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.byteLength)}(t,n);case B:case P:case R:case F:case D:case U:case k:case $:case H:return wi(t,n);case w:return new i;case x:case I:return new i(t);case E:return function(t){var e=new t.constructor(t.source,ft.exec(t));return e.lastIndex=t.lastIndex,e}(t);case T:return new i;case N:return r=t,Fn?_t(Fn.call(r)):{}}}(t,f,u)}}s||(s=new zn);var p=s.get(t);if(p)return p;s.set(t,a),oa(t)?t.forEach((function(r){a.add(sr(r,e,n,r,t,s))})):ea(t)&&t.forEach((function(r,i){a.set(i,sr(r,e,n,i,t,s))}));var m=h?i:(c?l?eo:to:l?La:Oa)(t);return Se(m||t,(function(r,i){m&&(r=t[i=r]),Zn(a,i,sr(r,e,n,i,t,s))})),a}function ar(t,e,n){var r=n.length;if(null==t)return!r;for(t=_t(t);r--;){var o=n[r],s=e[o],a=t[o];if(a===i&&!(o in t)||!s(a))return!1}return!0}function ur(t,e,n){if("function"!=typeof t)throw new Tt(o);return Io((function(){t.apply(i,n)}),e)}function lr(t,e,n,r){var i=-1,o=Ne,s=!0,a=t.length,u=[],l=e.length;if(!a)return u;n&&(e=Le(e,Ke(n))),r?(o=Oe,s=!1):e.length>=200&&(o=Xe,s=!1,e=new Wn(e));t:for(;++i<a;){var c=t[i],h=null==n?c:n(c);if(c=r||0!==c?c:0,s&&h==h){for(var f=l;f--;)if(e[f]===h)continue t;u.push(c)}else o(e,h,r)||u.push(c)}return u}Un.templateSettings={escape:K,evaluate:Q,interpolate:X,variable:"",imports:{_:Un}},Un.prototype=$n.prototype,Un.prototype.constructor=Un,Hn.prototype=kn($n.prototype),Hn.prototype.constructor=Hn,Vn.prototype=kn($n.prototype),Vn.prototype.constructor=Vn,jn.prototype.clear=function(){this.__data__=Tn?Tn(null):{},this.size=0},jn.prototype.delete=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},jn.prototype.get=function(t){var e=this.__data__;if(Tn){var n=e[t];return n===s?i:n}return Bt.call(e,t)?e[t]:i},jn.prototype.has=function(t){var e=this.__data__;return Tn?e[t]!==i:Bt.call(e,t)},jn.prototype.set=function(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=Tn&&e===i?s:e,this},qn.prototype.clear=function(){this.__data__=[],this.size=0},qn.prototype.delete=function(t){var e=this.__data__,n=tr(e,t);return!(n<0||(n==e.length-1?e.pop():zt.call(e,n,1),--this.size,0))},qn.prototype.get=function(t){var e=this.__data__,n=tr(e,t);return n<0?i:e[n][1]},qn.prototype.has=function(t){return tr(this.__data__,t)>-1},qn.prototype.set=function(t,e){var n=this.__data__,r=tr(n,t);return r<0?(++this.size,n.push([t,e])):n[r][1]=e,this},Gn.prototype.clear=function(){this.size=0,this.__data__={hash:new jn,map:new(xn||qn),string:new jn}},Gn.prototype.delete=function(t){var e=so(this,t).delete(t);return this.size-=e?1:0,e},Gn.prototype.get=function(t){return so(this,t).get(t)},Gn.prototype.has=function(t){return so(this,t).has(t)},Gn.prototype.set=function(t,e){var n=so(this,t),r=n.size;return n.set(t,e),this.size+=n.size==r?0:1,this},Wn.prototype.add=Wn.prototype.push=function(t){return this.__data__.set(t,s),this},Wn.prototype.has=function(t){return this.__data__.has(t)},zn.prototype.clear=function(){this.__data__=new qn,this.size=0},zn.prototype.delete=function(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n},zn.prototype.get=function(t){return this.__data__.get(t)},zn.prototype.has=function(t){return this.__data__.has(t)},zn.prototype.set=function(t,e){var n=this.__data__;if(n instanceof qn){var r=n.__data__;if(!xn||r.length<199)return r.push([t,e]),this.size=++n.size,this;n=this.__data__=new Gn(r)}return n.set(t,e),this.size=n.size,this};var cr=Oi(yr),hr=Oi(br,!0);function fr(t,e){var n=!0;return cr(t,(function(t,r,i){return n=!!e(t,r,i)})),n}function dr(t,e,n){for(var r=-1,o=t.length;++r<o;){var s=t[r],a=e(s);if(null!=a&&(u===i?a==a&&!aa(a):n(a,u)))var u=a,l=s}return l}function pr(t,e){var n=[];return cr(t,(function(t,r,i){e(t,r,i)&&n.push(t)})),n}function gr(t,e,n,r,i){var o=-1,s=t.length;for(n||(n=go),i||(i=[]);++o<s;){var a=t[o];e>0&&n(a)?e>1?gr(a,e-1,n,r,i):Me(i,a):r||(i[i.length]=a)}return i}var mr=Li(),vr=Li(!0);function yr(t,e){return t&&mr(t,e,Oa)}function br(t,e){return t&&vr(t,e,Oa)}function Ar(t,e){return Ie(e,(function(e){return Qs(t[e])}))}function Cr(t,e){for(var n=0,r=(e=mi(e,t)).length;null!=t&&n<r;)t=t[Fo(e[n++])];return n&&n==r?t:i}function wr(t,e,n){var r=e(t);return js(t)?r:Me(r,n(t))}function xr(t){return null==t?t===i?"[object Undefined]":"[object Null]":Jt&&Jt in _t(t)?function(t){var e=Bt.call(t,Jt),n=t[Jt];try{t[Jt]=i;var r=!0}catch(t){}var o=Ft.call(t);return r&&(e?t[Jt]=n:delete t[Jt]),o}(t):function(t){return Ft.call(t)}(t)}function _r(t,e){return t>e}function Sr(t,e){return null!=t&&Bt.call(t,e)}function Er(t,e){return null!=t&&e in _t(t)}function Tr(t,e,n){for(var o=n?Oe:Ne,s=t[0].length,a=t.length,u=a,l=r(a),c=1/0,h=[];u--;){var f=t[u];u&&e&&(f=Le(f,Ke(e))),c=vn(f.length,c),l[u]=!n&&(e||s>=120&&f.length>=120)?new Wn(u&&f):i}f=t[0];var d=-1,p=l[0];t:for(;++d<s&&h.length<c;){var g=f[d],m=e?e(g):g;if(g=n||0!==g?g:0,!(p?Xe(p,m):o(h,m,n))){for(u=a;--u;){var v=l[u];if(!(v?Xe(v,m):o(t[u],m,n)))continue t}p&&p.push(m),h.push(g)}}return h}function Ir(t,e,n){var r=null==(t=So(t,e=mi(e,t)))?t:t[Fo(Ko(e))];return null==r?i:xe(r,t,n)}function Nr(t){return ta(t)&&xr(t)==g}function Or(t,e,n,r,o){return t===e||(null==t||null==e||!ta(t)&&!ta(e)?t!=t&&e!=e:function(t,e,n,r,o,s){var a=js(t),u=js(e),l=a?m:ho(t),c=u?m:ho(e),h=(l=l==g?_:l)==_,f=(c=c==g?_:c)==_,d=l==c;if(d&&zs(t)){if(!zs(e))return!1;a=!0,h=!1}if(d&&!h)return s||(s=new zn),a||ua(t)?Ji(t,e,n,r,o,s):function(t,e,n,r,i,o,s){switch(n){case M:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case L:return!(t.byteLength!=e.byteLength||!o(new Vt(t),new Vt(e)));case v:case y:case x:return ks(+t,+e);case b:return t.name==e.name&&t.message==e.message;case E:case I:return t==e+"";case w:var a=on;case T:var u=1&r;if(a||(a=un),t.size!=e.size&&!u)return!1;var l=s.get(t);if(l)return l==e;r|=2,s.set(t,e);var c=Ji(a(t),a(e),r,i,o,s);return s.delete(t),c;case N:if(Fn)return Fn.call(t)==Fn.call(e)}return!1}(t,e,l,n,r,o,s);if(!(1&n)){var p=h&&Bt.call(t,"__wrapped__"),A=f&&Bt.call(e,"__wrapped__");if(p||A){var C=p?t.value():t,S=A?e.value():e;return s||(s=new zn),o(C,S,n,r,s)}}return!!d&&(s||(s=new zn),function(t,e,n,r,o,s){var a=1&n,u=to(t),l=u.length;if(l!=to(e).length&&!a)return!1;for(var c=l;c--;){var h=u[c];if(!(a?h in e:Bt.call(e,h)))return!1}var f=s.get(t),d=s.get(e);if(f&&d)return f==e&&d==t;var p=!0;s.set(t,e),s.set(e,t);for(var g=a;++c<l;){var m=t[h=u[c]],v=e[h];if(r)var y=a?r(v,m,h,e,t,s):r(m,v,h,t,e,s);if(!(y===i?m===v||o(m,v,n,r,s):y)){p=!1;break}g||(g="constructor"==h)}if(p&&!g){var b=t.constructor,A=e.constructor;b==A||!("constructor"in t)||!("constructor"in e)||"function"==typeof b&&b instanceof b&&"function"==typeof A&&A instanceof A||(p=!1)}return s.delete(t),s.delete(e),p}(t,e,n,r,o,s))}(t,e,n,r,Or,o))}function Lr(t,e,n,r){var o=n.length,s=o,a=!r;if(null==t)return!s;for(t=_t(t);o--;){var u=n[o];if(a&&u[2]?u[1]!==t[u[0]]:!(u[0]in t))return!1}for(;++o<s;){var l=(u=n[o])[0],c=t[l],h=u[1];if(a&&u[2]){if(c===i&&!(l in t))return!1}else{var f=new zn;if(r)var d=r(c,h,l,t,e,f);if(!(d===i?Or(h,c,3,r,f):d))return!1}}return!0}function Mr(t){return!(!Zs(t)||(e=t,Rt&&Rt in e))&&(Qs(t)?kt:gt).test(Do(t));var e}function Br(t){return"function"==typeof t?t:null==t?nu:"object"==typeof t?js(t)?Ur(t[0],t[1]):Dr(t):hu(t)}function Pr(t){if(!Co(t))return gn(t);var e=[];for(var n in _t(t))Bt.call(t,n)&&"constructor"!=n&&e.push(n);return e}function Rr(t,e){return t<e}function Fr(t,e){var n=-1,i=Gs(t)?r(t.length):[];return cr(t,(function(t,r,o){i[++n]=e(t,r,o)})),i}function Dr(t){var e=ao(t);return 1==e.length&&e[0][2]?xo(e[0][0],e[0][1]):function(n){return n===t||Lr(n,t,e)}}function Ur(t,e){return yo(t)&&wo(e)?xo(Fo(t),e):function(n){var r=Sa(n,t);return r===i&&r===e?Ea(n,t):Or(e,r,3)}}function kr(t,e,n,r,o){t!==e&&mr(e,(function(s,a){if(o||(o=new zn),Zs(s))!function(t,e,n,r,o,s,a){var u=Eo(t,n),l=Eo(e,n),c=a.get(l);if(c)Jn(t,n,c);else{var h=s?s(u,l,n+"",t,e,a):i,f=h===i;if(f){var d=js(l),p=!d&&zs(l),g=!d&&!p&&ua(l);h=l,d||p||g?js(u)?h=u:Ws(u)?h=Ei(u):p?(f=!1,h=Ai(l,!0)):g?(f=!1,h=wi(l,!0)):h=[]:ra(l)||Vs(l)?(h=u,Vs(u)?h=ma(u):Zs(u)&&!Qs(u)||(h=po(l))):f=!1}f&&(a.set(l,h),o(h,l,r,s,a),a.delete(l)),Jn(t,n,h)}}(t,e,a,n,kr,r,o);else{var u=r?r(Eo(t,a),s,a+"",t,e,o):i;u===i&&(u=s),Jn(t,a,u)}}),La)}function $r(t,e){var n=t.length;if(n)return mo(e+=e<0?n:0,n)?t[e]:i}function Hr(t,e,n){e=e.length?Le(e,(function(t){return js(t)?function(e){return Cr(e,1===t.length?t[0]:t)}:t})):[nu];var r=-1;e=Le(e,Ke(oo()));var i=Fr(t,(function(t,n,i){var o=Le(e,(function(e){return e(t)}));return{criteria:o,index:++r,value:t}}));return function(t,e){var r=t.length;for(t.sort((function(t,e){return function(t,e,n){for(var r=-1,i=t.criteria,o=e.criteria,s=i.length,a=n.length;++r<s;){var u=xi(i[r],o[r]);if(u)return r>=a?u:u*("desc"==n[r]?-1:1)}return t.index-e.index}(t,e,n)}));r--;)t[r]=t[r].value;return t}(i)}function Vr(t,e,n){for(var r=-1,i=e.length,o={};++r<i;){var s=e[r],a=Cr(t,s);n(a,s)&&Qr(o,mi(s,t),a)}return o}function jr(t,e,n,r){var i=r?$e:ke,o=-1,s=e.length,a=t;for(t===e&&(e=Ei(e)),n&&(a=Le(t,Ke(n)));++o<s;)for(var u=0,l=e[o],c=n?n(l):l;(u=i(a,c,u,r))>-1;)a!==t&&zt.call(a,u,1),zt.call(t,u,1);return t}function qr(t,e){for(var n=t?e.length:0,r=n-1;n--;){var i=e[n];if(n==r||i!==o){var o=i;mo(i)?zt.call(t,i,1):ui(t,i)}}return t}function Gr(t,e){return t+de(An()*(e-t+1))}function Wr(t,e){var n="";if(!t||e<1||e>h)return n;do{e%2&&(n+=t),(e=de(e/2))&&(t+=t)}while(e);return n}function zr(t,e){return No(_o(t,e,nu),t+"")}function Yr(t){return Kn(ka(t))}function Kr(t,e){var n=ka(t);return Mo(n,or(e,0,n.length))}function Qr(t,e,n,r){if(!Zs(t))return t;for(var o=-1,s=(e=mi(e,t)).length,a=s-1,u=t;null!=u&&++o<s;){var l=Fo(e[o]),c=n;if("__proto__"===l||"constructor"===l||"prototype"===l)return t;if(o!=a){var h=u[l];(c=r?r(h,l,u):i)===i&&(c=Zs(h)?h:mo(e[o+1])?[]:{})}Zn(u,l,c),u=u[l]}return t}var Xr=In?function(t,e){return In.set(t,e),t}:nu,Jr=te?function(t,e){return te(t,"toString",{configurable:!0,enumerable:!1,value:Za(e),writable:!0})}:nu;function Zr(t){return Mo(ka(t))}function ti(t,e,n){var i=-1,o=t.length;e<0&&(e=-e>o?0:o+e),(n=n>o?o:n)<0&&(n+=o),o=e>n?0:n-e>>>0,e>>>=0;for(var s=r(o);++i<o;)s[i]=t[i+e];return s}function ei(t,e){var n;return cr(t,(function(t,r,i){return!(n=e(t,r,i))})),!!n}function ni(t,e,n){var r=0,i=null==t?r:t.length;if("number"==typeof e&&e==e&&i<=2147483647){for(;r<i;){var o=r+i>>>1,s=t[o];null!==s&&!aa(s)&&(n?s<=e:s<e)?r=o+1:i=o}return i}return ri(t,e,nu,n)}function ri(t,e,n,r){var o=0,s=null==t?0:t.length;if(0===s)return 0;for(var a=(e=n(e))!=e,u=null===e,l=aa(e),c=e===i;o<s;){var h=de((o+s)/2),f=n(t[h]),d=f!==i,p=null===f,g=f==f,m=aa(f);if(a)var v=r||g;else v=c?g&&(r||d):u?g&&d&&(r||!p):l?g&&d&&!p&&(r||!m):!p&&!m&&(r?f<=e:f<e);v?o=h+1:s=h}return vn(s,4294967294)}function ii(t,e){for(var n=-1,r=t.length,i=0,o=[];++n<r;){var s=t[n],a=e?e(s):s;if(!n||!ks(a,u)){var u=a;o[i++]=0===s?0:s}}return o}function oi(t){return"number"==typeof t?t:aa(t)?f:+t}function si(t){if("string"==typeof t)return t;if(js(t))return Le(t,si)+"";if(aa(t))return Dn?Dn.call(t):"";var e=t+"";return"0"==e&&1/t==-1/0?"-0":e}function ai(t,e,n){var r=-1,i=Ne,o=t.length,s=!0,a=[],u=a;if(n)s=!1,i=Oe;else if(o>=200){var l=e?null:Wi(t);if(l)return un(l);s=!1,i=Xe,u=new Wn}else u=e?[]:a;t:for(;++r<o;){var c=t[r],h=e?e(c):c;if(c=n||0!==c?c:0,s&&h==h){for(var f=u.length;f--;)if(u[f]===h)continue t;e&&u.push(h),a.push(c)}else i(u,h,n)||(u!==a&&u.push(h),a.push(c))}return a}function ui(t,e){return null==(t=So(t,e=mi(e,t)))||delete t[Fo(Ko(e))]}function li(t,e,n,r){return Qr(t,e,n(Cr(t,e)),r)}function ci(t,e,n,r){for(var i=t.length,o=r?i:-1;(r?o--:++o<i)&&e(t[o],o,t););return n?ti(t,r?0:o,r?o+1:i):ti(t,r?o+1:0,r?i:o)}function hi(t,e){var n=t;return n instanceof Vn&&(n=n.value()),Be(e,(function(t,e){return e.func.apply(e.thisArg,Me([t],e.args))}),n)}function fi(t,e,n){var i=t.length;if(i<2)return i?ai(t[0]):[];for(var o=-1,s=r(i);++o<i;)for(var a=t[o],u=-1;++u<i;)u!=o&&(s[o]=lr(s[o]||a,t[u],e,n));return ai(gr(s,1),e,n)}function di(t,e,n){for(var r=-1,o=t.length,s=e.length,a={};++r<o;){var u=r<s?e[r]:i;n(a,t[r],u)}return a}function pi(t){return Ws(t)?t:[]}function gi(t){return"function"==typeof t?t:nu}function mi(t,e){return js(t)?t:yo(t,e)?[t]:Ro(va(t))}var vi=zr;function yi(t,e,n){var r=t.length;return n=n===i?r:n,!e&&n>=r?t:ti(t,e,n)}var bi=se||function(t){return he.clearTimeout(t)};function Ai(t,e){if(e)return t.slice();var n=t.length,r=jt?jt(n):new t.constructor(n);return t.copy(r),r}function Ci(t){var e=new t.constructor(t.byteLength);return new Vt(e).set(new Vt(t)),e}function wi(t,e){var n=e?Ci(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.length)}function xi(t,e){if(t!==e){var n=t!==i,r=null===t,o=t==t,s=aa(t),a=e!==i,u=null===e,l=e==e,c=aa(e);if(!u&&!c&&!s&&t>e||s&&a&&l&&!u&&!c||r&&a&&l||!n&&l||!o)return 1;if(!r&&!s&&!c&&t<e||c&&n&&o&&!r&&!s||u&&n&&o||!a&&o||!l)return-1}return 0}function _i(t,e,n,i){for(var o=-1,s=t.length,a=n.length,u=-1,l=e.length,c=mn(s-a,0),h=r(l+c),f=!i;++u<l;)h[u]=e[u];for(;++o<a;)(f||o<s)&&(h[n[o]]=t[o]);for(;c--;)h[u++]=t[o++];return h}function Si(t,e,n,i){for(var o=-1,s=t.length,a=-1,u=n.length,l=-1,c=e.length,h=mn(s-u,0),f=r(h+c),d=!i;++o<h;)f[o]=t[o];for(var p=o;++l<c;)f[p+l]=e[l];for(;++a<u;)(d||o<s)&&(f[p+n[a]]=t[o++]);return f}function Ei(t,e){var n=-1,i=t.length;for(e||(e=r(i));++n<i;)e[n]=t[n];return e}function Ti(t,e,n,r){var o=!n;n||(n={});for(var s=-1,a=e.length;++s<a;){var u=e[s],l=r?r(n[u],t[u],u,n,t):i;l===i&&(l=t[u]),o?rr(n,u,l):Zn(n,u,l)}return n}function Ii(t,e){return function(n,r){var i=js(n)?_e:er,o=e?e():{};return i(n,t,oo(r,2),o)}}function Ni(t){return zr((function(e,n){var r=-1,o=n.length,s=o>1?n[o-1]:i,a=o>2?n[2]:i;for(s=t.length>3&&"function"==typeof s?(o--,s):i,a&&vo(n[0],n[1],a)&&(s=o<3?i:s,o=1),e=_t(e);++r<o;){var u=n[r];u&&t(e,u,r,s)}return e}))}function Oi(t,e){return function(n,r){if(null==n)return n;if(!Gs(n))return t(n,r);for(var i=n.length,o=e?i:-1,s=_t(n);(e?o--:++o<i)&&!1!==r(s[o],o,s););return n}}function Li(t){return function(e,n,r){for(var i=-1,o=_t(e),s=r(e),a=s.length;a--;){var u=s[t?a:++i];if(!1===n(o[u],u,o))break}return e}}function Mi(t){return function(e){var n=rn(e=va(e))?hn(e):i,r=n?n[0]:e.charAt(0),o=n?yi(n,1).join(""):e.slice(1);return r[t]()+o}}function Bi(t){return function(e){return Be(Qa(Va(e).replace(Qt,"")),t,"")}}function Pi(t){return function(){var e=arguments;switch(e.length){case 0:return new t;case 1:return new t(e[0]);case 2:return new t(e[0],e[1]);case 3:return new t(e[0],e[1],e[2]);case 4:return new t(e[0],e[1],e[2],e[3]);case 5:return new t(e[0],e[1],e[2],e[3],e[4]);case 6:return new t(e[0],e[1],e[2],e[3],e[4],e[5]);case 7:return new t(e[0],e[1],e[2],e[3],e[4],e[5],e[6])}var n=kn(t.prototype),r=t.apply(n,e);return Zs(r)?r:n}}function Ri(t){return function(e,n,r){var o=_t(e);if(!Gs(e)){var s=oo(n,3);e=Oa(e),n=function(t){return s(o[t],t,o)}}var a=t(e,n,r);return a>-1?o[s?e[a]:a]:i}}function Fi(t){return Zi((function(e){var n=e.length,r=n,s=Hn.prototype.thru;for(t&&e.reverse();r--;){var a=e[r];if("function"!=typeof a)throw new Tt(o);if(s&&!u&&"wrapper"==ro(a))var u=new Hn([],!0)}for(r=u?r:n;++r<n;){var l=ro(a=e[r]),c="wrapper"==l?no(a):i;u=c&&bo(c[0])&&424==c[1]&&!c[4].length&&1==c[9]?u[ro(c[0])].apply(u,c[3]):1==a.length&&bo(a)?u[l]():u.thru(a)}return function(){var t=arguments,r=t[0];if(u&&1==t.length&&js(r))return u.plant(r).value();for(var i=0,o=n?e[i].apply(this,t):r;++i<n;)o=e[i].call(this,o);return o}}))}function Di(t,e,n,o,s,a,u,c,h,f){var d=e&l,p=1&e,g=2&e,m=24&e,v=512&e,y=g?i:Pi(t);return function l(){for(var b=arguments.length,A=r(b),C=b;C--;)A[C]=arguments[C];if(m)var w=io(l),x=function(t,e){for(var n=t.length,r=0;n--;)t[n]===e&&++r;return r}(A,w);if(o&&(A=_i(A,o,s,m)),a&&(A=Si(A,a,u,m)),b-=x,m&&b<f){var _=an(A,w);return qi(t,e,Di,l.placeholder,n,A,_,c,h,f-b)}var S=p?n:this,E=g?S[t]:t;return b=A.length,c?A=function(t,e){for(var n=t.length,r=vn(e.length,n),o=Ei(t);r--;){var s=e[r];t[r]=mo(s,n)?o[s]:i}return t}(A,c):v&&b>1&&A.reverse(),d&&h<b&&(A.length=h),this&&this!==he&&this instanceof l&&(E=y||Pi(E)),E.apply(S,A)}}function Ui(t,e){return function(n,r){return function(t,e,n,r){return yr(t,(function(t,i,o){e(r,n(t),i,o)})),r}(n,t,e(r),{})}}function ki(t,e){return function(n,r){var o;if(n===i&&r===i)return e;if(n!==i&&(o=n),r!==i){if(o===i)return r;"string"==typeof n||"string"==typeof r?(n=si(n),r=si(r)):(n=oi(n),r=oi(r)),o=t(n,r)}return o}}function $i(t){return Zi((function(e){return e=Le(e,Ke(oo())),zr((function(n){var r=this;return t(e,(function(t){return xe(t,r,n)}))}))}))}function Hi(t,e){var n=(e=e===i?" ":si(e)).length;if(n<2)return n?Wr(e,t):e;var r=Wr(e,fe(t/cn(e)));return rn(e)?yi(hn(r),0,t).join(""):r.slice(0,t)}function Vi(t){return function(e,n,o){return o&&"number"!=typeof o&&vo(e,n,o)&&(n=o=i),e=fa(e),n===i?(n=e,e=0):n=fa(n),function(t,e,n,i){for(var o=-1,s=mn(fe((e-t)/(n||1)),0),a=r(s);s--;)a[i?s:++o]=t,t+=n;return a}(e,n,o=o===i?e<n?1:-1:fa(o),t)}}function ji(t){return function(e,n){return"string"==typeof e&&"string"==typeof n||(e=ga(e),n=ga(n)),t(e,n)}}function qi(t,e,n,r,o,s,a,l,c,h){var f=8&e;e|=f?u:64,4&(e&=~(f?64:u))||(e&=-4);var d=[t,e,o,f?s:i,f?a:i,f?i:s,f?i:a,l,c,h],p=n.apply(i,d);return bo(t)&&To(p,d),p.placeholder=r,Oo(p,t,e)}function Gi(t){var e=xt[t];return function(t,n){if(t=ga(t),(n=null==n?0:vn(da(n),292))&&Fe(t)){var r=(va(t)+"e").split("e");return+((r=(va(e(r[0]+"e"+(+r[1]+n)))+"e").split("e"))[0]+"e"+(+r[1]-n))}return e(t)}}var Wi=Sn&&1/un(new Sn([,-0]))[1]==c?function(t){return new Sn(t)}:au;function zi(t){return function(e){var n=ho(e);return n==w?on(e):n==T?ln(e):function(t,e){return Le(e,(function(e){return[e,t[e]]}))}(e,t(e))}}function Yi(t,e,n,s,c,h,f,d){var p=2&e;if(!p&&"function"!=typeof t)throw new Tt(o);var g=s?s.length:0;if(g||(e&=-97,s=c=i),f=f===i?f:mn(da(f),0),d=d===i?d:da(d),g-=c?c.length:0,64&e){var m=s,v=c;s=c=i}var y=p?i:no(t),b=[t,e,n,s,c,m,v,h,f,d];if(y&&function(t,e){var n=t[1],r=e[1],i=n|r,o=i<131,s=r==l&&8==n||r==l&&256==n&&t[7].length<=e[8]||384==r&&e[7].length<=e[8]&&8==n;if(!o&&!s)return t;1&r&&(t[2]=e[2],i|=1&n?0:4);var u=e[3];if(u){var c=t[3];t[3]=c?_i(c,u,e[4]):u,t[4]=c?an(t[3],a):e[4]}(u=e[5])&&(c=t[5],t[5]=c?Si(c,u,e[6]):u,t[6]=c?an(t[5],a):e[6]),(u=e[7])&&(t[7]=u),r&l&&(t[8]=null==t[8]?e[8]:vn(t[8],e[8])),null==t[9]&&(t[9]=e[9]),t[0]=e[0],t[1]=i}(b,y),t=b[0],e=b[1],n=b[2],s=b[3],c=b[4],!(d=b[9]=b[9]===i?p?0:t.length:mn(b[9]-g,0))&&24&e&&(e&=-25),e&&1!=e)A=8==e||16==e?function(t,e,n){var o=Pi(t);return function s(){for(var a=arguments.length,u=r(a),l=a,c=io(s);l--;)u[l]=arguments[l];var h=a<3&&u[0]!==c&&u[a-1]!==c?[]:an(u,c);return(a-=h.length)<n?qi(t,e,Di,s.placeholder,i,u,h,i,i,n-a):xe(this&&this!==he&&this instanceof s?o:t,this,u)}}(t,e,d):e!=u&&33!=e||c.length?Di.apply(i,b):function(t,e,n,i){var o=1&e,s=Pi(t);return function e(){for(var a=-1,u=arguments.length,l=-1,c=i.length,h=r(c+u),f=this&&this!==he&&this instanceof e?s:t;++l<c;)h[l]=i[l];for(;u--;)h[l++]=arguments[++a];return xe(f,o?n:this,h)}}(t,e,n,s);else var A=function(t,e,n){var r=1&e,i=Pi(t);return function e(){return(this&&this!==he&&this instanceof e?i:t).apply(r?n:this,arguments)}}(t,e,n);return Oo((y?Xr:To)(A,b),t,e)}function Ki(t,e,n,r){return t===i||ks(t,Ot[n])&&!Bt.call(r,n)?e:t}function Qi(t,e,n,r,o,s){return Zs(t)&&Zs(e)&&(s.set(e,t),kr(t,e,i,Qi,s),s.delete(e)),t}function Xi(t){return ra(t)?i:t}function Ji(t,e,n,r,o,s){var a=1&n,u=t.length,l=e.length;if(u!=l&&!(a&&l>u))return!1;var c=s.get(t),h=s.get(e);if(c&&h)return c==e&&h==t;var f=-1,d=!0,p=2&n?new Wn:i;for(s.set(t,e),s.set(e,t);++f<u;){var g=t[f],m=e[f];if(r)var v=a?r(m,g,f,e,t,s):r(g,m,f,t,e,s);if(v!==i){if(v)continue;d=!1;break}if(p){if(!Re(e,(function(t,e){if(!Xe(p,e)&&(g===t||o(g,t,n,r,s)))return p.push(e)}))){d=!1;break}}else if(g!==m&&!o(g,m,n,r,s)){d=!1;break}}return s.delete(t),s.delete(e),d}function Zi(t){return No(_o(t,i,qo),t+"")}function to(t){return wr(t,Oa,lo)}function eo(t){return wr(t,La,co)}var no=In?function(t){return In.get(t)}:au;function ro(t){for(var e=t.name+"",n=Nn[e],r=Bt.call(Nn,e)?n.length:0;r--;){var i=n[r],o=i.func;if(null==o||o==t)return i.name}return e}function io(t){return(Bt.call(Un,"placeholder")?Un:t).placeholder}function oo(){var t=Un.iteratee||ru;return t=t===ru?Br:t,arguments.length?t(arguments[0],arguments[1]):t}function so(t,e){var n,r,i=t.__data__;return("string"==(r=typeof(n=e))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?i["string"==typeof e?"string":"hash"]:i.map}function ao(t){for(var e=Oa(t),n=e.length;n--;){var r=e[n],i=t[r];e[n]=[r,i,wo(i)]}return e}function uo(t,e){var n=function(t,e){return null==t?i:t[e]}(t,e);return Mr(n)?n:i}var lo=ge?function(t){return null==t?[]:(t=_t(t),Ie(ge(t),(function(e){return Wt.call(t,e)})))}:pu,co=ge?function(t){for(var e=[];t;)Me(e,lo(t)),t=qt(t);return e}:pu,ho=xr;function fo(t,e,n){for(var r=-1,i=(e=mi(e,t)).length,o=!1;++r<i;){var s=Fo(e[r]);if(!(o=null!=t&&n(t,s)))break;t=t[s]}return o||++r!=i?o:!!(i=null==t?0:t.length)&&Js(i)&&mo(s,i)&&(js(t)||Vs(t))}function po(t){return"function"!=typeof t.constructor||Co(t)?{}:kn(qt(t))}function go(t){return js(t)||Vs(t)||!!(Yt&&t&&t[Yt])}function mo(t,e){var n=typeof t;return!!(e=null==e?h:e)&&("number"==n||"symbol"!=n&&vt.test(t))&&t>-1&&t%1==0&&t<e}function vo(t,e,n){if(!Zs(n))return!1;var r=typeof e;return!!("number"==r?Gs(n)&&mo(e,n.length):"string"==r&&e in n)&&ks(n[e],t)}function yo(t,e){if(js(t))return!1;var n=typeof t;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=t&&!aa(t))||Z.test(t)||!J.test(t)||null!=e&&t in _t(e)}function bo(t){var e=ro(t),n=Un[e];if("function"!=typeof n||!(e in Vn.prototype))return!1;if(t===n)return!0;var r=no(n);return!!r&&t===r[0]}(wn&&ho(new wn(new ArrayBuffer(1)))!=M||xn&&ho(new xn)!=w||_n&&ho(_n.resolve())!=S||Sn&&ho(new Sn)!=T||En&&ho(new En)!=O)&&(ho=function(t){var e=xr(t),n=e==_?t.constructor:i,r=n?Do(n):"";if(r)switch(r){case On:return M;case Ln:return w;case Mn:return S;case Bn:return T;case Pn:return O}return e});var Ao=Lt?Qs:gu;function Co(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||Ot)}function wo(t){return t==t&&!Zs(t)}function xo(t,e){return function(n){return null!=n&&n[t]===e&&(e!==i||t in _t(n))}}function _o(t,e,n){return e=mn(e===i?t.length-1:e,0),function(){for(var i=arguments,o=-1,s=mn(i.length-e,0),a=r(s);++o<s;)a[o]=i[e+o];o=-1;for(var u=r(e+1);++o<e;)u[o]=i[o];return u[e]=n(a),xe(t,this,u)}}function So(t,e){return e.length<2?t:Cr(t,ti(e,0,-1))}function Eo(t,e){if(("constructor"!==e||"function"!=typeof t[e])&&"__proto__"!=e)return t[e]}var To=Lo(Xr),Io=ce||function(t,e){return he.setTimeout(t,e)},No=Lo(Jr);function Oo(t,e,n){var r=e+"";return No(t,function(t,e){var n=e.length;if(!n)return t;var r=n-1;return e[r]=(n>1?"& ":"")+e[r],e=e.join(n>2?", ":" "),t.replace(ot,"{\n/* [wrapped with "+e+"] */\n")}(r,function(t,e){return Se(p,(function(n){var r="_."+n[0];e&n[1]&&!Ne(t,r)&&t.push(r)})),t.sort()}(function(t){var e=t.match(st);return e?e[1].split(at):[]}(r),n)))}function Lo(t){var e=0,n=0;return function(){var r=yn(),o=16-(r-n);if(n=r,o>0){if(++e>=800)return arguments[0]}else e=0;return t.apply(i,arguments)}}function Mo(t,e){var n=-1,r=t.length,o=r-1;for(e=e===i?r:e;++n<e;){var s=Gr(n,o),a=t[s];t[s]=t[n],t[n]=a}return t.length=e,t}var Bo,Po,Ro=(Bo=Bs((function(t){var e=[];return 46===t.charCodeAt(0)&&e.push(""),t.replace(tt,(function(t,n,r,i){e.push(r?i.replace(ct,"$1"):n||t)})),e}),(function(t){return 500===Po.size&&Po.clear(),t})),Po=Bo.cache,Bo);function Fo(t){if("string"==typeof t||aa(t))return t;var e=t+"";return"0"==e&&1/t==-1/0?"-0":e}function Do(t){if(null!=t){try{return Mt.call(t)}catch(t){}try{return t+""}catch(t){}}return""}function Uo(t){if(t instanceof Vn)return t.clone();var e=new Hn(t.__wrapped__,t.__chain__);return e.__actions__=Ei(t.__actions__),e.__index__=t.__index__,e.__values__=t.__values__,e}var ko=zr((function(t,e){return Ws(t)?lr(t,gr(e,1,Ws,!0)):[]})),$o=zr((function(t,e){var n=Ko(e);return Ws(n)&&(n=i),Ws(t)?lr(t,gr(e,1,Ws,!0),oo(n,2)):[]})),Ho=zr((function(t,e){var n=Ko(e);return Ws(n)&&(n=i),Ws(t)?lr(t,gr(e,1,Ws,!0),i,n):[]}));function Vo(t,e,n){var r=null==t?0:t.length;if(!r)return-1;var i=null==n?0:da(n);return i<0&&(i=mn(r+i,0)),Ue(t,oo(e,3),i)}function jo(t,e,n){var r=null==t?0:t.length;if(!r)return-1;var o=r-1;return n!==i&&(o=da(n),o=n<0?mn(r+o,0):vn(o,r-1)),Ue(t,oo(e,3),o,!0)}function qo(t){return null!=t&&t.length?gr(t,1):[]}function Go(t){return t&&t.length?t[0]:i}var Wo=zr((function(t){var e=Le(t,pi);return e.length&&e[0]===t[0]?Tr(e):[]})),zo=zr((function(t){var e=Ko(t),n=Le(t,pi);return e===Ko(n)?e=i:n.pop(),n.length&&n[0]===t[0]?Tr(n,oo(e,2)):[]})),Yo=zr((function(t){var e=Ko(t),n=Le(t,pi);return(e="function"==typeof e?e:i)&&n.pop(),n.length&&n[0]===t[0]?Tr(n,i,e):[]}));function Ko(t){var e=null==t?0:t.length;return e?t[e-1]:i}var Qo=zr(Xo);function Xo(t,e){return t&&t.length&&e&&e.length?jr(t,e):t}var Jo=Zi((function(t,e){var n=null==t?0:t.length,r=ir(t,e);return qr(t,Le(e,(function(t){return mo(t,n)?+t:t})).sort(xi)),r}));function Zo(t){return null==t?t:Cn.call(t)}var ts=zr((function(t){return ai(gr(t,1,Ws,!0))})),es=zr((function(t){var e=Ko(t);return Ws(e)&&(e=i),ai(gr(t,1,Ws,!0),oo(e,2))})),ns=zr((function(t){var e=Ko(t);return e="function"==typeof e?e:i,ai(gr(t,1,Ws,!0),i,e)}));function rs(t){if(!t||!t.length)return[];var e=0;return t=Ie(t,(function(t){if(Ws(t))return e=mn(t.length,e),!0})),ze(e,(function(e){return Le(t,je(e))}))}function is(t,e){if(!t||!t.length)return[];var n=rs(t);return null==e?n:Le(n,(function(t){return xe(e,i,t)}))}var os=zr((function(t,e){return Ws(t)?lr(t,e):[]})),ss=zr((function(t){return fi(Ie(t,Ws))})),as=zr((function(t){var e=Ko(t);return Ws(e)&&(e=i),fi(Ie(t,Ws),oo(e,2))})),us=zr((function(t){var e=Ko(t);return e="function"==typeof e?e:i,fi(Ie(t,Ws),i,e)})),ls=zr(rs),cs=zr((function(t){var e=t.length,n=e>1?t[e-1]:i;return n="function"==typeof n?(t.pop(),n):i,is(t,n)}));function hs(t){var e=Un(t);return e.__chain__=!0,e}function fs(t,e){return e(t)}var ds=Zi((function(t){var e=t.length,n=e?t[0]:0,r=this.__wrapped__,o=function(e){return ir(e,t)};return!(e>1||this.__actions__.length)&&r instanceof Vn&&mo(n)?((r=r.slice(n,+n+(e?1:0))).__actions__.push({func:fs,args:[o],thisArg:i}),new Hn(r,this.__chain__).thru((function(t){return e&&!t.length&&t.push(i),t}))):this.thru(o)})),ps=Ii((function(t,e,n){Bt.call(t,n)?++t[n]:rr(t,n,1)})),gs=Ri(Vo),ms=Ri(jo);function vs(t,e){return(js(t)?Se:cr)(t,oo(e,3))}function ys(t,e){return(js(t)?Ee:hr)(t,oo(e,3))}var bs=Ii((function(t,e,n){Bt.call(t,n)?t[n].push(e):rr(t,n,[e])})),As=zr((function(t,e,n){var i=-1,o="function"==typeof e,s=Gs(t)?r(t.length):[];return cr(t,(function(t){s[++i]=o?xe(e,t,n):Ir(t,e,n)})),s})),Cs=Ii((function(t,e,n){rr(t,n,e)}));function ws(t,e){return(js(t)?Le:Fr)(t,oo(e,3))}var xs=Ii((function(t,e,n){t[n?0:1].push(e)}),(function(){return[[],[]]})),_s=zr((function(t,e){if(null==t)return[];var n=e.length;return n>1&&vo(t,e[0],e[1])?e=[]:n>2&&vo(e[0],e[1],e[2])&&(e=[e[0]]),Hr(t,gr(e,1),[])})),Ss=le||function(){return he.Date.now()};function Es(t,e,n){return e=n?i:e,e=t&&null==e?t.length:e,Yi(t,l,i,i,i,i,e)}function Ts(t,e){var n;if("function"!=typeof e)throw new Tt(o);return t=da(t),function(){return--t>0&&(n=e.apply(this,arguments)),t<=1&&(e=i),n}}var Is=zr((function(t,e,n){var r=1;if(n.length){var i=an(n,io(Is));r|=u}return Yi(t,r,e,n,i)})),Ns=zr((function(t,e,n){var r=3;if(n.length){var i=an(n,io(Ns));r|=u}return Yi(e,r,t,n,i)}));function Os(t,e,n){var r,s,a,u,l,c,h=0,f=!1,d=!1,p=!0;if("function"!=typeof t)throw new Tt(o);function g(e){var n=r,o=s;return r=s=i,h=e,u=t.apply(o,n)}function m(t){var n=t-c;return c===i||n>=e||n<0||d&&t-h>=a}function v(){var t=Ss();if(m(t))return y(t);l=Io(v,function(t){var n=e-(t-c);return d?vn(n,a-(t-h)):n}(t))}function y(t){return l=i,p&&r?g(t):(r=s=i,u)}function b(){var t=Ss(),n=m(t);if(r=arguments,s=this,c=t,n){if(l===i)return function(t){return h=t,l=Io(v,e),f?g(t):u}(c);if(d)return bi(l),l=Io(v,e),g(c)}return l===i&&(l=Io(v,e)),u}return e=ga(e)||0,Zs(n)&&(f=!!n.leading,a=(d="maxWait"in n)?mn(ga(n.maxWait)||0,e):a,p="trailing"in n?!!n.trailing:p),b.cancel=function(){l!==i&&bi(l),h=0,r=c=s=l=i},b.flush=function(){return l===i?u:y(Ss())},b}var Ls=zr((function(t,e){return ur(t,1,e)})),Ms=zr((function(t,e,n){return ur(t,ga(e)||0,n)}));function Bs(t,e){if("function"!=typeof t||null!=e&&"function"!=typeof e)throw new Tt(o);var n=function(){var r=arguments,i=e?e.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var s=t.apply(this,r);return n.cache=o.set(i,s)||o,s};return n.cache=new(Bs.Cache||Gn),n}function Ps(t){if("function"!=typeof t)throw new Tt(o);return function(){var e=arguments;switch(e.length){case 0:return!t.call(this);case 1:return!t.call(this,e[0]);case 2:return!t.call(this,e[0],e[1]);case 3:return!t.call(this,e[0],e[1],e[2])}return!t.apply(this,e)}}Bs.Cache=Gn;var Rs=vi((function(t,e){var n=(e=1==e.length&&js(e[0])?Le(e[0],Ke(oo())):Le(gr(e,1),Ke(oo()))).length;return zr((function(r){for(var i=-1,o=vn(r.length,n);++i<o;)r[i]=e[i].call(this,r[i]);return xe(t,this,r)}))})),Fs=zr((function(t,e){var n=an(e,io(Fs));return Yi(t,u,i,e,n)})),Ds=zr((function(t,e){var n=an(e,io(Ds));return Yi(t,64,i,e,n)})),Us=Zi((function(t,e){return Yi(t,256,i,i,i,e)}));function ks(t,e){return t===e||t!=t&&e!=e}var $s=ji(_r),Hs=ji((function(t,e){return t>=e})),Vs=Nr(function(){return arguments}())?Nr:function(t){return ta(t)&&Bt.call(t,"callee")&&!Wt.call(t,"callee")},js=r.isArray,qs=ve?Ke(ve):function(t){return ta(t)&&xr(t)==L};function Gs(t){return null!=t&&Js(t.length)&&!Qs(t)}function Ws(t){return ta(t)&&Gs(t)}var zs=me||gu,Ys=ye?Ke(ye):function(t){return ta(t)&&xr(t)==y};function Ks(t){if(!ta(t))return!1;var e=xr(t);return e==b||"[object DOMException]"==e||"string"==typeof t.message&&"string"==typeof t.name&&!ra(t)}function Qs(t){if(!Zs(t))return!1;var e=xr(t);return e==A||e==C||"[object AsyncFunction]"==e||"[object Proxy]"==e}function Xs(t){return"number"==typeof t&&t==da(t)}function Js(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=h}function Zs(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}function ta(t){return null!=t&&"object"==typeof t}var ea=be?Ke(be):function(t){return ta(t)&&ho(t)==w};function na(t){return"number"==typeof t||ta(t)&&xr(t)==x}function ra(t){if(!ta(t)||xr(t)!=_)return!1;var e=qt(t);if(null===e)return!0;var n=Bt.call(e,"constructor")&&e.constructor;return"function"==typeof n&&n instanceof n&&Mt.call(n)==Dt}var ia=Ae?Ke(Ae):function(t){return ta(t)&&xr(t)==E},oa=Ce?Ke(Ce):function(t){return ta(t)&&ho(t)==T};function sa(t){return"string"==typeof t||!js(t)&&ta(t)&&xr(t)==I}function aa(t){return"symbol"==typeof t||ta(t)&&xr(t)==N}var ua=we?Ke(we):function(t){return ta(t)&&Js(t.length)&&!!ie[xr(t)]},la=ji(Rr),ca=ji((function(t,e){return t<=e}));function ha(t){if(!t)return[];if(Gs(t))return sa(t)?hn(t):Ei(t);if(Kt&&t[Kt])return function(t){for(var e,n=[];!(e=t.next()).done;)n.push(e.value);return n}(t[Kt]());var e=ho(t);return(e==w?on:e==T?un:ka)(t)}function fa(t){return t?(t=ga(t))===c||t===-1/0?17976931348623157e292*(t<0?-1:1):t==t?t:0:0===t?t:0}function da(t){var e=fa(t),n=e%1;return e==e?n?e-n:e:0}function pa(t){return t?or(da(t),0,d):0}function ga(t){if("number"==typeof t)return t;if(aa(t))return f;if(Zs(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=Zs(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=Ye(t);var n=pt.test(t);return n||mt.test(t)?ue(t.slice(2),n?2:8):dt.test(t)?f:+t}function ma(t){return Ti(t,La(t))}function va(t){return null==t?"":si(t)}var ya=Ni((function(t,e){if(Co(e)||Gs(e))Ti(e,Oa(e),t);else for(var n in e)Bt.call(e,n)&&Zn(t,n,e[n])})),ba=Ni((function(t,e){Ti(e,La(e),t)})),Aa=Ni((function(t,e,n,r){Ti(e,La(e),t,r)})),Ca=Ni((function(t,e,n,r){Ti(e,Oa(e),t,r)})),wa=Zi(ir),xa=zr((function(t,e){t=_t(t);var n=-1,r=e.length,o=r>2?e[2]:i;for(o&&vo(e[0],e[1],o)&&(r=1);++n<r;)for(var s=e[n],a=La(s),u=-1,l=a.length;++u<l;){var c=a[u],h=t[c];(h===i||ks(h,Ot[c])&&!Bt.call(t,c))&&(t[c]=s[c])}return t})),_a=zr((function(t){return t.push(i,Qi),xe(Ba,i,t)}));function Sa(t,e,n){var r=null==t?i:Cr(t,e);return r===i?n:r}function Ea(t,e){return null!=t&&fo(t,e,Er)}var Ta=Ui((function(t,e,n){null!=e&&"function"!=typeof e.toString&&(e=Ft.call(e)),t[e]=n}),Za(nu)),Ia=Ui((function(t,e,n){null!=e&&"function"!=typeof e.toString&&(e=Ft.call(e)),Bt.call(t,e)?t[e].push(n):t[e]=[n]}),oo),Na=zr(Ir);function Oa(t){return Gs(t)?Yn(t):Pr(t)}function La(t){return Gs(t)?Yn(t,!0):function(t){if(!Zs(t))return function(t){var e=[];if(null!=t)for(var n in _t(t))e.push(n);return e}(t);var e=Co(t),n=[];for(var r in t)("constructor"!=r||!e&&Bt.call(t,r))&&n.push(r);return n}(t)}var Ma=Ni((function(t,e,n){kr(t,e,n)})),Ba=Ni((function(t,e,n,r){kr(t,e,n,r)})),Pa=Zi((function(t,e){var n={};if(null==t)return n;var r=!1;e=Le(e,(function(e){return e=mi(e,t),r||(r=e.length>1),e})),Ti(t,eo(t),n),r&&(n=sr(n,7,Xi));for(var i=e.length;i--;)ui(n,e[i]);return n})),Ra=Zi((function(t,e){return null==t?{}:function(t,e){return Vr(t,e,(function(e,n){return Ea(t,n)}))}(t,e)}));function Fa(t,e){if(null==t)return{};var n=Le(eo(t),(function(t){return[t]}));return e=oo(e),Vr(t,n,(function(t,n){return e(t,n[0])}))}var Da=zi(Oa),Ua=zi(La);function ka(t){return null==t?[]:Qe(t,Oa(t))}var $a=Bi((function(t,e,n){return e=e.toLowerCase(),t+(n?Ha(e):e)}));function Ha(t){return Ka(va(t).toLowerCase())}function Va(t){return(t=va(t))&&t.replace(yt,tn).replace(Xt,"")}var ja=Bi((function(t,e,n){return t+(n?"-":"")+e.toLowerCase()})),qa=Bi((function(t,e,n){return t+(n?" ":"")+e.toLowerCase()})),Ga=Mi("toLowerCase"),Wa=Bi((function(t,e,n){return t+(n?"_":"")+e.toLowerCase()})),za=Bi((function(t,e,n){return t+(n?" ":"")+Ka(e)})),Ya=Bi((function(t,e,n){return t+(n?" ":"")+e.toUpperCase()})),Ka=Mi("toUpperCase");function Qa(t,e,n){return t=va(t),(e=n?i:e)===i?function(t){return ee.test(t)}(t)?function(t){return t.match(Zt)||[]}(t):function(t){return t.match(ut)||[]}(t):t.match(e)||[]}var Xa=zr((function(t,e){try{return xe(t,i,e)}catch(t){return Ks(t)?t:new Ct(t)}})),Ja=Zi((function(t,e){return Se(e,(function(e){e=Fo(e),rr(t,e,Is(t[e],t))})),t}));function Za(t){return function(){return t}}var tu=Fi(),eu=Fi(!0);function nu(t){return t}function ru(t){return Br("function"==typeof t?t:sr(t,1))}var iu=zr((function(t,e){return function(n){return Ir(n,t,e)}})),ou=zr((function(t,e){return function(n){return Ir(t,n,e)}}));function su(t,e,n){var r=Oa(e),i=Ar(e,r);null!=n||Zs(e)&&(i.length||!r.length)||(n=e,e=t,t=this,i=Ar(e,Oa(e)));var o=!(Zs(n)&&"chain"in n&&!n.chain),s=Qs(t);return Se(i,(function(n){var r=e[n];t[n]=r,s&&(t.prototype[n]=function(){var e=this.__chain__;if(o||e){var n=t(this.__wrapped__);return(n.__actions__=Ei(this.__actions__)).push({func:r,args:arguments,thisArg:t}),n.__chain__=e,n}return r.apply(t,Me([this.value()],arguments))})})),t}function au(){}var uu=$i(Le),lu=$i(Te),cu=$i(Re);function hu(t){return yo(t)?je(Fo(t)):function(t){return function(e){return Cr(e,t)}}(t)}var fu=Vi(),du=Vi(!0);function pu(){return[]}function gu(){return!1}var mu,vu=ki((function(t,e){return t+e}),0),yu=Gi("ceil"),bu=ki((function(t,e){return t/e}),1),Au=Gi("floor"),Cu=ki((function(t,e){return t*e}),1),wu=Gi("round"),xu=ki((function(t,e){return t-e}),0);return Un.after=function(t,e){if("function"!=typeof e)throw new Tt(o);return t=da(t),function(){if(--t<1)return e.apply(this,arguments)}},Un.ary=Es,Un.assign=ya,Un.assignIn=ba,Un.assignInWith=Aa,Un.assignWith=Ca,Un.at=wa,Un.before=Ts,Un.bind=Is,Un.bindAll=Ja,Un.bindKey=Ns,Un.castArray=function(){if(!arguments.length)return[];var t=arguments[0];return js(t)?t:[t]},Un.chain=hs,Un.chunk=function(t,e,n){e=(n?vo(t,e,n):e===i)?1:mn(da(e),0);var o=null==t?0:t.length;if(!o||e<1)return[];for(var s=0,a=0,u=r(fe(o/e));s<o;)u[a++]=ti(t,s,s+=e);return u},Un.compact=function(t){for(var e=-1,n=null==t?0:t.length,r=0,i=[];++e<n;){var o=t[e];o&&(i[r++]=o)}return i},Un.concat=function(){var t=arguments.length;if(!t)return[];for(var e=r(t-1),n=arguments[0],i=t;i--;)e[i-1]=arguments[i];return Me(js(n)?Ei(n):[n],gr(e,1))},Un.cond=function(t){var e=null==t?0:t.length,n=oo();return t=e?Le(t,(function(t){if("function"!=typeof t[1])throw new Tt(o);return[n(t[0]),t[1]]})):[],zr((function(n){for(var r=-1;++r<e;){var i=t[r];if(xe(i[0],this,n))return xe(i[1],this,n)}}))},Un.conforms=function(t){return function(t){var e=Oa(t);return function(n){return ar(n,t,e)}}(sr(t,1))},Un.constant=Za,Un.countBy=ps,Un.create=function(t,e){var n=kn(t);return null==e?n:nr(n,e)},Un.curry=function t(e,n,r){var o=Yi(e,8,i,i,i,i,i,n=r?i:n);return o.placeholder=t.placeholder,o},Un.curryRight=function t(e,n,r){var o=Yi(e,16,i,i,i,i,i,n=r?i:n);return o.placeholder=t.placeholder,o},Un.debounce=Os,Un.defaults=xa,Un.defaultsDeep=_a,Un.defer=Ls,Un.delay=Ms,Un.difference=ko,Un.differenceBy=$o,Un.differenceWith=Ho,Un.drop=function(t,e,n){var r=null==t?0:t.length;return r?ti(t,(e=n||e===i?1:da(e))<0?0:e,r):[]},Un.dropRight=function(t,e,n){var r=null==t?0:t.length;return r?ti(t,0,(e=r-(e=n||e===i?1:da(e)))<0?0:e):[]},Un.dropRightWhile=function(t,e){return t&&t.length?ci(t,oo(e,3),!0,!0):[]},Un.dropWhile=function(t,e){return t&&t.length?ci(t,oo(e,3),!0):[]},Un.fill=function(t,e,n,r){var o=null==t?0:t.length;return o?(n&&"number"!=typeof n&&vo(t,e,n)&&(n=0,r=o),function(t,e,n,r){var o=t.length;for((n=da(n))<0&&(n=-n>o?0:o+n),(r=r===i||r>o?o:da(r))<0&&(r+=o),r=n>r?0:pa(r);n<r;)t[n++]=e;return t}(t,e,n,r)):[]},Un.filter=function(t,e){return(js(t)?Ie:pr)(t,oo(e,3))},Un.flatMap=function(t,e){return gr(ws(t,e),1)},Un.flatMapDeep=function(t,e){return gr(ws(t,e),c)},Un.flatMapDepth=function(t,e,n){return n=n===i?1:da(n),gr(ws(t,e),n)},Un.flatten=qo,Un.flattenDeep=function(t){return null!=t&&t.length?gr(t,c):[]},Un.flattenDepth=function(t,e){return null!=t&&t.length?gr(t,e=e===i?1:da(e)):[]},Un.flip=function(t){return Yi(t,512)},Un.flow=tu,Un.flowRight=eu,Un.fromPairs=function(t){for(var e=-1,n=null==t?0:t.length,r={};++e<n;){var i=t[e];r[i[0]]=i[1]}return r},Un.functions=function(t){return null==t?[]:Ar(t,Oa(t))},Un.functionsIn=function(t){return null==t?[]:Ar(t,La(t))},Un.groupBy=bs,Un.initial=function(t){return null!=t&&t.length?ti(t,0,-1):[]},Un.intersection=Wo,Un.intersectionBy=zo,Un.intersectionWith=Yo,Un.invert=Ta,Un.invertBy=Ia,Un.invokeMap=As,Un.iteratee=ru,Un.keyBy=Cs,Un.keys=Oa,Un.keysIn=La,Un.map=ws,Un.mapKeys=function(t,e){var n={};return e=oo(e,3),yr(t,(function(t,r,i){rr(n,e(t,r,i),t)})),n},Un.mapValues=function(t,e){var n={};return e=oo(e,3),yr(t,(function(t,r,i){rr(n,r,e(t,r,i))})),n},Un.matches=function(t){return Dr(sr(t,1))},Un.matchesProperty=function(t,e){return Ur(t,sr(e,1))},Un.memoize=Bs,Un.merge=Ma,Un.mergeWith=Ba,Un.method=iu,Un.methodOf=ou,Un.mixin=su,Un.negate=Ps,Un.nthArg=function(t){return t=da(t),zr((function(e){return $r(e,t)}))},Un.omit=Pa,Un.omitBy=function(t,e){return Fa(t,Ps(oo(e)))},Un.once=function(t){return Ts(2,t)},Un.orderBy=function(t,e,n,r){return null==t?[]:(js(e)||(e=null==e?[]:[e]),js(n=r?i:n)||(n=null==n?[]:[n]),Hr(t,e,n))},Un.over=uu,Un.overArgs=Rs,Un.overEvery=lu,Un.overSome=cu,Un.partial=Fs,Un.partialRight=Ds,Un.partition=xs,Un.pick=Ra,Un.pickBy=Fa,Un.property=hu,Un.propertyOf=function(t){return function(e){return null==t?i:Cr(t,e)}},Un.pull=Qo,Un.pullAll=Xo,Un.pullAllBy=function(t,e,n){return t&&t.length&&e&&e.length?jr(t,e,oo(n,2)):t},Un.pullAllWith=function(t,e,n){return t&&t.length&&e&&e.length?jr(t,e,i,n):t},Un.pullAt=Jo,Un.range=fu,Un.rangeRight=du,Un.rearg=Us,Un.reject=function(t,e){return(js(t)?Ie:pr)(t,Ps(oo(e,3)))},Un.remove=function(t,e){var n=[];if(!t||!t.length)return n;var r=-1,i=[],o=t.length;for(e=oo(e,3);++r<o;){var s=t[r];e(s,r,t)&&(n.push(s),i.push(r))}return qr(t,i),n},Un.rest=function(t,e){if("function"!=typeof t)throw new Tt(o);return zr(t,e=e===i?e:da(e))},Un.reverse=Zo,Un.sampleSize=function(t,e,n){return e=(n?vo(t,e,n):e===i)?1:da(e),(js(t)?Qn:Kr)(t,e)},Un.set=function(t,e,n){return null==t?t:Qr(t,e,n)},Un.setWith=function(t,e,n,r){return r="function"==typeof r?r:i,null==t?t:Qr(t,e,n,r)},Un.shuffle=function(t){return(js(t)?Xn:Zr)(t)},Un.slice=function(t,e,n){var r=null==t?0:t.length;return r?(n&&"number"!=typeof n&&vo(t,e,n)?(e=0,n=r):(e=null==e?0:da(e),n=n===i?r:da(n)),ti(t,e,n)):[]},Un.sortBy=_s,Un.sortedUniq=function(t){return t&&t.length?ii(t):[]},Un.sortedUniqBy=function(t,e){return t&&t.length?ii(t,oo(e,2)):[]},Un.split=function(t,e,n){return n&&"number"!=typeof n&&vo(t,e,n)&&(e=n=i),(n=n===i?d:n>>>0)?(t=va(t))&&("string"==typeof e||null!=e&&!ia(e))&&!(e=si(e))&&rn(t)?yi(hn(t),0,n):t.split(e,n):[]},Un.spread=function(t,e){if("function"!=typeof t)throw new Tt(o);return e=null==e?0:mn(da(e),0),zr((function(n){var r=n[e],i=yi(n,0,e);return r&&Me(i,r),xe(t,this,i)}))},Un.tail=function(t){var e=null==t?0:t.length;return e?ti(t,1,e):[]},Un.take=function(t,e,n){return t&&t.length?ti(t,0,(e=n||e===i?1:da(e))<0?0:e):[]},Un.takeRight=function(t,e,n){var r=null==t?0:t.length;return r?ti(t,(e=r-(e=n||e===i?1:da(e)))<0?0:e,r):[]},Un.takeRightWhile=function(t,e){return t&&t.length?ci(t,oo(e,3),!1,!0):[]},Un.takeWhile=function(t,e){return t&&t.length?ci(t,oo(e,3)):[]},Un.tap=function(t,e){return e(t),t},Un.throttle=function(t,e,n){var r=!0,i=!0;if("function"!=typeof t)throw new Tt(o);return Zs(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),Os(t,e,{leading:r,maxWait:e,trailing:i})},Un.thru=fs,Un.toArray=ha,Un.toPairs=Da,Un.toPairsIn=Ua,Un.toPath=function(t){return js(t)?Le(t,Fo):aa(t)?[t]:Ei(Ro(va(t)))},Un.toPlainObject=ma,Un.transform=function(t,e,n){var r=js(t),i=r||zs(t)||ua(t);if(e=oo(e,4),null==n){var o=t&&t.constructor;n=i?r?new o:[]:Zs(t)&&Qs(o)?kn(qt(t)):{}}return(i?Se:yr)(t,(function(t,r,i){return e(n,t,r,i)})),n},Un.unary=function(t){return Es(t,1)},Un.union=ts,Un.unionBy=es,Un.unionWith=ns,Un.uniq=function(t){return t&&t.length?ai(t):[]},Un.uniqBy=function(t,e){return t&&t.length?ai(t,oo(e,2)):[]},Un.uniqWith=function(t,e){return e="function"==typeof e?e:i,t&&t.length?ai(t,i,e):[]},Un.unset=function(t,e){return null==t||ui(t,e)},Un.unzip=rs,Un.unzipWith=is,Un.update=function(t,e,n){return null==t?t:li(t,e,gi(n))},Un.updateWith=function(t,e,n,r){return r="function"==typeof r?r:i,null==t?t:li(t,e,gi(n),r)},Un.values=ka,Un.valuesIn=function(t){return null==t?[]:Qe(t,La(t))},Un.without=os,Un.words=Qa,Un.wrap=function(t,e){return Fs(gi(e),t)},Un.xor=ss,Un.xorBy=as,Un.xorWith=us,Un.zip=ls,Un.zipObject=function(t,e){return di(t||[],e||[],Zn)},Un.zipObjectDeep=function(t,e){return di(t||[],e||[],Qr)},Un.zipWith=cs,Un.entries=Da,Un.entriesIn=Ua,Un.extend=ba,Un.extendWith=Aa,su(Un,Un),Un.add=vu,Un.attempt=Xa,Un.camelCase=$a,Un.capitalize=Ha,Un.ceil=yu,Un.clamp=function(t,e,n){return n===i&&(n=e,e=i),n!==i&&(n=(n=ga(n))==n?n:0),e!==i&&(e=(e=ga(e))==e?e:0),or(ga(t),e,n)},Un.clone=function(t){return sr(t,4)},Un.cloneDeep=function(t){return sr(t,5)},Un.cloneDeepWith=function(t,e){return sr(t,5,e="function"==typeof e?e:i)},Un.cloneWith=function(t,e){return sr(t,4,e="function"==typeof e?e:i)},Un.conformsTo=function(t,e){return null==e||ar(t,e,Oa(e))},Un.deburr=Va,Un.defaultTo=function(t,e){return null==t||t!=t?e:t},Un.divide=bu,Un.endsWith=function(t,e,n){t=va(t),e=si(e);var r=t.length,o=n=n===i?r:or(da(n),0,r);return(n-=e.length)>=0&&t.slice(n,o)==e},Un.eq=ks,Un.escape=function(t){return(t=va(t))&&Y.test(t)?t.replace(W,en):t},Un.escapeRegExp=function(t){return(t=va(t))&&nt.test(t)?t.replace(et,"\\$&"):t},Un.every=function(t,e,n){var r=js(t)?Te:fr;return n&&vo(t,e,n)&&(e=i),r(t,oo(e,3))},Un.find=gs,Un.findIndex=Vo,Un.findKey=function(t,e){return De(t,oo(e,3),yr)},Un.findLast=ms,Un.findLastIndex=jo,Un.findLastKey=function(t,e){return De(t,oo(e,3),br)},Un.floor=Au,Un.forEach=vs,Un.forEachRight=ys,Un.forIn=function(t,e){return null==t?t:mr(t,oo(e,3),La)},Un.forInRight=function(t,e){return null==t?t:vr(t,oo(e,3),La)},Un.forOwn=function(t,e){return t&&yr(t,oo(e,3))},Un.forOwnRight=function(t,e){return t&&br(t,oo(e,3))},Un.get=Sa,Un.gt=$s,Un.gte=Hs,Un.has=function(t,e){return null!=t&&fo(t,e,Sr)},Un.hasIn=Ea,Un.head=Go,Un.identity=nu,Un.includes=function(t,e,n,r){t=Gs(t)?t:ka(t),n=n&&!r?da(n):0;var i=t.length;return n<0&&(n=mn(i+n,0)),sa(t)?n<=i&&t.indexOf(e,n)>-1:!!i&&ke(t,e,n)>-1},Un.indexOf=function(t,e,n){var r=null==t?0:t.length;if(!r)return-1;var i=null==n?0:da(n);return i<0&&(i=mn(r+i,0)),ke(t,e,i)},Un.inRange=function(t,e,n){return e=fa(e),n===i?(n=e,e=0):n=fa(n),function(t,e,n){return t>=vn(e,n)&&t<mn(e,n)}(t=ga(t),e,n)},Un.invoke=Na,Un.isArguments=Vs,Un.isArray=js,Un.isArrayBuffer=qs,Un.isArrayLike=Gs,Un.isArrayLikeObject=Ws,Un.isBoolean=function(t){return!0===t||!1===t||ta(t)&&xr(t)==v},Un.isBuffer=zs,Un.isDate=Ys,Un.isElement=function(t){return ta(t)&&1===t.nodeType&&!ra(t)},Un.isEmpty=function(t){if(null==t)return!0;if(Gs(t)&&(js(t)||"string"==typeof t||"function"==typeof t.splice||zs(t)||ua(t)||Vs(t)))return!t.length;var e=ho(t);if(e==w||e==T)return!t.size;if(Co(t))return!Pr(t).length;for(var n in t)if(Bt.call(t,n))return!1;return!0},Un.isEqual=function(t,e){return Or(t,e)},Un.isEqualWith=function(t,e,n){var r=(n="function"==typeof n?n:i)?n(t,e):i;return r===i?Or(t,e,i,n):!!r},Un.isError=Ks,Un.isFinite=function(t){return"number"==typeof t&&Fe(t)},Un.isFunction=Qs,Un.isInteger=Xs,Un.isLength=Js,Un.isMap=ea,Un.isMatch=function(t,e){return t===e||Lr(t,e,ao(e))},Un.isMatchWith=function(t,e,n){return n="function"==typeof n?n:i,Lr(t,e,ao(e),n)},Un.isNaN=function(t){return na(t)&&t!=+t},Un.isNative=function(t){if(Ao(t))throw new Ct("Unsupported core-js use. Try https://npms.io/search?q=ponyfill.");return Mr(t)},Un.isNil=function(t){return null==t},Un.isNull=function(t){return null===t},Un.isNumber=na,Un.isObject=Zs,Un.isObjectLike=ta,Un.isPlainObject=ra,Un.isRegExp=ia,Un.isSafeInteger=function(t){return Xs(t)&&t>=-9007199254740991&&t<=h},Un.isSet=oa,Un.isString=sa,Un.isSymbol=aa,Un.isTypedArray=ua,Un.isUndefined=function(t){return t===i},Un.isWeakMap=function(t){return ta(t)&&ho(t)==O},Un.isWeakSet=function(t){return ta(t)&&"[object WeakSet]"==xr(t)},Un.join=function(t,e){return null==t?"":qe.call(t,e)},Un.kebabCase=ja,Un.last=Ko,Un.lastIndexOf=function(t,e,n){var r=null==t?0:t.length;if(!r)return-1;var o=r;return n!==i&&(o=(o=da(n))<0?mn(r+o,0):vn(o,r-1)),e==e?function(t,e,n){for(var r=n+1;r--;)if(t[r]===e)return r;return r}(t,e,o):Ue(t,He,o,!0)},Un.lowerCase=qa,Un.lowerFirst=Ga,Un.lt=la,Un.lte=ca,Un.max=function(t){return t&&t.length?dr(t,nu,_r):i},Un.maxBy=function(t,e){return t&&t.length?dr(t,oo(e,2),_r):i},Un.mean=function(t){return Ve(t,nu)},Un.meanBy=function(t,e){return Ve(t,oo(e,2))},Un.min=function(t){return t&&t.length?dr(t,nu,Rr):i},Un.minBy=function(t,e){return t&&t.length?dr(t,oo(e,2),Rr):i},Un.stubArray=pu,Un.stubFalse=gu,Un.stubObject=function(){return{}},Un.stubString=function(){return""},Un.stubTrue=function(){return!0},Un.multiply=Cu,Un.nth=function(t,e){return t&&t.length?$r(t,da(e)):i},Un.noConflict=function(){return he._===this&&(he._=Ut),this},Un.noop=au,Un.now=Ss,Un.pad=function(t,e,n){t=va(t);var r=(e=da(e))?cn(t):0;if(!e||r>=e)return t;var i=(e-r)/2;return Hi(de(i),n)+t+Hi(fe(i),n)},Un.padEnd=function(t,e,n){t=va(t);var r=(e=da(e))?cn(t):0;return e&&r<e?t+Hi(e-r,n):t},Un.padStart=function(t,e,n){t=va(t);var r=(e=da(e))?cn(t):0;return e&&r<e?Hi(e-r,n)+t:t},Un.parseInt=function(t,e,n){return n||null==e?e=0:e&&(e=+e),bn(va(t).replace(rt,""),e||0)},Un.random=function(t,e,n){if(n&&"boolean"!=typeof n&&vo(t,e,n)&&(e=n=i),n===i&&("boolean"==typeof e?(n=e,e=i):"boolean"==typeof t&&(n=t,t=i)),t===i&&e===i?(t=0,e=1):(t=fa(t),e===i?(e=t,t=0):e=fa(e)),t>e){var r=t;t=e,e=r}if(n||t%1||e%1){var o=An();return vn(t+o*(e-t+ae("1e-"+((o+"").length-1))),e)}return Gr(t,e)},Un.reduce=function(t,e,n){var r=js(t)?Be:Ge,i=arguments.length<3;return r(t,oo(e,4),n,i,cr)},Un.reduceRight=function(t,e,n){var r=js(t)?Pe:Ge,i=arguments.length<3;return r(t,oo(e,4),n,i,hr)},Un.repeat=function(t,e,n){return e=(n?vo(t,e,n):e===i)?1:da(e),Wr(va(t),e)},Un.replace=function(){var t=arguments,e=va(t[0]);return t.length<3?e:e.replace(t[1],t[2])},Un.result=function(t,e,n){var r=-1,o=(e=mi(e,t)).length;for(o||(o=1,t=i);++r<o;){var s=null==t?i:t[Fo(e[r])];s===i&&(r=o,s=n),t=Qs(s)?s.call(t):s}return t},Un.round=wu,Un.runInContext=t,Un.sample=function(t){return(js(t)?Kn:Yr)(t)},Un.size=function(t){if(null==t)return 0;if(Gs(t))return sa(t)?cn(t):t.length;var e=ho(t);return e==w||e==T?t.size:Pr(t).length},Un.snakeCase=Wa,Un.some=function(t,e,n){var r=js(t)?Re:ei;return n&&vo(t,e,n)&&(e=i),r(t,oo(e,3))},Un.sortedIndex=function(t,e){return ni(t,e)},Un.sortedIndexBy=function(t,e,n){return ri(t,e,oo(n,2))},Un.sortedIndexOf=function(t,e){var n=null==t?0:t.length;if(n){var r=ni(t,e);if(r<n&&ks(t[r],e))return r}return-1},Un.sortedLastIndex=function(t,e){return ni(t,e,!0)},Un.sortedLastIndexBy=function(t,e,n){return ri(t,e,oo(n,2),!0)},Un.sortedLastIndexOf=function(t,e){if(null!=t&&t.length){var n=ni(t,e,!0)-1;if(ks(t[n],e))return n}return-1},Un.startCase=za,Un.startsWith=function(t,e,n){return t=va(t),n=null==n?0:or(da(n),0,t.length),e=si(e),t.slice(n,n+e.length)==e},Un.subtract=xu,Un.sum=function(t){return t&&t.length?We(t,nu):0},Un.sumBy=function(t,e){return t&&t.length?We(t,oo(e,2)):0},Un.template=function(t,e,n){var r=Un.templateSettings;n&&vo(t,e,n)&&(e=i),t=va(t),e=Aa({},e,r,Ki);var o,s,a=Aa({},e.imports,r.imports,Ki),u=Oa(a),l=Qe(a,u),c=0,h=e.interpolate||bt,f="__p += '",d=St((e.escape||bt).source+"|"+h.source+"|"+(h===X?ht:bt).source+"|"+(e.evaluate||bt).source+"|$","g"),p="//# sourceURL="+(Bt.call(e,"sourceURL")?(e.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++re+"]")+"\n";t.replace(d,(function(e,n,r,i,a,u){return r||(r=i),f+=t.slice(c,u).replace(At,nn),n&&(o=!0,f+="' +\n__e("+n+") +\n'"),a&&(s=!0,f+="';\n"+a+";\n__p += '"),r&&(f+="' +\n((__t = ("+r+")) == null ? '' : __t) +\n'"),c=u+e.length,e})),f+="';\n";var g=Bt.call(e,"variable")&&e.variable;if(g){if(lt.test(g))throw new Ct("Invalid `variable` option passed into `_.template`")}else f="with (obj) {\n"+f+"\n}\n";f=(s?f.replace(V,""):f).replace(j,"$1").replace(q,"$1;"),f="function("+(g||"obj")+") {\n"+(g?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(o?", __e = _.escape":"")+(s?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+f+"return __p\n}";var m=Xa((function(){return wt(u,p+"return "+f).apply(i,l)}));if(m.source=f,Ks(m))throw m;return m},Un.times=function(t,e){if((t=da(t))<1||t>h)return[];var n=d,r=vn(t,d);e=oo(e),t-=d;for(var i=ze(r,e);++n<t;)e(n);return i},Un.toFinite=fa,Un.toInteger=da,Un.toLength=pa,Un.toLower=function(t){return va(t).toLowerCase()},Un.toNumber=ga,Un.toSafeInteger=function(t){return t?or(da(t),-9007199254740991,h):0===t?t:0},Un.toString=va,Un.toUpper=function(t){return va(t).toUpperCase()},Un.trim=function(t,e,n){if((t=va(t))&&(n||e===i))return Ye(t);if(!t||!(e=si(e)))return t;var r=hn(t),o=hn(e);return yi(r,Je(r,o),Ze(r,o)+1).join("")},Un.trimEnd=function(t,e,n){if((t=va(t))&&(n||e===i))return t.slice(0,fn(t)+1);if(!t||!(e=si(e)))return t;var r=hn(t);return yi(r,0,Ze(r,hn(e))+1).join("")},Un.trimStart=function(t,e,n){if((t=va(t))&&(n||e===i))return t.replace(rt,"");if(!t||!(e=si(e)))return t;var r=hn(t);return yi(r,Je(r,hn(e))).join("")},Un.truncate=function(t,e){var n=30,r="...";if(Zs(e)){var o="separator"in e?e.separator:o;n="length"in e?da(e.length):n,r="omission"in e?si(e.omission):r}var s=(t=va(t)).length;if(rn(t)){var a=hn(t);s=a.length}if(n>=s)return t;var u=n-cn(r);if(u<1)return r;var l=a?yi(a,0,u).join(""):t.slice(0,u);if(o===i)return l+r;if(a&&(u+=l.length-u),ia(o)){if(t.slice(u).search(o)){var c,h=l;for(o.global||(o=St(o.source,va(ft.exec(o))+"g")),o.lastIndex=0;c=o.exec(h);)var f=c.index;l=l.slice(0,f===i?u:f)}}else if(t.indexOf(si(o),u)!=u){var d=l.lastIndexOf(o);d>-1&&(l=l.slice(0,d))}return l+r},Un.unescape=function(t){return(t=va(t))&&z.test(t)?t.replace(G,dn):t},Un.uniqueId=function(t){var e=++Pt;return va(t)+e},Un.upperCase=Ya,Un.upperFirst=Ka,Un.each=vs,Un.eachRight=ys,Un.first=Go,su(Un,(mu={},yr(Un,(function(t,e){Bt.call(Un.prototype,e)||(mu[e]=t)})),mu),{chain:!1}),Un.VERSION="4.17.21",Se(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(t){Un[t].placeholder=Un})),Se(["drop","take"],(function(t,e){Vn.prototype[t]=function(n){n=n===i?1:mn(da(n),0);var r=this.__filtered__&&!e?new Vn(this):this.clone();return r.__filtered__?r.__takeCount__=vn(n,r.__takeCount__):r.__views__.push({size:vn(n,d),type:t+(r.__dir__<0?"Right":"")}),r},Vn.prototype[t+"Right"]=function(e){return this.reverse()[t](e).reverse()}})),Se(["filter","map","takeWhile"],(function(t,e){var n=e+1,r=1==n||3==n;Vn.prototype[t]=function(t){var e=this.clone();return e.__iteratees__.push({iteratee:oo(t,3),type:n}),e.__filtered__=e.__filtered__||r,e}})),Se(["head","last"],(function(t,e){var n="take"+(e?"Right":"");Vn.prototype[t]=function(){return this[n](1).value()[0]}})),Se(["initial","tail"],(function(t,e){var n="drop"+(e?"":"Right");Vn.prototype[t]=function(){return this.__filtered__?new Vn(this):this[n](1)}})),Vn.prototype.compact=function(){return this.filter(nu)},Vn.prototype.find=function(t){return this.filter(t).head()},Vn.prototype.findLast=function(t){return this.reverse().find(t)},Vn.prototype.invokeMap=zr((function(t,e){return"function"==typeof t?new Vn(this):this.map((function(n){return Ir(n,t,e)}))})),Vn.prototype.reject=function(t){return this.filter(Ps(oo(t)))},Vn.prototype.slice=function(t,e){t=da(t);var n=this;return n.__filtered__&&(t>0||e<0)?new Vn(n):(t<0?n=n.takeRight(-t):t&&(n=n.drop(t)),e!==i&&(n=(e=da(e))<0?n.dropRight(-e):n.take(e-t)),n)},Vn.prototype.takeRightWhile=function(t){return this.reverse().takeWhile(t).reverse()},Vn.prototype.toArray=function(){return this.take(d)},yr(Vn.prototype,(function(t,e){var n=/^(?:filter|find|map|reject)|While$/.test(e),r=/^(?:head|last)$/.test(e),o=Un[r?"take"+("last"==e?"Right":""):e],s=r||/^find/.test(e);o&&(Un.prototype[e]=function(){var e=this.__wrapped__,a=r?[1]:arguments,u=e instanceof Vn,l=a[0],c=u||js(e),h=function(t){var e=o.apply(Un,Me([t],a));return r&&f?e[0]:e};c&&n&&"function"==typeof l&&1!=l.length&&(u=c=!1);var f=this.__chain__,d=!!this.__actions__.length,p=s&&!f,g=u&&!d;if(!s&&c){e=g?e:new Vn(this);var m=t.apply(e,a);return m.__actions__.push({func:fs,args:[h],thisArg:i}),new Hn(m,f)}return p&&g?t.apply(this,a):(m=this.thru(h),p?r?m.value()[0]:m.value():m)})})),Se(["pop","push","shift","sort","splice","unshift"],(function(t){var e=It[t],n=/^(?:push|sort|unshift)$/.test(t)?"tap":"thru",r=/^(?:pop|shift)$/.test(t);Un.prototype[t]=function(){var t=arguments;if(r&&!this.__chain__){var i=this.value();return e.apply(js(i)?i:[],t)}return this[n]((function(n){return e.apply(js(n)?n:[],t)}))}})),yr(Vn.prototype,(function(t,e){var n=Un[e];if(n){var r=n.name+"";Bt.call(Nn,r)||(Nn[r]=[]),Nn[r].push({name:e,func:n})}})),Nn[Di(i,2).name]=[{name:"wrapper",func:i}],Vn.prototype.clone=function(){var t=new Vn(this.__wrapped__);return t.__actions__=Ei(this.__actions__),t.__dir__=this.__dir__,t.__filtered__=this.__filtered__,t.__iteratees__=Ei(this.__iteratees__),t.__takeCount__=this.__takeCount__,t.__views__=Ei(this.__views__),t},Vn.prototype.reverse=function(){if(this.__filtered__){var t=new Vn(this);t.__dir__=-1,t.__filtered__=!0}else(t=this.clone()).__dir__*=-1;return t},Vn.prototype.value=function(){var t=this.__wrapped__.value(),e=this.__dir__,n=js(t),r=e<0,i=n?t.length:0,o=function(t,e,n){for(var r=-1,i=n.length;++r<i;){var o=n[r],s=o.size;switch(o.type){case"drop":t+=s;break;case"dropRight":e-=s;break;case"take":e=vn(e,t+s);break;case"takeRight":t=mn(t,e-s)}}return{start:t,end:e}}(0,i,this.__views__),s=o.start,a=o.end,u=a-s,l=r?a:s-1,c=this.__iteratees__,h=c.length,f=0,d=vn(u,this.__takeCount__);if(!n||!r&&i==u&&d==u)return hi(t,this.__actions__);var p=[];t:for(;u--&&f<d;){for(var g=-1,m=t[l+=e];++g<h;){var v=c[g],y=v.iteratee,b=v.type,A=y(m);if(2==b)m=A;else if(!A){if(1==b)continue t;break t}}p[f++]=m}return p},Un.prototype.at=ds,Un.prototype.chain=function(){return hs(this)},Un.prototype.commit=function(){return new Hn(this.value(),this.__chain__)},Un.prototype.next=function(){this.__values__===i&&(this.__values__=ha(this.value()));var t=this.__index__>=this.__values__.length;return{done:t,value:t?i:this.__values__[this.__index__++]}},Un.prototype.plant=function(t){for(var e,n=this;n instanceof $n;){var r=Uo(n);r.__index__=0,r.__values__=i,e?o.__wrapped__=r:e=r;var o=r;n=n.__wrapped__}return o.__wrapped__=t,e},Un.prototype.reverse=function(){var t=this.__wrapped__;if(t instanceof Vn){var e=t;return this.__actions__.length&&(e=new Vn(this)),(e=e.reverse()).__actions__.push({func:fs,args:[Zo],thisArg:i}),new Hn(e,this.__chain__)}return this.thru(Zo)},Un.prototype.toJSON=Un.prototype.valueOf=Un.prototype.value=function(){return hi(this.__wrapped__,this.__actions__)},Un.prototype.first=Un.prototype.head,Kt&&(Un.prototype[Kt]=function(){return this}),Un}();he._=pn,(r=function(){return pn}.call(e,n,e,t))===i||(t.exports=r)}.call(this)},802:t=>{t.exports=function t(e,n,r){function i(s,a){if(!n[s]){if(!e[s]){if(o)return o(s,!0);throw new Error("Cannot find module '"+s+"'")}a=n[s]={exports:{}},e[s][0].call(a.exports,(function(t){return i(e[s][1][t]||t)}),a,a.exports,t,e,n,r)}return n[s].exports}for(var o=void 0,s=0;s<r.length;s++)i(r[s]);return i}({1:[function(t,e,n){(function(r,i,o,s,a,u,l,c,h){"use strict";var f=t("crypto");function d(t,e){var n;return void 0===(n="passthrough"!==(e=m(t,e)).algorithm?f.createHash(e.algorithm):new b).write&&(n.write=n.update,n.end=n.update),y(e,n).dispatch(t),n.update||n.end(""),n.digest?n.digest("buffer"===e.encoding?void 0:e.encoding):(t=n.read(),"buffer"!==e.encoding?t.toString(e.encoding):t)}(n=e.exports=d).sha1=function(t){return d(t)},n.keys=function(t){return d(t,{excludeValues:!0,algorithm:"sha1",encoding:"hex"})},n.MD5=function(t){return d(t,{algorithm:"md5",encoding:"hex"})},n.keysMD5=function(t){return d(t,{algorithm:"md5",encoding:"hex",excludeValues:!0})};var p=f.getHashes?f.getHashes().slice():["sha1","md5"],g=(p.push("passthrough"),["buffer","hex","binary","base64"]);function m(t,e){var n={};if(n.algorithm=(e=e||{}).algorithm||"sha1",n.encoding=e.encoding||"hex",n.excludeValues=!!e.excludeValues,n.algorithm=n.algorithm.toLowerCase(),n.encoding=n.encoding.toLowerCase(),n.ignoreUnknown=!0===e.ignoreUnknown,n.respectType=!1!==e.respectType,n.respectFunctionNames=!1!==e.respectFunctionNames,n.respectFunctionProperties=!1!==e.respectFunctionProperties,n.unorderedArrays=!0===e.unorderedArrays,n.unorderedSets=!1!==e.unorderedSets,n.unorderedObjects=!1!==e.unorderedObjects,n.replacer=e.replacer||void 0,n.excludeKeys=e.excludeKeys||void 0,void 0===t)throw new Error("Object argument required.");for(var r=0;r<p.length;++r)p[r].toLowerCase()===n.algorithm.toLowerCase()&&(n.algorithm=p[r]);if(-1===p.indexOf(n.algorithm))throw new Error('Algorithm "'+n.algorithm+'" not supported. supported values: '+p.join(", "));if(-1===g.indexOf(n.encoding)&&"passthrough"!==n.algorithm)throw new Error('Encoding "'+n.encoding+'" not supported. supported values: '+g.join(", "));return n}function v(t){if("function"==typeof t)return null!=/^function\s+\w*\s*\(\s*\)\s*{\s+\[native code\]\s+}$/i.exec(Function.prototype.toString.call(t))}function y(t,e,n){function r(t){return e.update?e.update(t,"utf8"):e.write(t,"utf8")}return n=n||[],{dispatch:function(e){return this["_"+(null===(e=t.replacer?t.replacer(e):e)?"null":typeof e)](e)},_object:function(e){var i,s=Object.prototype.toString.call(e),a=/\[object (.*)\]/i.exec(s);if(a=(a=a?a[1]:"unknown:["+s+"]").toLowerCase(),0<=(s=n.indexOf(e)))return this.dispatch("[CIRCULAR:"+s+"]");if(n.push(e),void 0!==o&&o.isBuffer&&o.isBuffer(e))return r("buffer:"),r(e);if("object"===a||"function"===a||"asyncfunction"===a)return s=Object.keys(e),t.unorderedObjects&&(s=s.sort()),!1===t.respectType||v(e)||s.splice(0,0,"prototype","__proto__","constructor"),t.excludeKeys&&(s=s.filter((function(e){return!t.excludeKeys(e)}))),r("object:"+s.length+":"),i=this,s.forEach((function(n){i.dispatch(n),r(":"),t.excludeValues||i.dispatch(e[n]),r(",")}));if(!this["_"+a]){if(t.ignoreUnknown)return r("["+a+"]");throw new Error('Unknown object type "'+a+'"')}this["_"+a](e)},_array:function(e,i){i=void 0!==i?i:!1!==t.unorderedArrays;var o=this;if(r("array:"+e.length+":"),!i||e.length<=1)return e.forEach((function(t){return o.dispatch(t)}));var s=[];return i=e.map((function(e){var r=new b,i=n.slice();return y(t,r,i).dispatch(e),s=s.concat(i.slice(n.length)),r.read().toString()})),n=n.concat(s),i.sort(),this._array(i,!1)},_date:function(t){return r("date:"+t.toJSON())},_symbol:function(t){return r("symbol:"+t.toString())},_error:function(t){return r("error:"+t.toString())},_boolean:function(t){return r("bool:"+t.toString())},_string:function(t){r("string:"+t.length+":"),r(t.toString())},_function:function(e){r("fn:"),v(e)?this.dispatch("[native]"):this.dispatch(e.toString()),!1!==t.respectFunctionNames&&this.dispatch("function-name:"+String(e.name)),t.respectFunctionProperties&&this._object(e)},_number:function(t){return r("number:"+t.toString())},_xml:function(t){return r("xml:"+t.toString())},_null:function(){return r("Null")},_undefined:function(){return r("Undefined")},_regexp:function(t){return r("regex:"+t.toString())},_uint8array:function(t){return r("uint8array:"),this.dispatch(Array.prototype.slice.call(t))},_uint8clampedarray:function(t){return r("uint8clampedarray:"),this.dispatch(Array.prototype.slice.call(t))},_int8array:function(t){return r("int8array:"),this.dispatch(Array.prototype.slice.call(t))},_uint16array:function(t){return r("uint16array:"),this.dispatch(Array.prototype.slice.call(t))},_int16array:function(t){return r("int16array:"),this.dispatch(Array.prototype.slice.call(t))},_uint32array:function(t){return r("uint32array:"),this.dispatch(Array.prototype.slice.call(t))},_int32array:function(t){return r("int32array:"),this.dispatch(Array.prototype.slice.call(t))},_float32array:function(t){return r("float32array:"),this.dispatch(Array.prototype.slice.call(t))},_float64array:function(t){return r("float64array:"),this.dispatch(Array.prototype.slice.call(t))},_arraybuffer:function(t){return r("arraybuffer:"),this.dispatch(new Uint8Array(t))},_url:function(t){return r("url:"+t.toString())},_map:function(e){return r("map:"),e=Array.from(e),this._array(e,!1!==t.unorderedSets)},_set:function(e){return r("set:"),e=Array.from(e),this._array(e,!1!==t.unorderedSets)},_file:function(t){return r("file:"),this.dispatch([t.name,t.size,t.type,t.lastModfied])},_blob:function(){if(t.ignoreUnknown)return r("[blob]");throw Error('Hashing Blob objects is currently not supported\n(see https://github.com/puleos/object-hash/issues/26)\nUse "options.replacer" or "options.ignoreUnknown"\n')},_domwindow:function(){return r("domwindow")},_bigint:function(t){return r("bigint:"+t.toString())},_process:function(){return r("process")},_timer:function(){return r("timer")},_pipe:function(){return r("pipe")},_tcp:function(){return r("tcp")},_udp:function(){return r("udp")},_tty:function(){return r("tty")},_statwatcher:function(){return r("statwatcher")},_securecontext:function(){return r("securecontext")},_connection:function(){return r("connection")},_zlib:function(){return r("zlib")},_context:function(){return r("context")},_nodescript:function(){return r("nodescript")},_httpparser:function(){return r("httpparser")},_dataview:function(){return r("dataview")},_signal:function(){return r("signal")},_fsevent:function(){return r("fsevent")},_tlswrap:function(){return r("tlswrap")}}}function b(){return{buf:"",write:function(t){this.buf+=t},end:function(t){this.buf+=t},read:function(){return this.buf}}}n.writeToStream=function(t,e,n){return void 0===n&&(n=e,e={}),y(e=m(t,e),n).dispatch(t)}}).call(this,t("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},t("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/fake_9a5aa49d.js","/")},{buffer:3,crypto:5,lYpoI2:11}],2:[function(t,e,n){(function(t,e,r,i,o,s,a,u,l){!function(t){"use strict";var e="undefined"!=typeof Uint8Array?Uint8Array:Array,n="+".charCodeAt(0),r="/".charCodeAt(0),i="0".charCodeAt(0),o="a".charCodeAt(0),s="A".charCodeAt(0),a="-".charCodeAt(0),u="_".charCodeAt(0);function l(t){return(t=t.charCodeAt(0))===n||t===a?62:t===r||t===u?63:t<i?-1:t<i+10?t-i+26+26:t<s+26?t-s:t<o+26?t-o+26:void 0}t.toByteArray=function(t){var n,r;if(0<t.length%4)throw new Error("Invalid string. Length must be a multiple of 4");var i=t.length,o=(i="="===t.charAt(i-2)?2:"="===t.charAt(i-1)?1:0,new e(3*t.length/4-i)),s=0<i?t.length-4:t.length,a=0;function u(t){o[a++]=t}for(n=0;n<s;n+=4,0)u((16711680&(r=l(t.charAt(n))<<18|l(t.charAt(n+1))<<12|l(t.charAt(n+2))<<6|l(t.charAt(n+3))))>>16),u((65280&r)>>8),u(255&r);return 2==i?u(255&(r=l(t.charAt(n))<<2|l(t.charAt(n+1))>>4)):1==i&&(u((r=l(t.charAt(n))<<10|l(t.charAt(n+1))<<4|l(t.charAt(n+2))>>2)>>8&255),u(255&r)),o},t.fromByteArray=function(t){var e,n,r,i,o=t.length%3,s="";function a(t){return"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(t)}for(e=0,r=t.length-o;e<r;e+=3)s+=a((i=n=(t[e]<<16)+(t[e+1]<<8)+t[e+2])>>18&63)+a(i>>12&63)+a(i>>6&63)+a(63&i);switch(o){case 1:s=(s+=a((n=t[t.length-1])>>2))+a(n<<4&63)+"==";break;case 2:s=(s=(s+=a((n=(t[t.length-2]<<8)+t[t.length-1])>>10))+a(n>>4&63))+a(n<<2&63)+"="}return s}}(void 0===n?this.base64js={}:n)}).call(this,t("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},t("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/base64-js/lib/b64.js","/node_modules/gulp-browserify/node_modules/base64-js/lib")},{buffer:3,lYpoI2:11}],3:[function(t,e,n){(function(e,r,i,o,s,a,u,l,c){var h=t("base64-js"),f=t("ieee754");function i(t,e,n){if(!(this instanceof i))return new i(t,e,n);var r,o,s,a,u=typeof t;if("base64"===e&&"string"==u)for(t=(a=t).trim?a.trim():a.replace(/^\s+|\s+$/g,"");t.length%4!=0;)t+="=";if("number"==u)r=T(t);else if("string"==u)r=i.byteLength(t,e);else{if("object"!=u)throw new Error("First argument needs to be a number, array or string.");r=T(t.length)}if(i._useTypedArrays?o=i._augment(new Uint8Array(r)):((o=this).length=r,o._isBuffer=!0),i._useTypedArrays&&"number"==typeof t.byteLength)o._set(t);else if(I(a=t)||i.isBuffer(a)||a&&"object"==typeof a&&"number"==typeof a.length)for(s=0;s<r;s++)i.isBuffer(t)?o[s]=t.readUInt8(s):o[s]=t[s];else if("string"==u)o.write(t,0,e);else if("number"==u&&!i._useTypedArrays&&!n)for(s=0;s<r;s++)o[s]=0;return o}function d(t,e,n,r){var i;if(r||(D("boolean"==typeof n,"missing or invalid endian"),D(null!=e,"missing offset"),D(e+1<t.length,"Trying to read beyond buffer length")),!((r=t.length)<=e))return n?(i=t[e],e+1<r&&(i|=t[e+1]<<8)):(i=t[e]<<8,e+1<r&&(i|=t[e+1])),i}function p(t,e,n,r){var i;if(r||(D("boolean"==typeof n,"missing or invalid endian"),D(null!=e,"missing offset"),D(e+3<t.length,"Trying to read beyond buffer length")),!((r=t.length)<=e))return n?(e+2<r&&(i=t[e+2]<<16),e+1<r&&(i|=t[e+1]<<8),i|=t[e],e+3<r&&(i+=t[e+3]<<24>>>0)):(e+1<r&&(i=t[e+1]<<16),e+2<r&&(i|=t[e+2]<<8),e+3<r&&(i|=t[e+3]),i+=t[e]<<24>>>0),i}function g(t,e,n,r){if(r||(D("boolean"==typeof n,"missing or invalid endian"),D(null!=e,"missing offset"),D(e+1<t.length,"Trying to read beyond buffer length")),!(t.length<=e))return 32768&(r=d(t,e,n,!0))?-1*(65535-r+1):r}function m(t,e,n,r){if(r||(D("boolean"==typeof n,"missing or invalid endian"),D(null!=e,"missing offset"),D(e+3<t.length,"Trying to read beyond buffer length")),!(t.length<=e))return 2147483648&(r=p(t,e,n,!0))?-1*(4294967295-r+1):r}function v(t,e,n,r){return r||(D("boolean"==typeof n,"missing or invalid endian"),D(e+3<t.length,"Trying to read beyond buffer length")),f.read(t,e,n,23,4)}function y(t,e,n,r){return r||(D("boolean"==typeof n,"missing or invalid endian"),D(e+7<t.length,"Trying to read beyond buffer length")),f.read(t,e,n,52,8)}function b(t,e,n,r,i){if(i||(D(null!=e,"missing value"),D("boolean"==typeof r,"missing or invalid endian"),D(null!=n,"missing offset"),D(n+1<t.length,"trying to write beyond buffer length"),P(e,65535)),!((i=t.length)<=n))for(var o=0,s=Math.min(i-n,2);o<s;o++)t[n+o]=(e&255<<8*(r?o:1-o))>>>8*(r?o:1-o)}function A(t,e,n,r,i){if(i||(D(null!=e,"missing value"),D("boolean"==typeof r,"missing or invalid endian"),D(null!=n,"missing offset"),D(n+3<t.length,"trying to write beyond buffer length"),P(e,4294967295)),!((i=t.length)<=n))for(var o=0,s=Math.min(i-n,4);o<s;o++)t[n+o]=e>>>8*(r?o:3-o)&255}function C(t,e,n,r,i){i||(D(null!=e,"missing value"),D("boolean"==typeof r,"missing or invalid endian"),D(null!=n,"missing offset"),D(n+1<t.length,"Trying to write beyond buffer length"),R(e,32767,-32768)),t.length<=n||b(t,0<=e?e:65535+e+1,n,r,i)}function w(t,e,n,r,i){i||(D(null!=e,"missing value"),D("boolean"==typeof r,"missing or invalid endian"),D(null!=n,"missing offset"),D(n+3<t.length,"Trying to write beyond buffer length"),R(e,2147483647,-2147483648)),t.length<=n||A(t,0<=e?e:4294967295+e+1,n,r,i)}function x(t,e,n,r,i){i||(D(null!=e,"missing value"),D("boolean"==typeof r,"missing or invalid endian"),D(null!=n,"missing offset"),D(n+3<t.length,"Trying to write beyond buffer length"),F(e,34028234663852886e22,-34028234663852886e22)),t.length<=n||f.write(t,e,n,r,23,4)}function _(t,e,n,r,i){i||(D(null!=e,"missing value"),D("boolean"==typeof r,"missing or invalid endian"),D(null!=n,"missing offset"),D(n+7<t.length,"Trying to write beyond buffer length"),F(e,17976931348623157e292,-17976931348623157e292)),t.length<=n||f.write(t,e,n,r,52,8)}n.Buffer=i,n.SlowBuffer=i,n.INSPECT_MAX_BYTES=50,i.poolSize=8192,i._useTypedArrays=function(){try{var t=new ArrayBuffer(0),e=new Uint8Array(t);return e.foo=function(){return 42},42===e.foo()&&"function"==typeof e.subarray}catch(t){return!1}}(),i.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"raw":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},i.isBuffer=function(t){return!(null==t||!t._isBuffer)},i.byteLength=function(t,e){var n;switch(t+="",e||"utf8"){case"hex":n=t.length/2;break;case"utf8":case"utf-8":n=O(t).length;break;case"ascii":case"binary":case"raw":n=t.length;break;case"base64":n=L(t).length;break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":n=2*t.length;break;default:throw new Error("Unknown encoding")}return n},i.concat=function(t,e){if(D(I(t),"Usage: Buffer.concat(list, [totalLength])\nlist should be an Array."),0===t.length)return new i(0);if(1===t.length)return t[0];if("number"!=typeof e)for(o=e=0;o<t.length;o++)e+=t[o].length;for(var n=new i(e),r=0,o=0;o<t.length;o++){var s=t[o];s.copy(n,r),r+=s.length}return n},i.prototype.write=function(t,e,n,r){isFinite(e)?isFinite(n)||(r=n,n=void 0):(l=r,r=e,e=n,n=l),e=Number(e)||0;var o,s,a,u,l=this.length-e;switch((!n||l<(n=Number(n)))&&(n=l),r=String(r||"utf8").toLowerCase()){case"hex":o=function(t,e,n,r){n=Number(n)||0;var o=t.length-n;(!r||o<(r=Number(r)))&&(r=o),D((o=e.length)%2==0,"Invalid hex string"),o/2<r&&(r=o/2);for(var s=0;s<r;s++){var a=parseInt(e.substr(2*s,2),16);D(!isNaN(a),"Invalid hex string"),t[n+s]=a}return i._charsWritten=2*s,s}(this,t,e,n);break;case"utf8":case"utf-8":s=this,a=e,u=n,o=i._charsWritten=M(O(t),s,a,u);break;case"ascii":case"binary":o=function(t,e,n,r){return i._charsWritten=M(function(t){for(var e=[],n=0;n<t.length;n++)e.push(255&t.charCodeAt(n));return e}(e),t,n,r)}(this,t,e,n);break;case"base64":s=this,a=e,u=n,o=i._charsWritten=M(L(t),s,a,u);break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":o=function(t,e,n,r){return i._charsWritten=M(function(t){for(var e,n,r=[],i=0;i<t.length;i++)e=(n=t.charCodeAt(i))>>8,n%=256,r.push(n),r.push(e);return r}(e),t,n,r)}(this,t,e,n);break;default:throw new Error("Unknown encoding")}return o},i.prototype.toString=function(t,e,n){var r,i,o,s,a=this;if(t=String(t||"utf8").toLowerCase(),e=Number(e)||0,(n=void 0!==n?Number(n):a.length)===e)return"";switch(t){case"hex":r=function(t,e,n){var r=t.length;(!e||e<0)&&(e=0),(!n||n<0||r<n)&&(n=r);for(var i="",o=e;o<n;o++)i+=N(t[o]);return i}(a,e,n);break;case"utf8":case"utf-8":r=function(t,e,n){var r="",i="";n=Math.min(t.length,n);for(var o=e;o<n;o++)t[o]<=127?(r+=B(i)+String.fromCharCode(t[o]),i=""):i+="%"+t[o].toString(16);return r+B(i)}(a,e,n);break;case"ascii":case"binary":r=function(t,e,n){var r="";n=Math.min(t.length,n);for(var i=e;i<n;i++)r+=String.fromCharCode(t[i]);return r}(a,e,n);break;case"base64":i=a,s=n,r=0===(o=e)&&s===i.length?h.fromByteArray(i):h.fromByteArray(i.slice(o,s));break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":r=function(t,e,n){for(var r=t.slice(e,n),i="",o=0;o<r.length;o+=2)i+=String.fromCharCode(r[o]+256*r[o+1]);return i}(a,e,n);break;default:throw new Error("Unknown encoding")}return r},i.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},i.prototype.copy=function(t,e,n,r){if(e=e||0,(r=r||0===r?r:this.length)!==(n=n||0)&&0!==t.length&&0!==this.length){D(n<=r,"sourceEnd < sourceStart"),D(0<=e&&e<t.length,"targetStart out of bounds"),D(0<=n&&n<this.length,"sourceStart out of bounds"),D(0<=r&&r<=this.length,"sourceEnd out of bounds"),r>this.length&&(r=this.length);var o=(r=t.length-e<r-n?t.length-e+n:r)-n;if(o<100||!i._useTypedArrays)for(var s=0;s<o;s++)t[s+e]=this[s+n];else t._set(this.subarray(n,n+o),e)}},i.prototype.slice=function(t,e){var n=this.length;if(t=E(t,n,0),e=E(e,n,n),i._useTypedArrays)return i._augment(this.subarray(t,e));for(var r=e-t,o=new i(r,void 0,!0),s=0;s<r;s++)o[s]=this[s+t];return o},i.prototype.get=function(t){return console.log(".get() is deprecated. Access using array indexes instead."),this.readUInt8(t)},i.prototype.set=function(t,e){return console.log(".set() is deprecated. Access using array indexes instead."),this.writeUInt8(t,e)},i.prototype.readUInt8=function(t,e){if(e||(D(null!=t,"missing offset"),D(t<this.length,"Trying to read beyond buffer length")),!(t>=this.length))return this[t]},i.prototype.readUInt16LE=function(t,e){return d(this,t,!0,e)},i.prototype.readUInt16BE=function(t,e){return d(this,t,!1,e)},i.prototype.readUInt32LE=function(t,e){return p(this,t,!0,e)},i.prototype.readUInt32BE=function(t,e){return p(this,t,!1,e)},i.prototype.readInt8=function(t,e){if(e||(D(null!=t,"missing offset"),D(t<this.length,"Trying to read beyond buffer length")),!(t>=this.length))return 128&this[t]?-1*(255-this[t]+1):this[t]},i.prototype.readInt16LE=function(t,e){return g(this,t,!0,e)},i.prototype.readInt16BE=function(t,e){return g(this,t,!1,e)},i.prototype.readInt32LE=function(t,e){return m(this,t,!0,e)},i.prototype.readInt32BE=function(t,e){return m(this,t,!1,e)},i.prototype.readFloatLE=function(t,e){return v(this,t,!0,e)},i.prototype.readFloatBE=function(t,e){return v(this,t,!1,e)},i.prototype.readDoubleLE=function(t,e){return y(this,t,!0,e)},i.prototype.readDoubleBE=function(t,e){return y(this,t,!1,e)},i.prototype.writeUInt8=function(t,e,n){n||(D(null!=t,"missing value"),D(null!=e,"missing offset"),D(e<this.length,"trying to write beyond buffer length"),P(t,255)),e>=this.length||(this[e]=t)},i.prototype.writeUInt16LE=function(t,e,n){b(this,t,e,!0,n)},i.prototype.writeUInt16BE=function(t,e,n){b(this,t,e,!1,n)},i.prototype.writeUInt32LE=function(t,e,n){A(this,t,e,!0,n)},i.prototype.writeUInt32BE=function(t,e,n){A(this,t,e,!1,n)},i.prototype.writeInt8=function(t,e,n){n||(D(null!=t,"missing value"),D(null!=e,"missing offset"),D(e<this.length,"Trying to write beyond buffer length"),R(t,127,-128)),e>=this.length||(0<=t?this.writeUInt8(t,e,n):this.writeUInt8(255+t+1,e,n))},i.prototype.writeInt16LE=function(t,e,n){C(this,t,e,!0,n)},i.prototype.writeInt16BE=function(t,e,n){C(this,t,e,!1,n)},i.prototype.writeInt32LE=function(t,e,n){w(this,t,e,!0,n)},i.prototype.writeInt32BE=function(t,e,n){w(this,t,e,!1,n)},i.prototype.writeFloatLE=function(t,e,n){x(this,t,e,!0,n)},i.prototype.writeFloatBE=function(t,e,n){x(this,t,e,!1,n)},i.prototype.writeDoubleLE=function(t,e,n){_(this,t,e,!0,n)},i.prototype.writeDoubleBE=function(t,e,n){_(this,t,e,!1,n)},i.prototype.fill=function(t,e,n){if(e=e||0,n=n||this.length,D("number"==typeof(t="string"==typeof(t=t||0)?t.charCodeAt(0):t)&&!isNaN(t),"value is not a number"),D(e<=n,"end < start"),n!==e&&0!==this.length){D(0<=e&&e<this.length,"start out of bounds"),D(0<=n&&n<=this.length,"end out of bounds");for(var r=e;r<n;r++)this[r]=t}},i.prototype.inspect=function(){for(var t=[],e=this.length,r=0;r<e;r++)if(t[r]=N(this[r]),r===n.INSPECT_MAX_BYTES){t[r+1]="...";break}return"<Buffer "+t.join(" ")+">"},i.prototype.toArrayBuffer=function(){if("undefined"==typeof Uint8Array)throw new Error("Buffer.toArrayBuffer not supported in this browser");if(i._useTypedArrays)return new i(this).buffer;for(var t=new Uint8Array(this.length),e=0,n=t.length;e<n;e+=1)t[e]=this[e];return t.buffer};var S=i.prototype;function E(t,e,n){return"number"!=typeof t?n:e<=(t=~~t)?e:0<=t||0<=(t+=e)?t:0}function T(t){return(t=~~Math.ceil(+t))<0?0:t}function I(t){return(Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)})(t)}function N(t){return t<16?"0"+t.toString(16):t.toString(16)}function O(t){for(var e=[],n=0;n<t.length;n++){var r=t.charCodeAt(n);if(r<=127)e.push(t.charCodeAt(n));else for(var i=n,o=(55296<=r&&r<=57343&&n++,encodeURIComponent(t.slice(i,n+1)).substr(1).split("%")),s=0;s<o.length;s++)e.push(parseInt(o[s],16))}return e}function L(t){return h.toByteArray(t)}function M(t,e,n,r){for(var i=0;i<r&&!(i+n>=e.length||i>=t.length);i++)e[i+n]=t[i];return i}function B(t){try{return decodeURIComponent(t)}catch(t){return String.fromCharCode(65533)}}function P(t,e){D("number"==typeof t,"cannot write a non-number as a number"),D(0<=t,"specified a negative value for writing an unsigned value"),D(t<=e,"value is larger than maximum value for type"),D(Math.floor(t)===t,"value has a fractional component")}function R(t,e,n){D("number"==typeof t,"cannot write a non-number as a number"),D(t<=e,"value larger than maximum allowed value"),D(n<=t,"value smaller than minimum allowed value"),D(Math.floor(t)===t,"value has a fractional component")}function F(t,e,n){D("number"==typeof t,"cannot write a non-number as a number"),D(t<=e,"value larger than maximum allowed value"),D(n<=t,"value smaller than minimum allowed value")}function D(t,e){if(!t)throw new Error(e||"Failed assertion")}i._augment=function(t){return t._isBuffer=!0,t._get=t.get,t._set=t.set,t.get=S.get,t.set=S.set,t.write=S.write,t.toString=S.toString,t.toLocaleString=S.toString,t.toJSON=S.toJSON,t.copy=S.copy,t.slice=S.slice,t.readUInt8=S.readUInt8,t.readUInt16LE=S.readUInt16LE,t.readUInt16BE=S.readUInt16BE,t.readUInt32LE=S.readUInt32LE,t.readUInt32BE=S.readUInt32BE,t.readInt8=S.readInt8,t.readInt16LE=S.readInt16LE,t.readInt16BE=S.readInt16BE,t.readInt32LE=S.readInt32LE,t.readInt32BE=S.readInt32BE,t.readFloatLE=S.readFloatLE,t.readFloatBE=S.readFloatBE,t.readDoubleLE=S.readDoubleLE,t.readDoubleBE=S.readDoubleBE,t.writeUInt8=S.writeUInt8,t.writeUInt16LE=S.writeUInt16LE,t.writeUInt16BE=S.writeUInt16BE,t.writeUInt32LE=S.writeUInt32LE,t.writeUInt32BE=S.writeUInt32BE,t.writeInt8=S.writeInt8,t.writeInt16LE=S.writeInt16LE,t.writeInt16BE=S.writeInt16BE,t.writeInt32LE=S.writeInt32LE,t.writeInt32BE=S.writeInt32BE,t.writeFloatLE=S.writeFloatLE,t.writeFloatBE=S.writeFloatBE,t.writeDoubleLE=S.writeDoubleLE,t.writeDoubleBE=S.writeDoubleBE,t.fill=S.fill,t.inspect=S.inspect,t.toArrayBuffer=S.toArrayBuffer,t}}).call(this,t("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},t("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/buffer/index.js","/node_modules/gulp-browserify/node_modules/buffer")},{"base64-js":2,buffer:3,ieee754:10,lYpoI2:11}],4:[function(t,e,n){(function(n,r,i,o,s,a,u,l,c){i=t("buffer").Buffer;var h=new i(4);h.fill(0),e.exports={hash:function(t,e,n,r){for(var o=e(function(t,e){t.length%4!=0&&(n=t.length+(4-t.length%4),t=i.concat([t,h],n));for(var n,r=[],o=e?t.readInt32BE:t.readInt32LE,s=0;s<t.length;s+=4)r.push(o.call(t,s));return r}(t=i.isBuffer(t)?t:new i(t),r),8*t.length),s=(e=r,new i(n)),a=e?s.writeInt32BE:s.writeInt32LE,u=0;u<o.length;u++)a.call(s,o[u],4*u,!0);return s}}}).call(this,t("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},t("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/helpers.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{buffer:3,lYpoI2:11}],5:[function(t,e,n){(function(e,r,i,o,s,a,u,l,c){i=t("buffer").Buffer;var h=t("./sha"),f=t("./sha256"),d=t("./rng"),p={sha1:h,sha256:f,md5:t("./md5")},g=64,m=new i(g);function v(t,e){var n=p[t=t||"sha1"],r=[];return n||y("algorithm:",t,"is not yet supported"),{update:function(t){return i.isBuffer(t)||(t=new i(t)),r.push(t),t.length,this},digest:function(t){var o=i.concat(r);return o=e?function(t,e,n){i.isBuffer(e)||(e=new i(e)),i.isBuffer(n)||(n=new i(n)),e.length>g?e=t(e):e.length<g&&(e=i.concat([e,m],g));for(var r=new i(g),o=new i(g),s=0;s<g;s++)r[s]=54^e[s],o[s]=92^e[s];return n=t(i.concat([r,n])),t(i.concat([o,n]))}(n,e,o):n(o),r=null,t?o.toString(t):o}}}function y(){var t=[].slice.call(arguments).join(" ");throw new Error([t,"we accept pull requests","http://github.com/dominictarr/crypto-browserify"].join("\n"))}m.fill(0),n.createHash=function(t){return v(t)},n.createHmac=v,n.randomBytes=function(t,e){if(!e||!e.call)return new i(d(t));try{e.call(this,void 0,new i(d(t)))}catch(t){e(t)}};var b,A=["createCredentials","createCipher","createCipheriv","createDecipher","createDecipheriv","createSign","createVerify","createDiffieHellman","pbkdf2"],C=function(t){n[t]=function(){y("sorry,",t,"is not implemented yet")}};for(b in A)C(A[b])}).call(this,t("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},t("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/index.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{"./md5":6,"./rng":7,"./sha":8,"./sha256":9,buffer:3,lYpoI2:11}],6:[function(t,e,n){(function(n,r,i,o,s,a,u,l,c){var h=t("./helpers");function f(t,e){t[e>>5]|=128<<e%32,t[14+(e+64>>>9<<4)]=e;for(var n=1732584193,r=-271733879,i=-1732584194,o=271733878,s=0;s<t.length;s+=16){var a=n,u=r,l=i,c=o;n=p(n,r,i,o,t[s+0],7,-680876936),o=p(o,n,r,i,t[s+1],12,-389564586),i=p(i,o,n,r,t[s+2],17,606105819),r=p(r,i,o,n,t[s+3],22,-1044525330),n=p(n,r,i,o,t[s+4],7,-176418897),o=p(o,n,r,i,t[s+5],12,1200080426),i=p(i,o,n,r,t[s+6],17,-1473231341),r=p(r,i,o,n,t[s+7],22,-45705983),n=p(n,r,i,o,t[s+8],7,1770035416),o=p(o,n,r,i,t[s+9],12,-1958414417),i=p(i,o,n,r,t[s+10],17,-42063),r=p(r,i,o,n,t[s+11],22,-1990404162),n=p(n,r,i,o,t[s+12],7,1804603682),o=p(o,n,r,i,t[s+13],12,-40341101),i=p(i,o,n,r,t[s+14],17,-1502002290),n=g(n,r=p(r,i,o,n,t[s+15],22,1236535329),i,o,t[s+1],5,-165796510),o=g(o,n,r,i,t[s+6],9,-1069501632),i=g(i,o,n,r,t[s+11],14,643717713),r=g(r,i,o,n,t[s+0],20,-373897302),n=g(n,r,i,o,t[s+5],5,-701558691),o=g(o,n,r,i,t[s+10],9,38016083),i=g(i,o,n,r,t[s+15],14,-660478335),r=g(r,i,o,n,t[s+4],20,-405537848),n=g(n,r,i,o,t[s+9],5,568446438),o=g(o,n,r,i,t[s+14],9,-1019803690),i=g(i,o,n,r,t[s+3],14,-187363961),r=g(r,i,o,n,t[s+8],20,1163531501),n=g(n,r,i,o,t[s+13],5,-1444681467),o=g(o,n,r,i,t[s+2],9,-51403784),i=g(i,o,n,r,t[s+7],14,1735328473),n=m(n,r=g(r,i,o,n,t[s+12],20,-1926607734),i,o,t[s+5],4,-378558),o=m(o,n,r,i,t[s+8],11,-2022574463),i=m(i,o,n,r,t[s+11],16,1839030562),r=m(r,i,o,n,t[s+14],23,-35309556),n=m(n,r,i,o,t[s+1],4,-1530992060),o=m(o,n,r,i,t[s+4],11,1272893353),i=m(i,o,n,r,t[s+7],16,-155497632),r=m(r,i,o,n,t[s+10],23,-1094730640),n=m(n,r,i,o,t[s+13],4,681279174),o=m(o,n,r,i,t[s+0],11,-358537222),i=m(i,o,n,r,t[s+3],16,-722521979),r=m(r,i,o,n,t[s+6],23,76029189),n=m(n,r,i,o,t[s+9],4,-640364487),o=m(o,n,r,i,t[s+12],11,-421815835),i=m(i,o,n,r,t[s+15],16,530742520),n=v(n,r=m(r,i,o,n,t[s+2],23,-995338651),i,o,t[s+0],6,-198630844),o=v(o,n,r,i,t[s+7],10,1126891415),i=v(i,o,n,r,t[s+14],15,-1416354905),r=v(r,i,o,n,t[s+5],21,-57434055),n=v(n,r,i,o,t[s+12],6,1700485571),o=v(o,n,r,i,t[s+3],10,-1894986606),i=v(i,o,n,r,t[s+10],15,-1051523),r=v(r,i,o,n,t[s+1],21,-2054922799),n=v(n,r,i,o,t[s+8],6,1873313359),o=v(o,n,r,i,t[s+15],10,-30611744),i=v(i,o,n,r,t[s+6],15,-1560198380),r=v(r,i,o,n,t[s+13],21,1309151649),n=v(n,r,i,o,t[s+4],6,-145523070),o=v(o,n,r,i,t[s+11],10,-1120210379),i=v(i,o,n,r,t[s+2],15,718787259),r=v(r,i,o,n,t[s+9],21,-343485551),n=y(n,a),r=y(r,u),i=y(i,l),o=y(o,c)}return Array(n,r,i,o)}function d(t,e,n,r,i,o){return y((e=y(y(e,t),y(r,o)))<<i|e>>>32-i,n)}function p(t,e,n,r,i,o,s){return d(e&n|~e&r,t,e,i,o,s)}function g(t,e,n,r,i,o,s){return d(e&r|n&~r,t,e,i,o,s)}function m(t,e,n,r,i,o,s){return d(e^n^r,t,e,i,o,s)}function v(t,e,n,r,i,o,s){return d(n^(e|~r),t,e,i,o,s)}function y(t,e){var n=(65535&t)+(65535&e);return(t>>16)+(e>>16)+(n>>16)<<16|65535&n}e.exports=function(t){return h.hash(t,f,16)}}).call(this,t("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},t("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/md5.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{"./helpers":4,buffer:3,lYpoI2:11}],7:[function(t,e,n){(function(t,n,r,i,o,s,a,u,l){e.exports=function(t){for(var e,n=new Array(t),r=0;r<t;r++)!(3&r)&&(e=4294967296*Math.random()),n[r]=e>>>((3&r)<<3)&255;return n}}).call(this,t("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},t("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/rng.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{buffer:3,lYpoI2:11}],8:[function(t,e,n){(function(n,r,i,o,s,a,u,l,c){var h=t("./helpers");function f(t,e){t[e>>5]|=128<<24-e%32,t[15+(e+64>>9<<4)]=e;for(var n,r,i,o=Array(80),s=1732584193,a=-271733879,u=-1732584194,l=271733878,c=-1009589776,h=0;h<t.length;h+=16){for(var f=s,g=a,m=u,v=l,y=c,b=0;b<80;b++){o[b]=b<16?t[h+b]:p(o[b-3]^o[b-8]^o[b-14]^o[b-16],1);var A=d(d(p(s,5),(A=a,r=u,i=l,(n=b)<20?A&r|~A&i:!(n<40)&&n<60?A&r|A&i|r&i:A^r^i)),d(d(c,o[b]),(n=b)<20?1518500249:n<40?1859775393:n<60?-1894007588:-899497514));c=l,l=u,u=p(a,30),a=s,s=A}s=d(s,f),a=d(a,g),u=d(u,m),l=d(l,v),c=d(c,y)}return Array(s,a,u,l,c)}function d(t,e){var n=(65535&t)+(65535&e);return(t>>16)+(e>>16)+(n>>16)<<16|65535&n}function p(t,e){return t<<e|t>>>32-e}e.exports=function(t){return h.hash(t,f,20,!0)}}).call(this,t("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},t("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/sha.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{"./helpers":4,buffer:3,lYpoI2:11}],9:[function(t,e,n){(function(n,r,i,o,s,a,u,l,c){function h(t,e){var n=(65535&t)+(65535&e);return(t>>16)+(e>>16)+(n>>16)<<16|65535&n}function f(t,e){var n,r=new Array(1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298),i=new Array(1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225),o=new Array(64);t[e>>5]|=128<<24-e%32,t[15+(e+64>>9<<4)]=e;for(var s,a,u=0;u<t.length;u+=16){for(var l=i[0],c=i[1],f=i[2],d=i[3],m=i[4],v=i[5],y=i[6],b=i[7],A=0;A<64;A++)o[A]=A<16?t[A+u]:h(h(h((a=o[A-2],p(a,17)^p(a,19)^g(a,10)),o[A-7]),(a=o[A-15],p(a,7)^p(a,18)^g(a,3))),o[A-16]),n=h(h(h(h(b,p(a=m,6)^p(a,11)^p(a,25)),m&v^~m&y),r[A]),o[A]),s=h(p(s=l,2)^p(s,13)^p(s,22),l&c^l&f^c&f),b=y,y=v,v=m,m=h(d,n),d=f,f=c,c=l,l=h(n,s);i[0]=h(l,i[0]),i[1]=h(c,i[1]),i[2]=h(f,i[2]),i[3]=h(d,i[3]),i[4]=h(m,i[4]),i[5]=h(v,i[5]),i[6]=h(y,i[6]),i[7]=h(b,i[7])}return i}var d=t("./helpers"),p=function(t,e){return t>>>e|t<<32-e},g=function(t,e){return t>>>e};e.exports=function(t){return d.hash(t,f,32,!0)}}).call(this,t("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},t("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/sha256.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{"./helpers":4,buffer:3,lYpoI2:11}],10:[function(t,e,n){(function(t,e,r,i,o,s,a,u,l){n.read=function(t,e,n,r,i){var o,s,a=8*i-r-1,u=(1<<a)-1,l=u>>1,c=-7,h=n?i-1:0,f=n?-1:1;for(i=t[e+h],h+=f,o=i&(1<<-c)-1,i>>=-c,c+=a;0<c;o=256*o+t[e+h],h+=f,c-=8);for(s=o&(1<<-c)-1,o>>=-c,c+=r;0<c;s=256*s+t[e+h],h+=f,c-=8);if(0===o)o=1-l;else{if(o===u)return s?NaN:1/0*(i?-1:1);s+=Math.pow(2,r),o-=l}return(i?-1:1)*s*Math.pow(2,o-r)},n.write=function(t,e,n,r,i,o){var s,a,u=8*o-i-1,l=(1<<u)-1,c=l>>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,f=r?0:o-1,d=r?1:-1;for(o=e<0||0===e&&1/e<0?1:0,e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=l):(s=Math.floor(Math.log(e)/Math.LN2),e*(r=Math.pow(2,-s))<1&&(s--,r*=2),2<=(e+=1<=s+c?h/r:h*Math.pow(2,1-c))*r&&(s++,r/=2),l<=s+c?(a=0,s=l):1<=s+c?(a=(e*r-1)*Math.pow(2,i),s+=c):(a=e*Math.pow(2,c-1)*Math.pow(2,i),s=0));8<=i;t[n+f]=255&a,f+=d,a/=256,i-=8);for(s=s<<i|a,u+=i;0<u;t[n+f]=255&s,f+=d,s/=256,u-=8);t[n+f-d]|=128*o}}).call(this,t("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},t("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/ieee754/index.js","/node_modules/gulp-browserify/node_modules/ieee754")},{buffer:3,lYpoI2:11}],11:[function(t,e,n){(function(t,n,r,i,o,s,a,u,l){var c,h,f;function d(){}(t=e.exports={}).nextTick=(h="undefined"!=typeof window&&window.setImmediate,f="undefined"!=typeof window&&window.postMessage&&window.addEventListener,h?function(t){return window.setImmediate(t)}:f?(c=[],window.addEventListener("message",(function(t){var e=t.source;e!==window&&null!==e||"process-tick"!==t.data||(t.stopPropagation(),0<c.length&&c.shift()())}),!0),function(t){c.push(t),window.postMessage("process-tick","*")}):function(t){setTimeout(t,0)}),t.title="browser",t.browser=!0,t.env={},t.argv=[],t.on=d,t.addListener=d,t.once=d,t.off=d,t.removeListener=d,t.removeAllListeners=d,t.emit=d,t.binding=function(t){throw new Error("process.binding is not supported")},t.cwd=function(){return"/"},t.chdir=function(t){throw new Error("process.chdir is not supported")}}).call(this,t("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},t("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/process/browser.js","/node_modules/gulp-browserify/node_modules/process")},{buffer:3,lYpoI2:11}]},{},[1])(1)},146:(t,e)=>{"use strict";var n;!function(){var r=e||{}||this||window;void 0===(n=function(){return r}.apply(e,[]))||(t.exports=n),r.default=r;var i="http://www.w3.org/2000/xmlns/",o="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"},u=function(t){return t instanceof HTMLElement||t instanceof SVGElement},l=function(t){if(!u(t))throw new Error("an HTMLElement or SVGElement is required; got "+t)},c=function(t){return new Promise((function(e,n){u(t)?e(t):n(new Error("an HTMLElement or SVGElement is required; got "+t))}))},h=function(t,e,n){var r=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==r||isNaN(parseFloat(r))?0:r},f=function(t){for(var e=window.atob(t.split(",")[1]),n=t.split(",")[0].split(":")[1].split(";")[0],r=new ArrayBuffer(e.length),i=new Uint8Array(r),o=0;o<e.length;o++)i[o]=e.charCodeAt(o);return new Blob([r],{type:n})},d={},p=null,g=function(t,e){var n=e||{},r=n.selectorRemap,i=n.modifyStyle,o=n.modifyCss,u=n.fonts,l=n.excludeUnusedCss,c=o||function(t,e){return(r?r(t):t)+"{"+(i?i(e):e)+"}\n"},h=[],f=void 0===u,g=u||[];return(p||(p=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,r=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(c(e.selectorText,e.style.cssText));else if(f&&e.cssText.match(/^@font-face/)){var n=function(t,e){var n=t.cssText.match(s),r=n&&n[1]||"";if(r&&!r.match(/^data:/)&&"about:blank"!==r){var i,o,u=r.startsWith("../")?e+"/../"+r:r.startsWith("./")?e+"/."+r:r;return{text:t.cssText,format:(i=u,o=Object.keys(a).filter((function(t){return i.indexOf("."+t)>0})).map((function(t){return a[t]})),o?o[0]:(console.error("Unknown font format for "+i+". Fonts may not be working correctly."),"application/octet-stream")),url:u}}}(e,r);n&&g.push(n)}else l||h.push(e.cssText)}))})),function(t){return Promise.all(t.map((function(t){return new Promise((function(e,n){if(d[t.url])return e(d[t.url]);var r=new XMLHttpRequest;r.addEventListener("load",(function(){var n=function(t){for(var e="",n=new Uint8Array(t),r=0;r<n.byteLength;r++)e+=String.fromCharCode(n[r]);return window.btoa(e)}(r.response),i=t.text.replace(s,'url("data:'+t.format+";base64,"+n+'")')+"\n";d[t.url]=i,e(i)})),r.addEventListener("error",(function(n){console.warn("Failed to load font from: "+t.url,n),d[t.url]=null,e(null)})),r.addEventListener("abort",(function(n){console.warn("Aborted loading font from: "+t.url,n),e(null)})),r.open("GET",t.url),r.responseType="arraybuffer",r.send()}))}))).then((function(t){return t.filter((function(t){return t})).join("")}))}(g).then((function(t){return h.join("\n")+t}))},m=function(){if(!navigator.msSaveOrOpenBlob&&!("download"in document.createElement("a")))return{popup:window.open()}};r.prepareSvg=function(t,e,n){l(t);var r=e||{},s=r.left,a=void 0===s?0:s,u=r.top,c=void 0===u?0:u,f=r.width,d=r.height,p=r.scale,m=void 0===p?1:p,v=r.responsive,y=void 0!==v&&v,b=r.excludeCss,A=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,r){var i=document.createElement("canvas"),o=new Image;o.crossOrigin="anonymous",o.src=n,o.onerror=function(){return r(new Error("Could not load "+n))},o.onload=function(){i.width=o.width,i.height=o.height,i.getContext("2d").drawImage(o,0,0),t.setAttributeNS("http://www.w3.org/1999/xlink","href",i.toDataURL("image/png")),e(!0)}}))):Promise.resolve(null)})))}(t).then((function(){var r=t.cloneNode(!0);r.style.backgroundColor=(e||{}).backgroundColor||t.style.backgroundColor;var s=function(t,e,n,r){if("svg"===t.tagName)return{width:n||h(t,e,"width"),height:r||h(t,e,"height")};if(t.getBBox){var i=t.getBBox(),o=i.x,s=i.y;return{width:o+i.width,height:s+i.height}}}(t,r,f,d),u=s.width,l=s.height;if("svg"!==t.tagName){if(!t.getBBox)return void console.error("Attempted to render non-SVG element",t);null!=r.getAttribute("transform")&&r.setAttribute("transform",r.getAttribute("transform").replace(/translate\(.*?\)/,""));var p=document.createElementNS("http://www.w3.org/2000/svg","svg");p.appendChild(r),r=p}if(r.setAttribute("version","1.1"),r.setAttribute("viewBox",[a,c,u,l].join(" ")),r.getAttribute("xmlns")||r.setAttributeNS(i,"xmlns",o),r.getAttribute("xmlns:xlink")||r.setAttributeNS(i,"xmlns:xlink","http://www.w3.org/1999/xlink"),y?(r.removeAttribute("width"),r.removeAttribute("height"),r.setAttribute("preserveAspectRatio","xMinYMin meet")):(r.setAttribute("width",u*m),r.setAttribute("height",l*m)),Array.from(r.querySelectorAll("foreignObject > *")).forEach((function(t){t.setAttributeNS(i,"xmlns","svg"===t.tagName?o:"http://www.w3.org/1999/xhtml")})),!A)return g(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),r.insertBefore(i,r.firstChild);var o=document.createElement("div");o.appendChild(r);var s=o.innerHTML.replace(/NS\d+:href/gi,'xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href');if("function"!=typeof n)return{src:s,width:u,height:l};n(s,u,l)}));var v=document.createElement("div");v.appendChild(r);var b=v.innerHTML;if("function"!=typeof n)return{src:b,width:u,height:l};n(b,u,l)}))},r.svgAsDataUri=function(t,e,n){return l(t),r.prepareSvg(t,e).then((function(t){var e=t.src,r=t.width,i=t.height,o="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(o,r,i),o}))},r.svgAsPngUri=function(t,e,n){l(t);var i=e||{},o=i.encoderType,s=void 0===o?"image/png":o,a=i.encoderOptions,u=void 0===a?.8:a,c=i.canvg,h=function(t){var e=t.src,r=t.width,i=t.height,o=document.createElement("canvas"),a=o.getContext("2d"),l=window.devicePixelRatio||1;o.width=r*l,o.height=i*l,o.style.width=o.width+"px",o.style.height=o.height+"px",a.setTransform(l,0,0,l,0,0),c?c(o,e):a.drawImage(e,0,0);var h=void 0;try{h=o.toDataURL(s,u)}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,o.width,o.height),Promise.resolve(h)};return c?r.prepareSvg(t,e).then(h):r.svgAsDataUri(t,e).then((function(t){return new Promise((function(e,n){var r=new Image;r.onload=function(){return e(h({src:r,width:r.width,height:r.height}))},r.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)},r.src=t}))}))},r.download=function(t,e,n){if(navigator.msSaveOrOpenBlob)navigator.msSaveOrOpenBlob(f(e),t);else{var r=document.createElement("a");if("download"in r){r.download=t,r.style.display="none",document.body.appendChild(r);try{var i=f(e),o=URL.createObjectURL(i);r.href=o,r.onclick=function(){return requestAnimationFrame((function(){return URL.revokeObjectURL(o)}))}}catch(t){console.error(t),console.warn("Error while getting object URL. Falling back to string URL."),r.href=e}r.click(),document.body.removeChild(r)}else n&&n.popup&&(n.popup.document.title=t,n.popup.location.replace(e))}},r.saveSvg=function(t,e,n){var i=m();return c(t).then((function(t){return r.svgAsDataUri(t,n||{})})).then((function(t){return r.download(e,t,i)}))},r.saveSvgAsPng=function(t,e,n){var i=m();return c(t).then((function(t){return r.svgAsPngUri(t,n||{})})).then((function(t){return r.download(e,t,i)}))}}()},72:t=>{"use strict";var e=[];function n(t){for(var n=-1,r=0;r<e.length;r++)if(e[r].identifier===t){n=r;break}return n}function r(t,r){for(var o={},s=[],a=0;a<t.length;a++){var u=t[a],l=r.base?u[0]+r.base:u[0],c=o[l]||0,h="".concat(l," ").concat(c);o[l]=c+1;var f=n(h),d={css:u[1],media:u[2],sourceMap:u[3],supports:u[4],layer:u[5]};if(-1!==f)e[f].references++,e[f].updater(d);else{var p=i(d,r);r.byIndex=a,e.splice(a,0,{identifier:h,updater:p,references:1})}s.push(h)}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 o=r(t=t||[],i=i||{});return function(t){t=t||[];for(var s=0;s<o.length;s++){var a=n(o[s]);e[a].references--}for(var u=r(t,i),l=0;l<o.length;l++){var c=n(o[l]);0===e[c].references&&(e[c].updater(),e.splice(c,1))}o=u}}},659:t=>{"use strict";var e={};t.exports=function(t,n){var r=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(!r)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");r.appendChild(n)}},540:t=>{"use strict";t.exports=function(t){var e=document.createElement("style");return t.setAttributes(e,t.attributes),t.insert(e,t.options),e}},56:(t,e,n)=>{"use strict";t.exports=function(t){var e=n.nc;e&&t.setAttribute("nonce",e)}},825:t=>{"use strict";t.exports=function(t){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var e=t.insertStyleElement(t);return{update:function(n){!function(t,e,n){var r="";n.supports&&(r+="@supports (".concat(n.supports,") {")),n.media&&(r+="@media ".concat(n.media," {"));var i=void 0!==n.layer;i&&(r+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),r+=n.css,i&&(r+="}"),n.media&&(r+="}"),n.supports&&(r+="}");var o=n.sourceMap;o&&"undefined"!=typeof btoa&&(r+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(o))))," */")),e.styleTagTransform(r,t,e.options)}(e,t,n)},remove:function(){!function(t){if(null===t.parentNode)return!1;t.parentNode.removeChild(t)}(e)}}}},113:t=>{"use strict";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))}}},686:(t,e,n)=>{"use strict";n.d(e,{AL:()=>r,NO:()=>i});const r=["A","G","C","U"];var i;!function(t){t.HELM="HELM",t.AXOLABS="Axolabs"}(i||(i={}))},373:(t,e,n)=>{"use strict";n.d(e,{BP:()=>l,H6:()=>u,Nf:()=>a,Q_:()=>s,c6:()=>i,so:()=>r,y1:()=>o});const r="System:AppData/SequenceTranslator",i="monomer-lib.json",o="System:AppData/SequenceTranslator",s="pattern-app-data.json",a="formats-to-helm.json",u="codes-to-symbols.json",l="linkers.json"},620:(t,e,n)=>{"use strict";n.d(e,{$D:()=>a,QC:()=>u,TJ:()=>l,a1:()=>s,hH:()=>c});var r=n(82),i=n(373);const o=new r.FileSource(i.y1);let s,a,u,l;async function c(){if([s,a,u,l].every((t=>void 0!==t)))return;const t=[i.Q_,i.Nf,i.H6,i.BP];[s,a,u,l]=await Promise.all(t.map((t=>async function(t){try{const e=await o.readAsText(t);return JSON.parse(e)}catch(e){console.error(`Error loading json from ${t}:`,e)}}(t))))}},124:(t,e,n)=>{"use strict";n.d(e,{RG:()=>o,TX:()=>s,iD:()=>i});var r=n(328);function i(t){return t.sort(((t,e)=>e.length-t.length))}function o(t,e){const n=document.createElement("a");n.setAttribute("href","data:text/plain;charset=utf-8,"+e),n.setAttribute("download",t),n.click()}async function s(t,e,n="Oligo app"){try{return await t()}catch(t){const e=t.hasOwnProperty("message")?t.message:t.toString();throw r.shell.error(`${n} error: `+e),t}finally{e&&e()}}},448:(t,e,n)=>{"use strict";n.d(e,{k:()=>a});var r=n(82),i=n(416),o=n(686),s=n(620);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()}formatMonomerForViewer(t){const e={};return e.name=t.symbol,e.symbol=t.symbol,e.molfile=t.molfile,this.getAllFormats().forEach((n=>{if(n===o.NO.HELM)return;const r=s.QC[n],i=Object.keys(r).filter((e=>r[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.QC[t]))}getCodesByFormat(t){return Object.keys(s.QC[t])}getAllFormats(){return Object.keys(s.QC)}getTableForViewer(){const t=this.allMonomers.map((t=>this.formatMonomerForViewer(t)));return r.DataFrame.fromObjects(t)}getCodesToWeightsMap(){const t=new Map;return Object.entries(s.QC).forEach((([e,n])=>{Object.entries(n).forEach((([e,n])=>{const r=this.getMonomer(n),i=r.meta?.molecularWeight;t.set(e,i)}))})),t}}},838:(t,e,n)=>{"use strict";n.d(e,{q:()=>s});var r=n(686),i=n(448),o=n(124);class s{constructor(t){this.sequence=t,this.libWrapper=i.k.getInstance()}getInvalidCodeIndex(t){if(t===r.NO.HELM)return this.sequence.length;const e=["r","d"],n=(0,o.iD)(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&&r.AL.includes(this.sequence[i])&&e.includes(this.sequence[i-2]))break;if(e.includes(this.sequence[i+1])&&r.AL.includes(this.sequence[i])){i++;break}i+=t.length}return i===this.sequence.length&&(i=-1),i}isValidSequence(t){return-1===this.getInvalidCodeIndex(t)}}},670:(t,e,n)=>{"use strict";function r(t,e=!0){let n="\n Datagrok macromolecule handler\n\n";n+=" 0 0 0 0 0 0 999 V3000\n",n+="M V30 BEGIN CTAB\n";let r="",a="",u="";const l=[];let c=0,h=0,f=0;if(t.antiStrands.length>0)for(let e=0;e<t.antiStrands.length;e++)t.antiStrands[e]=i(t.antiStrands[e]);let d=!1;const p=t.senseStrands.concat(t.antiStrands);let g=0;for(let e=0;e<p.length;e++){p[e]=p[e].replaceAll("(-\nM V30 ","(").replaceAll("-\nM V30 ","").replaceAll(" )",")");const n=o(p[e]),i=s(p[e]);if(e>=t.senseStrands.length?!1===d&&(d=!0,f=0):g=Math.min(g,Math.min(...i.y.filter((t=>t<0)))),d){const t=Math.min(...i.x)-f,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-g}let u=p[e].indexOf("M V30 BEGIN ATOM");u=p[e].indexOf("\n",u);let m=u,v=u;for(let t=0;t<n.natom;t++){m=p[e].indexOf("V30",m)+4,v=p[e].indexOf(" ",m);const n=parseInt(p[e].substring(m,v))+c;p[e]=p[e].slice(0,m)+n+p[e].slice(v),m=p[e].indexOf(" ",m)+1,m=p[e].indexOf(" ",m)+1,v=p[e].indexOf(" ",m);let r=Math.round(1e4*i.x[t])/1e4;p[e]=p[e].slice(0,m)+r+p[e].slice(v),m=p[e].indexOf(" ",m)+1,v=p[e].indexOf(" ",m),r=Math.round(1e4*i.y[t])/1e4,p[e]=p[e].slice(0,m)+r+p[e].slice(v),m=p[e].indexOf("\n",m)+1}const y=p[e].indexOf("M V30 END ATOM");r+=p[e].substring(u+1,y);let b=p[e].indexOf("M V30 BEGIN BOND");b=p[e].indexOf("\n",b),m=b,v=b;for(let t=0;t<n.nbond;t++){m=p[e].indexOf("V30",m)+4,v=p[e].indexOf(" ",m);const t=parseInt(p[e].substring(m,v))+h;p[e]=p[e].slice(0,m)+t+p[e].slice(v),m=p[e].indexOf(" ",m)+1,m=p[e].indexOf(" ",m)+1,v=p[e].indexOf(" ",m);let n=parseInt(p[e].substring(m,v))+c;p[e]=p[e].slice(0,m)+n+p[e].slice(v),m=p[e].indexOf(" ",m)+1,v=Math.min(p[e].indexOf("\n",m),p[e].indexOf(" ",m)),n=parseInt(p[e].substring(m,v))+c,p[e]=p[e].slice(0,m)+n+p[e].slice(v),m=p[e].indexOf("\n",m)+1}const A=p[e].indexOf("M V30 END BOND");a+=p[e].substring(b+1,A);let C=p[e].indexOf("M V30 MDLV30/STEABS ATOMS=(");for(;-1!==C;){C+=28;const t=p[e].indexOf(")",C);p[e].substring(C,t).split(" ").slice(1).forEach((t=>{l.push(parseInt(t)+c)})),C=t,C=p[e].indexOf("M V30 MDLV30/STEABS ATOMS=(",C)}c+=n.natom,h+=n.nbond,f+=Math.max(...i.x)+5}const m=Math.ceil(l.length/4);u+="M V30 MDLV30/STEABS ATOMS=("+l.length+" -\n";for(let t=0;t<m;t++){u+="M V30 ";const e=t+1===m?l.length-4*(m-1):4;for(let n=0;n<e;n++)u+=n+1===e?t===m-1?l[4*t+n]+")\n":l[4*t+n]+" -\n":l[4*t+n]+" "}return n+="M V30 COUNTS "+c+" "+h+" 0 0 0\n",n+="M V30 BEGIN ATOM\n",n+=r,n+="M V30 END ATOM\n",n+="M V30 BEGIN BOND\n",n+=a,n+="M V30 END BOND\n",e&&l.length>0?(n+="M V30 BEGIN COLLECTION\n",n+=u,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,r=(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]-=r,e.y[t]-=i;const o=Math.PI,a=Math.cos(o),u=Math.sin(o);for(let t=0;t<n;t++){const n=e.x[t];e.x[t]=n*a-e.y[t]*u,e.y[t]=n*u+e.y[t]*a}const l=Math.max(...e.y);for(let t=0;t<n;t++)e.x[t]+=r,e.y[t]-=l;let c=t.indexOf("M V30 BEGIN ATOM");c=t.indexOf("\n",c);let h=c;for(let r=0;r<n;r++)c=t.indexOf("V30",c)+4,c=t.indexOf(" ",c)+1,c=t.indexOf(" ",c)+1,h=t.indexOf(" ",c)+1,h=t.indexOf(" ",h),c=(t=t.slice(0,c)+e.x[r]+" "+e.y[r]+t.slice(h)).indexOf("\n",c)+1;return t}function o(t){let e=(t=t.replaceAll("\r","")).indexOf("COUNTS")+7,n=t.indexOf(" ",e);const r=parseInt(t.substring(e,n));return e=n+1,n=t.indexOf(" ",e),{natom:r,nbond:parseInt(t.substring(e,n))}}function s(t){const e=o(t);let n=t.indexOf("M V30 BEGIN ATOM");n=t.indexOf("\n",n);let r=n;const i=Array(e.natom),s=Array(e.natom),a=Array(e.natom),u=Array(e.natom);for(let o=0;o<e.natom;o++)n=t.indexOf("V30",n)+4,r=t.indexOf(" ",n),i[o]=parseInt(t.substring(n,r)),n=r+1,r=t.indexOf(" ",n),s[o]=t.substring(n,r),n=r+1,r=t.indexOf(" ",n),a[o]=parseFloat(t.substring(n,r)),n=r+1,r=t.indexOf(" ",n),u[o]=parseFloat(t.substring(n,r)),n=t.indexOf("\n",n)+1;return{atomIndex:i,atomType:s,x:a,y:u}}n.d(e,{cx:()=>s,vS:()=>r})},537:(t,e,n)=>{"use strict";n.d(e,{iL:()=>o,q7:()=>i,ti:()=>r});const r={NUCLEOSIDE:"nucleoside",LINKAGE:"phosphateBackbone"},i="p",o="<?>"},480:(t,e,n)=>{"use strict";n.d(e,{C6:()=>h,OT:()=>f,bD:()=>l});var r=n(686),i=n(67),o=n(537),s=n(348),a=n(620),u=n(448);function l(t,e,n){const i=Object.keys(a.$D).concat([r.NO.HELM]);if(!t||-1!==e&&n!==r.NO.HELM)return{};if(!i.includes(n))throw new Error(`${n} format is not supported by SequenceTranslator`);const o=i.filter((t=>t!=n)).sort(((t,e)=>t.localeCompare(e))),l=new s.y(t,n),h=Object.fromEntries(o.map((t=>{let e;try{e=l.convertTo(t)}catch{e=null}return[t,e]})).filter((([t,e])=>e))),f=c(n===r.NO.HELM?t:h[r.NO.HELM],u.k.getInstance());return f&&(h.Nucleotides=f),h}function c(t,e){const n=new RegExp("\\([^()]*\\)","g"),i=t.match(n);return i?i.map((t=>{const n=t.replace(/[\[\]()]/g,"");return r.AL.includes(n)?n:e.getNaturalAnalogBySymbol(n)})).map((t=>t||o.iL)).join(""):null}function h(t,e,n){const o=new s.y(t,e);return n===i.qP?c(o.convertTo(r.NO.HELM),u.k.getInstance()):o.convertTo(n)}function f(){return Object.keys(a.$D).concat([r.NO.HELM,i.qP]).sort()}},348:(t,e,n)=>{"use strict";n.d(e,{y:()=>c});var r=n(686),i=n(537),o=n(620);const s=(t,e)=>e.length-t.length;class a{constructor(){this.formats=this.getFormats()}getFormatNames(){return this.formats.sort()}getCodesByFormat(t){if(this.validateFormat(t),this.isHelm(t))throw new Error("Codes cannot be obtained for HELM");return this.getFormatCodes(t)}getHelmToFormatDict(t){return this.validateFormat(t),function(t){const e={};return Object.values(t).forEach((t=>{Object.entries(t).forEach((([t,n])=>{const r=n.replace(/\)p/g,")").replace(/\]p/g,"]");void 0===e[r]?e[r]=[t]:e[r].push(t)}))})),Object.entries(e).forEach((([t,n])=>{const r=n.sort(s);e[t]=r[0]})),e}(o.$D[t])}getFormatToHelmDict(t){this.validateFormat(t);const e=o.$D[t];return Object.assign({},...Object.values(e))}getTargetFormatHelmCodes(t){this.validateFormat(t);const e=this.getHelmToFormatDict(t);return Object.keys(e).sort(s)}getTargetFormatHelmCodesRegExp(t){this.validateFormat(t);const e=this.getTargetFormatHelmCodes(t);return new RegExp(u(e)+"|.","g")}getFormatRegExp(t){if(this.validateFormat(t),this.isHelm(t))throw new Error("Helm RegExp can be built for non-HELM target formats");return this.getNonHelmFormatRegExp(t)}getPhosphateHelmCodesRegExp(t){this.validateFormat(t);const e=o.$D[t],n=u(Array.from(new Set(Object.values(e[i.ti.LINKAGE]))).sort(s));return new RegExp(`${i.q7}.(${n})`,"g")}isValidFormat(t){return this.formats.includes(t)}getFormats(){return Object.keys(o.$D)}validateFormat(t){if(!this.isValidFormat(t))throw new Error(`Invalid format: ${t}`)}isHelm(t){return t===r.NO.HELM}getFormatCodes(t){const e=this.getFormatToHelmDict(t);return Object.keys(e).sort(s)}getNonHelmFormatRegExp(t){const e=this.getCodesByFormat(t);return new RegExp(u(e)+"|\\([^()]*\\)|.","g")}}function u(t){return t.map((t=>t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"))).map((t=>t.includes("(")||t.includes(")")?t:`(?<!\\([^()]*)${t}(?![^()]*\\))`)).join("|")}const l={LEFT:"RNA1{",RIGHT:"}$$$$"};class c{constructor(t,e){this.sequence=t,this.sourceFormat=e,this.formats=new a}convertTo(t){const e=this.formats.getFormatNames();if(this.sourceFormat===r.NO.HELM&&e.includes(t))return this.helmToFormat(this.sequence,t);if(e.includes(this.sourceFormat)&&t===r.NO.HELM)return this.formatToHelm(this.sequence,this.sourceFormat);if([this.sourceFormat,t].every((t=>e.includes(t)))){const e=this.formatToHelm(this.sequence,this.sourceFormat);return this.helmToFormat(e,t)}throw new Error(`ST: unsupported translation direction ${this.sourceFormat} -> ${t}`)}helmToFormat(t,e){const n=new RegExp(u(Object.values(l)),"g");let r=t.replace(n,"");const o=this.formats.getHelmToFormatDict(e),s=this.formats.getTargetFormatHelmCodes(e),a=this.formats.getTargetFormatHelmCodesRegExp(e);return r=r.replace(a,(t=>s.includes(t)?o[t]:"p"===t||"."===t?t:"?")).replace(/\?+/g,i.iL).replace(/p\.|\./g,""),r=r.replace(/<empty>/g,""),r=r.replace(/\/\//g,"/"),r}formatToHelm(t,e){const n=this.formats.getFormatToHelmDict(e),r=this.formats.getCodesByFormat(e),o=this.formats.getFormatRegExp(e),s=this.formats.getPhosphateHelmCodesRegExp(e);let a=t.replace(o,(t=>r.includes(t)?n[t]+".":"?"));return a=a.replace(/\?+/g,`${i.iL}.`),a=a.slice(0,-1),a[a.length-1]===i.q7&&(a=a.slice(0,-1)),a=a.replace(s,((t,e)=>e)),a=a.replace(/<empty>/g,""),`${l.LEFT+a+l.RIGHT}`}}},67:(t,e,n)=>{"use strict";n.d(e,{U_:()=>i,n_:()=>r,qP:()=>o});const r="Copied",i="Copy sequence",o="Nucleotides"},416:(t,e,n)=>{"use strict";n.r(e),n.d(e,{_package:()=>Hn,createMonomerLibraryForPolyTool:()=>ir,demoOligoPattern:()=>Jn,demoOligoStructure:()=>Zn,demoTranslateSequence:()=>Xn,getCodeToWeightsMap:()=>zn,getMolfileFromGcrsSequence:()=>Kn,initSequenceTranslatorLibData:()=>Wn,linkStrands:()=>Qn,oligoPatternApp:()=>qn,oligoStructureApp:()=>Gn,oligoToolkitApp:()=>Vn,oligoTranslatorApp:()=>jn,polyTool:()=>nr,polyToolColumnChoice:()=>rr,translateOligonucleotideSequence:()=>tr,validateSequence:()=>Yn});var r=n(82),i=n.n(r),o=n(328),s=n(620),a=n(448);const u={monomerType:"Backbone",smiles:"",name:"",author:"Datagrok",molfile:"",naturalAnalog:"",rgroups:[],createDate:null,id:0,polymerType:"PEPTIDE",symbol:""},l="p",c=new RegExp(`[rd]\\((\\w)\\)${l}?`,"g");class h{constructor(t,e,n){this.name=t,this.alphabet=e,this.cutoff=n}}class f extends h{constructor(t,e,n){super(t.name,t.alphabet,t.cutoff),this.freq=e,this.similarity=n}}const d=wu;var p,g,m=n.n(d);(g=p||(p={})).FASTA="fasta",g.SEPARATOR="separator",g.HELM="helm";const v=/(?:\[([A-Za-z0-9_\-,()]+)\])|([A-Za-z\-])/g,y=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"])}}},b=[new h("PT",y.fasta.peptide,.5),new h("DNA",y.fasta.dna,.55),new h("RNA",y.fasta.rna,.55)];class A extends Float32Array{}function C(t){let e=0;for(let n=0;n<t.length;n++)e+=t[n]*t[n];return Math.sqrt(e)}class w{static makePalette(t,e=!1,n=w){const r={};return t.forEach((t=>{const n=t[0],i=t[1];n.forEach(((t,n)=>{r[t]=this.colourPalette[i][e?0:n]}))})),new n(r)}constructor(t){this._palette=t}get(t){return this._palette[t]}}w.undefinedColor="rgb(100,100,100)",w.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 x extends w{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,x)),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,x)),this.grokGroups}static get RasMol(){return void 0===this.rasMol&&(this.rasMol=new x({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 x.aaSynonyms?x.aaSynonyms[t]:t;return super.get(e)}}x.aaSynonyms={MeNle:"L",MeA:"A",MeG:"G",MeF:"F"};class _{static getPalette(t="grok"){switch(t){case"grok":return x.GrokGroups;case"lesk":return x.Lesk;default:throw new Error(`ChemPalette: scheme \`${t}\` does not exist`)}}static getInnerOuter(t){let e=0,n="",r="";for(const i of t)"("==i?e++:")"==i?e--:e?n+=i:r+=i;return isNaN(parseInt(n))?[r,n]:[r,""]}static getColorAAPivot(t="",e="grok"){const n=this.getPalette(e);let[r,i]=this.getInnerOuter(t);if(r=r.length>6?`${r.slice(0,3)}...`:r,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,r,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,r,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,r,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,r,i,4]}return[this.undefinedColor,r,i,0]}}_.SemType="Aminoacids",_.SemTypeMultipleAlignment="AminoacidsMultipleAlignment",_.undefinedColor="rgb(100,100,100)",_.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"},_.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"},_.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(*)*"},_.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 S{}S.SemType="Nucleotides",S.SemTypeMultipleAlignment="NucleotidesMultipleAlignment",S.Names={A:"Adenine",C:"Cytosine",G:"Guanine",T:"Thymine",U:"Uracil"};class E{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 T{}class I extends T{static buildPalette(){return[].concat(...Object.values(w.colourPalette))}get(t){const e=E.hashCode(t)%I.palette.length;return function(t){if(null==t)return"rgb(100,100,100)";const e=r.Color.fromHtml(t),n=r.Color.g(e),i=r.Color.r(e),o=r.Color.b(e),s=Math.sqrt(Math.pow(0-i,2)+Math.pow(0-n,2)+Math.pow(0-o,2));return s>210?`rgb(${i/s*210},${n/s*210},${o/s*210})`:r.Color.toRgb(e)}(I.palette[e])}}I.palette=I.buildPalette();class N{get length(){return this.mList.length}get canonicals(){return this.mList}get originals(){return this.mList}isGap(t){return this.getOriginal(t)===this.gapOriginalMonomer}getCanonical(t){if(this.length<=t)throw new Error("Index out of bounds");return this.mList[t]}getOriginal(t){if(this.length<=t)throw new Error("Index out of bounds");return this.mList[t]}constructor(t,e){this.mList=t,this.gapOriginalMonomer=e}}class O{get length(){return this.seqS.length}get canonicals(){return this.seqS}get originals(){return this.seqS}isGap(t){return this.getOriginal(t)===G[p.FASTA]}getCanonical(t){if(this.length<=t)throw new Error("Index out of bounds");return this.isGap(t)?"":this.seqS[t]}getOriginal(t){if(this.length<=t)throw new Error("Index out of bounds");return this.seqS[t]}constructor(t){this.seqS=t}}const L=t=>{const e=m()(t.toString().matchAll(v)).map((t=>t[2]??t[1])).toArray();return new N(e,G[p.FASTA])},M=t=>t?new O(t):new N([],G[p.FASTA]);function B(t,e=void 0){return n=>{if(n){const r=n.replaceAll('"-"',"").replaceAll("'-'","").split(t,e);return new N(r,G[p.SEPARATOR])}return new N([],G[p.SEPARATOR])}}const P=/(PEPTIDE1|DNA1|RNA1)\{([^}]+)}/g,R=/\[([^\[\]]+)]/g,F=t=>{P.lastIndex=0;const e=P.exec(t.toString()),n=e?e[2]:null,r=n?n.split("."):[];return new N(r.map((t=>{R.lastIndex=0;const e=R.exec(t);return e&&e.length>=2?e[1]:t})),G[p.HELM])};function D(t,e,n="-"){const r=e.map((e=>{const r=function(t,e,n="-"){const r=new Set([...new Set(Object.keys(t)),...e]);r.delete(n);const i=[],o=[];for(const n of r)i.push(n in t?t[n]:0),o.push(e.has(n)?1:0);const s=new A(i),a=new A(o);return function(t,e){if(t.length!=e.length)throw new Error("The dimensionality of the vectors must match");let n=0;for(let r=0;r<t.length;r++)n+=t[r]*e[r];return n}(s,a)/(C(s)*C(a))}(t,e.alphabet,n);return new f(e,t,r)}));let i;const o=Math.max(...r.map((t=>t.similarity>t.cutoff?t.similarity:-1)));return i=o>0?r.find((t=>t.similarity===o)).name:"UN",i}function U(t={}){const e=function(){if(!t||!t.scoringMatrix||!t.alphabetIndexes)return(t,e)=>t===e?0:1;if(t.scoringMatrix.length!==Object.keys(t.alphabetIndexes).length)throw new Error("Scoring matrix and alphabet indexes should have the same length");const e=t.alphabetIndexes,n=t.scoringMatrix,r=Math.min(...Object.keys(e).map((t=>t.charCodeAt(0))))+1,i=new Float32Array((n.length+r)*(n.length+r));return Object.entries(e).forEach((([t,r])=>{const o=n[r];Object.entries(e).forEach((([e,r])=>{i[t.charCodeAt(0)*n.length+e.charCodeAt(0)]=o[r]}))})),(t,e)=>1-i[t.charCodeAt(0)*n.length+e.charCodeAt(0)]}(),n=t?.threshold??0;return(t,r)=>{let i=0;const o=t.length,s=r.length,a=Math.max(o,s)*(1-n);o!==s&&(i=Math.abs(o-s));let u=0;for(let n=0;n<Math.min(o,s);n++)if(t[n]!==r[n]&&(u+=e(t[n],r[n]),u>a))return 1;return u+=i,u/=Math.max(o,s),u}}const k=new Uint32Array(65536),H={gapOpen:1,gapExtend:.6,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 V;!function(t){t.HAMMING="Hamming",t.LEVENSHTEIN="Levenshtein",t.NEEDLEMANN_WUNSCH="Needlemann-Wunsch",t.MONOMER_CHEMICAL_DISTANCE="Monomer chemical distance"}(V||(V={}));const j={[V.HAMMING]:U,[V.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,r=e.length,i=1<<n-1;let o=-1,s=0,a=n,u=n;for(;u--;)k[t.charCodeAt(u)]|=1<<u;for(u=0;u<r;u++){let t=k[e.charCodeAt(u)];const n=t|s;t|=(t&o)+o^o,s|=~(t|o),o&=t,s&i&&a++,o&i&&a--,s=s<<1|1,o=o<<1|~(n|s),s&=n}for(u=n;u--;)k[t.charCodeAt(u)]=0;return a})(t,e):((t,e)=>{const n=e.length,r=t.length,i=[],o=[],s=Math.ceil(n/32),a=Math.ceil(r/32);for(let t=0;t<s;t++)o[t]=-1,i[t]=0;let u=0;for(;u<a-1;u++){let s=0,a=-1;const l=32*u,c=Math.min(32,r)+l;for(let e=l;e<c;e++)k[t.charCodeAt(e)]|=1<<e;for(let t=0;t<n;t++){const n=k[e.charCodeAt(t)],r=o[t/32|0]>>>t&1,u=i[t/32|0]>>>t&1,l=n|s,c=((n|u)&a)+a^a|n|u;let h=s|~(c|a),f=a&c;h>>>31^r&&(o[t/32|0]^=1<<t),f>>>31^u&&(i[t/32|0]^=1<<t),h=h<<1|r,f=f<<1|u,a=f|~(l|h),s=h&l}for(let e=l;e<c;e++)k[t.charCodeAt(e)]=0}let l=0,c=-1;const h=32*u,f=Math.min(32,r-h)+h;for(let e=h;e<f;e++)k[t.charCodeAt(e)]|=1<<e;let d=r;for(let t=0;t<n;t++){const n=k[e.charCodeAt(t)],s=o[t/32|0]>>>t&1,a=i[t/32|0]>>>t&1,u=n|l,h=((n|a)&c)+c^c|n|a;let f=l|~(h|c),p=c&h;d+=f>>>r-1&1,d-=p>>>r-1&1,f>>>31^s&&(o[t/32|0]^=1<<t),p>>>31^a&&(i[t/32|0]^=1<<t),f=f<<1|s,p=p<<1|a,c=p|~(u|f),l=f&u}for(let e=h;e<f;e++)k[t.charCodeAt(e)]=0;return d})(t,e)})(t,e)/Math.max(t.length,e.length)},[V.NEEDLEMANN_WUNSCH]:function(t){const e=new Uint16Array(65536),{gapOpen:n,gapExtend:r,scoringMatrix:i,alphabetIndexes:o}={...H,...t};Object.entries(o).forEach((([t,n])=>e[t.charCodeAt(0)]=n));const s=[new Float32Array(1e4),new Float32Array(1e4)];return(t,o)=>{const a=new Array(t.length+1).fill(!1),u=new Array(t.length+1).fill(!1);let l=0,c=1;for(let e=1;e<t.length+1;e++)s[0][e]=-n-(e-1)*r,s[1][e]=0;s[0][0]=0;for(let h=1;h<o.length+1;h++){s[c][0]=-n-(h-1)*r;for(let f=1;f<t.length+1;f++){const d=s[l][f-1]+i[e[t.charCodeAt(f-1)]][e[o.charCodeAt(h-1)]],p=s[l][f]-(a[f]?r:n),g=s[c][f-1]-(u[f-1]?r:n);s[c][f]=Math.max(d,g,p),s[c][f]===d?(a[f]=!1,u[f]=!1):s[c][f]===g?(a[f]=!1,u[f]=!0):(a[f]=!0,u[f]=!1)}l=c,c=(c+1)%2}const h=Math.max(t.length,o.length);return(h-s[l][t.length])/h}},[V.MONOMER_CHEMICAL_DISTANCE]:U},q=new class{constructor(){this.seqHandler="seq-handler",this.notationProvider="seq-handler.notation-provider"}},G={[p.FASTA]:"-",[p.SEPARATOR]:"",[p.HELM]:"*"};class W{constructor(t){if(this._splitter=null,this.cached=!0,this._splitted=null,this.columnVersion=null,this._stats=null,this._maxLength=null,this._posList=null,this._joiner=void 0,t.type!==r.TYPE.STRING)throw new Error(`Unexpected column type '${t.type}', must be '${r.TYPE.STRING}'.`);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._defaultGapOriginal=this.isFasta()?G[p.FASTA]:this.isHelm()?G[p.HELM]:G[p.SEPARATOR],!this.column.tags.has("aligned")||!this.column.tags.has("alphabet")||!this.column.tags.has(".alphabetIsMultichar")&&!this.isHelm()&&"UN"===this.alphabet)if(this.isFasta())W.setUnitsToFastaColumn(this);else if(this.isSeparator()){const e=t.getTag("separator");W.setUnitsToSeparatorColumn(this,e)}else{if(!this.isHelm())throw new Error(`Unexpected units '${this.column.getTag(r.TAGS.UNITS)}'.`);W.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.`);this.notationProvider=this.column.temp[q.notationProvider]??null,this.columnVersion=this.column.version}static setUnitsToFastaColumn(t){if(t.column.semType!==r.SEMTYPE.MACROMOLECULE||t.column.getTag(r.TAGS.UNITS)!==p.FASTA)throw new Error(`The column of notation '${p.FASTA}' must be '${r.SEMTYPE.MACROMOLECULE}'.`);t.column.setTag(r.TAGS.UNITS,p.FASTA),W.setTags(t)}static setUnitsToSeparatorColumn(t,e){if(t.column.semType!==r.SEMTYPE.MACROMOLECULE||t.column.getTag(r.TAGS.UNITS)!==p.SEPARATOR)throw new Error(`The column of notation '${p.SEPARATOR}' must be '${r.SEMTYPE.MACROMOLECULE}'.`);if(!e)throw new Error(`The column of notation '${p.SEPARATOR}' must have the separator tag.`);t.column.setTag(r.TAGS.UNITS,p.SEPARATOR),t.column.setTag("separator",e),W.setTags(t)}static setUnitsToHelmColumn(t){if(t.column.semType!==r.SEMTYPE.MACROMOLECULE)throw new Error(`The column of notation '${p.HELM}' must be '${r.SEMTYPE.MACROMOLECULE}'`);t.column.setTag(r.TAGS.UNITS,p.HELM),W.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)),[p.FASTA,p.SEPARATOR].includes(e)){if(!t.column.getTag("alphabet")&&0===Object.keys(n.freq).length)throw new Error("Alphabet is empty and not annotated.");let e=t.column.getTag("aligned");null===e&&(e=n.sameLength?"SEQ.MSA":"SEQ",t.column.setTag("aligned",e));let r=t.column.getTag("alphabet");if(null===r&&(r=D(n.freq,b),t.column.setTag("alphabet",r)),"UN"===r){const e=Object.keys(n.freq).length,r=Object.keys(n.freq).some((t=>t.length>1));t.column.setTag(".alphabetSize",e.toString()),t.column.setTag(".alphabetIsMultichar",r?"true":"false")}}}get column(){return this._column}get length(){return this._column.length}get units(){return this._units}get notation(){return this._notation}get defaultGapOriginal(){return this._defaultGapOriginal}get separator(){const t=this.column.getTag("separator")??void 0;if(this.notation===p.SEPARATOR&&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(this.notation==p.HELM||"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 this.notation===p.HELM||"UN"===this.alphabet&&"true"===this.column.getTag(".alphabetIsMultichar")}getSplitted(t){if(this.cached){this.column.version===this.columnVersion&&null!==this._splitted||(this.columnVersion=this.column.version,this._splitted=new Array(this.column.length));let e=this._splitted[t]?this._splitted[t].deref():void 0;if(!e){const n=this.column.get(t);e=this.splitter(n),this._splitted[t]=new WeakRef(e)}return e}{const e=this.column.get(t);return this.splitter(e)}}get stats(){if(null===this._stats){const t={};let e=!0,n=null;const r=this.column.length;for(let i=0;i<r;++i){const r=this.getSplitted(i);null==n?n=r.length:r.length!==n&&(e=!1);for(const e of r.canonicals)e in t||(t[e]=0),t[e]+=1}this._stats={freq:t,sameLength:e}}return this._stats}get maxLength(){return null===this._maxLength&&(this._maxLength=0===this.column.length?0:Math.max(...m().count(0).take(this.column.length).map((t=>this.getSplitted(t).length)))),this._maxLength}get posList(){if(null===this._posList){const t=this.column.getTag(".positionNames");this._posList=t?t.split(", ").map((t=>t.trim())):m().count(1).take(this.maxLength).map((t=>t.toString())).toArray()}return this._posList}isFasta(){return this.notation===p.FASTA}isSeparator(){return this.notation===p.SEPARATOR}isHelm(){return this.notation===p.HELM}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}isGap(t){return!t||t===this._defaultGapOriginal}getNotation(){if(this.units.toLowerCase().startsWith(p.FASTA))return p.FASTA;if(this.units.toLowerCase().startsWith(p.SEPARATOR))return p.SEPARATOR;if(this.units.toLowerCase().startsWith(p.HELM))return p.HELM;throw new Error(`Column '${this.column.name}' has unexpected notation '${this.units}'.`)}getHelmWrappers(){return[this.isDna()||this.isRna()||this.isHelmCompatible()?"RNA1{":"PEPTIDE1{",this.isDna()?"d(":this.isRna()?"r(":"",this.isDna()||this.isRna()?")p":"","}$$$$"]}getNewColumn(t,e,n,i){const o=this.column,s=t.toLowerCase()+"("+o.name+")",a=n??o.dataFrame.columns.getUnusedName(s),u=r.Column.fromList("string",a,i??new Array(this.column.length).fill(""));if(u.semType=r.SEMTYPE.MACROMOLECULE,u.setTag(r.TAGS.UNITS,t),t===p.SEPARATOR){if(!e)throw new Error(`Notation '${p.SEPARATOR}' requires separator value.`);u.setTag("separator",e)}u.setTag(r.TAGS.CELL_RENDERER,"sequence");const l=o.getTag("aligned");l&&u.setTag("aligned",l);let c=o.getTag("alphabet");c||this.notation!==p.HELM||t===p.HELM||(c="UN"),null!=c&&u.setTag("alphabet",c);let h=o.getTag(".alphabetSize");null!=c&&h&&u.setTag(".alphabetSize",h);const f=o.getTag(".alphabetIsMultichar");return null!=c&&void 0!==f&&u.setTag(".alphabetIsMultichar",f),t==p.HELM&&(h=this.getAlphabetSize().toString(),u.setTag(".alphabetSize",h)),u}getNewColumnFromList(t,e){return this.getNewColumn(this.notation,this.separator,t,e)}static getNewColumn(t){const e=W.forColumn(t),n=e.notation;return e.getNewColumn(n)}static unitsStringIsValid(t){return t=t.toLowerCase(),[p.FASTA,p.SEPARATOR,p.HELM].some((e=>t.startsWith(e.toLowerCase())))}static getNewColumnFromParams(t,e,n){if(!W.unitsStringIsValid(n))throw new Error("Invalid format of 'units' parameter");const i=r.Column.fromList("string",e,new Array(t).fill(""));return i.semType=r.SEMTYPE.MACROMOLECULE,i.setTag(r.TAGS.UNITS,n),i}getSplitter(t){let e=null;if(e=this.notationProvider?this.notationProvider.splitter:null,e)return e;if(this.units.toLowerCase().startsWith(p.FASTA))return null===this.column.getTag("alphabet")||this.getAlphabetIsMultichar()?L:M;if(this.units.toLowerCase().startsWith(p.SEPARATOR))return B(this.separator,t);if(this.units.toLowerCase().startsWith(p.HELM))return F;throw new Error(`Unexpected units ${this.units} .`)}split(t){return this.splitter(t)}getDistanceFunctionName(){if(!this.isFasta())throw new Error("Only FASTA notation is supported");return this.isMsa()?V.HAMMING:(this.alphabet,V.LEVENSHTEIN)}getDistanceFunction(){return j[this.getDistanceFunctionName()]()}async checkHelmCompatibility(){if(this.column.tags.has(".isHelmCompatible"))return"true"===this.column.getTag(".isHelmCompatible");const t=(await rt()).getBioLib().getMonomerSymbolsByType("PEPTIDE".toString()),e=new Set(t),n=(B(this.separator),new Set),r=this.column.length,i=this.column.getRawData();for(let t=0;t<r;++t){const r=i[t];if(!(r in n)){n.add(r);const i=this.getSplitted(t);for(const t of i.canonicals)if(!e.has(t))return this.column.setTag(".isHelmCompatible","false"),!1}}return this.column.setTag(".isHelmCompatible","true"),!0}get splitter(){return null===this._splitter&&(this._splitter=this.getSplitter()),this._splitter}toFasta(t){return t===p.FASTA}toSeparator(t){return t===p.SEPARATOR}toHelm(t){return t===p.HELM}convertHelmToFastaSeparator(t,e,n,r){r||(r=this.toFasta(e)?G[p.FASTA]:G[p.SEPARATOR]),n||(n=this.toFasta(e)?"":this.separator);const i=t.startsWith("RNA"),o=this.splitter(t),s=[];for(let t=0;t<o.length;++t){let n=o.getOriginal(t);if(i&&(n=n.replace(c,"")),n===G[p.HELM])s.push(r);else if(this.toFasta(e)&&n.length>1){const t="["+n+"]";s.push(t)}else s.push(n)}return s.join(n)}convert(t,e){const n=this.getJoiner({notation:t,separator:e}),r=this.getNewColumn(t,e);return r.init((t=>{const e=this.getSplitted(t);return n(e)})),r}getRegion(t,e,n){const r=this.getNewColumn(this.notation,this.separator);r.name=n;const i=t??0,o=e??this.maxLength-1,s=this.getJoiner(),a=o-i+1,u=G[this.notation];r.init((t=>{const e=this.getSplitted(t),n=new Array(a);for(let t=0;t<a;++t){const r=i+t;n[t]=r<e.length?e.getOriginal(r):u}return s(new N(n,u))}));const l=t=>{const e=t.split(",").map((t=>t.trim())),n=new Array(a);for(let t=0;t<a;++t){const r=i+t;n[t]=r<e.length?e[r]:"?"}return n.join(", ")},c=this.column.getTag(".positionNames");c&&r.setTag(".positionNames",l(c));const h=this.column.getTag(".positionLabels");return h&&r.setTag(".positionLabels",l(h)),r}get joiner(){return this._joiner||(this._joiner=this.getJoiner()),this._joiner}getJoiner(t){const e=t?t.notation:this.notation,n=t?t.separator:this.separator;let r;const i=this;switch(e){case p.FASTA:r=function(t){return i.joinToFasta(t,i.isHelm())};break;case p.SEPARATOR:if(!n)throw new Error(`Separator is mandatory for notation '${e}'.`);r=function(t){return z(t,n,i.isHelm())};break;case p.HELM:{const t="DNA"===i.alphabet||"RNA"===i.alphabet,e=i.getHelmWrappers();r=function(n){return Y(n,e,t)};break}default:throw new Error(`Unexpected notation '${e}'.`)}return r}getConverter(t,e=void 0){if(t===p.SEPARATOR&&!e)throw new Error(`Target separator is not specified for target units '${p.SEPARATOR}'.`);const n=this;if(t===p.FASTA)return function(t){return n.convertToFasta(t)};if(t===p.HELM)return function(t){return n.convertToHelm(t)};if(t===p.SEPARATOR)return function(t){return n.convertToSeparator(t,e)};throw new Error}static forColumn(t){let e=t.temp[q.seqHandler];return e&&e.columnVersion===t.version||(e=t.temp[q.seqHandler]=new W(t)),e}joinToFasta(t,e){const n=new Array(t.length);for(let r=0;r<t.length;++r){const i=t.getOriginal(r);let o=t.getOriginal(r);e&&(o=o.replace(c,"$1")),""===i?o=G[p.FASTA]:i===l?o="":o.length>1&&(o="["+o+"]"),n[r]=o}return n.join("")}convertToFasta(t){const e=this.splitter,n=this.isHelm()?this.splitterAsHelmNucl(t):e(t);return this.joinToFasta(n,this.isHelm())}convertToSeparator(t,e){return z(this.isHelm()?this.splitterAsHelmNucl(t):this.splitter(t),e,this.isHelm())}convertToHelm(t){const e=this.getHelmWrappers(),n=t.startsWith("DNA")||t.startsWith("RNA");return Y(this.splitter(t),e,n)}splitterAsHelmNucl(t){const e=this.splitter(t),n=new Array(e.length),r=t.startsWith("DNA"),i=t.startsWith("RNA");for(let t=0;t<e.length;++t){let o=e.getOriginal(t);(r||i)&&(o=o.replace(c,"$1"),o=o===l?null:o),n[t]=o||null}return new N(n.filter((t=>!!t)),G[p.HELM])}}function z(t,e,n){const r=new Array(t.length);for(let e=0;e<t.length;++e){const i=t.getCanonical(e);let o=t.getOriginal(e);n&&(o=o.replace(c,"$1")),""===i?o=G[p.SEPARATOR]:i===l&&(o=""),r[e]=o}return r.join(e)}function Y(t,e,n){const[r,i,o,s]=e,a=new Array(t.length);for(let e=0;e<t.length;++e){const r=t.getCanonical(e);let s=t.getOriginal(e);""===r?s=G[p.HELM]:(n&&(s=s.replace(c,"$1")),s=1===s.length?`${i}${s}${o}`:`${i}[${s}]${o}`),a[e]=s}return`${r}${a.join(".")}${s}`}class K{constructor(t,e=!1){if(this._length=0,this._version=0,this._updateLevel=0,this._selectedCount=0,this._selectedCountVersion=-1,this._selectedIndexesVersion=-1,this._versionedName="",this._versionedNameVersion=-1,this.SHRINK_THRESHOLD=256,"number"==typeof t){const n=t,r=K._createBuffer(n);if(e)for(let t=0;t<r.length;t++)r[t]=-1;this._data=r,this._length=n}else{if(!(t instanceof Uint32Array))throw new Error("Invalid constructor");this._data=t,this._length=e}}getRawData(){return this._data}assureGoez(t,e){if(t<0)throw new Error(`${e} should be greater than zero`)}assureInRange(t,e,n,r){if(t<e||t>n)throw new Error(`Argument ${r} (${t}) out of range (${e}, ${n})`)}copy(t,e,n){for(let r=0;r<n;r++)e[r]=t[r]}copyFrom(t){if(this._length!=t._length)throw new Error(`Lengths differ (${this._length} != ${t._length})`);this.copy(t._data,this._data,this.lengthInInts),this._version++}get length(){return this._length}get buffer(){return this._data}set buffer(t){this._data=t,this._version++}get version(){return this._version}set version(t){this._version=t}incrementVersion(t=!0){this._version++}get lengthInInts(){return Math.floor((this._length+31)/32)}get versionedName(){return this._version==this._versionedNameVersion?this._versionedName:""}set versionedName(t){this._versionedName=t,this._versionedNameVersion=this._version}get self(){return this}setLength(t){if(t<0)throw new Error("should be >= 0");if(t==this._length)return;const e=Math.floor((t+31)/32);if(e>this._data.length||e+this.SHRINK_THRESHOLD<this._data.length){const t=new Uint32Array(e);this.copy(this._data,t,e>this._data.length?this._data.length:e),this._data=t}t>this._length&&(this._length%32>0&&(this._data[this.lengthInInts-1]&=(1<<(this._length%32&31))-1),this._data.fill(0,this.lengthInInts,e)),this._length=t,this._version++}static fromAnd(t,e){if(t._length!=e._length)throw new Error(`Lengths differ (${t._length} != ${e._length})`);const n=new K(t._length);n._length=t._length,n._data=K._createBuffer(n._length),n._version=0;const r=t.lengthInInts;for(let i=0;i<r;i++)n._data[i]=t._data[i]&e._data[i];return n}static _createBuffer(t){return new Uint32Array(Math.floor((t+31)/32))}static fromValues(t){const e=new K(t.length);e._version=0;for(let n=0;n<e._length;n++)t[n]&&(e._data[Math.floor(n/32)]|=1<<(n%32&31));return e}static fromSeq(t,e){const n=new K(t);for(let r=0;r<t;++r)n.setBit(r,e(r));return n._version=0,n}static fromString(t){return K.fromSeq(t.length,(e=>"1"==t.charAt(e)))}static fromUint32Array(t,e){const n=new K(t);return n._data=e,n}static fromBytes(t){const e=t.length,n=new K(8*e);n._data=new Uint32Array(Math.floor((e+3)/4)),n._length=8*e;let r=0,i=0;for(;e-i>=4;)n._data[r++]=255&t[i]|(255&t[i+1])<<8|(255&t[i+2])<<16|(255&t[i+3])<<24,i+=4;return e-i==3&&(n._data[r]=(255&t[i+2])<<16),e-i==2&&(n._data[r]|=(255&t[i+1])<<8),e-i==1&&(n._data[r]|=255&t[i]),n._version=0,n}toString(){return`${this._length} bits, ${this.countBits(!0)} set`}equals(t){if(this==t)return!0;if(null==t)return!1;if(this._length!=t._length)return!1;if(0==this._length)return!0;for(let e=0;e<this._data.length-1;e++)if(this._data[e]!=t._data[e])return!1;for(let e=8*(this._data.length-1);e<this._length;e++)if(this.getBit(e)!=t.getBit(e))return!1;return!0}clone(){const t=new K(0,!1);return t._data=Uint32Array.from(this._data),t._length=this._length,t._version=this._version,t}init(t,e){this.setAll(!1,!1);for(let e=0;e<this._length;e++)t(e)&&(this._data[Math.floor(e/32)]|=1<<(e%32&31));return this.incrementVersion(e),this}invert(t=!0){for(let t=0;t<this._data.length;t++)this._data[t]^=-1;this.incrementVersion(t)}setAll(t,e=!1){const n=t?-1:0,r=this.lengthInInts;for(let t=0;t<r;t++)this._data[t]=n;this.incrementVersion(e)}setIndexes(t,e=!0,n=!0,r=!0){n&&this.setAll(!e,!1);for(const n of t)this.setFast(n,e);this.incrementVersion(r)}everyIndex(t,e=!0){for(const n of t)if(this.getBit(n)!=e)return!1;return!0}anyIndex(t,e=!0){for(const n of t)if(this.getBit(n)==e)return!0;return!1}setWhere(t,e=!0,n=!0,r=!0,i=!0){if(n&&i&&this.setAll(!e,!1),i)for(let n=0;n<this._length;n++)t(n)&&this.setFast(n,e);else for(let n=0;n<this._length;n++)this.setFast(n,t(n)?e:!e);this.incrementVersion(r)}getRange(t,e){this.assureInRange(t,0,this._length-1,"from"),this.assureInRange(e,0,this._length,"to");const n=[];for(let r=t;r<e;++r)n.push(this.getBit(r));return K.fromValues(n)}getRangeAsList(t,e){this.assureInRange(t,0,this._length-1,"from"),this.assureInRange(e,0,this._length,"to");const n=[];for(let r=t;r<e;++r)n.push(this.getBit(r));return n}setRange(t,e,n,r=!0){this.assureInRange(t,0,this._length-1,"from"),this.assureInRange(e,0,this._length-1,"to");const i=Math.min(t,e),o=Math.max(t,e);if(n)for(let t=i;t<=o;t++)this.setTrue(t);else for(let t=i;t<=o;t++)this.setFalse(t);return this.incrementVersion(r),this}setRandom(t,e,n=!0){if(t<0||t>this._length)throw new Error("n must be >= 0 && <= Count");t>this._length/2&&this.setRandom(this._length-t,!e),this.setAll(!e);for(let n=0;n<t;){const t=Math.floor(Math.random()*this._length);this.getBit(t)!=e&&(this.setFast(t,e),n++)}this.incrementVersion(n)}and(t,e=!0){if(this._length!=t._length)throw new Error("Array lengths differ.");for(let e=0,n=this.lengthInInts;e<n;e++)this._data[e]&=t._data[e];return this.incrementVersion(e),this}andNot(t,e=!0){if(this._length!=t._length)throw new Error("Array lengths differ.");const n=this.lengthInInts;for(let e=0;e<n;e++)this._data[e]&=~t._data[e];return this.incrementVersion(e),this}notAnd(t,e=!0){if(this._length!=t._length)throw new Error("Array lengths differ.");for(let e=0,n=this.lengthInInts;e<n;e++)this._data[e]=~this._data[e]&t._data[e];return this.incrementVersion(e),this}not(t=!0){for(let t=0,e=this.lengthInInts;t<e;t++)this._data[t]=~this._data[t];return this.incrementVersion(t),this}or(t,e=!0){if(this._length!=t._length)throw new Error("Array lengths differ.");for(let e=0,n=this.lengthInInts;e<n;e++)this._data[e]|=t._data[e];return this.incrementVersion(e),this}xor(t,e=!0){if(this._length!=t._length)throw new Error("Array lengths differ.");for(let e=0,n=this.lengthInInts;e<n;e++)this._data[e]^=t._data[e];return this.incrementVersion(e),this}insertAt(t,e,n=!1){if(this.assureInRange(t,0,this._length,"pos"),0==e)return;const r=this._length;this.setLength(this._length+e);for(let n=r-1;n>=t;n--)this.setBit(n+e,this.getBit(n));for(let r=t;r<t+e;r++)this.setBit(r,n)}removeAt(t,e=1){if(e<0)throw new Error("n cannot be negative");if(this.assureInRange(t,0,this._length-e,"pos"),this.contains(!0))for(let n=t;n<this._length-e;n++)this.setBit(n,this.getBit(n+e));this.setLength(this._length-e)}removeByMask(t,e=!0){if(this._length!=t.length)throw new Error("length != mask.length");if(t==this)this.setLength(t.countBits(!e)),this.setAll(!e);else{let n=0;for(let r=-1;-1!=(r=t.findNext(r,!e));)this.setFast(n++,this.getBit(r));this._length=n,this._version++}return this}getBit(t){return!!(this._data[Math.floor(t/32)]&1<<(31&t))}setBit(t,e,n=!0){this.setFast(t,e),this._version++}setFast(t,e){e?this._data[Math.floor(t/32)]|=1<<(31&t):this._data[Math.floor(t/32)]&=~(1<<(31&t))}setTrue(t){this._data[Math.floor(t/32)]|=1<<(31&t)}setFalse(t){this._data[Math.floor(t/32)]&=~(1<<(31&t))}trueCount(){return this.countBits(!0)}falseCount(){return this.countBits(!1)}countBits(t){if(0==this._length)return 0;if(this._selectedCountVersion!=this._version){this._selectedCount=0;const t=this.lengthInInts;let e=0;for(;e<t-1;e++)for(let t=this._data[e];0!=t;t>>>=8)this._selectedCount+=K._onBitCount[255&t];let n=this._data[e];const r=31&this._length;for(0!=r&&(n&=~(4294967295<<r));0!=n;n>>>=8)this._selectedCount+=K._onBitCount[255&n];this._selectedCountVersion=this._version}return t?this._selectedCount:this._length-this._selectedCount}countWhere(t){let e=0;if(this.trueCount()==this._length)for(let n=0;n<this._length;n++)e+=t(n)?1:0;else for(let n=-1;-1!=(n=this.findNext(n,!0));)e+=t(n)?1:0;return e}andWithCountBits(t,e){if(0==this._length)return 0;let n=0;const r=this.lengthInInts;let i=0;for(;i<r-1;i++)for(let e=this._data[i]&t._data[i];0!=e;e>>>=8)n+=K._onBitCount[255&e];let o=this._data[i]&t._data[i];const s=31&this._length;for(0!=s&&(o&=~(4294967295<<s));0!=o;o>>>=8)n+=K._onBitCount[255&o];return e?n:this._length-n}clear(){this.setLength(0)}contains(t){return this.findNext(-1,t)>=0}get allTrue(){return this.countBits(!0)==this._length}get allFalse(){return this.countBits(!1)==this._length}get anyTrue(){return this.countBits(!0)>0}get anyFalse(){return this.countBits(!1)>0}findNext(t,e=!0){if(this.assureInRange(t,-1,this._length,"index"),t>=this._length-1)return-1;let n=31&(t=t<0?0:t+1);const r=this.lengthInInts;for(let i=Math.floor(t/32);i<r;i++){let r=e?this._data[i]:~this._data[i];if(0!=n)r&=4294967295<<n&4294967295,n=0;else if(!e&&-4294967296==r)continue;for(let e=0;0!=r;e+=8,r>>>=8){const n=K._firstOnBit[255&r];if(n>=0)return(t=n+32*i+e)>=this._length?-1:t}}return-1}findPrev(t,e=!0){if(0==t)return-1;this.assureInRange(t,-1,this._length,"index");let n=1+(t=t<0?this._length-1:t-1)&31;for(let r=Math.floor(t/32);r>=0;r--){let t=e?this._data[r]:~this._data[r];0!=n&&(t&=~(4294967295<<n),n=0);for(let e=24;0!=t;e-=8,t<<=8){const n=K._lastOnBit[t>>>24];if(n>=0)return n+32*r+e}}return-1}}var Q,X,J,Z,tt,et,nt;async function rt(){const t=r.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()}K._onBitCount=Int8Array.from([0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4,1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7,1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7,3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7,4,5,5,6,5,6,6,7,5,6,6,7,6,7,7,8]),K._firstOnBit=Int8Array.from([-1,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,6,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,7,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,6,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0]),K._lastOnBit=Int8Array.from([-1,0,1,1,2,2,2,2,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7]),function(t){t.Levenshtein="Levenshtein",t.JaroWinkler="Jaro-Winkler",t.Manhattan="Manhattan",t.Onehot="One-Hot"}(Q||(Q={})),function(t){t.Euclidean="Euclidean"}(X||(X={})),function(t){t.Tanimoto="Tanimoto",t.Dice="Dice",t.Asymmetric="Asymmetric",t.BraunBlanquet="Braun-Blanquet",t.Cosine="Cosine",t.Kulczynski="Kulczynski",t.McConnaughey="Mc-Connaughey",t.RogotGoldberg="Rogot-Goldberg",t.Russel="Russel",t.Sokal="Sokal",t.Hamming="Hamming",t.Euclidean="Euclidean"}(J||(J={})),function(t){t.TanimotoIntArray="TanimotoIntArray"}(Z||(Z={})),function(t){t.Vector="Vector",t.String="String",t.BitArray="BitArray",t.MacroMolecule="MacroMolecule",t.Number="Number",t.IntArray="IntArray",t.NumberArray="NumberArray"}(tt||(tt={})),function(t){t.Difference="Difference"}(et||(et={})),function(t){t.CommonItems="Common Items"}(nt||(nt={})),J.Tanimoto,J.Dice,J.Asymmetric,J.BraunBlanquet,J.Cosine,J.Kulczynski,J.McConnaughey,J.RogotGoldberg,J.Russel,J.Sokal,J.Hamming,J.Euclidean,J.Tanimoto,J.Dice,J.Asymmetric,J.BraunBlanquet,J.Cosine,J.Kulczynski,J.McConnaughey,J.RogotGoldberg,J.Russel,J.Sokal,J.Hamming,J.Euclidean,J.Tanimoto,J.Dice,J.Cosine,J.Tanimoto,J.Asymmetric,J.Cosine,J.Sokal,V.HAMMING,V.LEVENSHTEIN,V.MONOMER_CHEMICAL_DISTANCE,V.NEEDLEMANN_WUNSCH;var it=n(373),ot=n(124);class st extends r.Package{get monomerLib(){if(!this._monomerLib)throw new Error("Monomer lib not loaded");return this._monomerLib}async initMonomerLib(){if(void 0!==this._monomerLib)return;const t=r.TaskBarProgressIndicator.create("Initializing Oligo Toolkit monomer library ...");await(0,ot.TX)((async()=>{const t=await rt();this._monomerLib=await t.readLibrary(it.so,it.c6)}),(()=>t.close()))}}var at=n(686),ut=n(838);class lt{constructor(t){this.sequence=t,this.libWrapper=a.k.getInstance(),this.formats=Object.keys(s.$D)}getFormat(){if(this.sequence.startsWith("RNA"))return at.NO.HELM;const t=this.getListOfPossibleSynthesizersByFirstMatchedCode();if(0===t.length)return null;const e=new ut.q(this.sequence),n=Array(t.length).fill(0);for(let r=0;r<t.length;++r){const i=t[r];n[r]=e.getInvalidCodeIndex(i)}const r=n.some((t=>-1===t))?-1:Math.max(...n);return t[n.indexOf(r)]}getListOfPossibleSynthesizersByFirstMatchedCode(){const t=this.sequence,e=[];for(const n of this.formats){const r=(0,ot.iD)(this.libWrapper.getCodesByFormat(n));let i=0;for(let e=0;e<t.length;e++)if(")"===t[e]&&e!==t.length-1){i=e+1;break}r.some((e=>e===t.slice(i,i+e.length)))&&e.push(n)}return e}}const ct=ui;class ht{constructor(t,e){this.appName=t,this.parentAppName=e}async getAppView(){const t=r.TaskBarProgressIndicator.create(`Loading ${this.appName}...`),e=o.shell.v?.root;e&&ct.setUpdateIndicator(e,!0);try{return await this.constructView()}finally{t.close(),e&&ct.setUpdateIndicator(e,!1)}}}class ft extends ht{constructor(t){super(t),this.view=r.View.create(),this.configureView()}async constructView(){await this.initView();const t=this.parentAppName?this.parentAppName+"/"+this.appName:this.appName;return this.view.path=`/apps/${Hn.name}/${t.replace(/\s/g,"")}/`,this.view}async initView(){const t=await this.getContent();this.view.append(t)}configureView(){this.view.box=!0,this.view.name=this.appName;const t=o.shell.windows;t.showProperties=!1,t.showToolbox=!1,t.showHelp=!1}getView(){return this.view}}const dt=["SS","AS"],pt={SS:"Sense strand",AS:"Anti sense"},gt=[0,1],mt=["3'","5'"],vt={SS:{0:"3'",1:"5'"},AS:{0:"5'",1:"3'"}},yt="OligoToolkit";var bt,At,Ct;!function(t){t.IS_ANTISENSE_STRAND_INCLUDED="isAntisenseStrandIncluded",t.NUCLEOTIDE_SEQUENCES="nucleotideSequences",t.PHOSPHOROTHIOATE_LINKAGE_FLAGS="phosphorothioateLinkageFlags",t.STRAND_TERMINUS_MODIFICATIONS="strandTerminusModifications"}(bt||(bt={})),function(t){t.PATTERN_NAME="patternName",t.PATTERN_COMMENT="patternComment",t.NUCLEOTIDES_WITH_NUMERIC_LABELS="nucleotidesWithNumericLabels"}(At||(At={})),function(t){t.PATTERN_CONFIG="patternConfig",t.AUTHOR_ID="authorID"}(Ct||(Ct={}));const wt=[bt.IS_ANTISENSE_STRAND_INCLUDED,bt.NUCLEOTIDE_SEQUENCES,bt.PHOSPHOROTHIOATE_LINKAGE_FLAGS,bt.STRAND_TERMINUS_MODIFICATIONS],xt=(At.PATTERN_NAME,At.PATTERN_COMMENT,At.NUCLEOTIDES_WITH_NUMERIC_LABELS,Ct.PATTERN_CONFIG,Ct.AUTHOR_ID,{patternConfig:{patternName:"<default example>",isAntisenseStrandIncluded:!0,nucleotideSequences:{SS:["RNA","RNA","RNA","RNA","RNA","RNA","RNA","RNA","RNA","RNA","RNA","RNA","RNA","RNA","RNA","RNA","RNA","RNA","RNA","RNA","RNA","RNA","RNA"],AS:["RNA","RNA","RNA","RNA","RNA","RNA","RNA","RNA","RNA","RNA","RNA","RNA","RNA","RNA","RNA","RNA","RNA","RNA","RNA","RNA","RNA","RNA","RNA"]},phosphorothioateLinkageFlags:{SS:[!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0],AS:[!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0]},strandTerminusModifications:{SS:{"3'":"","5'":""},AS:{"3'":"","5'":""}},patternComment:"",nucleotidesWithNumericLabels:["RNA"]},authorID:""});class _t extends Error{constructor(t){super(t),this.name="PatternNameExistsError"}}class St extends Error{constructor(t){super(t),this.name="PatternExistsError"}}var Et=n(802),Tt=n.n(Et);class It{constructor(){this.otherUsersPatternNameToHash=new Map,this.currentUserPatternNameToHash=new Map}static async getInstance(){const t=new It;t.currentUserName=await t.fetchCurrentUserName(),t.currentUserId=await t.fetchCurrentUserId();const e=await t.fetchPatterns();return await t.initializePatternMaps(e),t}getCurrentUserPatternNames(){return Array.from(this.currentUserPatternNameToHash.keys()).sort(((t,e)=>t.toLowerCase().localeCompare(e.toLowerCase())))}getOtherUsersPatternNames(){return Array.from(this.otherUsersPatternNameToHash.keys()).sort(((t,e)=>t.toLowerCase().localeCompare(e.toLowerCase())))}getCurrentUserName(){return this.currentUserName}validatePatternNameUniqueness(t){if(this.currentUserPatternNameToHash.has(t))throw new _t(`Pattern with name ${t} already exists`)}validatePatternUniqueness(t){if(Array.from(this.currentUserPatternNameToHash.values()).concat(Array.from(this.otherUsersPatternNameToHash.values())).includes(t))throw new St(t)}getPatternHash(t,e){const n=e?this.currentUserPatternNameToHash.get(t):this.otherUsersPatternNameToHash.get(t);if(void 0===n)throw new Error(`Pattern with name ${t} not found`);return n}async getPatternRecord(t){if(null===t||""===t)return null;try{const e=await o.dapi.userDataStorage.getValue(yt,t,!1);return JSON.parse(e)}catch{return null}}async getPatternConfig(t){if(""===t||null===t)return null;const e=await this.getPatternRecord(t);return null===e?null:e[Ct.PATTERN_CONFIG]}getDefaultPatternRecord(){const t=xt;return t[Ct.AUTHOR_ID]=this.currentUserId,t}getDefaultPatternConfig(){return xt[Ct.PATTERN_CONFIG]}getAuthorCategoryByHash(t){if(this.isCurrentUserPattern(t))return this.getCurrentUserAuthorshipCategory();if(this.isOtherUserPattern(t))return this.getOtherUsersAuthorshipCategory();throw new Error(`Pattern with hash ${t} not found`)}isCurrentUserPattern(t){return Array.from(this.currentUserPatternNameToHash.values()).includes(t)}isOtherUserPattern(t){return Array.from(this.otherUsersPatternNameToHash.values()).includes(t)}getPatternNameByHash(t){const e=[this.currentUserPatternNameToHash,this.otherUsersPatternNameToHash];for(const n of e)for(const[e,r]of n.entries())if(r===t)return e;throw new Error(`Pattern with hash ${t} not found`)}getHashOfPatternToBeLoadedAfterDeletion(){const t=this.getCurrentUserPatternNames()[0];if(!t)throw new Error("Cannot load pattern after deletion, as there are no patterns left");const e=this.currentUserPatternNameToHash.get(t);if(void 0===e)throw new Error(`Pattern with name ${t} not found`);return e}async getRecordFromPattern(t){const e={[Ct.PATTERN_CONFIG]:t,[Ct.AUTHOR_ID]:await o.dapi.users.current().then((t=>t.id))};return JSON.stringify(e)}getHash(t){const e=wt.reduce(((e,n)=>(e[n]=t[n],e)),{});return Tt().sha1(e)}async savePatternToUserStorage(t){const e=t.getPatternConfig();try{const n=this.getHash(e);this.validatePatternUniqueness(n);const r=e[At.PATTERN_NAME];this.validatePatternNameUniqueness(r);const i=await this.getRecordFromPattern(e);await o.dapi.userDataStorage.postValue(yt,n,i,!1),this.currentUserPatternNameToHash.set(r,n),t.selectAuthor(this.getCurrentUserAuthorshipCategory()),t.updatePatternList()}catch(t){if(t instanceof _t||t instanceof St)throw t;console.error("Error while saving pattern to user storage",t)}}async overwritePatternInUserStorage(t){const e=t.getPatternConfig(),n=this.getHash(e),r=e[At.PATTERN_NAME],i=await this.getRecordFromPattern(e);await o.dapi.userDataStorage.postValue(yt,n,i,!1),this.currentUserPatternNameToHash.set(r,n),t.updatePatternList()}async deletePattern(t,e){const n=this.currentUserPatternNameToHash.get(t);if(t===this.getDefaultPatternName())return void o.shell.warning("Cannot delete default pattern");if(void 0===n)throw new Error(`Pattern with name ${t} not found`);await o.dapi.userDataStorage.remove(yt,n,!1),this.currentUserPatternNameToHash.delete(t),e.updatePatternList();const r=this.getHashOfPatternToBeLoadedAfterDeletion();e.requestPatternLoad(r)}fetchDefaultNucleobase(){return this.fetchAvailableNucleotideBases()[0]}fetchAvailableNucleotideBases(){const t=Object.keys(s.a1)[0];return Object.keys(s.a1[t])}async fetchCurrentUserName(){return(await o.dapi.users.current()).friendlyName}async fetchCurrentUserId(){return(await o.dapi.users.current()).id}async fetchPatterns(){return await o.dapi.userDataStorage.get(yt,!1)}async initializePatternMaps(t){if(!this.currentUserId)throw new Error("Current user ID is not set");const e=new Map;for(const[n,r]of Object.entries(t))await this.extractDataFromRecordToMaps(n,r,e);this.setDefaultPattern()}setDefaultPattern(){const t=xt[Ct.PATTERN_CONFIG];this.currentUserPatternNameToHash.set(t[At.PATTERN_NAME],"")}async extractDataFromRecordToMaps(t,e,n){const r=JSON.parse(e),i=r[Ct.PATTERN_CONFIG].patternName,s=r[Ct.AUTHOR_ID];if(this.isCurrentUserId(s))this.currentUserPatternNameToHash.set(i,t);else{if(!n.has(s)){const t=(await o.dapi.users.find(s)).friendlyName;n.set(s,t)}const e=i+` (created by ${n.get(s)})`;this.otherUsersPatternNameToHash.set(e,t)}}getDefaultPatternName(){return xt[Ct.PATTERN_CONFIG][At.PATTERN_NAME]}getCurrentUserAuthorshipCategory(){return this.currentUserName+" (me)"}getOtherUsersAuthorshipCategory(){return"Other users"}isCurrentUserId(t){return t===this.currentUserId}}const Nt=rxjs,Ot=rxjs.operators;function Lt(t){return t.endsWith("(o)")}function Mt(t){const e=Object.values(t).flat().reduce(((t,e)=>(t[e]=(t[e]||0)+1,t)),{});return Object.entries(e).reduce(((t,e)=>t[1]>e[1]?t:e),["",0])[0]}var Bt;function Pt(t){const e=Array.from(new Set(t));return Array.from(e).sort(((t,e)=>t.toLowerCase().localeCompare(e.toLowerCase())))}!function(t){t.getTruncatedStrandData=function(t,e,n){return{nucleotides:t.slice(0,n),ptoFlags:e.slice(0,n+1)}},t.getExtendedStrandData=function(t,e,n,r){const i=n-t.length,o=t.concat(new Array(n-t.length).fill(r)),s=0===t.length?n+1:i;return{nucleotides:o,ptoFlags:e.concat(new Array(s).fill(!0))}}}(Bt||(Bt={}));var Rt=n(543),Ft=n.n(Rt);class Dt{constructor(t,e){this.dataManager=t,this._patternListUpdated$=new Nt.Subject,this._patternLoadRequested$=new Nt.Subject,this._patternLoaded$=new Nt.Subject,this._uniqueNucleotides$=new Nt.BehaviorSubject([]),this._patternDeletionRequested$=new Nt.Subject,this._tableSelection$=new Nt.BehaviorSubject(null),this._svgSaveRequested$=new Nt.Subject,this._loadPatternInNewTabRequested$=new Nt.Subject,this._urlStateUpdated$=new Nt.Subject,this._patternHasUnsavedChanges$=new Nt.BehaviorSubject(!1),this._selectedColumn=new Nt.BehaviorSubject(null),this.initializeAuthorSelection(e),this.initializePatternState(e),this._lastLoadedPatternConfig=new Nt.BehaviorSubject(Ft().cloneDeep(this.getPatternConfig())),this.setupSubscriptions()}setupSubscriptions(){this._nucleotideSequences$.subscribe((()=>{this.updateUniqueNucleotides(),this.updateSequenceBase()})),this._isAntisenseStrandActive$.subscribe((t=>{t||mt.forEach((t=>{this.updateTerminusModification("AS",t,"")}))})),this.patternStateChanged$.pipe((0,Ot.debounceTime)(20)).subscribe((()=>{const t=this._lastLoadedPatternConfig.getValue(),e=this.getPatternConfig(),n=!Ft().isEqual(e,t);this._patternHasUnsavedChanges$.next(n)}))}updateUniqueNucleotides(){const t=(e=this._nucleotideSequences$.getValue(),Pt(Object.values(e).flat()));var e;this._uniqueNucleotides$.next(t)}updateSequenceBase(){const t=Mt(this._nucleotideSequences$.getValue());this._sequenceBase$.next(t)}get nucleotideSequencesChanged$(){return this._nucleotideSequences$.asObservable()}initializeAuthorSelection(t){const e=t[Ct.AUTHOR_ID];this.dataManager.isCurrentUserId(e)?this._patternAuthorSelection$=new Nt.BehaviorSubject(this.dataManager.getCurrentUserAuthorshipCategory()):this._patternAuthorSelection$=new Nt.BehaviorSubject(this.dataManager.getOtherUsersAuthorshipCategory())}initializePatternState(t){const e=t[Ct.PATTERN_CONFIG];this._patternName$=new Nt.BehaviorSubject(e[At.PATTERN_NAME]),this._isAntisenseStrandActive$=new Nt.BehaviorSubject(e[bt.IS_ANTISENSE_STRAND_INCLUDED]),this._nucleotideSequences$=new Nt.BehaviorSubject(e[bt.NUCLEOTIDE_SEQUENCES]),this._phosphorothioateLinkageFlags=new Nt.BehaviorSubject(e[bt.PHOSPHOROTHIOATE_LINKAGE_FLAGS]),this._terminalModifications=new Nt.BehaviorSubject(e[bt.STRAND_TERMINUS_MODIFICATIONS]),this._comment$=new Nt.BehaviorSubject(e[At.PATTERN_COMMENT]),this._modificationsWithNumericLabels$=new Nt.BehaviorSubject(e[At.NUCLEOTIDES_WITH_NUMERIC_LABELS]),this._sequenceBase$=new Nt.BehaviorSubject(Mt(e[bt.NUCLEOTIDE_SEQUENCES]))}getPatternName(){return this._patternName$.getValue()}updatePatternName(t){this._patternName$.next(t)}get antisenseStrandToggled$(){return this._isAntisenseStrandActive$.asObservable()}isAntisenseStrandActive(){return this._isAntisenseStrandActive$.getValue()}toggleAntisenseStrand(t){t?this.updateStrandLength("AS",this.getNucleotideSequences().SS.length):this.updateStrandLength("AS",0),this._isAntisenseStrandActive$.next(t)}getNucleotideSequences(){return this._nucleotideSequences$.getValue()}updateNucleotideSequences(t){this._nucleotideSequences$.next(t)}updateStrandLength(t,e){const n=this.getNucleotideSequences()[t];if(n.length===e)return;const r=this.getPhosphorothioateLinkageFlags()[t];if(0===e)return void this.setNewStrandData([],[],t);if(n.length>e){const{nucleotides:i,ptoFlags:o}=Bt.getTruncatedStrandData(n,r,e);return void this.setNewStrandData(i,o,t)}const i=this.getSequenceBase(),{nucleotides:o,ptoFlags:s}=Bt.getExtendedStrandData(n,r,e,i);this.setNewStrandData(o,s,t)}setNewStrandData(t,e,n){this.updateNucleotideSequences({...this.getNucleotideSequences(),[n]:t}),this.updatePhosphorothioateLinkageFlags({...this.getPhosphorothioateLinkageFlags(),[n]:e})}getPhosphorothioateLinkageFlags(){return this._phosphorothioateLinkageFlags.getValue()}updatePhosphorothioateLinkageFlags(t){this._phosphorothioateLinkageFlags.next(t)}get phosphorothioateLingeFlagsChanged$(){return this._phosphorothioateLinkageFlags.asObservable()}getTerminalModifications(){return this._terminalModifications.getValue()}updateTerminalModifications(t){this._terminalModifications.next(t)}updateTerminusModification(t,e,n){const r=this.getTerminalModifications();r[t][e]=n,this.updateTerminalModifications(r)}terminalModificationsUpdated$(){return this._terminalModifications.asObservable()}getComment(){return this._comment$.getValue()}updateComment(t){this._comment$.next(t)}getModificationsWithNumericLabels(){return this._modificationsWithNumericLabels$.getValue()}updateModificationsWithNumericLabels(t){const e=function(t){return Pt(t).filter((t=>!Lt(t)))}(t);this._modificationsWithNumericLabels$.next(e)}get patternLoadRequested$(){return this._patternLoadRequested$.asObservable()}requestPatternLoad(t){this._patternLoadRequested$.next(t)}get patternListUpdated$(){return this._patternListUpdated$.asObservable()}updatePatternList(){this._patternListUpdated$.next()}get tableSelectionChanged$(){return this._tableSelection$.asObservable()}selectTable(t){this._tableSelection$.next(t)}getTableSelection(){return this._tableSelection$.getValue()}requestPatternDeletion(t){this._patternDeletionRequested$.next(t)}get patternDeletionRequested$(){return this._patternDeletionRequested$.asObservable()}replaceSequenceBase(t){const e=this._nucleotideSequences$.getValue(),n={};dt.forEach((r=>{n[r]=e[r].map((()=>t))})),this._nucleotideSequences$.next(n);const r=this._modificationsWithNumericLabels$.getValue();r.includes(t)||this.updateModificationsWithNumericLabels(r.concat(t))}get patternStateChanged$(){return Nt.merge(this._patternName$.pipe((0,Ot.debounceTime)(300),(0,Ot.map)((()=>{}))),this._isAntisenseStrandActive$,this._nucleotideSequences$,this._phosphorothioateLinkageFlags,this._terminalModifications,this._comment$.pipe((0,Ot.debounceTime)(300)),this._modificationsWithNumericLabels$)}getSequenceBase(){return this._sequenceBase$.getValue()}uniqueNucleotidesChanged$(){return this.patternStateChanged$.pipe((0,Ot.switchMap)((()=>this._uniqueNucleotides$)))}getUniqueNucleotides(){return this._uniqueNucleotides$.getValue()}get svgSaveRequested$(){return this._svgSaveRequested$.asObservable()}requestSvgSave(){this._svgSaveRequested$.next()}setAllPTOLinkages(t){const e=this.getPhosphorothioateLinkageFlags();dt.forEach((n=>{e[n]=e[n].map((()=>t))})),this.updatePhosphorothioateLinkageFlags(e)}setPatternConfig(t){this._patternName$.next(t[At.PATTERN_NAME]),this._isAntisenseStrandActive$.next(t[bt.IS_ANTISENSE_STRAND_INCLUDED]),this._nucleotideSequences$.next(t[bt.NUCLEOTIDE_SEQUENCES]),this._phosphorothioateLinkageFlags.next(t[bt.PHOSPHOROTHIOATE_LINKAGE_FLAGS]),this._terminalModifications.next(t[bt.STRAND_TERMINUS_MODIFICATIONS]),this._comment$.next(t[At.PATTERN_COMMENT]),this._modificationsWithNumericLabels$.next(t[At.NUCLEOTIDES_WITH_NUMERIC_LABELS])}setLastLoadedPatternConfig(t){this._lastLoadedPatternConfig.next(Ft().cloneDeep(t))}getPatternConfig(){return{[At.PATTERN_NAME]:this.getPatternName(),[bt.IS_ANTISENSE_STRAND_INCLUDED]:this.isAntisenseStrandActive(),[bt.NUCLEOTIDE_SEQUENCES]:this.getNucleotideSequences(),[bt.PHOSPHOROTHIOATE_LINKAGE_FLAGS]:this.getPhosphorothioateLinkageFlags(),[bt.STRAND_TERMINUS_MODIFICATIONS]:this.getTerminalModifications(),[At.PATTERN_COMMENT]:this.getComment(),[At.NUCLEOTIDES_WITH_NUMERIC_LABELS]:this.getModificationsWithNumericLabels()}}setPhosphorothioateLinkageFlag(t,e,n){const r=this.getPhosphorothioateLinkageFlags();r[t][e]=n,this.updatePhosphorothioateLinkageFlags(r)}setNucleotide(t,e,n){const r=this.getNucleotideSequences();r[t][e]=n;const i=this.getModificationsWithNumericLabels();this.updateModificationsWithNumericLabels(i.concat(n)),this.updateNucleotideSequences(r)}get strandsUpdated$(){return Nt.merge(this._isAntisenseStrandActive$.asObservable().pipe((0,Ot.map)((()=>{}))),this._nucleotideSequences$.asObservable().pipe((0,Ot.map)((()=>{}))),this._patternLoaded$.asObservable().pipe((0,Ot.map)((()=>{})))).pipe((0,Ot.debounceTime)(10))}get strandsLinkagesAndTerminalsUpdated$(){return Nt.merge(this.strandsUpdated$,this._phosphorothioateLinkageFlags.asObservable().pipe((0,Ot.map)((()=>{}))),this._terminalModifications.asObservable().pipe((0,Ot.map)((()=>{}))))}updateControlsUponPatternLoaded(t){this._patternLoaded$.next(t)}get patternLoaded$(){return this._patternLoaded$.asObservable()}get userSelection$(){return this._patternAuthorSelection$.asObservable().pipe((0,Ot.skip)(1))}selectAuthor(t){this._patternAuthorSelection$.next(t)}getSelectedAuthor(){return this._patternAuthorSelection$.getValue()}get loadPatternInNewTabRequested$(){return this._loadPatternInNewTabRequested$.asObservable()}requestLoadPatternInNewTab(t){this._loadPatternInNewTabRequested$.next(t)}updateUrlState(t){this._urlStateUpdated$.next(t)}get urlStateUpdated$(){return this._urlStateUpdated$.asObservable()}get patternHasUnsavedChanges$(){return this._patternHasUnsavedChanges$.asObservable()}selectColumn(t,e){this._selectedColumn.next({strand:t,colName:e})}getSelectedColumn(t){return this._selectedColumn.getValue()?.colName??null}}const Ut="pattern";class kt{constructor(){this.urlSearchParams=new URLSearchParams(window.location.search)}subscribeToObservables(t){t.urlStateUpdated$.subscribe((t=>this.setPatternURL(t))),t.loadPatternInNewTabRequested$.subscribe((t=>{const e=`${window.location.origin}${window.location.pathname}?${Ut}=${t}`;window.open(e,"_blank")})),window.addEventListener("popstate",(()=>{this.urlSearchParams=new URLSearchParams(window.location.search);const e=this.getPatternHash();null!==e&&t.requestPatternLoad(e)}))}getPatternHash(){return this.urlSearchParams.get(Ut)}setPatternURL(t){null!==t&&""!==t?(this.urlSearchParams.set(Ut,t),window.history.pushState({},"",`${window.location.pathname}?${this.urlSearchParams}`)):this.clearPatternURL()}clearPatternURL(){this.urlSearchParams.delete(Ut),window.history.pushState({},"",`${window.location.pathname}`)}}const $t=$;var Ht=n.n($t),Vt=n(72),jt=n.n(Vt),qt=n(825),Gt=n.n(qt),Wt=n(659),zt=n.n(Wt),Yt=n(56),Kt=n.n(Yt),Qt=n(540),Xt=n.n(Qt),Jt=n(113),Zt=n.n(Jt),te=n(252),ee={};ee.styleTagTransform=Zt(),ee.setAttributes=Kt(),ee.insert=zt().bind(null,"head"),ee.domAPI=Gt(),ee.insertStyleElement=Xt(),jt()(te.A,ee),te.A&&te.A.locals&&te.A.locals;class ne{constructor(t){this.eventBus=t,this.columnControlsContainer=ct.div([]),this.eventBus.tableSelectionChanged$.subscribe((()=>this.handleTableChoice())),this.refreshColumnControls()}getColumnControlsContainer(){return this.columnControlsContainer}get selectedTable(){return this.eventBus.getTableSelection()}handleTableChoice(){this.refreshColumnControls()}refreshColumnControls(){Ht()(this.columnControlsContainer).empty(),Ht()(this.columnControlsContainer).append(this.constructColumnControls())}constructColumnControls(){const t=this.createStrandColumnInput();return[t.SS,t.AS,this.createIdColumnInput()]}createStrandColumnInput(){const t=this.selectedTable?this.selectedTable.columns.names().sort(((t,e)=>t.localeCompare(e))):[];return Object.fromEntries(dt.map((e=>{const n=ct.choiceInput(`${pt[e]} column`,t[0],t,(t=>this.eventBus.selectColumn(e,t)));return[e,n.root]})))}createIdColumnInput(){const t=this.selectedTable?this.selectedTable.columns.names():[];return ct.choiceInput("ID column",t[0],t,(()=>{})).root}}class re{constructor(t){this.eventBus=t,this.availableTables=[],this.tableInputContainer=ct.div([]),this.subscribeToTableEvents(),this.refreshTableInput()}getTableInputContainer(){return this.tableInputContainer}subscribeToTableEvents(){o.events.onTableAdded.subscribe((t=>this.handleTableAdded(t))),o.events.onTableRemoved.subscribe((t=>this.handleTableRemoved(t))),this.eventBus.tableSelectionChanged$.subscribe((()=>this.handleTableChoice()))}getTableFromEventData(t){if(!t&&t.args&&t.args.dataFrame instanceof r.DataFrame)throw new Error("EventData does not contain a dataframe",t);return t.args.dataFrame}handleTableAdded(t){const e=this.getTableFromEventData(t);this.availableTables.some((t=>t.name===e.name))||(this.availableTables.push(e),this.eventBus.selectTable(e),this.refreshTableInput())}handleTableRemoved(t){const e=this.getTableFromEventData(t);this.availableTables=this.availableTables.filter((t=>t.name!==e.name));const n=this.availableTables[0];this.eventBus.selectTable(n||null),this.refreshTableInput()}refreshTableInput(){const t=this.createTableInput();Ht()(this.tableInputContainer).empty(),this.tableInputContainer.append(t.root)}createTableInput(){const t=this.eventBus.getTableSelection();return ct.tableInput("Tables",t,this.availableTables,(t=>{null!==t&&t instanceof r.DataFrame&&this.eventBus.selectTable(t)}))}handleTableChoice(){const t=this.eventBus.getTableSelection();t&&(this.isTableDisplayed(t)||this.displayTable(t))}isTableDisplayed(t){return o.shell.tableNames.includes(t.name)}displayTable(t){const e=o.shell.v;o.shell.addTableView(t),o.shell.v=e}}class ie{constructor(t){this.eventBus=t,this.tableInputManager=new re(t),this.columnInputManager=new ne(t)}createControls(){const t=ct.h1("Bulk convert"),e=this.tableInputManager.getTableInputContainer(),n=this.columnInputManager.getColumnControlsContainer(),r=ct.bigButton("Convert",(()=>this.processConvertButtonClick()));return[t,e,n,ct.buttonsInput([r])]}processConvertButtonClick(){}}class oe{constructor(t,e,n){this.eventBus=t,this.initialPatternConfig=e,this.subscriptions=n}create(){return ct.divV([ct.h1("PTO"),ct.divH([this.createAllPtoActivationInput().root,...this.createFirstPtoInputs().map((t=>t.root))],{style:{gap:"12px"}})])}areAllPtoLinkagesSet(t){return dt.map((e=>t[e].filter((t=>t)).length)).reduce(((t,e)=>t+e),0)===dt.map((t=>this.initialPatternConfig.nucleotideSequences[t].length)).reduce(((t,e)=>t+e),0)+dt.filter((e=>t[e].length)).length}createAllPtoActivationInput(){const t=this.initialPatternConfig.phosphorothioateLinkageFlags,e=this.areAllPtoLinkagesSet(t),n=ct.boolInput("All PTO",e);n.onInput((()=>{const t=n.value;this.eventBus.setAllPTOLinkages(t)}));const r=this.eventBus.phosphorothioateLingeFlagsChanged$.subscribe((()=>{const t=this.eventBus.getPatternConfig().phosphorothioateLinkageFlags,e=this.areAllPtoLinkagesSet(t);n.value=e}));return this.subscriptions.add(r),this.addStyleToPtoInput(n),ct.tooltip.bind(n.captionLabel,"Activate all phosphothioates"),n}addStyleToPtoInput(t){const e=t.captionLabel;e.classList.add("ui-label-right"),Object.assign(e.style,{textAlign:"left",maxWidth:"100px",minWidth:"40px",width:"auto"})}createFirstPtoInputs(){return dt.map((t=>{if(!this.eventBus.isAntisenseStrandActive()&&"AS"===t)return;const e=this.isFirstPtoActive(t),n=ct.boolInput(`First ${t} PTO`,e);n.onInput((()=>{const e=n.value;this.eventBus.setPhosphorothioateLinkageFlag(t,0,e)}));const r=this.eventBus.phosphorothioateLingeFlagsChanged$.subscribe((e=>{const r=e[t][0];n.value=r}));return this.subscriptions.add(r),this.addStyleToPtoInput(n),ct.tooltip.bind(n.captionLabel,`Activate first phosphothioate in ${t}`),n})).filter((t=>void 0!==t))}isFirstPtoActive(t){return this.initialPatternConfig.phosphorothioateLinkageFlags[t][0]}}class se{constructor(t,e,n){this.eventBus=t,this.dataManager=e,this.subscriptions=n;const r=this.eventBus.nucleotideSequencesChanged$.subscribe((()=>{this.displayedInputLabels=this.computeDisplayedInputLabels()}));this.subscriptions.add(r)}create(){const t=dt.map((t=>this.constructControlsPanel(t)));return ct.divH(t,{style:{gap:"24px"}})}constructControlsPanel(t){if(!this.eventBus.isAntisenseStrandActive()&&"AS"===t)return ct.div([]);const e=this.constructHeader(),n=this.createControls(t);return ct.block([ct.h1(`${pt[t]}`),e,n],{style:{paddingTop:"12px"}})}constructHeader(){return ct.divH([ct.div([ct.divText("#")],{style:{width:"20px"}}),ct.block75([ct.divText("Modification")]),ct.div([ct.divText("PTO")])])}createControls(t){const e=this.createNucleobaseInputs(t),n=this.createLabelDivs(t),r=this.createPTOFlagInputs(t);return ct.div(e.map(((t,e)=>ct.divH([n[e],ct.block75([t.root]),r[e].root],{style:{alignItems:"center"}}))))}createNucleobaseInputs(t){const e=this.dataManager.fetchAvailableNucleotideBases().sort(((t,e)=>t.toLowerCase().localeCompare(e.toLowerCase())));return this.eventBus.getNucleotideSequences()[t].map(((n,r)=>{const i=ct.choiceInput("",n,e);return i.onInput((()=>{const e=i.value;this.eventBus.setNucleotide(t,r,e)})),i}))}createPTOFlagInputs(t){return this.eventBus.getPhosphorothioateLinkageFlags()[t].slice(1).map(((e,n)=>{const r=ct.boolInput("",e);r.onInput((()=>{const e=r.value;this.eventBus.setPhosphorothioateLinkageFlag(t,n+1,e)}));const i=this.eventBus.phosphorothioateLingeFlagsChanged$.subscribe((e=>{const i=e[t][n+1];r.value=i}));return this.subscriptions.add(i),r}))}computeDisplayedInputLabels(){const t=this.eventBus.getNucleotideSequences(),e=new Map;return dt.forEach((n=>{let r=1;const i=t[n].map((t=>{if(Lt(t))return"";const e=String(r);return r++,e}));e.set(n,i)})),e}createLabelDivs(t){const e=this.createLabels(t).map((t=>ct.div([t],{style:{width:"20px"}}))),n=this.eventBus.nucleotideSequencesChanged$.subscribe((()=>{this.createLabels(t).forEach(((t,n)=>{Ht()(e[n]).empty(),Ht()(e[n]).append(t)}))}));return this.subscriptions.add(n),e}createLabels(t){return this.eventBus.getNucleotideSequences()[t].map(((e,n)=>{const r=this.displayedInputLabels.get(t)[n];return ct.label(r)}))}}class ae{constructor(){this.rxjsSubscriptions=[],this.dgSubscriptions=[]}add(t){t instanceof Nt.Subscription?this.rxjsSubscriptions.push(t):this.dgSubscriptions.push(t)}unsubscribeAll(){for(const t of[this.rxjsSubscriptions,this.dgSubscriptions])t.forEach((t=>t.unsubscribe())),t.length=0}}class ue{constructor(t,e){this.eventBus=t,this.dataManager=e,this.subscriptions=new ae}static open(t,e){ue.isDialogOpen||(ue.instance||(ue.instance=new ue(t,e)),ue.instance.openDialog())}openDialog(){this.initialPatternConfig=Ft().cloneDeep(this.eventBus.getPatternConfig()),ue.isDialogOpen=!0,this.createDialog().show()}createDialog(){const t=ct.divV([]);this.subscriptions.add(this.eventBus.strandsUpdated$.subscribe((()=>this.onStrandsUpdated(t))));const e=ct.dialog("Edit strands").add(t).onOK((()=>{})).onCancel((()=>this.resetToInitialState()));return this.subscriptions.add(e.onClose.subscribe((()=>{ue.isDialogOpen=!1,this.subscriptions.unsubscribeAll()}))),e}onStrandsUpdated(t){const e=new oe(this.eventBus,this.initialPatternConfig,this.subscriptions).create(),n=new se(this.eventBus,this.dataManager,this.subscriptions).create();Ht()(t).empty(),Ht()(t).append(e,n)}resetToInitialState(){this.eventBus.setPatternConfig(this.initialPatternConfig)}}ue.isDialogOpen=!1;class le{constructor(t){this.eventBus=t,this.subscriptions=new ae}static open(t){le.isDialogOpen||(le.instance||(le.instance=new le(t)),le.instance.openDialog())}openDialog(){this.initialPatternConfig=Ft().cloneDeep(this.eventBus.getPatternConfig()),le.isDialogOpen=!0,this.createDialog().show()}createDialog(){const t=ct.divV([]);this.subscriptions.add(this.eventBus.strandsUpdated$.subscribe((()=>this.onStrandsUpdated(t))));const e=ct.dialog("Edit terminal modifications").add(t).onOK((()=>{})).onCancel((()=>this.resetToInitialState()));return this.subscriptions.add(e.onClose.subscribe((()=>{le.isDialogOpen=!1,this.subscriptions.unsubscribeAll()}))),e}onStrandsUpdated(t){const e=new ce(this.eventBus).create();Ht()(t).empty(),Ht()(t).append(e)}resetToInitialState(){this.eventBus.setPatternConfig(this.initialPatternConfig)}}le.isDialogOpen=!1;class ce{constructor(t){this.eventBus=t}create(){const t=dt.map((t=>this.constructControlsPanel(t)));return ct.divH(t,{style:{gap:"24px"}})}constructControlsPanel(t){if(!this.eventBus.isAntisenseStrandActive()&&"AS"===t)return ct.div([]);const e=this.createInputs(t);return ct.block([ct.h1(`${pt[t]}`),e],{style:{paddingTop:"12px"}})}createInputs(t){const e=("SS"===t?[...mt].reverse():mt).map((e=>this.createInputForTerminus(t,e)));return ct.form(e)}createInputForTerminus(t,e){const n=this.eventBus.getTerminalModifications()[t][e],r=ct.textInput(e,n);return this.applyStylingToInput(r),r.onInput((()=>{const n=r.value;null!==n&&this.eventBus.updateTerminusModification(t,e,n)})),r}applyStylingToInput(t){const e=t.root.getElementsByTagName("textarea")[0];Ht()(e).css("resize","none")}}class he{constructor(t,e){this.eventBus=t,this.dataManager=e}createControls(){const t=this.createAntisenseStrandToggle(),e=this.createStrandLengthInputs(),n=e.SS.root,r=e.AS.root,i=this.createSequenceBaseInput().root,o=this.createPatternCommentInput().root,s=this.createPatternNameInputBlock(),a=this.createEditPatternButton(),u=this.createEditTerminalModificationsButton();return[ct.h1("Edit"),t,n,r,i,s,o,ct.buttonsInput([u,a])]}createEditPatternButton(){const t=ct.button("Edit strands",(()=>ue.open(this.eventBus,this.dataManager)));return ct.tooltip.bind(t,"Edit strand modifications and PTOs"),t}createEditTerminalModificationsButton(){const t=ct.button("Edit terminals",(()=>le.open(this.eventBus)));return ct.tooltip.bind(t,"Edit terminal modifications"),Ht()(t).css("margin-right","20px"),t}createAntisenseStrandToggle(){const t=ct.switchInput(`${pt.AS} strand`,this.eventBus.isAntisenseStrandActive());return t.onInput((()=>this.eventBus.toggleAntisenseStrand(t.value))),this.eventBus.patternLoaded$.subscribe((()=>{t.value=this.eventBus.isAntisenseStrandActive()})),t.setTooltip("Toggle antisense strand"),t.root}createStrandLengthInputs(){const t=t=>{const n=this.eventBus.getNucleotideSequences()[t].length,r=ct.intInput(`${pt[t]} length`,n);return r.onInput((()=>e(t,r))),this.eventBus.nucleotideSequencesChanged$.subscribe((()=>{r.value=this.eventBus.getNucleotideSequences()[t].length})),r.setTooltip(`Number of nucleotides in ${t}, including overhangs`),[t,r]},e=(t,e)=>{const n=e.value;null!==n&&(n<=0&&(o.shell.warning("Sequence length must be greater than 0"),e.value=1),n>34&&(o.shell.warning("Sequence length must be less than 35"),e.value=34),this.eventBus.updateStrandLength(t,e.value))},n=Object.fromEntries(dt.map((e=>t(e))));return this.eventBus.antisenseStrandToggled$.subscribe((t=>{Ht()(n.AS.root).toggle(t)})),n}createSequenceBaseInput(){const t=this.dataManager.fetchAvailableNucleotideBases().sort(((t,e)=>t.toLowerCase().localeCompare(e.toLowerCase()))),e=this.dataManager.fetchDefaultNucleobase(),n=ct.choiceInput("Sequence basis",e,t);return n.onInput((()=>this.eventBus.replaceSequenceBase(n.value))),this.eventBus.nucleotideSequencesChanged$.subscribe((()=>{n.value=this.eventBus.getSequenceBase()})),n.setTooltip("Most frequent nucleobase in the strands"),n}createPatternCommentInput(){const t=ct.textInput("Comment",this.eventBus.getComment());return Ht()(t.root).addClass("st-pattern-text-input"),t.onInput((()=>this.eventBus.updateComment(t.value))),this.eventBus.patternLoaded$.subscribe((()=>{t.value=this.eventBus.getComment()})),t}createPatternNameInputBlock(){const t=ct.textInput("Pattern name",this.eventBus.getPatternName());return Ht()(t.root).addClass("st-pattern-text-input"),t.onInput((()=>this.eventBus.updatePatternName(t.value))),this.eventBus.patternLoaded$.subscribe((()=>{t.value=this.eventBus.getPatternName()})),t.setTooltip("Name under which pattern will be saved"),t.root}}class fe{constructor(t,e){this.eventBus=t,this.dataManager=e,this.subscriptions=new ae,this.authorSelectedByUser=!1,this.eventBus.patternLoadRequested$.subscribe((t=>this.handlePatternChoice(t))),this.eventBus.patternDeletionRequested$.subscribe((async t=>{await this.dataManager.deletePattern(t,this.eventBus)}))}async handlePatternChoice(t){let e=await this.dataManager.getPatternConfig(t);null===e&&(e=this.dataManager.getDefaultPatternConfig()),this.eventBus.setPatternConfig(e),this.eventBus.updateControlsUponPatternLoaded(t),this.eventBus.setLastLoadedPatternConfig(e)}isCurrentUserSelected(){return this.eventBus.getSelectedAuthor()!==this.dataManager.getOtherUsersAuthorshipCategory()}createControls(){const t=this.getPatternInputsContainer();return[ct.h1("Load"),t]}getPatternInputsContainer(){const t=ct.divH(this.createPatternInputs());return this.eventBus.patternListUpdated$.subscribe((()=>{this.subscriptions.unsubscribeAll(),Ht()(t).empty(),Ht()(t).append(this.createPatternInputs())})),t}createPatternInputs(){const t=this.createAuthorChoiceInput(),e=this.createPatternChoiceInputContainer(),n=this.createDeletePatternButton();return[t.root,e,n]}createPatternChoiceInputContainer(){const t=this.createPatternChoiceInput(),e=ct.div([t.root]),n=this.eventBus.userSelection$.subscribe((()=>{Ht()(e).empty(),Ht()(e).append(this.createPatternChoiceInput().root)}));return this.subscriptions.add(n),e}createAuthorChoiceInput(){const t=[this.dataManager.getCurrentUserAuthorshipCategory()];this.dataManager.getOtherUsersPatternNames().length>0&&t.push(this.dataManager.getOtherUsersAuthorshipCategory());const e=ct.choiceInput("Author",this.eventBus.getSelectedAuthor(),t,(t=>{this.authorSelectedByUser=!0,this.eventBus.selectAuthor(t)}));return this.setAuthorChoiceInputStyle(e),e.setTooltip("Select pattern author"),e}setAuthorChoiceInputStyle(t){Ht()(t.input).css({"max-width":"100px","min-width":"100px"}),Ht()(t.root).css({"padding-right":"30px","padding-left":"30px"})}createPatternChoiceInput(){const t=this.isCurrentUserSelected()?this.dataManager.getCurrentUserPatternNames():this.dataManager.getOtherUsersPatternNames();if(this.authorSelectedByUser){const e=this.dataManager.getPatternHash(t[0],this.isCurrentUserSelected());this.eventBus.requestPatternLoad(e),this.eventBus.updateUrlState(e),this.authorSelectedByUser=!1}const e=this.getPatternName(t),n=ct.choiceInput("Pattern",e,t);return n.setTooltip("Select pattern to load"),Ht()(n.input).css({"max-width":"100px","min-width":"100px"}),this.subscriptions.add(n.onInput((()=>{const t=this.dataManager.getPatternHash(n.value,this.isCurrentUserSelected());this.eventBus.requestPatternLoad(t),this.eventBus.updateUrlState(t)}))),this.subscriptions.add(this.eventBus.patternLoaded$.subscribe((()=>{const e=this.eventBus.getPatternName();n.value?.includes(e)||(n.value=this.getPatternName(t))}))),n}getPatternName(t){return t.find((t=>t.includes(this.eventBus.getPatternName())))??t[0]}createDeletePatternButton(){const t=ct.button(ct.iconFA("trash-alt"),(()=>{this.eventBus.getPatternName()!==this.dataManager.getDefaultPatternName()?this.showDeletePatternDialog():o.shell.warning("Cannot delete example pattern")}));ct.tooltip.bind(t,"Delete pattern from user storage");const e=this.eventBus.userSelection$.subscribe((()=>{t.disabled=!this.isCurrentUserSelected()}));return this.subscriptions.add(e),t}showDeletePatternDialog(){const t=ct.dialog("Delete pattern"),e=this.eventBus.getPatternName();t.add(ct.divText(`Are you sure you want to delete pattern ${e}?`)),t.onOK((()=>this.eventBus.requestPatternDeletion(e))),t.show()}}class de{constructor(t,e){this.eventBus=t,this.dataManager=e}getLayout(){const t=new fe(this.eventBus,this.dataManager),e=new he(this.eventBus,this.dataManager),n=new ie(this.eventBus),r=t.createControls(),i=e.createControls(),o=n.createControls(),s=ct.div(r);Ht()(s).css({"padding-bottom":"20px"});const a=ct.div([...i,...o],"ui-form"),u=ct.div([s,a]);return Ht()(u).css({padding:"25px"}),ct.box(u,{style:{maxWidth:"450px"}})}}class pe{constructor(){this.xmlNamespace="http://www.w3.org/2000/svg"}createElement(t){return document.createElementNS(this.xmlNamespace,t)}setAttributes(t,e){Object.entries(e).forEach((([e,n])=>{t.setAttribute(e,String(n))}))}createCanvas(t,e){const n=this.createElement("svg");return this.setAttributes(n,{id:"mySvg",width:t,height:e}),n}createCircleElement(t,e,n){const r=this.createElement("circle");return this.setAttributes(r,{cx:t.x,cy:t.y,r:e,fill:n}),r}createTextElement(t,e,n,r){const i=this.createElement("text");return this.setAttributes(i,{x:e.x,y:e.y,"font-size":n,"font-weight":"normal","font-family":"Arial",fill:r}),i.textContent=t,i}createStarElement(t,e){const n=this.createElement("polygon"),r=this.computeStarVertexCoordinates(t).map((t=>t.join(","))).join(" ");return this.setAttributes(n,{points:r,fill:e}),n}computeStarVertexCoordinates(t){const e=Math.PI/5,n=-e/2;return Array.from({length:10},((r,i)=>{const o=i%2==0?6:3,s=i*e+n;return[t.x+Math.cos(s)*o,t.y+Math.sin(s)*o]}))}}const ge={0:{SS:"SS: 5'",AS:"AS: 3'"},1:{SS:"3'",AS:"5'"}},me={SS:{NUMERIC_LABEL:30,NUCLEOBASE_CIRCLE:52.5,NUCLEOBASE_LABEL:60},AS:{NUMERIC_LABEL:127.5,NUCLEOBASE_CIRCLE:97.5,NUCLEOBASE_LABEL:105}};function ve(t){const e=Object.keys(s.a1)[0];if(!e)throw new Error("No format found in PATTERN_APP_DATA");return s.a1[e][t].color||""}class ye{constructor(t){this.config=t;const e=this.computeRightOverhangNucleotideCounts(),n=this.computeMaxEffectiveStrandLength(e),r=this.computeMaxWidthOfRightOverhangs(e),i=this.computeStrandLabelWidth(),o=this.computeMaxWidthOfTerminusLabels();this.initializeCalculators(e,n,r,i,o)}initializeCalculators(t,e,n,r,i){this.canvasDimensions=new Ae(this.config,e,n,r,i),this.nucleotidePositionCalculator=new Ce(this.config,e,t,i),this.legendPositionCalculator=new we(this.config,this.canvasDimensions),this.labelPositionCalculator=new xe(this.config,n,i,r,t,this.nucleotidePositionCalculator),this.linkageStarPositionCalculator=new _e(this.nucleotidePositionCalculator,t)}computeRightOverhangNucleotideCounts(){return dt.reduce(((t,e)=>(t[e]=this.countOverhangNucleotidesAtStartOfStrand(e),t)),{})}computeMaxEffectiveStrandLength(t){return Math.max(...dt.map((e=>this.config.nucleotideSequences[e].length-t[e])))}computeMaxWidthOfRightOverhangs(t){return Math.max(t.SS,t.AS)}getCanvasWidth(){return this.canvasDimensions.getCanvasWidth()}getCanvasHeight(){return this.canvasDimensions.getCanvasHeight()}getNucleotideCirclePosition(t,e){return this.nucleotidePositionCalculator.getNucleotideCirclePosition(t,e)}getNucleotideLabelTextPosition(t,e){return this.nucleotidePositionCalculator.getNucleotideLabelTextPosition(t,e)}getNumericLabelPosition(t,e,n){return this.nucleotidePositionCalculator.getNumericLabelPosition(t,e,n)}getLegendCirclePosition(t,e,n){return this.legendPositionCalculator.getLegendCirclePosition(t,e,n)}getLegendTextPosition(t,e,n){return this.legendPositionCalculator.getLegendTextPosition(t,e,n)}getStarLabelPosition(){return this.legendPositionCalculator.getStarLabelPosition()}getPhosphorothioateLinkageLabelPosition(){return this.legendPositionCalculator.getPhosphorothioateLinkageLabelPosition()}getTerminusLabelPosition(t,e){return this.labelPositionCalculator.getTerminusLabelPosition(t,e)}getStrandEndLabelPosition(t,e){return this.labelPositionCalculator.getStrandEndLabelPosition(t,e)}getTitleTextPosition(){return this.labelPositionCalculator.getTitleTextPosition()}getCommentLabelPosition(){return this.labelPositionCalculator.getCommentLabelPosition()}getCenterPositionOfLinkageStar(t,e){return this.linkageStarPositionCalculator.getCenterPositionOfLinkageStar(t,e)}computeStrandLabelWidth(){return Object.fromEntries(gt.map((t=>[t,this.getMaxWidthStrandEndLabelsByEnd(t)])))}computeMaxWidthOfTerminusLabels(){return gt.reduce(((t,e)=>(t[e]=this.getMaxWidthOfTerminusLabelsByEnd(e),t)),{})}getMaxWidthOfTerminusLabelsByEnd(t){return this.calculateMaxWidthOfStrandEndLabel((e=>this.config.strandTerminusModifications[e][vt[e][t]]))}getMaxWidthStrandEndLabelsByEnd(t){return this.calculateMaxWidthOfStrandEndLabel((e=>ge[t][e]))}calculateMaxWidthOfStrandEndLabel(t){const e=be.getInstance();return Math.max(...dt.map((n=>e.computeTextWidth(t(n),17,"Arial"))))}countOverhangNucleotidesAtStartOfStrand(t){const e=this.config.nucleotideSequences[t];let n=0;for(const t of e){if(!Lt(t))break;n++}return n}}class be{constructor(){this.canvas=document.createElement("canvas"),this.context=this.canvas.getContext("2d"),this.pixelRatio=window.devicePixelRatio||1,this.canvas.width*=this.pixelRatio,this.canvas.height*=this.pixelRatio}static getInstance(){return be.instance||(be.instance=new be),be.instance}computeTextWidth(t,e,n){return this.context?(this.context.font=`${e*this.pixelRatio}px ${n}`,this.context.measureText(t).width/this.pixelRatio):0}}class Ae{constructor(t,e,n,r,i){this.config=t,this.maxEffectiveStrandLength=e,this.maxWidthOfRightOverhangs=n,this.strandLabelWidth=r,this.maxTerminusWidthByEnd=i}getCanvasWidth(){const t=30*(this.maxEffectiveStrandLength+this.maxWidthOfRightOverhangs);return gt.reduce(((t,e)=>t+(this.strandLabelWidth[e]+this.maxTerminusWidthByEnd[e])),0)+t+30}getCanvasHeight(){return 15*(this.config.isAntisenseStrandIncluded?11:9)}}class Ce{constructor(t,e,n,r){this.config=t,this.maxEffectiveStrandLength=e,this.rightOverhangNucleotideCounts=n,this.maxTerminusWidthByEnd=r}getNucleotideCirclePosition(t,e){return{x:this.computeNucleotideCircleXPositionByStrand(t,e),y:me[e].NUCLEOBASE_CIRCLE}}getNucleotideLabelTextPosition(t,e){return{x:this.computeNucleotideCircleXPositionByStrand(t,e)+-5,y:me[e].NUCLEOBASE_LABEL}}computeNucleotideCircleXPositionByStrand(t,e){const n=this.rightOverhangNucleotideCounts[e];return this.computeNucleobaseCircleXPosition(t,n)}computeNucleobaseCircleXPosition(t,e){return this.maxTerminusWidthByEnd[1]+30*(this.maxEffectiveStrandLength-t+e+1)}getNumericLabelPosition(t,e,n){const r=this.getVisualStrandIndex(t,e),i=this.computeNumericLabelXOffset(this.config.nucleotideSequences[e],r,n);return{x:this.computeNucleotideCircleXPositionByStrand(t,e)+i,y:me[e].NUMERIC_LABEL}}computeNumericLabelXOffset(t,e,n){return n>=0&&n<10||at.AL.includes(t[e])?-5:-10}getVisualStrandIndex(t,e){return"SS"===e?t:this.config.nucleotideSequences[e].length-t}}class we{constructor(t,e){this.config=t,this.canvasDimensionCalculator=e}getLegendCirclePosition(t,e,n){return{x:this.computeLegendCircleXPosition(t,e,n),y:this.getLegendVerticalPosition()}}getLegendTextPosition(t,e,n){return{x:this.computeLegendCircleXPosition(t,e,n)+6+4,y:this.getLegendTextVerticalPosition()}}computeLegendCircleXPosition(t,e,n){const r=n?1:0,i=e.length+r,o=(t+r)*(this.canvasDimensionCalculator.getCanvasWidth()/i)+6;return Math.round(o)}getStarLabelPosition(){return{x:15,y:this.getLegendVerticalPosition()}}getPhosphorothioateLinkageLabelPosition(){return{x:22,y:this.getLegendTextVerticalPosition()}}getLegendVerticalPosition(){return 15*(this.config.isAntisenseStrandIncluded?9.5:6)}getLegendTextVerticalPosition(){return(this.config.isAntisenseStrandIncluded?150:me.AS.NUCLEOBASE_CIRCLE)-3}}class xe{constructor(t,e,n,r,i,o){this.config=t,this.maxWidthOfRightOverhangs=e,this.maxTerminusWidthByEnd=n,this.strandLabelWidth=r,this.rightOverhangNucleotideCounts=i,this.nucleotidePositionCalculator=o,this.xPositionOfTerminusModifications=this.computeXPositionOfTerminusModifications()}getTerminusLabelPosition(t,e){return{x:this.xPositionOfTerminusModifications[e][t],y:me[t].NUCLEOBASE_LABEL}}getStrandEndLabelPosition(t,e){return{x:this.getXPositionOfStrandLabels()[e],y:me[t].NUCLEOBASE_LABEL}}getTitleTextPosition(){return{x:15,y:15}}getCommentLabelPosition(){const t=15*(this.config.isAntisenseStrandIncluded?11:8.5);return{x:this.getXPositionOfStrandLabels()[0],y:t}}getXPositionOfStrandLabels(){return{0:0,1:Math.max(...dt.map((t=>this.xPositionOfTerminusModifications[1][t])))+this.maxTerminusWidthByEnd[0]+30*this.maxWidthOfRightOverhangs}}computeXPositionOfTerminusModifications(){return Object.fromEntries(gt.map((t=>[t,Object.fromEntries(dt.map((e=>[e,0===t?this.strandLabelWidth[0]-5:30*this.rightOverhangNucleotideCounts[e]+this.nucleotidePositionCalculator.computeNucleobaseCircleXPosition(-.5,0)])))])))}}class _e{constructor(t,e){this.nucleotidePositionCalculator=t,this.rightOverhangNucleotideCounts=e}getCenterPositionOfLinkageStar(t,e){return{x:this.getXPositionOfLinkageStar(t,e),y:this.getYPositionOfLinkageStar(e)}}getXPositionOfLinkageStar(t,e){return this.nucleotidePositionCalculator.computeNucleobaseCircleXPosition(t,this.rightOverhangNucleotideCounts[e])+15}getYPositionOfLinkageStar(t){return me[t].NUCLEOBASE_LABEL+5}}class Se{constructor(t){this.setupPatternConfig(t),this.patternDimensionsCalculator=new ye(this.config),this.svgFactory=new Ie(new pe,this.config,this.patternDimensionsCalculator),this.strandElementManager=new Ne(this.svgFactory,this.config),this.legendBuilder=new Ee(this.svgFactory,this.config)}renderPattern(){const t=this.createLabelElements(),e=this.countNucleotidesExcludingOverhangs(),n=this.strandElementManager.createStrandElements(e),r=this.svgFactory.createTitleElement(this.config.patternName,e,this.config.isAntisenseStrandIncluded),i=this.legendBuilder.getLegendItems(),o=this.svgFactory.createCanvas();return o.append(...t,...n,r,...i),o}countNucleotidesExcludingOverhangs(){return dt.reduce(((t,e)=>(t[e]=this.config.nucleotideSequences[e].filter((t=>!Lt(t))).length,t)),{})}createLabelElements(){const t=this.getStrandEndLabels(),e=this.getTerminusModificationLabels();return[...dt.flatMap((n=>[...Object.values(t[n]),...Object.values(e[n])]))].filter((t=>null!==t))}setupPatternConfig(t){this.config=JSON.parse(JSON.stringify(t)),this.config.nucleotideSequences.SS.reverse(),this.config.phosphorothioateLinkageFlags.SS.reverse()}getStrandEndLabels(){return dt.reduce(((t,e)=>(t[e]=gt.reduce(((t,n)=>(t[n]=this.svgFactory.createLabelForStrandEnd(e,n),t)),{}),t)),{})}getTerminusModificationLabels(){return dt.reduce(((t,e)=>(t[e]=mt.reduce(((t,n)=>(t[n]=this.svgFactory.createTerminusModificationLabel(e,n),t)),{}),t)),{})}}class Ee{constructor(t,e){this.svgFactory=t,this.config=e,this.containsPhosphorothioateLinkages=this.checkAnyPhosphorothioateLinkages()}getLegendItems(){return[this.svgFactory.createCommentLabel(),...this.createLegendItemsForNucleotideTypes(),...this.createLegendItemForPhosphorothioateLinkage(this.containsPhosphorothioateLinkages)]}createLegendItemsForNucleotideTypes(){const t=this.extractNucleotideTypes(),e=[];return t.forEach(((n,r)=>{const i=this.svgFactory.createLegendCircle(n,r,t,this.containsPhosphorothioateLinkages),o=this.svgFactory.createLegendText(n,r,t,this.containsPhosphorothioateLinkages);e.push(i,o)})),e}createLegendItemForPhosphorothioateLinkage(t){return[this.svgFactory.createLinkageStarLegendLabel(t),this.svgFactory.createPhosphorothioateLinkageLabel(t)].filter((t=>null!==t))}extractNucleotideTypes(){return[...new Set(this.config.nucleotideSequences.SS.concat(this.config.isAntisenseStrandIncluded?this.config.nucleotideSequences.AS:[]))]}checkAnyPhosphorothioateLinkages(){return[...this.config.phosphorothioateLinkageFlags.SS,...this.config.isAntisenseStrandIncluded?this.config.phosphorothioateLinkageFlags.AS:[]].some((t=>t))}}class Te{constructor(t){this.nucleotideCounts=JSON.parse(JSON.stringify(t))}decrementIfNotOverhang(t,e){t||this.nucleotideCounts[e]--}getCurrentCount(t){return this.nucleotideCounts[t]}}class Ie{constructor(t,e,n){this.svgElementFactory=t,this.config=e,this.dimensionsCalculator=n}createCanvas(){const t=this.dimensionsCalculator.getCanvasWidth(),e=this.dimensionsCalculator.getCanvasHeight();return this.svgElementFactory.createCanvas(t,e)}createTitleElement(t,e,n){const r=this.getTitleText(t,e,n),i=this.dimensionsCalculator.getTitleTextPosition();return this.svgElementFactory.createTextElement(r,i,17,"black")}getTitleText(t,e,n){return`${t} for ${e.SS}${n?`/${e.AS}`:""}-mer`}createPhosphorothioateLinkageStar(t,e){if(!this.config.phosphorothioateLinkageFlags[t][e])return null;const n=this.dimensionsCalculator.getCenterPositionOfLinkageStar(e,t);return this.svgElementFactory.createStarElement(n,"red")}createNucleotideNumericLabel(t,e,n){const r=this.config.nucleotideSequences[e][t],i=Lt(r),o=this.dimensionsCalculator.getNumericLabelPosition(t,e,n),s=!i&&this.config.nucleotidesWithNumericLabels.includes(r)?String(n):"";return this.svgElementFactory.createTextElement(s,o,14,"var(--grey-6)")}createNucleotideCircle(t,e){const n=this.config.nucleotideSequences[e][t],r=this.dimensionsCalculator.getNucleotideCirclePosition(t,e);return this.svgElementFactory.createCircleElement(r,15,ve(n))}createNucleotideNameLabel(t,e){const n=this.config.nucleotideSequences[e][t],r=this.dimensionsCalculator.getNucleotideLabelTextPosition(t,e);var i;return this.svgElementFactory.createTextElement(!Lt(i=n)&&at.AL.includes(i)?i:"",r,17,function(t){const e=ve(t),n=e.match(/\d+/g)?.map(Number);if(!n||n.length<3)return"#ffffff";const[r,i,o]=n;return.299*r+.587*i+.114*o>186?"#333333":"#ffffff"}(n))}createCommentLabel(){const t=this.dimensionsCalculator.getCommentLabelPosition();return this.svgElementFactory.createTextElement(this.config.patternComment,t,14,"var(--grey-6)")}createLinkageStarLegendLabel(t){const e=this.dimensionsCalculator.getStarLabelPosition();return t?this.svgElementFactory.createStarElement(e,"red"):null}createPhosphorothioateLinkageLabel(t){const e=this.dimensionsCalculator.getPhosphorothioateLinkageLabelPosition();return t?this.svgElementFactory.createTextElement("ps linkage",e,14,"var(--grey-6)"):null}createLabelForStrandEnd(t,e){if(!("SS"===t||"AS"===t&&this.config.isAntisenseStrandIncluded))return null;const n=ge[e][t],r=this.dimensionsCalculator.getStrandEndLabelPosition(t,e);return this.svgElementFactory.createTextElement(n,r,17,"var(--grey-6)")}createTerminusModificationLabel(t,e){if("AS"===t&&!this.config.isAntisenseStrandIncluded)return null;const n="SS"===t&&"5'"===e||"AS"===t&&"3'"===e?0:1,r=this.config.strandTerminusModifications[t][e],i=this.dimensionsCalculator.getTerminusLabelPosition(t,n);return this.svgElementFactory.createTextElement(r,i,17,"red")}createLegendCircle(t,e,n,r){const i=ve(t),o=this.dimensionsCalculator.getLegendCirclePosition(e,n,r);return this.svgElementFactory.createCircleElement(o,6,i)}createLegendText(t,e,n,r){const i=this.dimensionsCalculator.getLegendTextPosition(e,n,r);return this.svgElementFactory.createTextElement(t,i,14,"var(--grey-6)")}}class Ne{constructor(t,e){this.svgFactory=t,this.config=e}createStrandElements(t){const e=[],n=new Te(t);return dt.forEach((r=>{("SS"===r||"AS"===r&&this.config.isAntisenseStrandIncluded)&&this.config.nucleotideSequences[r].forEach(((i,o)=>{const s=this.createElementsForNucleotide(o,r,n,t);e.push(...s)}))})),e}createElementsForNucleotide(t,e,n,r){const i=Lt(this.config.nucleotideSequences[e][t]);n.decrementIfNotOverhang(i,e);const o="SS"===e?n.getCurrentCount(e)+1:r[e]-n.getCurrentCount(e),s=this.svgFactory.createNucleotideNumericLabel(t,e,o),a=this.svgFactory.createNucleotideCircle(t,e),u=this.svgFactory.createNucleotideNameLabel(t,e),l=this.svgFactory.createPhosphorothioateLinkageStar(e,t),c=this.config.nucleotideSequences[e].length;return[s,a,u,l,this.svgFactory.createPhosphorothioateLinkageStar(e,c)].filter((t=>null!==t))}}var Oe=n(146);class Le{constructor(t){this.eventBus=t,this.svgDisplayDiv=ct.div([]),t.patternStateChanged$.subscribe((()=>this.updateSvgContainer())),t.svgSaveRequested$.subscribe((()=>this.saveSvgAsPng()))}static createSvgDiv(t){return new Le(t).svgDisplayDiv}updateSvgContainer(){$(this.svgDisplayDiv).empty();const t=this.eventBus.getPatternConfig();this.svgElement=this.createSvg(t),this.svgDisplayDiv.append(this.svgElement)}createSvg(t){return new Se(t).renderPattern()}saveSvgAsPng(){const t=this.eventBus.getPatternName();Oe.saveSvgAsPng(this.svgElement,t,{backgroundColor:"white"})}}class Me{constructor(t){this.eventBus=t,this.togglesContainer=ct.div([]),this.eventBus.uniqueNucleotidesChanged$().subscribe((()=>{this.updateContainer()}))}getContainer(){return this.togglesContainer}updateContainer(){Ht()(this.togglesContainer).empty(),Ht()(this.togglesContainer).append(this.createInputs())}createInputs(){const t=this.eventBus.getUniqueNucleotides().filter((t=>!Lt(t))).map((t=>this.createSingleInput(t)));return t.sort(((t,e)=>t.captionLabel.textContent.localeCompare(e.captionLabel.textContent))),ct.divH(t.map((t=>t.root)))}createSingleInput(t){const e=this.eventBus.getModificationsWithNumericLabels().includes(t),n=ct.boolInput(t,e,(e=>this.handleNumericLabelToggle(t,e)));return Ht()(n.root).css("padding-right","20px"),n.setTooltip(`Show numeric labels for ${t}`),n}handleNumericLabelToggle(t,e){const n=this.eventBus.getModificationsWithNumericLabels();if(n.includes(t)===e)return;const r=e?n.concat(t):n.filter((e=>e!==t));this.eventBus.updateModificationsWithNumericLabels(r)}}class Be{constructor(t,e){this.eventBus=t,this.dataManager=e,this.subscriptions=new ae}createContainer(){return ct.div([ct.h1("Translation example"),this.createTranslationExamples()],{style:{paddingTop:"20px"}})}createTranslationExamples(){const t=ct.divH([...this.getExampleElements()],"ui-form");return this.eventBus.antisenseStrandToggled$.subscribe((()=>{this.subscriptions.unsubscribeAll(),Ht()(t).empty(),Ht()(t).append(this.getExampleElements())})),t}getExampleElements(){return dt.map((t=>new Pe(t,this.eventBus,this.subscriptions).create()))}}class Pe{constructor(t,e,n){this.strand=t,this.eventBus=e,this.subscriptions=n}create(){return this.eventBus.isAntisenseStrandActive()||"AS"!==this.strand?(this.inputExample=this.createInputExample(),this.outputExample=this.createOutputExample(this.inputExample.value),this.subscribeToEvents(),ct.block50([ct.h2(pt[this.strand]),this.inputExample.root,this.outputExample.root],{style:{paddingRight:"20px"}})):ct.div([])}subscribeToEvents(){const t=this.eventBus.strandsLinkagesAndTerminalsUpdated$.subscribe((()=>{const t=this.generateExampleSequence();this.inputExample.value=t,this.outputExample.value=this.computeOutputValue(t)}));"AS"===this.strand&&this.subscriptions.add(t)}createInputExample(){const t=this.createTextInputForExamples(),e=this.generateExampleSequence();return t.value=e,t.setTooltip(`Example raw nucleotides input for ${pt[this.strand]}`),t}generateExampleSequence(){return this.eventBus.getNucleotideSequences()[this.strand].map(((t,e)=>at.AL[e%at.AL.length])).join("")}createOutputExample(t){const e=this.createTextInputForExamples();return e.value=this.computeOutputValue(t),e.setTooltip(`Pattern applied to the example input for ${pt[this.strand]}`),e}computeOutputValue(t){const e=this.eventBus.getNucleotideSequences()[this.strand],n=this.eventBus.getTerminalModifications()[this.strand];return function(t,e,n,r){const i=function(t,e,n){const r=new Array(t.length+e.filter((t=>t)).length+mt.length);r[0]=n["5'"],r[r.length-1]=n["3'"];let i=1;return e[0]&&(r[i]="ps",i++),t.forEach(((t,n)=>{r[n+i]=t,e[n+1]&&(r[n+i+1]="ps",i++)})),r}(t.split("").map(((t,n)=>{const r=function(t,e){const n=Object.keys(s.a1)[0],r=s.a1[n][e].substitution;return t.replace(/([AGCTU])/,r)}(t,e[n]);return r})),n,r);return i.join("")}(t,e,this.eventBus.getPhosphorothioateLinkageFlags()[this.strand],n)}createTextInputForExamples(){const t=ct.textInput("","");return this.applyStylingToInput(t),t}applyStylingToInput(t){const e=t.root.getElementsByTagName("textarea")[0];e.setAttribute("readonly","true"),Ht()(e).css("resize","none"),Ht()(t.root).css("opacity","75%")}}class Re{constructor(t,e){this.eventBus=t,this.dataManager=e,this.svgDisplay=Le.createSvgDiv(t)}getLayout(){const t=new Me(this.eventBus).getContainer(),e=this.generateDownloadControls(),n=new Be(this.eventBus,this.dataManager).createContainer();return ct.panel([this.svgDisplay,t,e,n],{style:{overflowX:"scroll",padding:"12px 24px"}})}generateDownloadControls(){return ct.divH([this.createSavePatternButton(),this.createDownloadPngButton(),this.createShareLinkButton()],{style:{gap:"12px",marginTop:"12px"}})}createDownloadPngButton(){const t=ct.button("Get PNG",(()=>this.eventBus.requestSvgSave()));return ct.tooltip.bind(t,"Download pattern as PNG"),t}createShareLinkButton(){const t=ct.button(ct.iconFA("link"),(()=>navigator.clipboard.writeText(window.location.href).then((()=>o.shell.info("Link to pattern copied to clipboard")))));return this.eventBus.patternHasUnsavedChanges$.subscribe((e=>{t.disabled=e})),ct.tooltip.bind(t,"Share pattern link"),t}createSavePatternButton(){const t=ct.button("Save",(()=>this.processSaveButtonClick()));return this.eventBus.patternHasUnsavedChanges$.subscribe((e=>{t.disabled=!e})),ct.tooltip.bind(t,"Save pattern to user storage"),t}processSaveButtonClick(){const t=this.eventBus.getPatternName();t!==this.dataManager.getDefaultPatternName()?""!==t?this.dataManager.savePatternToUserStorage(this.eventBus).then((()=>{o.shell.info(`Pattern ${t} saved`)})).catch((t=>this.handleErrorWhileSavingPattern(t))):o.shell.warning("Insert pattern name"):o.shell.warning("Cannot save default pattern")}handleErrorWhileSavingPattern(t){t instanceof _t?new Fe(this.eventBus,this.dataManager).show():t instanceof St?o.shell.warning(ct.div([ct.divText("Pattern already exists"),ct.button("Load",(()=>{const e=t.message;this.eventBus.requestLoadPatternInNewTab(e)}))])):console.error("Error while saving pattern",t)}}class Fe{constructor(t,e){this.eventBus=t,this.dataManager=e}show(){const t=this.eventBus.getPatternName(),e=ct.dialog(`Pattern "${t}" already exists`);e.add(ct.divText(`Pattern "${t}" already exists. Do you want to overwrite it?`)),e.show(),e.onOK((()=>this.processOverwriteNamesakePattern()))}processOverwriteNamesakePattern(){const t=this.eventBus.getPatternName();this.dataManager.overwritePatternInUserStorage(this.eventBus).then((()=>{o.shell.info(`Pattern ${t} overwritten`)})).catch((t=>{console.error("Error while overwriting pattern in user storage",t),o.shell.error("Error while overwriting pattern")}))}}class De extends ft{constructor(){super("Oligo Pattern")}getContent(){return async function(){const t=await It.getInstance(),e=new kt,n=await async function(t,e){const n=e.getPatternHash();if(!n)return e.clearPatternURL(),t.getDefaultPatternRecord();let r=await t.getPatternRecord(n);return r||(e.clearPatternURL(),r=t.getDefaultPatternRecord()),r}(t,e),r=new Dt(t,n);e.subscribeToObservables(r);const i=new de(r,t).getLayout(),o=new Re(r,t).getLayout();return ct.splitH([i,o],{},!0)}()}}var Ue=n(507),ke={};function $e(t){var e;return"string"==typeof t||t instanceof String?t:("object"==typeof t||t instanceof Object)&&"$thrownJsError"in t?$e(t.$thrownJsError):t instanceof Error?null!==(e=t.stack)&&void 0!==e?e:t.message:t.toString()}ke.styleTagTransform=Zt(),ke.setAttributes=Kt(),ke.insert=zt().bind(null,"head"),ke.domAPI=Gt(),ke.insertStyleElement=Xt(),jt()(Ue.A,ke),Ue.A&&Ue.A.locals&&Ue.A.locals;var He,Ve=n(74),je={};je.styleTagTransform=Zt(),je.setAttributes=Kt(),je.insert=zt().bind(null,"head"),je.domAPI=Gt(),je.insertStyleElement=Xt(),jt()(Ve.A,je),Ve.A&&Ve.A.locals&&Ve.A.locals;class qe{constructor(t,e,n=!0){this.textInputBase=t,this.painter=e,Ht()(this.root).addClass("colored-text-input"),n&&this.textInputBase.onChanged((()=>{Ht()(this.textArea).css("height",0),Ht()(this.textArea).css("height",this.textArea.scrollHeight+"px")})),this.highlights=ct.div([]),this.root.appendChild(this.highlights),this.colorize(),this.textInputBase.onChanged((()=>this.colorize()))}get textArea(){return this.textInputBase.root.getElementsByTagName("textarea").item(0)}get inputBase(){return this.textInputBase}get root(){return this.textInputBase.root}colorize(){const t=this.painter(this.textInputBase.value);this.highlights.innerHTML="",t.forEach((t=>this.highlights.appendChild(t)))}}function Ge(t){let e=0;const n=new lt(t).getFormat();null!==n&&(e=new ut.q(t).getInvalidCodeIndex(n));const r=e<0||""===t,i=ct.span([]);Ht()(i).css("-webkit-text-fill-color","var(--grey-6)");const o=ct.span([]);return Ht()(o).css("-webkit-text-fill-color","red"),r?i.innerHTML=t:(i.innerHTML=t.slice(0,e),o.innerHTML=t.slice(e)),[i,o]}!function(t){t.TYPE="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[t.MAX_ATOM_COUNT=999]="MAX_ATOM_COUNT",t.RGP_LINE_START="M RGP",t.ATOM_ALIAS_LINE_START="A ",t.END="M END"}(He||(He={}));class We{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 r=this.isWhitespace(n)?e:e-1;for(let t=0;t<r;t++)n=this.getNextColumnIdx(n);return n}parseAtomTypes(){const t=this.atomCount,e=new Array(t);let n=this.getAtomBlockIdx();for(let r=0;r<t;r++)n=this.shiftIdxToAtomType(n),e[r]=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 r=this.getAtomBlockIdx();for(let i=0;i<this.atomCount;i++){r=this.shiftIdxToXColumn(r);for(const o of[t,e,n])o[i]=this.parseFloatValue(r),r=this.getNextColumnIdx(r);r=this.getNextLineIdx(r)}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 r=new Uint16Array(2);r[0]=this.parseIntValue(e),e=this.getNextColumnIdx(e),r[1]=this.parseIntValue(e),t[n]=r,e=this.getNextLineIdx(e)}return t}parseBondTypes(){const t=this.bondCount,e=new Uint16Array(t);let n=this.getBondBlockIdx();for(let r=0;r<t;r++)n=this.shiftIdxToBondType(n),e[r]=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 ze extends We{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 r=0;r<e;r++){if(n=this.shiftIdxToAtomType(n),t(this.fileContent.charCodeAt(n),n))return!0;n=this.getNextLineIdx(n)}return!1}}class Ye extends ze{constructor(t){super(t)}getAtomLines(){const t=this.getAtomBlockIdx(),e=this.getBondBlockIdx();return this.fileContent.substring(t,e).split("\n").slice(0,this.atomCount)}getBondLines(){const t=this.getBondBlockIdx();return this.fileContent.substring(t).split("\n").slice(0,this.bondCount)}getRGroupIdToAtomicIdxMap(){const t=new Map,e=this.fileContent.split("\n");e.filter((t=>t.startsWith(He.RGP_LINE_START))).forEach((e=>{const n=this.getAtomIdxToRgpIdxList(e);for(const[e,r]of n){if(t.has(e))throw new Error(`R group ${e} is already in the map`);t.set(e,r)}}));const n=e.map(((t,e)=>{if(t.startsWith(He.ATOM_ALIAS_LINE_START))return e})).filter((t=>void 0!==t)),r=n.map((t=>e[t])),i=n.map((t=>e[t+1]));r.forEach(((e,n)=>{const r=parseInt(e.split(/\s+/)[1])-1,o=parseInt(i[n].substring(1));if(t.has(o))throw new Error(`R group ${o} is already in the map`);t.set(o,r)}));const o=this.getRGroupAtomicIndices().filter((e=>!Array.from(t.values()).includes(e)));if(0!==o.length)throw new Error(`Unaccounted R group indices: ${o}`);return t}getAtomIdxToRgpIdxList(t){const e=t.split(/\s+/).filter((t=>t)).slice(3).map((t=>parseInt(t))),n=new Array(e.length/2);for(let t=0;t<e.length;t+=2)n[t/2]=[e[t+1],e[t]-1];return n}getRGroupAtomicIndices(){return this.atomTypes.map(((t,e)=>{if(t.includes("R#"))return e})).filter((t=>void 0!==t))}static isValidMolfile(t){return-1!==t.indexOf(He.TYPE)&&-1!==t.indexOf(He.END)}shiftIdxToAtomType(t){return this.shiftIdxToSpecifiedColumn(t,He.ATOM_TYPE_COL)}getCountsLineIdx(){let t=0;for(let e=0;e<He.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,He.FIRST_BONDED_ATOM_COL)}shiftIdxToBondType(t){return this.shiftIdxToSpecifiedColumn(t,He.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+He.NUM_OF_COUNTS_DIGITS;const n=parseInt(this.fileContent.substring(t,e));return t=e,e+=He.NUM_OF_COUNTS_DIGITS,{atomCount:n,bondCount:parseInt(this.fileContent.substring(t,e))}}}class Ke extends ze{constructor(t){super(t),this.init(t)}getAtomLines(){const t=this.getAtomBlockIdx(),e=this.getBondBlockIdx();return this.fileContent.substring(t,e).split("\n").slice(0,this.atomCount)}getBondLines(){const t=this.getBondBlockIdx();return this.fileContent.substring(t).split("\n").slice(0,this.bondCount)}getRGroupIdToAtomicIdxMap(){const t=new Map;return this.getAtomLines().forEach(((e,n)=>{const r=e.match(/RGROUPS=\(([\d\s]+)\)/);if(r){const e=r[1].split(/\s+/).map((t=>parseInt(t)));if(e.length>2)throw new Error(`R group data ${e} has more than 2 elements`);const i=e[1];if(t.has(i))throw new Error(`R group ${i} is already in the map`);t.set(i,n)}})),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 isValidMolfile(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))}}}class Qe{constructor(){}static getInstance(t){if(Qe.isMolfileV2K(t))return new Ye(t);if(Qe.isMolfileV3K(t))return new Ke(t);throw new Error("Malformed molfile")}static isMolfileV2K(t){return Ye.isValidMolfile(t)}static isMolfileV3K(t){return Ke.isValidMolfile(t)}}const Xe=class extends Error{constructor(t){super(t)}};class Je{constructor(t){this.molblock=t}get molblock(){return this._validMolBlock}set molblock(t){if(""!==t){try{this.validateMolBlock(t)}catch(e){e instanceof Xe&&(t="");const n=$e(e);console.error(n)}this._validMolBlock=t}else this._validMolBlock=t}validateMolBlock(t){if(""===t)throw new Xe("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=$e(t);console.error(e)}}getMoleculeDimensions(){const t=Qe.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=ct.dialog({title:"Molecule",showFooter:!1}),e=.7*Ht()(window).height(),n=this.getMoleculeDimensions(),r=e/n.height,i=e,o=n.width*r,s=ct.canvas(o,i);await this.drawMolBlockOnCanvas(s);const a=ct.block([s],{style:{overflowX:"scroll"}});t.add(a).showModal(!0),Ht()(t.root).find(".d4-dialog-contents").removeClass("ui-form"),Ht()(t.root).find(".d4-dialog-contents").removeClass("ui-panel"),Ht()(t.root).find(".d4-dialog-contents").addClass("ui-box"),Ht()(t.root).find(".d4-dialog-contents").css("padding","0")}async drawMolecule(t,e,n){t.innerHTML="";const r=ct.canvas(e*window.devicePixelRatio,n*window.devicePixelRatio);r.style.width=`${e}px`,r.style.height=`${n}px`,r.style.cursor="zoom-in",this.drawMolBlockOnCanvas(r),r.addEventListener("click",(async()=>{await this.zoomIn()})),t.append(ct.tooltip.bind(r,"Click to zoom"))}}class Ze{constructor(t,e){this.sequence=t,this.codeMap=e}parseSequence(){const t=this.parseRawSequence();return this.addLinkers(t)}addLinkers(t){const e=[];return t.forEach(((n,r)=>{const i=this.getSymbolForCode(n);r>0&&function(t){return s.TJ.left.includes(t)}(i)&&e.pop(),e.push(i);const o=tn(i),a=r===t.length-1,u=r+1<t.length&&tn(this.getSymbolForCode(t[r+1]));o||function(t){return s.TJ.right.includes(t)}(i)||u||a||e.push("p")})),e}getSymbolForCode(t){let e=this.codeMap.get(t);return e??(e=t),e}parseRawSequence(){const t=this.getAllCodesOfFormat(),e=[];let n=0;for(;n<this.sequence.length;){const r=t.find((t=>t===this.sequence.substring(n,n+t.length)));e.push(r),n+=r.length}return e}getAllCodesOfFormat(){const t=Array.from(this.codeMap.keys());return(0,ot.iD)(t)}}function tn(t){return s.TJ.phosphate.includes(t)}class en{constructor(t,e=!1,n){this.invert=e,this.lib=a.k.getInstance();const r=this.lib.getCodeToSymbolMap(n);this.parser=new Ze(t,r)}convert(){const t=this.parser.parseSequence(),e=[];t.forEach(((t,n)=>{const r=this.getMonomerMolfile(t,n);e.push(r)}));let n=this.getPolymerMolfile(e);return this.invert&&(n=this.reflect(n),n=this.invertBondConfiguration(n)),n}invertBondConfiguration(t){const e=t.indexOf("M V30 BEGIN BOND"),n=t.indexOf("M V30 END BOND");let r=t.substring(e,n);return r=r.replace(/(CFG=)([13])/g,((t,e,n)=>"1"===n?`${e}3`:"3"===n?`${e}1`:t)),t.substring(0,e)+r+t.substring(n)}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,r=e.atomIndex.indexOf(1),i=e.atomIndex.indexOf(n),o=(e.x[i]+e.x[r])/2,s=(e.y[i]+e.y[r])/2;for(let t=0;t<n;t++)e.x[t]-=o,e.y[t]-=s;for(let t=0;t<n;t++)e.x[t]=-e.x[t];const a=e.x[r];for(let t=0;t<n;t++)e.x[t]-=a;let u=t.indexOf("M V30 BEGIN ATOM");u=t.indexOf("\n",u);let l=u;for(let r=0;r<n;r++)u=t.indexOf("V30",u)+4,u=t.indexOf(" ",u)+1,u=t.indexOf(" ",u)+1,l=t.indexOf(" ",u)+1,l=t.indexOf(" ",l),u=(t=t.slice(0,u)+e.x[r]+" "+e.y[r]+t.slice(l)).indexOf("\n",u)+1;return t}extractAtomDataV3000(t){const e=this.extractAtomsBondsNumbersV3000(t);let n=t.indexOf("M V30 BEGIN ATOM");n=t.indexOf("\n",n);let r=n;const i=Array(e.natom),o=Array(e.natom),s=Array(e.natom),a=Array(e.natom);for(let u=0;u<e.natom;u++)n=t.indexOf("V30",n)+4,r=t.indexOf(" ",n),i[u]=parseInt(t.substring(n,r)),n=r+1,r=t.indexOf(" ",n),o[u]=t.substring(n,r),n=r+1,r=t.indexOf(" ",n),s[u]=parseFloat(t.substring(n,r)),n=r+1,r=t.indexOf(" ",n),a[u]=parseFloat(t.substring(n,r)),n=t.indexOf("\n",n)+1;return{atomIndex:i,atomType:o,x:s,y:a}}extractAtomsBondsNumbersV3000(t){let e=(t=t.replaceAll("\r","")).indexOf("COUNTS")+7,n=t.indexOf(" ",e);const r=parseInt(t.substring(e,n));return e=n+1,n=t.indexOf(" ",e),{natom:r,nbond:parseInt(t.substring(e,n))}}rotateNucleotidesV3000(t){const e=this.extractAtomDataV3000(t),n=e.atomIndex.length,r=e.atomIndex.indexOf(1),i=e.atomIndex.indexOf(n);n>8&&this.fix5Prime(e,r,i);const o=(e.x[i]+e.x[r])/2,s=(e.y[i]+e.y[r])/2;for(let t=0;t<n;t++)e.x[t]-=o,e.y[t]-=s;let a=0;if(0===e.x[r])a=e.y[r]>e.y[i]?Math.PI/2:3*Math.PI/2;else if(0===e.y[r])a=e.x[r]>e.x[i]?Math.PI:0;else{const t=e.y[r]/e.x[r];a=t>0?e.x[r]>0?Math.PI-Math.atan(t):2*Math.PI-Math.atan(t):e.x[r]>0?-Math.PI-Math.atan(t):Math.atan(t)}const u=Math.cos(a),l=Math.sin(a);for(let t=0;t<n;t++){const n=e.x[t];e.x[t]=n*u-e.y[t]*l,e.y[t]=n*l+e.y[t]*u}const c=e.x[r];for(let t=0;t<n;t++)e.x[t]-=c;let h=t.indexOf("M V30 BEGIN ATOM");h=t.indexOf("\n",h);let f=h;for(let r=0;r<n;r++)h=t.indexOf("V30",h)+4,h=t.indexOf(" ",h)+1,h=t.indexOf(" ",h)+1,f=t.indexOf(" ",h)+1,f=t.indexOf(" ",f),h=(t=t.slice(0,h)+e.x[r]+" "+e.y[r]+t.slice(f)).indexOf("\n",h)+1;return t}linkV3000(t,e=!0){let n="\n Datagrok macromolecule handler\n\n";n+=" 0 0 0 0 0 0 999 V3000\n",n+="M V30 BEGIN CTAB\n";let r="",i="",o="";const s=[];let a=0,u=0,l=0;for(let e=0;e<t.length;e++){const n=t[e].includes("MODIFICATION")&&0===e;let o=0;n&&(o=this.extractAtomDataV3000(t[e]).atomIndex.length),t[e]=t[e].replaceAll("(-\nM V30 ","(").replaceAll("-\nM V30 ","").replaceAll(" )",")");const c=this.extractAtomsBondsNumbersV3000(t[e]),h=this.extractAtomDataV3000(t[e]);let f=t[e].indexOf("M V30 BEGIN ATOM");f=t[e].indexOf("\n",f);let d=f,p=f;for(let r=0;r<c.natom;r++)if(1!==h.atomIndex[r]||0===e){d=t[e].indexOf("V30",d)+4,p=t[e].indexOf(" ",d);let r=0;n?(r=parseInt(t[e].substring(d,p)),1===r?r=o:r===o&&(r=1),r+=a):r=parseInt(t[e].substring(d,p))+a,t[e]=t[e].slice(0,d)+r+t[e].slice(p),d=t[e].indexOf(" ",d)+1,d=t[e].indexOf(" ",d)+1,p=t[e].indexOf(" ",d);const i=l-h.x[0];let s=Math.round(1e4*(parseFloat(t[e].substring(d,p))+i))/1e4;t[e]=t[e].slice(0,d)+s+t[e].slice(p),d=t[e].indexOf(" ",d)+1,p=t[e].indexOf(" ",d),s=Math.round(1e4*parseFloat(t[e].substring(d,p)))/1e4,t[e]=t[e].slice(0,d)+s+t[e].slice(p),d=t[e].indexOf("\n",d)+1}else d=t[e].indexOf("M V30",d)-1,p=t[e].indexOf("\n",d+1),t[e]=t[e].slice(0,d)+t[e].slice(p);const g=t[e].indexOf("M V30 END ATOM");r+=t[e].substring(f+1,g);let m=t[e].indexOf("M V30 BEGIN BOND");m=t[e].indexOf("\n",m),d=m,p=m;for(let r=0;r<c.nbond;r++){d=t[e].indexOf("V30",d)+4,p=t[e].indexOf(" ",d);const r=parseInt(t[e].substring(d,p))+u;t[e]=t[e].slice(0,d)+r+t[e].slice(p),d=t[e].indexOf(" ",d)+1,d=t[e].indexOf(" ",d)+1,p=t[e].indexOf(" ",d);let i=0;n?(i=parseInt(t[e].substring(d,p)),1===i?i=o:i===o&&(i=1),i+=a):i=parseInt(t[e].substring(d,p))+a,t[e]=t[e].slice(0,d)+i+t[e].slice(p),d=t[e].indexOf(" ",d)+1,p=Math.min(t[e].indexOf("\n",d),t[e].indexOf(" ",d)),i=0,n?(i=parseInt(t[e].substring(d,p)),1===i?i=o:i===o&&(i=1),i+=a):i=parseInt(t[e].substring(d,p))+a,t[e]=t[e].slice(0,d)+i+t[e].slice(p),d=t[e].indexOf("\n",d)+1}const v=t[e].indexOf("M V30 END BOND");i+=t[e].substring(m+1,v);let y=t[e].indexOf("M V30 MDLV30/STEABS ATOMS=(");for(;-1!==y;){y+=28;const n=t[e].indexOf(")",y);t[e].substring(y,n).split(" ").slice(1).forEach((t=>{s.push(parseInt(t)+a)})),y=n,y=t[e].indexOf("M V30 MDLV30/STEABS ATOMS=(",y)}a+=c.natom-1,u+=c.nbond,l+=n?Math.max(...h.x):h.x[c.natom-1]-h.x[0]}const c=Math.ceil(s.length/4);o+="M V30 MDLV30/STEABS ATOMS=("+s.length+" -\n";for(let t=0;t<c;t++){o+="M V30 ";const e=t+1===c?s.length-4*(c-1):4;for(let n=0;n<e;n++)o+=n+1===e?t===c-1?s[4*t+n]+")\n":s[4*t+n]+" -\n":s[4*t+n]+" "}return a++,n+="M V30 COUNTS "+a+" "+u+" 0 0 0\n",n+="M V30 BEGIN ATOM\n",n+=r,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+=o,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 r=e+1,i=t.x[r],o=t.y[r],s=t.x[n]-i,a=t.y[n]-o,u=t.x[e]-i,l=t.y[e]-o,c=u*Math.cos(2*Math.PI/3)-l*Math.sin(2*Math.PI/3),h=u*Math.sin(2*Math.PI/3)+l*Math.cos(2*Math.PI/3),f=u-s,d=l-a,p=c-s,g=h-a;Math.sqrt(g*g+p*p)>=Math.sqrt(d*d+f*f)&&(t.x[e]=c+i,t.y[e]=h+o)}}var nn=n(670);function rn(t,e){if(""===t)return"";const n=new lt(t).getFormat();if(!n)return"";let r="";try{r=new en(t,e,n).convert()}catch(t){const e=$e(t);console.error(e)}return r}function on(t,e,n,r){const i=[t,e,n].filter((t=>""!==t.strand));if(1===i.length)return rn(i[0].strand,i[0].invert);{const i=rn(t.strand,t.invert),o=[rn(e.strand,e.invert),rn(n.strand,n.invert)].filter((t=>""!==t));return(0,nn.vS)({senseStrands:[i],antiStrands:o},r)}}const sn=["ss","as","as2"];class an{constructor(){this.onInput=new Nt.Subject,this.onInvalidInput=new Nt.Subject,this.inputBase=Object.fromEntries(sn.map((t=>[t,ct.textInput("","",(()=>{this.onInput.next()}))]))),this.useChiralInput=ct.boolInput("Use chiral",!0),this.saveAllStrandsInput=ct.boolInput("Save as one entity",!0),ct.tooltip.bind(this.saveAllStrandsInput.root,"Save SDF with all strands in one molfile"),this.directionInversion=Object.fromEntries(sn.map((t=>[t,!1]))),this.moleculeImgDiv=ct.block([]),Ht()(this.moleculeImgDiv).addClass("st-structure-mol-img"),r.debounce(this.onInput,300).subscribe((async()=>{await this.updateMoleculeImg()})),r.debounce(this.onInvalidInput,1e3).subscribe((async()=>{o.shell.warning("Insert Sense strand")}))}async getHtmlDivElement(){const t=this.getTableInput(),e=this.getBoolInputsAndButton();await this.updateMoleculeImg();const n=ct.divH([e,this.moleculeImgDiv]);Ht()(n).addClass("st-structure-bottom");const r=ct.divV([t,n]);return Ht()(r).addClass("st-structure-body"),r}getBoolInputsAndButton(){const t=ct.buttonsInput([ct.bigButton("Save SDF",(()=>{const t=this.getStrandData();!function(t,e,n,r,i){const s=[t.strand,e.strand,n.strand].filter((t=>""!==t));if(0===s.length||1===s.length&&""===t.strand)o.shell.warning("Enter SENSE_STRAND and optionally ANTISENSE_STRAND/AS2 to save SDF");else{let a;if(i)a=on(t,e,n,r)+"\n$$$$\n";else{const h=rn(t.strand,t.invert),f=rn(e.strand,e.invert),d=rn(n.strand,n.invert);a=h+"\n> <Sequence>\nSense Strand\n$$$$\n",f&&(a+=f+"\n> <Sequence>\nAnti Sense\n$$$$\n"),d&&(a+=d+"\n> <Sequence>\nAnti Sense 2\n$$$$\n")}const u=new Date;function l(t){return t>=10?t.toString():"0"+t.toString()}const c=u.getFullYear()+"-"+l(u.getMonth()+1)+"-"+l(u.getDate())+"_"+l(u.getHours())+"-"+l(u.getMinutes())+"-"+l(u.getSeconds());(0,ot.RG)(`SequenceTranslator-${c}.sdf`,encodeURIComponent(a))}}(t.ss,t.as,t.as2,this.useChiralInput.value,this.saveAllStrandsInput.value)}))]),e=[this.saveAllStrandsInput.root,this.useChiralInput.root,t],n=ct.divV(e);for(const t of e)Ht()(t).addClass("st-structure-bool-button-block");return n}getTableInput(){const t=Object.fromEntries(sn.map((t=>[t,new qe(this.inputBase[t],Ge)]))),e=Object.fromEntries(sn.map(((t,e)=>{const n=0===e?"5′ → 3′":"3′ → 5′";return[t,ct.choiceInput(`${t.toUpperCase()} direction`,n,["5′ → 3′","3′ → 5′"])]})));sn.forEach(((t,n)=>{e[t].onChanged((()=>{let r="3′ → 5′"===e[t].value;n>0&&(r=!r),this.directionInversion[t]=r,this.onInput.next()}))}));const n=["Sense Strand","Anti Sense","Anti Sense 2"],r=new Map(sn.map(((t,e)=>[t,n[e]]))),i=Object.fromEntries(sn.map((t=>[t,ct.label(r.get(t))]))),o=Object.fromEntries(sn.map((e=>{const n=ct.icons.delete((()=>{t[e].inputBase.value=""})),r=ct.button(n,(()=>{}));return ct.tooltip.bind(r,`Clear ${e.toUpperCase()}`),[e,n]}))),s=sn.map((n=>({label:i[n],textInput:t[n].root,clear:o[n],choiceInput:e[n].root}))),a=ct.table(s,(t=>[t.label,t.textInput,t.clear,t.choiceInput]));Ht()(a).css("margin-top","10px");for(const t of sn){let n=i[t].parentElement;n.classList.add("st-structure-input-form"),Ht()(n).css("padding-top","3px"),n=e[t].root.parentElement,n.classList.add("st-structure-input-form","st-structure-direction-choice"),n=this.inputBase[t].root.parentElement,n.classList.add("st-structure-text-input-td")}return a}getStrandData(){return Object.fromEntries(sn.map((t=>{const e=this.directionInversion[t];return[t,{strand:this.inputBase[t].value.replace(/\s*/g,""),invert:e}]})))}getMolfile(t,e,n){return on(t,e,n,this.useChiralInput.value)}async updateMoleculeImg(){let t="";try{const e=this.getStrandData();Object.values(e).some((t=>""!==t.strand))&&(t=this.getMolfile(e.ss,e.as,e.as2))}catch(t){const e=$e(t);console.error(e)}const e=new Je(t);await e.drawMolecule(this.moleculeImgDiv,650,150),Ht()(this.moleculeImgDiv).find("canvas").css("float","inherit")}}class un extends ft{constructor(){super("Oligo Structure"),this.layout=new an}getContent(){return this.layout.getHtmlDivElement()}}async function ln(t){try{const e={overflowX:"scroll"},n=ct.div([],{style:e}),r=(0,nn.cx)(t),i=.7*Ht()(window).height(),s=Math.max(...r.x)-Math.min(...r.x),a=Math.max(...r.y)-Math.min(...r.y),u=i/a,l=u*s,c=u*a,h=ct.canvas(l*window.devicePixelRatio,c*window.devicePixelRatio);h.style.width=`${l}px`,h.style.height=`${c}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),ct.dialog("Molecule").add(n).showModal(!0)}catch(t){const e=$e(t);console.error(e)}}class cn{static async view(){const t=a.k.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 ln(e)}))}}var hn=n(480),fn=n(348),dn=n(67),pn=n(254),gn={};gn.styleTagTransform=Zt(),gn.setAttributes=Kt(),gn.insert=zt().bind(null,"head"),gn.domAPI=Gt(),gn.insertStyleElement=Xt(),jt()(pn.A,gn),pn.A&&pn.A.locals&&pn.A.locals;const mn=["Sequence"];class vn{constructor(){this.inputFormats=Object.keys(s.$D).concat(at.NO.HELM),this.onInput=new Nt.Subject,this.moleculeImgDiv=ct.div([]),this.moleculeImgDiv.className="mol-host",this.moleculeImgDiv.style.border="1px solid var(--grey-2)",this.moleculeImgDiv.style.borderRadius="1px",this.moleculeImgDiv.style.marginTop="12px",this.outputTableDiv=ct.div([]),this.formatChoiceInput=ct.choiceInput("",at.NO.HELM,this.inputFormats,(async()=>{this.format=this.formatChoiceInput.value,this.updateTable(),await this.updateMolImg()})),this.sequenceInputBase=ct.textInput("","Afcgacsu",(()=>{this.onInput.next()})),this.init(),r.debounce(this.onInput,300).subscribe((async()=>{this.init(),this.formatChoiceInput.value=this.format,this.updateTable(),await this.updateMolImg()})),this.eventBus=Cn.getInstance()}async getHtmlElement(){const t=this.constructSingleSequenceControls(),e=this.constructBulkTranslationControls(),n=ct.box(ct.panel([t,e,ct.block([ct.box(this.moleculeImgDiv)])]));return this.formatChoiceInput.value=this.format,this.updateTable(),await this.updateMolImg(),n}constructBulkTranslationControls(){const t=ct.h1("Bulk");ct.tooltip.bind(t,"Bulk translation from table input");const e=new yn(this.eventBus).createUIComponents(),n=ct.choiceInput("Input format",at.NO.AXOLABS,this.inputFormats,(t=>this.eventBus.selectInputFormat(t))),r=ct.choiceInput("Output format",dn.qP,(0,hn.OT)(),(t=>this.eventBus.selectOutputFormat(t))),i=this.createConvertBulkButton(),o=ct.div([...e,n,r,i],"ui-form");return ct.block25([t,o])}createConvertBulkButton(){const t=ct.bigButton("Convert",(()=>this.processConvertBulkButtonClick()));return ct.tooltip.bind(t,"Convert sequences from table input"),$(t).css({float:"right","margin-top":"20px"}),t}processConvertBulkButtonClick(){const t=this.eventBus.getSelectedTable();if(!t)return void o.shell.warning("No table selected");const e=this.eventBus.getSelectedInputFormat(),n=this.eventBus.getSelectedOutputFormat(),i=this.eventBus.getSelectedColumn("Sequence");if(!i)return void o.shell.warning("No sequence column selected");const s=`${i.name} (${n})`,a=r.Column.fromList(r.TYPE.STRING,s,i.toList().map((t=>(0,hn.C6)(t,e,n))));if(n===dn.qP||n===at.NO.HELM){a.semType=r.SEMTYPE.MACROMOLECULE;const t=n==dn.qP?p.FASTA:p.HELM;a.setTag(r.TAGS.UNITS,t);const e=W.forColumn(a);(n==dn.qP?W.setUnitsToFastaColumn:W.setUnitsToHelmColumn)(e)}t.columns.add(a),o.data.detectSemanticTypes(t),o.shell.v=o.shell.getTableView(t.name)}constructSingleSequenceControls(){const t=new qe(this.sequenceInputBase,Ge),e=ct.button("Get SDF",(()=>{this.saveMolfile()}),"Save structure as SDF"),n=ct.button("Copy SMILES",(()=>{this.copySmiles()}),"Copy SMILES for the sequence"),r=ct.div([this.formatChoiceInput]),i=ct.button(ct.icons.delete((()=>{t.inputBase.value=""})),(()=>{}));ct.tooltip.bind(i,"Clear input");const o={format:r,textInput:t.root,clearBtn:i},s=ct.table([o],(t=>[t.format,t.textInput,t.clearBtn]));s.classList.add("st-translator-input-table");const a=ct.block([this.outputTableDiv,e,n]);return ct.block75([ct.h1("Single sequence"),s,a])}saveMolfile(){const t=new en(this.sequence,!1,this.formatChoiceInput.value).convert()+"\n$$$$";(0,ot.RG)(this.sequence+".sdf",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(dn.n_)))}updateTable(){this.outputTableDiv.innerHTML="";const t=this.format?new ut.q(this.sequence).getInvalidCodeIndex(this.format):0,e=(0,hn.bD)(this.sequence,t,this.format),n=[];for(const t of Object.keys(e)){const r="indexOfFirstInvalidChar"in e?ct.divH([]):ct.link(e[t],(()=>navigator.clipboard.writeText(e[t]).then((()=>o.shell.info(dn.n_)))),dn.U_,"");n.push({format:t,sequence:r})}const r=ct.table(n,(t=>[t.format,t.sequence]),["FORMAT","SEQUENCE"]);this.outputTableDiv.append(r),this.outputTableDiv.classList.add("st-translator-output-table")}async updateMolImg(){const t=new Je(this.molfile);await t.drawMolecule(this.moleculeImgDiv,500,170)}init(){this.sequence=this.getFormattedSequence(),this.format=new lt(this.sequence).getFormat(),this.molfile=this.getMolfile()}getFormattedSequence(){return this.sequenceInputBase.value.replace(/\s/g,"")}getMolfile(){if(!this.format)return"";if(this.format===at.NO.HELM){const t=new fn.y(this.sequence,this.format).convertTo(at.NO.AXOLABS);return new en(t,!1,at.NO.AXOLABS).convert()}return new en(this.sequence,!1,this.format).convert()}}class yn{constructor(t){this.tableInputManager=new bn(t),this.columnInputManager=new An(t)}createUIComponents(){return[this.tableInputManager.getTableInputContainer(),this.columnInputManager.getColumnControlsContainer()]}}class bn{constructor(t){this.eventBus=t,this.availableTables=[],this.tableInputContainer=ct.div([]),this.subscribeToTableEvents(),this.refreshTableInput()}getTableInputContainer(){return this.tableInputContainer}subscribeToTableEvents(){o.events.onTableAdded.subscribe((t=>this.handleTableAdded(t))),o.events.onTableRemoved.subscribe((t=>this.handleTableRemoved(t))),this.eventBus.tableSelected$.subscribe((()=>this.handleTableChoice()))}getTableFromEventData(t){return t.args.dataFrame}handleTableAdded(t){const e=this.getTableFromEventData(t);this.availableTables.some((t=>t.name===e.name))||(this.availableTables.push(e),this.eventBus.selectTable(e),this.refreshTableInput())}handleTableRemoved(t){const e=this.getTableFromEventData(t);this.availableTables=this.availableTables.filter((t=>t.name!==e.name));const n=this.availableTables[0];this.eventBus.selectTable(n||null),this.refreshTableInput()}refreshTableInput(){const t=this.createTableInput();$(this.tableInputContainer).empty(),this.tableInputContainer.append(t.root)}createTableInput(){const t=this.eventBus.getSelectedTable();return ct.tableInput("Table",t,this.availableTables,(t=>{null!==t&&t instanceof r.DataFrame&&this.eventBus.selectTable(t)}))}handleTableChoice(){const t=this.eventBus.getSelectedTable();t&&(this.isTableDisplayed(t)||this.displayTable(t))}isTableDisplayed(t){return o.shell.tableNames.includes(t.name)}displayTable(t){const e=o.shell.v;o.shell.addTableView(t),o.shell.v=e}}class An{constructor(t){this.eventBus=t,this.columnControlsContainer=ct.div([]),this.eventBus.tableSelected$.subscribe((()=>this.handleTableChoice())),this.refreshColumnControls()}getColumnControlsContainer(){return this.columnControlsContainer}handleTableChoice(){this.refreshColumnControls()}refreshColumnControls(){const t=this.createColumnInputs();$(this.columnControlsContainer).empty();const e=t.map((t=>t.root));this.columnControlsContainer.append(...e)}createColumnInputs(){const t=this.eventBus.getSelectedTable(),e=null!==t?t.columns.names().sort(((t,e)=>t.localeCompare(e))):[];return mn.map((n=>this.createColumnInput(n,e,t)))}createColumnInput(t,e,n){const r=t.toLowerCase(),i=e.find((t=>t.toLowerCase().includes(r)))||e[0];return this.selectColumnIfTableNotNull(n,i,t),ct.choiceInput(`${t}`,i,e,(e=>this.selectColumnIfTableNotNull(n,e,t)))}selectColumnIfTableNotNull(t,e,n){if(null!==t){const r=t.getCol(e);this.eventBus.selectColumn(n,r)}}}class Cn{constructor(){this._tableSelection$=new Nt.BehaviorSubject(null),this._columnSelection=Object.fromEntries(mn.map((t=>[t,new Nt.BehaviorSubject(null)]))),this._inputFormatSelection$=new Nt.BehaviorSubject(at.NO.AXOLABS),this._outputFormatSelection$=new Nt.BehaviorSubject(dn.qP)}static getInstance(){return void 0===Cn._instance&&(Cn._instance=new Cn),Cn._instance}get tableSelected$(){return this._tableSelection$.asObservable()}getSelectedTable(){return this._tableSelection$.getValue()}selectTable(t){this._tableSelection$.next(t)}selectColumn(t,e){this._columnSelection[t].next(e)}getSelectedColumn(t){return this._columnSelection[t].getValue()}getSelectedInputFormat(){return this._inputFormatSelection$.getValue()}selectInputFormat(t){this._inputFormatSelection$.next(t)}selectOutputFormat(t){this._outputFormatSelection$.next(t)}getSelectedOutputFormat(){return this._outputFormatSelection$.getValue()}}class wn extends ft{constructor(){super("Oligo Translator"),this.layout=new vn;const t=ct.iconFA("book",cn.view,"View monomer library");this.topPanel=[t],this.view.setRibbonPanels([this.topPanel])}getContent(){return this.layout.getHtmlElement()}}class xn extends ft{constructor(t,e){super(t),this.content=e}getContent(){return Promise.resolve(this.content)}}class _n extends ht{constructor(t){super("Oligo Toolkit"),this.externalViewFactories=t;const e=this.getViewFactories();this.multiView=new r.MultiView({viewFactories:e})}getViewFactories(){function t(t){const e=r.View.create(),n=new t(e);return n.initView().catch((e=>console.error(`Failed to initialize ${t.name}: ${e}`))),()=>n.getView()}let e={TRANSLATOR:t(wn),PATTERN:t(De),STRUCTURE:t(un)};return this.externalViewFactories&&(e=Object.assign({},e,this.externalViewFactories)),e}getCurrentPanePath(){let t=this.multiView.tabs.currentPane.name;return t=t.charAt(0).toUpperCase()+t.substring(1).toLowerCase(),`/apps/${Hn.name}/OligoToolkit/${t}`}setUrl(){this.multiView.path=this.getCurrentPanePath()}async constructView(){return this.multiView.tabs.onTabChanged.subscribe((()=>this.setUrl())),this.setUrl(),this.multiView}}var Sn=n(415);function En(){const t=ct.textInput("","");return{coloredInput:new qe(t,Ge),codes:s.QC}}const Tn="System:AppData/Bio/polytool-rules/",In="Polytool";class Nn{constructor(t){this.helmColumn=t}getLinkedPositions(t,e){const n=t.map((t=>t.replace("[","").replace("]",""))),r=new Array(e.length);for(let t=0;t<e.length;t++){let i=!1,o=!1,s=!1,a=-1,u=-1;const l=`(${e[t].code})`;for(let r=0;r<n.length;r++)if(n[r].includes(l)){if(i){if(s&&n[r]==e[t].secondMonomer+l){o=!0,u=r;break}if(s||n[r]!=e[t].firstMonomer+l)continue;o=!0,u=r;break}if(n[r]==e[t].firstMonomer+l)i=!0,s=!0,a=r;else{if(n[r]!=e[t].secondMonomer+l)continue;i=!0,s=!1,a=r}}r[t]=i&&o?s?[a,u]:[u,a]:[-1,-1]}return r}getRules(t){const e=t.map((t=>t.rowCount)).reduce(((t,e)=>t+e)),n=new Array(e);let r=0;for(let e=0;e<t.length;e++){const i=t[e].columns.byName("code"),o=t[e].columns.byName("monomer1"),s=t[e].columns.byName("monomer2"),a=t[e].columns.byName("modification1"),u=t[e].columns.byName("modification2"),l=t[e].columns.byName("R1"),c=t[e].columns.byName("R2");for(let h=0;h<t[e].rowCount;h++,r++)n[r]={code:i.get(h),firstMonomer:o.get(h),secondMonomer:s.get(h),firstModification:a.get(h),secondModification:u.get(h),firstR:l.get(h),secondR:c.get(h)}}return n}getDimeric(t){const e=t.replace("PEPTIDE1{","").replace("}$$$$","").split("."),n=[];for(let t=0;t<e.length;t++)if(e[t].includes("(#2)")){e[t]=e[t].replace("(#2)","");const r=t+1;let i=0;for(let t=r+1;t<e.length;t++)if(e[t].includes("}")){i=t;break}e[r]=e[r].replace("{",""),e[i]=e[i].replace("}",""),n.push([r,i])}return[e,n]}getAllCycles(t,e,n){const r=[],i=[],o=[],s=[],a=t.length;for(let u=0;u<a;u++){if(-1==n[u][0])continue;const a=e[n[u][0]].replace("[","").replace("]",""),l=e[n[u][1]].replace("[","").replace("]","");e[n[u][0]]=e[n[u][0]].replace(a,t[u].firstModification),e[n[u][1]]=e[n[u][1]].replace(l,t[u].secondModification),r.push(n[u][0]+1),i.push(n[u][1]+1),o.push(t[u].firstR),s.push(t[u].secondR)}return[e,r,i,o,s]}getHelmCycle(t,e,n){let r="";for(let i=0;i<t.allPos1.length;i++)r+=0==i?`PEPTIDE${e},PEPTIDE${n},`:`|PEPTIDE${e},PEPTIDE${n},`,r+=`${t.allPos1[i]}:R${t.allAttaches1[i]}-${t.allPos2[i]}:R${t.allAttaches2[i]}`;return r}getTransformedHelm(t,e){const[n,r]=this.getDimeric(t),i=this.getLinkedPositions(n,e),[o,s,a,u,l]=this.getAllCycles(e,n,i);t="PEPTIDE1{";for(let e=0;e<o.length;e++)t+=e!=o.length-1?o[e]+".":o[e];t+="}";const c=new Array(r.length),h=new Array(r.length);for(let t=0;t<r.length;t++){let e=`|PEPTIDE${t+2}{`;const n=r[t][1]-r[t][0],i=[],l=[],f=[],d=[];for(let i=0;i<=n;i++){const s=i+r[t][0];e+=i!=n?o[s]+".":o[s]}e+="}";for(let e=0;e<s.length;e++)s[e]-1>=r[t][0]&&s[e]-1<=r[t][1]&&(i.push(s[e]-r[t][0]),l.push(a[e]-r[t][0]),f.push(u[e]),d.push(u[e]));const p=this.getHelmCycle({allPos1:i,allPos2:l,allAttaches1:f,allAttaches2:d},t+2,t+2);c[t]=e,h[t]=this.getHelmCycle({allPos1:[r[t][0]],allPos2:[1],allAttaches1:[1],allAttaches2:[1]},1,t+2),h.push(p)}for(let e=0;e<c.length;e++)t+=c[e];t+="$",t+=this.getHelmCycle({allPos1:s,allPos2:a,allAttaches1:u,allAttaches2:l},1,1);for(let e=0;e<h.length;e++)t+="|",t+=h[e];return t+"$$$"}transform(t){const e=this.getRules(t);return this.helmColumn.toList().map((t=>this.getTransformedHelm(t,e)))}}class On{constructor(){}static getInstance(t){return new Nn(t)}}var Ln=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{u(r.next(t))}catch(t){o(t)}}function a(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))};class Mn{constructor(t,e,n=".csv"){this.path=t,this.userStorageName=e,this.ext=n,"/"!==this.path[this.path.length-1]&&(this.path+="/"),"."!==this.ext[0]&&(this.ext="."+this.ext)}getUserSettings(){return Ln(this,void 0,void 0,(function*(){if(this.settings)return this.settings;const t=yield o.dapi.userDataStorage.getValue(this.userStorageName,"Settings",!0),e=t?JSON.parse(t):{excluded:[],explicit:[]};return e.explicit=e.explicit instanceof Array?e.explicit:[],e.excluded=e.excluded instanceof Array?e.excluded:[],this.settings=e}))}setUserSettings(t){return Ln(this,void 0,void 0,(function*(){this.settings=t,yield o.dapi.userDataStorage.postValue(this.userStorageName,"Settings",JSON.stringify(t),!0)}))}getAllAvailable(){return Ln(this,void 0,void 0,(function*(){return(yield o.dapi.files.list(this.path)).map((t=>t.fullPath.replace(`${this.path}`,"")))}))}getActive(){return Ln(this,void 0,void 0,(function*(){const t=yield this.getUserSettings();return t.explicit.length>0?t.explicit:(yield this.getAllAvailable()).filter((e=>!t.excluded.includes(e)))}))}createInput(t,e){const n=ct.boolInput(t,e,(e=>this.updateSelectionStatus(t,e)));return n.addOptions(ct.button(ct.iconFA("trash"),(()=>{ct.dialog({title:"Warning"}).add(ct.divText(`Delete file '${t}'?`)).onOK((()=>{n.root.remove(),this.availableRemove(t)})).show()}),`Delete ${t}`)),n}getInputs(){return Ln(this,void 0,void 0,(function*(){const t=yield this.getAllAvailable(),e=yield this.getActive(),n=new Array(t.length);for(let r=0;r<t.length;r++){const i=e.includes(t[r]);n[r]=this.createInput(t[r],i)}return n}))}getForm(){return Ln(this,void 0,void 0,(function*(){const t=yield this.getInputs(),e=ct.divV(t);return ct.divV([e,ct.button("ADD",(()=>Ln(this,void 0,void 0,(function*(){let t="";t=yield this.getNewAvailable(),""!==t&&e.append(this.createInput(t,!0).root)}))))])}))}updateSelectionStatus(t,e){return Ln(this,void 0,void 0,(function*(){const n=yield this.getUserSettings();if(!n.excluded.includes(t)!==e){if(e){const e=n.excluded.indexOf(t);e>-1&&n.excluded.splice(e,1)}else n.excluded.push(t);this.setUserSettings(n)}}))}availableRemove(t){return Ln(this,void 0,void 0,(function*(){const e=yield this.getUserSettings(),n=e.excluded.indexOf(t);n>-1&&e.excluded.splice(n,1),yield Promise.all([this.setUserSettings(e),o.dapi.files.delete(this.path+t)]),o.shell.info(`File ${t} successfully deleted`)}))}getNewAvailable(){return Ln(this,void 0,void 0,(function*(){return new Promise(((t,e)=>{r.Utils.openFile({accept:this.ext,open:e=>Ln(this,void 0,void 0,(function*(){const n=e.name,r=yield e.arrayBuffer();yield o.dapi.files.write(this.path+`${e.name}`,new Uint8Array(r)),t(n)}))})}))}))}}class Bn extends Mn{constructor(t,e,n){super(t,e,n)}}const Pn={symbol:"Short Name",name:"Medium Name",smiles:"SMILES"},Rn=[{capGroupSMILES:"[*:1][H]",alternateId:"R1-H",capGroupName:"H",label:"R1"},{capGroupSMILES:"O[*:2]",alternateId:"R2-OH",capGroupName:"OH",label:"R2"},{capGroupSMILES:"[*:3][H]",alternateId:"R3-H",capGroupName:"H",label:"R3"}];class Fn{constructor(t){this.rawLib=t}isValid(){return this.rawLib.every((t=>"object"==typeof t&&Object.values(Pn).every((e=>e in t&&"string"==typeof t[e]))))}getJsonMonomerLib(){const t=[];return this.rawLib.forEach((e=>{const n=this.prepareMonomer(e);t.push(n)})),t}prepareMonomer(t){const e={...u};Object.entries(Pn).forEach((([n,r])=>{const i=t[r];e[n]=i}));let n="smiles";const r=t[Pn[n]],i=new Dn(r),o=i.getCappedSmiles();return e[n]=o,n="rgroups",e[n]=Un.getRGroups(i.getNumberOfRGroups()),n="molfile",e[n]=new kn(i.getSmilesWithRGroups()).getMolfile(),e}}class Dn{constructor(t){let e=0;this.smilesWithRGroups=t.replace(/\[R(\d+)\]/g,((t,n)=>(++e,`[${n}*]`))),this.numberOfRGroups=e}getSmilesWithRGroups(){return this.smilesWithRGroups}getCappedSmiles(){return this.capRGroups()}getNumberOfRGroups(){return this.numberOfRGroups}capRGroups(){let t=this.smilesWithRGroups.replace("[1*]","[H:1]");return t=t.replace("[2*]","[OH:2]"),t.replace("[3*]","[H:3]")}}class Un{constructor(){}static getRGroups(t){return Rn.slice(0,t)}}class kn{constructor(t){this.smilesWithRGroups=t}getMolfile(){let t=r.chem.convert(this.smilesWithRGroups,r.chem.Notation.Smiles,r.chem.Notation.MolBlock);return t=this.restoreRGPLine(t),t=this.fixRGroupSymbols(t),t}restoreRGPLine(t){return t.replace("M ISO","M RGP")}fixRGroupSymbols(t){return t.replace(/\bR\b/g,"R#")}}class $n{constructor(t,e){this.fileName=t,this.fileContent=e,this.validateFileType();const n=r.DataFrame.fromCsv(this.fileContent),i=this.toJson(n);this.polyToolMonomerLib=new Fn(i),this.validateContent()}async getJson(){return this.polyToolMonomerLib.getJsonMonomerLib()}toJson(t){return Array.from({length:t.rowCount},((e,n)=>t.columns.names().reduce(((e,r)=>(e[r]=t.get(r,n),e)),{})))}validateFileType(){if(!this.fileName.endsWith(".csv"))throw new Error(`File ${this.fileName} is not an CSV file`)}validateContent(){if(!this.polyToolMonomerLib.isValid())throw new Error("Invalid format of CSV monomer lib")}}const Hn=new st;async function Vn(){await Wn();const t=await async function(){const t={"Mermadesynthesis:merMadeSynthesis":{tabName:"SYNTHESIZE",parameters:En()}},e={};for(const[n,r]of Object.entries(t)){let t;try{t=await o.functions.call(n,r.parameters);const i=new xn(r.tabName,t);i.initView(),e[r.tabName]=()=>i.getView()}catch(t){console.warn(`Plugin ${n} not loaded, reason:`,t);continue}}return e}();if(!t)throw new Error("External app view factories not loaded");const e=new _n(t);return await e.getAppView()}async function jn(){return await er("Oligo Translator")}async function qn(){return await er("Oligo Pattern")}async function Gn(){return await er("Oligo Structure")}async function Wn(){await(0,s.hH)(),await Hn.initMonomerLib()}function zn(){const t=a.k.getInstance().getCodesToWeightsMap();return Object.fromEntries(t)}function Yn(t){const e=new ut.q(t),n=new lt(t).getFormat();return null!==n&&e.isValidSequence(n)}function Kn(t,e){return new en(t,e,"GCRS").convert()}function Qn(t){return(0,nn.vS)(t,!0)}async function Xn(){await async function(){await(0,ot.TX)((async()=>{const t=await jn();o.shell.addView(t)}))}()}async function Jn(){await async function(){await(0,ot.TX)((async()=>{const t=await qn();o.shell.addView(t)}))}()}async function Zn(){await async function(){await(0,ot.TX)((async()=>{const t=await Gn();o.shell.addView(t),["Afcgacsu","Afcgacsu","Afcgacsu"].forEach((async(t,e)=>{await async function(t,e){await(0,Sn.cb)(500);const n=document.querySelectorAll(".colored-text-input > textarea")[t];n.value=e;const r=new Event("input");n.dispatchEvent(r)}(e,t)}))}))}()}async function tr(t,e,n){return await Wn(),new fn.y(t,e).convertTo(n)}async function er(t){await Wn();const e=function(t){switch(t){case"Oligo Translator":return new wn;case"Oligo Pattern":return new De;case"Oligo Structure":return new un;default:throw new Error(`Unknown app name: ${t}`)}}(t);return await e.getAppView()}async function nr(){let t;try{t=await async function(){const t=o.shell.t.columns.bySemTypeAll(r.SEMTYPE.MACROMOLECULE);if(!t)throw new Error("No dataframe with macromolecule columns open");const e=ct.columnInput("Column",o.shell.t,t[0],null,{filter:t=>t.semType===r.SEMTYPE.MACROMOLECULE}),n=ct.boolInput("Get HELM",!0);ct.tooltip.bind(n.root,"Add HELM column");const i=ct.boolInput("Chirality engine",!1),s=new Bn(Tn,In,".csv"),a=await s.getForm(),u=ct.div([e,n,i,"Rules used",a]);return ct.dialog("Poly Tool").add(u).onOK((async()=>{const t=e.value;if(!t)return void o.shell.warning("No marcomolecule column chosen!");const a=await s.getActive();!async function(t,e,n,i){const s=t.dataFrame,a=W.forColumn(t).convert(p.HELM),u=On.getInstance(a),l=new r.FileSource(Tn),c=new Array(n.length);for(let t=0;t<n.length;t++){const e=await l.readAsText(n[t].replace(Tn,""));c[t]=r.DataFrame.fromCsv(e)}const h=u.transform(c),f=s.columns.getUnusedName("transformed("+t.name+")"),d=r.Column.fromList("string",f,h);var g;(g=d).setTag("quality",r.SEMTYPE.MACROMOLECULE),g.setTag("aligned","SEQ"),g.setTag("alphabet","PT"),d.setTag("units",p.HELM);const m=await o.functions.call("Bio:getMolFromHelm",{df:s,helmCol:d,chiralityEngine:i});m.name=s.columns.getUnusedName("molfile("+t.name+")"),m.semType=r.SEMTYPE.MOLECULE,e&&(d.setTag("cell.renderer","helm"),s.columns.add(d)),s.columns.add(m,!0),await o.data.detectSemanticTypes(s)}(t,n.value,a,i.value)}))}(),t.show()}catch(t){o.shell.warning("To run PolyTool, open a dataframe with macromolecules")}}async function rr(t,e){var n;(function(t){t.setTag("quality",r.SEMTYPE.MACROMOLECULE),t.setTag("aligned","SEQ"),t.setTag("alphabet","PT")})(n=e),n.setTag("units",p.SEPARATOR),n.setTag("separator","-"),await o.data.detectSemanticTypes(t)}async function ir(t){const e=await t.readAsString(),n=new $n(t.fileName,e),r=await n.getJson(),o=t.fileName.replace(/\.csv$/,".json"),s=JSON.stringify(r,null,2);i().Utils.download(o,s)}},82:t=>{"use strict";t.exports=DG},328:t=>{"use strict";t.exports=grok}},e={};function n(r){var i=e[r];if(void 0!==i)return i.exports;var o=e[r]={id:r,loaded:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.loaded=!0,o.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 r in e)n.o(e,r)&&!n.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),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.nmd=t=>(t.paths=[],t.children||(t.children=[]),t),n.nc=void 0;var r=n(416);sequencetranslator=r})();
2
3
  //# sourceMappingURL=package.js.map