@rnacanvas/draw.interact 2.1.0 → 2.3.0

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.
@@ -37,7 +37,7 @@ interface LiveSet<T> {
37
37
  * by dragging the mouse over them while holding down the mouse and the `Shift` key.
38
38
  */
39
39
  export declare class ConsecutiveBasesSelectingTool<B extends Nucleobase> {
40
- private targetDrawing;
40
+ target: Drawing<B>;
41
41
  private selectedBases;
42
42
  /**
43
43
  * The most recent mouse down event.
@@ -50,10 +50,10 @@ export declare class ConsecutiveBasesSelectingTool<B extends Nucleobase> {
50
50
  /**
51
51
  * The provided set of selected bases will be modified based on user interaction with the target drawing.
52
52
  *
53
- * @param targetDrawing The drawing that the tool is for.
53
+ * @param target The drawing that the tool is for.
54
54
  * @param selectedBases A live set of the currently selected bases.
55
55
  */
56
- constructor(targetDrawing: Drawing<B>, selectedBases: LiveSet<B>);
56
+ constructor(target: Drawing<B>, selectedBases: LiveSet<B>);
57
57
  handleMouseDown(event: MouseEvent): void;
58
58
  handleMouseUp(event: MouseEvent): void;
59
59
  handleMouseOver(event: MouseEvent): void;
@@ -1 +1 @@
1
- {"version":3,"file":"ConsecutiveBasesSelectingTool.d.ts","sourceRoot":"","sources":["../src/ConsecutiveBasesSelectingTool.ts"],"names":[],"mappings":"AAAA,UAAU,UAAU;IAClB;;OAEG;IACH,OAAO,EAAE,IAAI,CAAC;CACf;AAED;;GAEG;AACH,UAAU,OAAO,CAAC,CAAC,SAAS,UAAU;IACpC;;OAEG;IACH,OAAO,EAAE,IAAI,CAAC;IAEd;;;;OAIG;IACH,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC;CACpB;AAED;;GAEG;AACH,UAAU,OAAO,CAAC,CAAC;IACjB;;OAEG;IACH,OAAO,CAAC,IAAI,EAAE,CAAC,GAAG,OAAO,CAAC;IAE1B;;OAEG;IACH,MAAM,CAAC,KAAK,EAAE,CAAC,EAAE,GAAG,IAAI,CAAC;CAC1B;AAED;;;GAGG;AACH,qBAAa,6BAA6B,CAAC,CAAC,SAAS,UAAU;IAiBjD,OAAO,CAAC,aAAa;IAAc,OAAO,CAAC,aAAa;IAhBpE;;OAEG;IACH,OAAO,CAAC,aAAa,CAAyB;IAE9C;;OAEG;IACH,OAAO,CAAC,WAAW,CAAS;IAE5B;;;;;OAKG;gBACiB,aAAa,EAAE,OAAO,CAAC,CAAC,CAAC,EAAU,aAAa,EAAE,OAAO,CAAC,CAAC,CAAC;IAQhF,eAAe,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI;IAMxC,aAAa,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI;IAItC,eAAe,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI;CA+BzC"}
1
+ {"version":3,"file":"ConsecutiveBasesSelectingTool.d.ts","sourceRoot":"","sources":["../src/ConsecutiveBasesSelectingTool.ts"],"names":[],"mappings":"AAAA,UAAU,UAAU;IAClB;;OAEG;IACH,OAAO,EAAE,IAAI,CAAC;CACf;AAED;;GAEG;AACH,UAAU,OAAO,CAAC,CAAC,SAAS,UAAU;IACpC;;OAEG;IACH,OAAO,EAAE,IAAI,CAAC;IAEd;;;;OAIG;IACH,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC;CACpB;AAED;;GAEG;AACH,UAAU,OAAO,CAAC,CAAC;IACjB;;OAEG;IACH,OAAO,CAAC,IAAI,EAAE,CAAC,GAAG,OAAO,CAAC;IAE1B;;OAEG;IACH,MAAM,CAAC,KAAK,EAAE,CAAC,EAAE,GAAG,IAAI,CAAC;CAC1B;AAED;;;GAGG;AACH,qBAAa,6BAA6B,CAAC,CAAC,SAAS,UAAU;IAiB1C,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IAAE,OAAO,CAAC,aAAa;IAhB5D;;OAEG;IACH,OAAO,CAAC,aAAa,CAAyB;IAE9C;;OAEG;IACH,OAAO,CAAC,WAAW,CAAS;IAE5B;;;;;OAKG;gBACgB,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,EAAU,aAAa,EAAE,OAAO,CAAC,CAAC,CAAC;IAQxE,eAAe,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI;IAMxC,aAAa,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI;IAItC,eAAe,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI;CA+BzC"}
@@ -49,7 +49,7 @@ type Options = {
49
49
  afterDragging?: () => void;
50
50
  };
51
51
  export declare class DraggingTool {
52
- private targetDrawing;
52
+ target: Drawing;
53
53
  private selectedElements;
54
54
  private options?;
55
55
  /**
@@ -69,7 +69,12 @@ export declare class DraggingTool {
69
69
  * To be set to false afterwards upon mouse up.
70
70
  */
71
71
  private dragged;
72
- constructor(targetDrawing: Drawing, selectedElements: SelectedElements, options?: Options | undefined);
72
+ /**
73
+ * @param target The target drawing for the dragging tool.
74
+ * @param selectedElements
75
+ * @param options
76
+ */
77
+ constructor(target: Drawing, selectedElements: SelectedElements, options?: Options | undefined);
73
78
  private handleMouseDown;
74
79
  private handleMouseMove;
75
80
  private handleMouseUp;
@@ -1 +1 @@
1
- {"version":3,"file":"DraggingTool.d.ts","sourceRoot":"","sources":["../src/DraggingTool.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAI1D;;GAEG;AACH,UAAU,OAAO;IACf;;;OAGG;IACH,uBAAuB,EAAE,MAAM,CAAC;IAEhC;;;OAGG;IACH,qBAAqB,EAAE,MAAM,CAAC;CAC/B;AAED;;;;GAIG;AACH,UAAU,gBAAgB;IACxB;;;;;OAKG;IACH,WAAW,EAAE;QACX;;;WAGG;QACH,OAAO,CAAC,GAAG,EAAE,kBAAkB,GAAG,OAAO,CAAC;KAC3C,CAAA;IAED;;OAEG;IACH,KAAK,EAAE,QAAQ,CAAC,UAAU,CAAC,CAAC;CAC7B;AAED,KAAK,OAAO,GAAG;IACb;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,IAAI,CAAC;IAE5B;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,IAAI,CAAC;CAC5B,CAAC;AAEF,qBAAa,YAAY;IAqBX,OAAO,CAAC,aAAa;IAAW,OAAO,CAAC,gBAAgB;IAAoB,OAAO,CAAC,OAAO,CAAC;IApBxG;;OAEG;IACH,OAAO,CAAC,aAAa,CAAyB;IAE9C;;OAEG;IACH,OAAO,CAAC,WAAW,CAAS;IAE5B;;;;;;;OAOG;IACH,OAAO,CAAC,OAAO,CAAS;gBAEJ,aAAa,EAAE,OAAO,EAAU,gBAAgB,EAAE,gBAAgB,EAAU,OAAO,CAAC,EAAE,OAAO,YAAA;IAQjH,OAAO,CAAC,eAAe;IAQvB,OAAO,CAAC,eAAe;IAsBvB,OAAO,CAAC,aAAa;CAMtB"}
1
+ {"version":3,"file":"DraggingTool.d.ts","sourceRoot":"","sources":["../src/DraggingTool.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAI1D;;GAEG;AACH,UAAU,OAAO;IACf;;;OAGG;IACH,uBAAuB,EAAE,MAAM,CAAC;IAEhC;;;OAGG;IACH,qBAAqB,EAAE,MAAM,CAAC;CAC/B;AAED;;;;GAIG;AACH,UAAU,gBAAgB;IACxB;;;;;OAKG;IACH,WAAW,EAAE;QACX;;;WAGG;QACH,OAAO,CAAC,GAAG,EAAE,kBAAkB,GAAG,OAAO,CAAC;KAC3C,CAAA;IAED;;OAEG;IACH,KAAK,EAAE,QAAQ,CAAC,UAAU,CAAC,CAAC;CAC7B;AAED,KAAK,OAAO,GAAG;IACb;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,IAAI,CAAC;IAE5B;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,IAAI,CAAC;CAC5B,CAAC;AAEF,qBAAa,YAAY;IA0BJ,MAAM,EAAE,OAAO;IAAE,OAAO,CAAC,gBAAgB;IAAoB,OAAO,CAAC,OAAO,CAAC;IAzBhG;;OAEG;IACH,OAAO,CAAC,aAAa,CAAyB;IAE9C;;OAEG;IACH,OAAO,CAAC,WAAW,CAAS;IAE5B;;;;;;;OAOG;IACH,OAAO,CAAC,OAAO,CAAS;IAExB;;;;OAIG;gBACgB,MAAM,EAAE,OAAO,EAAU,gBAAgB,EAAE,gBAAgB,EAAU,OAAO,CAAC,EAAE,OAAO,YAAA;IAQzG,OAAO,CAAC,eAAe;IAQvB,OAAO,CAAC,eAAe;IAsBvB,OAAO,CAAC,aAAa;CAMtB"}
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["draw.interact"]=t():e["draw.interact"]=t()}(this,(()=>(()=>{var e={661:function(e){var t;t=()=>(()=>{var e={127:function(e){var t;t=()=>(()=>{var e={986:function(e){e.exports=(()=>{"use strict";var e={d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function r(e){var t=0;return e.forEach((function(e){return t+=e})),t}function n(e){return r(e)/e.length}function i(e){e.sort((function(e,t){return e-t}))}e.r(t),e.d(t,{areWithin:()=>p,average:()=>n,clamp:()=>h,degrees:()=>m,isBetween:()=>l,isBetweenExclusive:()=>f,isBetweenInclusive:()=>l,max:()=>c,mean:()=>n,median:()=>s,min:()=>u,radians:()=>y,sortNumbers:()=>i,sortNumbersAscending:()=>i,sortNumbersDescending:()=>g,sortedNumbers:()=>a,sortedNumbersAscending:()=>a,sortedNumbersDescending:()=>d,sum:()=>r});var o=function(e,t,r){if(r||2===arguments.length)for(var n,i=0,o=t.length;i<o;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))};function a(e){var t=o([],e,!0);return i(t),t}function s(e){if(0==e.length)return NaN;var t=a(e);if(t.length%2!=0)return t[Math.floor(t.length/2)];var r=t.length/2,i=r-1;return n([t[r],t[i]])}function u(e){if(0==e.length)return 1/0;var t=e[0];return e.slice(1).forEach((function(e){t=Math.min(t,e)})),t}function c(e){if(0==e.length)return-1/0;var t=e[0];return e.slice(1).forEach((function(e){t=Math.max(t,e)})),t}function l(e,t,r){return e>=t&&e<=r}function f(e,t,r){return e>t&&e<r}function h(e,t,r){return e<t?t:e>r?r:e}function p(e,t,r){return Math.abs(e-t)<=r}function g(e){i(e),e.reverse()}function d(e){var t=a(e);return t.reverse(),t}function m(e){return e*(180/Math.PI)}function y(e){return e*(Math.PI/180)}return t})()},369:function(e){var t;t=()=>(()=>{var e={986:function(e){e.exports=(()=>{"use strict";var e={d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function r(e){var t=0;return e.forEach((function(e){return t+=e})),t}function n(e){return r(e)/e.length}function i(e){e.sort((function(e,t){return e-t}))}e.r(t),e.d(t,{areWithin:()=>p,average:()=>n,clamp:()=>h,degrees:()=>m,isBetween:()=>l,isBetweenExclusive:()=>f,isBetweenInclusive:()=>l,max:()=>c,mean:()=>n,median:()=>s,min:()=>u,radians:()=>y,sortNumbers:()=>i,sortNumbersAscending:()=>i,sortNumbersDescending:()=>g,sortedNumbers:()=>a,sortedNumbersAscending:()=>a,sortedNumbersDescending:()=>d,sum:()=>r});var o=function(e,t,r){if(r||2===arguments.length)for(var n,i=0,o=t.length;i<o;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))};function a(e){var t=o([],e,!0);return i(t),t}function s(e){if(0==e.length)return NaN;var t=a(e);if(t.length%2!=0)return t[Math.floor(t.length/2)];var r=t.length/2,i=r-1;return n([t[r],t[i]])}function u(e){if(0==e.length)return 1/0;var t=e[0];return e.slice(1).forEach((function(e){t=Math.min(t,e)})),t}function c(e){if(0==e.length)return-1/0;var t=e[0];return e.slice(1).forEach((function(e){t=Math.max(t,e)})),t}function l(e,t,r){return e>=t&&e<=r}function f(e,t,r){return e>t&&e<r}function h(e,t,r){return e<t?t:e>r?r:e}function p(e,t,r){return Math.abs(e-t)<=r}function g(e){i(e),e.reverse()}function d(e){var t=a(e);return t.reverse(),t}function m(e){return e*(180/Math.PI)}function y(e){return e*(Math.PI/180)}return t})()},854:function(e){e.exports=(()=>{"use strict";var e={d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function r(e){return"number"==typeof e}function n(e){return r(e)&&Number.isFinite(e)}function i(e){return r(e)&&!Number.isFinite(e)}function o(e){return n(e)&&e>0}function a(e){return n(e)&&e>=0}function s(e){return"string"==typeof e}function u(e){return null==e}function c(e){return"object"==typeof e&&null!==e}function l(e){return Array.isArray(e)}function f(e){return l(e)&&e.every(r)}function h(e){return l(e)&&e.every(n)}function p(e){return l(e)&&e.every(i)}function g(e){return l(e)&&e.every(s)}return e.r(t),e.d(t,{isArray:()=>l,isFiniteNumber:()=>n,isFiniteNumbersArray:()=>h,isNonFiniteNumber:()=>i,isNonFiniteNumbersArray:()=>p,isNonNegativeFiniteNumber:()=>a,isNonNullObject:()=>c,isNullish:()=>u,isNumber:()=>r,isNumbersArray:()=>f,isPositiveFiniteNumber:()=>o,isString:()=>s,isStringsArray:()=>g}),t})()}},t={};function r(n){var i=t[n];if(void 0!==i)return i.exports;var o=t[n]={exports:{}};return e[n].call(o.exports,o,o.exports,r),o.exports}r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};return(()=>{"use strict";r.r(n),r.d(n,{Linkers:()=>m,Stems:()=>d,areConflicting:()=>c,areCrossing:()=>h,areEqual:()=>s,areKnotless:()=>f,areStacked:()=>u,deepCopy:()=>i,knotless:()=>g,mountainPlotTraversal:()=>y,parseDotBracket:()=>b,sorted:()=>a});var e=r(854),t=function(e,t,r){if(r||2===arguments.length)for(var n,i=0,o=t.length;i<o;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))};function i(r){return(0,e.isNumbersArray)(r)?t([],r,!0):r.map((function(e){return t([],e,!0)}))}var o=r(986);function a(e){var t=i(e);return t.forEach(o.sortNumbers),t.sort((function(e,t){return e[0]-t[0]})),t}function s(e,t){var r=i(e),n=i(t);return(0,o.sortNumbers)(r),(0,o.sortNumbers)(n),[0,1].every((function(e){return r[e]==n[e]}))}function u(e,t){var r=a([e,t]);return r[0][0]==r[1][0]-1&&r[0][1]==r[1][1]+1}function c(e,t){return(0,o.min)(e)==(0,o.min)(t)&&(0,o.max)(e)!=(0,o.max)(t)||(0,o.min)(e)!=(0,o.min)(t)&&(0,o.max)(e)==(0,o.max)(t)}function l(e){if(0==e.length)return[];for(var t=[],r=0;r<(0,o.max)(e.flat());r++)t.push(void 0);return e.forEach((function(e){t[e[0]-1]=e[1],t[e[1]-1]=e[0]})),t}function f(e){var t=l(e),r=[],n=!1;return t.forEach((function(e,t){var i=t+1;null==e||(i<e?r.push(i):i==e||r.pop()!=e&&(n=!0))})),!n}function h(e,t){return!f([e,t])}var p=function(e,t,r){if(r||2===arguments.length)for(var n,i=0,o=t.length;i<o;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))};function g(e){var t=[],r=i(e);return r.sort((function(e,t){return Math.abs(e[0]-e[1])-Math.abs(t[0]-t[1])})),r.forEach((function(e){f(p(p([],t,!0),[e],!1))&&t.push(e)})),t}var d=function(){function e(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.targetStructure=e}return e.prototype.get=function(){var e=this.targetStructure[1];if(0==e.length)return[];var t=a(e),r=[],n=[];return t.forEach((function(e){var t=0==n.length?null:n[n.length-1];!t||u(t,e)?n.push(e):(r.push(n),n=[e])})),r.push(n),r},e}(),m=function(){function e(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.targetStructure=e}return e.prototype.get=function(){var e=(new(d.bind.apply(d,function(e,t,r){if(r||2===arguments.length)for(var n,i=0,o=t.length;i<o;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))}([void 0],this.targetStructure,!1)))).get().flatMap((function(e){return[e.map(o.min),e.map(o.max)]}));e.forEach(o.sortNumbers),e.sort((function(e,t){return(0,o.min)(e)-(0,o.min)(t)}));for(var t=[],r=e.shift(),n=e.shift();r&&n;){for(var i=[],a=(0,o.max)(r),s=(0,o.min)(n),u=a;u<=s;u++)i.push(u);t.push(i),r=n,n=e.shift()}return t},e}();function y(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=e[0],n=e[1],i=l(n);if(!f(n))throw new Error("Pseudoknot(s) encountered.");var o=[],a=0;return r.forEach((function(e,t){var r=t+1,n=i[t];null==n?o.push(a):r<n?(o.push(a),a++):(r==n||a--,o.push(a))})),o}function b(e){var t=e.split(""),r=[".","(",")"];t.forEach((function(e){if(!r.includes(e))throw new Error('Unrecognized character in dot-bracket notation: "'.concat(e,'".'))}));var n=[],i=[];if(t.forEach((function(e,t){var r=t+1;if("("==e)i.push(r);else if(")"==e){var o=i.pop();if("number"!=typeof o)throw new Error("Unmatched downstream partner(s) in dot-bracket notation.");n.push([o,r])}})),i.length>0)throw new Error("Unmatched upstream partner(s) in dot-bracket notation.");return a(n)}})(),n})(),e.exports=t()}},t={};function r(n){var i=t[n];if(void 0!==i)return i.exports;var o=t[n]={exports:{}};return e[n].call(o.exports,o,o.exports,r),o.exports}r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};return(()=>{"use strict";r.r(n),r.d(n,{FirstPairedBase:()=>t,LastPairedBase:()=>o,LeadingDanglingBases:()=>a,Linkers:()=>l,PositionPairs:()=>e,Stems:()=>c,TrailingDanglingBases:()=>s,consecutivePairs:()=>p,knotless:()=>f,parseDotBracket:()=>h});class e{constructor(...e){this.targetStructure=e}get(){let e=this.targetStructure[0];return this.targetStructure[1].map((t=>[e.indexOf(t[0])+1,e.indexOf(t[1])+1]))}}class t{constructor(...e){this.targetStructure=e}get(){let e=this.targetStructure[0],t=this.targetStructure[1];if(0==t.length)throw new Error("There are no paired bases.");let r=t.flat(),n=e.findIndex((e=>r.includes(e)));if(n<0)throw new Error("No paired bases present in sequence.");return e[n]}}var i=r(986);class o{constructor(...e){this.targetStructure=e}get(){let e=this.targetStructure[0],t=this.targetStructure[1];if(0==t.length)throw new Error("There are no paired bases.");let r=t.flat().map((t=>e.indexOf(t)));if((0,i.max)(r)<0)throw new Error("No paired bases present in sequence.");return e[(0,i.max)(r)]}}class a{constructor(...e){this.targetStructure=e}get(){let e=this.targetStructure[0];if(0==this.targetStructure[1].length)throw new Error("There are no paired bases.");let r=new t(...this.targetStructure).get(),n=e.indexOf(r);if(n<0)throw new Error("No paired bases present in sequence.");return e.slice(0,n)}}class s{constructor(...e){this.targetStructure=e}get(){let e=this.targetStructure[0];if(0==this.targetStructure[1].length)throw new Error("There are no paired bases.");let t=new o(...this.targetStructure).get(),r=e.indexOf(t);if(r<0)throw new Error("No paired bases present in sequence.");return e.slice(r+1)}}var u=r(369);class c{constructor(...e){this.targetStructure=e}get(){let t=this.targetStructure[0],r=new e(...this.targetStructure).get();return new u.Stems(t,r).get().map((e=>e.map((e=>[t[e[0]-1],t[e[1]-1]]))))}}class l{constructor(...e){this.targetStructure=e}get(){let t=this.targetStructure[0],r=new e(...this.targetStructure).get();return new u.Linkers(t,r).get().map((e=>e.map((e=>t[e-1]))))}}function f(...t){let[r,n]=t,i=new e(...t).get();(0,u.areKnotless)(i)||(i=(0,u.knotless)(i));let o=i.map((e=>[r[e[0]-1],r[e[1]-1]]));return[[...r],o]}function h(e,t){if(t.length>e.length)throw new Error("Dot-bracket notation is longer than the sequence.");return[...(0,u.parseDotBracket)(t)].map((t=>{let r=t[0],n=t[1];return[e[r-1],e[n-1]]}))}function p(e){return e.length<2?[]:e.slice(0,-1).map(((t,r)=>[e[r],e[r+1]]))}})(),n})(),e.exports=t()},173:function(e){var t;t=()=>(()=>{var e={422:function(e){e.exports=(()=>{var e={138:function(e){e.exports=(()=>{"use strict";var e={d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function r(e){var t=0;return e.forEach((function(e){return t+=e})),t}function n(e){return r(e)/e.length}return e.r(t),e.d(t,{average:()=>n,mean:()=>n,sum:()=>r}),t})()}},t={};function r(n){var i=t[n];if(void 0!==i)return i.exports;var o=t[n]={exports:{}};return e[n].call(o.exports,o,o.exports,r),o.exports}r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};return(()=>{"use strict";function e(e,t){var r=t.x-e.x,n=t.y-e.y;return Math.pow(Math.pow(r,2)+Math.pow(n,2),.5)}function t(e,t){return{x:t.x-e.x,y:t.y-e.y}}r.r(n),r.d(n,{centroid:()=>o,displacement:()=>t,distance:()=>e,midpoint:()=>a});var i=r(138);function o(e){return{x:(0,i.mean)(e.map((function(e){return e.x}))),y:(0,i.mean)(e.map((function(e){return e.y})))}}function a(e,t){return o([e,t])}})(),n})()},872:function(e){e.exports=(()=>{"use strict";var e={d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function r(e){return Math.atan2(e.y,e.x)}return e.r(t),e.d(t,{direction:()=>r}),t})()}},t={};function r(n){var i=t[n];if(void 0!==i)return i.exports;var o=t[n]={exports:{}};return e[n].call(o.exports,o,o.exports,r),o.exports}r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};return(()=>{"use strict";r.r(n),r.d(n,{CircularSegment:()=>s,Semicircle:()=>t});var e=r(422),t=function(){function t(e){this.chord=e}return Object.defineProperty(t.prototype,"chordLength",{get:function(){return(0,e.distance)(this.chord[0],this.chord[1])},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"arcLength",{get:function(){return Math.PI*this.chordLength/2},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"arcAngle",{get:function(){return Math.PI},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"parentCircleRadius",{get:function(){return this.chordLength/2},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"parentCircleDiameter",{get:function(){return 2*this.parentCircleRadius},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"parentCircleCircumference",{get:function(){return 2*Math.PI*this.parentCircleRadius},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"parentCircleCenterPoint",{get:function(){return(0,e.midpoint)(this.chord[0],this.chord[1])},enumerable:!1,configurable:!0}),t}(),i=r(872),o=function(){function t(t,r){this.chord=t,this.moreProps=r;var n=r.arcLength,i=(0,e.distance)(t[0],t[1]);if(n<=i)throw new Error("Arc length is too small.");if(n>=Math.PI*i/2)throw new Error("Arc length is too big.");for(var o=Math.PI/2,a=0;a<20;a++)o-=(n/i*Math.sin(o)-o)/(n/i*Math.cos(o)-1);this.arcAngle=2*o}return Object.defineProperty(t.prototype,"chordLength",{get:function(){return(0,e.distance)(this.chord[0],this.chord[1])},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"arcLength",{get:function(){return this.moreProps.arcLength},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"parentCircleRadius",{get:function(){return this.arcLength/this.arcAngle},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"parentCircleDiameter",{get:function(){return 2*this.parentCircleRadius},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"parentCircleCircumference",{get:function(){return 2*Math.PI*this.parentCircleRadius},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"parentCircleCenterPoint",{get:function(){var t=(0,i.direction)((0,e.displacement)(this.chord[0],this.chord[1]));t+=(Math.PI-this.arcAngle)/2;var r=this.parentCircleRadius;return{x:this.chord[0].x+r*Math.cos(t),y:this.chord[0].y+r*Math.sin(t)}},enumerable:!1,configurable:!0}),t}(),a=function(){function t(t,r){this.chord=t,this.moreProps=r;var n=r.arcLength,i=(0,e.distance)(t[0],t[1]);if(0==i)throw new Error("Chord length cannot be zero.");if(n<=Math.PI*i/2)throw new Error("Arc length is too small.");for(var o=Math.PI,a=0;a<20;a++)o-=(n/i*Math.sin(Math.PI-o)-o)/(-n/i*Math.cos(Math.PI-o)-1);this.arcAngle=2*o}return Object.defineProperty(t.prototype,"chordLength",{get:function(){return(0,e.distance)(this.chord[0],this.chord[1])},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"arcLength",{get:function(){return this.moreProps.arcLength},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"parentCircleRadius",{get:function(){return this.arcLength/this.arcAngle},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"parentCircleDiameter",{get:function(){return 2*this.parentCircleRadius},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"parentCircleCircumference",{get:function(){return 2*Math.PI*this.parentCircleRadius},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"parentCircleCenterPoint",{get:function(){var t=(0,i.direction)((0,e.displacement)(this.chord[0],this.chord[1]));t-=(this.arcAngle-Math.PI)/2;var r=this.parentCircleRadius;return{x:this.chord[0].x+r*Math.cos(t),y:this.chord[0].y+r*Math.sin(t)}},enumerable:!1,configurable:!0}),t}(),s=function(){function r(r,n){this.chord=r,this.moreProps=n;var i=n.arcLength,s=(0,e.distance)(r[0],r[1]);if(s>0&&i<=s)throw new Error("Arc length is too small.");var u=s<.001&&i<.001,c=Math.PI*s/2,l=Math.abs(i-c)<.001;this.wrappedCircularSegment=u||l?new t(r):i<c?new o(r,{arcLength:i}):new a(r,{arcLength:i})}return Object.defineProperty(r.prototype,"chordLength",{get:function(){return this.wrappedCircularSegment.chordLength},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"arcLength",{get:function(){return this.moreProps.arcLength},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"arcAngle",{get:function(){return this.wrappedCircularSegment.arcAngle},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"parentCircleRadius",{get:function(){return this.wrappedCircularSegment.parentCircleRadius},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"parentCircleDiameter",{get:function(){return this.wrappedCircularSegment.parentCircleDiameter},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"parentCircleCircumference",{get:function(){return this.wrappedCircularSegment.parentCircleCircumference},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"parentCircleCenterPoint",{get:function(){return this.wrappedCircularSegment.parentCircleCenterPoint},enumerable:!1,configurable:!0}),r}()})(),n})(),e.exports=t()},986:function(e){e.exports=(()=>{"use strict";var e={d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function r(e){var t=0;return e.forEach((function(e){return t+=e})),t}function n(e){return r(e)/e.length}function i(e){e.sort((function(e,t){return e-t}))}e.r(t),e.d(t,{areWithin:()=>p,average:()=>n,clamp:()=>h,degrees:()=>m,isBetween:()=>l,isBetweenExclusive:()=>f,isBetweenInclusive:()=>l,max:()=>c,mean:()=>n,median:()=>s,min:()=>u,radians:()=>y,sortNumbers:()=>i,sortNumbersAscending:()=>i,sortNumbersDescending:()=>g,sortedNumbers:()=>a,sortedNumbersAscending:()=>a,sortedNumbersDescending:()=>d,sum:()=>r});var o=function(e,t,r){if(r||2===arguments.length)for(var n,i=0,o=t.length;i<o;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))};function a(e){var t=o([],e,!0);return i(t),t}function s(e){if(0==e.length)return NaN;var t=a(e);if(t.length%2!=0)return t[Math.floor(t.length/2)];var r=t.length/2,i=r-1;return n([t[r],t[i]])}function u(e){if(0==e.length)return 1/0;var t=e[0];return e.slice(1).forEach((function(e){t=Math.min(t,e)})),t}function c(e){if(0==e.length)return-1/0;var t=e[0];return e.slice(1).forEach((function(e){t=Math.max(t,e)})),t}function l(e,t,r){return e>=t&&e<=r}function f(e,t,r){return e>t&&e<r}function h(e,t,r){return e<t?t:e>r?r:e}function p(e,t,r){return Math.abs(e-t)<=r}function g(e){i(e),e.reverse()}function d(e){var t=a(e);return t.reverse(),t}function m(e){return e*(180/Math.PI)}function y(e){return e*(Math.PI/180)}return t})()},725:function(e){e.exports=(()=>{var e={986:function(e){e.exports=(()=>{"use strict";var e={d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function r(e){var t=0;return e.forEach((function(e){return t+=e})),t}function n(e){return r(e)/e.length}function i(e){e.sort((function(e,t){return e-t}))}e.r(t),e.d(t,{areWithin:()=>h,average:()=>n,degrees:()=>d,isBetweenExclusive:()=>f,isBetweenInclusive:()=>l,max:()=>c,mean:()=>n,median:()=>s,min:()=>u,radians:()=>m,sortNumbers:()=>i,sortNumbersAscending:()=>i,sortNumbersDescending:()=>p,sortedNumbers:()=>a,sortedNumbersAscending:()=>a,sortedNumbersDescending:()=>g,sum:()=>r});var o=function(e,t,r){if(r||2===arguments.length)for(var n,i=0,o=t.length;i<o;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))};function a(e){var t=o([],e,!0);return i(t),t}function s(e){if(0==e.length)return NaN;var t=a(e);if(t.length%2!=0)return t[Math.floor(t.length/2)];var r=t.length/2,i=r-1;return n([t[r],t[i]])}function u(e){if(0==e.length)return 1/0;var t=e[0];return e.slice(1).forEach((function(e){t=Math.min(t,e)})),t}function c(e){if(0==e.length)return-1/0;var t=e[0];return e.slice(1).forEach((function(e){t=Math.max(t,e)})),t}function l(e,t,r){return e>=t&&e<=r}function f(e,t,r){return e>t&&e<r}function h(e,t,r){return Math.abs(e-t)<=r}function p(e){i(e),e.reverse()}function g(e){var t=a(e);return t.reverse(),t}function d(e){return e*(180/Math.PI)}function m(e){return e*(Math.PI/180)}return t})()},854:function(e){e.exports=(()=>{"use strict";var e={d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function r(e){return"number"==typeof e}function n(e){return r(e)&&Number.isFinite(e)}function i(e){return r(e)&&!Number.isFinite(e)}function o(e){return n(e)&&e>0}function a(e){return n(e)&&e>=0}function s(e){return"string"==typeof e}function u(e){return null==e}function c(e){return"object"==typeof e&&null!==e}function l(e){return Array.isArray(e)}return e.r(t),e.d(t,{isArray:()=>l,isFiniteNumber:()=>n,isNonFiniteNumber:()=>i,isNonNegativeFiniteNumber:()=>a,isNonNullObject:()=>c,isNullish:()=>u,isNumber:()=>r,isPositiveFiniteNumber:()=>o,isString:()=>s}),t})()},30:function(e){e.exports=(()=>{"use strict";var e={d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function r(e){return Math.pow(Math.pow(e.x,2)+Math.pow(e.y,2),.5)}function n(e){return Math.atan2(e.y,e.x)}return e.r(t),e.d(t,{direction:()=>n,magnitude:()=>r}),t})()}},t={};function r(n){var i=t[n];if(void 0!==i)return i.exports;var o=t[n]={exports:{}};return e[n].call(o.exports,o,o.exports,r),o.exports}r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};return(()=>{"use strict";r.r(n),r.d(n,{areWithin:()=>s,centroid:()=>p,deepCopy:()=>o,direction:()=>f,displaced:()=>c,displacement:()=>u,distance:()=>a,isFinitePoint:()=>i,isPoint:()=>t,midpoint:()=>g});var e=r(854);function t(t){return(0,e.isNonNullObject)(t)&&(0,e.isNumber)(t.x)&&(0,e.isNumber)(t.y)}function i(r){return t(r)&&(0,e.isFiniteNumber)(r.x)&&(0,e.isFiniteNumber)(r.y)}function o(e){return{x:e.x,y:e.y}}function a(e,t){var r=t.x-e.x,n=t.y-e.y;return Math.pow(Math.pow(r,2)+Math.pow(n,2),.5)}function s(e,t,r){return a(e,t)<=r}function u(e,t){return{x:t.x-e.x,y:t.y-e.y}}function c(e,t){return{x:e.x+t.x,y:e.y+t.y}}var l=r(30);function f(e,t){return(0,l.direction)(u(e,t))}var h=r(986);function p(e){return{x:(0,h.mean)(e.map((function(e){return e.x}))),y:(0,h.mean)(e.map((function(e){return e.y})))}}function g(e,t){return p([e,t])}})(),n})()},369:function(e){var t;t=()=>(()=>{var e={986:function(e){e.exports=(()=>{"use strict";var e={d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function r(e){var t=0;return e.forEach((function(e){return t+=e})),t}function n(e){return r(e)/e.length}function i(e){e.sort((function(e,t){return e-t}))}e.r(t),e.d(t,{areWithin:()=>p,average:()=>n,clamp:()=>h,degrees:()=>m,isBetween:()=>l,isBetweenExclusive:()=>f,isBetweenInclusive:()=>l,max:()=>c,mean:()=>n,median:()=>s,min:()=>u,radians:()=>y,sortNumbers:()=>i,sortNumbersAscending:()=>i,sortNumbersDescending:()=>g,sortedNumbers:()=>a,sortedNumbersAscending:()=>a,sortedNumbersDescending:()=>d,sum:()=>r});var o=function(e,t,r){if(r||2===arguments.length)for(var n,i=0,o=t.length;i<o;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))};function a(e){var t=o([],e,!0);return i(t),t}function s(e){if(0==e.length)return NaN;var t=a(e);if(t.length%2!=0)return t[Math.floor(t.length/2)];var r=t.length/2,i=r-1;return n([t[r],t[i]])}function u(e){if(0==e.length)return 1/0;var t=e[0];return e.slice(1).forEach((function(e){t=Math.min(t,e)})),t}function c(e){if(0==e.length)return-1/0;var t=e[0];return e.slice(1).forEach((function(e){t=Math.max(t,e)})),t}function l(e,t,r){return e>=t&&e<=r}function f(e,t,r){return e>t&&e<r}function h(e,t,r){return e<t?t:e>r?r:e}function p(e,t,r){return Math.abs(e-t)<=r}function g(e){i(e),e.reverse()}function d(e){var t=a(e);return t.reverse(),t}function m(e){return e*(180/Math.PI)}function y(e){return e*(Math.PI/180)}return t})()},854:function(e){e.exports=(()=>{"use strict";var e={d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function r(e){return"number"==typeof e}function n(e){return r(e)&&Number.isFinite(e)}function i(e){return r(e)&&!Number.isFinite(e)}function o(e){return n(e)&&e>0}function a(e){return n(e)&&e>=0}function s(e){return"string"==typeof e}function u(e){return null==e}function c(e){return"object"==typeof e&&null!==e}function l(e){return Array.isArray(e)}function f(e){return l(e)&&e.every(r)}function h(e){return l(e)&&e.every(n)}function p(e){return l(e)&&e.every(i)}function g(e){return l(e)&&e.every(s)}return e.r(t),e.d(t,{isArray:()=>l,isFiniteNumber:()=>n,isFiniteNumbersArray:()=>h,isNonFiniteNumber:()=>i,isNonFiniteNumbersArray:()=>p,isNonNegativeFiniteNumber:()=>a,isNonNullObject:()=>c,isNullish:()=>u,isNumber:()=>r,isNumbersArray:()=>f,isPositiveFiniteNumber:()=>o,isString:()=>s,isStringsArray:()=>g}),t})()}},t={};function r(n){var i=t[n];if(void 0!==i)return i.exports;var o=t[n]={exports:{}};return e[n].call(o.exports,o,o.exports,r),o.exports}r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};return(()=>{"use strict";r.r(n),r.d(n,{Linkers:()=>m,Stems:()=>d,areConflicting:()=>c,areCrossing:()=>h,areEqual:()=>s,areKnotless:()=>f,areStacked:()=>u,deepCopy:()=>i,knotless:()=>g,mountainPlotTraversal:()=>y,parseDotBracket:()=>b,sorted:()=>a});var e=r(854),t=function(e,t,r){if(r||2===arguments.length)for(var n,i=0,o=t.length;i<o;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))};function i(r){return(0,e.isNumbersArray)(r)?t([],r,!0):r.map((function(e){return t([],e,!0)}))}var o=r(986);function a(e){var t=i(e);return t.forEach(o.sortNumbers),t.sort((function(e,t){return e[0]-t[0]})),t}function s(e,t){var r=i(e),n=i(t);return(0,o.sortNumbers)(r),(0,o.sortNumbers)(n),[0,1].every((function(e){return r[e]==n[e]}))}function u(e,t){var r=a([e,t]);return r[0][0]==r[1][0]-1&&r[0][1]==r[1][1]+1}function c(e,t){return(0,o.min)(e)==(0,o.min)(t)&&(0,o.max)(e)!=(0,o.max)(t)||(0,o.min)(e)!=(0,o.min)(t)&&(0,o.max)(e)==(0,o.max)(t)}function l(e){if(0==e.length)return[];for(var t=[],r=0;r<(0,o.max)(e.flat());r++)t.push(void 0);return e.forEach((function(e){t[e[0]-1]=e[1],t[e[1]-1]=e[0]})),t}function f(e){var t=l(e),r=[],n=!1;return t.forEach((function(e,t){var i=t+1;null==e||(i<e?r.push(i):i==e||r.pop()!=e&&(n=!0))})),!n}function h(e,t){return!f([e,t])}var p=function(e,t,r){if(r||2===arguments.length)for(var n,i=0,o=t.length;i<o;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))};function g(e){var t=[],r=i(e);return r.sort((function(e,t){return Math.abs(e[0]-e[1])-Math.abs(t[0]-t[1])})),r.forEach((function(e){f(p(p([],t,!0),[e],!1))&&t.push(e)})),t}var d=function(){function e(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.targetStructure=e}return e.prototype.get=function(){var e=this.targetStructure[1];if(0==e.length)return[];var t=a(e),r=[],n=[];return t.forEach((function(e){var t=0==n.length?null:n[n.length-1];!t||u(t,e)?n.push(e):(r.push(n),n=[e])})),r.push(n),r},e}(),m=function(){function e(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.targetStructure=e}return e.prototype.get=function(){var e=(new(d.bind.apply(d,function(e,t,r){if(r||2===arguments.length)for(var n,i=0,o=t.length;i<o;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))}([void 0],this.targetStructure,!1)))).get().flatMap((function(e){return[e.map(o.min),e.map(o.max)]}));e.forEach(o.sortNumbers),e.sort((function(e,t){return(0,o.min)(e)-(0,o.min)(t)}));for(var t=[],r=e.shift(),n=e.shift();r&&n;){for(var i=[],a=(0,o.max)(r),s=(0,o.min)(n),u=a;u<=s;u++)i.push(u);t.push(i),r=n,n=e.shift()}return t},e}();function y(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=e[0],n=e[1],i=l(n);if(!f(n))throw new Error("Pseudoknot(s) encountered.");var o=[],a=0;return r.forEach((function(e,t){var r=t+1,n=i[t];null==n?o.push(a):r<n?(o.push(a),a++):(r==n||a--,o.push(a))})),o}function b(e){var t=e.split(""),r=[".","(",")"];t.forEach((function(e){if(!r.includes(e))throw new Error('Unrecognized character in dot-bracket notation: "'.concat(e,'".'))}));var n=[],i=[];if(t.forEach((function(e,t){var r=t+1;if("("==e)i.push(r);else if(")"==e){var o=i.pop();if("number"!=typeof o)throw new Error("Unmatched downstream partner(s) in dot-bracket notation.");n.push([o,r])}})),i.length>0)throw new Error("Unmatched upstream partner(s) in dot-bracket notation.");return a(n)}})(),n})(),e.exports=t()},30:function(e){e.exports=(()=>{"use strict";var e={d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function r(e){return Math.pow(Math.pow(e.x,2)+Math.pow(e.y,2),.5)}function n(e){return Math.atan2(e.y,e.x)}return e.r(t),e.d(t,{direction:()=>n,magnitude:()=>r}),t})()}},t={};function r(n){var i=t[n];if(void 0!==i)return i.exports;var o=t[n]={exports:{}};return e[n].call(o.exports,o,o.exports,r),o.exports}r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};return(()=>{"use strict";r.r(n),r.d(n,{Centroid:()=>o,Direction:()=>p,MaxCenterX:()=>u,MaxCenterY:()=>l,MinCenterX:()=>s,MinCenterY:()=>c,NucleobaseMock:()=>e,arrange:()=>j,circularize:()=>w,flipSelfX:()=>m,flipSelfY:()=>y,flipX:()=>g,flipY:()=>d,linearize:()=>b,radialize:()=>k,rotate:()=>h,round:()=>x,shift:()=>t,stemmify:()=>P,straighten:()=>v});class e{constructor(e){this.props=e}getCenterPoint(){return this.props.centerPoint}setCenterPoint(e){this.props.centerPoint=e}}function t(e,t){e.forEach((e=>{let r=e.getCenterPoint();e.setCenterPoint({x:r.x+t.x,y:r.y+t.y})}))}var i=r(725);class o{constructor(e){this.targetBases=e}get(){let e=this.targetBases.map((e=>e.getCenterPoint()));return(0,i.centroid)(e)}set(e){let r=this.get(),n=(0,i.displacement)(r,e);t(this.targetBases,n)}}var a=r(986);class s{constructor(e){this.targetBases=e}get(){return(0,a.min)(this.targetBases.map((e=>e.getCenterPoint().x)))}set(e){let r=this.get();t(this.targetBases,{x:e-r,y:0})}}class u{constructor(e){this.targetBases=e}get(){return(0,a.max)(this.targetBases.map((e=>e.getCenterPoint().x)))}set(e){let r=this.get();t(this.targetBases,{x:e-r,y:0})}}class c{constructor(e){this.targetBases=e}get(){return(0,a.min)(this.targetBases.map((e=>e.getCenterPoint().y)))}set(e){let r=this.get();t(this.targetBases,{x:0,y:e-r})}}class l{constructor(e){this.targetBases=e}get(){return(0,a.max)(this.targetBases.map((e=>e.getCenterPoint().y)))}set(e){let r=this.get();t(this.targetBases,{x:0,y:e-r})}}var f=r(30);function h(e,t){if(0==e.length)return;let r=new o(e).get();e.forEach((e=>{let n=e.getCenterPoint(),o=(0,i.distance)(r,n),a=(0,f.direction)((0,i.displacement)(r,n));a+=t,e.setCenterPoint({x:r.x+o*Math.cos(a),y:r.y+o*Math.sin(a)})}))}class p{constructor(e){this.targetBases=e}get(){if(this.targetBases.length<2)return 0;let e=this.targetBases[0],t=this.targetBases[this.targetBases.length-1];return(0,f.direction)((0,i.displacement)(e.getCenterPoint(),t.getCenterPoint()))}set(e){let t=e-this.get();h(this.targetBases,t)}}function g(e){let t=new o(e).get().y;e.forEach((e=>{let r=e.getCenterPoint(),n=r.y-t;e.setCenterPoint({x:r.x,y:t-n})}))}function d(e){let t=new o(e).get().x;e.forEach((e=>{let r=e.getCenterPoint(),n=r.x-t;e.setCenterPoint({x:t-n,y:r.y})}))}function m(e){if(0==e.length)return;let r=e[0],{x:n,y:o}=r.getCenterPoint(),a={x:n,y:o},s=new p(e).get();h(e,-s),g(e),h(e,s),t(e,(0,i.displacement)(r.getCenterPoint(),a))}function y(e){let t=new o(e),{x:r,y:n}=t.get(),i=r,a=n,s=new p(e).get();h(e,-s),d(e),h(e,s),t.set({x:i,y:a})}function b(e,t){let{spacing:r}=t;if(e.length<2)return;let n=new p(e),i=n.get(),a=new o(e),{x:s,y:u}=a.get(),c={x:s,y:u};e.forEach(((e,t)=>{e.setCenterPoint({x:t*r,y:0})})),n.set(i),a.set(c)}function v(e){if(e.length<3)return;let t=e[0],r=e[e.length-1],n=[t.getCenterPoint(),r.getCenterPoint()],o=(0,i.distance)(n[0],n[1]),a=(0,f.direction)((0,i.displacement)(n[0],n[1])),s=o/(e.length-1),u=s*Math.cos(a),c=s*Math.sin(a),{x:l,y:h}=n[0];e.forEach((e=>{e.setCenterPoint({x:l,y:h}),l+=u,h+=c}))}function P(e,r){let{basePairLength:n,basePairSpacing:a}=r;if(e.length<2)return;let s=Math.ceil(e.length/2),u=e.slice(0,s),c=e.slice(s),l=new o(e),{x:f,y:g}=l.get(),d={x:f,y:g},m=new p(e).get();b(u,{spacing:a}),b(c,{spacing:a}),new p(u).set(-Math.PI/2),new p(c).set(Math.PI/2);let y=e[0],v=e[e.length-1];t(u,(0,i.displacement)(y.getCenterPoint(),{x:0,y:0})),t(c,(0,i.displacement)(v.getCenterPoint(),{x:n,y:0})),h(e,m),l.set(d)}function w(e,t){let{spacing:r,terminiGap:n}=t;if(e.length<2)return;let i=new o(e),{x:a,y:s}=i.get(),u=a,c=s,l=new p(e).get(),f=r*(e.length-1);f+=n,Math.abs(f)<1e-5&&(f=1e-5);let g=f/(2*Math.PI),d=Math.PI/2+2*Math.PI*(.5*n/f);e.forEach(((e,t)=>{let n=d+2*Math.PI*(t*r)/f;e.setCenterPoint({x:g*Math.cos(n),y:g*Math.sin(n)})})),h(e,l),i.set({x:u,y:c})}var S=r(173);function x(e,r){let{spacing:n}=r;if(e.length<3)return;let o=e[0],a=e[e.length-1],s=[o.getCenterPoint(),a.getCenterPoint()],u=(0,i.distance)(s[0],s[1]),c=n*(e.length-1);if(c-u<.001)return void v(e);if(u<.001){let{x:r,y:a}=o.getCenterPoint();return w(e,{spacing:n,terminiGap:u}),void t(e,(0,i.displacement)(o.getCenterPoint(),{x:r,y:a}))}let l=new S.CircularSegment(s,{arcLength:c}),h=l.parentCircleCenterPoint,p=l.parentCircleRadius,g=(0,f.direction)((0,i.displacement)(h,o.getCenterPoint())),d=l.arcAngle/(e.length-1);e.forEach((e=>{e.setCenterPoint({x:h.x+p*Math.cos(g),y:h.y+p*Math.sin(g)}),g+=d}))}var M=r(127),O=r(369);function j(e,r,n){var s,u,c;let{spacing:l}=n,f=null!==(s=n.basePairSpacing)&&void 0!==s?s:l,h=null!==(u=n.hairpinLoopSpacing)&&void 0!==u?u:l,g=null!==(c=n.terminiGap)&&void 0!==c?c:l,{x:d,y:m}=new o(e).get(),y={x:d,y:m},b=new p(e).get();[,r]=(0,M.knotless)(e,r);let v=new M.PositionPairs(e,r).get(),S=(0,O.mountainPlotTraversal)(e,v),j=e.filter(((e,t)=>0==S[t]));w(j,{spacing:l,terminiGap:g});let N=new M.Stems(e,r).get(),C=new Set(j),E=N.filter((e=>C.has(e[0][0]))),B=r=>{let n=r[0],{x:s,y:u}=new o(n).get(),c={x:s,y:u},g=new p(r[0]).get(),d=[...r.map((e=>e[0])),...r.map((e=>e[1])).reverse()];P(d,{basePairLength:l,basePairSpacing:f}),new p(d).set(g),t(d,(0,i.displacement)(new o(n).get(),c));let m=r[r.length-1],y=m.map((t=>e.indexOf(t))),b=e.filter(((e,t)=>(0,a.isBetweenExclusive)(t,(0,a.min)(y),(0,a.max)(y))&&S[t]==S[(0,a.min)(y)]+1)),v=new Set(b),w=N.filter((e=>v.has(e[0][0])));x([m[0],...b,m[1]],{spacing:w.length>0?l:h}),w.forEach((e=>B(e)))};E.forEach((e=>B(e))),new p(e).set(b),new o(e).set(y)}class N{static from(e){return{to:t=>({inclusive:()=>{let r=t-e+1;return Array.from({length:r},((t,r)=>e+r))}})}}}class C{static of(...e){let[t,r]=e,n=new M.PositionPairs(...e).get();n=(0,O.sorted)(n);let i=n.map((e=>e.map((e=>e-1)))),o=[],s=0;return t.forEach(((e,t)=>{let r=i.find((e=>e.includes(t)));r&&t==(0,a.min)(r)?(o.push(s),s+=1):r&&t==(0,a.max)(r)?(s-=1,o.push(s)):o.push(s)})),o}}class E{constructor(...e){let[t,r]=e;this.rawForm=e,this.mountainPlotTraversal=C.of(...e),this.positionPairs=new M.PositionPairs(...e).get(),this.indexPairs=this.positionPairs.map((e=>[e[0]-1,e[1]-1])),this.pairedBases=new Set(r.flat()),this.pairedIndices=new Set(t.map(((e,t)=>({b:e,i:t}))).filter((e=>this.pairedBases.has(e.b))).map((e=>e.i)))}[Symbol.iterator](){return this.rawForm.values()}get sequence(){return this.rawForm[0]}get basePairs(){return this.rawForm[1]}}class B{static correspondingTo(e){return{in:t=>e.map((e=>t.sequence.indexOf(e)))}}}class A{static composedOf(e){if(0==e.length)throw new Error("All stems must have at least one base-pair.");let r=e[0],n=e[e.length-1],o=e.map((e=>e[0])),a=e.map((e=>e[1])).reverse(),s=r[0],u=r[1],c=[...o,...a];return{[Symbol.iterator]:()=>e.values(),bottomBasePair:r,topBasePair:n,side5:o,side3:a,flat:()=>c,firstBase:s,lastBase:u,stemmify:()=>({with:e=>{let{basePairLength:r,basePairSpacing:n}=e,o=Object.assign({},s.getCenterPoint());P(c,{basePairLength:r,basePairSpacing:n}),t(c,(0,i.displacement)(s.getCenterPoint(),o))}})}}}class T{static in(e){return{[Symbol.iterator]:()=>new M.Stems(e.sequence,e.basePairs).get().map((e=>A.composedOf(e))).values()}}}class I{static composedOf(e){if(e.length<2)throw new Error("Linkers must have at least two bases.");let r=e[0],n=e[e.length-1],o=e.slice(1,-1);return{in:a=>{let s=a.sequence.indexOf(r),u=a.sequence.indexOf(n),c=N.from(s).to(u).inclusive(),l=!!a.indexPairs.find((e=>e.includes(s)&&e.includes(u))),f=c.every((e=>0==a.mountainPlotTraversal[e])),h=1==new Set(c.map((e=>a.mountainPlotTraversal[e]))).size&&!l;return{[Symbol.iterator]:()=>e.values(),indices:c,firstBase:r,lastBase:n,firstIndex:s,lastIndex:u,unpairedBases:{[Symbol.iterator]:()=>o.values(),stemmify:()=>({with:e=>{let{spacing:r}=e;if(o.length<3)return;let n=o[0],a=o[o.length-1],s=Object.assign({},n.getCenterPoint());P(o,{basePairLength:(0,i.distance)(n.getCenterPoint(),a.getCenterPoint()),basePairSpacing:r}),t(o,(0,i.displacement)(n.getCenterPoint(),s))}})},get middleThreeUnpairedBases(){if(o.length<3)throw new Error("This linker has less than three unpaired bases.");if(o.length%2==0)throw new Error("This linker has an even number of unpaired bases.");let e=Math.floor(o.length/2);return[o[e-1],o[e],o[e+1]]},isHairpinLoop:()=>l,isInOutermostLoop:()=>f,isBetweenSiblingStems:()=>h,round:()=>({with:t=>{let{spacing:r}=t;x(e,{spacing:r})}})}}}}}class L{static in(e){let t=new M.Linkers(e.sequence,e.basePairs).get().map((t=>I.composedOf(t).in(e)));return{[Symbol.iterator]:()=>t.values(),thatAreHairpinLoops:{[Symbol.iterator]:()=>t.filter((e=>e.isHairpinLoop())).values()},inOutermostLoop:{[Symbol.iterator]:()=>t.filter((e=>e.isInOutermostLoop())).values()},notInOutermostLoop:{[Symbol.iterator]:()=>t.filter((e=>!e.isInOutermostLoop())).values(),betweenSiblingStems:{[Symbol.iterator]:()=>t.filter((e=>!e.isInOutermostLoop())).filter((e=>e.isBetweenSiblingStems())).values()}},notBetweenSiblingStems:{[Symbol.iterator]:()=>t.filter((e=>!e.isBetweenSiblingStems())).values()}}}}class D{static closedBy(r){return{in:n=>{let o=r.topBasePair,s=B.correspondingTo(o).in(n),u=(0,a.min)(s),c=n.sequence.filter(((e,t)=>t>(0,a.min)(s)&&t<(0,a.max)(s)&&n.mountainPlotTraversal[t]==n.mountainPlotTraversal[u]+1)),l=c.map((e=>n.sequence.indexOf(e))),f=c.filter((e=>n.pairedBases.has(e))),h=l.filter((e=>n.pairedIndices.has(e))),p=[o[0],...c,o[1]];return{[Symbol.iterator]:()=>p.values(),parentStructure:n,closingStem:r,closingBasePair:o,closingIndexPair:s,enclosedBases:c,enclosedIndices:l,enclosedPairedBases:f,enclosedPairedIndices:h,get platform(){if(0==h.length)throw new Error("This loop does not have a platform.");let r=(0,a.min)(h),u=(0,a.max)(h),c=n.sequence.filter(((e,t)=>t>=r&&t<=u&&l.includes(t)&&[t-1,t,t+1].some((e=>h.includes(e)))));return{[Symbol.iterator]:()=>c.values(),firstIndex:r,lastIndex:u,arch:()=>({with:n=>{let{spacing:l}=n,f=(0,a.max)([c.length-2,r-(0,a.min)(s)-1,(0,a.max)(s)-u-1,0]),h=N.from(1).to(f).inclusive().map((()=>new e({centerPoint:{x:0,y:0}}))),p=h.map((()=>new e({centerPoint:{x:0,y:0}}))),g=Object.assign({},o[0].getCenterPoint());w([o[0],...h,...c,...p,o[1]],{spacing:l,terminiGap:l}),t([...o,...c],(0,i.displacement)(o[0].getCenterPoint(),g))}})}}}}}}}class _{static of(e){let t=e.sequence.filter(((t,r)=>0==e.mountainPlotTraversal[r]));return{[Symbol.iterator]:()=>t.values()}}}function k(e,t,r){var n;let{spacing:i,basePairSpacing:a}=r,s=null!==(n=r.hairpinLoopSpacing)&&void 0!==n?n:i,u=new E(e,t);if(e.length<2)return;if(0==t.length)return void w(e,{spacing:i,terminiGap:2*i});let c=Object.assign({},new o(e).get()),l=new p(e).get(),f=T.in(u),h=L.in(u);w([..._.of(u)],{spacing:i,terminiGap:2*i});let g=[...f].map((e=>D.closedBy(e).in(u)));g.filter((e=>e.enclosedPairedBases.length>0)).forEach((e=>{e.closingStem.stemmify().with({basePairLength:i,basePairSpacing:a}),e.platform.arch().with({spacing:i}),e.closingStem.stemmify().with({basePairLength:i,basePairSpacing:a})})),g.filter((e=>0==e.enclosedPairedBases.length)).forEach((e=>e.closingStem.stemmify().with({basePairLength:i,basePairSpacing:a}))),[...h.notBetweenSiblingStems].forEach((e=>e.round().with({spacing:i}))),[...h.thatAreHairpinLoops].forEach((e=>e.round().with({spacing:s}))),[...h.notInOutermostLoop.betweenSiblingStems].filter((e=>[...e.unpairedBases].length>=3)).forEach((e=>{e.unpairedBases.stemmify().with({spacing:i}),[...e.unpairedBases].length%2!=0&&x(e.middleThreeUnpairedBases,{spacing:i})})),new p(e).set(l),new o(e).set(c)}})(),n})(),e.exports=t()}},t={};function r(n){var i=t[n];if(void 0!==i)return i.exports;var o=t[n]={exports:{}};return e[n].call(o.exports,o,o.exports,r),o.exports}r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};return(()=>{"use strict";r.r(n),r.d(n,{ConsecutiveBasesSelectingTool:()=>e,DraggingTool:()=>f,SelectedBases:()=>c});class e{constructor(e,t){this.targetDrawing=e,this.selectedBases=t,this.mouseIsDown=!1,window.addEventListener("mousedown",(e=>this.handleMouseDown(e))),window.addEventListener("mouseup",(e=>this.handleMouseUp(e))),window.addEventListener("mouseover",(e=>this.handleMouseOver(e)))}handleMouseDown(e){this.lastMouseDown=e,this.mouseIsDown=!0}handleMouseUp(e){this.mouseIsDown=!1}handleMouseOver(e){if(!this.mouseIsDown)return;let t=this.lastMouseDown;if(!t)return;if(!t.shiftKey)return;if(!(e.target instanceof Node))return;if(!this.targetDrawing.domNode.contains(e.target))return;let r=[...this.targetDrawing.bases],n=r.findIndex((t=>t.domNode===e.target));if(n<0)return;let i=r.findIndex((e=>e.domNode===t.target));if(i<0)return;try{let e=r[i];if(!this.selectedBases.include(e))return}catch(e){console.error(e)}let o=Math.min(i,n),a=Math.max(i,n);this.selectedBases.addAll(r.slice(o,a+1))}}var t,i,o,a,s=function(e,t,r,n,i){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?i.call(e,r):i?i.value=r:t.set(e,r),r},u=function(e,t,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)};class c{constructor(e,r){t.add(this),this.selectedSVGElements=r,i.set(this,void 0),o.set(this,{change:[]}),s(this,i,e,"f"),r.addEventListener("change",(()=>u(this,t,"m",a).call(this,"change")))}get target(){return u(this,i,"f")}set target(e){s(this,i,e,"f"),u(this,t,"m",a).call(this,"change")}[(i=new WeakMap,o=new WeakMap,t=new WeakSet,Symbol.iterator)](){return[...this.target.bases].filter((e=>this.selectedSVGElements.include(e.domNode))).values()}include(e){return this.selectedSVGElements.include(e.domNode)}addAll(e){this.selectedSVGElements.addAll([...e].map((e=>e.domNode)))}addEventListener(e,t){u(this,o,"f")[e].push(t)}}a=function(e){u(this,o,"f")[e].forEach((e=>e()))};var l=r(661);class f{constructor(e,t,r){this.targetDrawing=e,this.selectedElements=t,this.options=r,this.mouseIsDown=!1,this.dragged=!1,window.addEventListener("mousedown",(e=>this.handleMouseDown(e))),window.addEventListener("mousemove",(e=>this.handleMouseMove(e))),window.addEventListener("mouseup",(e=>this.handleMouseUp(e)))}handleMouseDown(e){this.lastMouseDown=e,this.mouseIsDown=!0,this.dragged=!1}handleMouseMove(e){var t;if(!this.mouseIsDown)return;if(!this.lastMouseDown)return;if(this.lastMouseDown.shiftKey)return;if(!(this.lastMouseDown.target instanceof SVGGraphicsElement))return;if(!this.selectedElements.svgElements.include(this.lastMouseDown.target))return;let r=e.movementX/this.targetDrawing.horizontalClientScaling,n=e.movementY/this.targetDrawing.verticalClientScaling;this.dragged||!(null===(t=this.options)||void 0===t?void 0:t.beforeDragging)||this.options.beforeDragging(),(0,l.shift)([...this.selectedElements.bases],{x:r,y:n}),this.dragged=!0}handleMouseUp(e){var t;this.mouseIsDown=!1,!this.dragged||!(null===(t=this.options)||void 0===t?void 0:t.afterDragging)||this.options.afterDragging(),this.dragged=!1}}})(),n})()));
1
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["draw.interact"]=t():e["draw.interact"]=t()}(this,(()=>(()=>{var e={661:function(e){var t;t=()=>(()=>{var e={127:function(e){var t;t=()=>(()=>{var e={986:function(e){e.exports=(()=>{"use strict";var e={d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function r(e){var t=0;return e.forEach((function(e){return t+=e})),t}function n(e){return r(e)/e.length}function i(e){e.sort((function(e,t){return e-t}))}e.r(t),e.d(t,{areWithin:()=>p,average:()=>n,clamp:()=>h,degrees:()=>m,isBetween:()=>l,isBetweenExclusive:()=>f,isBetweenInclusive:()=>l,max:()=>c,mean:()=>n,median:()=>s,min:()=>u,radians:()=>y,sortNumbers:()=>i,sortNumbersAscending:()=>i,sortNumbersDescending:()=>g,sortedNumbers:()=>a,sortedNumbersAscending:()=>a,sortedNumbersDescending:()=>d,sum:()=>r});var o=function(e,t,r){if(r||2===arguments.length)for(var n,i=0,o=t.length;i<o;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))};function a(e){var t=o([],e,!0);return i(t),t}function s(e){if(0==e.length)return NaN;var t=a(e);if(t.length%2!=0)return t[Math.floor(t.length/2)];var r=t.length/2,i=r-1;return n([t[r],t[i]])}function u(e){if(0==e.length)return 1/0;var t=e[0];return e.slice(1).forEach((function(e){t=Math.min(t,e)})),t}function c(e){if(0==e.length)return-1/0;var t=e[0];return e.slice(1).forEach((function(e){t=Math.max(t,e)})),t}function l(e,t,r){return e>=t&&e<=r}function f(e,t,r){return e>t&&e<r}function h(e,t,r){return e<t?t:e>r?r:e}function p(e,t,r){return Math.abs(e-t)<=r}function g(e){i(e),e.reverse()}function d(e){var t=a(e);return t.reverse(),t}function m(e){return e*(180/Math.PI)}function y(e){return e*(Math.PI/180)}return t})()},369:function(e){var t;t=()=>(()=>{var e={986:function(e){e.exports=(()=>{"use strict";var e={d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function r(e){var t=0;return e.forEach((function(e){return t+=e})),t}function n(e){return r(e)/e.length}function i(e){e.sort((function(e,t){return e-t}))}e.r(t),e.d(t,{areWithin:()=>p,average:()=>n,clamp:()=>h,degrees:()=>m,isBetween:()=>l,isBetweenExclusive:()=>f,isBetweenInclusive:()=>l,max:()=>c,mean:()=>n,median:()=>s,min:()=>u,radians:()=>y,sortNumbers:()=>i,sortNumbersAscending:()=>i,sortNumbersDescending:()=>g,sortedNumbers:()=>a,sortedNumbersAscending:()=>a,sortedNumbersDescending:()=>d,sum:()=>r});var o=function(e,t,r){if(r||2===arguments.length)for(var n,i=0,o=t.length;i<o;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))};function a(e){var t=o([],e,!0);return i(t),t}function s(e){if(0==e.length)return NaN;var t=a(e);if(t.length%2!=0)return t[Math.floor(t.length/2)];var r=t.length/2,i=r-1;return n([t[r],t[i]])}function u(e){if(0==e.length)return 1/0;var t=e[0];return e.slice(1).forEach((function(e){t=Math.min(t,e)})),t}function c(e){if(0==e.length)return-1/0;var t=e[0];return e.slice(1).forEach((function(e){t=Math.max(t,e)})),t}function l(e,t,r){return e>=t&&e<=r}function f(e,t,r){return e>t&&e<r}function h(e,t,r){return e<t?t:e>r?r:e}function p(e,t,r){return Math.abs(e-t)<=r}function g(e){i(e),e.reverse()}function d(e){var t=a(e);return t.reverse(),t}function m(e){return e*(180/Math.PI)}function y(e){return e*(Math.PI/180)}return t})()},854:function(e){e.exports=(()=>{"use strict";var e={d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function r(e){return"number"==typeof e}function n(e){return r(e)&&Number.isFinite(e)}function i(e){return r(e)&&!Number.isFinite(e)}function o(e){return n(e)&&e>0}function a(e){return n(e)&&e>=0}function s(e){return"string"==typeof e}function u(e){return null==e}function c(e){return"object"==typeof e&&null!==e}function l(e){return Array.isArray(e)}function f(e){return l(e)&&e.every(r)}function h(e){return l(e)&&e.every(n)}function p(e){return l(e)&&e.every(i)}function g(e){return l(e)&&e.every(s)}return e.r(t),e.d(t,{isArray:()=>l,isFiniteNumber:()=>n,isFiniteNumbersArray:()=>h,isNonFiniteNumber:()=>i,isNonFiniteNumbersArray:()=>p,isNonNegativeFiniteNumber:()=>a,isNonNullObject:()=>c,isNullish:()=>u,isNumber:()=>r,isNumbersArray:()=>f,isPositiveFiniteNumber:()=>o,isString:()=>s,isStringsArray:()=>g}),t})()}},t={};function r(n){var i=t[n];if(void 0!==i)return i.exports;var o=t[n]={exports:{}};return e[n].call(o.exports,o,o.exports,r),o.exports}r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};return(()=>{"use strict";r.r(n),r.d(n,{Linkers:()=>m,Stems:()=>d,areConflicting:()=>c,areCrossing:()=>h,areEqual:()=>s,areKnotless:()=>f,areStacked:()=>u,deepCopy:()=>i,knotless:()=>g,mountainPlotTraversal:()=>y,parseDotBracket:()=>b,sorted:()=>a});var e=r(854),t=function(e,t,r){if(r||2===arguments.length)for(var n,i=0,o=t.length;i<o;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))};function i(r){return(0,e.isNumbersArray)(r)?t([],r,!0):r.map((function(e){return t([],e,!0)}))}var o=r(986);function a(e){var t=i(e);return t.forEach(o.sortNumbers),t.sort((function(e,t){return e[0]-t[0]})),t}function s(e,t){var r=i(e),n=i(t);return(0,o.sortNumbers)(r),(0,o.sortNumbers)(n),[0,1].every((function(e){return r[e]==n[e]}))}function u(e,t){var r=a([e,t]);return r[0][0]==r[1][0]-1&&r[0][1]==r[1][1]+1}function c(e,t){return(0,o.min)(e)==(0,o.min)(t)&&(0,o.max)(e)!=(0,o.max)(t)||(0,o.min)(e)!=(0,o.min)(t)&&(0,o.max)(e)==(0,o.max)(t)}function l(e){if(0==e.length)return[];for(var t=[],r=0;r<(0,o.max)(e.flat());r++)t.push(void 0);return e.forEach((function(e){t[e[0]-1]=e[1],t[e[1]-1]=e[0]})),t}function f(e){var t=l(e),r=[],n=!1;return t.forEach((function(e,t){var i=t+1;null==e||(i<e?r.push(i):i==e||r.pop()!=e&&(n=!0))})),!n}function h(e,t){return!f([e,t])}var p=function(e,t,r){if(r||2===arguments.length)for(var n,i=0,o=t.length;i<o;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))};function g(e){var t=[],r=i(e);return r.sort((function(e,t){return Math.abs(e[0]-e[1])-Math.abs(t[0]-t[1])})),r.forEach((function(e){f(p(p([],t,!0),[e],!1))&&t.push(e)})),t}var d=function(){function e(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.targetStructure=e}return e.prototype.get=function(){var e=this.targetStructure[1];if(0==e.length)return[];var t=a(e),r=[],n=[];return t.forEach((function(e){var t=0==n.length?null:n[n.length-1];!t||u(t,e)?n.push(e):(r.push(n),n=[e])})),r.push(n),r},e}(),m=function(){function e(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.targetStructure=e}return e.prototype.get=function(){var e=(new(d.bind.apply(d,function(e,t,r){if(r||2===arguments.length)for(var n,i=0,o=t.length;i<o;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))}([void 0],this.targetStructure,!1)))).get().flatMap((function(e){return[e.map(o.min),e.map(o.max)]}));e.forEach(o.sortNumbers),e.sort((function(e,t){return(0,o.min)(e)-(0,o.min)(t)}));for(var t=[],r=e.shift(),n=e.shift();r&&n;){for(var i=[],a=(0,o.max)(r),s=(0,o.min)(n),u=a;u<=s;u++)i.push(u);t.push(i),r=n,n=e.shift()}return t},e}();function y(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=e[0],n=e[1],i=l(n);if(!f(n))throw new Error("Pseudoknot(s) encountered.");var o=[],a=0;return r.forEach((function(e,t){var r=t+1,n=i[t];null==n?o.push(a):r<n?(o.push(a),a++):(r==n||a--,o.push(a))})),o}function b(e){var t=e.split(""),r=[".","(",")"];t.forEach((function(e){if(!r.includes(e))throw new Error('Unrecognized character in dot-bracket notation: "'.concat(e,'".'))}));var n=[],i=[];if(t.forEach((function(e,t){var r=t+1;if("("==e)i.push(r);else if(")"==e){var o=i.pop();if("number"!=typeof o)throw new Error("Unmatched downstream partner(s) in dot-bracket notation.");n.push([o,r])}})),i.length>0)throw new Error("Unmatched upstream partner(s) in dot-bracket notation.");return a(n)}})(),n})(),e.exports=t()}},t={};function r(n){var i=t[n];if(void 0!==i)return i.exports;var o=t[n]={exports:{}};return e[n].call(o.exports,o,o.exports,r),o.exports}r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};return(()=>{"use strict";r.r(n),r.d(n,{FirstPairedBase:()=>t,LastPairedBase:()=>o,LeadingDanglingBases:()=>a,Linkers:()=>l,PositionPairs:()=>e,Stems:()=>c,TrailingDanglingBases:()=>s,consecutivePairs:()=>p,knotless:()=>f,parseDotBracket:()=>h});class e{constructor(...e){this.targetStructure=e}get(){let e=this.targetStructure[0];return this.targetStructure[1].map((t=>[e.indexOf(t[0])+1,e.indexOf(t[1])+1]))}}class t{constructor(...e){this.targetStructure=e}get(){let e=this.targetStructure[0],t=this.targetStructure[1];if(0==t.length)throw new Error("There are no paired bases.");let r=t.flat(),n=e.findIndex((e=>r.includes(e)));if(n<0)throw new Error("No paired bases present in sequence.");return e[n]}}var i=r(986);class o{constructor(...e){this.targetStructure=e}get(){let e=this.targetStructure[0],t=this.targetStructure[1];if(0==t.length)throw new Error("There are no paired bases.");let r=t.flat().map((t=>e.indexOf(t)));if((0,i.max)(r)<0)throw new Error("No paired bases present in sequence.");return e[(0,i.max)(r)]}}class a{constructor(...e){this.targetStructure=e}get(){let e=this.targetStructure[0];if(0==this.targetStructure[1].length)throw new Error("There are no paired bases.");let r=new t(...this.targetStructure).get(),n=e.indexOf(r);if(n<0)throw new Error("No paired bases present in sequence.");return e.slice(0,n)}}class s{constructor(...e){this.targetStructure=e}get(){let e=this.targetStructure[0];if(0==this.targetStructure[1].length)throw new Error("There are no paired bases.");let t=new o(...this.targetStructure).get(),r=e.indexOf(t);if(r<0)throw new Error("No paired bases present in sequence.");return e.slice(r+1)}}var u=r(369);class c{constructor(...e){this.targetStructure=e}get(){let t=this.targetStructure[0],r=new e(...this.targetStructure).get();return new u.Stems(t,r).get().map((e=>e.map((e=>[t[e[0]-1],t[e[1]-1]]))))}}class l{constructor(...e){this.targetStructure=e}get(){let t=this.targetStructure[0],r=new e(...this.targetStructure).get();return new u.Linkers(t,r).get().map((e=>e.map((e=>t[e-1]))))}}function f(...t){let[r,n]=t,i=new e(...t).get();(0,u.areKnotless)(i)||(i=(0,u.knotless)(i));let o=i.map((e=>[r[e[0]-1],r[e[1]-1]]));return[[...r],o]}function h(e,t){if(t.length>e.length)throw new Error("Dot-bracket notation is longer than the sequence.");return[...(0,u.parseDotBracket)(t)].map((t=>{let r=t[0],n=t[1];return[e[r-1],e[n-1]]}))}function p(e){return e.length<2?[]:e.slice(0,-1).map(((t,r)=>[e[r],e[r+1]]))}})(),n})(),e.exports=t()},173:function(e){var t;t=()=>(()=>{var e={422:function(e){e.exports=(()=>{var e={138:function(e){e.exports=(()=>{"use strict";var e={d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function r(e){var t=0;return e.forEach((function(e){return t+=e})),t}function n(e){return r(e)/e.length}return e.r(t),e.d(t,{average:()=>n,mean:()=>n,sum:()=>r}),t})()}},t={};function r(n){var i=t[n];if(void 0!==i)return i.exports;var o=t[n]={exports:{}};return e[n].call(o.exports,o,o.exports,r),o.exports}r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};return(()=>{"use strict";function e(e,t){var r=t.x-e.x,n=t.y-e.y;return Math.pow(Math.pow(r,2)+Math.pow(n,2),.5)}function t(e,t){return{x:t.x-e.x,y:t.y-e.y}}r.r(n),r.d(n,{centroid:()=>o,displacement:()=>t,distance:()=>e,midpoint:()=>a});var i=r(138);function o(e){return{x:(0,i.mean)(e.map((function(e){return e.x}))),y:(0,i.mean)(e.map((function(e){return e.y})))}}function a(e,t){return o([e,t])}})(),n})()},872:function(e){e.exports=(()=>{"use strict";var e={d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function r(e){return Math.atan2(e.y,e.x)}return e.r(t),e.d(t,{direction:()=>r}),t})()}},t={};function r(n){var i=t[n];if(void 0!==i)return i.exports;var o=t[n]={exports:{}};return e[n].call(o.exports,o,o.exports,r),o.exports}r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};return(()=>{"use strict";r.r(n),r.d(n,{CircularSegment:()=>s,Semicircle:()=>t});var e=r(422),t=function(){function t(e){this.chord=e}return Object.defineProperty(t.prototype,"chordLength",{get:function(){return(0,e.distance)(this.chord[0],this.chord[1])},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"arcLength",{get:function(){return Math.PI*this.chordLength/2},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"arcAngle",{get:function(){return Math.PI},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"parentCircleRadius",{get:function(){return this.chordLength/2},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"parentCircleDiameter",{get:function(){return 2*this.parentCircleRadius},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"parentCircleCircumference",{get:function(){return 2*Math.PI*this.parentCircleRadius},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"parentCircleCenterPoint",{get:function(){return(0,e.midpoint)(this.chord[0],this.chord[1])},enumerable:!1,configurable:!0}),t}(),i=r(872),o=function(){function t(t,r){this.chord=t,this.moreProps=r;var n=r.arcLength,i=(0,e.distance)(t[0],t[1]);if(n<=i)throw new Error("Arc length is too small.");if(n>=Math.PI*i/2)throw new Error("Arc length is too big.");for(var o=Math.PI/2,a=0;a<20;a++)o-=(n/i*Math.sin(o)-o)/(n/i*Math.cos(o)-1);this.arcAngle=2*o}return Object.defineProperty(t.prototype,"chordLength",{get:function(){return(0,e.distance)(this.chord[0],this.chord[1])},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"arcLength",{get:function(){return this.moreProps.arcLength},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"parentCircleRadius",{get:function(){return this.arcLength/this.arcAngle},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"parentCircleDiameter",{get:function(){return 2*this.parentCircleRadius},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"parentCircleCircumference",{get:function(){return 2*Math.PI*this.parentCircleRadius},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"parentCircleCenterPoint",{get:function(){var t=(0,i.direction)((0,e.displacement)(this.chord[0],this.chord[1]));t+=(Math.PI-this.arcAngle)/2;var r=this.parentCircleRadius;return{x:this.chord[0].x+r*Math.cos(t),y:this.chord[0].y+r*Math.sin(t)}},enumerable:!1,configurable:!0}),t}(),a=function(){function t(t,r){this.chord=t,this.moreProps=r;var n=r.arcLength,i=(0,e.distance)(t[0],t[1]);if(0==i)throw new Error("Chord length cannot be zero.");if(n<=Math.PI*i/2)throw new Error("Arc length is too small.");for(var o=Math.PI,a=0;a<20;a++)o-=(n/i*Math.sin(Math.PI-o)-o)/(-n/i*Math.cos(Math.PI-o)-1);this.arcAngle=2*o}return Object.defineProperty(t.prototype,"chordLength",{get:function(){return(0,e.distance)(this.chord[0],this.chord[1])},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"arcLength",{get:function(){return this.moreProps.arcLength},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"parentCircleRadius",{get:function(){return this.arcLength/this.arcAngle},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"parentCircleDiameter",{get:function(){return 2*this.parentCircleRadius},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"parentCircleCircumference",{get:function(){return 2*Math.PI*this.parentCircleRadius},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"parentCircleCenterPoint",{get:function(){var t=(0,i.direction)((0,e.displacement)(this.chord[0],this.chord[1]));t-=(this.arcAngle-Math.PI)/2;var r=this.parentCircleRadius;return{x:this.chord[0].x+r*Math.cos(t),y:this.chord[0].y+r*Math.sin(t)}},enumerable:!1,configurable:!0}),t}(),s=function(){function r(r,n){this.chord=r,this.moreProps=n;var i=n.arcLength,s=(0,e.distance)(r[0],r[1]);if(s>0&&i<=s)throw new Error("Arc length is too small.");var u=s<.001&&i<.001,c=Math.PI*s/2,l=Math.abs(i-c)<.001;this.wrappedCircularSegment=u||l?new t(r):i<c?new o(r,{arcLength:i}):new a(r,{arcLength:i})}return Object.defineProperty(r.prototype,"chordLength",{get:function(){return this.wrappedCircularSegment.chordLength},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"arcLength",{get:function(){return this.moreProps.arcLength},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"arcAngle",{get:function(){return this.wrappedCircularSegment.arcAngle},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"parentCircleRadius",{get:function(){return this.wrappedCircularSegment.parentCircleRadius},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"parentCircleDiameter",{get:function(){return this.wrappedCircularSegment.parentCircleDiameter},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"parentCircleCircumference",{get:function(){return this.wrappedCircularSegment.parentCircleCircumference},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"parentCircleCenterPoint",{get:function(){return this.wrappedCircularSegment.parentCircleCenterPoint},enumerable:!1,configurable:!0}),r}()})(),n})(),e.exports=t()},986:function(e){e.exports=(()=>{"use strict";var e={d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function r(e){var t=0;return e.forEach((function(e){return t+=e})),t}function n(e){return r(e)/e.length}function i(e){e.sort((function(e,t){return e-t}))}e.r(t),e.d(t,{areWithin:()=>p,average:()=>n,clamp:()=>h,degrees:()=>m,isBetween:()=>l,isBetweenExclusive:()=>f,isBetweenInclusive:()=>l,max:()=>c,mean:()=>n,median:()=>s,min:()=>u,radians:()=>y,sortNumbers:()=>i,sortNumbersAscending:()=>i,sortNumbersDescending:()=>g,sortedNumbers:()=>a,sortedNumbersAscending:()=>a,sortedNumbersDescending:()=>d,sum:()=>r});var o=function(e,t,r){if(r||2===arguments.length)for(var n,i=0,o=t.length;i<o;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))};function a(e){var t=o([],e,!0);return i(t),t}function s(e){if(0==e.length)return NaN;var t=a(e);if(t.length%2!=0)return t[Math.floor(t.length/2)];var r=t.length/2,i=r-1;return n([t[r],t[i]])}function u(e){if(0==e.length)return 1/0;var t=e[0];return e.slice(1).forEach((function(e){t=Math.min(t,e)})),t}function c(e){if(0==e.length)return-1/0;var t=e[0];return e.slice(1).forEach((function(e){t=Math.max(t,e)})),t}function l(e,t,r){return e>=t&&e<=r}function f(e,t,r){return e>t&&e<r}function h(e,t,r){return e<t?t:e>r?r:e}function p(e,t,r){return Math.abs(e-t)<=r}function g(e){i(e),e.reverse()}function d(e){var t=a(e);return t.reverse(),t}function m(e){return e*(180/Math.PI)}function y(e){return e*(Math.PI/180)}return t})()},725:function(e){e.exports=(()=>{var e={986:function(e){e.exports=(()=>{"use strict";var e={d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function r(e){var t=0;return e.forEach((function(e){return t+=e})),t}function n(e){return r(e)/e.length}function i(e){e.sort((function(e,t){return e-t}))}e.r(t),e.d(t,{areWithin:()=>h,average:()=>n,degrees:()=>d,isBetweenExclusive:()=>f,isBetweenInclusive:()=>l,max:()=>c,mean:()=>n,median:()=>s,min:()=>u,radians:()=>m,sortNumbers:()=>i,sortNumbersAscending:()=>i,sortNumbersDescending:()=>p,sortedNumbers:()=>a,sortedNumbersAscending:()=>a,sortedNumbersDescending:()=>g,sum:()=>r});var o=function(e,t,r){if(r||2===arguments.length)for(var n,i=0,o=t.length;i<o;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))};function a(e){var t=o([],e,!0);return i(t),t}function s(e){if(0==e.length)return NaN;var t=a(e);if(t.length%2!=0)return t[Math.floor(t.length/2)];var r=t.length/2,i=r-1;return n([t[r],t[i]])}function u(e){if(0==e.length)return 1/0;var t=e[0];return e.slice(1).forEach((function(e){t=Math.min(t,e)})),t}function c(e){if(0==e.length)return-1/0;var t=e[0];return e.slice(1).forEach((function(e){t=Math.max(t,e)})),t}function l(e,t,r){return e>=t&&e<=r}function f(e,t,r){return e>t&&e<r}function h(e,t,r){return Math.abs(e-t)<=r}function p(e){i(e),e.reverse()}function g(e){var t=a(e);return t.reverse(),t}function d(e){return e*(180/Math.PI)}function m(e){return e*(Math.PI/180)}return t})()},854:function(e){e.exports=(()=>{"use strict";var e={d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function r(e){return"number"==typeof e}function n(e){return r(e)&&Number.isFinite(e)}function i(e){return r(e)&&!Number.isFinite(e)}function o(e){return n(e)&&e>0}function a(e){return n(e)&&e>=0}function s(e){return"string"==typeof e}function u(e){return null==e}function c(e){return"object"==typeof e&&null!==e}function l(e){return Array.isArray(e)}return e.r(t),e.d(t,{isArray:()=>l,isFiniteNumber:()=>n,isNonFiniteNumber:()=>i,isNonNegativeFiniteNumber:()=>a,isNonNullObject:()=>c,isNullish:()=>u,isNumber:()=>r,isPositiveFiniteNumber:()=>o,isString:()=>s}),t})()},30:function(e){e.exports=(()=>{"use strict";var e={d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function r(e){return Math.pow(Math.pow(e.x,2)+Math.pow(e.y,2),.5)}function n(e){return Math.atan2(e.y,e.x)}return e.r(t),e.d(t,{direction:()=>n,magnitude:()=>r}),t})()}},t={};function r(n){var i=t[n];if(void 0!==i)return i.exports;var o=t[n]={exports:{}};return e[n].call(o.exports,o,o.exports,r),o.exports}r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};return(()=>{"use strict";r.r(n),r.d(n,{areWithin:()=>s,centroid:()=>p,deepCopy:()=>o,direction:()=>f,displaced:()=>c,displacement:()=>u,distance:()=>a,isFinitePoint:()=>i,isPoint:()=>t,midpoint:()=>g});var e=r(854);function t(t){return(0,e.isNonNullObject)(t)&&(0,e.isNumber)(t.x)&&(0,e.isNumber)(t.y)}function i(r){return t(r)&&(0,e.isFiniteNumber)(r.x)&&(0,e.isFiniteNumber)(r.y)}function o(e){return{x:e.x,y:e.y}}function a(e,t){var r=t.x-e.x,n=t.y-e.y;return Math.pow(Math.pow(r,2)+Math.pow(n,2),.5)}function s(e,t,r){return a(e,t)<=r}function u(e,t){return{x:t.x-e.x,y:t.y-e.y}}function c(e,t){return{x:e.x+t.x,y:e.y+t.y}}var l=r(30);function f(e,t){return(0,l.direction)(u(e,t))}var h=r(986);function p(e){return{x:(0,h.mean)(e.map((function(e){return e.x}))),y:(0,h.mean)(e.map((function(e){return e.y})))}}function g(e,t){return p([e,t])}})(),n})()},369:function(e){var t;t=()=>(()=>{var e={986:function(e){e.exports=(()=>{"use strict";var e={d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function r(e){var t=0;return e.forEach((function(e){return t+=e})),t}function n(e){return r(e)/e.length}function i(e){e.sort((function(e,t){return e-t}))}e.r(t),e.d(t,{areWithin:()=>p,average:()=>n,clamp:()=>h,degrees:()=>m,isBetween:()=>l,isBetweenExclusive:()=>f,isBetweenInclusive:()=>l,max:()=>c,mean:()=>n,median:()=>s,min:()=>u,radians:()=>y,sortNumbers:()=>i,sortNumbersAscending:()=>i,sortNumbersDescending:()=>g,sortedNumbers:()=>a,sortedNumbersAscending:()=>a,sortedNumbersDescending:()=>d,sum:()=>r});var o=function(e,t,r){if(r||2===arguments.length)for(var n,i=0,o=t.length;i<o;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))};function a(e){var t=o([],e,!0);return i(t),t}function s(e){if(0==e.length)return NaN;var t=a(e);if(t.length%2!=0)return t[Math.floor(t.length/2)];var r=t.length/2,i=r-1;return n([t[r],t[i]])}function u(e){if(0==e.length)return 1/0;var t=e[0];return e.slice(1).forEach((function(e){t=Math.min(t,e)})),t}function c(e){if(0==e.length)return-1/0;var t=e[0];return e.slice(1).forEach((function(e){t=Math.max(t,e)})),t}function l(e,t,r){return e>=t&&e<=r}function f(e,t,r){return e>t&&e<r}function h(e,t,r){return e<t?t:e>r?r:e}function p(e,t,r){return Math.abs(e-t)<=r}function g(e){i(e),e.reverse()}function d(e){var t=a(e);return t.reverse(),t}function m(e){return e*(180/Math.PI)}function y(e){return e*(Math.PI/180)}return t})()},854:function(e){e.exports=(()=>{"use strict";var e={d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function r(e){return"number"==typeof e}function n(e){return r(e)&&Number.isFinite(e)}function i(e){return r(e)&&!Number.isFinite(e)}function o(e){return n(e)&&e>0}function a(e){return n(e)&&e>=0}function s(e){return"string"==typeof e}function u(e){return null==e}function c(e){return"object"==typeof e&&null!==e}function l(e){return Array.isArray(e)}function f(e){return l(e)&&e.every(r)}function h(e){return l(e)&&e.every(n)}function p(e){return l(e)&&e.every(i)}function g(e){return l(e)&&e.every(s)}return e.r(t),e.d(t,{isArray:()=>l,isFiniteNumber:()=>n,isFiniteNumbersArray:()=>h,isNonFiniteNumber:()=>i,isNonFiniteNumbersArray:()=>p,isNonNegativeFiniteNumber:()=>a,isNonNullObject:()=>c,isNullish:()=>u,isNumber:()=>r,isNumbersArray:()=>f,isPositiveFiniteNumber:()=>o,isString:()=>s,isStringsArray:()=>g}),t})()}},t={};function r(n){var i=t[n];if(void 0!==i)return i.exports;var o=t[n]={exports:{}};return e[n].call(o.exports,o,o.exports,r),o.exports}r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};return(()=>{"use strict";r.r(n),r.d(n,{Linkers:()=>m,Stems:()=>d,areConflicting:()=>c,areCrossing:()=>h,areEqual:()=>s,areKnotless:()=>f,areStacked:()=>u,deepCopy:()=>i,knotless:()=>g,mountainPlotTraversal:()=>y,parseDotBracket:()=>b,sorted:()=>a});var e=r(854),t=function(e,t,r){if(r||2===arguments.length)for(var n,i=0,o=t.length;i<o;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))};function i(r){return(0,e.isNumbersArray)(r)?t([],r,!0):r.map((function(e){return t([],e,!0)}))}var o=r(986);function a(e){var t=i(e);return t.forEach(o.sortNumbers),t.sort((function(e,t){return e[0]-t[0]})),t}function s(e,t){var r=i(e),n=i(t);return(0,o.sortNumbers)(r),(0,o.sortNumbers)(n),[0,1].every((function(e){return r[e]==n[e]}))}function u(e,t){var r=a([e,t]);return r[0][0]==r[1][0]-1&&r[0][1]==r[1][1]+1}function c(e,t){return(0,o.min)(e)==(0,o.min)(t)&&(0,o.max)(e)!=(0,o.max)(t)||(0,o.min)(e)!=(0,o.min)(t)&&(0,o.max)(e)==(0,o.max)(t)}function l(e){if(0==e.length)return[];for(var t=[],r=0;r<(0,o.max)(e.flat());r++)t.push(void 0);return e.forEach((function(e){t[e[0]-1]=e[1],t[e[1]-1]=e[0]})),t}function f(e){var t=l(e),r=[],n=!1;return t.forEach((function(e,t){var i=t+1;null==e||(i<e?r.push(i):i==e||r.pop()!=e&&(n=!0))})),!n}function h(e,t){return!f([e,t])}var p=function(e,t,r){if(r||2===arguments.length)for(var n,i=0,o=t.length;i<o;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))};function g(e){var t=[],r=i(e);return r.sort((function(e,t){return Math.abs(e[0]-e[1])-Math.abs(t[0]-t[1])})),r.forEach((function(e){f(p(p([],t,!0),[e],!1))&&t.push(e)})),t}var d=function(){function e(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.targetStructure=e}return e.prototype.get=function(){var e=this.targetStructure[1];if(0==e.length)return[];var t=a(e),r=[],n=[];return t.forEach((function(e){var t=0==n.length?null:n[n.length-1];!t||u(t,e)?n.push(e):(r.push(n),n=[e])})),r.push(n),r},e}(),m=function(){function e(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.targetStructure=e}return e.prototype.get=function(){var e=(new(d.bind.apply(d,function(e,t,r){if(r||2===arguments.length)for(var n,i=0,o=t.length;i<o;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))}([void 0],this.targetStructure,!1)))).get().flatMap((function(e){return[e.map(o.min),e.map(o.max)]}));e.forEach(o.sortNumbers),e.sort((function(e,t){return(0,o.min)(e)-(0,o.min)(t)}));for(var t=[],r=e.shift(),n=e.shift();r&&n;){for(var i=[],a=(0,o.max)(r),s=(0,o.min)(n),u=a;u<=s;u++)i.push(u);t.push(i),r=n,n=e.shift()}return t},e}();function y(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=e[0],n=e[1],i=l(n);if(!f(n))throw new Error("Pseudoknot(s) encountered.");var o=[],a=0;return r.forEach((function(e,t){var r=t+1,n=i[t];null==n?o.push(a):r<n?(o.push(a),a++):(r==n||a--,o.push(a))})),o}function b(e){var t=e.split(""),r=[".","(",")"];t.forEach((function(e){if(!r.includes(e))throw new Error('Unrecognized character in dot-bracket notation: "'.concat(e,'".'))}));var n=[],i=[];if(t.forEach((function(e,t){var r=t+1;if("("==e)i.push(r);else if(")"==e){var o=i.pop();if("number"!=typeof o)throw new Error("Unmatched downstream partner(s) in dot-bracket notation.");n.push([o,r])}})),i.length>0)throw new Error("Unmatched upstream partner(s) in dot-bracket notation.");return a(n)}})(),n})(),e.exports=t()},30:function(e){e.exports=(()=>{"use strict";var e={d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function r(e){return Math.pow(Math.pow(e.x,2)+Math.pow(e.y,2),.5)}function n(e){return Math.atan2(e.y,e.x)}return e.r(t),e.d(t,{direction:()=>n,magnitude:()=>r}),t})()}},t={};function r(n){var i=t[n];if(void 0!==i)return i.exports;var o=t[n]={exports:{}};return e[n].call(o.exports,o,o.exports,r),o.exports}r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};return(()=>{"use strict";r.r(n),r.d(n,{Centroid:()=>o,Direction:()=>p,MaxCenterX:()=>u,MaxCenterY:()=>l,MinCenterX:()=>s,MinCenterY:()=>c,NucleobaseMock:()=>e,arrange:()=>j,circularize:()=>w,flipSelfX:()=>m,flipSelfY:()=>y,flipX:()=>g,flipY:()=>d,linearize:()=>b,radialize:()=>k,rotate:()=>h,round:()=>x,shift:()=>t,stemmify:()=>P,straighten:()=>v});class e{constructor(e){this.props=e}getCenterPoint(){return this.props.centerPoint}setCenterPoint(e){this.props.centerPoint=e}}function t(e,t){e.forEach((e=>{let r=e.getCenterPoint();e.setCenterPoint({x:r.x+t.x,y:r.y+t.y})}))}var i=r(725);class o{constructor(e){this.targetBases=e}get(){let e=this.targetBases.map((e=>e.getCenterPoint()));return(0,i.centroid)(e)}set(e){let r=this.get(),n=(0,i.displacement)(r,e);t(this.targetBases,n)}}var a=r(986);class s{constructor(e){this.targetBases=e}get(){return(0,a.min)(this.targetBases.map((e=>e.getCenterPoint().x)))}set(e){let r=this.get();t(this.targetBases,{x:e-r,y:0})}}class u{constructor(e){this.targetBases=e}get(){return(0,a.max)(this.targetBases.map((e=>e.getCenterPoint().x)))}set(e){let r=this.get();t(this.targetBases,{x:e-r,y:0})}}class c{constructor(e){this.targetBases=e}get(){return(0,a.min)(this.targetBases.map((e=>e.getCenterPoint().y)))}set(e){let r=this.get();t(this.targetBases,{x:0,y:e-r})}}class l{constructor(e){this.targetBases=e}get(){return(0,a.max)(this.targetBases.map((e=>e.getCenterPoint().y)))}set(e){let r=this.get();t(this.targetBases,{x:0,y:e-r})}}var f=r(30);function h(e,t){if(0==e.length)return;let r=new o(e).get();e.forEach((e=>{let n=e.getCenterPoint(),o=(0,i.distance)(r,n),a=(0,f.direction)((0,i.displacement)(r,n));a+=t,e.setCenterPoint({x:r.x+o*Math.cos(a),y:r.y+o*Math.sin(a)})}))}class p{constructor(e){this.targetBases=e}get(){if(this.targetBases.length<2)return 0;let e=this.targetBases[0],t=this.targetBases[this.targetBases.length-1];return(0,f.direction)((0,i.displacement)(e.getCenterPoint(),t.getCenterPoint()))}set(e){let t=e-this.get();h(this.targetBases,t)}}function g(e){let t=new o(e).get().y;e.forEach((e=>{let r=e.getCenterPoint(),n=r.y-t;e.setCenterPoint({x:r.x,y:t-n})}))}function d(e){let t=new o(e).get().x;e.forEach((e=>{let r=e.getCenterPoint(),n=r.x-t;e.setCenterPoint({x:t-n,y:r.y})}))}function m(e){if(0==e.length)return;let r=e[0],{x:n,y:o}=r.getCenterPoint(),a={x:n,y:o},s=new p(e).get();h(e,-s),g(e),h(e,s),t(e,(0,i.displacement)(r.getCenterPoint(),a))}function y(e){let t=new o(e),{x:r,y:n}=t.get(),i=r,a=n,s=new p(e).get();h(e,-s),d(e),h(e,s),t.set({x:i,y:a})}function b(e,t){let{spacing:r}=t;if(e.length<2)return;let n=new p(e),i=n.get(),a=new o(e),{x:s,y:u}=a.get(),c={x:s,y:u};e.forEach(((e,t)=>{e.setCenterPoint({x:t*r,y:0})})),n.set(i),a.set(c)}function v(e){if(e.length<3)return;let t=e[0],r=e[e.length-1],n=[t.getCenterPoint(),r.getCenterPoint()],o=(0,i.distance)(n[0],n[1]),a=(0,f.direction)((0,i.displacement)(n[0],n[1])),s=o/(e.length-1),u=s*Math.cos(a),c=s*Math.sin(a),{x:l,y:h}=n[0];e.forEach((e=>{e.setCenterPoint({x:l,y:h}),l+=u,h+=c}))}function P(e,r){let{basePairLength:n,basePairSpacing:a}=r;if(e.length<2)return;let s=Math.ceil(e.length/2),u=e.slice(0,s),c=e.slice(s),l=new o(e),{x:f,y:g}=l.get(),d={x:f,y:g},m=new p(e).get();b(u,{spacing:a}),b(c,{spacing:a}),new p(u).set(-Math.PI/2),new p(c).set(Math.PI/2);let y=e[0],v=e[e.length-1];t(u,(0,i.displacement)(y.getCenterPoint(),{x:0,y:0})),t(c,(0,i.displacement)(v.getCenterPoint(),{x:n,y:0})),h(e,m),l.set(d)}function w(e,t){let{spacing:r,terminiGap:n}=t;if(e.length<2)return;let i=new o(e),{x:a,y:s}=i.get(),u=a,c=s,l=new p(e).get(),f=r*(e.length-1);f+=n,Math.abs(f)<1e-5&&(f=1e-5);let g=f/(2*Math.PI),d=Math.PI/2+2*Math.PI*(.5*n/f);e.forEach(((e,t)=>{let n=d+2*Math.PI*(t*r)/f;e.setCenterPoint({x:g*Math.cos(n),y:g*Math.sin(n)})})),h(e,l),i.set({x:u,y:c})}var S=r(173);function x(e,r){let{spacing:n}=r;if(e.length<3)return;let o=e[0],a=e[e.length-1],s=[o.getCenterPoint(),a.getCenterPoint()],u=(0,i.distance)(s[0],s[1]),c=n*(e.length-1);if(c-u<.001)return void v(e);if(u<.001){let{x:r,y:a}=o.getCenterPoint();return w(e,{spacing:n,terminiGap:u}),void t(e,(0,i.displacement)(o.getCenterPoint(),{x:r,y:a}))}let l=new S.CircularSegment(s,{arcLength:c}),h=l.parentCircleCenterPoint,p=l.parentCircleRadius,g=(0,f.direction)((0,i.displacement)(h,o.getCenterPoint())),d=l.arcAngle/(e.length-1);e.forEach((e=>{e.setCenterPoint({x:h.x+p*Math.cos(g),y:h.y+p*Math.sin(g)}),g+=d}))}var M=r(127),O=r(369);function j(e,r,n){var s,u,c;let{spacing:l}=n,f=null!==(s=n.basePairSpacing)&&void 0!==s?s:l,h=null!==(u=n.hairpinLoopSpacing)&&void 0!==u?u:l,g=null!==(c=n.terminiGap)&&void 0!==c?c:l,{x:d,y:m}=new o(e).get(),y={x:d,y:m},b=new p(e).get();[,r]=(0,M.knotless)(e,r);let v=new M.PositionPairs(e,r).get(),S=(0,O.mountainPlotTraversal)(e,v),j=e.filter(((e,t)=>0==S[t]));w(j,{spacing:l,terminiGap:g});let N=new M.Stems(e,r).get(),C=new Set(j),E=N.filter((e=>C.has(e[0][0]))),B=r=>{let n=r[0],{x:s,y:u}=new o(n).get(),c={x:s,y:u},g=new p(r[0]).get(),d=[...r.map((e=>e[0])),...r.map((e=>e[1])).reverse()];P(d,{basePairLength:l,basePairSpacing:f}),new p(d).set(g),t(d,(0,i.displacement)(new o(n).get(),c));let m=r[r.length-1],y=m.map((t=>e.indexOf(t))),b=e.filter(((e,t)=>(0,a.isBetweenExclusive)(t,(0,a.min)(y),(0,a.max)(y))&&S[t]==S[(0,a.min)(y)]+1)),v=new Set(b),w=N.filter((e=>v.has(e[0][0])));x([m[0],...b,m[1]],{spacing:w.length>0?l:h}),w.forEach((e=>B(e)))};E.forEach((e=>B(e))),new p(e).set(b),new o(e).set(y)}class N{static from(e){return{to:t=>({inclusive:()=>{let r=t-e+1;return Array.from({length:r},((t,r)=>e+r))}})}}}class C{static of(...e){let[t,r]=e,n=new M.PositionPairs(...e).get();n=(0,O.sorted)(n);let i=n.map((e=>e.map((e=>e-1)))),o=[],s=0;return t.forEach(((e,t)=>{let r=i.find((e=>e.includes(t)));r&&t==(0,a.min)(r)?(o.push(s),s+=1):r&&t==(0,a.max)(r)?(s-=1,o.push(s)):o.push(s)})),o}}class E{constructor(...e){let[t,r]=e;this.rawForm=e,this.mountainPlotTraversal=C.of(...e),this.positionPairs=new M.PositionPairs(...e).get(),this.indexPairs=this.positionPairs.map((e=>[e[0]-1,e[1]-1])),this.pairedBases=new Set(r.flat()),this.pairedIndices=new Set(t.map(((e,t)=>({b:e,i:t}))).filter((e=>this.pairedBases.has(e.b))).map((e=>e.i)))}[Symbol.iterator](){return this.rawForm.values()}get sequence(){return this.rawForm[0]}get basePairs(){return this.rawForm[1]}}class B{static correspondingTo(e){return{in:t=>e.map((e=>t.sequence.indexOf(e)))}}}class A{static composedOf(e){if(0==e.length)throw new Error("All stems must have at least one base-pair.");let r=e[0],n=e[e.length-1],o=e.map((e=>e[0])),a=e.map((e=>e[1])).reverse(),s=r[0],u=r[1],c=[...o,...a];return{[Symbol.iterator]:()=>e.values(),bottomBasePair:r,topBasePair:n,side5:o,side3:a,flat:()=>c,firstBase:s,lastBase:u,stemmify:()=>({with:e=>{let{basePairLength:r,basePairSpacing:n}=e,o=Object.assign({},s.getCenterPoint());P(c,{basePairLength:r,basePairSpacing:n}),t(c,(0,i.displacement)(s.getCenterPoint(),o))}})}}}class T{static in(e){return{[Symbol.iterator]:()=>new M.Stems(e.sequence,e.basePairs).get().map((e=>A.composedOf(e))).values()}}}class I{static composedOf(e){if(e.length<2)throw new Error("Linkers must have at least two bases.");let r=e[0],n=e[e.length-1],o=e.slice(1,-1);return{in:a=>{let s=a.sequence.indexOf(r),u=a.sequence.indexOf(n),c=N.from(s).to(u).inclusive(),l=!!a.indexPairs.find((e=>e.includes(s)&&e.includes(u))),f=c.every((e=>0==a.mountainPlotTraversal[e])),h=1==new Set(c.map((e=>a.mountainPlotTraversal[e]))).size&&!l;return{[Symbol.iterator]:()=>e.values(),indices:c,firstBase:r,lastBase:n,firstIndex:s,lastIndex:u,unpairedBases:{[Symbol.iterator]:()=>o.values(),stemmify:()=>({with:e=>{let{spacing:r}=e;if(o.length<3)return;let n=o[0],a=o[o.length-1],s=Object.assign({},n.getCenterPoint());P(o,{basePairLength:(0,i.distance)(n.getCenterPoint(),a.getCenterPoint()),basePairSpacing:r}),t(o,(0,i.displacement)(n.getCenterPoint(),s))}})},get middleThreeUnpairedBases(){if(o.length<3)throw new Error("This linker has less than three unpaired bases.");if(o.length%2==0)throw new Error("This linker has an even number of unpaired bases.");let e=Math.floor(o.length/2);return[o[e-1],o[e],o[e+1]]},isHairpinLoop:()=>l,isInOutermostLoop:()=>f,isBetweenSiblingStems:()=>h,round:()=>({with:t=>{let{spacing:r}=t;x(e,{spacing:r})}})}}}}}class L{static in(e){let t=new M.Linkers(e.sequence,e.basePairs).get().map((t=>I.composedOf(t).in(e)));return{[Symbol.iterator]:()=>t.values(),thatAreHairpinLoops:{[Symbol.iterator]:()=>t.filter((e=>e.isHairpinLoop())).values()},inOutermostLoop:{[Symbol.iterator]:()=>t.filter((e=>e.isInOutermostLoop())).values()},notInOutermostLoop:{[Symbol.iterator]:()=>t.filter((e=>!e.isInOutermostLoop())).values(),betweenSiblingStems:{[Symbol.iterator]:()=>t.filter((e=>!e.isInOutermostLoop())).filter((e=>e.isBetweenSiblingStems())).values()}},notBetweenSiblingStems:{[Symbol.iterator]:()=>t.filter((e=>!e.isBetweenSiblingStems())).values()}}}}class D{static closedBy(r){return{in:n=>{let o=r.topBasePair,s=B.correspondingTo(o).in(n),u=(0,a.min)(s),c=n.sequence.filter(((e,t)=>t>(0,a.min)(s)&&t<(0,a.max)(s)&&n.mountainPlotTraversal[t]==n.mountainPlotTraversal[u]+1)),l=c.map((e=>n.sequence.indexOf(e))),f=c.filter((e=>n.pairedBases.has(e))),h=l.filter((e=>n.pairedIndices.has(e))),p=[o[0],...c,o[1]];return{[Symbol.iterator]:()=>p.values(),parentStructure:n,closingStem:r,closingBasePair:o,closingIndexPair:s,enclosedBases:c,enclosedIndices:l,enclosedPairedBases:f,enclosedPairedIndices:h,get platform(){if(0==h.length)throw new Error("This loop does not have a platform.");let r=(0,a.min)(h),u=(0,a.max)(h),c=n.sequence.filter(((e,t)=>t>=r&&t<=u&&l.includes(t)&&[t-1,t,t+1].some((e=>h.includes(e)))));return{[Symbol.iterator]:()=>c.values(),firstIndex:r,lastIndex:u,arch:()=>({with:n=>{let{spacing:l}=n,f=(0,a.max)([c.length-2,r-(0,a.min)(s)-1,(0,a.max)(s)-u-1,0]),h=N.from(1).to(f).inclusive().map((()=>new e({centerPoint:{x:0,y:0}}))),p=h.map((()=>new e({centerPoint:{x:0,y:0}}))),g=Object.assign({},o[0].getCenterPoint());w([o[0],...h,...c,...p,o[1]],{spacing:l,terminiGap:l}),t([...o,...c],(0,i.displacement)(o[0].getCenterPoint(),g))}})}}}}}}}class _{static of(e){let t=e.sequence.filter(((t,r)=>0==e.mountainPlotTraversal[r]));return{[Symbol.iterator]:()=>t.values()}}}function k(e,t,r){var n;let{spacing:i,basePairSpacing:a}=r,s=null!==(n=r.hairpinLoopSpacing)&&void 0!==n?n:i,u=new E(e,t);if(e.length<2)return;if(0==t.length)return void w(e,{spacing:i,terminiGap:2*i});let c=Object.assign({},new o(e).get()),l=new p(e).get(),f=T.in(u),h=L.in(u);w([..._.of(u)],{spacing:i,terminiGap:2*i});let g=[...f].map((e=>D.closedBy(e).in(u)));g.filter((e=>e.enclosedPairedBases.length>0)).forEach((e=>{e.closingStem.stemmify().with({basePairLength:i,basePairSpacing:a}),e.platform.arch().with({spacing:i}),e.closingStem.stemmify().with({basePairLength:i,basePairSpacing:a})})),g.filter((e=>0==e.enclosedPairedBases.length)).forEach((e=>e.closingStem.stemmify().with({basePairLength:i,basePairSpacing:a}))),[...h.notBetweenSiblingStems].forEach((e=>e.round().with({spacing:i}))),[...h.thatAreHairpinLoops].forEach((e=>e.round().with({spacing:s}))),[...h.notInOutermostLoop.betweenSiblingStems].filter((e=>[...e.unpairedBases].length>=3)).forEach((e=>{e.unpairedBases.stemmify().with({spacing:i}),[...e.unpairedBases].length%2!=0&&x(e.middleThreeUnpairedBases,{spacing:i})})),new p(e).set(l),new o(e).set(c)}})(),n})(),e.exports=t()}},t={};function r(n){var i=t[n];if(void 0!==i)return i.exports;var o=t[n]={exports:{}};return e[n].call(o.exports,o,o.exports,r),o.exports}r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};return(()=>{"use strict";r.r(n),r.d(n,{ConsecutiveBasesSelectingTool:()=>e,DraggingTool:()=>f,SelectedBases:()=>c});class e{constructor(e,t){this.target=e,this.selectedBases=t,this.mouseIsDown=!1,window.addEventListener("mousedown",(e=>this.handleMouseDown(e))),window.addEventListener("mouseup",(e=>this.handleMouseUp(e))),window.addEventListener("mouseover",(e=>this.handleMouseOver(e)))}handleMouseDown(e){this.lastMouseDown=e,this.mouseIsDown=!0}handleMouseUp(e){this.mouseIsDown=!1}handleMouseOver(e){if(!this.mouseIsDown)return;let t=this.lastMouseDown;if(!t)return;if(!t.shiftKey)return;if(!(e.target instanceof Node))return;if(!this.target.domNode.contains(e.target))return;let r=[...this.target.bases],n=r.findIndex((t=>t.domNode===e.target));if(n<0)return;let i=r.findIndex((e=>e.domNode===t.target));if(i<0)return;try{let e=r[i];if(!this.selectedBases.include(e))return}catch(e){console.error(e)}let o=Math.min(i,n),a=Math.max(i,n);this.selectedBases.addAll(r.slice(o,a+1))}}var t,i,o,a,s=function(e,t,r,n,i){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?i.call(e,r):i?i.value=r:t.set(e,r),r},u=function(e,t,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)};class c{constructor(e,r){t.add(this),this.selectedSVGElements=r,i.set(this,void 0),o.set(this,{change:[]}),s(this,i,e,"f"),r.addEventListener("change",(()=>u(this,t,"m",a).call(this,"change")))}get target(){return u(this,i,"f")}set target(e){s(this,i,e,"f"),u(this,t,"m",a).call(this,"change")}[(i=new WeakMap,o=new WeakMap,t=new WeakSet,Symbol.iterator)](){return[...this.target.bases].filter((e=>this.selectedSVGElements.include(e.domNode))).values()}include(e){return this.selectedSVGElements.include(e.domNode)}addAll(e){this.selectedSVGElements.addAll([...e].map((e=>e.domNode)))}addEventListener(e,t){u(this,o,"f")[e].push(t)}}a=function(e){u(this,o,"f")[e].forEach((e=>e()))};var l=r(661);class f{constructor(e,t,r){this.target=e,this.selectedElements=t,this.options=r,this.mouseIsDown=!1,this.dragged=!1,window.addEventListener("mousedown",(e=>this.handleMouseDown(e))),window.addEventListener("mousemove",(e=>this.handleMouseMove(e))),window.addEventListener("mouseup",(e=>this.handleMouseUp(e)))}handleMouseDown(e){this.lastMouseDown=e,this.mouseIsDown=!0,this.dragged=!1}handleMouseMove(e){var t;if(!this.mouseIsDown)return;if(!this.lastMouseDown)return;if(this.lastMouseDown.shiftKey)return;if(!(this.lastMouseDown.target instanceof SVGGraphicsElement))return;if(!this.selectedElements.svgElements.include(this.lastMouseDown.target))return;let r=e.movementX/this.target.horizontalClientScaling,n=e.movementY/this.target.verticalClientScaling;this.dragged||!(null===(t=this.options)||void 0===t?void 0:t.beforeDragging)||this.options.beforeDragging(),(0,l.shift)([...this.selectedElements.bases],{x:r,y:n}),this.dragged=!0}handleMouseUp(e){var t;this.mouseIsDown=!1,!this.dragged||!(null===(t=this.options)||void 0===t?void 0:t.afterDragging)||this.options.afterDragging(),this.dragged=!1}}})(),n})()));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rnacanvas/draw.interact",
3
- "version": "2.1.0",
3
+ "version": "2.3.0",
4
4
  "description": "Interact with RNAcanvas structure drawings",
5
5
  "repository": {
6
6
  "type": "git",