@datagrok/hit-triage 1.1.2 → 1.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/dist/package.js +1 -1
- package/dist/package.js.map +1 -1
- package/package.json +1 -1
- package/src/app/hit-design-app.ts +2 -2
- package/src/app/hit-triage-app.ts +15 -6
- package/src/package.ts +4 -6
package/CHANGELOG.md
CHANGED
package/dist/package.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var hittriage;(()=>{var t={553:t=>{!function(){"use strict";var e=document,n=window,i=e.documentElement,o=e.createElement.bind(e),a=o("div"),s=o("table"),r=o("tbody"),l=o("tr"),c=Array.isArray,u=Array.prototype,d=u.concat,p=u.filter,m=u.indexOf,h=u.map,f=u.push,v=u.slice,g=u.some,y=u.splice,b=/^#(?:[\w-]|\\.|[^\x00-\xa0])*$/,w=/^\.(?:[\w-]|\\.|[^\x00-\xa0])*$/,C=/<.+>/,A=/^\w+$/;function T(t,e){var n,i=!!(n=e)&&11===n.nodeType;return t&&(i||S(e)||F(e))?!i&&w.test(t)?e.getElementsByClassName(t.slice(1).replace(/\\/g,"")):!i&&A.test(t)?e.getElementsByTagName(t):e.querySelectorAll(t):[]}var x=function(){function t(t,i){if(t){if(_(t))return t;var o=t;if(O(t)){var a=i||e;if(!(o=b.test(t)&&S(a)?a.getElementById(t.slice(1).replace(/\\/g,"")):C.test(t)?X(t):_(a)?a.find(t):O(a)?N(a).find(t):T(t,a)))return}else if(P(t))return this.ready(t);(o.nodeType||o===n)&&(o=[o]),this.length=o.length;for(var s=0,r=this.length;s<r;s++)this[s]=o[s]}}return t.prototype.init=function(e,n){return new t(e,n)},t}(),I=x.prototype,N=I.init;function _(t){return t instanceof x}function E(t){return!!t&&t===t.window}function S(t){return!!t&&9===t.nodeType}function F(t){return!!t&&1===t.nodeType}function B(t){return"boolean"==typeof t}function P(t){return"function"==typeof t}function O(t){return"string"==typeof t}function k(t){return void 0===t}function V(t){return null===t}function L(t){return!isNaN(parseFloat(t))&&isFinite(t)}function D(t){if("object"!=typeof t||null===t)return!1;var e=Object.getPrototypeOf(t);return null===e||e===Object.prototype}function j(t,e,n){if(n){for(var i=t.length;i--;)if(!1===e.call(t[i],i,t[i]))return t}else if(D(t))for(var o=Object.keys(t),a=(i=0,o.length);i<a;i++){var s=o[i];if(!1===e.call(t[s],s,t[s]))return t}else for(i=0,a=t.length;i<a;i++)if(!1===e.call(t[i],i,t[i]))return t;return t}function R(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=!!B(t[0])&&t.shift(),i=t.shift(),o=t.length;if(!i)return{};if(!o)return R(n,N,i);for(var a=0;a<o;a++){var s=t[a];for(var r in s)n&&(c(s[r])||D(s[r]))?(i[r]&&i[r].constructor===s[r].constructor||(i[r]=new s[r].constructor),R(n,i[r],s[r])):i[r]=s[r]}return i}N.fn=N.prototype=I,I.length=0,I.splice=y,"function"==typeof Symbol&&(I[Symbol.iterator]=u[Symbol.iterator]),N.isWindow=E,N.isFunction=P,N.isArray=c,N.isNumeric=L,N.isPlainObject=D,N.each=j,I.each=function(t){return j(this,t)},I.empty=function(){return this.each((function(t,e){for(;e.firstChild;)e.removeChild(e.firstChild)}))},N.extend=R,I.extend=function(t){return R(I,t)};var M=/\S+/g;function H(t){return O(t)&&t.match(M)||[]}function U(t,e,i){if(F(t)){var o=n.getComputedStyle(t,null);return i?o.getPropertyValue(e)||void 0:o[e]||t.style[e]}}function $(t,e){return parseInt(U(t,e),10)||0}function Y(t,e){return $(t,"border".concat(e?"Left":"Top","Width"))+$(t,"padding".concat(e?"Left":"Top"))+$(t,"padding".concat(e?"Right":"Bottom"))+$(t,"border".concat(e?"Right":"Bottom","Width"))}I.toggleClass=function(t,e){var n=H(t),i=!k(e);return this.each((function(t,o){F(o)&&j(n,(function(t,n){i?e?o.classList.add(n):o.classList.remove(n):o.classList.toggle(n)}))}))},I.addClass=function(t){return this.toggleClass(t,!0)},I.removeAttr=function(t){var e=H(t);return this.each((function(t,n){F(n)&&j(e,(function(t,e){n.removeAttribute(e)}))}))},I.attr=function(t,e){if(t){if(O(t)){if(arguments.length<2){if(!this[0]||!F(this[0]))return;var n=this[0].getAttribute(t);return V(n)?void 0:n}return k(e)?this:V(e)?this.removeAttr(t):this.each((function(n,i){F(i)&&i.setAttribute(t,e)}))}for(var i in t)this.attr(i,t[i]);return this}},I.removeClass=function(t){return arguments.length?this.toggleClass(t,!1):this.attr("class","")},I.hasClass=function(t){return!!t&&g.call(this,(function(e){return F(e)&&e.classList.contains(t)}))},I.get=function(t){return k(t)?v.call(this):this[(t=Number(t))<0?t+this.length:t]},I.eq=function(t){return N(this.get(t))},I.first=function(){return this.eq(0)},I.last=function(){return this.eq(-1)},I.text=function(t){return k(t)?this.get().map((function(t){return F(t)||(e=t)&&3===e.nodeType?t.textContent:"";var e})).join(""):this.each((function(e,n){F(n)&&(n.textContent=t)}))};var W={};function q(t){return"none"===U(t,"display")}function G(t,e){var n=t&&(t.matches||t.webkitMatchesSelector||t.msMatchesSelector);return!!n&&!!e&&n.call(t,e)}function J(t){return O(t)?function(e,n){return G(n,t)}:P(t)?t:_(t)?function(e,n){return t.is(n)}:t?function(e,n){return n===t}:function(){return!1}}function Z(t,e){return e?t.filter(e):t}I.filter=function(t){var e=J(t);return N(p.call(this,(function(t,n){return e.call(t,n,t)})))},I.detach=function(t){return Z(this,t).each((function(t,e){e.parentNode&&e.parentNode.removeChild(e)})),this};var z=/^\s*<(\w+)[^>]*>/,K=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,Q={"*":a,tr:r,td:l,th:l,thead:s,tbody:s,tfoot:s};function X(t){if(!O(t))return[];if(K.test(t))return[o(RegExp.$1)];var e=z.test(t)&&RegExp.$1,n=Q[e]||Q["*"];return n.innerHTML=t,N(n.childNodes).detach().get()}function tt(t,e,n,i){for(var o=[],a=P(e),s=i&&J(i),r=0,l=t.length;r<l;r++)if(a){var c=e(t[r]);c.length&&f.apply(o,c)}else for(var u=t[r][e];!(null==u||i&&s(-1,u));)o.push(u),u=n?u[e]:null;return o}function et(t){return t.multiple&&t.options?tt(p.call(t.options,(function(t){return t.selected&&!t.disabled&&!t.parentNode.disabled})),"value"):t.value||""}function nt(t){return t.length>1?p.call(t,(function(t,e,n){return m.call(n,t)===e})):t}N.parseHTML=X,I.has=function(t){var e=O(t)?function(e,n){return T(t,n).length}:function(e,n){return n.contains(t)};return this.filter(e)},I.not=function(t){var e=J(t);return this.filter((function(n,i){return(!O(t)||F(i))&&!e.call(i,n,i)}))},I.val=function(t){return arguments.length?this.each((function(e,n){var i=n.multiple&&n.options;if(i||Ot.test(n.type)){var o=c(t)?h.call(t,String):V(t)?[]:[String(t)];i?j(n.options,(function(t,e){e.selected=o.indexOf(e.value)>=0}),!0):n.checked=o.indexOf(n.value)>=0}else n.value=k(t)||V(t)?"":t})):this[0]&&et(this[0])},I.is=function(t){var e=J(t);return g.call(this,(function(t,n){return e.call(t,n,t)}))},N.guid=1,N.unique=nt,I.add=function(t,e){return N(nt(this.get().concat(N(t,e).get())))},I.children=function(t){return Z(N(nt(tt(this,(function(t){return t.children})))),t)},I.parent=function(t){return Z(N(nt(tt(this,"parentNode"))),t)},I.index=function(t){var e=t?N(t)[0]:this[0],n=t?this:N(e).parent().children();return m.call(n,e)},I.closest=function(t){var e=this.filter(t);if(e.length)return e;var n=this.parent();return n.length?n.closest(t):e},I.siblings=function(t){return Z(N(nt(tt(this,(function(t){return N(t).parent().children().not(t)})))),t)},I.find=function(t){return N(nt(tt(this,(function(e){return T(t,e)}))))};var it=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,ot=/^$|^module$|\/(java|ecma)script/i,at=["type","src","nonce","noModule"];function st(t,e,n,a,s,r,l,c){return j(t,(function(t,r){j(N(r),(function(t,r){j(N(e),(function(e,l){var c=n?l:r,u=n?t:e;!function(t,e,n,a,s){a?t.insertBefore(e,n?t.firstChild:null):"HTML"===t.nodeName?t.parentNode.replaceChild(e,t):t.parentNode.insertBefore(e,n?t:t.nextSibling),s&&function(t,e){var n=N(t);n.filter("script").add(n.find("script")).each((function(t,n){if(ot.test(n.type)&&i.contains(n)){var a=o("script");a.text=n.textContent.replace(it,""),j(at,(function(t,e){n[e]&&(a[e]=n[e])})),e.head.insertBefore(a,null),e.head.removeChild(a)}}))}(e,t.ownerDocument)}(n?r:l,u?c.cloneNode(!0):c,a,s,!u)}),c)}),l)}),r),e}I.after=function(){return st(arguments,this,!1,!1,!1,!0,!0)},I.append=function(){return st(arguments,this,!1,!1,!0)},I.html=function(t){if(!arguments.length)return this[0]&&this[0].innerHTML;if(k(t))return this;var e=/<script[\s>]/.test(t);return this.each((function(n,i){F(i)&&(e?N(i).empty().append(t):i.innerHTML=t)}))},I.appendTo=function(t){return st(arguments,this,!0,!1,!0)},I.wrapInner=function(t){return this.each((function(e,n){var i=N(n),o=i.contents();o.length?o.wrapAll(t):i.append(t)}))},I.before=function(){return st(arguments,this,!1,!0)},I.wrapAll=function(t){for(var e=N(t),n=e[0];n.children.length;)n=n.firstElementChild;return this.first().before(e),this.appendTo(n)},I.wrap=function(t){return this.each((function(e,n){var i=N(t)[0];N(n).wrapAll(e?i.cloneNode(!0):i)}))},I.insertAfter=function(t){return st(arguments,this,!0,!1,!1,!1,!1,!0)},I.insertBefore=function(t){return st(arguments,this,!0,!0)},I.prepend=function(){return st(arguments,this,!1,!0,!0,!0,!0)},I.prependTo=function(t){return st(arguments,this,!0,!0,!0,!1,!1,!0)},I.contents=function(){return N(nt(tt(this,(function(t){return"IFRAME"===t.tagName?[t.contentDocument]:"TEMPLATE"===t.tagName?t.content.childNodes:t.childNodes}))))},I.next=function(t,e,n){return Z(N(nt(tt(this,"nextElementSibling",e,n))),t)},I.nextAll=function(t){return this.next(t,!0)},I.nextUntil=function(t,e){return this.next(e,!0,t)},I.parents=function(t,e){return Z(N(nt(tt(this,"parentElement",!0,e))),t)},I.parentsUntil=function(t,e){return this.parents(e,t)},I.prev=function(t,e,n){return Z(N(nt(tt(this,"previousElementSibling",e,n))),t)},I.prevAll=function(t){return this.prev(t,!0)},I.prevUntil=function(t,e){return this.prev(e,!0,t)},I.map=function(t){return N(d.apply([],h.call(this,(function(e,n){return t.call(e,n,e)}))))},I.clone=function(){return this.map((function(t,e){return e.cloneNode(!0)}))},I.offsetParent=function(){return this.map((function(t,e){for(var n=e.offsetParent;n&&"static"===U(n,"position");)n=n.offsetParent;return n||i}))},I.slice=function(t,e){return N(v.call(this,t,e))};var rt=/-([a-z])/g;function lt(t){return t.replace(rt,(function(t,e){return e.toUpperCase()}))}I.ready=function(t){var n=function(){return setTimeout(t,0,N)};return"loading"!==e.readyState?n():e.addEventListener("DOMContentLoaded",n),this},I.unwrap=function(){return this.parent().each((function(t,e){if("BODY"!==e.tagName){var n=N(e);n.replaceWith(n.children())}})),this},I.offset=function(){var t=this[0];if(t){var e=t.getBoundingClientRect();return{top:e.top+n.pageYOffset,left:e.left+n.pageXOffset}}},I.position=function(){var t=this[0];if(t){var e="fixed"===U(t,"position"),n=e?t.getBoundingClientRect():this.offset();if(!e){for(var i=t.ownerDocument,o=t.offsetParent||i.documentElement;(o===i.body||o===i.documentElement)&&"static"===U(o,"position");)o=o.parentNode;if(o!==t&&F(o)){var a=N(o).offset();n.top-=a.top+$(o,"borderTopWidth"),n.left-=a.left+$(o,"borderLeftWidth")}}return{top:n.top-$(t,"marginTop"),left:n.left-$(t,"marginLeft")}}};var ct={class:"className",contenteditable:"contentEditable",for:"htmlFor",readonly:"readOnly",maxlength:"maxLength",tabindex:"tabIndex",colspan:"colSpan",rowspan:"rowSpan",usemap:"useMap"};I.prop=function(t,e){if(t){if(O(t))return t=ct[t]||t,arguments.length<2?this[0]&&this[0][t]:this.each((function(n,i){i[t]=e}));for(var n in t)this.prop(n,t[n]);return this}},I.removeProp=function(t){return this.each((function(e,n){delete n[ct[t]||t]}))};var ut=/^--/;function dt(t){return ut.test(t)}var pt={},mt=a.style,ht=["webkit","moz","ms"];function ft(t,e){if(void 0===e&&(e=dt(t)),e)return t;if(!pt[t]){var n=lt(t),i="".concat(n[0].toUpperCase()).concat(n.slice(1));j("".concat(n," ").concat(ht.join("".concat(i," "))).concat(i).split(" "),(function(e,n){if(n in mt)return pt[t]=n,!1}))}return pt[t]}var vt={animationIterationCount:!0,columnCount:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,gridArea:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnStart:!0,gridRow:!0,gridRowEnd:!0,gridRowStart:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0};function gt(t,e,n){return void 0===n&&(n=dt(t)),n||vt[t]||!L(e)?e:"".concat(e,"px")}function yt(t,e){try{return t(e)}catch(t){return e}}I.css=function(t,e){if(O(t)){var n=dt(t);return t=ft(t,n),arguments.length<2?this[0]&&U(this[0],t,n):t?(e=gt(t,e,n),this.each((function(i,o){F(o)&&(n?o.style.setProperty(t,e):o.style[t]=e)}))):this}for(var i in t)this.css(i,t[i]);return this};var bt=/^\s+|\s+$/;function wt(t,e){var n=t.dataset[e]||t.dataset[lt(e)];return bt.test(n)?n:yt(JSON.parse,n)}function Ct(t,e,n){n=yt(JSON.stringify,n),t.dataset[lt(e)]=n}function At(t,e){var n=t.documentElement;return Math.max(t.body["scroll".concat(e)],n["scroll".concat(e)],t.body["offset".concat(e)],n["offset".concat(e)],n["client".concat(e)])}I.data=function(t,e){if(!t){if(!this[0])return;var n={};for(var i in this[0].dataset)n[i]=wt(this[0],i);return n}if(O(t))return arguments.length<2?this[0]&&wt(this[0],t):k(e)?this:this.each((function(n,i){Ct(i,t,e)}));for(var i in t)this.data(i,t[i]);return this},j([!0,!1],(function(t,e){j(["Width","Height"],(function(t,n){var i="".concat(e?"outer":"inner").concat(n);I[i]=function(i){if(this[0])return E(this[0])?e?this[0]["inner".concat(n)]:this[0].document.documentElement["client".concat(n)]:S(this[0])?At(this[0],n):this[0]["".concat(e?"offset":"client").concat(n)]+(i&&e?$(this[0],"margin".concat(t?"Top":"Left"))+$(this[0],"margin".concat(t?"Bottom":"Right")):0)}}))})),j(["Width","Height"],(function(t,e){var n=e.toLowerCase();I[n]=function(i){if(!this[0])return k(i)?void 0:this;if(!arguments.length)return E(this[0])?this[0].document.documentElement["client".concat(e)]:S(this[0])?At(this[0],e):this[0].getBoundingClientRect()[n]-Y(this[0],!t);var o=parseInt(i,10);return this.each((function(e,i){if(F(i)){var a=U(i,"boxSizing");i.style[n]=gt(n,o+("border-box"===a?Y(i,!t):0))}}))}})),I.toggle=function(t){return this.each((function(n,i){if(F(i)){var a=q(i);(k(t)?a:t)?(i.style.display=i.___cd||"",q(i)&&(i.style.display=function(t){if(W[t])return W[t];var n=o(t);e.body.insertBefore(n,null);var i=U(n,"display");return e.body.removeChild(n),W[t]="none"!==i?i:"block"}(i.tagName))):a||(i.___cd=U(i,"display"),i.style.display="none")}}))},I.hide=function(){return this.toggle(!1)},I.show=function(){return this.toggle(!0)};var Tt={focus:"focusin",blur:"focusout"},xt={mouseenter:"mouseover",mouseleave:"mouseout"},It=/^(mouse|pointer|contextmenu|drag|drop|click|dblclick)/i;function Nt(t){return xt[t]||Tt[t]||t}function _t(t){var e=t.split(".");return[e[0],e.slice(1).sort()]}function Et(t){return t.___ce=t.___ce||{}}function St(t,e){return!e||!g.call(e,(function(e){return t.indexOf(e)<0}))}function Ft(t,e,n,i,o){var a=Et(t);if(e)a[e]&&(a[e]=a[e].filter((function(a){var s=a[0],r=a[1],l=a[2];if(o&&l.guid!==o.guid||!St(s,n)||i&&i!==r)return!0;t.removeEventListener(e,l)})));else for(e in a)Ft(t,e,n,i,o)}I.trigger=function(t,n){if(O(t)){var i=_t(t),o=i[0],a=i[1],s=Nt(o);if(!s)return this;var r=It.test(s)?"MouseEvents":"HTMLEvents";(t=e.createEvent(r)).initEvent(s,!0,!0),t.namespace=a.join("."),t.___ot=o}t.___td=n;var l=t.___ot in Tt;return this.each((function(e,n){l&&P(n[t.___ot])&&(n["___i".concat(t.type)]=!0,n[t.___ot](),n["___i".concat(t.type)]=!1),n.dispatchEvent(t)}))},I.off=function(t,e,n){var i=this;if(k(t))this.each((function(t,e){(F(e)||S(e)||E(e))&&Ft(e)}));else if(O(t))P(e)&&(n=e,e=""),j(H(t),(function(t,o){var a=_t(o),s=a[0],r=a[1],l=Nt(s);i.each((function(t,i){(F(i)||S(i)||E(i))&&Ft(i,l,r,e,n)}))}));else for(var o in t)this.off(o,t[o]);return this},I.remove=function(t){return Z(this,t).detach().off(),this},I.replaceWith=function(t){return this.before(t).remove()},I.replaceAll=function(t){return N(t).replaceWith(this),this},I.on=function(t,e,n,i,o){var a=this;if(!O(t)){for(var s in t)this.on(s,e,n,t[s],o);return this}return O(e)||(k(e)||V(e)?e="":k(n)?(n=e,e=""):(i=n,n=e,e="")),P(i)||(i=n,n=void 0),i?(j(H(t),(function(t,s){var r=_t(s),l=r[0],c=r[1],u=Nt(l),d=l in xt,p=l in Tt;u&&a.each((function(t,a){if(F(a)||S(a)||E(a)){var s=function(t){if(t.target["___i".concat(t.type)])return t.stopImmediatePropagation();if((!t.namespace||St(c,t.namespace.split(".")))&&(e||!(p&&(t.target!==a||t.___ot===u)||d&&t.relatedTarget&&a.contains(t.relatedTarget)))){var r=a;if(e){for(var l=t.target;!G(l,e);){if(l===a)return;if(!(l=l.parentNode))return}r=l}Object.defineProperty(t,"currentTarget",{configurable:!0,get:function(){return r}}),Object.defineProperty(t,"delegateTarget",{configurable:!0,get:function(){return a}}),Object.defineProperty(t,"data",{configurable:!0,get:function(){return n}});var m=i.call(r,t,t.___td);o&&Ft(a,u,c,e,s),!1===m&&(t.preventDefault(),t.stopPropagation())}};s.guid=i.guid=i.guid||N.guid++,function(t,e,n,i,o){var a=Et(t);a[e]=a[e]||[],a[e].push([n,i,o]),t.addEventListener(e,o)}(a,u,c,e,s)}}))})),this):this},I.one=function(t,e,n,i){return this.on(t,e,n,i,!0)};var Bt=/\r?\n/g,Pt=/file|reset|submit|button|image/i,Ot=/radio|checkbox/i;I.serialize=function(){var t="";return this.each((function(e,n){j(n.elements||[n],(function(e,n){if(!(n.disabled||!n.name||"FIELDSET"===n.tagName||Pt.test(n.type)||Ot.test(n.type)&&!n.checked)){var i=et(n);k(i)||j(c(i)?i:[i],(function(e,i){t+=function(t,e){return"&".concat(encodeURIComponent(t),"=").concat(encodeURIComponent(e.replace(Bt,"\r\n")))}(n.name,i)}))}}))})),t.slice(1)},t.exports=N}()},631:(t,e,n)=>{"use strict";n.d(e,{Z:()=>r});var i=n(537),o=n.n(i),a=n(645),s=n.n(a)()(o());s.push([t.id,".grok-hit-triage-view .d4-grid {\n width: initial !important;\n height: initial !important;\n}\n\n.hit-triage-compute-dialog-pane-header {\n display: flex;\n align-items: center;\n justify-content: end;\n}\n\n.hit-triage-compute-dialog-host>.d4-tab-host.d4-tab-vertical>.d4-tab-header-stripe>.d4-tab-header.hit-triage-compute-dialog-pane-header {\n border: none;\n border-left: 4px solid transparent;\n border-radius: 1px;\n padding: 4px 8px;\n min-height: 28px;\n justify-content: flex-end;\n flex-direction: row-reverse;\n}\n\n.hit-triage-compute-dialog-host>.d4-tab-host.d4-tab-vertical>.d4-tab-header-stripe>.d4-tab-header.hit-triage-compute-dialog-pane-header.selected {\n border-left: 4px solid var(--blue-1);\n background-color: #f2f2f5;\n}\n\n.hit-triage-compute-dialog-host>.d4-tab-host.d4-tab-vertical>.d4-tab-header-stripe>.d4-tab-header.hit-triage-compute-dialog-pane-header>span {\n padding: 0 4px;\n}\n\ntable.hit-triage-table {\n margin: 10px;\n width: calc(100% - 20px);\n}\n\n.hit-triage-table-container {\n max-width: 600px;\n max-height: 500px;\n overflow-y: scroll;\n}\n\n.hit-triage-error-div {\n color: red;\n text-align: start;\n}\n\n.mx-5 {\n margin-left: 5px;\n margin-right: 5px;\n}\n\n.hit-triage-new-template-functions-input > .ui-box {\n height: 300px;\n}\n\n.hit-triage-new-template-functions-input {\n max-height: 200px;\n max-width: unset !important;\n overflow-y: scroll;\n}\n\n\n.hit-triage-new-template-functions-input > .d4-tab-host {\n width: 100% !important;\n}\n\n.hit-triage-compute-dialog-host {\n max-height: 550px;\n max-width: 500px;\n}\n\n.hit-triage-compute-dialog-descriptors-group {\n margin-left: 16px;\n}\n\n.oy-scroll {\n overflow-y: scroll;\n}\n\n.d4-ribbon-name .ui-breadcrumbs {\n\toverflow: hidden;\n white-space: nowrap;\n text-overflow: ellipsis;\n\tflex-wrap: nowrap;\n padding: 0;\n}\n\n.d4-ribbon-name .ui-breadcrumbs i {\n\tpadding: 0 6px;\n\tfont-size: 10px;\n\tfont-weight: bold;\n}\n\n.d4-ribbon-name .ui-breadcrumbs-element:first-child {\n\twhite-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}","",{version:3,sources:["webpack://./css/hit-triage.css"],names:[],mappings:"AAAA;IACI,yBAAyB;IACzB,0BAA0B;AAC9B;;AAEA;IACI,aAAa;IACb,mBAAmB;IACnB,oBAAoB;AACxB;;AAEA;IACI,YAAY;IACZ,kCAAkC;IAClC,kBAAkB;IAClB,gBAAgB;IAChB,gBAAgB;IAChB,yBAAyB;IACzB,2BAA2B;AAC/B;;AAEA;IACI,oCAAoC;IACpC,yBAAyB;AAC7B;;AAEA;IACI,cAAc;AAClB;;AAEA;IACI,YAAY;IACZ,wBAAwB;AAC5B;;AAEA;IACI,gBAAgB;IAChB,iBAAiB;IACjB,kBAAkB;AACtB;;AAEA;IACI,UAAU;IACV,iBAAiB;AACrB;;AAEA;IACI,gBAAgB;IAChB,iBAAiB;AACrB;;AAEA;IACI,aAAa;AACjB;;AAEA;IACI,iBAAiB;IACjB,2BAA2B;IAC3B,kBAAkB;AACtB;;;AAGA;IACI,sBAAsB;AAC1B;;AAEA;IACI,iBAAiB;IACjB,gBAAgB;AACpB;;AAEA;IACI,iBAAiB;AACrB;;AAEA;IACI,kBAAkB;AACtB;;AAEA;CACC,gBAAgB;IACb,mBAAmB;IACnB,uBAAuB;CAC1B,iBAAiB;IACd,UAAU;AACd;;AAEA;CACC,cAAc;CACd,eAAe;CACf,iBAAiB;AAClB;;AAEA;CACC,mBAAmB;IAChB,gBAAgB;IAChB,uBAAuB;AAC3B",sourcesContent:[".grok-hit-triage-view .d4-grid {\n width: initial !important;\n height: initial !important;\n}\n\n.hit-triage-compute-dialog-pane-header {\n display: flex;\n align-items: center;\n justify-content: end;\n}\n\n.hit-triage-compute-dialog-host>.d4-tab-host.d4-tab-vertical>.d4-tab-header-stripe>.d4-tab-header.hit-triage-compute-dialog-pane-header {\n border: none;\n border-left: 4px solid transparent;\n border-radius: 1px;\n padding: 4px 8px;\n min-height: 28px;\n justify-content: flex-end;\n flex-direction: row-reverse;\n}\n\n.hit-triage-compute-dialog-host>.d4-tab-host.d4-tab-vertical>.d4-tab-header-stripe>.d4-tab-header.hit-triage-compute-dialog-pane-header.selected {\n border-left: 4px solid var(--blue-1);\n background-color: #f2f2f5;\n}\n\n.hit-triage-compute-dialog-host>.d4-tab-host.d4-tab-vertical>.d4-tab-header-stripe>.d4-tab-header.hit-triage-compute-dialog-pane-header>span {\n padding: 0 4px;\n}\n\ntable.hit-triage-table {\n margin: 10px;\n width: calc(100% - 20px);\n}\n\n.hit-triage-table-container {\n max-width: 600px;\n max-height: 500px;\n overflow-y: scroll;\n}\n\n.hit-triage-error-div {\n color: red;\n text-align: start;\n}\n\n.mx-5 {\n margin-left: 5px;\n margin-right: 5px;\n}\n\n.hit-triage-new-template-functions-input > .ui-box {\n height: 300px;\n}\n\n.hit-triage-new-template-functions-input {\n max-height: 200px;\n max-width: unset !important;\n overflow-y: scroll;\n}\n\n\n.hit-triage-new-template-functions-input > .d4-tab-host {\n width: 100% !important;\n}\n\n.hit-triage-compute-dialog-host {\n max-height: 550px;\n max-width: 500px;\n}\n\n.hit-triage-compute-dialog-descriptors-group {\n margin-left: 16px;\n}\n\n.oy-scroll {\n overflow-y: scroll;\n}\n\n.d4-ribbon-name .ui-breadcrumbs {\n\toverflow: hidden;\n white-space: nowrap;\n text-overflow: ellipsis;\n\tflex-wrap: nowrap;\n padding: 0;\n}\n\n.d4-ribbon-name .ui-breadcrumbs i {\n\tpadding: 0 6px;\n\tfont-size: 10px;\n\tfont-weight: bold;\n}\n\n.d4-ribbon-name .ui-breadcrumbs-element:first-child {\n\twhite-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}"],sourceRoot:""}]);const r=s},290:(t,e,n)=>{"use strict";n.d(e,{Z:()=>r});var i=n(537),o=n.n(i),a=n(645),s=n.n(a)()(o());s.push([t.id,".ui-app-header {\n\n}\n\n.ui-app-header-icon {\n width: 150px;\n height: 150px;\n margin-right: 20px;\n}\n\n.u2-panel {\n gap: 10px;\n}","",{version:3,sources:["webpack://./node_modules/@datagrok-libraries/utils/src/u2.css"],names:[],mappings:"AAAA;;AAEA;;AAEA;IACI,YAAY;IACZ,aAAa;IACb,kBAAkB;AACtB;;AAEA;IACI,SAAS;AACb",sourcesContent:[".ui-app-header {\n\n}\n\n.ui-app-header-icon {\n width: 150px;\n height: 150px;\n margin-right: 20px;\n}\n\n.u2-panel {\n gap: 10px;\n}"],sourceRoot:""}]);const r=s},143:(t,e,n)=>{"use strict";n.d(e,{Z:()=>r});var i=n(537),o=n.n(i),a=n(645),s=n.n(a)()(o());s.push([t.id,"img[alt='hitDesignReadmeImg'] {\n max-width: 100%;\n}","",{version:3,sources:["webpack://./src/app/hit-design-views/utils.css"],names:[],mappings:"AAAA;IACI,eAAe;AACnB",sourcesContent:["img[alt='hitDesignReadmeImg'] {\n max-width: 100%;\n}"],sourceRoot:""}]);const r=s},645:t=>{"use strict";t.exports=function(t){var e=[];return e.toString=function(){return this.map((function(e){var n="",i=void 0!==e[5];return e[4]&&(n+="@supports (".concat(e[4],") {")),e[2]&&(n+="@media ".concat(e[2]," {")),i&&(n+="@layer".concat(e[5].length>0?" ".concat(e[5]):""," {")),n+=t(e),i&&(n+="}"),e[2]&&(n+="}"),e[4]&&(n+="}"),n})).join("")},e.i=function(t,n,i,o,a){"string"==typeof t&&(t=[[null,t,void 0]]);var s={};if(i)for(var r=0;r<this.length;r++){var l=this[r][0];null!=l&&(s[l]=!0)}for(var c=0;c<t.length;c++){var u=[].concat(t[c]);i&&s[u[0]]||(void 0!==a&&(void 0===u[5]||(u[1]="@layer".concat(u[5].length>0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=a),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),o&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=o):u[4]="".concat(o)),e.push(u))}},e}},537:t=>{"use strict";t.exports=function(t){var e=t[1],n=t[3];if(!n)return e;if("function"==typeof btoa){var i=btoa(unescape(encodeURIComponent(JSON.stringify(n)))),o="sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(i),a="/*# ".concat(o," */");return[e].concat([a]).join("\n")}return[e].join("\n")}},379:t=>{"use strict";var e=[];function n(t){for(var n=-1,i=0;i<e.length;i++)if(e[i].identifier===t){n=i;break}return n}function i(t,i){for(var a={},s=[],r=0;r<t.length;r++){var l=t[r],c=i.base?l[0]+i.base:l[0],u=a[c]||0,d="".concat(c," ").concat(u);a[c]=u+1;var p=n(d),m={css:l[1],media:l[2],sourceMap:l[3],supports:l[4],layer:l[5]};if(-1!==p)e[p].references++,e[p].updater(m);else{var h=o(m,i);i.byIndex=r,e.splice(r,0,{identifier:d,updater:h,references:1})}s.push(d)}return s}function o(t,e){var n=e.domAPI(e);return n.update(t),function(e){if(e){if(e.css===t.css&&e.media===t.media&&e.sourceMap===t.sourceMap&&e.supports===t.supports&&e.layer===t.layer)return;n.update(t=e)}else n.remove()}}t.exports=function(t,o){var a=i(t=t||[],o=o||{});return function(t){t=t||[];for(var s=0;s<a.length;s++){var r=n(a[s]);e[r].references--}for(var l=i(t,o),c=0;c<a.length;c++){var u=n(a[c]);0===e[u].references&&(e[u].updater(),e.splice(u,1))}a=l}}},569:t=>{"use strict";var e={};t.exports=function(t,n){var i=function(t){if(void 0===e[t]){var n=document.querySelector(t);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(t){n=null}e[t]=n}return e[t]}(t);if(!i)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");i.appendChild(n)}},216:t=>{"use strict";t.exports=function(t){var e=document.createElement("style");return t.setAttributes(e,t.attributes),t.insert(e,t.options),e}},565:(t,e,n)=>{"use strict";t.exports=function(t){var e=n.nc;e&&t.setAttribute("nonce",e)}},795:t=>{"use strict";t.exports=function(t){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var e=t.insertStyleElement(t);return{update:function(n){!function(t,e,n){var i="";n.supports&&(i+="@supports (".concat(n.supports,") {")),n.media&&(i+="@media ".concat(n.media," {"));var o=void 0!==n.layer;o&&(i+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),i+=n.css,o&&(i+="}"),n.media&&(i+="}"),n.supports&&(i+="}");var a=n.sourceMap;a&&"undefined"!=typeof btoa&&(i+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(a))))," */")),e.styleTagTransform(i,t,e.options)}(e,t,n)},remove:function(){!function(t){if(null===t.parentNode)return!1;t.parentNode.removeChild(t)}(e)}}}},589:t=>{"use strict";t.exports=function(t,e){if(e.styleSheet)e.styleSheet.cssText=t;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(t))}}}},e={};function n(i){var o=e[i];if(void 0!==o)return o.exports;var a=e[i]={id:i,exports:{}};return t[i](a,a.exports,n),a.exports}n.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return n.d(e,{a:e}),e},n.d=(t,e)=>{for(var i in e)n.o(e,i)&&!n.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),n.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.nc=void 0;var i={};(()=>{"use strict";n.r(i),n.d(i,{_package:()=>It,demoFileIngest:()=>Et,demoFileIngest1:()=>St,demoFileIngest2:()=>Ft,demoFileSubmit:()=>Bt,gasteigerCellRenderer:()=>Pt,hitDesignApp:()=>_t,hitTriageApp:()=>Nt});const t=grok,e=DG,o=ui,a="campaignId",s="campaignId",r="HitTriageFunction",l="HitTriageDataSource",c="HitTriageSubmitFunction",u="Selected hits",d="Stage",p="Molecule",m="V-iD",h="V######",f="HTScript",v="Source",g="New template",y="Start",b="Create",w="Download",C="Cancel",A="Continue a campaign",T="New campaign";var x=n(379),I=n.n(x),N=n(795),_=n.n(N),E=n(569),S=n.n(E),F=n(565),B=n.n(F),P=n(216),O=n.n(P),k=n(589),V=n.n(k),L=n(631),D={};D.styleTagTransform=V(),D.setAttributes=B(),D.insert=S().bind(null,"head"),D.domAPI=_(),D.insertStyleElement=O(),I()(L.Z,D),L.Z&&L.Z.locals&&L.Z.locals;const j=t=>`${t.getFullYear()}/${t.getMonth()+1}/${t.getDate()}`;function R(t,e){const n=document.title,i=window.location.href.split("?")[0]+"?"+t+"="+e;if(history.replaceState){const t={Title:n,Url:i};history.replaceState(t,t.Title,t.Url)}}function M(e,n,i,a){var s;const r=o.breadcrumbs([n,i]),l=r.onPathClick.subscribe((t=>{1===t.length&&(l.unsubscribe(),H(e),a())})),c=null===(s=t.shell.v.ribbonMenu.root.parentElement)||void 0===s?void 0:s.getElementsByClassName("d4-ribbon-name")[0];return c&&(c.textContent="",c.appendChild(r.root)),{breadcrumbs:r,sub:l}}function H(t){const e=t.getRibbonPanels();(null==e?void 0:e.length)&&(e.pop(),t.setRibbonPanels(e))}function U(t){return t.reduce(((t,e)=>t||e.reduce(((t,e)=>t||e.classList.contains("hit-design-submit-button")||Array.from(e.children).some((t=>t.classList.contains("hit-design-submit-button")))),!1)),!1)}const $={String:e.TYPE.STRING,Number:e.TYPE.FLOAT,Boolean:e.TYPE.BOOL,Date:e.TYPE.DATE_TIME,Molecule:e.SEMTYPE.MOLECULE};var Y=function(t,e,n,i){return new(n||(n=Promise))((function(o,a){function s(t){try{l(i.next(t))}catch(t){a(t)}}function r(t){try{l(i.throw(t))}catch(t){a(t)}}function l(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,r)}l((i=i.apply(t,e||[])).next())}))},W=n(553),q=n.n(W);function G(n,i,a,s){var l,c,u,d,p,m,h,v,g,y,b,w,C,A,T,x,I,N,_,E,S,F,B,P,O;return F=this,B=void 0,O=function*(){const F=e.Func.find({tags:[r]}).filter((({inputs:t})=>t.length>2&&"dataframe"===t[0].propertyType&&"column"===t[1].propertyType)).map((t=>{var e,n,i,o;return{package:t.package.name,name:t.name,args:null!==(o=null===(i=null===(n=null===(e=null==a?void 0:a.compute)||void 0===e?void 0:e.functions)||void 0===n?void 0:n.find((e=>e.name===t.name&&e.package===t.package.name)))||void 0===i?void 0:i.args)&&void 0!==o?o:{}}})),B=(yield t.dapi.scripts.include("params").filter("#HitTriageFunction").list()).filter((({inputs:t})=>t.length>2&&"dataframe"===t[0].propertyType&&"column"===t[1].propertyType)).map((t=>{var e,n,i,o;return{name:t.name,id:t.id,args:null!==(o=null===(i=null===(n=null===(e=null==a?void 0:a.compute)||void 0===e?void 0:e.scripts)||void 0===n?void 0:n.find((e=>e.id===t.id)))||void 0===i?void 0:i.args)&&void 0!==o?o:{}}})),P=!!(null===(c=null===(l=null==a?void 0:a.compute)||void 0===l?void 0:l.descriptors)||void 0===c?void 0:c.enabled)||s,O=yield t.chem.descriptorsTree(),k=o.tree();k.root.classList.add("hit-triage-compute-dialog-descriptors-group");const V=o.div([],{classes:"hit-triage-compute-dialog-host"}),L=[];function D(t,e){const n=e.group(t,null,!1);return n.enableCheckBox(!1),n}const j=Object.keys(O),R=null!==(p=null===(d=null===(u=null==a?void 0:a.compute)||void 0===u?void 0:u.descriptors)||void 0===d?void 0:d.args)&&void 0!==p?p:[];for(const t of j){const e=D(t,k);for(const n of O[t].descriptors){const t=e.item(n.name,n);L.push(t),t.enableCheckBox(R.includes(n.name))}}const M="Descriptors",H={[M]:M},U=P?{[M]:k.root}:{},$={},Y={[M]:!1};Y.Descriptors=!!(null===(h=null===(m=null==a?void 0:a.compute)||void 0===m?void 0:m.descriptors)||void 0===h?void 0:h.enabled)&&(null===(y=null===(g=null===(v=null==a?void 0:a.compute)||void 0===v?void 0:v.descriptors)||void 0===g?void 0:g.args)||void 0===y?void 0:y.length)>0;for(const t of F){const n=e.Func.find({package:t.package,name:t.name})[0],i=n.prepare(t.args),s=`${t.package}:${t.name}`;$[s]=i;const r=o.div(),l=yield i.buildEditor(r,{condensed:!1});r.classList.add("oy-scroll"),r.style.marginLeft="15px",U[null!==(b=n.friendlyName)&&void 0!==b?b:n.name]=r,H[null!==(w=n.friendlyName)&&void 0!==w?w:n.name]=s,Y[s]=null!==(T=null===(A=null===(C=null==a?void 0:a.compute)||void 0===C?void 0:C.functions)||void 0===A?void 0:A.some((e=>e.name===t.name&&e.package===t.package)))&&void 0!==T&&T,r.children[0].style.display="none",r.children[1].style.display="none",l.forEach((e=>{var n,i;(null===(n=e.property)||void 0===n?void 0:n.name)&&Object.keys(t.args).includes(null===(i=e.property)||void 0===i?void 0:i.name)&&(e.value=t.args[e.property.name]),e.fireChanged()}))}for(const e of B)try{const n=yield t.dapi.scripts.find(e.id),i=n.prepare(e.args),s=`HTScript:${null!==(x=e.name)&&void 0!==x?x:""}:${e.id}`;$[s]=i;const r=o.div(),l=yield i.buildEditor(r,{condensed:!1});r.classList.add("oy-scroll"),r.style.marginLeft="15px",U[null!==(I=n.friendlyName)&&void 0!==I?I:n.name]=r,H[null!==(N=n.friendlyName)&&void 0!==N?N:n.name]=s,Y[s]=null!==(S=null===(E=null===(_=null==a?void 0:a.compute)||void 0===_?void 0:_.scripts)||void 0===E?void 0:E.some((t=>t.id===e.id)))&&void 0!==S&&S,r.children[0].style.display="none",r.children[1].style.display="none",l.forEach((t=>{var n,i;(null===(n=t.property)||void 0===n?void 0:n.name)&&Object.keys(e.args).includes(null===(i=t.property)||void 0===i?void 0:i.name)&&(t.value=e.args[t.property.name]),t.fireChanged()}))}catch(t){console.error(t);continue}const W=o.tabControl(U,!0);function G(){const t={descriptors:[],externals:{},scripts:{}};t.descriptors=Y.Descriptors?L.filter((t=>t.checked)).map((t=>t.value.name)):[];const e=Object.entries($).filter((([t,e])=>Y[t]));e.filter((([t,e])=>!t.startsWith(f))).forEach((([e,n])=>{t.externals[e]={};const i=n.inputs;Object.entries(i).slice(2).forEach((([n,i])=>{t.externals[e][n]=i}))})),e.filter((([t,e])=>t.startsWith(f))).forEach((([e,n])=>{t.scripts[e]={};const i=n.inputs;Object.entries(i).slice(2).forEach((([n,i])=>{t.scripts[e][n]=i}))})),console.log(t),n(t)}return V.appendChild(W.root),W.panes.forEach((t=>{const e=o.boolInput("",Y[H[t.name]],(n=>{Y[H[t.name]]=!!e.value,n?q()(t.content).find("input").removeAttr("disabled"):q()(t.content).find("input").attr("disabled","true")}));e.setTooltip("Toggle calculation of this function"),t.header.appendChild(e.root),t.header.classList.add("hit-triage-compute-dialog-pane-header")})),s&&o.dialog("Compute").add(V).onOK((()=>G())).onCancel(i).show(),{root:V,okProxy:G}},new((P=void 0)||(P=Promise))((function(t,e){function n(t){try{o(O.next(t))}catch(t){e(t)}}function i(t){try{o(O.throw(t))}catch(t){e(t)}}function o(e){var o;e.done?t(e.value):(o=e.value,o instanceof P?o:new P((function(t){t(o)}))).then(n,i)}o((O=O.apply(F,B||[])).next())}))}const J=rxjs;class Z{constructor(t,e=[],n={}){this.onItemChanged=new J.Subject,this.onAddingItemChanged=new J.Subject,this.onItemAdded=new J.Subject,this.onItemRemoved=new J.Subject,this.options={removeButtonTooltip:"Remove item",addButtonTooltip:"Add item",allowAdd:!0,allowRemove:!0},this.properties=t,this.options=Object.assign(Object.assign({},this.options),n),this._root=o.divV([],{style:{display:"grid",gridTemplateColumns:`repeat(${this.properties.length}, 1fr)`,alignItems:"center",gap:"12px"},classes:"ui-items-grid"}),this._items=e,this.render()}get root(){return this._root}get items(){return this._items}render(){var t,e,n,i;if(o.empty(this._root),!this.options.horizontalInputNames)for(const e of this.properties){const n=o.divText(null!==(t=e.caption)&&void 0!==t?t:e.name);n.style.fontWeight="bold",this._root.appendChild(n)}for(const t of this._items){const e=this.getItemDiv(t);for(const t of e)this._root.appendChild(t)}if(this.options.allowAdd){const t=this.getItemDiv(null!==(i=null===(n=(e=this.options).newItemFunction)||void 0===n?void 0:n.call(e))&&void 0!==i?i:void 0,!0);for(const e of t)this._root.appendChild(e)}}getItemDiv(t={},n){var i;const a=[],s={};let r=null;for(const l of this.properties){void 0===t[l.name]&&(t[l.name]=null);const c=(null===(i=this.options.customInputs)||void 0===i?void 0:i[l.name])?this.options.customInputs[l.name](t):o.input.forProperty(l,t);a.push(this.options.horizontalInputNames?c.root:this.hideLabel(c.root)),l.propertyType!==e.TYPE.BOOL&&"color"!==l.name.toLowerCase()&&c.input&&(c.input.style.width="100%"),s[l.name]=c,c.onChanged((()=>{t[l.name]=c.value,n?this.onAddingItemChanged.next({item:t,fieldName:l.name}):this.onItemChanged.next({item:t,fieldName:l.name})})),c.root.style.alignItems="center",r=c}let l=null;if(n)l=o.icons.add((()=>{const t=this.options.newItemFunction?this.options.newItemFunction():{};Object.keys(s).forEach((e=>{t[e]=s[e].value})),this._items.push(t),this.onItemAdded.next(t),this.render()}),this.options.addButtonTooltip);else{if(!this.options.allowRemove)return a;l=o.icons.delete((()=>{this._items.splice(this._items.indexOf(t),1),this.onItemRemoved.next(t),this.render()}),this.options.removeButtonTooltip)}return r&&r.addOptions?r.addOptions(l):null==r||r.root.appendChild(l),l.style.color="#2083d5",a}hideLabel(t){return t.getElementsByTagName("label")[0]&&t.removeChild(t.getElementsByTagName("label")[0]),t}}var z=function(t,e,n,i){return new(n||(n=Promise))((function(o,a){function s(t){try{l(i.next(t))}catch(t){a(t)}}function r(t){try{l(i.throw(t))}catch(t){a(t)}}function l(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,r)}l((i=i.apply(t,e||[])).next())}))};function K(){var n,i;return z(this,void 0,void 0,(function*(){const a=e.Func.find({tags:[r]}),s=(yield It.files.list("Hit Triage/templates")).map((t=>t.name.slice(0,-5))),u=[];for(const t of s){const e=JSON.parse(yield It.files.readAsText(`Hit Triage/templates/${t}.json`));u.push(e.key)}const d=e.Func.find({tags:[c]}),p={};d.forEach((t=>{var e;p[null!==(e=t.friendlyName)&&void 0!==e?e:t.name]=t}));const m=o.choiceInput("Submit function",null,[null,...Object.keys(p)]);m.value=null,m.nullable=!0,m.setTooltip("Select function to be called upon submitting");const h=o.divText("Template name is empty or already exists",{classes:"hit-triage-error-div"}),g=o.divText("Template key is empty or already exists",{classes:"hit-triage-error-div"}),y=o.stringInput("Name","",(()=>{""===y.value||s.includes(y.value)?(y.root.style.borderBottom="1px solid red",h.style.opacity="100%"):(y.root.style.borderBottom="none",h.style.opacity="0%")})),w=o.stringInput("Key","",(()=>{""===w.value||u.includes(w.value)?(w.root.style.borderBottom="1px solid red",g.style.opacity="100%"):(w.root.style.borderBottom="none",g.style.opacity="0%")}));w.setTooltip("Template key used for campaign prefix"),y.setTooltip("Template name"),y.root.style.borderBottom="none",w.root.style.borderBottom="none",h.style.opacity="0%",g.style.opacity="0%";const A={Descriptors:"Descriptors"};a.forEach((t=>{var e;A[null!==(e=t.friendlyName)&&void 0!==e?e:t.name]=`${t.package.name}:${t.name}`}));let T=null;const x=yield G((t=>{T=t}),(()=>null),{compute:{descriptors:{enabled:!0,args:[]},functions:[]}},!1);x.root.classList.add("hit-triage-new-template-functions-input");const I=e.Func.find({tags:[l]}),N={};I.forEach((t=>{var e;N[null!==(e=t.friendlyName)&&void 0!==e?e:t.name]=t}));const _=o.choiceInput(v,Object.keys(N)[0],Object.keys(N)),E=o.choiceInput("Ingest using","Query",["Query","File"],(()=>{"Query"!==E.value?_.root.style.display="none":_.root.style.display="block"})),S=Q(),F=o.div([o.h2("Details"),o.div([y,h]),o.div([w,g]),E.root,_.root,S.fieldsDiv,o.h2("Compute"),x.root,o.h2("Submit"),m.root],"ui-form"),B=o.buttonsInput([]),P=null!==(i=null===(n=B.getElementsByClassName("ui-input-editor"))||void 0===n?void 0:n[0])&&void 0!==i?i:B;F.appendChild(B);const O=new Promise((t=>{const e=o.button(C,(()=>t()));P.appendChild(e)})),k=new Promise((e=>{const n=o.bigButton(b,(()=>function(){var n,i,o,a,s,r;return z(this,void 0,void 0,(function*(){if(x.okProxy(),"100%"===h.style.opacity)return void t.shell.error("Template name is empty or already exists");const l=m.value?p[m.value]:void 0,c=Object.assign(Object.assign({name:y.value,key:w.value,campaignFields:S.getFields(),dataSourceType:null!==(n=E.value)&&void 0!==n?n:"Query",compute:{descriptors:{enabled:!!(null===(i=null==T?void 0:T.descriptors)||void 0===i?void 0:i.length),args:null!==(o=null==T?void 0:T.descriptors)&&void 0!==o?o:[]},functions:Object.entries(null!==(a=null==T?void 0:T.externals)&&void 0!==a?a:{}).map((([t,e])=>{const n=t.split(":");return{name:n[1],package:n[0],args:e}})),scripts:Object.entries(null!==(s=null==T?void 0:T.scripts)&&void 0!==s?s:{}).filter((([t,e])=>t.startsWith(f)&&3===t.split(":").length)).map((([t,e])=>{var n,i;const o=t.split(":");return{name:null!==(n=o[1])&&void 0!==n?n:"",id:null!==(i=o[2])&&void 0!==i?i:"",args:e}}))}},l?{submit:{fName:l.name,package:l.package.name}}:{}),{queryFunctionName:"Query"===E.value&&null!==(r=_.value)&&void 0!==r?r:void 0});var u;u=c,It.files.writeAsText(`Hit Triage/templates/${u.name}.json`,JSON.stringify(u)),t.shell.info("Template created successfully"),e(c)}))}()));P.appendChild(n)}));return{root:F,template:k,cancelPromise:O}}))}function Q(t){const n=[e.Property.fromOptions({name:"Name",type:e.TYPE.STRING}),e.Property.fromOptions({name:"Type",type:e.TYPE.STRING,choices:Object.keys($)}),e.Property.fromOptions({name:"Required",type:e.TYPE.BOOL})],i=new Z(n,t?t.map((t=>({Name:t.name,Type:t.type,Required:t.required}))):void 0,{horizontalInputNames:!1});i.root.style.maxWidth="750px";let a={};i.onItemAdded.subscribe((t=>{a=null!=t?t:{}})),i.onAddingItemChanged.subscribe((t=>{t&&(a=t.item)}));const s=o.h2("Additional fields");o.tooltip.bind(s,"Additional fields to be filled by user for each campaign");const r=o.div([s,i.root]);return{getFields:function(){var t;const e=i.items.filter((t=>t.Name)).map((t=>{var e;return{name:t.Name,type:t.Type,required:null!==(e=t.Required)&&void 0!==e&&e}}));return a.Name&&""!==a.Name&&a.Type&&(null!==(t=a.Required)&&void 0!==t||(a.Required=!1),e.push({name:a.Name,type:a.Type,required:a.Required})),e},fieldsDiv:o.div([r])}}var X=function(t,e,n,i){return new(n||(n=Promise))((function(o,a){function s(t){try{l(i.next(t))}catch(t){a(t)}}function r(t){try{l(i.throw(t))}catch(t){a(t)}}function l(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,r)}l((i=i.apply(t,e||[])).next())}))};class tt extends e.ViewBase{constructor(t){super(),this.app=t}get template(){return this.app.template}onActivated(){}onReset(){}process(){return X(this,void 0,void 0,(function*(){}))}deleteCampaign(t,e){return X(this,void 0,void 0,(function*(){yield It.files.delete(`${t}/campaigns/${e}`)}))}}var et=function(t,e,n,i){return new(n||(n=Promise))((function(o,a){function s(t){try{l(i.next(t))}catch(t){a(t)}}function r(t){try{l(i.throw(t))}catch(t){a(t)}}function l(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,r)}l((i=i.apply(t,e||[])).next())}))};class nt extends tt{constructor(e){super(e),this.readmePath=It.webRoot+"README_HT.md",this.deletedCampaigns=[],this.name="Hit Triage",t.shell.windows.showHelp=!0,t.shell.windows.help.showHelp(this.readmePath),this.checkCampaign().then((t=>{this.app.campaign=t,this.init()}))}onActivated(){t.shell.windows.showHelp=!0,t.shell.windows.help.showHelp(this.readmePath)}init(t){return et(this,void 0,void 0,(function*(){const e=o.h1(A),n=o.h1(T,{style:{marginLeft:"10px"}}),i=o.div([o.h1("Process, analyse and filter molecules for your needs using Hit Triage:"),o.div(o.markdown("- Configure your own workflow using the template editor.\n- Calculate different molecular properties.\n- Filter molecules using different criteria.\n- Submit processed dataframe to the function of your choice.\n- Save campaigns and continue any time from where you left off.\n "),{style:{color:"var(--grey-5)"},classes:"mb-small"}),o.link("Read more","https://github.com/datagrok-ai/public/tree/master/packages/HitTriage")]),a=o.div(),s=o.div([],{classes:"ui-form"}),r=yield this.getCampaignsTable();q()(this.root).empty(),this.root.appendChild(o.div([i,e,r,n,s,a])),this.startNewCampaign(a,s,t).then((()=>this.app.resetBaseUrl()))}))}startNewCampaign(t,e,n){var i;return et(this,void 0,void 0,(function*(){const a=(yield It.files.list("Hit Triage/templates")).map((t=>t.name.slice(0,-5)));n&&!a.includes(n.name)&&a.push(n.name);const s=()=>et(this,void 0,void 0,(function*(){const e=r.value,i=n&&n.name===e?n:JSON.parse(yield It.files.readAsText("Hit Triage/templates/"+e+".json")),o=yield this.getNewCampaignAccordeon(i);q()(t).empty(),t.className="ui-form",t.appendChild(o)})),r=o.choiceInput("Template",null!==(i=null==n?void 0:n.name)&&void 0!==i?i:a[0],a,(()=>et(this,void 0,void 0,(function*(){yield s()})))),l=o.icons.add((()=>{this.createNewTemplate()}),g);r.addOptions(l),yield s(),q()(e).empty(),e.appendChild(r.root)}))}checkCampaign(t){return et(this,void 0,void 0,(function*(){const e=location.search,n=new URLSearchParams(e);if(!n.has(a)&&!t)return;const i=null!=t?t:n.get(a);if(!(yield It.files.exists(`Hit Triage/campaigns/${i}/campaign.json`)))return;const o=JSON.parse(yield It.files.readAsText(`Hit Triage/campaigns/${i}/campaign.json`)),s=JSON.parse(yield It.files.readAsText(`Hit Triage/templates/${o.templateName}.json`));return this.app.setTemplate(s,o.filters,i,o.ingest),t&&R(a,t),o}))}getCampaignsTable(){return et(this,void 0,void 0,(function*(){const t=(yield It.files.list("Hit Triage/campaigns")).filter((t=>-1===this.deletedCampaigns.indexOf(t.name))),e={};for(const n of t){const t=JSON.parse(yield It.files.readAsText(`Hit Triage/campaigns/${n.name}/campaign.json`));e[t.name]=t}const n=Object.values(e).map((t=>({name:t.name,createDate:t.createDate,rowCount:t.rowCount,filtered:t.filteredRowCount,status:t.status}))),i=o.table(n,(t=>[o.link(t.name,(()=>this.setCampaign(t.name)),"",""),t.createDate,t.rowCount,t.filtered,t.status,o.icons.delete((()=>et(this,void 0,void 0,(function*(){o.dialog("Delete campaign").add(o.divText(`Are you sure you want to delete campaign ${t.name}?`)).onOK((()=>et(this,void 0,void 0,(function*(){yield this.deleteCampaign("Hit Triage",t.name),this.deletedCampaigns.push(t.name),yield this.init()})))).show()}))),"Delete campaign")]),["Name","Created","Total","Selected","Status",""]);return i.style.color="var(--grey-5)",i}))}setCampaign(t){return et(this,void 0,void 0,(function*(){const e=yield this.checkCampaign(t);this.app.campaign=e}))}getNewCampaignAccordeon(n){return et(this,void 0,void 0,(function*(){const{root:i,promise:a,cancelPromise:s}=function(n){var i,a;const s=o.divText("",{style:{color:"red"}});let r=null;const c=()=>Y(this,void 0,void 0,(function*(){try{if(r=u.value,!r)return;if(yield r.meta.detectSemanticTypes(),!r.columns.bySemType(e.SEMTYPE.MOLECULE))return void(s.innerText="No molecules column found");s.innerText=""}catch(t){s.innerText="Error parsing file"}})),u=o.tableInput("Dataframe",null,void 0,c);c();const d=o.div([u,s]),p=e.Func.find({tags:[l]}),m={};p.forEach((t=>{var e;m[null!==(e=t.friendlyName)&&void 0!==e?e:t.name]=t}));let h=null;const f=()=>Y(this,void 0,void 0,(function*(){const t=m[b.value];h=t.prepare();const e=yield h.getEditor();e.classList.remove("ui-form"),g.innerHTML="",g.appendChild(e)})),g=o.div([]),b=o.choiceInput(v,null!==(i=n.queryFunctionName)&&void 0!==i?i:Object.keys(m)[0],Object.keys(m),f);f(),n.queryFunctionName&&(null===(a=b.root.getElementsByTagName("select").item(0))||void 0===a||a.setAttribute("disabled","true"));const w=o.div([b,g]);w.style.display="none";const A=o.div([d,w]),T=n.campaignFields.map((t=>t.type===e.SEMTYPE.MOLECULE?Object.assign(Object.assign({},t),{type:"String",semtype:e.SEMTYPE.MOLECULE}):t)).map((t=>e.Property.fromOptions(Object.assign({name:t.name,type:$[t.type],nullable:!t.required},t.semtype?{semType:t.semtype}:{})))),x={},I=T.length?o.input.form(x,T):o.div();I.classList.remove("ui-form"),"File"===n.dataSourceType?(d.style.display="inherit",w.style.display="none"):(d.style.display="none",w.style.display="inherit");const N=o.div([A,...T.length?[I]:[]]),_=o.buttonsInput([]);return N.appendChild(_),{promise:new Promise((e=>{const i=()=>Y(this,void 0,void 0,(function*(){if("File"===n.dataSourceType){if(!r)return void t.shell.error("No file selected");const n=r;n.name=r.name,e({df:n,type:"File",campaignProps:x})}else{const n=m[b.value];if(!n)return void t.shell.error("No function selected");const i={};Object.entries(h.inputs).forEach((([t,e])=>{i[t]=e}));const o=yield n.apply(i);e({df:o,type:"Query",campaignProps:x})}})),a=o.bigButton(y,(()=>i()));_.appendChild(a)})),root:N,cancelPromise:new Promise((t=>{o.button(C,(()=>t()))}))}}(n);return a.then((t=>et(this,void 0,void 0,(function*(){this.app.dataFrame=t.df,this.app._fileInputType=t.type,yield this.app.setTemplate(n),this.app.campaignProps=t.campaignProps,this.app.saveCampaign(void 0,!1)})))),s.then((()=>{this.init()})),i}))}createNewTemplate(){return et(this,void 0,void 0,(function*(){const n=yield K(),i=new e.ViewBase,o=t.shell.v;i.name="New Template",i.root.appendChild(n.root),i.parentCall=this.app.parentCall,t.shell.addView(i),i.path=new URL(this.app.baseUrl).pathname+"/new-template",i.parentView=o;const{sub:a}=M(t.shell.v,"Hit Triage",g,(()=>{t.shell.v=o,i.close()}));n.template.then((e=>et(this,void 0,void 0,(function*(){yield this.init(e),i.close(),H(i),t.shell.v=o,a.unsubscribe()})))),n.cancelPromise.then((()=>{a.unsubscribe(),i.close(),t.shell.v=o}))}))}}class it extends tt{constructor(t){super(t),this.name="Submit"}render(){return o.empty(this.root),o.divV([o.h1("Summary"),o.div([o.tableFromMap(this.app.getSummary())])])}onActivated(){this.render()}submit(){var n,i,o,a,s;return i=this,o=void 0,s=function*(){const i=null===(n=this.app.template)||void 0===n?void 0:n.submit;if(!i)return;const o=e.Func.find({name:i.fName,package:i.package})[0];if(!o)return void t.shell.error(`Function ${i.fName} not found.`);const a=e.DataFrame.fromCsv(this.app.dataFrame.toCsv({filteredRowsOnly:!0}));yield o.apply({df:a,molecules:this.app.molColName}),this.app.campaign&&(this.app.campaign.status="Submitted"),this.app.saveCampaign("Submitted"),t.shell.info("Submitted successfully.")},new((a=void 0)||(a=Promise))((function(t,e){function n(t){try{l(s.next(t))}catch(t){e(t)}}function r(t){try{l(s.throw(t))}catch(t){e(t)}}function l(e){var i;e.done?t(e.value):(i=e.value,i instanceof a?i:new a((function(t){t(i)}))).then(n,r)}l((s=s.apply(i,o||[])).next())}))}}class ot{constructor(t){this.parentCall=t,this.resetBaseUrl()}resetBaseUrl(){const t=window.location.href,e=new URL(t);this.baseUrl=e.origin+e.pathname}getFilterType(t){const n=this.dataFrame.col(t);return(null==n?void 0:n.semType)===e.SEMTYPE.MOLECULE?e.FILTER_TYPE.SUBSTRUCTURE:(null==n?void 0:n.type)===e.COLUMN_TYPE.BOOL?e.FILTER_TYPE.BOOL_COLUMNS:(null==n?void 0:n.type)===e.COLUMN_TYPE.STRING?e.FILTER_TYPE.CATEGORICAL:e.FILTER_TYPE.HISTOGRAM}download(t,n,i=!1){const o=document.createElement("a"),a=e.DataFrame.fromColumns(t.columns.toList().filter((t=>!t.name.startsWith("~")))).toCsv({filteredRowsOnly:i});o.setAttribute("href","data:text/plain;charset=utf-8,"+encodeURIComponent(a)),o.setAttribute("download",n+".csv"),o.click()}getNewCampaignName(t,e){return n=this,i=void 0,a=function*(){const n=(yield It.files.list(t)).map((t=>t.name)).filter((t=>t.startsWith(e)));if(0===n.length)return e+"-1";const i=n.map((t=>t.split("-")[1])).filter(Boolean).map((t=>parseInt(t,10))).sort();return e+"-"+(i[i.length-1]+1).toString()},new((o=void 0)||(o=Promise))((function(t,e){function s(t){try{l(a.next(t))}catch(t){e(t)}}function r(t){try{l(a.throw(t))}catch(t){e(t)}}function l(e){var n;e.done?t(e.value):(n=e.value,n instanceof o?n:new o((function(t){t(n)}))).then(s,r)}l((a=a.apply(n,i||[])).next())}));var n,i,o,a}setBaseUrl(){const t=document.title;if(history.replaceState){const e={Title:t,Url:this.baseUrl};history.replaceState(e,e.Title,e.Url)}}}var at=function(t,e,n,i){return new(n||(n=Promise))((function(o,a){function s(t){try{l(i.next(t))}catch(t){a(t)}}function r(t){try{l(i.throw(t))}catch(t){a(t)}}function l(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,r)}l((i=i.apply(t,e||[])).next())}))},st=function(t,e,n,i){return new(n||(n=Promise))((function(o,a){function s(t){try{l(i.next(t))}catch(t){a(t)}}function r(t){try{l(i.throw(t))}catch(t){a(t)}}function l(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,r)}l((i=i.apply(t,e||[])).next())}))};class rt extends ot{constructor(n){super(n),this._filterViewName="Hit triage | Pick",this._filterDescriptions=[],this.campaignProps={},this._infoView=new nt(this),this.multiView=new e.MultiView({viewFactories:{[this._infoView.name]:()=>this._infoView}}),this.multiView.tabs.onTabChanged.subscribe((t=>{this.multiView.currentView instanceof tt&&this.multiView.currentView.onActivated()})),this.multiView.parentCall=n,t.events.onCurrentViewChanged.subscribe((()=>{var e,n,i,o;try{(null===(e=t.shell.v)||void 0===e?void 0:e.name)===this.currentPickViewId&&(t.shell.windows.showHelp=!1,this.setBaseUrl(),R(a,null!==(o=null!==(n=this._campaignId)&&void 0!==n?n:null===(i=this._campaign)||void 0===i?void 0:i.name)&&void 0!==o?o:""))}catch(t){console.error(t)}}))}setTemplate(n,i,o,s){var r,l,c,u,d,p,m,h,f,v,g;return st(this,void 0,void 0,(function*(){if((null===(r=this._pickView)||void 0===r?void 0:r.dataFrame)&&t.shell.closeTable(null===(l=this._pickView)||void 0===l?void 0:l.dataFrame),this._pickView=void 0,o?s&&(this._fileInputType=s.type,"File"===s.type?this.dataFrame=yield t.dapi.files.readCsv(s.query):this.dataFrame=yield t.functions.call(s.query)):(o=yield this.getNewCampaignName("Hit Triage/campaigns",n.key),R(a,o)),!this.dataFrame)return void console.error("Dataframe is empty.");if((null===(c=this._campaign)||void 0===c?void 0:c.columnSemTypes)&&Object.entries(this._campaign.columnSemTypes).forEach((([t,e])=>{const n=this.dataFrame.columns.byName(t);n&&(n.semType=e)})),yield this.dataFrame.meta.detectSemanticTypes(),this._molColName=null!==(d=null===(u=this.dataFrame.columns.bySemType(e.SEMTYPE.MOLECULE))||void 0===u?void 0:u.name)&&void 0!==d?d:void 0,this._dfName=null!==(p=this.dataFrame.name)&&void 0!==p?p:null==s?void 0:s.query,this.dataFrame.name=null!==(h=null!==(m=this._dfName)&&void 0!==m?m:this.dataFrame.name)&&void 0!==h?h:"Molecules",this._campaignId=o,this.template=n,this._campaignFilters=i,!i){const t={};n.compute.functions.forEach((e=>{const n=`${e.package}:${e.name}`;t[n]=e.args})),yield this.calculateColumns({descriptors:n.compute.descriptors.enabled?n.compute.descriptors.args:[],externals:t})}const y=t.shell.v,b=t.shell.addView(this.pickView);this.currentPickViewId=b.name,this._submitView=new it(this),this.setBaseUrl(),R(a,null!==(g=null!==(f=this._campaignId)&&void 0!==f?f:null===(v=this._campaign)||void 0===v?void 0:v.name)&&void 0!==g?g:"");const w=b,{sub:C}=M(w,"Hit Triage","Pick",(()=>{t.shell.v=y,w.close(),C.unsubscribe()}));t.shell.windows.showHelp=!1}))}get filterSettings(){return this._campaignFilters}get campaignId(){return this._campaignId}get pickView(){return this._pickView=this.getFilterView()}get molColName(){var t,n,i;return null!==(t=this._molColName)&&void 0!==t?t:this._molColName=null===(i=null===(n=this.dataFrame)||void 0===n?void 0:n.columns.bySemType(e.SEMTYPE.MOLECULE))||void 0===i?void 0:i.name}get fileInputType(){return this._fileInputType}get campaign(){return this._campaign}set campaign(t){this._campaign=t}calculateColumns(n,i){var o;return st(this,void 0,void 0,(function*(){const a=this.dataFrame.columns.names();n.descriptors&&n.descriptors.length>0&&(yield t.chem.descriptors(this.dataFrame,this.molColName,n.descriptors));for(const t of Object.keys(n.externals)){const i=n.externals[t],o=e.Func.find({package:t.split(":")[0],name:t.split(":")[1]})[0],a=o.inputs[0].name,s=o.inputs[1].name;i&&(yield o.apply(Object.assign(Object.assign({},i),{[a]:this.dataFrame,[s]:this.molColName})))}for(const e of Object.keys(null!==(o=n.scripts)&&void 0!==o?o:{})){const i=n.scripts[e];if(i)try{const n=yield t.dapi.scripts.find(e);if(!n)continue;const o=n.inputs[0].name,a=n.inputs[1].name;yield n.apply(Object.assign(Object.assign({},i),{[o]:this.dataFrame,[a]:this.molColName}))}catch(t){console.error(t)}}if(i){const t=i.getFiltersGroup();this.dataFrame.columns.names().filter((t=>!a.includes(t))).forEach((e=>{t.add({type:this.getFilterType(e),column:e})}))}}))}getFilterView(){this.dataFrame.col(u)||this.dataFrame.columns.addNewBool(u).init(!1);const t=e.TableView.create(this.dataFrame,!1),n=t.getRibbonPanels(),i=o.iconFA("wrench",(()=>st(this,void 0,void 0,(function*(){G((e=>st(this,void 0,void 0,(function*(){this.calculateColumns(e,t)}))),(()=>null),this.template,!0)}))),"Calculate additional properties"),a=o.bigButton("Submit",(()=>{var t;const e=null===(t=this._submitView)||void 0===t?void 0:t.render();if(e){const t=o.dialog("Submit");t.add(e),t.addButton("Save",(()=>{this.saveCampaign(),t.close()})),t.addButton("Submit",(()=>{var e;null===(e=this._submitView)||void 0===e||e.submit(),t.close()})),t.show()}}));a.classList.add("hit-design-submit-button");const s=U(n);return n.push([i,...s?[]:[a]]),t.setRibbonPanels(n),t.name=this._filterViewName,setTimeout((()=>st(this,void 0,void 0,(function*(){var n;t._onAdded(),yield new Promise((t=>setTimeout(t,1e3)));const i=t.filters(this._campaignFilters?{filters:this._campaignFilters}:void 0);if(null===(n=this._campaign)||void 0===n?void 0:n.layout)try{const n=e.ViewLayout.fromViewState(this._campaign.layout);t.loadLayout(n)}catch(t){console.error(t)}t.dataFrame.onFilterChanged.subscribe((e=>{this._filterDescriptions=Array.from(t.dataFrame.rows.filters),this._campaignFilters=i.getOptions().look.filters})),setTimeout((()=>{this._filterDescriptions=Array.from(t.dataFrame.rows.filters),this._campaignFilters=i.getOptions().look.filters}),300)}))),300),t.parentCall=this.parentCall,t}getSummary(){var t,e,n,i,a,s,r;const l=null!==(e=null===(t=this.campaign)||void 0===t?void 0:t.campaignFields)&&void 0!==e?e:this.campaignProps;return Object.assign(Object.assign({Template:null!==(i=null===(n=this.template)||void 0===n?void 0:n.name)&&void 0!==i?i:"Molecules","File path":o.divH([o.link(null!==(a=this._dfName)&&void 0!==a?a:"-",(()=>this.download(this.dataFrame,"molecules")),w)],{style:{alignItems:"center"}})},l),{"Number of molecules":this.dataFrame.rowCount.toString(),"Enrichment methods":[this.template.compute.descriptors.enabled?"descriptors":"",...this.template.compute.functions.map((t=>t.name))].filter((t=>t&&""!==t.trim())).join(", "),Filters:this._filterDescriptions.join(", "),"Result Molecules":o.divH([o.link(null!==(r=null===(s=this.dataFrame)||void 0===s?void 0:s.filter.trueCount.toString())&&void 0!==r?r:"0",(()=>{this.download(this.dataFrame,"hits",!0)}),w)],{style:{alignItems:"center"}})})}saveCampaign(n,i=!0){var a,s,r,l,c,u;return st(this,void 0,void 0,(function*(){const d=this.campaignId,p=this.filterSettings,m=this.template.name,h=this.dataFrame,f=`System:AppData/HitTriage/Hit Triage/campaigns/${d}/`,v=null!=d?d:yield function(t){return at(this,void 0,void 0,(function*(){return new Promise((e=>at(this,void 0,void 0,(function*(){const n=o.stringInput("Campaign name","");o.dialog("Save Campaign").add(o.div(n.root)).onOK((function(){n.value&&""!==n.value?e(n.value):e(t)})).show()}))))}))}(d),g={};h.columns.toList().forEach((t=>g[t.name]=t.semType));const y={name:v,templateName:m,filters:null!=p?p:{},ingest:{type:"File",query:`${f}enriched_table.csv`,molColName:this.molColName},status:null!==(s=null!=n?n:null===(a=this.campaign)||void 0===a?void 0:a.status)&&void 0!==s?s:"In Progress",createDate:null!==(l=null===(r=this.campaign)||void 0===r?void 0:r.createDate)&&void 0!==l?l:j(new Date),campaignFields:null!==(u=null===(c=this.campaign)||void 0===c?void 0:c.campaignFields)&&void 0!==u?u:this.campaignProps,columnSemTypes:g,rowCount:h.rowCount,filteredRowCount:h.filter.trueCount},b=e.DataFrame.fromColumns(h.columns.toList().filter((t=>!t.name.startsWith("~")))).toCsv();yield It.files.writeAsText(`Hit Triage/campaigns/${d}/enriched_table.csv`,b);const w=this._pickView.saveLayout();w?y.layout=w.viewState:t.shell.warning("Layout cound not be saved"),yield It.files.writeAsText(`Hit Triage/campaigns/${d}/campaign.json`,JSON.stringify(y)),i&&t.shell.info("Campaign saved successfully.")}))}}var lt=n(290),ct={};ct.styleTagTransform=V(),ct.setAttributes=B(),ct.insert=S().bind(null,"head"),ct.domAPI=_(),ct.insertStyleElement=O(),I()(lt.Z,ct),lt.Z&<.Z.locals&<.Z.locals;var ut;!function(e){let n,i;!function(t){t.vert=function(t){return o.divV(t.map((t=>o.render(t))),{classes:"u2-panel"})},t.horz=function(t){return o.divH(t.map((t=>o.render(t))),{classes:"u2-panel"})}}(n=e.panels||(e.panels={})),e.appHeader=function(t){const e=o.iconImage("",t.iconPath);return q()(e).addClass("ui-app-header-icon").css("margin-right","20px"),n.horz([e,n.vert([o.markdown(t.description),t.learnMoreUrl?o.link("Learn more",t.learnMoreUrl):null])])},function(e){e.runAsync=function(e,n){return i=this,a=void 0,r=function*(){o.setUpdateIndicator(e,!0);try{return yield n()}catch(e){t.log.error(e)}finally{o.setUpdateIndicator(e,!1)}},new((s=void 0)||(s=Promise))((function(t,e){function n(t){try{l(r.next(t))}catch(t){e(t)}}function o(t){try{l(r.throw(t))}catch(t){e(t)}}function l(e){var i;e.done?t(e.value):(i=e.value,i instanceof s?i:new s((function(t){t(i)}))).then(n,o)}l((r=r.apply(i,a||[])).next())}));var i,a,s,r}}(i=e.tools||(e.tools={}))}(ut||(ut={}));function dt(n,i,o,a=[]){return s=this,r=void 0,c=function*(){const s=e.Column.fromStrings(p,[n]),r=e.DataFrame.fromColumns([s]);yield r.meta.detectSemanticTypes(),i.length&&(yield t.chem.descriptors(r,s.name,i));for(const e of o){const n=e.args,i=yield t.functions.find(`${e.package}:${e.name}`);if(!i)continue;const o=i.inputs[0].name,a=i.inputs[1].name;yield i.apply(Object.assign(Object.assign({},n),{[o]:r,[a]:s.name}))}for(const e of a){const n=e.args;try{const i=yield t.dapi.scripts.find(e.id);if(i){const t=i.inputs[0].name,e=i.inputs[1].name;yield i.apply(Object.assign(Object.assign({},n),{[t]:r,[e]:s.name}))}}catch(t){console.error(t)}}return r},new((l=void 0)||(l=Promise))((function(t,e){function n(t){try{o(c.next(t))}catch(t){e(t)}}function i(t){try{o(c.throw(t))}catch(t){e(t)}}function o(e){var o;e.done?t(e.value):(o=e.value,o instanceof l?o:new l((function(t){t(o)}))).then(n,i)}o((c=c.apply(s,r||[])).next())}));var s,r,l,c}function pt(t){let e=0;if(t.length>1)for(const n of t.toList()){if(!n||!n.startsWith(h[0])||n.length!==h.length)continue;const t=parseInt(n.substring(1));isNaN(t)||(e=Math.max(t,e))}return`V${"".concat(...new Array(h.length-1-(e+1).toString().length).fill("0"))}${e+1}`}var mt=function(t,e,n,i){return new(n||(n=Promise))((function(o,a){function s(t){try{l(i.next(t))}catch(t){a(t)}}function r(t){try{l(i.throw(t))}catch(t){a(t)}}function l(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,r)}l((i=i.apply(t,e||[])).next())}))};function ht(n){var i,a,s,l,u,d,p,m,h,v,g;return mt(this,void 0,void 0,(function*(){const y=e.Func.find({tags:[r]}),w=yield It.files.list("Hit Design/templates");let A=!1,T=!1;const x=w.map((t=>t.name.slice(0,-5))),I=[];for(const t of w)try{const e=JSON.parse(yield It.files.readAsText(t));I.push(e.key)}catch(t){console.error(t)}const N=e.Func.find({tags:[c]}),_={};N.forEach((t=>{var e;_[null!==(e=t.friendlyName)&&void 0!==e?e:t.name]=t}));const E=o.choiceInput("Submit function",null,[null,...Object.keys(_)]);E.nullable=!0,E.value=null!==(a=null===(i=null==n?void 0:n.submit)||void 0===i?void 0:i.fName)&&void 0!==a?a:null,E.setTooltip("Select function to be called upon submitting");const S=o.divText("Template name is empty or already exists",{classes:"hit-triage-error-div"}),F=o.divText("Template key is empty or already exists",{classes:"hit-triage-error-div"});function B(){var t,e,n,i;if(""===P.value||x.includes(null!==(e=null===(t=P.value)||void 0===t?void 0:t.trim())&&void 0!==e?e:"")){const t=null!==(n=P.input.offsetLeft)&&void 0!==n?n:0,e=null!==(i=P.input.offsetWidth)&&void 0!==i?i:0;S.style.marginLeft=`${t}px`,S.style.width=`${e}px`,S.style.opacity="100%",S.style.borderTop="1px solid red",A=!0}else S.style.borderTop="none",S.style.opacity="0%",A=!1}const P=o.stringInput("Name",null!==(s=null==n?void 0:n.name)&&void 0!==s?s:"",B);function O(){var t,e,n,i;if(""===k.value||I.includes(null!==(e=null===(t=k.value)||void 0===t?void 0:t.trim())&&void 0!==e?e:"")){const t=null!==(n=k.input.offsetLeft)&&void 0!==n?n:0,e=null!==(i=k.input.offsetWidth)&&void 0!==i?i:0;F.style.marginLeft=`${t}px`,F.style.width=`${e}px`,F.style.borderTop="1px solid red",F.style.opacity="100%",T=!0}else F.style.opacity="0%",F.style.borderTop="none",T=!1}const k=o.stringInput("Key",null!==(l=null==n?void 0:n.key)&&void 0!==l?l:"",O);k.setTooltip("Template key used for campaign prefix"),P.setTooltip("Template name"),P.root.style.borderBottom="none",k.root.style.borderBottom="none",S.style.opacity="0%",F.style.opacity="0%";const V={Descriptors:"Descriptors"};y.forEach((t=>{var e;V[null!==(e=t.friendlyName)&&void 0!==e?e:t.name]=`${t.package.name}:${t.name}`}));let L=null;const D={compute:{descriptors:{enabled:!0,args:null!==(p=null===(d=null===(u=null==n?void 0:n.compute)||void 0===u?void 0:u.descriptors)||void 0===d?void 0:d.args)&&void 0!==p?p:[]},functions:null!==(h=null===(m=null==n?void 0:n.compute)||void 0===m?void 0:m.functions)&&void 0!==h?h:[]}},j=yield G((t=>{L=t}),(()=>null),D,!1);j.root.classList.add("hit-triage-new-template-functions-input");const R=Q(null==n?void 0:n.campaignFields),M=function(t){const n=[e.Property.fromOptions({name:"Name",type:e.TYPE.STRING})],i=new Z(n,t?t.map((t=>({Name:t}))):void 0,{horizontalInputNames:!0});let o={};return i.onItemAdded.subscribe((t=>{o=null!=t?t:{}})),i.onAddingItemChanged.subscribe((t=>{t&&(o=t.item)})),{getFields:function(){const t=i.items.filter((t=>t.Name)).map((t=>t.Name));return o.Name&&""!==o.Name&&t.push(o.Name),t},fieldsDiv:i.root}}(null==n?void 0:n.stages),H=o.divV([o.divV([P,S]),o.divV([k,F]),R.fieldsDiv]),U=o.h2("Stages");o.tooltip.bind(U,'Define Stages for designed molecules. For example, "Design", "Synthesis", "Test", etc.');const $=o.h2("Compute");o.tooltip.bind($,'Define functions to be calculated for each molecule. For example, "Descriptors", "Descriptors:Descriptors", etc.');const Y=o.div([o.h2("Details"),H,U,M.fieldsDiv,$,j.root,o.h2("Submit"),E.root],"ui-form"),W=o.buttonsInput([]);Y.appendChild(W);const q=null!==(g=null===(v=W.getElementsByClassName("ui-input-editor"))||void 0===v?void 0:v[0])&&void 0!==g?g:W,J=new Promise((t=>{const e=o.button(C,(()=>t()));q.appendChild(e)})),z=new Promise((e=>{const n=o.bigButton(b,(()=>function(){var n,i,o,a;return mt(this,void 0,void 0,(function*(){if(B(),O(),j.okProxy(),A||!P.value||""===P.value)return void t.shell.error("Template name is empty or already exists");if(T||!k.value||""===k.value)return void t.shell.error("Template key is empty or already exists");const s=E.value?_[E.value]:void 0,r=Object.assign({name:P.value,key:k.value,campaignFields:R.getFields(),stages:M.getFields(),compute:{descriptors:{enabled:!!(null===(n=null==L?void 0:L.descriptors)||void 0===n?void 0:n.length),args:null!==(i=null==L?void 0:L.descriptors)&&void 0!==i?i:[]},functions:Object.entries(null!==(o=null==L?void 0:L.externals)&&void 0!==o?o:{}).map((([t,e])=>{const n=t.split(":");return{name:n[1],package:n[0],args:e}})),scripts:Object.entries(null!==(a=null==L?void 0:L.scripts)&&void 0!==a?a:{}).filter((([t,e])=>t.startsWith(f)&&3===t.split(":").length)).map((([t,e])=>{var n,i;const o=t.split(":");return{name:null!==(n=o[1])&&void 0!==n?n:"",id:null!==(i=o[2])&&void 0!==i?i:"",args:e}}))}},s?{submit:{fName:s.name,package:s.package.name}}:{});var l;l=r,It.files.writeAsText(`Hit Design/templates/${l.name}.json`,JSON.stringify(l)),t.shell.info("Template created successfully"),e(r)}))}()));q.appendChild(n)}));return{root:Y,template:z,cancelPromise:J}}))}var ft=function(t,e,n,i){return new(n||(n=Promise))((function(o,a){function s(t){try{l(i.next(t))}catch(t){a(t)}}function r(t){try{l(i.throw(t))}catch(t){a(t)}}function l(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,r)}l((i=i.apply(t,e||[])).next())}))};class vt extends tt{constructor(e){super(e),this.deletedCampaigns=[],this.name="Hit Design",t.shell.windows.showHelp=!0,t.shell.windows.help.showHelp(It.webRoot+"README_HD.md"),this.checkCampaign().then((t=>{this.app.campaign=t,this.init()}))}onActivated(){t.shell.windows.showHelp=!0,t.shell.windows.help.showHelp(It.webRoot+"README_HD.md")}init(t){return ft(this,void 0,void 0,(function*(){o.setUpdateIndicator(this.root,!0);try{const e=o.h1(A),n=o.h1(T,{style:{marginLeft:"10px"}}),i=ut.appHeader({iconPath:It.webRoot+"/images/icons/hit-design-icon.png",learnMoreUrl:"https://github.com/datagrok-ai/public/blob/master/packages/HitTriage/README_HD.md",description:"- Configure your own workflow using the template editor\n- Sketch molecules in the molecular spreadsheet\n- Annotate and share ideas with the team\n- Calculate different molecular properties\n- Save campaigns and continue from where you left off\n- Submit final selection to the function of your choice"}),a=o.div(),s=o.divH([]),r=o.div([s,a],"ui-form"),l=yield this.getCampaignsTable();q()(this.root).empty(),this.root.appendChild(o.div([o.divV([i,e],{style:{marginLeft:"10px"}}),l,n,r])),yield this.startNewCampaign(a,s,t),this.app.resetBaseUrl()}finally{o.setUpdateIndicator(this.root,!1)}}))}startNewCampaign(t,e,n){var i;return ft(this,void 0,void 0,(function*(){const a=(yield It.files.list("Hit Design/templates")).filter((t=>t.name.endsWith(".json"))).map((t=>t.name.slice(0,-5)));n&&!a.includes(n.name)&&a.push(n.name);let s=null;const r=()=>ft(this,void 0,void 0,(function*(){const e=l.value,i=n&&n.name===e?n:JSON.parse(yield It.files.readAsText("Hit Design/templates/"+e+".json"));s=i;const o=yield this.getNewCampaignAccordeon(i);q()(t).empty(),t.appendChild(o)})),l=o.choiceInput("Template",null!==(i=null==n?void 0:n.name)&&void 0!==i?i:a[0],a,(()=>ft(this,void 0,void 0,(function*(){yield r()}))));l.root.style.width="100%";const c=o.icons.add((()=>{this.createNewTemplate()}),g),u=o.icons.copy((()=>{s&&this.createNewTemplate(s)}),"Clone template");c.style.color="#2083d5",l.addOptions(u),l.addOptions(c),yield r(),q()(e).empty(),e.appendChild(l.root)}))}checkCampaign(t){var e;return ft(this,void 0,void 0,(function*(){const n=location.search,i=new URLSearchParams(n);if(!i.has(s)&&!t)return;const o=null!=t?t:i.get(s);if(!(yield It.files.exists(`Hit Design/campaigns/${o}/campaign.json`)))return;const a=JSON.parse(yield It.files.readAsText(`Hit Design/campaigns/${o}/campaign.json`));a&&(this.app.campaign=a);const r=null!==(e=a.template)&&void 0!==e?e:JSON.parse(yield It.files.readAsText(`Hit Design/templates/${a.templateName}.json`));return yield this.app.setTemplate(r,o),t&&R(s,t),a.template=r,a}))}getCampaignsTable(){return ft(this,void 0,void 0,(function*(){const t=(yield It.files.list("Hit Design/campaigns")).filter((t=>-1===this.deletedCampaigns.indexOf(t.name))),e={};for(const n of t){const t=JSON.parse(yield It.files.readAsText(`Hit Design/campaigns/${n.name}/campaign.json`));e[t.name]=t}const n=o.table(Object.values(e),(t=>[o.link(t.name,(()=>this.setCampaign(t.name)),"",""),t.createDate,t.rowCount,t.status,o.icons.delete((()=>ft(this,void 0,void 0,(function*(){o.dialog("Delete campaign").add(o.divText(`Are you sure you want to delete campaign ${t.name}?`)).onOK((()=>ft(this,void 0,void 0,(function*(){yield this.deleteCampaign("Hit Design",t.name),this.deletedCampaigns.push(t.name),yield this.init()})))).show()}))),"Delete campaign")]),["Name","Created","Molecules","Status",""]);return n.style.color="var(--grey-5)",n.style.marginLeft="24px",n}))}setCampaign(t){return ft(this,void 0,void 0,(function*(){const e=yield this.checkCampaign(t);this.app.campaign=e}))}getNewCampaignAccordeon(n){return ft(this,void 0,void 0,(function*(){const{root:i,promise:a,cancelPromise:s}=function(n){var i,a;const s=e.DataFrame.create(1),r=s.columns.addNew(p,e.TYPE.STRING);r.semType=e.SEMTYPE.MOLECULE,r.setTag(e.TAGS.UNITS,e.UNITS.Molecule.SMILES),r.set(0,null),(null===(i=null==n?void 0:n.stages)||void 0===i?void 0:i.length)>0&&s.columns.addNew(d,e.TYPE.STRING).set(0,n.stages[0]);const l=s.columns.addNew(m,e.TYPE.STRING);l.set(0,pt(l));const c=n.campaignFields.map((t=>t.type===e.SEMTYPE.MOLECULE?Object.assign(Object.assign({},t),{type:"String",semtype:e.SEMTYPE.MOLECULE}):t)).map((t=>e.Property.fromOptions(Object.assign({name:t.name,type:$[t.type],nullable:!t.required},t.semtype?{semType:t.semtype}:{})))),u={},h=o.input.form(u,c);h.classList.remove("ui-form");const f=o.div([...(null===(a=n.campaignFields)||void 0===a||a.length,[]),h]),v=o.buttonsInput([]);return f.appendChild(v),{promise:new Promise((e=>{const i=o.bigButton(y,(()=>{for(const e of n.campaignFields)if(e.required&&(!u[e.name]||""===u[e.name]))return void t.shell.error(`Field '${e.name}' is required`);e({df:s,campaignProps:u})}));v.appendChild(i)})),root:f,cancelPromise:new Promise((t=>{o.button(C,(()=>t()))}))}}(n);return a.then((t=>ft(this,void 0,void 0,(function*(){this.app.dataFrame=t.df,yield this.app.setTemplate(n),this.app.campaignProps=t.campaignProps,this.app.saveCampaign(void 0,!1)})))),s.then((()=>{this.init()})),i}))}createNewTemplate(n){return ft(this,void 0,void 0,(function*(){o.setUpdateIndicator(this.root,!0);try{const i=yield ht(n),a=new e.ViewBase,s=t.shell.v;a.name="New Template",a.root.appendChild(i.root),a.parentCall=this.app.parentCall,t.shell.addView(a),a.path=new URL(this.app.baseUrl).pathname+"/new-template";const{sub:r}=M(a,"Hit Design",g,(()=>ft(this,void 0,void 0,(function*(){t.shell.v=s,a.close()}))));i.template.then((e=>ft(this,void 0,void 0,(function*(){yield this.init(e),a.close(),H(a),t.shell.v=s,r.unsubscribe()})))),i.cancelPromise.then((()=>ft(this,void 0,void 0,(function*(){r.unsubscribe(),a.close(),t.shell.v=s}))))}finally{o.setUpdateIndicator(this.root,!1)}}))}}class gt extends tt{constructor(t){super(t),this.name="Submit"}render(){return o.empty(this.root),o.divV([o.h1("Summary"),o.div([o.tableFromMap(this.app.getSummary())])])}onActivated(){this.render()}submit(){var n,i,o,a,s;return i=this,o=void 0,s=function*(){const i=null===(n=this.app.template)||void 0===n?void 0:n.submit;if(!i)return;const o=e.Func.find({name:i.fName,package:i.package})[0];if(!o)return void t.shell.error(`Function ${i.fName} not found.`);const a=e.DataFrame.fromCsv(this.app.dataFrame.toCsv({filteredRowsOnly:!0}));yield o.apply({df:a,molecules:this.app.molColName}),this.app.campaign&&(this.app.campaign.status="Submitted"),this.app.saveCampaign("Submitted"),t.shell.info("Submitted successfully.")},new((a=void 0)||(a=Promise))((function(t,e){function n(t){try{l(s.next(t))}catch(t){e(t)}}function r(t){try{l(s.throw(t))}catch(t){e(t)}}function l(e){var i;e.done?t(e.value):(i=e.value,i instanceof a?i:new a((function(t){t(i)}))).then(n,r)}l((s=s.apply(i,o||[])).next())}))}}var yt=n(143),bt={};bt.styleTagTransform=V(),bt.setAttributes=B(),bt.insert=S().bind(null,"head"),bt.domAPI=_(),bt.insertStyleElement=O(),I()(yt.Z,bt),yt.Z&&yt.Z.locals&&yt.Z.locals;class wt extends tt{constructor(t){super(t),this.v=null,this.name="Progress Tracker"}render(){return n=this,i=void 0,s=function*(){return new Promise((n=>{var i,a;o.empty(this.root),this.app.dataFrame.columns.names().forEach((t=>{t.startsWith("~")&&this.app.dataFrame.columns.remove(t)})),this.v=e.Viewer.fromType(e.VIEWER.TILE_VIEWER,this.app.dataFrame,{lanesColumnName:d,lanes:null!==(a=null===(i=this.app.template)||void 0===i?void 0:i.stages)&&void 0!==a?a:[]}),this.root.appendChild(this.v.root),this.v.root.style.height="100%",this.v.root.style.width="100%",setTimeout((()=>{var e,i,a;null===(i=null===(e=this.v)||void 0===e?void 0:e.view)||void 0===i||i._onAdded();const s=null===(a=t.shell.v)||void 0===a?void 0:a.getRibbonPanels();if(s){if(U(s))return void n();const e=o.bigButton("Design view",(()=>{const e=t.shell.view(this.app.designViewName);e&&(t.shell.v=e)})),i=o.bigButton("Submit",(()=>{var t;const e=null===(t=this.app._submitView)||void 0===t?void 0:t.render();if(e){const t=o.dialog("Submit");t.add(e),t.addButton("Save",(()=>{this.app.saveCampaign(),t.close()})),t.addButton("Submit",(()=>{var e;null===(e=this.app._submitView)||void 0===e||e.submit(),t.close()})),t.show()}}));i.classList.add("hit-design-submit-button"),s.push([e,i]),t.shell.v.setRibbonPanels(s)}n()}),5)}))},new((a=void 0)||(a=Promise))((function(t,e){function o(t){try{l(s.next(t))}catch(t){e(t)}}function r(t){try{l(s.throw(t))}catch(t){e(t)}}function l(e){var n;e.done?t(e.value):(n=e.value,n instanceof a?n:new a((function(t){t(n)}))).then(o,r)}l((s=s.apply(n,i||[])).next())}));var n,i,a,s}onActivated(){this.render()}destroy(){var t;null===(t=this.v)||void 0===t||t.detach()}}var Ct=function(t,e,n,i){return new(n||(n=Promise))((function(o,a){function s(t){try{l(i.next(t))}catch(t){a(t)}}function r(t){try{l(i.throw(t))}catch(t){a(t)}}function l(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,r)}l((i=i.apply(t,e||[])).next())}))};class At extends ot{constructor(n){super(n),this._tilesViewTab=null,this._designViewName="Design",this._filePath="System.AppData/HitTriage/Hit Design/campaigns",this._molColName=p,this.campaignProps={},this.processedValues=[],this._extraStageColsCount=0,this._infoView=new vt(this),this.multiView=new e.MultiView({viewFactories:{[this._infoView.name]:()=>this._infoView}}),this.multiView.tabs.onTabChanged.subscribe((t=>{this.multiView.currentView instanceof tt&&this.multiView.currentView.onActivated()})),this.multiView.parentCall=n,this.mainView=this.multiView,t.events.onCurrentViewChanged.subscribe((()=>Ct(this,void 0,void 0,(function*(){var e,n,i,o,s,r,l,c,u;try{if((null===(e=t.shell.v)||void 0===e?void 0:e.name)===this.currentDesignViewId||(null===(n=t.shell.v)||void 0===n?void 0:n.name)===this.currentTilesViewId){t.shell.windows.showHelp=!1,this.setBaseUrl(),R(a,null!==(s=null!==(i=this._campaignId)&&void 0!==i?i:null===(o=this._campaign)||void 0===o?void 0:o.name)&&void 0!==s?s:""),(null===(r=t.shell.v)||void 0===r?void 0:r.name)===this.currentTilesViewId?yield null===(l=this._tilesView)||void 0===l?void 0:l.render():null===(c=this._tilesView)||void 0===c||c.destroy();const{sub:e}=M(t.shell.v,"Hit Design",null===(u=t.shell.v)||void 0===u?void 0:u.name,(()=>{var n,i;t.shell.v=this.mainView,null===(n=this._tilesView)||void 0===n||n.close(),null===(i=this._designView)||void 0===i||i.close(),this._infoView.init(),e.unsubscribe()}))}}catch(t){console.error(t)}}))))}setTemplate(n,i){var o,r,l,c,u,d,m,h,f,v,g,y;return Ct(this,void 0,void 0,(function*(){if(i){const e="System.AppData/HitTriage/Hit Design/campaigns";this._filePath=null!==(l=null===(r=this.campaign)||void 0===r?void 0:r.savePath)&&void 0!==l?l:`${e}/${i}/enriched_table.csv`,this.dataFrame=yield t.dapi.files.readCsv(this._filePath),(null===(c=this._campaign)||void 0===c?void 0:c.columnSemTypes)&&Object.entries(this._campaign.columnSemTypes).forEach((([t,e])=>{const n=this.dataFrame.columns.byName(t);n&&e&&(n.semType=e)}))}else(null===(o=this._designView)||void 0===o?void 0:o.dataFrame)&&t.shell.closeTable(this._designView.dataFrame),this._designView=void 0,i=yield this.getNewCampaignName("Hit Design/campaigns",n.key),R(s,i),this._filePath=`System.AppData/HitTriage/Hit Design/campaigns/${i}/enriched_table.csv`;if(!this.dataFrame)return void console.error("DataFrame is empty");yield this.dataFrame.meta.detectSemanticTypes(),this._molColName=null!==(d=null===(u=this.dataFrame.columns.bySemType(e.SEMTYPE.MOLECULE))||void 0===u?void 0:u.name)&&void 0!==d?d:p,this._dfName=null!==(m=(y=this.dataFrame).name)&&void 0!==m?m:y.name=i,this._campaignId=i,this.template=n,null!==(h=this._submitView)&&void 0!==h||(this._submitView=new gt(this)),t.shell.windows.showHelp=!1,this._extraStageColsCount=this.dataFrame.rowCount-this.dataFrame.filter.trueCount;const b=t.shell.addView(this.designView);this.currentDesignViewId=b.name,this.setBaseUrl(),R(a,null!==(g=null!==(f=this._campaignId)&&void 0!==f?f:null===(v=this._campaign)||void 0===v?void 0:v.name)&&void 0!==g?g:""),this.campaign&&(this.campaign.template=n)}))}get campaignId(){return this._campaignId}get designView(){return this._designView=this.getDesignView()}get designViewName(){return this._designViewName}get molColName(){var t,n,i,o;return null!==(t=this._molColName)&&void 0!==t?t:this._molColName=null!==(o=null===(i=null===(n=this.dataFrame)||void 0===n?void 0:n.columns.bySemType(e.SEMTYPE.MOLECULE))||void 0===i?void 0:i.name)&&void 0!==o?o:p}get campaign(){return this._campaign}set campaign(t){this._campaign=t}getDesignView(){var n,i,a,s,r,l;const c=[],u=null===(n=this.dataFrame.col(this.molColName))||void 0===n?void 0:n.toList().every((t=>!t&&""===t)),h=e.TableView.create(this.dataFrame,!1);this._designViewName=null!==(a=null===(i=this.campaign)||void 0===i?void 0:i.name)&&void 0!==a?a:this._designViewName,h.name=this._designViewName,this.processedValues=this.dataFrame.getCol(this.molColName).toList(),setTimeout((()=>Ct(this,void 0,void 0,(function*(){var n,i;if(h._onAdded(),yield new Promise((t=>setTimeout(t,1e3))),null===(n=this._campaign)||void 0===n?void 0:n.layout)try{const t=e.ViewLayout.fromViewState(this._campaign.layout);h.loadLayout(t)}catch(t){console.error(t)}u&&t.functions.call("Chem:editMoleculeCell",{cell:h.grid.cell(this._molColName,0)}),c.push(this.dataFrame.onRowsAdded.subscribe((()=>{var e,n;try{if(this.processedValues=this.dataFrame.getCol(this.molColName).toList(),(null===(e=this.template.stages)||void 0===e?void 0:e.length)>0)for(let t=0;t<this.dataFrame.rowCount;t++){const e=this.dataFrame.col(d).get(t);e&&""!==e&&!(null===(n=this.dataFrame.col(d))||void 0===n?void 0:n.isNone(t))||this.dataFrame.set(d,t,this.template.stages[0])}let i=null;for(let t=0;t<this.dataFrame.rowCount;t++){const e=h.grid.cell(this.molColName,t);e&&(""!==e.cell.value&&null!==e.cell.value||(i=e))}i&&t.functions.call("Chem:editMoleculeCell",{cell:i})}catch(t){console.error(t)}}))),this.dataFrame&&c.push(null===(i=this.dataFrame)||void 0===i?void 0:i.onRowsRemoved.subscribe((()=>{try{this.processedValues=this.dataFrame.getCol(this.molColName).toList()}catch(t){console.error(t)}}))),c.push(t.events.onContextMenu.subscribe((n=>{var i,o,a,s,r;try{const t=null===(i=null==n?void 0:n.args)||void 0===i?void 0:i.context;if(!t)return;if((null==t?void 0:t.type)!==e.VIEWER.GRID)return;if(!t.tableView||t.tableView.id!==h.id)return;if((null===(s=null===(a=null===(o=null==n?void 0:n.args)||void 0===o?void 0:o.item)||void 0===a?void 0:a.tableColumn)||void 0===s?void 0:s.name)!==this.molColName)return;const l=null===(r=null==n?void 0:n.args)||void 0===r?void 0:r.menu;if(!l)return;l.item("Add new row",(()=>{this.dataFrame.rows.addNew(null,!0)})),l.item("Duplicate molecule",(()=>{var t,e,i,o;try{this.dataFrame.rows.addNew(null,!0);let a=null;for(let t=0;t<this.dataFrame.rowCount;t++){const e=h.grid.cell(this.molColName,t);e&&(""!==e.cell.value&&null!==e.cell.value||(a=e))}a&&(a.cell.value=null!==(o=null===(i=null===(e=null===(t=null==n?void 0:n.args)||void 0===t?void 0:t.item)||void 0===e?void 0:e.cell)||void 0===i?void 0:i.value)&&void 0!==o?o:"")}catch(t){console.error(t)}}))}catch(e){t.log.error(e)}}))),c.push(h.grid.onCellValueEdited.subscribe((t=>Ct(this,void 0,void 0,(function*(){var e,n,i,o;try{if((null===(e=t.tableColumn)||void 0===e?void 0:e.name)===d)return void(yield this.saveCampaign(void 0,!1));if((null===(n=t.tableColumn)||void 0===n?void 0:n.name)!==this.molColName)return;const a=t.cell.value,s=t.tableRowIndex;(null===(i=this.dataFrame.col(m))||void 0===i?void 0:i.get(s))&&""!==(null===(o=this.dataFrame.col(m))||void 0===o?void 0:o.get(s))||this.dataFrame.col(m).set(s,pt(this.dataFrame.col(m)),!1);const r=this.template.compute;if(!a||""===a)return;const l=yield dt(a,r.descriptors.args,r.functions,r.scripts);for(const t of l.columns.toList())t.name!==p&&(this.dataFrame.columns.contains(t.name)||(this.dataFrame.columns.addNew(t.name,t.type).semType=t.semType),this.dataFrame.col(t.name).set(s,t.get(0),!1));this.dataFrame.fireValuesChanged(),this.saveCampaign(void 0,!1)}catch(t){console.error(t)}})))));const o=t.events.onViewRemoved.subscribe((t=>{t.id===h.id&&(c.forEach((t=>t.unsubscribe())),o.unsubscribe())}))}))),300);const v=null==h?void 0:h.getRibbonPanels();if(v&&!U(v)){const e=()=>Ct(this,void 0,void 0,(function*(){var t;G((t=>Ct(this,void 0,void 0,(function*(){var e,n,i,a,s;const r=this.template.compute.descriptors.args,l=this.template.compute.functions,c=null!==(e=this.template.compute.scripts)&&void 0!==e?e:[],u=t.descriptors,d={descriptors:{enabled:!!(null===(n=null==t?void 0:t.descriptors)||void 0===n?void 0:n.length),args:null!==(i=null==t?void 0:t.descriptors)&&void 0!==i?i:[]},functions:Object.entries(null!==(a=null==t?void 0:t.externals)&&void 0!==a?a:{}).map((([t,e])=>{const n=t.split(":");return{name:n[1],package:n[0],args:e}})),scripts:Object.entries(null!==(s=null==t?void 0:t.scripts)&&void 0!==s?s:{}).filter((([t,e])=>t.startsWith(f)&&3===t.split(":").length)).map((([t,e])=>{var n,i;const o=t.split(":");return{name:null!==(n=o[1])&&void 0!==n?n:"",id:null!==(i=o[2])&&void 0!==i?i:"",args:e}}))};this.template.compute=d,this.campaign.template=this.template;const m=u.filter((t=>!r.includes(t))),v=d.functions.filter((t=>{if(!l.some((e=>e.name===t.name&&e.package===t.package)))return!0;const e=l.find((e=>e.name===t.name&&e.package===t.package));return!Object.entries(t.args).every((([t,n])=>e.args[t]===n))})),g=d.scripts.filter((t=>{if(!c.some((e=>e.id===t.id)))return!0;const e=c.find((e=>e.id===t.id));return!Object.entries(t.args).every((([t,n])=>e.args[t]===n))}));o.setUpdateIndicator(h.grid.root,!0);try{for(let t=0;t<this.dataFrame.rowCount;t++){const e=this.dataFrame.get(this.molColName,t);if(!e||""===e)continue;const n=yield dt(e,m,v,g);for(const e of n.columns.toList())e.name!==p&&(this.dataFrame.columns.contains(e.name)||(this.dataFrame.columns.addNew(e.name,e.type).semType=e.semType),this.dataFrame.col(e.name).set(t,e.get(0),!1));this.dataFrame.fireValuesChanged()}}finally{o.setUpdateIndicator(h.grid.root,!1),this.saveCampaign(void 0,!1)}}))),(()=>null),null===(t=this.campaign)||void 0===t?void 0:t.template,!0)})),n=o.iconFA("wrench",e,"Calculate additional properties"),i=o.icons.add((()=>{var t;null===(t=this.dataFrame)||void 0===t||t.rows.addNew(null,!0)}),"Add new row"),a=o.bigButton("Progress tracker",(()=>{this.currentTilesViewId&&t.shell.view(this.currentTilesViewId)?t.shell.v=t.shell.view(this.currentTilesViewId):(this._tilesView=new wt(this),this._tilesView.parentCall=this.parentCall,this._tilesViewTab=t.shell.addView(this._tilesView),this.currentTilesViewId=this._tilesViewTab.name,this._tilesView.onActivated())})),c=o.bigButton("Submit",(()=>{var t;const e=null===(t=this._submitView)||void 0===t?void 0:t.render();if(e){const t=o.dialog("Submit");t.add(e),t.addButton("Save",(()=>{this.saveCampaign(),t.close()})),t.addButton("Submit",(()=>{var e;null===(e=this._submitView)||void 0===e||e.submit(),t.close()})),t.show()}}));c.classList.add("hit-design-submit-button");const u=[c];null!==(l=null===(r=null===(s=this.template)||void 0===s?void 0:s.stages)||void 0===r?void 0:r.length)&&void 0!==l&&l&&u.unshift(a),this.campaign&&this.template&&(this.campaign.template||(this.campaign.template=this.template),u.unshift(n)),u.unshift(i),v.push(u),h.setRibbonPanels(v)}return h.parentCall=this.parentCall,h}getSummary(){var n,i,a,s;const r=()=>{var t,e;const n=this._filePath.indexOf(null!==(t=this.campaignId)&&void 0!==t?t:null===(e=this._campaign)||void 0===e?void 0:e.name);return-1===n?this._filePath:this._filePath.substring(0,n-1)},l=Object.assign({},null!==(i=null===(n=this.campaign)||void 0===n?void 0:n.campaignFields)&&void 0!==i?i:this.campaignProps);return this.template&&this.template.campaignFields&&Object.entries(l).forEach((([n,i])=>{const o=this.template.campaignFields.find((t=>t.name===n));o&&"Date"===o.type&&i?"Invalid Date"!==new Date(i).toString()?l[n]=new Date(i).toLocaleDateString():i.date?l[n]=new Date(i.date).toLocaleDateString():l[n]=i:o&&o.type===e.SEMTYPE.MOLECULE&&i&&(l[n]=t.chem.drawMolecule(i))})),Object.assign(Object.assign({Template:null!==(s=null===(a=this.template)||void 0===a?void 0:a.name)&&void 0!==s?s:"Molecules","File path":(()=>{const e=o.icons.edit((()=>{const n=r(),s=o.stringInput("Path",n),l=s.root.getElementsByTagName("label").item(0);l&&l.remove(),s.root.style.width="100%";const c=o.button("Save",(()=>Ct(this,void 0,void 0,(function*(){const n=yield function(){return Ct(this,void 0,void 0,(function*(){const e=s.value;return e&&""!==e.trim()?!!(yield t.dapi.files.exists(e))||(t.shell.error("Given folder does not exist"),!1):(t.shell.error("Path can not be empty"),!1)}))}();if(!n)return;const l=s.value;l.endsWith("/")?this._filePath=`${l}${this.campaignId}/enriched_table.csv`:this._filePath=`${l}/${this.campaignId}/enriched_table.csv`,this._campaign&&(this._campaign.savePath=this._filePath),yield this.saveCampaign(void 0,!0),o.empty(a);const c=r();i=o.link(c,(()=>{var t,e,n;return this.download(this.dataFrame,null!==(n=null!==(t=this.campaignId)&&void 0!==t?t:null===(e=this._campaign)||void 0===e?void 0:e.name)&&void 0!==n?n:"Molecules")}),w),a.appendChild(i),a.appendChild(e)})))),u=o.button("Cancel",(()=>{o.empty(a),a.appendChild(i),a.appendChild(e)}));o.empty(a),s.addOptions(u),s.addOptions(c),a.appendChild(s.root)}),"Edit file path");e.style.marginLeft="5px";const n=r();let i=o.link(n,(()=>{var t,e,n;return this.download(this.dataFrame,null!==(n=null!==(t=this.campaignId)&&void 0!==t?t:null===(e=this._campaign)||void 0===e?void 0:e.name)&&void 0!==n?n:"Molecules")}),w);const a=o.divH([i,e],{style:{alignItems:"center"}});return a})()},l),{"Number of molecules":(this.dataFrame.rowCount-this._extraStageColsCount).toString(),"Enrichment methods":[this.template.compute.descriptors.enabled?"descriptors":"",...this.template.compute.functions.map((t=>t.name))].filter((t=>t&&""!==t.trim())).join(", ")})}saveCampaign(n,i=!0){var o,a,s,r,l,c,u,d;return Ct(this,void 0,void 0,(function*(){const p=this.campaignId,h=this.template.name,f=this.dataFrame,v=p,g={};f.columns.toList().forEach((t=>g[t.name]=t.semType));const y={name:v,templateName:h,status:null!==(a=null!=n?n:null===(o=this.campaign)||void 0===o?void 0:o.status)&&void 0!==a?a:"In Progress",createDate:null!==(r=null===(s=this.campaign)||void 0===s?void 0:s.createDate)&&void 0!==r?r:j(new Date),campaignFields:null!==(c=null===(l=this.campaign)||void 0===l?void 0:l.campaignFields)&&void 0!==c?c:this.campaignProps,columnSemTypes:g,rowCount:null!==(d=null===(u=f.col(m))||void 0===u?void 0:u.toList().filter((t=>"StageDefiningRow"!==t)).length)&&void 0!==d?d:0,filteredRowCount:f.filter.trueCount,savePath:this._filePath};console.log(this._filePath);const b=e.DataFrame.fromColumns(f.columns.toList().filter((t=>!t.name.startsWith("~")))).toCsv();yield t.dapi.files.writeAsText(this._filePath,b);const w=this._designView.saveLayout();return w?y.layout=w.viewState:t.shell.warning("Layout cound not be saved"),y.template=this.template,yield It.files.writeAsText(`Hit Design/campaigns/${p}/campaign.json`,JSON.stringify(y)),i&&t.shell.info("Campaign saved successfully."),this.campaign=y,y}))}}class Tt extends e.GridCellRenderer{get name(){return"customGasteigerPNG"}get cellType(){return"customGasteigerPNG"}get defaultHeight(){return 200}get defaultWidth(){return 200}render(t,e,n,i,o,a,s){if(a.gridRow<0||!a.cell.value)return;const r=a.cell.value,l=new Image(i-2,o-2);l.src="data:image/png;base64,"+r,l.onload=function(){t.drawImage(l,e+2,n+2,i-2,o-2)}}}var xt=function(t,e,n,i){return new(n||(n=Promise))((function(o,a){function s(t){try{l(i.next(t))}catch(t){a(t)}}function r(t){try{l(i.throw(t))}catch(t){a(t)}}function l(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,r)}l((i=i.apply(t,e||[])).next())}))};const It=new e.Package;function Nt(){return xt(this,void 0,void 0,(function*(){const e=t.functions.getCurrentCall();return new rt(e).multiView}))}function _t(){return xt(this,void 0,void 0,(function*(){const e=t.functions.getCurrentCall();return new At(e).multiView}))}function Et(){return xt(this,void 0,void 0,(function*(){const e=t.data.demo.molecules(100);return e.name="100 Molecules",e}))}function St(){return xt(this,void 0,void 0,(function*(){const e=t.data.demo.molecules(5e3);return e.name="5000 Molecules",e}))}function Ft(e){return xt(this,void 0,void 0,(function*(){const n=t.data.demo.molecules(e);return n.name="Variable Molecules number",n}))}function Bt(e,n){return xt(this,void 0,void 0,(function*(){t.shell.info(e.rowCount),t.shell.info(n)}))}function Pt(){return new Tt}})(),hittriage=i})();
|
|
1
|
+
var hittriage;(()=>{var t={553:t=>{!function(){"use strict";var e=document,n=window,i=e.documentElement,o=e.createElement.bind(e),a=o("div"),s=o("table"),r=o("tbody"),l=o("tr"),c=Array.isArray,u=Array.prototype,d=u.concat,p=u.filter,m=u.indexOf,h=u.map,f=u.push,v=u.slice,g=u.some,y=u.splice,b=/^#(?:[\w-]|\\.|[^\x00-\xa0])*$/,w=/^\.(?:[\w-]|\\.|[^\x00-\xa0])*$/,C=/<.+>/,A=/^\w+$/;function T(t,e){var n,i=!!(n=e)&&11===n.nodeType;return t&&(i||S(e)||F(e))?!i&&w.test(t)?e.getElementsByClassName(t.slice(1).replace(/\\/g,"")):!i&&A.test(t)?e.getElementsByTagName(t):e.querySelectorAll(t):[]}var x=function(){function t(t,i){if(t){if(_(t))return t;var o=t;if(O(t)){var a=i||e;if(!(o=b.test(t)&&S(a)?a.getElementById(t.slice(1).replace(/\\/g,"")):C.test(t)?X(t):_(a)?a.find(t):O(a)?N(a).find(t):T(t,a)))return}else if(P(t))return this.ready(t);(o.nodeType||o===n)&&(o=[o]),this.length=o.length;for(var s=0,r=this.length;s<r;s++)this[s]=o[s]}}return t.prototype.init=function(e,n){return new t(e,n)},t}(),I=x.prototype,N=I.init;function _(t){return t instanceof x}function E(t){return!!t&&t===t.window}function S(t){return!!t&&9===t.nodeType}function F(t){return!!t&&1===t.nodeType}function B(t){return"boolean"==typeof t}function P(t){return"function"==typeof t}function O(t){return"string"==typeof t}function k(t){return void 0===t}function V(t){return null===t}function L(t){return!isNaN(parseFloat(t))&&isFinite(t)}function D(t){if("object"!=typeof t||null===t)return!1;var e=Object.getPrototypeOf(t);return null===e||e===Object.prototype}function j(t,e,n){if(n){for(var i=t.length;i--;)if(!1===e.call(t[i],i,t[i]))return t}else if(D(t))for(var o=Object.keys(t),a=(i=0,o.length);i<a;i++){var s=o[i];if(!1===e.call(t[s],s,t[s]))return t}else for(i=0,a=t.length;i<a;i++)if(!1===e.call(t[i],i,t[i]))return t;return t}function R(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=!!B(t[0])&&t.shift(),i=t.shift(),o=t.length;if(!i)return{};if(!o)return R(n,N,i);for(var a=0;a<o;a++){var s=t[a];for(var r in s)n&&(c(s[r])||D(s[r]))?(i[r]&&i[r].constructor===s[r].constructor||(i[r]=new s[r].constructor),R(n,i[r],s[r])):i[r]=s[r]}return i}N.fn=N.prototype=I,I.length=0,I.splice=y,"function"==typeof Symbol&&(I[Symbol.iterator]=u[Symbol.iterator]),N.isWindow=E,N.isFunction=P,N.isArray=c,N.isNumeric=L,N.isPlainObject=D,N.each=j,I.each=function(t){return j(this,t)},I.empty=function(){return this.each((function(t,e){for(;e.firstChild;)e.removeChild(e.firstChild)}))},N.extend=R,I.extend=function(t){return R(I,t)};var M=/\S+/g;function H(t){return O(t)&&t.match(M)||[]}function U(t,e,i){if(F(t)){var o=n.getComputedStyle(t,null);return i?o.getPropertyValue(e)||void 0:o[e]||t.style[e]}}function $(t,e){return parseInt(U(t,e),10)||0}function Y(t,e){return $(t,"border".concat(e?"Left":"Top","Width"))+$(t,"padding".concat(e?"Left":"Top"))+$(t,"padding".concat(e?"Right":"Bottom"))+$(t,"border".concat(e?"Right":"Bottom","Width"))}I.toggleClass=function(t,e){var n=H(t),i=!k(e);return this.each((function(t,o){F(o)&&j(n,(function(t,n){i?e?o.classList.add(n):o.classList.remove(n):o.classList.toggle(n)}))}))},I.addClass=function(t){return this.toggleClass(t,!0)},I.removeAttr=function(t){var e=H(t);return this.each((function(t,n){F(n)&&j(e,(function(t,e){n.removeAttribute(e)}))}))},I.attr=function(t,e){if(t){if(O(t)){if(arguments.length<2){if(!this[0]||!F(this[0]))return;var n=this[0].getAttribute(t);return V(n)?void 0:n}return k(e)?this:V(e)?this.removeAttr(t):this.each((function(n,i){F(i)&&i.setAttribute(t,e)}))}for(var i in t)this.attr(i,t[i]);return this}},I.removeClass=function(t){return arguments.length?this.toggleClass(t,!1):this.attr("class","")},I.hasClass=function(t){return!!t&&g.call(this,(function(e){return F(e)&&e.classList.contains(t)}))},I.get=function(t){return k(t)?v.call(this):this[(t=Number(t))<0?t+this.length:t]},I.eq=function(t){return N(this.get(t))},I.first=function(){return this.eq(0)},I.last=function(){return this.eq(-1)},I.text=function(t){return k(t)?this.get().map((function(t){return F(t)||(e=t)&&3===e.nodeType?t.textContent:"";var e})).join(""):this.each((function(e,n){F(n)&&(n.textContent=t)}))};var W={};function q(t){return"none"===U(t,"display")}function G(t,e){var n=t&&(t.matches||t.webkitMatchesSelector||t.msMatchesSelector);return!!n&&!!e&&n.call(t,e)}function J(t){return O(t)?function(e,n){return G(n,t)}:P(t)?t:_(t)?function(e,n){return t.is(n)}:t?function(e,n){return n===t}:function(){return!1}}function Z(t,e){return e?t.filter(e):t}I.filter=function(t){var e=J(t);return N(p.call(this,(function(t,n){return e.call(t,n,t)})))},I.detach=function(t){return Z(this,t).each((function(t,e){e.parentNode&&e.parentNode.removeChild(e)})),this};var z=/^\s*<(\w+)[^>]*>/,K=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,Q={"*":a,tr:r,td:l,th:l,thead:s,tbody:s,tfoot:s};function X(t){if(!O(t))return[];if(K.test(t))return[o(RegExp.$1)];var e=z.test(t)&&RegExp.$1,n=Q[e]||Q["*"];return n.innerHTML=t,N(n.childNodes).detach().get()}function tt(t,e,n,i){for(var o=[],a=P(e),s=i&&J(i),r=0,l=t.length;r<l;r++)if(a){var c=e(t[r]);c.length&&f.apply(o,c)}else for(var u=t[r][e];!(null==u||i&&s(-1,u));)o.push(u),u=n?u[e]:null;return o}function et(t){return t.multiple&&t.options?tt(p.call(t.options,(function(t){return t.selected&&!t.disabled&&!t.parentNode.disabled})),"value"):t.value||""}function nt(t){return t.length>1?p.call(t,(function(t,e,n){return m.call(n,t)===e})):t}N.parseHTML=X,I.has=function(t){var e=O(t)?function(e,n){return T(t,n).length}:function(e,n){return n.contains(t)};return this.filter(e)},I.not=function(t){var e=J(t);return this.filter((function(n,i){return(!O(t)||F(i))&&!e.call(i,n,i)}))},I.val=function(t){return arguments.length?this.each((function(e,n){var i=n.multiple&&n.options;if(i||Ot.test(n.type)){var o=c(t)?h.call(t,String):V(t)?[]:[String(t)];i?j(n.options,(function(t,e){e.selected=o.indexOf(e.value)>=0}),!0):n.checked=o.indexOf(n.value)>=0}else n.value=k(t)||V(t)?"":t})):this[0]&&et(this[0])},I.is=function(t){var e=J(t);return g.call(this,(function(t,n){return e.call(t,n,t)}))},N.guid=1,N.unique=nt,I.add=function(t,e){return N(nt(this.get().concat(N(t,e).get())))},I.children=function(t){return Z(N(nt(tt(this,(function(t){return t.children})))),t)},I.parent=function(t){return Z(N(nt(tt(this,"parentNode"))),t)},I.index=function(t){var e=t?N(t)[0]:this[0],n=t?this:N(e).parent().children();return m.call(n,e)},I.closest=function(t){var e=this.filter(t);if(e.length)return e;var n=this.parent();return n.length?n.closest(t):e},I.siblings=function(t){return Z(N(nt(tt(this,(function(t){return N(t).parent().children().not(t)})))),t)},I.find=function(t){return N(nt(tt(this,(function(e){return T(t,e)}))))};var it=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,ot=/^$|^module$|\/(java|ecma)script/i,at=["type","src","nonce","noModule"];function st(t,e,n,a,s,r,l,c){return j(t,(function(t,r){j(N(r),(function(t,r){j(N(e),(function(e,l){var c=n?l:r,u=n?t:e;!function(t,e,n,a,s){a?t.insertBefore(e,n?t.firstChild:null):"HTML"===t.nodeName?t.parentNode.replaceChild(e,t):t.parentNode.insertBefore(e,n?t:t.nextSibling),s&&function(t,e){var n=N(t);n.filter("script").add(n.find("script")).each((function(t,n){if(ot.test(n.type)&&i.contains(n)){var a=o("script");a.text=n.textContent.replace(it,""),j(at,(function(t,e){n[e]&&(a[e]=n[e])})),e.head.insertBefore(a,null),e.head.removeChild(a)}}))}(e,t.ownerDocument)}(n?r:l,u?c.cloneNode(!0):c,a,s,!u)}),c)}),l)}),r),e}I.after=function(){return st(arguments,this,!1,!1,!1,!0,!0)},I.append=function(){return st(arguments,this,!1,!1,!0)},I.html=function(t){if(!arguments.length)return this[0]&&this[0].innerHTML;if(k(t))return this;var e=/<script[\s>]/.test(t);return this.each((function(n,i){F(i)&&(e?N(i).empty().append(t):i.innerHTML=t)}))},I.appendTo=function(t){return st(arguments,this,!0,!1,!0)},I.wrapInner=function(t){return this.each((function(e,n){var i=N(n),o=i.contents();o.length?o.wrapAll(t):i.append(t)}))},I.before=function(){return st(arguments,this,!1,!0)},I.wrapAll=function(t){for(var e=N(t),n=e[0];n.children.length;)n=n.firstElementChild;return this.first().before(e),this.appendTo(n)},I.wrap=function(t){return this.each((function(e,n){var i=N(t)[0];N(n).wrapAll(e?i.cloneNode(!0):i)}))},I.insertAfter=function(t){return st(arguments,this,!0,!1,!1,!1,!1,!0)},I.insertBefore=function(t){return st(arguments,this,!0,!0)},I.prepend=function(){return st(arguments,this,!1,!0,!0,!0,!0)},I.prependTo=function(t){return st(arguments,this,!0,!0,!0,!1,!1,!0)},I.contents=function(){return N(nt(tt(this,(function(t){return"IFRAME"===t.tagName?[t.contentDocument]:"TEMPLATE"===t.tagName?t.content.childNodes:t.childNodes}))))},I.next=function(t,e,n){return Z(N(nt(tt(this,"nextElementSibling",e,n))),t)},I.nextAll=function(t){return this.next(t,!0)},I.nextUntil=function(t,e){return this.next(e,!0,t)},I.parents=function(t,e){return Z(N(nt(tt(this,"parentElement",!0,e))),t)},I.parentsUntil=function(t,e){return this.parents(e,t)},I.prev=function(t,e,n){return Z(N(nt(tt(this,"previousElementSibling",e,n))),t)},I.prevAll=function(t){return this.prev(t,!0)},I.prevUntil=function(t,e){return this.prev(e,!0,t)},I.map=function(t){return N(d.apply([],h.call(this,(function(e,n){return t.call(e,n,e)}))))},I.clone=function(){return this.map((function(t,e){return e.cloneNode(!0)}))},I.offsetParent=function(){return this.map((function(t,e){for(var n=e.offsetParent;n&&"static"===U(n,"position");)n=n.offsetParent;return n||i}))},I.slice=function(t,e){return N(v.call(this,t,e))};var rt=/-([a-z])/g;function lt(t){return t.replace(rt,(function(t,e){return e.toUpperCase()}))}I.ready=function(t){var n=function(){return setTimeout(t,0,N)};return"loading"!==e.readyState?n():e.addEventListener("DOMContentLoaded",n),this},I.unwrap=function(){return this.parent().each((function(t,e){if("BODY"!==e.tagName){var n=N(e);n.replaceWith(n.children())}})),this},I.offset=function(){var t=this[0];if(t){var e=t.getBoundingClientRect();return{top:e.top+n.pageYOffset,left:e.left+n.pageXOffset}}},I.position=function(){var t=this[0];if(t){var e="fixed"===U(t,"position"),n=e?t.getBoundingClientRect():this.offset();if(!e){for(var i=t.ownerDocument,o=t.offsetParent||i.documentElement;(o===i.body||o===i.documentElement)&&"static"===U(o,"position");)o=o.parentNode;if(o!==t&&F(o)){var a=N(o).offset();n.top-=a.top+$(o,"borderTopWidth"),n.left-=a.left+$(o,"borderLeftWidth")}}return{top:n.top-$(t,"marginTop"),left:n.left-$(t,"marginLeft")}}};var ct={class:"className",contenteditable:"contentEditable",for:"htmlFor",readonly:"readOnly",maxlength:"maxLength",tabindex:"tabIndex",colspan:"colSpan",rowspan:"rowSpan",usemap:"useMap"};I.prop=function(t,e){if(t){if(O(t))return t=ct[t]||t,arguments.length<2?this[0]&&this[0][t]:this.each((function(n,i){i[t]=e}));for(var n in t)this.prop(n,t[n]);return this}},I.removeProp=function(t){return this.each((function(e,n){delete n[ct[t]||t]}))};var ut=/^--/;function dt(t){return ut.test(t)}var pt={},mt=a.style,ht=["webkit","moz","ms"];function ft(t,e){if(void 0===e&&(e=dt(t)),e)return t;if(!pt[t]){var n=lt(t),i="".concat(n[0].toUpperCase()).concat(n.slice(1));j("".concat(n," ").concat(ht.join("".concat(i," "))).concat(i).split(" "),(function(e,n){if(n in mt)return pt[t]=n,!1}))}return pt[t]}var vt={animationIterationCount:!0,columnCount:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,gridArea:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnStart:!0,gridRow:!0,gridRowEnd:!0,gridRowStart:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0};function gt(t,e,n){return void 0===n&&(n=dt(t)),n||vt[t]||!L(e)?e:"".concat(e,"px")}function yt(t,e){try{return t(e)}catch(t){return e}}I.css=function(t,e){if(O(t)){var n=dt(t);return t=ft(t,n),arguments.length<2?this[0]&&U(this[0],t,n):t?(e=gt(t,e,n),this.each((function(i,o){F(o)&&(n?o.style.setProperty(t,e):o.style[t]=e)}))):this}for(var i in t)this.css(i,t[i]);return this};var bt=/^\s+|\s+$/;function wt(t,e){var n=t.dataset[e]||t.dataset[lt(e)];return bt.test(n)?n:yt(JSON.parse,n)}function Ct(t,e,n){n=yt(JSON.stringify,n),t.dataset[lt(e)]=n}function At(t,e){var n=t.documentElement;return Math.max(t.body["scroll".concat(e)],n["scroll".concat(e)],t.body["offset".concat(e)],n["offset".concat(e)],n["client".concat(e)])}I.data=function(t,e){if(!t){if(!this[0])return;var n={};for(var i in this[0].dataset)n[i]=wt(this[0],i);return n}if(O(t))return arguments.length<2?this[0]&&wt(this[0],t):k(e)?this:this.each((function(n,i){Ct(i,t,e)}));for(var i in t)this.data(i,t[i]);return this},j([!0,!1],(function(t,e){j(["Width","Height"],(function(t,n){var i="".concat(e?"outer":"inner").concat(n);I[i]=function(i){if(this[0])return E(this[0])?e?this[0]["inner".concat(n)]:this[0].document.documentElement["client".concat(n)]:S(this[0])?At(this[0],n):this[0]["".concat(e?"offset":"client").concat(n)]+(i&&e?$(this[0],"margin".concat(t?"Top":"Left"))+$(this[0],"margin".concat(t?"Bottom":"Right")):0)}}))})),j(["Width","Height"],(function(t,e){var n=e.toLowerCase();I[n]=function(i){if(!this[0])return k(i)?void 0:this;if(!arguments.length)return E(this[0])?this[0].document.documentElement["client".concat(e)]:S(this[0])?At(this[0],e):this[0].getBoundingClientRect()[n]-Y(this[0],!t);var o=parseInt(i,10);return this.each((function(e,i){if(F(i)){var a=U(i,"boxSizing");i.style[n]=gt(n,o+("border-box"===a?Y(i,!t):0))}}))}})),I.toggle=function(t){return this.each((function(n,i){if(F(i)){var a=q(i);(k(t)?a:t)?(i.style.display=i.___cd||"",q(i)&&(i.style.display=function(t){if(W[t])return W[t];var n=o(t);e.body.insertBefore(n,null);var i=U(n,"display");return e.body.removeChild(n),W[t]="none"!==i?i:"block"}(i.tagName))):a||(i.___cd=U(i,"display"),i.style.display="none")}}))},I.hide=function(){return this.toggle(!1)},I.show=function(){return this.toggle(!0)};var Tt={focus:"focusin",blur:"focusout"},xt={mouseenter:"mouseover",mouseleave:"mouseout"},It=/^(mouse|pointer|contextmenu|drag|drop|click|dblclick)/i;function Nt(t){return xt[t]||Tt[t]||t}function _t(t){var e=t.split(".");return[e[0],e.slice(1).sort()]}function Et(t){return t.___ce=t.___ce||{}}function St(t,e){return!e||!g.call(e,(function(e){return t.indexOf(e)<0}))}function Ft(t,e,n,i,o){var a=Et(t);if(e)a[e]&&(a[e]=a[e].filter((function(a){var s=a[0],r=a[1],l=a[2];if(o&&l.guid!==o.guid||!St(s,n)||i&&i!==r)return!0;t.removeEventListener(e,l)})));else for(e in a)Ft(t,e,n,i,o)}I.trigger=function(t,n){if(O(t)){var i=_t(t),o=i[0],a=i[1],s=Nt(o);if(!s)return this;var r=It.test(s)?"MouseEvents":"HTMLEvents";(t=e.createEvent(r)).initEvent(s,!0,!0),t.namespace=a.join("."),t.___ot=o}t.___td=n;var l=t.___ot in Tt;return this.each((function(e,n){l&&P(n[t.___ot])&&(n["___i".concat(t.type)]=!0,n[t.___ot](),n["___i".concat(t.type)]=!1),n.dispatchEvent(t)}))},I.off=function(t,e,n){var i=this;if(k(t))this.each((function(t,e){(F(e)||S(e)||E(e))&&Ft(e)}));else if(O(t))P(e)&&(n=e,e=""),j(H(t),(function(t,o){var a=_t(o),s=a[0],r=a[1],l=Nt(s);i.each((function(t,i){(F(i)||S(i)||E(i))&&Ft(i,l,r,e,n)}))}));else for(var o in t)this.off(o,t[o]);return this},I.remove=function(t){return Z(this,t).detach().off(),this},I.replaceWith=function(t){return this.before(t).remove()},I.replaceAll=function(t){return N(t).replaceWith(this),this},I.on=function(t,e,n,i,o){var a=this;if(!O(t)){for(var s in t)this.on(s,e,n,t[s],o);return this}return O(e)||(k(e)||V(e)?e="":k(n)?(n=e,e=""):(i=n,n=e,e="")),P(i)||(i=n,n=void 0),i?(j(H(t),(function(t,s){var r=_t(s),l=r[0],c=r[1],u=Nt(l),d=l in xt,p=l in Tt;u&&a.each((function(t,a){if(F(a)||S(a)||E(a)){var s=function(t){if(t.target["___i".concat(t.type)])return t.stopImmediatePropagation();if((!t.namespace||St(c,t.namespace.split(".")))&&(e||!(p&&(t.target!==a||t.___ot===u)||d&&t.relatedTarget&&a.contains(t.relatedTarget)))){var r=a;if(e){for(var l=t.target;!G(l,e);){if(l===a)return;if(!(l=l.parentNode))return}r=l}Object.defineProperty(t,"currentTarget",{configurable:!0,get:function(){return r}}),Object.defineProperty(t,"delegateTarget",{configurable:!0,get:function(){return a}}),Object.defineProperty(t,"data",{configurable:!0,get:function(){return n}});var m=i.call(r,t,t.___td);o&&Ft(a,u,c,e,s),!1===m&&(t.preventDefault(),t.stopPropagation())}};s.guid=i.guid=i.guid||N.guid++,function(t,e,n,i,o){var a=Et(t);a[e]=a[e]||[],a[e].push([n,i,o]),t.addEventListener(e,o)}(a,u,c,e,s)}}))})),this):this},I.one=function(t,e,n,i){return this.on(t,e,n,i,!0)};var Bt=/\r?\n/g,Pt=/file|reset|submit|button|image/i,Ot=/radio|checkbox/i;I.serialize=function(){var t="";return this.each((function(e,n){j(n.elements||[n],(function(e,n){if(!(n.disabled||!n.name||"FIELDSET"===n.tagName||Pt.test(n.type)||Ot.test(n.type)&&!n.checked)){var i=et(n);k(i)||j(c(i)?i:[i],(function(e,i){t+=function(t,e){return"&".concat(encodeURIComponent(t),"=").concat(encodeURIComponent(e.replace(Bt,"\r\n")))}(n.name,i)}))}}))})),t.slice(1)},t.exports=N}()},631:(t,e,n)=>{"use strict";n.d(e,{Z:()=>r});var i=n(537),o=n.n(i),a=n(645),s=n.n(a)()(o());s.push([t.id,".grok-hit-triage-view .d4-grid {\n width: initial !important;\n height: initial !important;\n}\n\n.hit-triage-compute-dialog-pane-header {\n display: flex;\n align-items: center;\n justify-content: end;\n}\n\n.hit-triage-compute-dialog-host>.d4-tab-host.d4-tab-vertical>.d4-tab-header-stripe>.d4-tab-header.hit-triage-compute-dialog-pane-header {\n border: none;\n border-left: 4px solid transparent;\n border-radius: 1px;\n padding: 4px 8px;\n min-height: 28px;\n justify-content: flex-end;\n flex-direction: row-reverse;\n}\n\n.hit-triage-compute-dialog-host>.d4-tab-host.d4-tab-vertical>.d4-tab-header-stripe>.d4-tab-header.hit-triage-compute-dialog-pane-header.selected {\n border-left: 4px solid var(--blue-1);\n background-color: #f2f2f5;\n}\n\n.hit-triage-compute-dialog-host>.d4-tab-host.d4-tab-vertical>.d4-tab-header-stripe>.d4-tab-header.hit-triage-compute-dialog-pane-header>span {\n padding: 0 4px;\n}\n\ntable.hit-triage-table {\n margin: 10px;\n width: calc(100% - 20px);\n}\n\n.hit-triage-table-container {\n max-width: 600px;\n max-height: 500px;\n overflow-y: scroll;\n}\n\n.hit-triage-error-div {\n color: red;\n text-align: start;\n}\n\n.mx-5 {\n margin-left: 5px;\n margin-right: 5px;\n}\n\n.hit-triage-new-template-functions-input > .ui-box {\n height: 300px;\n}\n\n.hit-triage-new-template-functions-input {\n max-height: 200px;\n max-width: unset !important;\n overflow-y: scroll;\n}\n\n\n.hit-triage-new-template-functions-input > .d4-tab-host {\n width: 100% !important;\n}\n\n.hit-triage-compute-dialog-host {\n max-height: 550px;\n max-width: 500px;\n}\n\n.hit-triage-compute-dialog-descriptors-group {\n margin-left: 16px;\n}\n\n.oy-scroll {\n overflow-y: scroll;\n}\n\n.d4-ribbon-name .ui-breadcrumbs {\n\toverflow: hidden;\n white-space: nowrap;\n text-overflow: ellipsis;\n\tflex-wrap: nowrap;\n padding: 0;\n}\n\n.d4-ribbon-name .ui-breadcrumbs i {\n\tpadding: 0 6px;\n\tfont-size: 10px;\n\tfont-weight: bold;\n}\n\n.d4-ribbon-name .ui-breadcrumbs-element:first-child {\n\twhite-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}","",{version:3,sources:["webpack://./css/hit-triage.css"],names:[],mappings:"AAAA;IACI,yBAAyB;IACzB,0BAA0B;AAC9B;;AAEA;IACI,aAAa;IACb,mBAAmB;IACnB,oBAAoB;AACxB;;AAEA;IACI,YAAY;IACZ,kCAAkC;IAClC,kBAAkB;IAClB,gBAAgB;IAChB,gBAAgB;IAChB,yBAAyB;IACzB,2BAA2B;AAC/B;;AAEA;IACI,oCAAoC;IACpC,yBAAyB;AAC7B;;AAEA;IACI,cAAc;AAClB;;AAEA;IACI,YAAY;IACZ,wBAAwB;AAC5B;;AAEA;IACI,gBAAgB;IAChB,iBAAiB;IACjB,kBAAkB;AACtB;;AAEA;IACI,UAAU;IACV,iBAAiB;AACrB;;AAEA;IACI,gBAAgB;IAChB,iBAAiB;AACrB;;AAEA;IACI,aAAa;AACjB;;AAEA;IACI,iBAAiB;IACjB,2BAA2B;IAC3B,kBAAkB;AACtB;;;AAGA;IACI,sBAAsB;AAC1B;;AAEA;IACI,iBAAiB;IACjB,gBAAgB;AACpB;;AAEA;IACI,iBAAiB;AACrB;;AAEA;IACI,kBAAkB;AACtB;;AAEA;CACC,gBAAgB;IACb,mBAAmB;IACnB,uBAAuB;CAC1B,iBAAiB;IACd,UAAU;AACd;;AAEA;CACC,cAAc;CACd,eAAe;CACf,iBAAiB;AAClB;;AAEA;CACC,mBAAmB;IAChB,gBAAgB;IAChB,uBAAuB;AAC3B",sourcesContent:[".grok-hit-triage-view .d4-grid {\n width: initial !important;\n height: initial !important;\n}\n\n.hit-triage-compute-dialog-pane-header {\n display: flex;\n align-items: center;\n justify-content: end;\n}\n\n.hit-triage-compute-dialog-host>.d4-tab-host.d4-tab-vertical>.d4-tab-header-stripe>.d4-tab-header.hit-triage-compute-dialog-pane-header {\n border: none;\n border-left: 4px solid transparent;\n border-radius: 1px;\n padding: 4px 8px;\n min-height: 28px;\n justify-content: flex-end;\n flex-direction: row-reverse;\n}\n\n.hit-triage-compute-dialog-host>.d4-tab-host.d4-tab-vertical>.d4-tab-header-stripe>.d4-tab-header.hit-triage-compute-dialog-pane-header.selected {\n border-left: 4px solid var(--blue-1);\n background-color: #f2f2f5;\n}\n\n.hit-triage-compute-dialog-host>.d4-tab-host.d4-tab-vertical>.d4-tab-header-stripe>.d4-tab-header.hit-triage-compute-dialog-pane-header>span {\n padding: 0 4px;\n}\n\ntable.hit-triage-table {\n margin: 10px;\n width: calc(100% - 20px);\n}\n\n.hit-triage-table-container {\n max-width: 600px;\n max-height: 500px;\n overflow-y: scroll;\n}\n\n.hit-triage-error-div {\n color: red;\n text-align: start;\n}\n\n.mx-5 {\n margin-left: 5px;\n margin-right: 5px;\n}\n\n.hit-triage-new-template-functions-input > .ui-box {\n height: 300px;\n}\n\n.hit-triage-new-template-functions-input {\n max-height: 200px;\n max-width: unset !important;\n overflow-y: scroll;\n}\n\n\n.hit-triage-new-template-functions-input > .d4-tab-host {\n width: 100% !important;\n}\n\n.hit-triage-compute-dialog-host {\n max-height: 550px;\n max-width: 500px;\n}\n\n.hit-triage-compute-dialog-descriptors-group {\n margin-left: 16px;\n}\n\n.oy-scroll {\n overflow-y: scroll;\n}\n\n.d4-ribbon-name .ui-breadcrumbs {\n\toverflow: hidden;\n white-space: nowrap;\n text-overflow: ellipsis;\n\tflex-wrap: nowrap;\n padding: 0;\n}\n\n.d4-ribbon-name .ui-breadcrumbs i {\n\tpadding: 0 6px;\n\tfont-size: 10px;\n\tfont-weight: bold;\n}\n\n.d4-ribbon-name .ui-breadcrumbs-element:first-child {\n\twhite-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}"],sourceRoot:""}]);const r=s},290:(t,e,n)=>{"use strict";n.d(e,{Z:()=>r});var i=n(537),o=n.n(i),a=n(645),s=n.n(a)()(o());s.push([t.id,".ui-app-header {\n\n}\n\n.ui-app-header-icon {\n width: 150px;\n height: 150px;\n margin-right: 20px;\n}\n\n.u2-panel {\n gap: 10px;\n}","",{version:3,sources:["webpack://./node_modules/@datagrok-libraries/utils/src/u2.css"],names:[],mappings:"AAAA;;AAEA;;AAEA;IACI,YAAY;IACZ,aAAa;IACb,kBAAkB;AACtB;;AAEA;IACI,SAAS;AACb",sourcesContent:[".ui-app-header {\n\n}\n\n.ui-app-header-icon {\n width: 150px;\n height: 150px;\n margin-right: 20px;\n}\n\n.u2-panel {\n gap: 10px;\n}"],sourceRoot:""}]);const r=s},143:(t,e,n)=>{"use strict";n.d(e,{Z:()=>r});var i=n(537),o=n.n(i),a=n(645),s=n.n(a)()(o());s.push([t.id,"img[alt='hitDesignReadmeImg'] {\n max-width: 100%;\n}","",{version:3,sources:["webpack://./src/app/hit-design-views/utils.css"],names:[],mappings:"AAAA;IACI,eAAe;AACnB",sourcesContent:["img[alt='hitDesignReadmeImg'] {\n max-width: 100%;\n}"],sourceRoot:""}]);const r=s},645:t=>{"use strict";t.exports=function(t){var e=[];return e.toString=function(){return this.map((function(e){var n="",i=void 0!==e[5];return e[4]&&(n+="@supports (".concat(e[4],") {")),e[2]&&(n+="@media ".concat(e[2]," {")),i&&(n+="@layer".concat(e[5].length>0?" ".concat(e[5]):""," {")),n+=t(e),i&&(n+="}"),e[2]&&(n+="}"),e[4]&&(n+="}"),n})).join("")},e.i=function(t,n,i,o,a){"string"==typeof t&&(t=[[null,t,void 0]]);var s={};if(i)for(var r=0;r<this.length;r++){var l=this[r][0];null!=l&&(s[l]=!0)}for(var c=0;c<t.length;c++){var u=[].concat(t[c]);i&&s[u[0]]||(void 0!==a&&(void 0===u[5]||(u[1]="@layer".concat(u[5].length>0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=a),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),o&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=o):u[4]="".concat(o)),e.push(u))}},e}},537:t=>{"use strict";t.exports=function(t){var e=t[1],n=t[3];if(!n)return e;if("function"==typeof btoa){var i=btoa(unescape(encodeURIComponent(JSON.stringify(n)))),o="sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(i),a="/*# ".concat(o," */");return[e].concat([a]).join("\n")}return[e].join("\n")}},379:t=>{"use strict";var e=[];function n(t){for(var n=-1,i=0;i<e.length;i++)if(e[i].identifier===t){n=i;break}return n}function i(t,i){for(var a={},s=[],r=0;r<t.length;r++){var l=t[r],c=i.base?l[0]+i.base:l[0],u=a[c]||0,d="".concat(c," ").concat(u);a[c]=u+1;var p=n(d),m={css:l[1],media:l[2],sourceMap:l[3],supports:l[4],layer:l[5]};if(-1!==p)e[p].references++,e[p].updater(m);else{var h=o(m,i);i.byIndex=r,e.splice(r,0,{identifier:d,updater:h,references:1})}s.push(d)}return s}function o(t,e){var n=e.domAPI(e);return n.update(t),function(e){if(e){if(e.css===t.css&&e.media===t.media&&e.sourceMap===t.sourceMap&&e.supports===t.supports&&e.layer===t.layer)return;n.update(t=e)}else n.remove()}}t.exports=function(t,o){var a=i(t=t||[],o=o||{});return function(t){t=t||[];for(var s=0;s<a.length;s++){var r=n(a[s]);e[r].references--}for(var l=i(t,o),c=0;c<a.length;c++){var u=n(a[c]);0===e[u].references&&(e[u].updater(),e.splice(u,1))}a=l}}},569:t=>{"use strict";var e={};t.exports=function(t,n){var i=function(t){if(void 0===e[t]){var n=document.querySelector(t);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(t){n=null}e[t]=n}return e[t]}(t);if(!i)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");i.appendChild(n)}},216:t=>{"use strict";t.exports=function(t){var e=document.createElement("style");return t.setAttributes(e,t.attributes),t.insert(e,t.options),e}},565:(t,e,n)=>{"use strict";t.exports=function(t){var e=n.nc;e&&t.setAttribute("nonce",e)}},795:t=>{"use strict";t.exports=function(t){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var e=t.insertStyleElement(t);return{update:function(n){!function(t,e,n){var i="";n.supports&&(i+="@supports (".concat(n.supports,") {")),n.media&&(i+="@media ".concat(n.media," {"));var o=void 0!==n.layer;o&&(i+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),i+=n.css,o&&(i+="}"),n.media&&(i+="}"),n.supports&&(i+="}");var a=n.sourceMap;a&&"undefined"!=typeof btoa&&(i+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(a))))," */")),e.styleTagTransform(i,t,e.options)}(e,t,n)},remove:function(){!function(t){if(null===t.parentNode)return!1;t.parentNode.removeChild(t)}(e)}}}},589:t=>{"use strict";t.exports=function(t,e){if(e.styleSheet)e.styleSheet.cssText=t;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(t))}}}},e={};function n(i){var o=e[i];if(void 0!==o)return o.exports;var a=e[i]={id:i,exports:{}};return t[i](a,a.exports,n),a.exports}n.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return n.d(e,{a:e}),e},n.d=(t,e)=>{for(var i in e)n.o(e,i)&&!n.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),n.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.nc=void 0;var i={};(()=>{"use strict";n.r(i),n.d(i,{_package:()=>It,demoFileIngest:()=>Et,demoFileIngest1:()=>St,demoFileIngest2:()=>Ft,demoFileSubmit:()=>Bt,gasteigerCellRenderer:()=>Pt,hitDesignApp:()=>_t,hitTriageApp:()=>Nt});const t=grok,e=DG,o=ui,a="campaignId",s="campaignId",r="HitTriageFunction",l="HitTriageDataSource",c="HitTriageSubmitFunction",u="Selected hits",d="Stage",p="Molecule",m="V-iD",h="V######",f="HTScript",v="Source",g="New template",y="Start",b="Create",w="Download",C="Cancel",A="Continue a campaign",T="New campaign";var x=n(379),I=n.n(x),N=n(795),_=n.n(N),E=n(569),S=n.n(E),F=n(565),B=n.n(F),P=n(216),O=n.n(P),k=n(589),V=n.n(k),L=n(631),D={};D.styleTagTransform=V(),D.setAttributes=B(),D.insert=S().bind(null,"head"),D.domAPI=_(),D.insertStyleElement=O(),I()(L.Z,D),L.Z&&L.Z.locals&&L.Z.locals;const j=t=>`${t.getFullYear()}/${t.getMonth()+1}/${t.getDate()}`;function R(t,e){const n=document.title,i=window.location.href.split("?")[0]+"?"+t+"="+e;if(history.replaceState){const t={Title:n,Url:i};history.replaceState(t,t.Title,t.Url)}}function M(e,n,i,a){var s;const r=o.breadcrumbs([n,i]),l=r.onPathClick.subscribe((t=>{1===t.length&&(l.unsubscribe(),H(e),a())})),c=null===(s=t.shell.v.ribbonMenu.root.parentElement)||void 0===s?void 0:s.getElementsByClassName("d4-ribbon-name")[0];return c&&(c.textContent="",c.appendChild(r.root)),{breadcrumbs:r,sub:l}}function H(t){const e=t.getRibbonPanels();(null==e?void 0:e.length)&&(e.pop(),t.setRibbonPanels(e))}function U(t){return t.reduce(((t,e)=>t||e.reduce(((t,e)=>t||e.classList.contains("hit-design-submit-button")||Array.from(e.children).some((t=>t.classList.contains("hit-design-submit-button")))),!1)),!1)}const $={String:e.TYPE.STRING,Number:e.TYPE.FLOAT,Boolean:e.TYPE.BOOL,Date:e.TYPE.DATE_TIME,Molecule:e.SEMTYPE.MOLECULE};var Y=function(t,e,n,i){return new(n||(n=Promise))((function(o,a){function s(t){try{l(i.next(t))}catch(t){a(t)}}function r(t){try{l(i.throw(t))}catch(t){a(t)}}function l(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,r)}l((i=i.apply(t,e||[])).next())}))},W=n(553),q=n.n(W);function G(n,i,a,s){var l,c,u,d,p,m,h,v,g,y,b,w,C,A,T,x,I,N,_,E,S,F,B,P,O;return F=this,B=void 0,O=function*(){const F=e.Func.find({tags:[r]}).filter((({inputs:t})=>t.length>2&&"dataframe"===t[0].propertyType&&"column"===t[1].propertyType)).map((t=>{var e,n,i,o;return{package:t.package.name,name:t.name,args:null!==(o=null===(i=null===(n=null===(e=null==a?void 0:a.compute)||void 0===e?void 0:e.functions)||void 0===n?void 0:n.find((e=>e.name===t.name&&e.package===t.package.name)))||void 0===i?void 0:i.args)&&void 0!==o?o:{}}})),B=(yield t.dapi.scripts.include("params").filter("#HitTriageFunction").list()).filter((({inputs:t})=>t.length>2&&"dataframe"===t[0].propertyType&&"column"===t[1].propertyType)).map((t=>{var e,n,i,o;return{name:t.name,id:t.id,args:null!==(o=null===(i=null===(n=null===(e=null==a?void 0:a.compute)||void 0===e?void 0:e.scripts)||void 0===n?void 0:n.find((e=>e.id===t.id)))||void 0===i?void 0:i.args)&&void 0!==o?o:{}}})),P=!!(null===(c=null===(l=null==a?void 0:a.compute)||void 0===l?void 0:l.descriptors)||void 0===c?void 0:c.enabled)||s,O=yield t.chem.descriptorsTree(),k=o.tree();k.root.classList.add("hit-triage-compute-dialog-descriptors-group");const V=o.div([],{classes:"hit-triage-compute-dialog-host"}),L=[];function D(t,e){const n=e.group(t,null,!1);return n.enableCheckBox(!1),n}const j=Object.keys(O),R=null!==(p=null===(d=null===(u=null==a?void 0:a.compute)||void 0===u?void 0:u.descriptors)||void 0===d?void 0:d.args)&&void 0!==p?p:[];for(const t of j){const e=D(t,k);for(const n of O[t].descriptors){const t=e.item(n.name,n);L.push(t),t.enableCheckBox(R.includes(n.name))}}const M="Descriptors",H={[M]:M},U=P?{[M]:k.root}:{},$={},Y={[M]:!1};Y.Descriptors=!!(null===(h=null===(m=null==a?void 0:a.compute)||void 0===m?void 0:m.descriptors)||void 0===h?void 0:h.enabled)&&(null===(y=null===(g=null===(v=null==a?void 0:a.compute)||void 0===v?void 0:v.descriptors)||void 0===g?void 0:g.args)||void 0===y?void 0:y.length)>0;for(const t of F){const n=e.Func.find({package:t.package,name:t.name})[0],i=n.prepare(t.args),s=`${t.package}:${t.name}`;$[s]=i;const r=o.div(),l=yield i.buildEditor(r,{condensed:!1});r.classList.add("oy-scroll"),r.style.marginLeft="15px",U[null!==(b=n.friendlyName)&&void 0!==b?b:n.name]=r,H[null!==(w=n.friendlyName)&&void 0!==w?w:n.name]=s,Y[s]=null!==(T=null===(A=null===(C=null==a?void 0:a.compute)||void 0===C?void 0:C.functions)||void 0===A?void 0:A.some((e=>e.name===t.name&&e.package===t.package)))&&void 0!==T&&T,r.children[0].style.display="none",r.children[1].style.display="none",l.forEach((e=>{var n,i;(null===(n=e.property)||void 0===n?void 0:n.name)&&Object.keys(t.args).includes(null===(i=e.property)||void 0===i?void 0:i.name)&&(e.value=t.args[e.property.name]),e.fireChanged()}))}for(const e of B)try{const n=yield t.dapi.scripts.find(e.id),i=n.prepare(e.args),s=`HTScript:${null!==(x=e.name)&&void 0!==x?x:""}:${e.id}`;$[s]=i;const r=o.div(),l=yield i.buildEditor(r,{condensed:!1});r.classList.add("oy-scroll"),r.style.marginLeft="15px",U[null!==(I=n.friendlyName)&&void 0!==I?I:n.name]=r,H[null!==(N=n.friendlyName)&&void 0!==N?N:n.name]=s,Y[s]=null!==(S=null===(E=null===(_=null==a?void 0:a.compute)||void 0===_?void 0:_.scripts)||void 0===E?void 0:E.some((t=>t.id===e.id)))&&void 0!==S&&S,r.children[0].style.display="none",r.children[1].style.display="none",l.forEach((t=>{var n,i;(null===(n=t.property)||void 0===n?void 0:n.name)&&Object.keys(e.args).includes(null===(i=t.property)||void 0===i?void 0:i.name)&&(t.value=e.args[t.property.name]),t.fireChanged()}))}catch(t){console.error(t);continue}const W=o.tabControl(U,!0);function G(){const t={descriptors:[],externals:{},scripts:{}};t.descriptors=Y.Descriptors?L.filter((t=>t.checked)).map((t=>t.value.name)):[];const e=Object.entries($).filter((([t,e])=>Y[t]));e.filter((([t,e])=>!t.startsWith(f))).forEach((([e,n])=>{t.externals[e]={};const i=n.inputs;Object.entries(i).slice(2).forEach((([n,i])=>{t.externals[e][n]=i}))})),e.filter((([t,e])=>t.startsWith(f))).forEach((([e,n])=>{t.scripts[e]={};const i=n.inputs;Object.entries(i).slice(2).forEach((([n,i])=>{t.scripts[e][n]=i}))})),console.log(t),n(t)}return V.appendChild(W.root),W.panes.forEach((t=>{const e=o.boolInput("",Y[H[t.name]],(n=>{Y[H[t.name]]=!!e.value,n?q()(t.content).find("input").removeAttr("disabled"):q()(t.content).find("input").attr("disabled","true")}));e.setTooltip("Toggle calculation of this function"),t.header.appendChild(e.root),t.header.classList.add("hit-triage-compute-dialog-pane-header")})),s&&o.dialog("Compute").add(V).onOK((()=>G())).onCancel(i).show(),{root:V,okProxy:G}},new((P=void 0)||(P=Promise))((function(t,e){function n(t){try{o(O.next(t))}catch(t){e(t)}}function i(t){try{o(O.throw(t))}catch(t){e(t)}}function o(e){var o;e.done?t(e.value):(o=e.value,o instanceof P?o:new P((function(t){t(o)}))).then(n,i)}o((O=O.apply(F,B||[])).next())}))}const J=rxjs;class Z{constructor(t,e=[],n={}){this.onItemChanged=new J.Subject,this.onAddingItemChanged=new J.Subject,this.onItemAdded=new J.Subject,this.onItemRemoved=new J.Subject,this.options={removeButtonTooltip:"Remove item",addButtonTooltip:"Add item",allowAdd:!0,allowRemove:!0},this.properties=t,this.options=Object.assign(Object.assign({},this.options),n),this._root=o.divV([],{style:{display:"grid",gridTemplateColumns:`repeat(${this.properties.length}, 1fr)`,alignItems:"center",gap:"12px"},classes:"ui-items-grid"}),this._items=e,this.render()}get root(){return this._root}get items(){return this._items}render(){var t,e,n,i;if(o.empty(this._root),!this.options.horizontalInputNames)for(const e of this.properties){const n=o.divText(null!==(t=e.caption)&&void 0!==t?t:e.name);n.style.fontWeight="bold",this._root.appendChild(n)}for(const t of this._items){const e=this.getItemDiv(t);for(const t of e)this._root.appendChild(t)}if(this.options.allowAdd){const t=this.getItemDiv(null!==(i=null===(n=(e=this.options).newItemFunction)||void 0===n?void 0:n.call(e))&&void 0!==i?i:void 0,!0);for(const e of t)this._root.appendChild(e)}}getItemDiv(t={},n){var i;const a=[],s={};let r=null;for(const l of this.properties){void 0===t[l.name]&&(t[l.name]=null);const c=(null===(i=this.options.customInputs)||void 0===i?void 0:i[l.name])?this.options.customInputs[l.name](t):o.input.forProperty(l,t);a.push(this.options.horizontalInputNames?c.root:this.hideLabel(c.root)),l.propertyType!==e.TYPE.BOOL&&"color"!==l.name.toLowerCase()&&c.input&&(c.input.style.width="100%"),s[l.name]=c,c.onChanged((()=>{t[l.name]=c.value,n?this.onAddingItemChanged.next({item:t,fieldName:l.name}):this.onItemChanged.next({item:t,fieldName:l.name})})),c.root.style.alignItems="center",r=c}let l=null;if(n)l=o.icons.add((()=>{const t=this.options.newItemFunction?this.options.newItemFunction():{};Object.keys(s).forEach((e=>{t[e]=s[e].value})),this._items.push(t),this.onItemAdded.next(t),this.render()}),this.options.addButtonTooltip);else{if(!this.options.allowRemove)return a;l=o.icons.delete((()=>{this._items.splice(this._items.indexOf(t),1),this.onItemRemoved.next(t),this.render()}),this.options.removeButtonTooltip)}return r&&r.addOptions?r.addOptions(l):null==r||r.root.appendChild(l),l.style.color="#2083d5",a}hideLabel(t){return t.getElementsByTagName("label")[0]&&t.removeChild(t.getElementsByTagName("label")[0]),t}}var z=function(t,e,n,i){return new(n||(n=Promise))((function(o,a){function s(t){try{l(i.next(t))}catch(t){a(t)}}function r(t){try{l(i.throw(t))}catch(t){a(t)}}function l(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,r)}l((i=i.apply(t,e||[])).next())}))};function K(){var n,i;return z(this,void 0,void 0,(function*(){const a=e.Func.find({tags:[r]}),s=(yield It.files.list("Hit Triage/templates")).map((t=>t.name.slice(0,-5))),u=[];for(const t of s){const e=JSON.parse(yield It.files.readAsText(`Hit Triage/templates/${t}.json`));u.push(e.key)}const d=e.Func.find({tags:[c]}),p={};d.forEach((t=>{var e;p[null!==(e=t.friendlyName)&&void 0!==e?e:t.name]=t}));const m=o.choiceInput("Submit function",null,[null,...Object.keys(p)]);m.value=null,m.nullable=!0,m.setTooltip("Select function to be called upon submitting");const h=o.divText("Template name is empty or already exists",{classes:"hit-triage-error-div"}),g=o.divText("Template key is empty or already exists",{classes:"hit-triage-error-div"}),y=o.stringInput("Name","",(()=>{""===y.value||s.includes(y.value)?(y.root.style.borderBottom="1px solid red",h.style.opacity="100%"):(y.root.style.borderBottom="none",h.style.opacity="0%")})),w=o.stringInput("Key","",(()=>{""===w.value||u.includes(w.value)?(w.root.style.borderBottom="1px solid red",g.style.opacity="100%"):(w.root.style.borderBottom="none",g.style.opacity="0%")}));w.setTooltip("Template key used for campaign prefix"),y.setTooltip("Template name"),y.root.style.borderBottom="none",w.root.style.borderBottom="none",h.style.opacity="0%",g.style.opacity="0%";const A={Descriptors:"Descriptors"};a.forEach((t=>{var e;A[null!==(e=t.friendlyName)&&void 0!==e?e:t.name]=`${t.package.name}:${t.name}`}));let T=null;const x=yield G((t=>{T=t}),(()=>null),{compute:{descriptors:{enabled:!0,args:[]},functions:[]}},!1);x.root.classList.add("hit-triage-new-template-functions-input");const I=e.Func.find({tags:[l]}),N={};I.forEach((t=>{var e;N[null!==(e=t.friendlyName)&&void 0!==e?e:t.name]=t}));const _=o.choiceInput(v,Object.keys(N)[0],Object.keys(N)),E=o.choiceInput("Ingest using","Query",["Query","File"],(()=>{"Query"!==E.value?_.root.style.display="none":_.root.style.display="block"})),S=Q(),F=o.div([o.h2("Details"),o.div([y,h]),o.div([w,g]),E.root,_.root,S.fieldsDiv,o.h2("Compute"),x.root,o.h2("Submit"),m.root],"ui-form"),B=o.buttonsInput([]),P=null!==(i=null===(n=B.getElementsByClassName("ui-input-editor"))||void 0===n?void 0:n[0])&&void 0!==i?i:B;F.appendChild(B);const O=new Promise((t=>{const e=o.button(C,(()=>t()));P.appendChild(e)})),k=new Promise((e=>{const n=o.bigButton(b,(()=>function(){var n,i,o,a,s,r;return z(this,void 0,void 0,(function*(){if(x.okProxy(),"100%"===h.style.opacity)return void t.shell.error("Template name is empty or already exists");const l=m.value?p[m.value]:void 0,c=Object.assign(Object.assign({name:y.value,key:w.value,campaignFields:S.getFields(),dataSourceType:null!==(n=E.value)&&void 0!==n?n:"Query",compute:{descriptors:{enabled:!!(null===(i=null==T?void 0:T.descriptors)||void 0===i?void 0:i.length),args:null!==(o=null==T?void 0:T.descriptors)&&void 0!==o?o:[]},functions:Object.entries(null!==(a=null==T?void 0:T.externals)&&void 0!==a?a:{}).map((([t,e])=>{const n=t.split(":");return{name:n[1],package:n[0],args:e}})),scripts:Object.entries(null!==(s=null==T?void 0:T.scripts)&&void 0!==s?s:{}).filter((([t,e])=>t.startsWith(f)&&3===t.split(":").length)).map((([t,e])=>{var n,i;const o=t.split(":");return{name:null!==(n=o[1])&&void 0!==n?n:"",id:null!==(i=o[2])&&void 0!==i?i:"",args:e}}))}},l?{submit:{fName:l.name,package:l.package.name}}:{}),{queryFunctionName:"Query"===E.value&&null!==(r=_.value)&&void 0!==r?r:void 0});var u;u=c,It.files.writeAsText(`Hit Triage/templates/${u.name}.json`,JSON.stringify(u)),t.shell.info("Template created successfully"),e(c)}))}()));P.appendChild(n)}));return{root:F,template:k,cancelPromise:O}}))}function Q(t){const n=[e.Property.fromOptions({name:"Name",type:e.TYPE.STRING}),e.Property.fromOptions({name:"Type",type:e.TYPE.STRING,choices:Object.keys($)}),e.Property.fromOptions({name:"Required",type:e.TYPE.BOOL})],i=new Z(n,t?t.map((t=>({Name:t.name,Type:t.type,Required:t.required}))):void 0,{horizontalInputNames:!1});i.root.style.maxWidth="750px";let a={};i.onItemAdded.subscribe((t=>{a=null!=t?t:{}})),i.onAddingItemChanged.subscribe((t=>{t&&(a=t.item)}));const s=o.h2("Additional fields");o.tooltip.bind(s,"Additional fields to be filled by user for each campaign");const r=o.div([s,i.root]);return{getFields:function(){var t;const e=i.items.filter((t=>t.Name)).map((t=>{var e;return{name:t.Name,type:t.Type,required:null!==(e=t.Required)&&void 0!==e&&e}}));return a.Name&&""!==a.Name&&a.Type&&(null!==(t=a.Required)&&void 0!==t||(a.Required=!1),e.push({name:a.Name,type:a.Type,required:a.Required})),e},fieldsDiv:o.div([r])}}var X=function(t,e,n,i){return new(n||(n=Promise))((function(o,a){function s(t){try{l(i.next(t))}catch(t){a(t)}}function r(t){try{l(i.throw(t))}catch(t){a(t)}}function l(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,r)}l((i=i.apply(t,e||[])).next())}))};class tt extends e.ViewBase{constructor(t){super(),this.app=t}get template(){return this.app.template}onActivated(){}onReset(){}process(){return X(this,void 0,void 0,(function*(){}))}deleteCampaign(t,e){return X(this,void 0,void 0,(function*(){yield It.files.delete(`${t}/campaigns/${e}`)}))}}var et=function(t,e,n,i){return new(n||(n=Promise))((function(o,a){function s(t){try{l(i.next(t))}catch(t){a(t)}}function r(t){try{l(i.throw(t))}catch(t){a(t)}}function l(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,r)}l((i=i.apply(t,e||[])).next())}))};class nt extends tt{constructor(e){super(e),this.readmePath=It.webRoot+"README_HT.md",this.deletedCampaigns=[],this.name="Hit Triage",t.shell.windows.showHelp=!0,t.shell.windows.help.showHelp(this.readmePath),this.checkCampaign().then((t=>{this.app.campaign=t,this.init()}))}onActivated(){t.shell.windows.showHelp=!0,t.shell.windows.help.showHelp(this.readmePath)}init(t){return et(this,void 0,void 0,(function*(){const e=o.h1(A),n=o.h1(T,{style:{marginLeft:"10px"}}),i=o.div([o.h1("Process, analyse and filter molecules for your needs using Hit Triage:"),o.div(o.markdown("- Configure your own workflow using the template editor.\n- Calculate different molecular properties.\n- Filter molecules using different criteria.\n- Submit processed dataframe to the function of your choice.\n- Save campaigns and continue any time from where you left off.\n "),{style:{color:"var(--grey-5)"},classes:"mb-small"}),o.link("Read more","https://github.com/datagrok-ai/public/tree/master/packages/HitTriage")]),a=o.div(),s=o.div([],{classes:"ui-form"}),r=yield this.getCampaignsTable();q()(this.root).empty(),this.root.appendChild(o.div([i,e,r,n,s,a])),this.startNewCampaign(a,s,t).then((()=>this.app.resetBaseUrl()))}))}startNewCampaign(t,e,n){var i;return et(this,void 0,void 0,(function*(){const a=(yield It.files.list("Hit Triage/templates")).map((t=>t.name.slice(0,-5)));n&&!a.includes(n.name)&&a.push(n.name);const s=()=>et(this,void 0,void 0,(function*(){const e=r.value,i=n&&n.name===e?n:JSON.parse(yield It.files.readAsText("Hit Triage/templates/"+e+".json")),o=yield this.getNewCampaignAccordeon(i);q()(t).empty(),t.className="ui-form",t.appendChild(o)})),r=o.choiceInput("Template",null!==(i=null==n?void 0:n.name)&&void 0!==i?i:a[0],a,(()=>et(this,void 0,void 0,(function*(){yield s()})))),l=o.icons.add((()=>{this.createNewTemplate()}),g);r.addOptions(l),yield s(),q()(e).empty(),e.appendChild(r.root)}))}checkCampaign(t){return et(this,void 0,void 0,(function*(){const e=location.search,n=new URLSearchParams(e);if(!n.has(a)&&!t)return;const i=null!=t?t:n.get(a);if(!(yield It.files.exists(`Hit Triage/campaigns/${i}/campaign.json`)))return;const o=JSON.parse(yield It.files.readAsText(`Hit Triage/campaigns/${i}/campaign.json`)),s=JSON.parse(yield It.files.readAsText(`Hit Triage/templates/${o.templateName}.json`));return this.app.setTemplate(s,o.filters,i,o.ingest),t&&R(a,t),o}))}getCampaignsTable(){return et(this,void 0,void 0,(function*(){const t=(yield It.files.list("Hit Triage/campaigns")).filter((t=>-1===this.deletedCampaigns.indexOf(t.name))),e={};for(const n of t){const t=JSON.parse(yield It.files.readAsText(`Hit Triage/campaigns/${n.name}/campaign.json`));e[t.name]=t}const n=Object.values(e).map((t=>({name:t.name,createDate:t.createDate,rowCount:t.rowCount,filtered:t.filteredRowCount,status:t.status}))),i=o.table(n,(t=>[o.link(t.name,(()=>this.setCampaign(t.name)),"",""),t.createDate,t.rowCount,t.filtered,t.status,o.icons.delete((()=>et(this,void 0,void 0,(function*(){o.dialog("Delete campaign").add(o.divText(`Are you sure you want to delete campaign ${t.name}?`)).onOK((()=>et(this,void 0,void 0,(function*(){yield this.deleteCampaign("Hit Triage",t.name),this.deletedCampaigns.push(t.name),yield this.init()})))).show()}))),"Delete campaign")]),["Name","Created","Total","Selected","Status",""]);return i.style.color="var(--grey-5)",i}))}setCampaign(t){return et(this,void 0,void 0,(function*(){const e=yield this.checkCampaign(t);this.app.campaign=e}))}getNewCampaignAccordeon(n){return et(this,void 0,void 0,(function*(){const{root:i,promise:a,cancelPromise:s}=function(n){var i,a;const s=o.divText("",{style:{color:"red"}});let r=null;const c=()=>Y(this,void 0,void 0,(function*(){try{if(r=u.value,!r)return;if(yield r.meta.detectSemanticTypes(),!r.columns.bySemType(e.SEMTYPE.MOLECULE))return void(s.innerText="No molecules column found");s.innerText=""}catch(t){s.innerText="Error parsing file"}})),u=o.tableInput("Dataframe",null,void 0,c);c();const d=o.div([u,s]),p=e.Func.find({tags:[l]}),m={};p.forEach((t=>{var e;m[null!==(e=t.friendlyName)&&void 0!==e?e:t.name]=t}));let h=null;const f=()=>Y(this,void 0,void 0,(function*(){const t=m[b.value];h=t.prepare();const e=yield h.getEditor();e.classList.remove("ui-form"),g.innerHTML="",g.appendChild(e)})),g=o.div([]),b=o.choiceInput(v,null!==(i=n.queryFunctionName)&&void 0!==i?i:Object.keys(m)[0],Object.keys(m),f);f(),n.queryFunctionName&&(null===(a=b.root.getElementsByTagName("select").item(0))||void 0===a||a.setAttribute("disabled","true"));const w=o.div([b,g]);w.style.display="none";const A=o.div([d,w]),T=n.campaignFields.map((t=>t.type===e.SEMTYPE.MOLECULE?Object.assign(Object.assign({},t),{type:"String",semtype:e.SEMTYPE.MOLECULE}):t)).map((t=>e.Property.fromOptions(Object.assign({name:t.name,type:$[t.type],nullable:!t.required},t.semtype?{semType:t.semtype}:{})))),x={},I=T.length?o.input.form(x,T):o.div();I.classList.remove("ui-form"),"File"===n.dataSourceType?(d.style.display="inherit",w.style.display="none"):(d.style.display="none",w.style.display="inherit");const N=o.div([A,...T.length?[I]:[]]),_=o.buttonsInput([]);return N.appendChild(_),{promise:new Promise((e=>{const i=()=>Y(this,void 0,void 0,(function*(){if("File"===n.dataSourceType){if(!r)return void t.shell.error("No file selected");const n=r;n.name=r.name,e({df:n,type:"File",campaignProps:x})}else{const n=m[b.value];if(!n)return void t.shell.error("No function selected");const i={};Object.entries(h.inputs).forEach((([t,e])=>{i[t]=e}));const o=yield n.apply(i);e({df:o,type:"Query",campaignProps:x})}})),a=o.bigButton(y,(()=>i()));_.appendChild(a)})),root:N,cancelPromise:new Promise((t=>{o.button(C,(()=>t()))}))}}(n);return a.then((t=>et(this,void 0,void 0,(function*(){this.app.dataFrame=t.df,this.app._fileInputType=t.type,yield this.app.setTemplate(n),this.app.campaignProps=t.campaignProps,this.app.saveCampaign(void 0,!1)})))),s.then((()=>{this.init()})),i}))}createNewTemplate(){return et(this,void 0,void 0,(function*(){const n=yield K(),i=new e.ViewBase,o=t.shell.v;i.name="New Template",i.root.appendChild(n.root),i.parentCall=this.app.parentCall,t.shell.addView(i),i.path=new URL(this.app.baseUrl).pathname+"/new-template",i.parentView=o;const{sub:a}=M(t.shell.v,"Hit Triage",g,(()=>{t.shell.v=o,i.close()}));n.template.then((e=>et(this,void 0,void 0,(function*(){yield this.init(e),i.close(),H(i),t.shell.v=o,a.unsubscribe()})))),n.cancelPromise.then((()=>{a.unsubscribe(),i.close(),t.shell.v=o}))}))}}class it extends tt{constructor(t){super(t),this.name="Submit"}render(){return o.empty(this.root),o.divV([o.h1("Summary"),o.div([o.tableFromMap(this.app.getSummary())])])}onActivated(){this.render()}submit(){var n,i,o,a,s;return i=this,o=void 0,s=function*(){const i=null===(n=this.app.template)||void 0===n?void 0:n.submit;if(!i)return;const o=e.Func.find({name:i.fName,package:i.package})[0];if(!o)return void t.shell.error(`Function ${i.fName} not found.`);const a=e.DataFrame.fromCsv(this.app.dataFrame.toCsv({filteredRowsOnly:!0}));yield o.apply({df:a,molecules:this.app.molColName}),this.app.campaign&&(this.app.campaign.status="Submitted"),this.app.saveCampaign("Submitted"),t.shell.info("Submitted successfully.")},new((a=void 0)||(a=Promise))((function(t,e){function n(t){try{l(s.next(t))}catch(t){e(t)}}function r(t){try{l(s.throw(t))}catch(t){e(t)}}function l(e){var i;e.done?t(e.value):(i=e.value,i instanceof a?i:new a((function(t){t(i)}))).then(n,r)}l((s=s.apply(i,o||[])).next())}))}}class ot{constructor(t){this.parentCall=t,this.resetBaseUrl()}resetBaseUrl(){const t=window.location.href,e=new URL(t);this.baseUrl=e.origin+e.pathname}getFilterType(t){const n=this.dataFrame.col(t);return(null==n?void 0:n.semType)===e.SEMTYPE.MOLECULE?e.FILTER_TYPE.SUBSTRUCTURE:(null==n?void 0:n.type)===e.COLUMN_TYPE.BOOL?e.FILTER_TYPE.BOOL_COLUMNS:(null==n?void 0:n.type)===e.COLUMN_TYPE.STRING?e.FILTER_TYPE.CATEGORICAL:e.FILTER_TYPE.HISTOGRAM}download(t,n,i=!1){const o=document.createElement("a"),a=e.DataFrame.fromColumns(t.columns.toList().filter((t=>!t.name.startsWith("~")))).toCsv({filteredRowsOnly:i});o.setAttribute("href","data:text/plain;charset=utf-8,"+encodeURIComponent(a)),o.setAttribute("download",n+".csv"),o.click()}getNewCampaignName(t,e){return n=this,i=void 0,a=function*(){const n=(yield It.files.list(t)).map((t=>t.name)).filter((t=>t.startsWith(e)));if(0===n.length)return e+"-1";const i=n.map((t=>t.split("-")[1])).filter(Boolean).map((t=>parseInt(t,10))).sort();return e+"-"+(i[i.length-1]+1).toString()},new((o=void 0)||(o=Promise))((function(t,e){function s(t){try{l(a.next(t))}catch(t){e(t)}}function r(t){try{l(a.throw(t))}catch(t){e(t)}}function l(e){var n;e.done?t(e.value):(n=e.value,n instanceof o?n:new o((function(t){t(n)}))).then(s,r)}l((a=a.apply(n,i||[])).next())}));var n,i,o,a}setBaseUrl(){const t=document.title;if(history.replaceState){const e={Title:t,Url:this.baseUrl};history.replaceState(e,e.Title,e.Url)}}}var at=function(t,e,n,i){return new(n||(n=Promise))((function(o,a){function s(t){try{l(i.next(t))}catch(t){a(t)}}function r(t){try{l(i.throw(t))}catch(t){a(t)}}function l(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,r)}l((i=i.apply(t,e||[])).next())}))},st=function(t,e,n,i){return new(n||(n=Promise))((function(o,a){function s(t){try{l(i.next(t))}catch(t){a(t)}}function r(t){try{l(i.throw(t))}catch(t){a(t)}}function l(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,r)}l((i=i.apply(t,e||[])).next())}))};class rt extends ot{constructor(n){super(n),this._filterViewName="Hit triage | Pick",this._filterDescriptions=[],this.campaignProps={},this._pickViewPromise=null,this._infoView=new nt(this),this.multiView=new e.MultiView({viewFactories:{[this._infoView.name]:()=>this._infoView}}),this.multiView.tabs.onTabChanged.subscribe((t=>{this.multiView.currentView instanceof tt&&this.multiView.currentView.onActivated()})),this.multiView.parentCall=n,t.shell.addView(this.multiView),t.events.onCurrentViewChanged.subscribe((()=>{var e,n,i,o;try{(null===(e=t.shell.v)||void 0===e?void 0:e.name)===this.currentPickViewId&&(t.shell.windows.showHelp=!1,this.setBaseUrl(),R(a,null!==(o=null!==(n=this._campaignId)&&void 0!==n?n:null===(i=this._campaign)||void 0===i?void 0:i.name)&&void 0!==o?o:""))}catch(t){console.error(t)}}))}setTemplate(n,i,o,s){var r,l,c,u,d,p,m,h,f,v,g;return st(this,void 0,void 0,(function*(){if((null===(r=this._pickView)||void 0===r?void 0:r.dataFrame)&&t.shell.closeTable(null===(l=this._pickView)||void 0===l?void 0:l.dataFrame),this._pickView=void 0,o?s&&(this._fileInputType=s.type,"File"===s.type?this.dataFrame=yield t.dapi.files.readCsv(s.query):this.dataFrame=yield t.functions.call(s.query)):(o=yield this.getNewCampaignName("Hit Triage/campaigns",n.key),R(a,o)),!this.dataFrame)return void console.error("Dataframe is empty.");if((null===(c=this._campaign)||void 0===c?void 0:c.columnSemTypes)&&Object.entries(this._campaign.columnSemTypes).forEach((([t,e])=>{const n=this.dataFrame.columns.byName(t);n&&(n.semType=e)})),yield this.dataFrame.meta.detectSemanticTypes(),this._molColName=null!==(d=null===(u=this.dataFrame.columns.bySemType(e.SEMTYPE.MOLECULE))||void 0===u?void 0:u.name)&&void 0!==d?d:void 0,this._dfName=null!==(p=this.dataFrame.name)&&void 0!==p?p:null==s?void 0:s.query,this.dataFrame.name=null!==(h=null!==(m=this._dfName)&&void 0!==m?m:this.dataFrame.name)&&void 0!==h?h:"Molecules",this._campaignId=o,this.template=n,this._campaignFilters=i,!i){const t={};n.compute.functions.forEach((e=>{const n=`${e.package}:${e.name}`;t[n]=e.args})),yield this.calculateColumns({descriptors:n.compute.descriptors.enabled?n.compute.descriptors.args:[],externals:t})}const y=t.shell.v,b=t.shell.addView(this.pickView);this.currentPickViewId=b.name,this._submitView=new it(this),this.setBaseUrl(),R(a,null!==(g=null!==(f=this._campaignId)&&void 0!==f?f:null===(v=this._campaign)||void 0===v?void 0:v.name)&&void 0!==g?g:"");const w=b;setTimeout((()=>{this._pickViewPromise&&this._pickViewPromise.then((()=>{const{sub:e}=M(w,"Hit Triage","Pick",(()=>{t.shell.v=y,w.close(),e.unsubscribe()}))}))}),300),t.shell.windows.showHelp=!1}))}get filterSettings(){return this._campaignFilters}get campaignId(){return this._campaignId}get pickView(){return this._pickView=this.getFilterView()}get molColName(){var t,n,i;return null!==(t=this._molColName)&&void 0!==t?t:this._molColName=null===(i=null===(n=this.dataFrame)||void 0===n?void 0:n.columns.bySemType(e.SEMTYPE.MOLECULE))||void 0===i?void 0:i.name}get fileInputType(){return this._fileInputType}get campaign(){return this._campaign}set campaign(t){this._campaign=t}calculateColumns(n,i){var o;return st(this,void 0,void 0,(function*(){const a=this.dataFrame.columns.names();n.descriptors&&n.descriptors.length>0&&(yield t.chem.descriptors(this.dataFrame,this.molColName,n.descriptors));for(const t of Object.keys(n.externals)){const i=n.externals[t],o=e.Func.find({package:t.split(":")[0],name:t.split(":")[1]})[0],a=o.inputs[0].name,s=o.inputs[1].name;i&&(yield o.apply(Object.assign(Object.assign({},i),{[a]:this.dataFrame,[s]:this.molColName})))}for(const e of Object.keys(null!==(o=n.scripts)&&void 0!==o?o:{})){const i=n.scripts[e];if(i)try{const n=yield t.dapi.scripts.find(e);if(!n)continue;const o=n.inputs[0].name,a=n.inputs[1].name;yield n.apply(Object.assign(Object.assign({},i),{[o]:this.dataFrame,[a]:this.molColName}))}catch(t){console.error(t)}}if(i){const t=i.getFiltersGroup();this.dataFrame.columns.names().filter((t=>!a.includes(t))).forEach((e=>{t.add({type:this.getFilterType(e),column:e})}))}}))}getFilterView(){let t=null;this._pickViewPromise=new Promise((e=>{t=e})),this.dataFrame.col(u)||this.dataFrame.columns.addNewBool(u).init(!1);const n=e.TableView.create(this.dataFrame,!1),i=n.getRibbonPanels(),a=o.iconFA("wrench",(()=>st(this,void 0,void 0,(function*(){G((t=>st(this,void 0,void 0,(function*(){this.calculateColumns(t,n)}))),(()=>null),this.template,!0)}))),"Calculate additional properties"),s=o.bigButton("Submit",(()=>{var t;const e=null===(t=this._submitView)||void 0===t?void 0:t.render();if(e){const t=o.dialog("Submit");t.add(e),t.addButton("Save",(()=>{this.saveCampaign(),t.close()})),t.addButton("Submit",(()=>{var e;null===(e=this._submitView)||void 0===e||e.submit(),t.close()})),t.show()}}));s.classList.add("hit-design-submit-button");const r=U(i);return i.push([a,...r?[]:[s]]),n.setRibbonPanels(i),n.name=this._filterViewName,setTimeout((()=>st(this,void 0,void 0,(function*(){var i;n._onAdded(),yield new Promise((t=>setTimeout(t,1e3)));const o=n.filters(this._campaignFilters?{filters:this._campaignFilters}:void 0);if(null===(i=this._campaign)||void 0===i?void 0:i.layout)try{const t=e.ViewLayout.fromViewState(this._campaign.layout);n.loadLayout(t)}catch(t){console.error(t)}n.dataFrame.onFilterChanged.subscribe((t=>{this._filterDescriptions=Array.from(n.dataFrame.rows.filters),this._campaignFilters=o.getOptions().look.filters})),setTimeout((()=>{this._filterDescriptions=Array.from(n.dataFrame.rows.filters),this._campaignFilters=o.getOptions().look.filters}),300),t&&t()}))),300),n.parentCall=this.parentCall,n}getSummary(){var t,e,n,i,a,s,r;const l=null!==(e=null===(t=this.campaign)||void 0===t?void 0:t.campaignFields)&&void 0!==e?e:this.campaignProps;return Object.assign(Object.assign({Template:null!==(i=null===(n=this.template)||void 0===n?void 0:n.name)&&void 0!==i?i:"Molecules","File path":o.divH([o.link(null!==(a=this._dfName)&&void 0!==a?a:"-",(()=>this.download(this.dataFrame,"molecules")),w)],{style:{alignItems:"center"}})},l),{"Number of molecules":this.dataFrame.rowCount.toString(),"Enrichment methods":[this.template.compute.descriptors.enabled?"descriptors":"",...this.template.compute.functions.map((t=>t.name))].filter((t=>t&&""!==t.trim())).join(", "),Filters:this._filterDescriptions.join(", "),"Result Molecules":o.divH([o.link(null!==(r=null===(s=this.dataFrame)||void 0===s?void 0:s.filter.trueCount.toString())&&void 0!==r?r:"0",(()=>{this.download(this.dataFrame,"hits",!0)}),w)],{style:{alignItems:"center"}})})}saveCampaign(n,i=!0){var a,s,r,l,c,u;return st(this,void 0,void 0,(function*(){const d=this.campaignId,p=this.filterSettings,m=this.template.name,h=this.dataFrame,f=`System:AppData/HitTriage/Hit Triage/campaigns/${d}/`,v=null!=d?d:yield function(t){return at(this,void 0,void 0,(function*(){return new Promise((e=>at(this,void 0,void 0,(function*(){const n=o.stringInput("Campaign name","");o.dialog("Save Campaign").add(o.div(n.root)).onOK((function(){n.value&&""!==n.value?e(n.value):e(t)})).show()}))))}))}(d),g={};h.columns.toList().forEach((t=>g[t.name]=t.semType));const y={name:v,templateName:m,filters:null!=p?p:{},ingest:{type:"File",query:`${f}enriched_table.csv`,molColName:this.molColName},status:null!==(s=null!=n?n:null===(a=this.campaign)||void 0===a?void 0:a.status)&&void 0!==s?s:"In Progress",createDate:null!==(l=null===(r=this.campaign)||void 0===r?void 0:r.createDate)&&void 0!==l?l:j(new Date),campaignFields:null!==(u=null===(c=this.campaign)||void 0===c?void 0:c.campaignFields)&&void 0!==u?u:this.campaignProps,columnSemTypes:g,rowCount:h.rowCount,filteredRowCount:h.filter.trueCount},b=e.DataFrame.fromColumns(h.columns.toList().filter((t=>!t.name.startsWith("~")))).toCsv();yield It.files.writeAsText(`Hit Triage/campaigns/${d}/enriched_table.csv`,b);const w=this._pickView.saveLayout();w?y.layout=w.viewState:t.shell.warning("Layout cound not be saved"),yield It.files.writeAsText(`Hit Triage/campaigns/${d}/campaign.json`,JSON.stringify(y)),i&&t.shell.info("Campaign saved successfully.")}))}}var lt=n(290),ct={};ct.styleTagTransform=V(),ct.setAttributes=B(),ct.insert=S().bind(null,"head"),ct.domAPI=_(),ct.insertStyleElement=O(),I()(lt.Z,ct),lt.Z&<.Z.locals&<.Z.locals;var ut;!function(e){let n,i;!function(t){t.vert=function(t){return o.divV(t.map((t=>o.render(t))),{classes:"u2-panel"})},t.horz=function(t){return o.divH(t.map((t=>o.render(t))),{classes:"u2-panel"})}}(n=e.panels||(e.panels={})),e.appHeader=function(t){const e=o.iconImage("",t.iconPath);return q()(e).addClass("ui-app-header-icon").css("margin-right","20px"),n.horz([e,n.vert([o.markdown(t.description),t.learnMoreUrl?o.link("Learn more",t.learnMoreUrl):null])])},function(e){e.runAsync=function(e,n){return i=this,a=void 0,r=function*(){o.setUpdateIndicator(e,!0);try{return yield n()}catch(e){t.log.error(e)}finally{o.setUpdateIndicator(e,!1)}},new((s=void 0)||(s=Promise))((function(t,e){function n(t){try{l(r.next(t))}catch(t){e(t)}}function o(t){try{l(r.throw(t))}catch(t){e(t)}}function l(e){var i;e.done?t(e.value):(i=e.value,i instanceof s?i:new s((function(t){t(i)}))).then(n,o)}l((r=r.apply(i,a||[])).next())}));var i,a,s,r}}(i=e.tools||(e.tools={}))}(ut||(ut={}));function dt(n,i,o,a=[]){return s=this,r=void 0,c=function*(){const s=e.Column.fromStrings(p,[n]),r=e.DataFrame.fromColumns([s]);yield r.meta.detectSemanticTypes(),i.length&&(yield t.chem.descriptors(r,s.name,i));for(const e of o){const n=e.args,i=yield t.functions.find(`${e.package}:${e.name}`);if(!i)continue;const o=i.inputs[0].name,a=i.inputs[1].name;yield i.apply(Object.assign(Object.assign({},n),{[o]:r,[a]:s.name}))}for(const e of a){const n=e.args;try{const i=yield t.dapi.scripts.find(e.id);if(i){const t=i.inputs[0].name,e=i.inputs[1].name;yield i.apply(Object.assign(Object.assign({},n),{[t]:r,[e]:s.name}))}}catch(t){console.error(t)}}return r},new((l=void 0)||(l=Promise))((function(t,e){function n(t){try{o(c.next(t))}catch(t){e(t)}}function i(t){try{o(c.throw(t))}catch(t){e(t)}}function o(e){var o;e.done?t(e.value):(o=e.value,o instanceof l?o:new l((function(t){t(o)}))).then(n,i)}o((c=c.apply(s,r||[])).next())}));var s,r,l,c}function pt(t){let e=0;if(t.length>1)for(const n of t.toList()){if(!n||!n.startsWith(h[0])||n.length!==h.length)continue;const t=parseInt(n.substring(1));isNaN(t)||(e=Math.max(t,e))}return`V${"".concat(...new Array(h.length-1-(e+1).toString().length).fill("0"))}${e+1}`}var mt=function(t,e,n,i){return new(n||(n=Promise))((function(o,a){function s(t){try{l(i.next(t))}catch(t){a(t)}}function r(t){try{l(i.throw(t))}catch(t){a(t)}}function l(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,r)}l((i=i.apply(t,e||[])).next())}))};function ht(n){var i,a,s,l,u,d,p,m,h,v,g;return mt(this,void 0,void 0,(function*(){const y=e.Func.find({tags:[r]}),w=yield It.files.list("Hit Design/templates");let A=!1,T=!1;const x=w.map((t=>t.name.slice(0,-5))),I=[];for(const t of w)try{const e=JSON.parse(yield It.files.readAsText(t));I.push(e.key)}catch(t){console.error(t)}const N=e.Func.find({tags:[c]}),_={};N.forEach((t=>{var e;_[null!==(e=t.friendlyName)&&void 0!==e?e:t.name]=t}));const E=o.choiceInput("Submit function",null,[null,...Object.keys(_)]);E.nullable=!0,E.value=null!==(a=null===(i=null==n?void 0:n.submit)||void 0===i?void 0:i.fName)&&void 0!==a?a:null,E.setTooltip("Select function to be called upon submitting");const S=o.divText("Template name is empty or already exists",{classes:"hit-triage-error-div"}),F=o.divText("Template key is empty or already exists",{classes:"hit-triage-error-div"});function B(){var t,e,n,i;if(""===P.value||x.includes(null!==(e=null===(t=P.value)||void 0===t?void 0:t.trim())&&void 0!==e?e:"")){const t=null!==(n=P.input.offsetLeft)&&void 0!==n?n:0,e=null!==(i=P.input.offsetWidth)&&void 0!==i?i:0;S.style.marginLeft=`${t}px`,S.style.width=`${e}px`,S.style.opacity="100%",S.style.borderTop="1px solid red",A=!0}else S.style.borderTop="none",S.style.opacity="0%",A=!1}const P=o.stringInput("Name",null!==(s=null==n?void 0:n.name)&&void 0!==s?s:"",B);function O(){var t,e,n,i;if(""===k.value||I.includes(null!==(e=null===(t=k.value)||void 0===t?void 0:t.trim())&&void 0!==e?e:"")){const t=null!==(n=k.input.offsetLeft)&&void 0!==n?n:0,e=null!==(i=k.input.offsetWidth)&&void 0!==i?i:0;F.style.marginLeft=`${t}px`,F.style.width=`${e}px`,F.style.borderTop="1px solid red",F.style.opacity="100%",T=!0}else F.style.opacity="0%",F.style.borderTop="none",T=!1}const k=o.stringInput("Key",null!==(l=null==n?void 0:n.key)&&void 0!==l?l:"",O);k.setTooltip("Template key used for campaign prefix"),P.setTooltip("Template name"),P.root.style.borderBottom="none",k.root.style.borderBottom="none",S.style.opacity="0%",F.style.opacity="0%";const V={Descriptors:"Descriptors"};y.forEach((t=>{var e;V[null!==(e=t.friendlyName)&&void 0!==e?e:t.name]=`${t.package.name}:${t.name}`}));let L=null;const D={compute:{descriptors:{enabled:!0,args:null!==(p=null===(d=null===(u=null==n?void 0:n.compute)||void 0===u?void 0:u.descriptors)||void 0===d?void 0:d.args)&&void 0!==p?p:[]},functions:null!==(h=null===(m=null==n?void 0:n.compute)||void 0===m?void 0:m.functions)&&void 0!==h?h:[]}},j=yield G((t=>{L=t}),(()=>null),D,!1);j.root.classList.add("hit-triage-new-template-functions-input");const R=Q(null==n?void 0:n.campaignFields),M=function(t){const n=[e.Property.fromOptions({name:"Name",type:e.TYPE.STRING})],i=new Z(n,t?t.map((t=>({Name:t}))):void 0,{horizontalInputNames:!0});let o={};return i.onItemAdded.subscribe((t=>{o=null!=t?t:{}})),i.onAddingItemChanged.subscribe((t=>{t&&(o=t.item)})),{getFields:function(){const t=i.items.filter((t=>t.Name)).map((t=>t.Name));return o.Name&&""!==o.Name&&t.push(o.Name),t},fieldsDiv:i.root}}(null==n?void 0:n.stages),H=o.divV([o.divV([P,S]),o.divV([k,F]),R.fieldsDiv]),U=o.h2("Stages");o.tooltip.bind(U,'Define Stages for designed molecules. For example, "Design", "Synthesis", "Test", etc.');const $=o.h2("Compute");o.tooltip.bind($,'Define functions to be calculated for each molecule. For example, "Descriptors", "Descriptors:Descriptors", etc.');const Y=o.div([o.h2("Details"),H,U,M.fieldsDiv,$,j.root,o.h2("Submit"),E.root],"ui-form"),W=o.buttonsInput([]);Y.appendChild(W);const q=null!==(g=null===(v=W.getElementsByClassName("ui-input-editor"))||void 0===v?void 0:v[0])&&void 0!==g?g:W,J=new Promise((t=>{const e=o.button(C,(()=>t()));q.appendChild(e)})),z=new Promise((e=>{const n=o.bigButton(b,(()=>function(){var n,i,o,a;return mt(this,void 0,void 0,(function*(){if(B(),O(),j.okProxy(),A||!P.value||""===P.value)return void t.shell.error("Template name is empty or already exists");if(T||!k.value||""===k.value)return void t.shell.error("Template key is empty or already exists");const s=E.value?_[E.value]:void 0,r=Object.assign({name:P.value,key:k.value,campaignFields:R.getFields(),stages:M.getFields(),compute:{descriptors:{enabled:!!(null===(n=null==L?void 0:L.descriptors)||void 0===n?void 0:n.length),args:null!==(i=null==L?void 0:L.descriptors)&&void 0!==i?i:[]},functions:Object.entries(null!==(o=null==L?void 0:L.externals)&&void 0!==o?o:{}).map((([t,e])=>{const n=t.split(":");return{name:n[1],package:n[0],args:e}})),scripts:Object.entries(null!==(a=null==L?void 0:L.scripts)&&void 0!==a?a:{}).filter((([t,e])=>t.startsWith(f)&&3===t.split(":").length)).map((([t,e])=>{var n,i;const o=t.split(":");return{name:null!==(n=o[1])&&void 0!==n?n:"",id:null!==(i=o[2])&&void 0!==i?i:"",args:e}}))}},s?{submit:{fName:s.name,package:s.package.name}}:{});var l;l=r,It.files.writeAsText(`Hit Design/templates/${l.name}.json`,JSON.stringify(l)),t.shell.info("Template created successfully"),e(r)}))}()));q.appendChild(n)}));return{root:Y,template:z,cancelPromise:J}}))}var ft=function(t,e,n,i){return new(n||(n=Promise))((function(o,a){function s(t){try{l(i.next(t))}catch(t){a(t)}}function r(t){try{l(i.throw(t))}catch(t){a(t)}}function l(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,r)}l((i=i.apply(t,e||[])).next())}))};class vt extends tt{constructor(e){super(e),this.deletedCampaigns=[],this.name="Hit Design",t.shell.windows.showHelp=!0,t.shell.windows.help.showHelp(It.webRoot+"README_HD.md"),this.checkCampaign().then((t=>{this.app.campaign=t,this.init()}))}onActivated(){t.shell.windows.showHelp=!0,t.shell.windows.help.showHelp(It.webRoot+"README_HD.md")}init(t){return ft(this,void 0,void 0,(function*(){o.setUpdateIndicator(this.root,!0);try{const e=o.h1(A),n=o.h1(T,{style:{marginLeft:"10px"}}),i=ut.appHeader({iconPath:It.webRoot+"/images/icons/hit-design-icon.png",learnMoreUrl:"https://github.com/datagrok-ai/public/blob/master/packages/HitTriage/README_HD.md",description:"- Configure your own workflow using the template editor\n- Sketch molecules in the molecular spreadsheet\n- Annotate and share ideas with the team\n- Calculate different molecular properties\n- Save campaigns and continue from where you left off\n- Submit final selection to the function of your choice"}),a=o.div(),s=o.divH([]),r=o.div([s,a],"ui-form"),l=yield this.getCampaignsTable();q()(this.root).empty(),this.root.appendChild(o.div([o.divV([i,e],{style:{marginLeft:"10px"}}),l,n,r])),yield this.startNewCampaign(a,s,t),this.app.resetBaseUrl()}finally{o.setUpdateIndicator(this.root,!1)}}))}startNewCampaign(t,e,n){var i;return ft(this,void 0,void 0,(function*(){const a=(yield It.files.list("Hit Design/templates")).filter((t=>t.name.endsWith(".json"))).map((t=>t.name.slice(0,-5)));n&&!a.includes(n.name)&&a.push(n.name);let s=null;const r=()=>ft(this,void 0,void 0,(function*(){const e=l.value,i=n&&n.name===e?n:JSON.parse(yield It.files.readAsText("Hit Design/templates/"+e+".json"));s=i;const o=yield this.getNewCampaignAccordeon(i);q()(t).empty(),t.appendChild(o)})),l=o.choiceInput("Template",null!==(i=null==n?void 0:n.name)&&void 0!==i?i:a[0],a,(()=>ft(this,void 0,void 0,(function*(){yield r()}))));l.root.style.width="100%";const c=o.icons.add((()=>{this.createNewTemplate()}),g),u=o.icons.copy((()=>{s&&this.createNewTemplate(s)}),"Clone template");c.style.color="#2083d5",l.addOptions(u),l.addOptions(c),yield r(),q()(e).empty(),e.appendChild(l.root)}))}checkCampaign(t){var e;return ft(this,void 0,void 0,(function*(){const n=location.search,i=new URLSearchParams(n);if(!i.has(s)&&!t)return;const o=null!=t?t:i.get(s);if(!(yield It.files.exists(`Hit Design/campaigns/${o}/campaign.json`)))return;const a=JSON.parse(yield It.files.readAsText(`Hit Design/campaigns/${o}/campaign.json`));a&&(this.app.campaign=a);const r=null!==(e=a.template)&&void 0!==e?e:JSON.parse(yield It.files.readAsText(`Hit Design/templates/${a.templateName}.json`));return yield this.app.setTemplate(r,o),t&&R(s,t),a.template=r,a}))}getCampaignsTable(){return ft(this,void 0,void 0,(function*(){const t=(yield It.files.list("Hit Design/campaigns")).filter((t=>-1===this.deletedCampaigns.indexOf(t.name))),e={};for(const n of t){const t=JSON.parse(yield It.files.readAsText(`Hit Design/campaigns/${n.name}/campaign.json`));e[t.name]=t}const n=o.table(Object.values(e),(t=>[o.link(t.name,(()=>this.setCampaign(t.name)),"",""),t.createDate,t.rowCount,t.status,o.icons.delete((()=>ft(this,void 0,void 0,(function*(){o.dialog("Delete campaign").add(o.divText(`Are you sure you want to delete campaign ${t.name}?`)).onOK((()=>ft(this,void 0,void 0,(function*(){yield this.deleteCampaign("Hit Design",t.name),this.deletedCampaigns.push(t.name),yield this.init()})))).show()}))),"Delete campaign")]),["Name","Created","Molecules","Status",""]);return n.style.color="var(--grey-5)",n.style.marginLeft="24px",n}))}setCampaign(t){return ft(this,void 0,void 0,(function*(){const e=yield this.checkCampaign(t);this.app.campaign=e}))}getNewCampaignAccordeon(n){return ft(this,void 0,void 0,(function*(){const{root:i,promise:a,cancelPromise:s}=function(n){var i,a;const s=e.DataFrame.create(1),r=s.columns.addNew(p,e.TYPE.STRING);r.semType=e.SEMTYPE.MOLECULE,r.setTag(e.TAGS.UNITS,e.UNITS.Molecule.SMILES),r.set(0,null),(null===(i=null==n?void 0:n.stages)||void 0===i?void 0:i.length)>0&&s.columns.addNew(d,e.TYPE.STRING).set(0,n.stages[0]);const l=s.columns.addNew(m,e.TYPE.STRING);l.set(0,pt(l));const c=n.campaignFields.map((t=>t.type===e.SEMTYPE.MOLECULE?Object.assign(Object.assign({},t),{type:"String",semtype:e.SEMTYPE.MOLECULE}):t)).map((t=>e.Property.fromOptions(Object.assign({name:t.name,type:$[t.type],nullable:!t.required},t.semtype?{semType:t.semtype}:{})))),u={},h=o.input.form(u,c);h.classList.remove("ui-form");const f=o.div([...(null===(a=n.campaignFields)||void 0===a||a.length,[]),h]),v=o.buttonsInput([]);return f.appendChild(v),{promise:new Promise((e=>{const i=o.bigButton(y,(()=>{for(const e of n.campaignFields)if(e.required&&(!u[e.name]||""===u[e.name]))return void t.shell.error(`Field '${e.name}' is required`);e({df:s,campaignProps:u})}));v.appendChild(i)})),root:f,cancelPromise:new Promise((t=>{o.button(C,(()=>t()))}))}}(n);return a.then((t=>ft(this,void 0,void 0,(function*(){this.app.dataFrame=t.df,yield this.app.setTemplate(n),this.app.campaignProps=t.campaignProps,this.app.saveCampaign(void 0,!1)})))),s.then((()=>{this.init()})),i}))}createNewTemplate(n){return ft(this,void 0,void 0,(function*(){o.setUpdateIndicator(this.root,!0);try{const i=yield ht(n),a=new e.ViewBase,s=t.shell.v;a.name="New Template",a.root.appendChild(i.root),a.parentCall=this.app.parentCall,t.shell.addView(a),a.path=new URL(this.app.baseUrl).pathname+"/new-template";const{sub:r}=M(a,"Hit Design",g,(()=>ft(this,void 0,void 0,(function*(){t.shell.v=s,a.close()}))));i.template.then((e=>ft(this,void 0,void 0,(function*(){yield this.init(e),a.close(),H(a),t.shell.v=s,r.unsubscribe()})))),i.cancelPromise.then((()=>ft(this,void 0,void 0,(function*(){r.unsubscribe(),a.close(),t.shell.v=s}))))}finally{o.setUpdateIndicator(this.root,!1)}}))}}class gt extends tt{constructor(t){super(t),this.name="Submit"}render(){return o.empty(this.root),o.divV([o.h1("Summary"),o.div([o.tableFromMap(this.app.getSummary())])])}onActivated(){this.render()}submit(){var n,i,o,a,s;return i=this,o=void 0,s=function*(){const i=null===(n=this.app.template)||void 0===n?void 0:n.submit;if(!i)return;const o=e.Func.find({name:i.fName,package:i.package})[0];if(!o)return void t.shell.error(`Function ${i.fName} not found.`);const a=e.DataFrame.fromCsv(this.app.dataFrame.toCsv({filteredRowsOnly:!0}));yield o.apply({df:a,molecules:this.app.molColName}),this.app.campaign&&(this.app.campaign.status="Submitted"),this.app.saveCampaign("Submitted"),t.shell.info("Submitted successfully.")},new((a=void 0)||(a=Promise))((function(t,e){function n(t){try{l(s.next(t))}catch(t){e(t)}}function r(t){try{l(s.throw(t))}catch(t){e(t)}}function l(e){var i;e.done?t(e.value):(i=e.value,i instanceof a?i:new a((function(t){t(i)}))).then(n,r)}l((s=s.apply(i,o||[])).next())}))}}var yt=n(143),bt={};bt.styleTagTransform=V(),bt.setAttributes=B(),bt.insert=S().bind(null,"head"),bt.domAPI=_(),bt.insertStyleElement=O(),I()(yt.Z,bt),yt.Z&&yt.Z.locals&&yt.Z.locals;class wt extends tt{constructor(t){super(t),this.v=null,this.name="Progress Tracker"}render(){return n=this,i=void 0,s=function*(){return new Promise((n=>{var i,a;o.empty(this.root),this.app.dataFrame.columns.names().forEach((t=>{t.startsWith("~")&&this.app.dataFrame.columns.remove(t)})),this.v=e.Viewer.fromType(e.VIEWER.TILE_VIEWER,this.app.dataFrame,{lanesColumnName:d,lanes:null!==(a=null===(i=this.app.template)||void 0===i?void 0:i.stages)&&void 0!==a?a:[]}),this.root.appendChild(this.v.root),this.v.root.style.height="100%",this.v.root.style.width="100%",setTimeout((()=>{var e,i,a;null===(i=null===(e=this.v)||void 0===e?void 0:e.view)||void 0===i||i._onAdded();const s=null===(a=t.shell.v)||void 0===a?void 0:a.getRibbonPanels();if(s){if(U(s))return void n();const e=o.bigButton("Design view",(()=>{const e=t.shell.view(this.app.designViewName);e&&(t.shell.v=e)})),i=o.bigButton("Submit",(()=>{var t;const e=null===(t=this.app._submitView)||void 0===t?void 0:t.render();if(e){const t=o.dialog("Submit");t.add(e),t.addButton("Save",(()=>{this.app.saveCampaign(),t.close()})),t.addButton("Submit",(()=>{var e;null===(e=this.app._submitView)||void 0===e||e.submit(),t.close()})),t.show()}}));i.classList.add("hit-design-submit-button"),s.push([e,i]),t.shell.v.setRibbonPanels(s)}n()}),5)}))},new((a=void 0)||(a=Promise))((function(t,e){function o(t){try{l(s.next(t))}catch(t){e(t)}}function r(t){try{l(s.throw(t))}catch(t){e(t)}}function l(e){var n;e.done?t(e.value):(n=e.value,n instanceof a?n:new a((function(t){t(n)}))).then(o,r)}l((s=s.apply(n,i||[])).next())}));var n,i,a,s}onActivated(){this.render()}destroy(){var t;null===(t=this.v)||void 0===t||t.detach()}}var Ct=function(t,e,n,i){return new(n||(n=Promise))((function(o,a){function s(t){try{l(i.next(t))}catch(t){a(t)}}function r(t){try{l(i.throw(t))}catch(t){a(t)}}function l(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,r)}l((i=i.apply(t,e||[])).next())}))};class At extends ot{constructor(n){super(n),this._tilesViewTab=null,this._designViewName="Design",this._filePath="System.AppData/HitTriage/Hit Design/campaigns",this._molColName=p,this.campaignProps={},this.processedValues=[],this._extraStageColsCount=0,this._infoView=new vt(this),this.multiView=new e.MultiView({viewFactories:{[this._infoView.name]:()=>this._infoView}}),this.multiView.tabs.onTabChanged.subscribe((t=>{this.multiView.currentView instanceof tt&&this.multiView.currentView.onActivated()})),this.multiView.parentCall=n,this.mainView=t.shell.addView(this.multiView),t.events.onCurrentViewChanged.subscribe((()=>Ct(this,void 0,void 0,(function*(){var e,n,i,o,s,r,l,c,u;try{if((null===(e=t.shell.v)||void 0===e?void 0:e.name)===this.currentDesignViewId||(null===(n=t.shell.v)||void 0===n?void 0:n.name)===this.currentTilesViewId){t.shell.windows.showHelp=!1,this.setBaseUrl(),R(a,null!==(s=null!==(i=this._campaignId)&&void 0!==i?i:null===(o=this._campaign)||void 0===o?void 0:o.name)&&void 0!==s?s:""),(null===(r=t.shell.v)||void 0===r?void 0:r.name)===this.currentTilesViewId?yield null===(l=this._tilesView)||void 0===l?void 0:l.render():null===(c=this._tilesView)||void 0===c||c.destroy();const{sub:e}=M(t.shell.v,"Hit Design",null===(u=t.shell.v)||void 0===u?void 0:u.name,(()=>{var n,i;t.shell.v=this.mainView,null===(n=this._tilesView)||void 0===n||n.close(),null===(i=this._designView)||void 0===i||i.close(),this._infoView.init(),e.unsubscribe()}))}}catch(t){console.error(t)}}))))}setTemplate(n,i){var o,r,l,c,u,d,m,h,f,v,g,y;return Ct(this,void 0,void 0,(function*(){if(i){const e="System.AppData/HitTriage/Hit Design/campaigns";this._filePath=null!==(l=null===(r=this.campaign)||void 0===r?void 0:r.savePath)&&void 0!==l?l:`${e}/${i}/enriched_table.csv`,this.dataFrame=yield t.dapi.files.readCsv(this._filePath),(null===(c=this._campaign)||void 0===c?void 0:c.columnSemTypes)&&Object.entries(this._campaign.columnSemTypes).forEach((([t,e])=>{const n=this.dataFrame.columns.byName(t);n&&e&&(n.semType=e)}))}else(null===(o=this._designView)||void 0===o?void 0:o.dataFrame)&&t.shell.closeTable(this._designView.dataFrame),this._designView=void 0,i=yield this.getNewCampaignName("Hit Design/campaigns",n.key),R(s,i),this._filePath=`System.AppData/HitTriage/Hit Design/campaigns/${i}/enriched_table.csv`;if(!this.dataFrame)return void console.error("DataFrame is empty");yield this.dataFrame.meta.detectSemanticTypes(),this._molColName=null!==(d=null===(u=this.dataFrame.columns.bySemType(e.SEMTYPE.MOLECULE))||void 0===u?void 0:u.name)&&void 0!==d?d:p,this._dfName=null!==(m=(y=this.dataFrame).name)&&void 0!==m?m:y.name=i,this._campaignId=i,this.template=n,null!==(h=this._submitView)&&void 0!==h||(this._submitView=new gt(this)),t.shell.windows.showHelp=!1,this._extraStageColsCount=this.dataFrame.rowCount-this.dataFrame.filter.trueCount;const b=t.shell.addView(this.designView);this.currentDesignViewId=b.name,this.setBaseUrl(),R(a,null!==(g=null!==(f=this._campaignId)&&void 0!==f?f:null===(v=this._campaign)||void 0===v?void 0:v.name)&&void 0!==g?g:""),this.campaign&&(this.campaign.template=n)}))}get campaignId(){return this._campaignId}get designView(){return this._designView=this.getDesignView()}get designViewName(){return this._designViewName}get molColName(){var t,n,i,o;return null!==(t=this._molColName)&&void 0!==t?t:this._molColName=null!==(o=null===(i=null===(n=this.dataFrame)||void 0===n?void 0:n.columns.bySemType(e.SEMTYPE.MOLECULE))||void 0===i?void 0:i.name)&&void 0!==o?o:p}get campaign(){return this._campaign}set campaign(t){this._campaign=t}getDesignView(){var n,i,a,s,r,l;const c=[],u=null===(n=this.dataFrame.col(this.molColName))||void 0===n?void 0:n.toList().every((t=>!t&&""===t)),h=e.TableView.create(this.dataFrame,!1);this._designViewName=null!==(a=null===(i=this.campaign)||void 0===i?void 0:i.name)&&void 0!==a?a:this._designViewName,h.name=this._designViewName,this.processedValues=this.dataFrame.getCol(this.molColName).toList(),setTimeout((()=>Ct(this,void 0,void 0,(function*(){var n,i;if(h._onAdded(),yield new Promise((t=>setTimeout(t,1e3))),null===(n=this._campaign)||void 0===n?void 0:n.layout)try{const t=e.ViewLayout.fromViewState(this._campaign.layout);h.loadLayout(t)}catch(t){console.error(t)}u&&t.functions.call("Chem:editMoleculeCell",{cell:h.grid.cell(this._molColName,0)}),c.push(this.dataFrame.onRowsAdded.subscribe((()=>{var e,n;try{if(this.processedValues=this.dataFrame.getCol(this.molColName).toList(),(null===(e=this.template.stages)||void 0===e?void 0:e.length)>0)for(let t=0;t<this.dataFrame.rowCount;t++){const e=this.dataFrame.col(d).get(t);e&&""!==e&&!(null===(n=this.dataFrame.col(d))||void 0===n?void 0:n.isNone(t))||this.dataFrame.set(d,t,this.template.stages[0])}let i=null;for(let t=0;t<this.dataFrame.rowCount;t++){const e=h.grid.cell(this.molColName,t);e&&(""!==e.cell.value&&null!==e.cell.value||(i=e))}i&&t.functions.call("Chem:editMoleculeCell",{cell:i})}catch(t){console.error(t)}}))),this.dataFrame&&c.push(null===(i=this.dataFrame)||void 0===i?void 0:i.onRowsRemoved.subscribe((()=>{try{this.processedValues=this.dataFrame.getCol(this.molColName).toList()}catch(t){console.error(t)}}))),c.push(t.events.onContextMenu.subscribe((n=>{var i,o,a,s,r;try{const t=null===(i=null==n?void 0:n.args)||void 0===i?void 0:i.context;if(!t)return;if((null==t?void 0:t.type)!==e.VIEWER.GRID)return;if(!t.tableView||t.tableView.id!==h.id)return;if((null===(s=null===(a=null===(o=null==n?void 0:n.args)||void 0===o?void 0:o.item)||void 0===a?void 0:a.tableColumn)||void 0===s?void 0:s.name)!==this.molColName)return;const l=null===(r=null==n?void 0:n.args)||void 0===r?void 0:r.menu;if(!l)return;l.item("Add new row",(()=>{this.dataFrame.rows.addNew(null,!0)})),l.item("Duplicate molecule",(()=>{var t,e,i,o;try{this.dataFrame.rows.addNew(null,!0);let a=null;for(let t=0;t<this.dataFrame.rowCount;t++){const e=h.grid.cell(this.molColName,t);e&&(""!==e.cell.value&&null!==e.cell.value||(a=e))}a&&(a.cell.value=null!==(o=null===(i=null===(e=null===(t=null==n?void 0:n.args)||void 0===t?void 0:t.item)||void 0===e?void 0:e.cell)||void 0===i?void 0:i.value)&&void 0!==o?o:"")}catch(t){console.error(t)}}))}catch(e){t.log.error(e)}}))),c.push(h.grid.onCellValueEdited.subscribe((t=>Ct(this,void 0,void 0,(function*(){var e,n,i,o;try{if((null===(e=t.tableColumn)||void 0===e?void 0:e.name)===d)return void(yield this.saveCampaign(void 0,!1));if((null===(n=t.tableColumn)||void 0===n?void 0:n.name)!==this.molColName)return;const a=t.cell.value,s=t.tableRowIndex;(null===(i=this.dataFrame.col(m))||void 0===i?void 0:i.get(s))&&""!==(null===(o=this.dataFrame.col(m))||void 0===o?void 0:o.get(s))||this.dataFrame.col(m).set(s,pt(this.dataFrame.col(m)),!1);const r=this.template.compute;if(!a||""===a)return;const l=yield dt(a,r.descriptors.args,r.functions,r.scripts);for(const t of l.columns.toList())t.name!==p&&(this.dataFrame.columns.contains(t.name)||(this.dataFrame.columns.addNew(t.name,t.type).semType=t.semType),this.dataFrame.col(t.name).set(s,t.get(0),!1));this.dataFrame.fireValuesChanged(),this.saveCampaign(void 0,!1)}catch(t){console.error(t)}})))));const o=t.events.onViewRemoved.subscribe((t=>{t.id===h.id&&(c.forEach((t=>t.unsubscribe())),o.unsubscribe())}))}))),300);const v=null==h?void 0:h.getRibbonPanels();if(v&&!U(v)){const e=()=>Ct(this,void 0,void 0,(function*(){var t;G((t=>Ct(this,void 0,void 0,(function*(){var e,n,i,a,s;const r=this.template.compute.descriptors.args,l=this.template.compute.functions,c=null!==(e=this.template.compute.scripts)&&void 0!==e?e:[],u=t.descriptors,d={descriptors:{enabled:!!(null===(n=null==t?void 0:t.descriptors)||void 0===n?void 0:n.length),args:null!==(i=null==t?void 0:t.descriptors)&&void 0!==i?i:[]},functions:Object.entries(null!==(a=null==t?void 0:t.externals)&&void 0!==a?a:{}).map((([t,e])=>{const n=t.split(":");return{name:n[1],package:n[0],args:e}})),scripts:Object.entries(null!==(s=null==t?void 0:t.scripts)&&void 0!==s?s:{}).filter((([t,e])=>t.startsWith(f)&&3===t.split(":").length)).map((([t,e])=>{var n,i;const o=t.split(":");return{name:null!==(n=o[1])&&void 0!==n?n:"",id:null!==(i=o[2])&&void 0!==i?i:"",args:e}}))};this.template.compute=d,this.campaign.template=this.template;const m=u.filter((t=>!r.includes(t))),v=d.functions.filter((t=>{if(!l.some((e=>e.name===t.name&&e.package===t.package)))return!0;const e=l.find((e=>e.name===t.name&&e.package===t.package));return!Object.entries(t.args).every((([t,n])=>e.args[t]===n))})),g=d.scripts.filter((t=>{if(!c.some((e=>e.id===t.id)))return!0;const e=c.find((e=>e.id===t.id));return!Object.entries(t.args).every((([t,n])=>e.args[t]===n))}));o.setUpdateIndicator(h.grid.root,!0);try{for(let t=0;t<this.dataFrame.rowCount;t++){const e=this.dataFrame.get(this.molColName,t);if(!e||""===e)continue;const n=yield dt(e,m,v,g);for(const e of n.columns.toList())e.name!==p&&(this.dataFrame.columns.contains(e.name)||(this.dataFrame.columns.addNew(e.name,e.type).semType=e.semType),this.dataFrame.col(e.name).set(t,e.get(0),!1));this.dataFrame.fireValuesChanged()}}finally{o.setUpdateIndicator(h.grid.root,!1),this.saveCampaign(void 0,!1)}}))),(()=>null),null===(t=this.campaign)||void 0===t?void 0:t.template,!0)})),n=o.iconFA("wrench",e,"Calculate additional properties"),i=o.icons.add((()=>{var t;null===(t=this.dataFrame)||void 0===t||t.rows.addNew(null,!0)}),"Add new row"),a=o.bigButton("Progress tracker",(()=>{this.currentTilesViewId&&t.shell.view(this.currentTilesViewId)?t.shell.v=t.shell.view(this.currentTilesViewId):(this._tilesView=new wt(this),this._tilesView.parentCall=this.parentCall,this._tilesViewTab=t.shell.addView(this._tilesView),this.currentTilesViewId=this._tilesViewTab.name,this._tilesView.onActivated())})),c=o.bigButton("Submit",(()=>{var t;const e=null===(t=this._submitView)||void 0===t?void 0:t.render();if(e){const t=o.dialog("Submit");t.add(e),t.addButton("Save",(()=>{this.saveCampaign(),t.close()})),t.addButton("Submit",(()=>{var e;null===(e=this._submitView)||void 0===e||e.submit(),t.close()})),t.show()}}));c.classList.add("hit-design-submit-button");const u=[c];null!==(l=null===(r=null===(s=this.template)||void 0===s?void 0:s.stages)||void 0===r?void 0:r.length)&&void 0!==l&&l&&u.unshift(a),this.campaign&&this.template&&(this.campaign.template||(this.campaign.template=this.template),u.unshift(n)),u.unshift(i),v.push(u),h.setRibbonPanels(v)}return h.parentCall=this.parentCall,h}getSummary(){var n,i,a,s;const r=()=>{var t,e;const n=this._filePath.indexOf(null!==(t=this.campaignId)&&void 0!==t?t:null===(e=this._campaign)||void 0===e?void 0:e.name);return-1===n?this._filePath:this._filePath.substring(0,n-1)},l=Object.assign({},null!==(i=null===(n=this.campaign)||void 0===n?void 0:n.campaignFields)&&void 0!==i?i:this.campaignProps);return this.template&&this.template.campaignFields&&Object.entries(l).forEach((([n,i])=>{const o=this.template.campaignFields.find((t=>t.name===n));o&&"Date"===o.type&&i?"Invalid Date"!==new Date(i).toString()?l[n]=new Date(i).toLocaleDateString():i.date?l[n]=new Date(i.date).toLocaleDateString():l[n]=i:o&&o.type===e.SEMTYPE.MOLECULE&&i&&(l[n]=t.chem.drawMolecule(i))})),Object.assign(Object.assign({Template:null!==(s=null===(a=this.template)||void 0===a?void 0:a.name)&&void 0!==s?s:"Molecules","File path":(()=>{const e=o.icons.edit((()=>{const n=r(),s=o.stringInput("Path",n),l=s.root.getElementsByTagName("label").item(0);l&&l.remove(),s.root.style.width="100%";const c=o.button("Save",(()=>Ct(this,void 0,void 0,(function*(){const n=yield function(){return Ct(this,void 0,void 0,(function*(){const e=s.value;return e&&""!==e.trim()?!!(yield t.dapi.files.exists(e))||(t.shell.error("Given folder does not exist"),!1):(t.shell.error("Path can not be empty"),!1)}))}();if(!n)return;const l=s.value;l.endsWith("/")?this._filePath=`${l}${this.campaignId}/enriched_table.csv`:this._filePath=`${l}/${this.campaignId}/enriched_table.csv`,this._campaign&&(this._campaign.savePath=this._filePath),yield this.saveCampaign(void 0,!0),o.empty(a);const c=r();i=o.link(c,(()=>{var t,e,n;return this.download(this.dataFrame,null!==(n=null!==(t=this.campaignId)&&void 0!==t?t:null===(e=this._campaign)||void 0===e?void 0:e.name)&&void 0!==n?n:"Molecules")}),w),a.appendChild(i),a.appendChild(e)})))),u=o.button("Cancel",(()=>{o.empty(a),a.appendChild(i),a.appendChild(e)}));o.empty(a),s.addOptions(u),s.addOptions(c),a.appendChild(s.root)}),"Edit file path");e.style.marginLeft="5px";const n=r();let i=o.link(n,(()=>{var t,e,n;return this.download(this.dataFrame,null!==(n=null!==(t=this.campaignId)&&void 0!==t?t:null===(e=this._campaign)||void 0===e?void 0:e.name)&&void 0!==n?n:"Molecules")}),w);const a=o.divH([i,e],{style:{alignItems:"center"}});return a})()},l),{"Number of molecules":(this.dataFrame.rowCount-this._extraStageColsCount).toString(),"Enrichment methods":[this.template.compute.descriptors.enabled?"descriptors":"",...this.template.compute.functions.map((t=>t.name))].filter((t=>t&&""!==t.trim())).join(", ")})}saveCampaign(n,i=!0){var o,a,s,r,l,c,u,d;return Ct(this,void 0,void 0,(function*(){const p=this.campaignId,h=this.template.name,f=this.dataFrame,v=p,g={};f.columns.toList().forEach((t=>g[t.name]=t.semType));const y={name:v,templateName:h,status:null!==(a=null!=n?n:null===(o=this.campaign)||void 0===o?void 0:o.status)&&void 0!==a?a:"In Progress",createDate:null!==(r=null===(s=this.campaign)||void 0===s?void 0:s.createDate)&&void 0!==r?r:j(new Date),campaignFields:null!==(c=null===(l=this.campaign)||void 0===l?void 0:l.campaignFields)&&void 0!==c?c:this.campaignProps,columnSemTypes:g,rowCount:null!==(d=null===(u=f.col(m))||void 0===u?void 0:u.toList().filter((t=>"StageDefiningRow"!==t)).length)&&void 0!==d?d:0,filteredRowCount:f.filter.trueCount,savePath:this._filePath};console.log(this._filePath);const b=e.DataFrame.fromColumns(f.columns.toList().filter((t=>!t.name.startsWith("~")))).toCsv();yield t.dapi.files.writeAsText(this._filePath,b);const w=this._designView.saveLayout();return w?y.layout=w.viewState:t.shell.warning("Layout cound not be saved"),y.template=this.template,yield It.files.writeAsText(`Hit Design/campaigns/${p}/campaign.json`,JSON.stringify(y)),i&&t.shell.info("Campaign saved successfully."),this.campaign=y,y}))}}class Tt extends e.GridCellRenderer{get name(){return"customGasteigerPNG"}get cellType(){return"customGasteigerPNG"}get defaultHeight(){return 200}get defaultWidth(){return 200}render(t,e,n,i,o,a,s){if(a.gridRow<0||!a.cell.value)return;const r=a.cell.value,l=new Image(i-2,o-2);l.src="data:image/png;base64,"+r,l.onload=function(){t.drawImage(l,e+2,n+2,i-2,o-2)}}}var xt=function(t,e,n,i){return new(n||(n=Promise))((function(o,a){function s(t){try{l(i.next(t))}catch(t){a(t)}}function r(t){try{l(i.throw(t))}catch(t){a(t)}}function l(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,r)}l((i=i.apply(t,e||[])).next())}))};const It=new e.Package;function Nt(){return xt(this,void 0,void 0,(function*(){const e=t.functions.getCurrentCall();new rt(e)}))}function _t(){return xt(this,void 0,void 0,(function*(){const e=t.functions.getCurrentCall();new At(e)}))}function Et(){return xt(this,void 0,void 0,(function*(){const e=t.data.demo.molecules(100);return e.name="100 Molecules",e}))}function St(){return xt(this,void 0,void 0,(function*(){const e=t.data.demo.molecules(5e3);return e.name="5000 Molecules",e}))}function Ft(e){return xt(this,void 0,void 0,(function*(){const n=t.data.demo.molecules(e);return n.name="Variable Molecules number",n}))}function Bt(e,n){return xt(this,void 0,void 0,(function*(){t.shell.info(e.rowCount),t.shell.info(n)}))}function Pt(){return new Tt}})(),hittriage=i})();
|
|
2
2
|
//# sourceMappingURL=package.js.map
|