@datagrok/compute 1.45.4 → 1.46.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +2 -2
- package/CHANGELOG.md +8 -0
- package/dist/package-test.js +8 -8
- package/dist/package-test.js.map +1 -1
- package/dist/package.js +3 -3
- package/dist/package.js.map +1 -1
- package/package.json +8 -8
- package/src/tests/rich-function-view-direct-tests.ts +24 -33
- package/src/tests/rich-function-view-tests.ts +24 -33
- package/src/tests/utils.ts +33 -0
- package/test-console-output-1.log +120 -120
- package/test-record-1.mp4 +0 -0
package/dist/package-test.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var compute_test;(()=>{var t={76(t,e,n){"use strict";n.d(e,{A:()=>a});var i=n(126),r=n.n(i),
|
|
1
|
+
var compute_test;(()=>{var t={76(t,e,n){"use strict";n.d(e,{A:()=>a});var i=n(126),r=n.n(i),o=n(454),s=n.n(o)()(r());s.push([t.id,`.fi-drop-area {
|
|
2
2
|
position: relative;
|
|
3
3
|
}
|
|
4
4
|
|
|
@@ -19,7 +19,7 @@ var compute_test;(()=>{var t={76(t,e,n){"use strict";n.d(e,{A:()=>a});var i=n(12
|
|
|
19
19
|
.fi-drop-area .success {
|
|
20
20
|
color: var(--grey-6);
|
|
21
21
|
}
|
|
22
|
-
`,"",{version:3,sources:["webpack://./../../libraries/compute-utils/dist/old-components/css/file-input.css"],names:[],mappings:"AAAA;EACE,kBAAkB;AACpB;;AAEA;EACE,oBAAoB;AACtB;;AAEA;EACE,gCAAgC;EAChC,gCAAgC;EAChC,oBAAoB;AACtB;;AAEA;EACE,mBAAmB;AACrB;;AAEA;EACE,oBAAoB;AACtB",sourcesContent:[".fi-drop-area {\n position: relative;\n}\n\n.fi-drop-area .default {\n color: var(--grey-2);\n}\n\n.fi-drop-area .drag-n-dropping {\n background-color: var(--steel-1);\n border: 1px dashed var(--blue-1);\n color: var(--grey-3);\n}\n\n.fi-drop-area .error {\n color: var(--red-3);\n}\n\n.fi-drop-area .success {\n color: var(--grey-6);\n}\n"],sourceRoot:""}]);let a=
|
|
22
|
+
`,"",{version:3,sources:["webpack://./../../libraries/compute-utils/dist/old-components/css/file-input.css"],names:[],mappings:"AAAA;EACE,kBAAkB;AACpB;;AAEA;EACE,oBAAoB;AACtB;;AAEA;EACE,gCAAgC;EAChC,gCAAgC;EAChC,oBAAoB;AACtB;;AAEA;EACE,mBAAmB;AACrB;;AAEA;EACE,oBAAoB;AACtB",sourcesContent:[".fi-drop-area {\n position: relative;\n}\n\n.fi-drop-area .default {\n color: var(--grey-2);\n}\n\n.fi-drop-area .drag-n-dropping {\n background-color: var(--steel-1);\n border: 1px dashed var(--blue-1);\n color: var(--grey-3);\n}\n\n.fi-drop-area .error {\n color: var(--red-3);\n}\n\n.fi-drop-area .success {\n color: var(--grey-6);\n}\n"],sourceRoot:""}]);let a=s},602(t,e,n){"use strict";n.d(e,{A:()=>a});var i=n(126),r=n.n(i),o=n(454),s=n.n(o)()(r());s.push([t.id,"","",{version:3,sources:[],names:[],mappings:"",sourceRoot:""}]);let a=s},128(t,e,n){"use strict";n.d(e,{A:()=>a});var i=n(126),r=n.n(i),o=n(454),s=n.n(o)()(r());s.push([t.id,`.hp-no-elements-label {
|
|
23
23
|
margin: 12px;
|
|
24
24
|
}
|
|
25
25
|
|
|
@@ -61,7 +61,7 @@ var compute_test;(()=>{var t={76(t,e,n){"use strict";n.d(e,{A:()=>a});var i=n(12
|
|
|
61
61
|
color: var(--grey-3);
|
|
62
62
|
margin-left: 5px;
|
|
63
63
|
}
|
|
64
|
-
`,"",{version:3,sources:["webpack://./../../libraries/compute-utils/dist/old-components/css/history-panel.css"],names:[],mappings:"AAAA;IACI,YAAY;AAChB;;AAEA;IACI,oBAAoB;IACpB,YAAY;AAChB;;AAEA;IACI,aAAa;AACjB;;AAEA;IACI,aAAa;IACb,uBAAuB;AAC3B;;AAEA;IACI,eAAe;IACf,YAAY;IACZ,8BAA8B;AAClC;;AAEA;IACI,6BAA6B;IAC7B,gBAAgB;AACpB;;AAEA;IACI,kBAAkB;AACtB;;AAEA;IACI,kBAAkB;IAClB,oBAAoB;AACxB;;AAEA;IACI,oBAAoB;IACpB,gBAAgB;AACpB",sourcesContent:[".hp-no-elements-label {\n margin: 12px;\n}\n\n.grok-icon.hp-disabled {\n pointer-events: none;\n opacity: 0.6;\n}\n\n.hp-funccall-card-hover-icon {\n display: none;\n}\n\n.hp-funccall-card:hover .hp-funccall-card-hover-icon {\n display: flex;\n margin: 0px 0px 0px 5px;\n}\n\n.hp-funccall-card {\n margin: 2px 1px;\n padding: 5px;\n justify-content: space-between;\n}\n\n.hp-funccall-card .hp-card-content {\n justify-content: space-around;\n margin-left: 5px;\n}\n\n.hp-funccall-card .hp-card-content * {\n margin-bottom: 3px;\n}\n\n.hp-funccall-card .description {\n margin-bottom: 2px;\n color: var(--grey-3);\n}\n\n.hp-funccall-card .date {\n color: var(--grey-3);\n margin-left: 5px;\n}\n"],sourceRoot:""}]);let a=
|
|
64
|
+
`,"",{version:3,sources:["webpack://./../../libraries/compute-utils/dist/old-components/css/history-panel.css"],names:[],mappings:"AAAA;IACI,YAAY;AAChB;;AAEA;IACI,oBAAoB;IACpB,YAAY;AAChB;;AAEA;IACI,aAAa;AACjB;;AAEA;IACI,aAAa;IACb,uBAAuB;AAC3B;;AAEA;IACI,eAAe;IACf,YAAY;IACZ,8BAA8B;AAClC;;AAEA;IACI,6BAA6B;IAC7B,gBAAgB;AACpB;;AAEA;IACI,kBAAkB;AACtB;;AAEA;IACI,kBAAkB;IAClB,oBAAoB;AACxB;;AAEA;IACI,oBAAoB;IACpB,gBAAgB;AACpB",sourcesContent:[".hp-no-elements-label {\n margin: 12px;\n}\n\n.grok-icon.hp-disabled {\n pointer-events: none;\n opacity: 0.6;\n}\n\n.hp-funccall-card-hover-icon {\n display: none;\n}\n\n.hp-funccall-card:hover .hp-funccall-card-hover-icon {\n display: flex;\n margin: 0px 0px 0px 5px;\n}\n\n.hp-funccall-card {\n margin: 2px 1px;\n padding: 5px;\n justify-content: space-between;\n}\n\n.hp-funccall-card .hp-card-content {\n justify-content: space-around;\n margin-left: 5px;\n}\n\n.hp-funccall-card .hp-card-content * {\n margin-bottom: 3px;\n}\n\n.hp-funccall-card .description {\n margin-bottom: 2px;\n color: var(--grey-3);\n}\n\n.hp-funccall-card .date {\n color: var(--grey-3);\n margin-left: 5px;\n}\n"],sourceRoot:""}]);let a=s},902(t,e,n){"use strict";n.d(e,{A:()=>a});var i=n(126),r=n.n(i),o=n(454),s=n.n(o)()(r());s.push([t.id,`.ui-form .ui-input-root.ui-input-buttons.rfv-buttons {
|
|
65
65
|
margin-top: 0px;
|
|
66
66
|
position: sticky;
|
|
67
67
|
align-items: flex-start;
|
|
@@ -142,7 +142,7 @@ div.ui-box > div.ui-box.rfv-form > div.ui-div {
|
|
|
142
142
|
|
|
143
143
|
.rfv-scalar-table td:last-child {
|
|
144
144
|
width: 100%;
|
|
145
|
-
}`,"",{version:3,sources:["webpack://./../../libraries/compute-utils/dist/old-views/css/rich-function-view.css"],names:[],mappings:"AAAA;IACI,eAAe;IACf,gBAAgB;IAChB,uBAAuB;AAC3B;;AAEA;IACI,eAAe;AACnB;;AAEA;IACI,mBAAmB;IACnB,yBAAyB;AAC7B;;AAEA,oCAAoC;AACpC;;;;IAII,aAAa;AACjB;;AAEA,mDAAmD;AACnD;IACI,gBAAgB;AACpB;;AAEA,+DAA+D;AAC/D;IACI,gBAAgB;AACpB;;AAEA,+CAA+C;AAC/C;IACI,aAAa;AACjB;AACA;IACI,gBAAgB;AACpB;AACA;IACI,aAAa;AACjB;AACA;IACI,gBAAgB;AACpB;;AAEA;IACI,2BAA2B;AAC/B;;AAEA;IACI,QAAQ;IACR,yBAAyB;AAC7B;;AAEA;IACI,2BAA2B;AAC/B;;AAEA;IACI,yBAAyB;IACzB,YAAY;AAChB;;AAEA;IACI,kBAAkB;IAClB,mBAAmB;AACvB;;AAEA;IACI,gBAAgB;IAChB,uCAAuC;AAC3C;;AAEA;IACI,+BAA+B;AACnC;;AAEA;IACI,WAAW;AACf",sourcesContent:[".ui-form .ui-input-root.ui-input-buttons.rfv-buttons {\n margin-top: 0px;\n position: sticky;\n align-items: flex-start;\n}\n\n.ui-form .ui-input-buttons.rfv-buttons .ui-input-editor {\n flex-wrap: wrap;\n}\n\n.ui-input-root.rfv-restricted-input.d4-disabled {\n pointer-events: all;\n cursor: pointer!important;\n}\n\n/* Hide all state icons by default */\n.ui-input-root > .ui-input-options .rfv-icon-lock,\n.ui-input-root > .ui-input-options .rfv-icon-unlock,\n.ui-input-root > .ui-input-options .rfv-icon-undo,\n.ui-input-root > .ui-input-options .rfv-icon-warning {\n display: none;\n}\n\n/* Show warning icon if input is on warning state */\n.ui-input-root.rfv-inconsistent-input > .ui-input-options .rfv-icon-warning {\n display: inherit;\n}\n\n/* Show undo icon if input is on inconstent state and hovered */\n.ui-input-root.rfv-restricted-unlocked-input:hover .rfv-icon-undo, .ui-input-root.rfv-inconsistent-input:hover .rfv-icon-undo {\n display: inherit;\n}\n\n/* Show/hide lock-unlock icons on input hover */\n.ui-input-root.rfv-restricted-input:hover .rfv-icon-lock {\n display: none;\n}\n.ui-input-root.rfv-restricted-input .rfv-icon-lock {\n display: inherit;\n}\n.ui-input-root.rfv-restricted-input .rfv-icon-unlock {\n display: none;\n}\n.ui-input-root.rfv-restricted-input:hover .rfv-icon-unlock {\n display: inherit;\n}\n\n.ui-form-condensed .rfv-buttons > .ui-label {\n margin-right: 0px!important;\n}\n\n.rfv-form .ui-form .rfv-buttons > .ui-input-editor {\n gap: 5px;\n justify-content: flex-end;\n}\n\ndiv.ui-box > div.ui-box.rfv-form > div.ui-div {\n overflow: visible!important;\n}\n\n.rfv-scalar-table {\n border-collapse: collapse;\n margin: 10px;\n}\n\n.rfv-scalar-table td {\n width: max-content;\n white-space: nowrap;\n}\n\n.rfv-scalar-table tr{\n min-height: 30px;\n border-bottom: 1pt solid var(--grey-12);\n}\n\n.rfv-scalar-table tr:nth-child(odd) {\n background-color: var(--grey-1);\n}\n\n.rfv-scalar-table td:last-child {\n width: 100%;\n}"],sourceRoot:""}]);let a=o},454(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,r,s){"string"==typeof t&&(t=[[null,t,void 0]]);var o={};if(i)for(var a=0;a<this.length;a++){var l=this[a][0];null!=l&&(o[l]=!0)}for(var u=0;u<t.length;u++){var c=[].concat(t[u]);i&&o[c[0]]||(void 0!==s&&(void 0===c[5]||(c[1]="@layer".concat(c[5].length>0?" ".concat(c[5]):""," {").concat(c[1],"}")),c[5]=s),n&&(c[2]&&(c[1]="@media ".concat(c[2]," {").concat(c[1],"}")),c[2]=n),r&&(c[4]?(c[1]="@supports (".concat(c[4],") {").concat(c[1],"}"),c[4]=r):c[4]="".concat(r)),e.push(c))}},e}},126(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))));return[e].concat(["/*# ".concat("sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(i)," */")]).join("\n")}return[e].join("\n")}},474(t){t.exports=function(){"use strict";var t="minute",e=/[+-]\d\d(?::?\d\d)?/g,n=/([+-]|\d\d)/g;return function(i,r,s){var o=r.prototype;s.utc=function(t){var e={date:t,utc:!0,args:arguments};return new r(e)},o.utc=function(e){var n=s(this.toDate(),{locale:this.$L,utc:!0});return e?n.add(this.utcOffset(),t):n},o.local=function(){return s(this.toDate(),{locale:this.$L,utc:!1})};var a=o.parse;o.parse=function(t){t.utc&&(this.$u=!0),this.$utils().u(t.$offset)||(this.$offset=t.$offset),a.call(this,t)};var l=o.init;o.init=function(){if(this.$u){var t=this.$d;this.$y=t.getUTCFullYear(),this.$M=t.getUTCMonth(),this.$D=t.getUTCDate(),this.$W=t.getUTCDay(),this.$H=t.getUTCHours(),this.$m=t.getUTCMinutes(),this.$s=t.getUTCSeconds(),this.$ms=t.getUTCMilliseconds()}else l.call(this)};var u=o.utcOffset;o.utcOffset=function(i,r){var s=this.$utils().u;if(s(i))return this.$u?0:s(this.$offset)?u.call(this):this.$offset;if("string"==typeof i&&null===(i=function(t){void 0===t&&(t="");var i=t.match(e);if(!i)return null;var r=(""+i[0]).match(n)||["-",0,0],s=r[0],o=60*r[1]+ +r[2];return 0===o?0:"+"===s?o:-o}(i)))return this;var o=16>=Math.abs(i)?60*i:i;if(0===o)return this.utc(r);var a=this.clone();if(r)return a.$offset=o,a.$u=!1,a;var l=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();return(a=this.local().add(o+l,t)).$offset=o,a.$x.$localOffset=l,a};var c=o.format;o.format=function(t){var e=t||(this.$u?"YYYY-MM-DDTHH:mm:ss[Z]":"");return c.call(this,e)},o.valueOf=function(){var t=this.$utils().u(this.$offset)?0:this.$offset+(this.$x.$localOffset||this.$d.getTimezoneOffset());return this.$d.valueOf()-6e4*t},o.isUTC=function(){return!!this.$u},o.toISOString=function(){return this.toDate().toISOString()},o.toString=function(){return this.toDate().toUTCString()};var d=o.toDate;o.toDate=function(t){return"s"===t&&this.$offset?s(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate():d.call(this)};var p=o.diff;o.diff=function(t,e,n){if(t&&this.$u===t.$u)return p.call(this,t,e,n);var i=this.local(),r=s(t).local();return p.call(i,r,e,n)}}}()},397(t){!function(e,n){var i={};n(i);var r=i.default;for(var s in i)r[s]=i[s];"object"==typeof t.exports?t.exports=r:"function"==typeof define&&define.amd?define(function(){return r}):e.sha256=r}(this,function(t){"use strict";t.__esModule=!0,t.digestLength=32,t.blockSize=64;var e=new Uint32Array([0x428a2f98,0x71374491,0xb5c0fbcf,0xe9b5dba5,0x3956c25b,0x59f111f1,0x923f82a4,0xab1c5ed5,0xd807aa98,0x12835b01,0x243185be,0x550c7dc3,0x72be5d74,0x80deb1fe,0x9bdc06a7,0xc19bf174,0xe49b69c1,0xefbe4786,0xfc19dc6,0x240ca1cc,0x2de92c6f,0x4a7484aa,0x5cb0a9dc,0x76f988da,0x983e5152,0xa831c66d,0xb00327c8,0xbf597fc7,0xc6e00bf3,0xd5a79147,0x6ca6351,0x14292967,0x27b70a85,0x2e1b2138,0x4d2c6dfc,0x53380d13,0x650a7354,0x766a0abb,0x81c2c92e,0x92722c85,0xa2bfe8a1,0xa81a664b,0xc24b8b70,0xc76c51a3,0xd192e819,0xd6990624,0xf40e3585,0x106aa070,0x19a4c116,0x1e376c08,0x2748774c,0x34b0bcb5,0x391c0cb3,0x4ed8aa4a,0x5b9cca4f,0x682e6ff3,0x748f82ee,0x78a5636f,0x84c87814,0x8cc70208,0x90befffa,0xa4506ceb,0xbef9a3f7,0xc67178f2]);function n(t,n,i,r,s){for(var o,a,l,u,c,d,p,h,f,m,y,g,v;s>=64;){for(m=0,o=n[0],a=n[1],l=n[2],u=n[3],c=n[4],d=n[5],p=n[6],h=n[7];m<16;m++)y=r+4*m,t[m]=(255&i[y])<<24|(255&i[y+1])<<16|(255&i[y+2])<<8|255&i[y+3];for(m=16;m<64;m++)g=((f=t[m-2])>>>17|f<<15)^(f>>>19|f<<13)^f>>>10,v=((f=t[m-15])>>>7|f<<25)^(f>>>18|f<<14)^f>>>3,t[m]=(g+t[m-7]|0)+(v+t[m-16]|0);for(m=0;m<64;m++)g=(((c>>>6|c<<26)^(c>>>11|c<<21)^(c>>>25|c<<7))+(c&d^~c&p)|0)+(h+(e[m]+t[m]|0)|0)|0,v=((o>>>2|o<<30)^(o>>>13|o<<19)^(o>>>22|o<<10))+(o&a^o&l^a&l)|0,h=p,p=d,d=c,c=u+g|0,u=l,l=a,a=o,o=g+v|0;n[0]+=o,n[1]+=a,n[2]+=l,n[3]+=u,n[4]+=c,n[5]+=d,n[6]+=p,n[7]+=h,r+=64,s-=64}return r}var i=function(){function e(){this.digestLength=t.digestLength,this.blockSize=t.blockSize,this.state=new Int32Array(8),this.temp=new Int32Array(64),this.buffer=new Uint8Array(128),this.bufferLength=0,this.bytesHashed=0,this.finished=!1,this.reset()}return e.prototype.reset=function(){return this.state[0]=0x6a09e667,this.state[1]=0xbb67ae85,this.state[2]=0x3c6ef372,this.state[3]=0xa54ff53a,this.state[4]=0x510e527f,this.state[5]=0x9b05688c,this.state[6]=0x1f83d9ab,this.state[7]=0x5be0cd19,this.bufferLength=0,this.bytesHashed=0,this.finished=!1,this},e.prototype.clean=function(){for(var t=0;t<this.buffer.length;t++)this.buffer[t]=0;for(var t=0;t<this.temp.length;t++)this.temp[t]=0;this.reset()},e.prototype.update=function(t,e){if(void 0===e&&(e=t.length),this.finished)throw Error("SHA256: can't update because hash was finished.");var i=0;if(this.bytesHashed+=e,this.bufferLength>0){for(;this.bufferLength<64&&e>0;)this.buffer[this.bufferLength++]=t[i++],e--;64===this.bufferLength&&(n(this.temp,this.state,this.buffer,0,64),this.bufferLength=0)}for(e>=64&&(i=n(this.temp,this.state,t,i,e),e%=64);e>0;)this.buffer[this.bufferLength++]=t[i++],e--;return this},e.prototype.finish=function(t){if(!this.finished){var e=this.bytesHashed,i=this.bufferLength,r=e/0x20000000|0,s=e<<3,o=e%64<56?64:128;this.buffer[i]=128;for(var a=i+1;a<o-8;a++)this.buffer[a]=0;this.buffer[o-8]=r>>>24&255,this.buffer[o-7]=r>>>16&255,this.buffer[o-6]=r>>>8&255,this.buffer[o-5]=r>>>0&255,this.buffer[o-4]=s>>>24&255,this.buffer[o-3]=s>>>16&255,this.buffer[o-2]=s>>>8&255,this.buffer[o-1]=s>>>0&255,n(this.temp,this.state,this.buffer,0,o),this.finished=!0}for(var a=0;a<8;a++)t[4*a+0]=this.state[a]>>>24&255,t[4*a+1]=this.state[a]>>>16&255,t[4*a+2]=this.state[a]>>>8&255,t[4*a+3]=this.state[a]>>>0&255;return this},e.prototype.digest=function(){var t=new Uint8Array(this.digestLength);return this.finish(t),t},e.prototype._saveState=function(t){for(var e=0;e<this.state.length;e++)t[e]=this.state[e]},e.prototype._restoreState=function(t,e){for(var n=0;n<this.state.length;n++)this.state[n]=t[n];this.bytesHashed=e,this.finished=!1,this.bufferLength=0},e}();t.Hash=i;var r=function(){function t(t){this.inner=new i,this.outer=new i,this.blockSize=this.inner.blockSize,this.digestLength=this.inner.digestLength;var e=new Uint8Array(this.blockSize);if(t.length>this.blockSize)new i().update(t).finish(e).clean();else for(var n=0;n<t.length;n++)e[n]=t[n];for(var n=0;n<e.length;n++)e[n]^=54;this.inner.update(e);for(var n=0;n<e.length;n++)e[n]^=106;this.outer.update(e),this.istate=new Uint32Array(8),this.ostate=new Uint32Array(8),this.inner._saveState(this.istate),this.outer._saveState(this.ostate);for(var n=0;n<e.length;n++)e[n]=0}return t.prototype.reset=function(){return this.inner._restoreState(this.istate,this.inner.blockSize),this.outer._restoreState(this.ostate,this.outer.blockSize),this},t.prototype.clean=function(){for(var t=0;t<this.istate.length;t++)this.ostate[t]=this.istate[t]=0;this.inner.clean(),this.outer.clean()},t.prototype.update=function(t){return this.inner.update(t),this},t.prototype.finish=function(t){return this.outer.finished?this.outer.finish(t):(this.inner.finish(t),this.outer.update(t,this.digestLength).finish(t)),this},t.prototype.digest=function(){var t=new Uint8Array(this.digestLength);return this.finish(t),t},t}();function s(t){var e=new i().update(t),n=e.digest();return e.clean(),n}function o(t,e){var n=new r(t).update(e),i=n.digest();return n.clean(),i}t.HMAC=r,t.hash=s,t.default=s,t.hmac=o;var a=new Uint8Array(t.digestLength);t.hkdf=function(t,e,n,i){void 0===e&&(e=a),void 0===i&&(i=32);for(var s=new Uint8Array([1]),l=new r(o(e,t)),u=new Uint8Array(l.digestLength),c=u.length,d=new Uint8Array(i),p=0;p<i;p++)c===u.length&&(!function(t,e,n,i){var r=i[0];if(0===r)throw Error("hkdf: cannot expand more");e.reset(),r>1&&e.update(t),n&&e.update(n),e.update(i),e.finish(t),i[0]++}(u,l,n,s),c=0),d[p]=u[c++];return l.clean(),u.fill(0),s.fill(0),d},t.pbkdf2=function(t,e,n,i){for(var s=new r(t),o=s.digestLength,a=new Uint8Array(4),l=new Uint8Array(o),u=new Uint8Array(o),c=new Uint8Array(i),d=0;d*o<i;d++){var p=d+1;a[0]=p>>>24&255,a[1]=p>>>16&255,a[2]=p>>>8&255,a[3]=p>>>0&255,s.reset(),s.update(e),s.update(a),s.finish(u);for(var h=0;h<o;h++)l[h]=u[h];for(var h=2;h<=n;h++){s.reset(),s.update(u).finish(u);for(var f=0;f<o;f++)l[f]^=u[f]}for(var h=0;h<o&&d*o+h<i;h++)c[d*o+h]=l[h]}for(var d=0;d<o;d++)l[d]=u[d]=0;for(var d=0;d<4;d++)a[d]=0;return s.clean(),c}})},2(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 r={},s=[],o=0;o<t.length;o++){var a=t[o],l=i.base?a[0]+i.base:a[0],u=r[l]||0,c="".concat(l," ").concat(u);r[l]=u+1;var d=n(c),p={css:a[1],media:a[2],sourceMap:a[3],supports:a[4],layer:a[5]};if(-1!==d)e[d].references++,e[d].updater(p);else{var h=function(t,e){var n=e.domAPI(e);return n.update(t),function(e){e?(e.css!==t.css||e.media!==t.media||e.sourceMap!==t.sourceMap||e.supports!==t.supports||e.layer!==t.layer)&&n.update(t=e):n.remove()}}(p,i);i.byIndex=o,e.splice(o,0,{identifier:c,updater:h,references:1})}s.push(c)}return s}t.exports=function(t,r){var s=i(t=t||[],r=r||{});return function(t){t=t||[];for(var o=0;o<s.length;o++){var a=n(s[o]);e[a].references--}for(var l=i(t,r),u=0;u<s.length;u++){var c=n(s[u]);0===e[c].references&&(e[c].updater(),e.splice(c,1))}s=l}}},129(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 Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");i.appendChild(n)}},838(t){"use strict";t.exports=function(t){var e=document.createElement("style");return t.setAttributes(e,t.attributes),t.insert(e,t.options),e}},986(t,e,n){"use strict";t.exports=function(t){var e=n.nc;e&&t.setAttribute("nonce",e)}},611(t){"use strict";t.exports=function(t){if("u"<typeof document)return{update:function(){},remove:function(){}};var e=t.insertStyleElement(t);return{update:function(n){var i,r,s;i="",n.supports&&(i+="@supports (".concat(n.supports,") {")),n.media&&(i+="@media ".concat(n.media," {")),(r=void 0!==n.layer)&&(i+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),i+=n.css,r&&(i+="}"),n.media&&(i+="}"),n.supports&&(i+="}"),(s=n.sourceMap)&&"u">typeof btoa&&(i+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(s))))," */")),t.styleTagTransform(i,e,t.options)},remove:function(){var t;null===(t=e).parentNode||t.parentNode.removeChild(t)}}}},515(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 r=e[i];if(void 0!==r)return r.exports;var s=e[i]={id:i,exports:{}};return t[i].call(s.exports,s,s.exports,n),s.exports}n.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return n.d(e,{a:e}),e},n.d=(t,e)=>{for(var 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=>{"u">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";let t,e;n.r(i),n.d(i,{tests:()=>c,test:()=>nH,_package:()=>nW,initAutoTests:()=>nY});let r=DG;n(397);let s=DG.DataFrame.fromCsv(`countries,fasta,smiles,molregno,LON,Zip Code,Street Address Line 1,ImageUrl,user_id,error_message,xray,flag,magnitude,CS-id,pdb_id,accel_a,time_offset,chart,fit,Questions,empty_number,empty_string
|
|
145
|
+
}`,"",{version:3,sources:["webpack://./../../libraries/compute-utils/dist/old-views/css/rich-function-view.css"],names:[],mappings:"AAAA;IACI,eAAe;IACf,gBAAgB;IAChB,uBAAuB;AAC3B;;AAEA;IACI,eAAe;AACnB;;AAEA;IACI,mBAAmB;IACnB,yBAAyB;AAC7B;;AAEA,oCAAoC;AACpC;;;;IAII,aAAa;AACjB;;AAEA,mDAAmD;AACnD;IACI,gBAAgB;AACpB;;AAEA,+DAA+D;AAC/D;IACI,gBAAgB;AACpB;;AAEA,+CAA+C;AAC/C;IACI,aAAa;AACjB;AACA;IACI,gBAAgB;AACpB;AACA;IACI,aAAa;AACjB;AACA;IACI,gBAAgB;AACpB;;AAEA;IACI,2BAA2B;AAC/B;;AAEA;IACI,QAAQ;IACR,yBAAyB;AAC7B;;AAEA;IACI,2BAA2B;AAC/B;;AAEA;IACI,yBAAyB;IACzB,YAAY;AAChB;;AAEA;IACI,kBAAkB;IAClB,mBAAmB;AACvB;;AAEA;IACI,gBAAgB;IAChB,uCAAuC;AAC3C;;AAEA;IACI,+BAA+B;AACnC;;AAEA;IACI,WAAW;AACf",sourcesContent:[".ui-form .ui-input-root.ui-input-buttons.rfv-buttons {\n margin-top: 0px;\n position: sticky;\n align-items: flex-start;\n}\n\n.ui-form .ui-input-buttons.rfv-buttons .ui-input-editor {\n flex-wrap: wrap;\n}\n\n.ui-input-root.rfv-restricted-input.d4-disabled {\n pointer-events: all;\n cursor: pointer!important;\n}\n\n/* Hide all state icons by default */\n.ui-input-root > .ui-input-options .rfv-icon-lock,\n.ui-input-root > .ui-input-options .rfv-icon-unlock,\n.ui-input-root > .ui-input-options .rfv-icon-undo,\n.ui-input-root > .ui-input-options .rfv-icon-warning {\n display: none;\n}\n\n/* Show warning icon if input is on warning state */\n.ui-input-root.rfv-inconsistent-input > .ui-input-options .rfv-icon-warning {\n display: inherit;\n}\n\n/* Show undo icon if input is on inconstent state and hovered */\n.ui-input-root.rfv-restricted-unlocked-input:hover .rfv-icon-undo, .ui-input-root.rfv-inconsistent-input:hover .rfv-icon-undo {\n display: inherit;\n}\n\n/* Show/hide lock-unlock icons on input hover */\n.ui-input-root.rfv-restricted-input:hover .rfv-icon-lock {\n display: none;\n}\n.ui-input-root.rfv-restricted-input .rfv-icon-lock {\n display: inherit;\n}\n.ui-input-root.rfv-restricted-input .rfv-icon-unlock {\n display: none;\n}\n.ui-input-root.rfv-restricted-input:hover .rfv-icon-unlock {\n display: inherit;\n}\n\n.ui-form-condensed .rfv-buttons > .ui-label {\n margin-right: 0px!important;\n}\n\n.rfv-form .ui-form .rfv-buttons > .ui-input-editor {\n gap: 5px;\n justify-content: flex-end;\n}\n\ndiv.ui-box > div.ui-box.rfv-form > div.ui-div {\n overflow: visible!important;\n}\n\n.rfv-scalar-table {\n border-collapse: collapse;\n margin: 10px;\n}\n\n.rfv-scalar-table td {\n width: max-content;\n white-space: nowrap;\n}\n\n.rfv-scalar-table tr{\n min-height: 30px;\n border-bottom: 1pt solid var(--grey-12);\n}\n\n.rfv-scalar-table tr:nth-child(odd) {\n background-color: var(--grey-1);\n}\n\n.rfv-scalar-table td:last-child {\n width: 100%;\n}"],sourceRoot:""}]);let a=s},454(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,r,o){"string"==typeof t&&(t=[[null,t,void 0]]);var s={};if(i)for(var a=0;a<this.length;a++){var l=this[a][0];null!=l&&(s[l]=!0)}for(var u=0;u<t.length;u++){var c=[].concat(t[u]);i&&s[c[0]]||(void 0!==o&&(void 0===c[5]||(c[1]="@layer".concat(c[5].length>0?" ".concat(c[5]):""," {").concat(c[1],"}")),c[5]=o),n&&(c[2]&&(c[1]="@media ".concat(c[2]," {").concat(c[1],"}")),c[2]=n),r&&(c[4]?(c[1]="@supports (".concat(c[4],") {").concat(c[1],"}"),c[4]=r):c[4]="".concat(r)),e.push(c))}},e}},126(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))));return[e].concat(["/*# ".concat("sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(i)," */")]).join("\n")}return[e].join("\n")}},474(t){t.exports=function(){"use strict";var t="minute",e=/[+-]\d\d(?::?\d\d)?/g,n=/([+-]|\d\d)/g;return function(i,r,o){var s=r.prototype;o.utc=function(t){var e={date:t,utc:!0,args:arguments};return new r(e)},s.utc=function(e){var n=o(this.toDate(),{locale:this.$L,utc:!0});return e?n.add(this.utcOffset(),t):n},s.local=function(){return o(this.toDate(),{locale:this.$L,utc:!1})};var a=s.parse;s.parse=function(t){t.utc&&(this.$u=!0),this.$utils().u(t.$offset)||(this.$offset=t.$offset),a.call(this,t)};var l=s.init;s.init=function(){if(this.$u){var t=this.$d;this.$y=t.getUTCFullYear(),this.$M=t.getUTCMonth(),this.$D=t.getUTCDate(),this.$W=t.getUTCDay(),this.$H=t.getUTCHours(),this.$m=t.getUTCMinutes(),this.$s=t.getUTCSeconds(),this.$ms=t.getUTCMilliseconds()}else l.call(this)};var u=s.utcOffset;s.utcOffset=function(i,r){var o=this.$utils().u;if(o(i))return this.$u?0:o(this.$offset)?u.call(this):this.$offset;if("string"==typeof i&&null===(i=function(t){void 0===t&&(t="");var i=t.match(e);if(!i)return null;var r=(""+i[0]).match(n)||["-",0,0],o=r[0],s=60*r[1]+ +r[2];return 0===s?0:"+"===o?s:-s}(i)))return this;var s=16>=Math.abs(i)?60*i:i;if(0===s)return this.utc(r);var a=this.clone();if(r)return a.$offset=s,a.$u=!1,a;var l=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();return(a=this.local().add(s+l,t)).$offset=s,a.$x.$localOffset=l,a};var c=s.format;s.format=function(t){var e=t||(this.$u?"YYYY-MM-DDTHH:mm:ss[Z]":"");return c.call(this,e)},s.valueOf=function(){var t=this.$utils().u(this.$offset)?0:this.$offset+(this.$x.$localOffset||this.$d.getTimezoneOffset());return this.$d.valueOf()-6e4*t},s.isUTC=function(){return!!this.$u},s.toISOString=function(){return this.toDate().toISOString()},s.toString=function(){return this.toDate().toUTCString()};var d=s.toDate;s.toDate=function(t){return"s"===t&&this.$offset?o(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate():d.call(this)};var p=s.diff;s.diff=function(t,e,n){if(t&&this.$u===t.$u)return p.call(this,t,e,n);var i=this.local(),r=o(t).local();return p.call(i,r,e,n)}}}()},397(t){!function(e,n){var i={};n(i);var r=i.default;for(var o in i)r[o]=i[o];"object"==typeof t.exports?t.exports=r:"function"==typeof define&&define.amd?define(function(){return r}):e.sha256=r}(this,function(t){"use strict";t.__esModule=!0,t.digestLength=32,t.blockSize=64;var e=new Uint32Array([0x428a2f98,0x71374491,0xb5c0fbcf,0xe9b5dba5,0x3956c25b,0x59f111f1,0x923f82a4,0xab1c5ed5,0xd807aa98,0x12835b01,0x243185be,0x550c7dc3,0x72be5d74,0x80deb1fe,0x9bdc06a7,0xc19bf174,0xe49b69c1,0xefbe4786,0xfc19dc6,0x240ca1cc,0x2de92c6f,0x4a7484aa,0x5cb0a9dc,0x76f988da,0x983e5152,0xa831c66d,0xb00327c8,0xbf597fc7,0xc6e00bf3,0xd5a79147,0x6ca6351,0x14292967,0x27b70a85,0x2e1b2138,0x4d2c6dfc,0x53380d13,0x650a7354,0x766a0abb,0x81c2c92e,0x92722c85,0xa2bfe8a1,0xa81a664b,0xc24b8b70,0xc76c51a3,0xd192e819,0xd6990624,0xf40e3585,0x106aa070,0x19a4c116,0x1e376c08,0x2748774c,0x34b0bcb5,0x391c0cb3,0x4ed8aa4a,0x5b9cca4f,0x682e6ff3,0x748f82ee,0x78a5636f,0x84c87814,0x8cc70208,0x90befffa,0xa4506ceb,0xbef9a3f7,0xc67178f2]);function n(t,n,i,r,o){for(var s,a,l,u,c,d,p,h,f,m,y,v,g;o>=64;){for(m=0,s=n[0],a=n[1],l=n[2],u=n[3],c=n[4],d=n[5],p=n[6],h=n[7];m<16;m++)y=r+4*m,t[m]=(255&i[y])<<24|(255&i[y+1])<<16|(255&i[y+2])<<8|255&i[y+3];for(m=16;m<64;m++)v=((f=t[m-2])>>>17|f<<15)^(f>>>19|f<<13)^f>>>10,g=((f=t[m-15])>>>7|f<<25)^(f>>>18|f<<14)^f>>>3,t[m]=(v+t[m-7]|0)+(g+t[m-16]|0);for(m=0;m<64;m++)v=(((c>>>6|c<<26)^(c>>>11|c<<21)^(c>>>25|c<<7))+(c&d^~c&p)|0)+(h+(e[m]+t[m]|0)|0)|0,g=((s>>>2|s<<30)^(s>>>13|s<<19)^(s>>>22|s<<10))+(s&a^s&l^a&l)|0,h=p,p=d,d=c,c=u+v|0,u=l,l=a,a=s,s=v+g|0;n[0]+=s,n[1]+=a,n[2]+=l,n[3]+=u,n[4]+=c,n[5]+=d,n[6]+=p,n[7]+=h,r+=64,o-=64}return r}var i=function(){function e(){this.digestLength=t.digestLength,this.blockSize=t.blockSize,this.state=new Int32Array(8),this.temp=new Int32Array(64),this.buffer=new Uint8Array(128),this.bufferLength=0,this.bytesHashed=0,this.finished=!1,this.reset()}return e.prototype.reset=function(){return this.state[0]=0x6a09e667,this.state[1]=0xbb67ae85,this.state[2]=0x3c6ef372,this.state[3]=0xa54ff53a,this.state[4]=0x510e527f,this.state[5]=0x9b05688c,this.state[6]=0x1f83d9ab,this.state[7]=0x5be0cd19,this.bufferLength=0,this.bytesHashed=0,this.finished=!1,this},e.prototype.clean=function(){for(var t=0;t<this.buffer.length;t++)this.buffer[t]=0;for(var t=0;t<this.temp.length;t++)this.temp[t]=0;this.reset()},e.prototype.update=function(t,e){if(void 0===e&&(e=t.length),this.finished)throw Error("SHA256: can't update because hash was finished.");var i=0;if(this.bytesHashed+=e,this.bufferLength>0){for(;this.bufferLength<64&&e>0;)this.buffer[this.bufferLength++]=t[i++],e--;64===this.bufferLength&&(n(this.temp,this.state,this.buffer,0,64),this.bufferLength=0)}for(e>=64&&(i=n(this.temp,this.state,t,i,e),e%=64);e>0;)this.buffer[this.bufferLength++]=t[i++],e--;return this},e.prototype.finish=function(t){if(!this.finished){var e=this.bytesHashed,i=this.bufferLength,r=e/0x20000000|0,o=e<<3,s=e%64<56?64:128;this.buffer[i]=128;for(var a=i+1;a<s-8;a++)this.buffer[a]=0;this.buffer[s-8]=r>>>24&255,this.buffer[s-7]=r>>>16&255,this.buffer[s-6]=r>>>8&255,this.buffer[s-5]=r>>>0&255,this.buffer[s-4]=o>>>24&255,this.buffer[s-3]=o>>>16&255,this.buffer[s-2]=o>>>8&255,this.buffer[s-1]=o>>>0&255,n(this.temp,this.state,this.buffer,0,s),this.finished=!0}for(var a=0;a<8;a++)t[4*a+0]=this.state[a]>>>24&255,t[4*a+1]=this.state[a]>>>16&255,t[4*a+2]=this.state[a]>>>8&255,t[4*a+3]=this.state[a]>>>0&255;return this},e.prototype.digest=function(){var t=new Uint8Array(this.digestLength);return this.finish(t),t},e.prototype._saveState=function(t){for(var e=0;e<this.state.length;e++)t[e]=this.state[e]},e.prototype._restoreState=function(t,e){for(var n=0;n<this.state.length;n++)this.state[n]=t[n];this.bytesHashed=e,this.finished=!1,this.bufferLength=0},e}();t.Hash=i;var r=function(){function t(t){this.inner=new i,this.outer=new i,this.blockSize=this.inner.blockSize,this.digestLength=this.inner.digestLength;var e=new Uint8Array(this.blockSize);if(t.length>this.blockSize)new i().update(t).finish(e).clean();else for(var n=0;n<t.length;n++)e[n]=t[n];for(var n=0;n<e.length;n++)e[n]^=54;this.inner.update(e);for(var n=0;n<e.length;n++)e[n]^=106;this.outer.update(e),this.istate=new Uint32Array(8),this.ostate=new Uint32Array(8),this.inner._saveState(this.istate),this.outer._saveState(this.ostate);for(var n=0;n<e.length;n++)e[n]=0}return t.prototype.reset=function(){return this.inner._restoreState(this.istate,this.inner.blockSize),this.outer._restoreState(this.ostate,this.outer.blockSize),this},t.prototype.clean=function(){for(var t=0;t<this.istate.length;t++)this.ostate[t]=this.istate[t]=0;this.inner.clean(),this.outer.clean()},t.prototype.update=function(t){return this.inner.update(t),this},t.prototype.finish=function(t){return this.outer.finished?this.outer.finish(t):(this.inner.finish(t),this.outer.update(t,this.digestLength).finish(t)),this},t.prototype.digest=function(){var t=new Uint8Array(this.digestLength);return this.finish(t),t},t}();function o(t){var e=new i().update(t),n=e.digest();return e.clean(),n}function s(t,e){var n=new r(t).update(e),i=n.digest();return n.clean(),i}t.HMAC=r,t.hash=o,t.default=o,t.hmac=s;var a=new Uint8Array(t.digestLength);t.hkdf=function(t,e,n,i){void 0===e&&(e=a),void 0===i&&(i=32);for(var o=new Uint8Array([1]),l=new r(s(e,t)),u=new Uint8Array(l.digestLength),c=u.length,d=new Uint8Array(i),p=0;p<i;p++)c===u.length&&(!function(t,e,n,i){var r=i[0];if(0===r)throw Error("hkdf: cannot expand more");e.reset(),r>1&&e.update(t),n&&e.update(n),e.update(i),e.finish(t),i[0]++}(u,l,n,o),c=0),d[p]=u[c++];return l.clean(),u.fill(0),o.fill(0),d},t.pbkdf2=function(t,e,n,i){for(var o=new r(t),s=o.digestLength,a=new Uint8Array(4),l=new Uint8Array(s),u=new Uint8Array(s),c=new Uint8Array(i),d=0;d*s<i;d++){var p=d+1;a[0]=p>>>24&255,a[1]=p>>>16&255,a[2]=p>>>8&255,a[3]=p>>>0&255,o.reset(),o.update(e),o.update(a),o.finish(u);for(var h=0;h<s;h++)l[h]=u[h];for(var h=2;h<=n;h++){o.reset(),o.update(u).finish(u);for(var f=0;f<s;f++)l[f]^=u[f]}for(var h=0;h<s&&d*s+h<i;h++)c[d*s+h]=l[h]}for(var d=0;d<s;d++)l[d]=u[d]=0;for(var d=0;d<4;d++)a[d]=0;return o.clean(),c}})},2(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 r={},o=[],s=0;s<t.length;s++){var a=t[s],l=i.base?a[0]+i.base:a[0],u=r[l]||0,c="".concat(l," ").concat(u);r[l]=u+1;var d=n(c),p={css:a[1],media:a[2],sourceMap:a[3],supports:a[4],layer:a[5]};if(-1!==d)e[d].references++,e[d].updater(p);else{var h=function(t,e){var n=e.domAPI(e);return n.update(t),function(e){e?(e.css!==t.css||e.media!==t.media||e.sourceMap!==t.sourceMap||e.supports!==t.supports||e.layer!==t.layer)&&n.update(t=e):n.remove()}}(p,i);i.byIndex=s,e.splice(s,0,{identifier:c,updater:h,references:1})}o.push(c)}return o}t.exports=function(t,r){var o=i(t=t||[],r=r||{});return function(t){t=t||[];for(var s=0;s<o.length;s++){var a=n(o[s]);e[a].references--}for(var l=i(t,r),u=0;u<o.length;u++){var c=n(o[u]);0===e[c].references&&(e[c].updater(),e.splice(c,1))}o=l}}},129(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 Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");i.appendChild(n)}},838(t){"use strict";t.exports=function(t){var e=document.createElement("style");return t.setAttributes(e,t.attributes),t.insert(e,t.options),e}},986(t,e,n){"use strict";t.exports=function(t){var e=n.nc;e&&t.setAttribute("nonce",e)}},611(t){"use strict";t.exports=function(t){if("u"<typeof document)return{update:function(){},remove:function(){}};var e=t.insertStyleElement(t);return{update:function(n){var i,r,o;i="",n.supports&&(i+="@supports (".concat(n.supports,") {")),n.media&&(i+="@media ".concat(n.media," {")),(r=void 0!==n.layer)&&(i+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),i+=n.css,r&&(i+="}"),n.media&&(i+="}"),n.supports&&(i+="}"),(o=n.sourceMap)&&"u">typeof btoa&&(i+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(o))))," */")),t.styleTagTransform(i,e,t.options)},remove:function(){var t;null===(t=e).parentNode||t.parentNode.removeChild(t)}}}},515(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 r=e[i];if(void 0!==r)return r.exports;var o=e[i]={id:i,exports:{}};return t[i].call(o.exports,o,o.exports,n),o.exports}n.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return n.d(e,{a:e}),e},n.d=(t,e)=>{for(var i in e)n.o(e,i)&&!n.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},n.g=(()=>{if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(t){if("object"==typeof window)return window}})(),n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),n.r=t=>{"u">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";let t,e;n.r(i),n.d(i,{tests:()=>y,test:()=>io,_package:()=>ir,initAutoTests:()=>is});let r=DG;n(397);let o=DG.DataFrame.fromCsv(`countries,fasta,smiles,molregno,LON,Zip Code,Street Address Line 1,ImageUrl,user_id,error_message,xray,flag,magnitude,CS-id,pdb_id,accel_a,time_offset,chart,fit,Questions,empty_number,empty_string
|
|
146
146
|
Belgium,MSNFHNEHVMQFYRNNLKTKGVFGRQ,CC(C(=O)OCCCc1cccnc1)c2cccc(c2)C(=O)c3ccccc3,1480014,36.276729583740234,995042300,14016 ROUTE 31W,https://datagrok.ai/img/slides/access-db-connect.png,id,ErrorMessage,"COMPND
|
|
147
147
|
ATOM
|
|
148
148
|
END",flag,1,1,1QBS,1,1.23,<chart></chart>,"{""series"":[{""name"":""Run:2023-08-08"",""fitFunction"":""sigmoid"",""fitLineColor"":""#1f77b4"",""pointColor"":""#1f77b4"",""showPoints"":""points"",""parameters"":[2.497360340644872, 1.7058694986686864, 5.278052678195135, 0.16000320889028383],""points"":[{""x"":0.10000000149011612,""y"":2.374499797821045},{""x"":0.6000000238418579,""y"":2.6242473125457764},{""x"":1.100000023841858,""y"":2.367267608642578},{""x"":1.600000023841858,""y"":2.6723148822784424},{""x"":2.0999999046325684,""y"":2.6537344455718994},{""x"":2.5999999046325684,""y"":2.3651671409606934},{""x"":3.0999999046325684,""y"":2.5654284954071045},{""x"":3.5999999046325684,""y"":2.4160959720611572},{""x"":4.099999904632568,""y"":2.286726713180542},{""x"":4.599999904632568,""y"":2.5100042819976807},{""x"":5.099999904632568,""y"":1.6676985025405884},{""x"":5.599999904632568,""y"":0.680136501789093},{""x"":6.099999904632568,""y"":0.3391543924808502},{""x"":6.599999904632568,""y"":0.09038983285427094},{""x"":7.099999904632568,""y"":0.19802775979042053}]},{""name"":""Run:2023-08-08"",""fitLineColor"":""#ffbb78"",""pointColor"":""#ffbb78"",""showPoints"":""points"",""parameters"":[7.525235855508179, 1.3186911876809984, 5.335672608564294, 0.7860743343958098],""points"":[{""x"":0.10000000149011612,""y"":7.988070487976074},{""x"":0.6000000238418579,""y"":7.018453121185303},{""x"":1.100000023841858,""y"":8.115279197692871},{""x"":1.600000023841858,""y"":7.486658096313477},{""x"":2.0999999046325684,""y"":7.396438121795654},{""x"":2.5999999046325684,""y"":7.477052211761475},{""x"":3.0999999046325684,""y"":6.913095474243164},{""x"":3.5999999046325684,""y"":8.01385498046875},{""x"":4.099999904632568,""y"":6.985900402069092},{""x"":4.599999904632568,""y"":6.970335960388184},{""x"":5.099999904632568,""y"":5.448817253112793},{""x"":5.599999904632568,""y"":2.5534818172454834},{""x"":6.099999904632568,""y"":1.893947958946228},{""x"":6.599999904632568,""y"":0.6340042352676392},{""x"":7.099999904632568,""y"":0.8403874039649963}]}],""chartOptions"":{""xAxisName"":""Conc."",""yAxisName"":""Activity"",""title"":""Dose-Response curves""}}",text,100,abc
|
|
@@ -173,8 +173,8 @@ END",flag,9,9,2BDJ,9,1.23,<chart></chart>,"{""series"":[{""name"":""Run:2023-08-
|
|
|
173
173
|
Switzerland,IRVVGRYLIEVWKAAGMDMDKVLFLWSSDEI,CN1CCC(CC1)Oc2ccc(cc2)C(F)(F)F,1480028,36.33137130737305,99504,92-11 179TH PLACE,https://datagrok.ai/img/slides/access-db-connect.png,id,ErrorMessage,"COMPND
|
|
174
174
|
ATOM
|
|
175
175
|
END",flag,9,10,1IAN,10,1.23,<chart></chart>,"{""series"":[{""name"":""Run:2023-08-08"",""fitFunction"":""sigmoid"",""fitLineColor"":""#1f77b4"",""pointColor"":""#1f77b4"",""showPoints"":""points"",""parameters"":[1.1190255865097471, 2.3163895161544437, 5.4968866182279195, 0.2035204047289052],""points"":[{""x"":0.10000000149011612,""y"":1.1057683229446411},{""x"":0.6000000238418579,""y"":1.1019697189331055},{""x"":1.100000023841858,""y"":1.0818607807159424},{""x"":1.600000023841858,""y"":1.062997817993164},{""x"":2.0999999046325684,""y"":1.046447515487671},{""x"":2.5999999046325684,""y"":1.1217249631881714},{""x"":3.0999999046325684,""y"":1.2166996002197266},{""x"":3.5999999046325684,""y"":1.215477705001831},{""x"":4.099999904632568,""y"":1.0581893920898438},{""x"":4.599999904632568,""y"":1.1747995615005493},{""x"":5.099999904632568,""y"":1.0181127786636353},{""x"":5.599999904632568,""y"":0.5344523191452026},{""x"":6.099999904632568,""y"":0.2569526433944702},{""x"":6.599999904632568,""y"":0.1912207305431366},{""x"":7.099999904632568,""y"":0.15060538053512573}]},{""name"":""Run:2023-08-08"",""fitLineColor"":""#ffbb78"",""pointColor"":""#ffbb78"",""showPoints"":""points"",""parameters"":[3.1038581025805785, 2.0032224204185245, 5.087602825989163, 0.13277988512492753],""points"":[{""x"":0.10000000149011612,""y"":3.0498509407043457},{""x"":0.6000000238418579,""y"":2.805217742919922},{""x"":1.100000023841858,""y"":3.3415253162384033},{""x"":1.600000023841858,""y"":3.0549843311309814},{""x"":2.0999999046325684,""y"":3.250074863433838},{""x"":2.5999999046325684,""y"":3.0432586669921875},{""x"":3.0999999046325684,""y"":3.265852451324463},{""x"":3.5999999046325684,""y"":2.9475724697113037},{""x"":4.099999904632568,""y"":3.1929898262023926},{""x"":4.599999904632568,""y"":2.7460060119628906},{""x"":5.099999904632568,""y"":1.6175861358642578},{""x"":5.599999904632568,""y"":0.3006608486175537},{""x"":6.099999904632568,""y"":0.3444803059101105},{""x"":6.599999904632568,""y"":0.015537971630692482},{""x"":7.099999904632568,""y"":0.5527358055114746}]}],""chartOptions"":{""xAxisName"":""Conc."",""yAxisName"":""Activity"",""title"":""Dose-Response curves""}}",text,,
|
|
176
|
-
,,,,,,,,,,,,,,,,,,,,,`);s.columns.add(DG.Column.fromList(DG.TYPE.BYTE_ARRAY,"BinaryImage",Array.from(
|
|
177
|
-
${t.stack?
|
|
178
|
-
Please ensure that you have opened DevTools (F12) / Performance panel before test starts.`)))}catch(e){u(e),a={name:t.name,owner:t.options?.owner??"",category:t.category,logs:"",date:h,success:!1,result:await R(e),ms:0,skipped:!1,package:r??"",flaking:!1}}if(t.options?.isAggregated&&a.result.constructor===DG.DataFrame){let t=a.result.col("success");if(t&&(a.success=t.stats.sum===t.length),!s){let t=a.result;t.columns.remove("stack"),t.rows.removeWhere(t=>t.get("success")),a.result=t}a.result=a.result.toCsv()}if(a.logs=n.join("\n"),a.ms=Date.now()-p,c||o(`Package testing: Finished {{${t.category}}} {{${t.name}}} with {{${a.success?"success":"error"}}} for ${a.ms} ms`),a.success||o(`Package testing: Result for {{${t.category}}} {{${t.name}}}: ${a.result}`),a.category=t.category,a.name=t.name,a.owner=t.options?.owner??"",!l){let e={success:a.success,result:a.result,ms:a.ms,date:a.date,skipped:a.skipped,category:t.category,name:t.name,logs:a.logs,owner:a.owner,flaking:DG.Test.isReproducing&&a.success,package:a.package};if(a.result.constructor==Object){let t=Object.keys(a.result).reduce((t,e)=>({...t,["result."+e]:a.result[e]}),{});e={...e,...t}}e.result instanceof DG.DataFrame&&(e.result=JSON.stringify(e.result?.toJson())||""),await grok.shell.reportTest("package",e)}return a}async function E(t){await new Promise(e=>setTimeout(e,t))}async function O(t,e,n="EXECUTION TIMEOUT"){let i=null,r=new Promise((t,r)=>{i=setTimeout(()=>{r(n)},e)});try{return await Promise.race([t(),r])}finally{i&&clearTimeout(i)}}function S(t,e,n,i,r,s,o){try{var a=t[s](o),l=a.value}catch(t){n(t);return}a.done?e(l):Promise.resolve(l).then(i,r)}function P(){var t;return(t=function*(){let t=r.Func.find({package:"Compute",name:"init"})[0];t&&(yield t.prepare().call())},function(){var e=this,n=arguments;return new Promise(function(i,r){var s=t.apply(e,n);function o(t){S(s,i,r,o,a,"next",t)}function a(t){S(s,i,r,o,a,"throw",t)}o(void 0)})})()}function k(...t){return new window.compute.RFV(...t)}DG.DataFrame.fromColumns([DG.Column.fromStrings("col",["val1","val2","val3"])]);let D=rxjs.operators;"function"==typeof TextDecoder&&new TextDecoder("utf-8",{ignoreBOM:!0}),"function"==typeof TextEncoder&&new TextEncoder;let L=Array.prototype.slice.call("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="),V=(e={},L.forEach((t,n)=>e[t]=n),e),F=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,M=String.fromCharCode.bind(String),N="function"==typeof Uint8Array.from?Uint8Array.from.bind(Uint8Array):t=>new Uint8Array(Array.prototype.slice.call(t,0)),B="function"==typeof btoa?t=>btoa(t):t=>{let e,n,i,r,s="",o=t.length%3;for(let o=0;o<t.length;){if((n=t.charCodeAt(o++))>255||(i=t.charCodeAt(o++))>255||(r=t.charCodeAt(o++))>255)throw TypeError("invalid character found");s+=L[(e=n<<16|i<<8|r)>>18&63]+L[e>>12&63]+L[e>>6&63]+L[63&e]}return o?s.slice(0,o-3)+"===".substring(o):s},j="function"==typeof Uint8Array.prototype.toBase64?t=>t.toBase64():t=>{let e=[];for(let n=0,i=t.length;n<i;n+=4096)e.push(M.apply(null,t.subarray(n,n+4096)));return B(e.join(""))},_=(t,e=!1)=>e?j(t).replace(/=/g,"").replace(/[+\/]/g,t=>"+"==t?"-":"_"):j(t),U="function"==typeof atob?t=>atob(t.replace(/[^A-Za-z0-9\+\/]/g,"")):t=>{let e,n,i;if(t=t.replace(/\s+/g,""),!F.test(t))throw TypeError("malformed base64.");t+="==".slice(2-(3&t.length));let r=[];for(let s=0;s<t.length;)e=V[t.charAt(s++)]<<18|V[t.charAt(s++)]<<12|(n=V[t.charAt(s++)])<<6|(i=V[t.charAt(s++)]),64===n?r.push(M(e>>16&255)):64===i?r.push(M(e>>16&255,e>>8&255)):r.push(M(e>>16&255,e>>8&255,255&e));return r.join("")},W="function"==typeof Uint8Array.fromBase64?t=>Uint8Array.fromBase64(t):t=>N(U(t).split("").map(t=>t.charCodeAt(0))),H=t=>t.replace(/[-_]/g,t=>"-"==t?"+":"/").replace(/[^A-Za-z0-9\+\/]/g,""),Y=dayjs;var G,Z,J,z,Q,K,q,X,tt,te,tn,ti,tr=n.n(Y);let ts="_DG_CUSTOM_SERIALIZED_TOKEN_";function to(t){return JSON.parse(t,tl)}function ta(t){return to(JSON.stringify(t))}function tl(t,e){if(e&&e[ts]&&e.value)switch(e[ts]){case"DataFrame":return r.DataFrame.fromByteArray(W(H(e.value)));case"DataFrameJSON":return r.DataFrame.fromJson(JSON.stringify(e.value));case"ArrayBuffer":return W(H(e.value)).buffer;case"Map":return new Map(e.value);case"DayJs":return tr()(e.value);case"Set":return new Set(e.value);case"Infinity":return 1/0;case"-Infinity":return-1/0;case"NaN":return NaN}return e}function tu(t){return{inputs:[...t.inputs.entries()],outputs:[...t.outputs.entries()]}}function tc(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=Array(e);n<e;n++)i[n]=t[n];return i}class td extends Error{}function tp(t,e,n){new tv(n).run(t,e)}function th(){}function tf(t,e){if(t!==e)return[{msg:`Expected ${e}, got ${t}`}]}function tm(t,e,n,i){let r=[];if(t.length!==e.length){let n={msg:`Arrays are of different length: actual array length is ${t.length} and expected array length is ${e.length}`};r.push(n)}for(let n=0;n<t.length;n++)i([String(n)],t[n],e[n]);return r}function ty(t,e){let n=[],i=new Set(e);var r=!0,s=!1,o=void 0;try{for(var a,l=t[Symbol.iterator]();!(r=(a=l.next()).done);r=!0){let t=a.value;if(!i.has(t)){let e={msg:`Additional key/col item in actual data found: ${t}`};n.push(e)}}}catch(t){s=!0,o=t}finally{try{r||null==l.return||l.return()}finally{if(s)throw o}}return n}let tg={floatTolerance:.001,maxErrorsReport:5,forbidAdditionalProps:!1,maxDepth:128,checkersSeq:[{name:"NaN",predicate:function(t,e){return Number.isNaN(t)&&Number.isNaN(e)},checker:th},{name:"Null",predicate:function(t,e){return null==t&&null==e},checker:th},{name:"Boolean",predicate:function(t,e){return"boolean"==typeof t&&"boolean"==typeof e},checker:tf},{name:"String",predicate:function(t,e){return"string"==typeof t&&"string"==typeof e},checker:tf},{name:"Integer",predicate:function(t,e){return Number.isInteger(t)&&Number.isInteger(e)},checker:tf},{name:"BigInt",predicate:function(t,e){return"bigint"==typeof t&&"bigint"==typeof e},checker:tf},{name:"Float",predicate:function(t,e){return"number"==typeof t&&"number"==typeof e},checker:function(t,e,n){if(!(t===1/0&&e===1/0||t===-1/0&&e===-1/0||isNaN(t)&&isNaN(e))&&!(Math.abs(t-e)<n.options.floatTolerance))return[{msg:`Expected ${e}, got ${t} (tolerance = ${n.options.floatTolerance})`}]}},{name:"Map",predicate:function(t,e){return t instanceof Map&&e instanceof Map},checker:function(t,e,n,i){let r=[];n.options.forbidAdditionalProps&&r.push(...ty([...t.keys()],[...e.keys()]));var s=!0,o=!1,a=void 0;try{for(var l,u=e.keys()[Symbol.iterator]();!(s=(l=u.next()).done);s=!0){let n=l.value,r=t.get(n),s=e.get(n);i([String(n)],r,s)}}catch(t){o=!0,a=t}finally{try{s||null==u.return||u.return()}finally{if(o)throw a}}return r}},{name:"Set",predicate:function(t,e){return t instanceof Set&&e instanceof Set},checker:function(t,e,n,i){let r=[];if(t.size!==e.size){let n={msg:`Sets are of different size: actual set size is ${t.size} and expected set size is ${e.size}`};r.push(n)}var s=!0,o=!1,a=void 0;try{for(var l,u=e.values()[Symbol.iterator]();!(s=(l=u.next()).done);s=!0){let e=l.value,n=t.has(e);i([String(e)],n,!0)}}catch(t){o=!0,a=t}finally{try{s||null==u.return||u.return()}finally{if(o)throw a}}return r}},{name:"ArrayBuffer",predicate:function(t,e){return t instanceof ArrayBuffer&&e instanceof ArrayBuffer},checker:function(t,e,n,i){return tm(Array.from(new Uint8Array(t)),Array.from(new Uint8Array(e)),n,i)}},{name:"Array",predicate:function(t,e){return t instanceof Array&&e instanceof Array},checker:tm},{name:"DataFrame",predicate:function(t,e){return t instanceof r.DataFrame&&e instanceof r.DataFrame},checker:function(t,e,n,i){let r=[];if(t.rowCount!==e.rowCount){let n={msg:`Dataframes has different row count: actual row count is ${t.rowCount} and expected row count is ${e.rowCount}`};r.push(n)}n.options.forbidAdditionalProps&&r.push(...ty([...t.columns].map(t=>t.name),[...e.columns].map(t=>t.name)));var s=!0,o=!1,a=void 0;try{for(var l,u=e.columns[Symbol.iterator]();!(s=(l=u.next()).done);s=!0){let n=l.value,s=t.columns.byName(n.name);if(!s){let t={msg:`Column ${n.name} not found`};r.push(t);continue}if(s.type!==n.type){let t={msg:`Column ${n.name} type expected ${n.type} got ${s.type}`};r.push(t);continue}for(let t=0;t<e.rowCount;t++){let e=s.get(t),r=n.get(t);i([n.name,String(t)],e,r)}}}catch(t){o=!0,a=t}finally{try{s||null==u.return||u.return()}finally{if(o)throw a}}return r}},{name:"DayJs",predicate:function(t,e){return tr().isDayjs(t)&&tr().isDayjs(e)},checker:function(t,e){if(!e.isSame(t))return[{msg:`Different date, expected ${e.toISOString()} actual ${t.toISOString()}`}]}},{name:"Object",predicate:function(t,e){return"object"==typeof t&&"object"==typeof e},checker:function(t,e,n,i){let r=[];n.options.forbidAdditionalProps&&r.push(...ty([...Object.keys(t)],[...Object.keys(e)]));var s=!0,o=!1,a=void 0;try{for(var l,u,c=Object.entries(e)[Symbol.iterator]();!(s=(u=c.next()).done);s=!0){let e=(l=u.value,function(t){if(Array.isArray(t))return t}(l)||function(t){var e,n,i=null==t?null:"u">typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=i){var r=[],s=!0,o=!1;try{for(i=i.call(t);!(s=(e=i.next()).done)&&(r.push(e.value),2!==r.length);s=!0);}catch(t){o=!0,n=t}finally{try{s||null==i.return||i.return()}finally{if(o)throw n}}return r}}(l)||function(t){if(t){if("string"==typeof t)return tc(t,2);var e=Object.prototype.toString.call(t).slice(8,-1);if("Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e)return Array.from(e);if("Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e))return tc(t,2)}}(l)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),n=e[0],r=e[1],s=t[n];i([n],s,r)}}catch(t){o=!0,a=t}finally{try{s||null==c.return||c.return()}finally{if(o)throw a}}return r}}],prefix:""};class tv{run(t,e){this.matchChecker(t,e),this.checkErrorsLimit(0)}checkDeep(t,e,n){let i=t.length;if(this.state.currentPath.push(...t),this.state.currentPath.length>this.options.maxDepth)throw new td(`Max depth ${this.options.maxDepth} is exceeded, potentially a circular structure`);this.matchChecker(e,n),this.state.currentPath.splice(-i)}matchChecker(t,e){let n=!1;var i=!0,r=!1,s=void 0;try{for(var o,a=this.options.checkersSeq[Symbol.iterator]();!(i=(o=a.next()).done);i=!0){let i=o.value,r=i.predicate,s=i.checker;if(r(t,e)){n=!0;let i=s(t,e,this.state,this.checkDeep.bind(this));i&&i.map(t=>this.addError(t));break}}}catch(t){r=!0,s=t}finally{try{i||null==a.return||a.return()}finally{if(r)throw s}}if(!n){let n={msg:`Type mismatch or no checker defined: expected ${e}, got ${t}`};this.addError(n)}}addError(t){var e,n;let i={path:[...null!=(e=this.state.currentPath)?e:[],...null!=(n=t.path)?n:[]],msg:t.msg};this.state.errors.push(i),this.checkErrorsLimit()}checkErrorsLimit(t){let e=void 0===t?this.options.maxErrorsReport:t;if(this.state.errors.length>e)throw new td(this.makeReport())}makeReport(){return this.state.errors.map(t=>{var e;let n=(null!=(e=t.path)?e:[]).map(t=>`['${String(t)}']`).join("."),i=n?`${n}: ${t.msg}`:t.msg;return this.options.prefix?`${this.options.prefix}: ${i}`:i}).slice(0,this.options.maxErrorsReport).join("\n")}constructor(t){this.options=function(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{},i=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(i=i.concat(Object.getOwnPropertySymbols(n).filter(function(t){return Object.getOwnPropertyDescriptor(n,t).enumerable}))),i.forEach(function(e){var i;i=n[e],e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i})}return t}({},tg,void 0===t?{}:t),this.state={errors:[],currentPath:[],options:this.options}}}var tb=JSON.parse('{"inputs":[["df",{"_DG_CUSTOM_SERIALIZED_TOKEN_":"DataFrame","value":"KaAAAAAAAAAIQAAAAAAAAPA/A6EAAAAAAAAUQGRmb3V0KqABAAAAA6EAAAAAAAAIQC5pZAOhAAAAAAAAQkBlNDk0MWE2MC05YjAwLTExZWYtY2JjMC1jOTUzNzQ3OGNkZTcooAOhAAAAAAAACEBjb2wDoQAAAAAAABhAZG91YmxlKqACAAAAA6EAAAAAAAAIQC5pZAOhAAAAAAAAQkBlNDRhOGU0MC05YjAwLTExZWYtZDA4ZC0yM2QxNzBmZGJiY2IDoQAAAAAAADxALnNlbWFudGljLWRldGVjdGlvbi1kdXJhdGlvbgOhAAAAAAAA8D8zBQAAAAEAAAACoQAAAAAAAAhAzcyMP83MDEAzM1NAA6EAAAAAAFCDQHsiI3R5cGUiOiJUYWJsZXNCbG9iIiwidmVyc2lvbiI6IjAuNi4wLTMwYTc1NjlkIiwidGFibGVzIjpbeyJjb2x1bW5zIjpbeyJuYW1lIjoiY29sIiwidHlwZSI6ImRvdWJsZSIsImlkIjoiZTQ0YThlNDAtOWIwMC0xMWVmLWQwOGQtMjNkMTcwZmRiYmNiIiwiZnJpZW5kbHlOYW1lIjoiQ29sIiwiZW50aXR5VGFncyI6W3sidGFnIjoiLmlkIiwiaWQiOiJlNGVlZTQ5MC05YjAwLTExZWYtZGNhZi1iM2JlNTZkYWFiMjEifSx7InRhZyI6Ii5zZW1hbnRpYy1kZXRlY3Rpb24tZHVyYXRpb24iLCJpZCI6ImU0ZWVlNDkwLTliMDAtMTFlZi1kZmM2LWM5ODIzZjZmZWMyYSJ9XSwibWV0YVBhcmFtcyI6eyIuaWQiOiJlNDRhOGU0MC05YjAwLTExZWYtZDA4ZC0yM2QxNzBmZGJiY2IiLCIuc2VtYW50aWMtZGV0ZWN0aW9uLWR1cmF0aW9uIjoiMyJ9fV0sInJvd0NvdW50IjozLCJjb2xDb3VudCI6MSwiaWQiOiJlNDk0MWE2MC05YjAwLTExZWYtY2JjMC1jOTUzNzQ3OGNkZTciLCJuYW1lIjoiRGZvdXQiLCJmcmllbmRseU5hbWUiOiJkZm91dCIsImVudGl0eVRhZ3MiOlt7InRhZyI6Ii5pZCIsImlkIjoiZTRlZWU0OTAtOWIwMC0xMWVmLWY1YzMtYjVlNTEyZTlkMDQ1In1dLCJtZXRhUGFyYW1zIjp7fX1dfQihAAAAAAAA8D8AAAAACKEAAAAAAADwP2IAAAADoQAAAAAAACxAMC42LjAtMzBhNzU2OWSoAgAA"}],["data","{\\"a\\":1,\\"b\\":\\"test\\"}"]],"outputs":[["dfout",{"_DG_CUSTOM_SERIALIZED_TOKEN_":"DataFrame","value":"KaAAAAAAAAAIQAAAAAAAAPA/A6EAAAAAAAAUQGRmb3V0KqABAAAAA6EAAAAAAAAIQC5pZAOhAAAAAAAAQkBlNDU5MGQzMC05YjAwLTExZWYtYmM0Mi1iYmZhMDBhYzUxM2IooAOhAAAAAAAACEBjb2wDoQAAAAAAABhAZG91YmxlKqACAAAAA6EAAAAAAAAIQC5pZAOhAAAAAAAAQkBlNDRhOGU0MC05YjAwLTExZWYtZDA4ZC0yM2QxNzBmZGJiY2IDoQAAAAAAADxALnNlbWFudGljLWRldGVjdGlvbi1kdXJhdGlvbgOhAAAAAAAA8D8zBQAAAAEAAAACoQAAAAAAAAhAzcyMP83MDEAzM1NAA6EAAAAAAFCDQHsiI3R5cGUiOiJUYWJsZXNCbG9iIiwidmVyc2lvbiI6IjAuNi4wLTMwYTc1NjlkIiwidGFibGVzIjpbeyJjb2x1bW5zIjpbeyJuYW1lIjoiY29sIiwidHlwZSI6ImRvdWJsZSIsImlkIjoiZTQ0YThlNDAtOWIwMC0xMWVmLWQwOGQtMjNkMTcwZmRiYmNiIiwiZnJpZW5kbHlOYW1lIjoiQ29sIiwiZW50aXR5VGFncyI6W3sidGFnIjoiLmlkIiwiaWQiOiJlNGVmMGJhMC05YjAwLTExZWYtOTEwZC02OTA2ZDYxM2FjMDEifSx7InRhZyI6Ii5zZW1hbnRpYy1kZXRlY3Rpb24tZHVyYXRpb24iLCJpZCI6ImU0ZWYzMmIwLTliMDAtMTFlZi1iZmUxLTBkYmZmMzQxYTRmZiJ9XSwibWV0YVBhcmFtcyI6eyIuaWQiOiJlNDRhOGU0MC05YjAwLTExZWYtZDA4ZC0yM2QxNzBmZGJiY2IiLCIuc2VtYW50aWMtZGV0ZWN0aW9uLWR1cmF0aW9uIjoiMyJ9fV0sInJvd0NvdW50IjozLCJjb2xDb3VudCI6MSwiaWQiOiJlNDU5MGQzMC05YjAwLTExZWYtYmM0Mi1iYmZhMDBhYzUxM2IiLCJuYW1lIjoiRGZvdXQiLCJmcmllbmRseU5hbWUiOiJkZm91dCIsImVudGl0eVRhZ3MiOlt7InRhZyI6Ii5pZCIsImlkIjoiZTRlZjMyYjAtOWIwMC0xMWVmLTkzZDAtNmI4MjEwMDE4OTFhIn1dLCJtZXRhUGFyYW1zIjp7fX1dfQihAAAAAAAA8D8AAAAACKEAAAAAAADwP2IAAAADoQAAAAAAACxAMC42LjAtMzBhNzU2OWSoAgAA"}],["dataout","{\\"a\\":1,\\"b\\":\\"test\\"}"]]}');function tC(t,e,n,i,r,s,o){try{var a=t[s](o),l=a.value}catch(t){n(t);return}a.done?e(l):Promise.resolve(l).then(i,r)}function tA(t){return function(){var e=this,n=arguments;return new Promise(function(i,r){var s=t.apply(e,n);function o(t){tC(s,i,r,o,a,"next",t)}function a(t){tC(s,i,r,o,a,"throw",t)}o(void 0)})}}C("Compute API: RFV Inputs",()=>tA(function*(){A(()=>tA(function*(){yield P()})()),v("Simple inputs setParamValue",()=>tA(function*(){let t=k("Compute:simpleInputs",{historyEnabled:!1,isTabbed:!1}),e={};t.afterInputPropertyRender.subscribe(({prop:t,input:n})=>{e[t.name]=n}),yield t.isReady.pipe((0,D.filter)(t=>t),(0,D.take)(1)).toPromise(),t.funcCall.setParamValue("a",1),t.funcCall.setParamValue("b",2.2),t.funcCall.setParamValue("c","test"),yield t.doRun();let n={inputs:[["a",1],["b",2.2],["c","test"]],outputs:[["aout",1],["bout",2.2],["cout","test"]]};for(let[i,r]of(tp(tu(t.funcCall),n,{prefix:"funcCall"}),tp(tu(t.lastCall),n,{prefix:"lastCall"}),Object.entries({a:1,b:2.2,c:"test"})))tp(e[i].value,r,{prefix:`input ${i}`})})()),v("Simple inputs inputs tweak",()=>tA(function*(){let t=k("Compute:simpleInputs",{historyEnabled:!1,isTabbed:!1}),e={a:1,b:2.2,c:"test"},n={};for(let[i,r]of(t.afterInputPropertyRender.subscribe(({prop:t,input:e})=>{n[t.name]=e}),yield t.isReady.pipe((0,D.filter)(t=>t),(0,D.take)(1)).toPromise(),yield E(100),Object.entries(n)))r.value=e[i],r.input.dispatchEvent(new Event("input",{bubbles:!0}));yield E(300),yield t.doRun();let i={inputs:[["a",1],["b",2.2],["c","test"]],outputs:[["aout",1],["bout",2.2],["cout","test"]]};tp(tu(t.funcCall),i,{prefix:"funcCall"}),tp(tu(t.lastCall),i,{prefix:"lastCall"})})()),v("Simple inputs setParamValue rerun",()=>tA(function*(){let t=k("Compute:simpleInputsDefaultValues",{historyEnabled:!1,isTabbed:!1}),e={};t.afterInputPropertyRender.subscribe(({prop:t,input:n})=>{e[t.name]=n}),yield t.isReady.pipe((0,D.filter)(t=>t),(0,D.take)(1)).toPromise(),yield E(100),yield t.doRun(),t.funcCall.setParamValue("a",2),t.funcCall.setParamValue("b",3.2),t.funcCall.setParamValue("c","test2"),yield t.doRun();let n={inputs:[["a",2],["b",3.2],["c","test2"]],outputs:[["aout",2],["bout",3.2],["cout","test2"]]};for(let[i,r]of(tp(tu(t.funcCall),n,{prefix:"funcCall"}),tp(tu(t.lastCall),n,{prefix:"lastCall"}),Object.entries({a:2,b:3.2,c:"test2"})))tp(e[i].value,r,{prefix:`input ${i}`})})()),v("Simple inputs inputs tweak rerun",()=>tA(function*(){let t=k("Compute:simpleInputsDefaultValues",{historyEnabled:!1,isTabbed:!1}),e={a:2,b:3.2,c:"test2"},n={};for(let[i,r]of(t.afterInputPropertyRender.subscribe(({prop:t,input:e})=>{n[t.name]=e}),yield t.isReady.pipe((0,D.filter)(t=>t),(0,D.take)(1)).toPromise(),yield E(100),yield t.doRun(),yield E(100),Object.entries(n)))r.value=e[i],r.input.dispatchEvent(new Event("input",{bubbles:!0}));yield E(300),yield t.doRun();let i={inputs:[["a",2],["b",3.2],["c","test2"]],outputs:[["aout",2],["bout",3.2],["cout","test2"]]};tp(tu(t.funcCall),i,{prefix:"funcCall"}),tp(tu(t.lastCall),i,{prefix:"lastCall"})})()),v("Simple inputs default values",()=>tA(function*(){let t=k("Compute:simpleInputsDefaultValues",{historyEnabled:!1,isTabbed:!1});yield t.isReady.pipe((0,D.filter)(t=>t),(0,D.take)(1)).toPromise(),yield E(100),tp(tu(t.funcCall).inputs,[["a",1],["b",2.2],["c","test"]])})()),v("Complex inputs setParamValue",()=>tA(function*(){let t=k("Compute:complexInputs",{historyEnabled:!1,isTabbed:!1}),e={df:r.DataFrame.fromColumns([r.Column.fromList("double","col",[1.1,2.2,3.3])]),data:JSON.stringify({a:1,b:"test"})},n={};t.afterInputPropertyRender.subscribe(({prop:t,input:e})=>{n[t.name]=e}),t.funcCall.setParamValue("df",e.df),t.funcCall.setParamValue("data",e.data),yield t.doRun(),tp(tu(t.funcCall),ta(tb),{prefix:"funcCall"}),tp(tu(t.lastCall),ta(tb),{prefix:"lastCall"}),tp(n.data.value,e.data,{prefix:"data"})})()),v("Complex inputs inputs tweak",()=>tA(function*(){let t=k("Compute:complexInputs",{historyEnabled:!1,isTabbed:!1}),e={df:r.DataFrame.fromColumns([r.Column.fromList("double","col",[1.1,2.2,3.3])]),data:JSON.stringify({a:1,b:"test"})},n={};t.afterInputPropertyRender.subscribe(({prop:t,input:e})=>{n[t.name]=e}),yield t.isReady.pipe((0,D.filter)(t=>t),(0,D.take)(1)).toPromise(),yield E(100),n.data.value=e.data,t.funcCall.setParamValue("df",e.df),yield E(300),yield t.doRun(),tp(tu(t.funcCall),ta(tb),{prefix:"funcCall"}),tp(tu(t.lastCall),ta(tb),{prefix:"lastCall"}),tp(n.data.value,e.data,{prefix:"data"})})()),v("Complex inputs setParamValue rerun",()=>tA(function*(){let t=k("Compute:complexInputs",{historyEnabled:!1,isTabbed:!1}),e={df:r.DataFrame.fromColumns([r.Column.fromList("double","col",[11.1,12.2,13.3])]),data:JSON.stringify({a:2,b:"pretest"})},n={};t.afterInputPropertyRender.subscribe(({prop:t,input:e})=>{n[t.name]=e}),yield t.isReady.pipe((0,D.filter)(t=>t),(0,D.take)(1)).toPromise(),t.funcCall.setParamValue("df",e.df),t.funcCall.setParamValue("data",e.data),yield t.doRun();let i={df:r.DataFrame.fromColumns([r.Column.fromList("double","col",[1.1,2.2,3.3])]),data:JSON.stringify({a:1,b:"test"})};t.funcCall.setParamValue("df",i.df),t.funcCall.setParamValue("data",i.data),yield t.doRun(),tp(tu(t.funcCall),ta(tb),{prefix:"funcCall"}),tp(tu(t.lastCall),ta(tb),{prefix:"lastCall"}),tp(n.data.value,i.data,{prefix:"data"})})()),v("Complex inputs inputs tweak rerun",()=>tA(function*(){let t=k("Compute:complexInputs",{historyEnabled:!1,isTabbed:!1}),e={df:r.DataFrame.fromColumns([r.Column.fromList("double","col",[11.1,12.2,13.3])]),data:JSON.stringify({a:2,b:"pretest"})},n={};t.afterInputPropertyRender.subscribe(({prop:t,input:e})=>{n[t.name]=e}),yield t.isReady.pipe((0,D.filter)(t=>t),(0,D.take)(1)).toPromise(),yield E(100),n.data.value=e.data,t.funcCall.setParamValue("df",e.df),yield E(300),yield t.doRun();let i={df:r.DataFrame.fromColumns([r.Column.fromList("double","col",[1.1,2.2,3.3])]),data:JSON.stringify({a:1,b:"test"})};n.data.value=i.data,t.funcCall.setParamValue("df",i.df),yield E(300),yield t.doRun(),tp(tu(t.funcCall),ta(tb),{prefix:"funcCall"}),tp(tu(t.lastCall),ta(tb),{prefix:"lastCall"}),tp(n.data.value,i.data,{prefix:"data"})})())})()),C("Compute API: RFV Validation",()=>tA(function*(){A(()=>tA(function*(){yield P()})()),v("Validate on start",()=>tA(function*(){let t=k("Compute:validationTest",{historyEnabled:!1,isTabbed:!1});yield t.isReady.pipe((0,D.filter)(t=>t),(0,D.take)(1)).toPromise(),yield E(1500),tp(t.getValidationState(),{a:{errors:[{description:"Missing value"},{description:"Out of range [1, 10] value: null"}],warnings:[],notifications:[],revalidate:[],context:{}},b:{errors:[{description:"Missing value"},{description:"Out of range [20, 100] value: null"}],warnings:[],notifications:[],revalidate:[],context:{}},x:{errors:[],warnings:[{description:"Try non-null value"}],notifications:[],revalidate:[],context:{}}})})()),v("Validate on input",()=>tA(function*(){let t=k("Compute:validationTest",{historyEnabled:!1,isTabbed:!1}),e={a:2.3,b:3.2,x:-1},n={};for(let[i,r]of(t.afterInputPropertyRender.subscribe(({prop:t,input:e})=>{n[t.name]=e}),yield t.isReady.pipe((0,D.filter)(t=>t),(0,D.take)(1)).toPromise(),yield E(1500),Object.entries(n)))r.value=e[i],r.input.dispatchEvent(new Event("input",{bubbles:!0}));yield E(400),tp(t.getValidationState(),{b:{errors:[{description:"Out of range [20, 100] value: 3.2"}]}})})()),v("Revalidation sequence",()=>tA(function*(){let t=k("Compute:globalValidationTest",{historyEnabled:!1,isTabbed:!1}),e={a:30,b:40,c:50},n={};for(let[i,r]of(t.afterInputPropertyRender.subscribe(({prop:t,input:e})=>{n[t.name]=e}),yield t.isReady.pipe((0,D.filter)(t=>t),(0,D.take)(1)).toPromise(),yield E(1500),Object.entries(n)))r.value=e[i],r.input.dispatchEvent(new Event("input",{bubbles:!0}));yield E(1e3),tp(t.getValidationState(),{a:{revalidate:["b","c"],context:{isOk:!1},warnings:[{description:"Try lowering a value"}]},b:{warnings:[{description:"Try lowering a value as well"}]},c:{warnings:[{description:"Try lowering a value as well"}]}})})())})());let tx=grok,tw=ui,tI=wu;var tR=n.n(tI);let tT=$;var tE=n.n(tT);let tO=rxjs;function tS(t,e,n,i,r,s,o){try{var a=t[s](o),l=a.value}catch(t){n(t);return}a.done?e(l):Promise.resolve(l).then(i,r)}function tP(t){var e;return!(null==t||null==(e=t.errors)?void 0:e.length)&&!(null==t?void 0:t.pending)}function tk(...t){let e=[],n=[],i=[],r=[],s={};var o=!0,a=!1,l=void 0;try{for(var u,c,d,p,h,f,m=t[Symbol.iterator]();!(o=(f=m.next()).done);o=!0){let t=f.value;t&&(e.push(...null!=(u=t.errors)?u:[]),n.push(...null!=(c=t.warnings)?c:[]),i.push(...null!=(d=t.notifications)?d:[]),r.push(...null!=(p=t.revalidate)?p:[]),s=function(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{},i=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(i=i.concat(Object.getOwnPropertySymbols(n).filter(function(t){return Object.getOwnPropertyDescriptor(n,t).enumerable}))),i.forEach(function(e){var i;i=n[e],e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i})}return t}({},s,null!=(h=t.context)?h:{}))}}catch(t){a=!0,l=t}finally{try{o||null==m.return||m.return()}finally{if(a)throw l}}return{errors:e,warnings:n,notifications:i,revalidate:r,context:s}}function tD(){return{pending:!0}}function tL(t){var e,n;let i,r,s;return(null==t?void 0:t.pending)&&(r=tw.iconFA("spinner",()=>{tV(t,r,i)},"Validating")).classList.add("fa-spin"),(null==t?void 0:t.errors)&&t.errors.length?(r=tw.iconFA("exclamation-circle",()=>{tV(t,r,i)},"Validation")).style.color="var(--red-3)":(null==t?void 0:t.warnings)&&t.warnings.length?(r=tw.iconFA("exclamation-circle",()=>{tV(t,r,i)},"Validation")).style.color="var(--orange-2)":(null==t?void 0:t.notifications)&&t.notifications.length&&((r=tw.iconFA("info-circle",()=>{tV(t,r,i)},"Info")).style.color="var(--blue-1)"),r&&(r.classList.remove("fal"),r.classList.add("far"),e=r,(n=s=tw.div([],"d4-tooltip")).popover="auto",n.style.fontStyle="normal",n.style.pointerEvents="all",n.style.maxWidth="300px",n.style.textWrap="pretty",e.appendChild(s),i=s),[null!=r?r:tw.div(),null!=i?i:tw.div()]}function tV(t,e,n){if(n&&e){var i,r;let s;for(i=e,r=n,s=i.getBoundingClientRect().toJSON(),r.style.inset="unset",r.style.top=s.y+"px",r.style.left=s.x+20+"px";n.firstChild&&n.removeChild(n.firstChild););let o=function(t){let e=tw.divV([],{style:{gap:"10px"}});for(let l=0,u=["errors","warnings","notifications"];l<u.length;l++){let c=u[l],d=t[c];if(null==d?void 0:d.length){var n=!0,i=!1,r=void 0;try{for(var s,o,a=d[Symbol.iterator]();!(n=(o=a.next()).done);n=!0){let t=o.value,n=function(t){let e;return"errors"===t?(e=tw.iconFA("exclamation-circle")).style.color="var(--red-3)":"warnings"===t?(e=tw.iconFA("exclamation-circle")).style.color="var(--orange-2)":"notifications"===t&&((e=tw.iconFA("info-circle")).style.color="var(--blue-1)"),e&&(e.classList.remove("fal"),e.classList.add("far")),e}(c);n.style.marginRight="4px",e.appendChild(tw.divV([tw.divH([n,tw.span([t.description])]),...(null!=(s=t.actions)?s:[]).map(t=>tw.link(t.actionName,t.action,void 0,{style:{paddingLeft:"20px"}}))]))}}catch(t){i=!0,r=t}finally{try{n||null==a.return||a.return()}finally{if(i)throw r}}}}return e}(t);n.appendChild(o),n.showPopover()}}let tF="#0.###",tM={barchart:r.VIEWER.BAR_CHART,boxplot:r.VIEWER.BOX_PLOT,calendar:r.VIEWER.CALENDAR,corrplot:r.VIEWER.CORR_PLOT,densityplot:r.VIEWER.DENSITY_PLOT,filters:r.VIEWER.FILTERS,form:r.VIEWER.FORM,globe:r.VIEWER.GLOBE,googlemap:r.VIEWER.GOOGLE_MAP,grid:r.VIEWER.GRID,heatmap:r.VIEWER.HEAT_MAP,histogram:r.VIEWER.HISTOGRAM,linechart:r.VIEWER.LINE_CHART,markup:r.VIEWER.MARKUP,matrixplot:r.VIEWER.MATRIX_PLOT,networkdiagram:r.VIEWER.NETWORK_DIAGRAM,pcplot:r.VIEWER.PC_PLOT,piechart:r.VIEWER.PIE_CHART,scatterplot:r.VIEWER.SCATTER_PLOT,"3dscatterplot":r.VIEWER.SCATTER_PLOT_3D,shapemap:r.VIEWER.SHAPE_MAP,statistics:r.VIEWER.STATISTICS,tileviewer:r.VIEWER.TILE_VIEWER,timelines:r.VIEWER.TIMELINES,treemap:r.VIEWER.TREE_MAP,trellisplot:r.VIEWER.TRELLIS_PLOT,wordcloud:r.VIEWER.WORD_CLOUD,diffstudiofacet:"DiffStudio Facet"},tN="JsCardView",tB="viewer",tj="experimental",t_="Run name",tU="RunId",t$="ModelStorage",tW="Source",tH="Is favorite",tY="Is complete",tG="Delete",tZ="Author",tJ="Date",tz="Title",tQ="Desc.",tK="Tags",tq="Version",tX=Object.values(r.COLUMN_TYPE).filter(t=>t!==r.TYPE.DATA_FRAME);function t0(t){return t&&t.root&&t.onInput}function t9(t){return(null==t?void 0:t.setValidation)&&t0(t)}function t1(t){return(null==t?void 0:t.setDisabled)&&(null==t?void 0:t.setRestricted)&&(null==t?void 0:t.setRestrictedUnlocked)&&(null==t?void 0:t.setInconsistent)&&(null==t?void 0:t.setUserInput)&&t0(t)}var t2=n(2),t5=n.n(t2),t6=n(611),t4=n.n(t6),t3=n(129),t8=n.n(t3),t7=n(986),et=n.n(t7),ee=n(838),en=n.n(ee),ei=n(515),er=n.n(ei),es=n(902),eo={};function ea(t,e,n,i,r,s,o){try{var a=t[s](o),l=a.value}catch(t){n(t);return}a.done?e(l):Promise.resolve(l).then(i,r)}eo.styleTagTransform=er(),eo.setAttributes=et(),eo.insert=t8().bind(null,"head"),eo.domAPI=t4(),eo.insertStyleElement=en(),t5()(es.A,eo),es.A&&es.A.locals&&es.A.locals;let el=new r.LruCache,eu=t=>{try{return null==t?void 0:t.started}catch(t){return}},ec=t=>{var e;return to(null!=(e=t.options.OUTPUT_OUTDATED)?e:"false")||!eu(t)||!t.id},ed=t=>{let e=(null==(l=t.func)||null==(a=l.nqName)?void 0:a.includes(":"))?r.Func.byName(t.func.nqName).prepare():t.func.prepare();e.id=t.id,t.options.forEach(n=>e.options[n]=t.options[n]);let n=tR()(e.outputParams.values()).filter(e=>null!=t.outputs[e.name]);var i=!0,s=!1,o=void 0;try{for(var a,l,u,c=n[Symbol.iterator]();!(i=(u=c.next()).done);i=!0){let n=u.value;n.property.propertyType===r.TYPE.DATA_FRAME?e.outputs[n.name]=t.outputs[n.name].clone():e.outputs[n.name]=t.outputs[n.name]}}catch(t){s=!0,o=t}finally{try{i||null==c.return||c.return()}finally{if(s)throw o}}let d=tR()(e.inputParams.values()).filter(e=>null!=t.inputs[e.name]);var p=!0,h=!1,f=void 0;try{for(var m,y=d[Symbol.iterator]();!(p=(m=y.next()).done);p=!0){let n=m.value;n.property.propertyType===r.TYPE.DATA_FRAME?e.inputs[n.name]=t.inputs[n.name].clone():e.inputs[n.name]=t.inputs[n.name]}}catch(t){h=!0,f=t}finally{try{p||null==y.return||y.return()}finally{if(h)throw f}}return eu(t)&&(e.started=t.started),e},ep=t=>{let e=t.options[tB];return e?{name:t.name,config:JSON.parse(e,(t,e)=>{if("true"===e)return!0;if("false"===e)return!1;if("type"===t)return tM[e]||e;if(!t.toLowerCase().includes("color")){let t=Number.parseFloat(e);if(!Number.isNaN(t))return t}return e})}:{name:t.name,config:[]}},eh=t=>{try{return t.started.toDate().toLocaleString("en-us",{month:"short",day:"numeric",hour:"numeric",minute:"numeric"})}catch(t){return"Not completed"}};function ef(t,e,n,i,r,s,o){try{var a=t[s](o),l=a.value}catch(t){n(t);return}a.done?e(l):Promise.resolve(l).then(i,r)}function em(t){return function(){var e=this,n=arguments;return new Promise(function(i,r){var s=t.apply(e,n);function o(t){ef(s,i,r,o,a,"next",t)}function a(t){ef(s,i,r,o,a,"throw",t)}o(void 0)})}}let ey=t=>{switch(t){case"Today":return"started > -1d";case"Yesterday":return"started > -2d and started < -1d";case"Any time":return"";case"Last year":return"started > -2y and started < -1y";case"This year":return"started > -1y";case"Last month":return"started > -2m and started < -1m";case"This month":return"started > -1m";case"Last week":return"started > -2w and started < -1w";case"This week":return"started > -1w"}};var eg=q||(q={});let ev=new r.LruCache;function eb(t){return em(function*(){let e=yield tx.dapi.functions.calls.allPackageVersions().include("session.user,func.package, inputs, outputs").find(t),n=tR()(e.inputParams.values()).filter(t=>t.property.propertyType===r.TYPE.FILE&&!!e.inputs[t.name]);yield Promise.all(n.map(t=>em(function*(){let n=JSON.parse(e.inputs[t.name]),i=n.id,s=n.name,o=yield tx.dapi.files.readAsBytes(i),a=r.FileInfo.fromBytes(s,o);return a.id=i,e.inputs[t.name]=a,Promise.resolve()})()));let i=tR()(e.outputParams.values()).filter(t=>t.property.propertyType===r.TYPE.DATA_FRAME&&!!e.outputs[t.name]);yield Promise.all(i.map(t=>em(function*(){return e.outputs[t.name]=yield tx.dapi.tables.getTable(e.outputs[t.name]),Promise.resolve()})()));let s=tR()(e.inputParams.values()).filter(t=>t.property.propertyType===r.TYPE.DATA_FRAME&&!!e.inputs[t.name]);return yield Promise.all(s.map(t=>em(function*(){return e.inputs[t.name]=yield tx.dapi.tables.getTable(e.inputs[t.name]),Promise.resolve()})())),e})()}function eC(t,e,n,i,r,s,o){try{var a=t[s](o),l=a.value}catch(t){n(t);return}a.done?e(l):Promise.resolve(l).then(i,r)}function eA(t){return function(){var e=this,n=arguments;return new Promise(function(i,r){var s=t.apply(e,n);function o(t){eC(s,i,r,o,a,"next",t)}function a(t){eC(s,i,r,o,a,"throw",t)}o(void 0)})}}function ex(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{},i=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(i=i.concat(Object.getOwnPropertySymbols(n).filter(function(t){return Object.getOwnPropertyDescriptor(n,t).enumerable}))),i.forEach(function(e){var i;i=n[e],e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i})}return t}function ew(t,e){return e=null!=e?e:{},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):(function(t){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e.push.apply(e,n)}return e})(Object(e)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(e,n))}),t}eg.loadChildRuns=function(t){return em(function*(){return{parentRun:yield eb(t),childRuns:yield tx.dapi.functions.calls.allPackageVersions().include("func, func.package").filter(`options.parentCallId="${t}"`).list()}})()},eg.shallowLoadRun=function(t){return em(function*(){return yield tx.dapi.functions.calls.allPackageVersions().include("session.user,func.package, inputs, outputs").find(t)})()},eg.loadRun=eb,eg.updateRunMeta=function(t){return em(function*(){let e=yield tx.dapi.functions.calls.allPackageVersions().save(t);tx.log.audit("@user edited metadata of @model model run",{user:r.User.current(),model:e.func})})()},eg.saveRun=function(t,e){return em(function*(){var n;let i=ev.get("All users");i||(i=yield tx.dapi.groups.find(r.Group.defaultGroupsIds["All users"]),ev.set("All users",i));let s=null!=(n=null==e?void 0:e.audience)?n:i;(null==e?void 0:e.newId)&&t.newId();let o=ed(t);ec(o)&&(o.options.createdOn=tr()().utc(!0).unix());let a=tR()(o.inputParams.values()).filter(t=>t.property.propertyType===r.TYPE.FILE&&!!o.inputs[t.name]);yield Promise.all(a.map(t=>em(function*(){var e;let n=o.inputs[t.name],i=n instanceof r.FileInfo?yield n.readAsBytes():new Uint8Array((yield n.arrayBuffer())),s=n instanceof r.FileInfo&&null!=(e=n.fileName)?e:n.name,a=r.FileInfo.fromBytes(s,i);return yield tx.dapi.files.write(a),o.inputs[t.name]={id:a.id,name:a.name},Promise.resolve()})()));let l=tR()(o.outputParams.values()).filter(t=>t.property.propertyType===r.TYPE.DATA_FRAME&&!!o.outputs[t.name]);yield Promise.all(l.map(t=>em(function*(){yield tx.dapi.tables.uploadDataFrame(o.outputs[t.name]),yield tx.dapi.permissions.grant(o.outputs[t.name].getTableInfo(),s,!1)})()));let u=tR()(o.inputParams.values()).filter(t=>t.property.propertyType===r.TYPE.DATA_FRAME&&!!o.inputs[t.name]);yield Promise.all(u.map(t=>em(function*(){yield tx.dapi.tables.uploadDataFrame(o.inputs[t.name]),yield tx.dapi.permissions.grant(o.inputs[t.name].getTableInfo(),s,!1)})()));let c=yield tx.dapi.functions.calls.allPackageVersions().save(o);return tx.log.audit("@user saved run of the @model model",{user:r.User.current(),model:c.func}),c})()},eg.deleteRun=function(t){return em(function*(){t.options.isDeleted=!0,yield tx.dapi.functions.calls.allPackageVersions().save(t)})()},eg.pullRuns=function(t){return em(function*(t,e,n){let i=void 0===e?{}:e,r=`func.id="${t}"`;return r+=i.author?` and session.user.id="${i.author.id}"`:"",r+=i.date?ey(i.date):"",tx.dapi.functions.calls.allPackageVersions().filter(r).include("session.user, options").list(void 0===n?{}:n)}).apply(this,arguments)},eg.pullRunsByName=function(t){return em(function*(t,e,n,i,s){let o=void 0===i?[]:i,a=void 0!==s&&s,l="";var u=!0,c=!1,d=void 0;try{for(var p,h=(void 0===e?[]:e)[Symbol.iterator]();!(u=(p=h.next()).done);u=!0){let t=p.value,e=[];t.author&&e.push(`session.user.id="${t.author.id}"`),t.date&&e.push(ey(t.date)),t.text&&e.push(`((options.title like "${t.text}") or (options.annotation like "${t.text}"))`),t.includeDeleted||e.push('((options.isDeleted != "true") or (options.isDeleted = null))');let n=e.join(" and ");""!==n&&(""===l?l+=`(${n})`:l+=` or (${n})`)}}catch(t){c=!0,d=t}finally{try{u||null==h.return||h.return()}finally{if(c)throw d}}""!==l&&(l=` and (${l})`);let f=yield tx.dapi.functions.calls.allPackageVersions().filter(`func.name="${t}"${l}`).include(`${[...o,"func.package"].join(",")}`).list(void 0===n?{}:n);if((o.includes("inputs")||o.includes("func.params"))&&!a){var m=!0,y=!1,g=void 0;try{for(var v,b=f[Symbol.iterator]();!(m=(v=b.next()).done);m=!0){let t=v.value,e=tR()(t.inputParams.values()).filter(e=>e.property.propertyType===r.TYPE.DATA_FRAME&&!!t.inputs[e.name]);var C=!0,A=!1,x=void 0;try{for(var w,I=e[Symbol.iterator]();!(C=(w=I.next()).done);C=!0){let e=w.value;t.inputs[e.name]=yield tx.dapi.tables.getTable(t.inputs[e.name])}}catch(t){A=!0,x=t}finally{try{C||null==I.return||I.return()}finally{if(A)throw x}}}}catch(t){y=!0,g=t}finally{try{m||null==b.return||b.return()}finally{if(y)throw g}}}if((o.includes("outputs")||o.includes("func.params"))&&!a){var R=!0,T=!1,E=void 0;try{for(var O,S=f[Symbol.iterator]();!(R=(O=S.next()).done);R=!0){let t=O.value,e=tR()(t.outputParams.values()).filter(e=>e.property.propertyType===r.TYPE.DATA_FRAME&&!!t.outputs[e.name]);var P=!0,k=!1,D=void 0;try{for(var L,V=e[Symbol.iterator]();!(P=(L=V.next()).done);P=!0){let e=L.value;t.outputs[e.name]=yield tx.dapi.tables.getTable(t.outputs[e.name])}}catch(t){k=!0,D=t}finally{try{P||null==V.return||V.return()}finally{if(k)throw D}}}}catch(t){T=!0,E=t}finally{try{R||null==S.return||S.return()}finally{if(T)throw E}}}return f}).apply(this,arguments)};let eI=t=>{var e,n;if(null==(e=t.options)?void 0:e.default)return JSON.parse(null==(n=t.options)?void 0:n.default);let i=t.defaultValue;return t.propertyType===r.TYPE.STRING&&i?i.substring(1,i.length-1):i};function eR(t,e){e?(tE()(t).addClass("ui-box").css({width:"auto",height:"auto"}),tw.setUpdateIndicator(t,!0)):(tw.setUpdateIndicator(t,!1),tE()(t).removeClass("ui-box"))}function eT(t,e,n,i,r,s,o){try{var a=t[s](o),l=a.value}catch(t){n(t);return}a.done?e(l):Promise.resolve(l).then(i,r)}function eE(t){return function(){var e=this,n=arguments;return new Promise(function(i,r){var s=t.apply(e,n);function o(t){eT(s,i,r,o,a,"next",t)}function a(t){eT(s,i,r,o,a,"throw",t)}o(void 0)})}}function eO(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{},i=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(i=i.concat(Object.getOwnPropertySymbols(n).filter(function(t){return Object.getOwnPropertyDescriptor(n,t).enumerable}))),i.forEach(function(e){var i;i=n[e],e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i})}return t}function eS(t,e){return e=null!=e?e:{},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):(function(t){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e.push.apply(e,n)}return e})(Object(e)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(e,n))}),t}class eP extends r.TableView{static fromComparedRuns(t,e){return eE(function*(t,e,n){var i,s;let o,a,l,u,c,d=void 0===n?{parentView:void 0,parentCall:void 0}:n,p=(o=void 0===d?{parentView:void 0,parentCall:void 0}:d,a=[...e.inputs,...e.outputs].map(t=>ep(t)).reduce((t,e)=>(t[e.name]?t[e.name].push(...e.config):t[e.name]=e.config,t),{}),l=e=>{if(e.propertyType===r.TYPE.DATA_FRAME)return a[e.name].map(n=>{var i;let s=null!=(i=e.caption)?i:e.name,o=r.Column.fromType(r.TYPE.DATA_FRAME,s,t.length);o.init(n=>{var i;return null!=(i=t[n].inputs[e.name])?i:t[n].outputs[e.name]});let a=u.columns.getUnusedName(`${o.name} (${n.type})`);return o.name=a,s=a,o.temp[tB]=n,u.columns.add(o),o});{var n;let i=null!=(n=e.caption)?n:e.name,s=r.Column.fromType(e.propertyType,i,t.length);s.init(n=>{var i;return null!=(i=t[n].inputs[e.name])?i:t[n].outputs[e.name]});let o=u.columns.getUnusedName(s.name);return s.name=o,i=o,u.columns.add(s),[s]}},u=r.DataFrame.create(t.length),c=[],t.forEach(t=>{var e;let n=null!=(e=t.options.title)?e:`${t.func.name} - ${eh(t)}`,i=2;for(;c.includes(n);)n=`${t.func.name} - ${eh(t)} - ${i}`,i++;c.push(n)}),u.columns.add(r.Column.fromStrings(t_,c)),u.name=(null==(i=o.parentCall)?void 0:i.func.name)?`${null==(s=o.parentCall)?void 0:s.func.name} - comparison`:`${e.name} - comparison`,e.inputs.forEach(t=>l(t)),e.outputs.forEach(t=>l(t)),tx.events.onCurrentObjectChanged.subscribe(t=>{let e=t.sender;if(e instanceof r.Column&&e.type===r.TYPE.DATA_FRAME&&tx.shell.tv&&tx.shell.tv.temp.isComparison&&[r.VIEWER.LINE_CHART,r.VIEWER.SCATTER_PLOT,r.VIEWER.HISTOGRAM,r.VIEWER.BOX_PLOT].includes(e.temp[tB].type)){tx.shell.windows.showContextPanel=!0;let t=t=>{let e=t.get(0).clone();e.columns.addNew(tU,r.TYPE.STRING).init(t.dataFrame.get(t_,0));for(let n=1;n<t.length;n++){let i=t.get(n).clone();i.columns.addNew(tU,r.TYPE.STRING).init(t.dataFrame.get(t_,n));let s=[r.COLUMN_TYPE.INT,r.COLUMN_TYPE.FLOAT];for(let t=0;t<i.columns.length;t++){let n=i.columns.byIndex(t),o=e.columns.byIndex(t);n.type!==o.type&&s.includes(n.type)&&s.includes(o.type)&&(n.type!==r.COLUMN_TYPE.FLOAT&&i.columns.replace(n,n.convertTo(r.COLUMN_TYPE.FLOAT)),o.type!==r.COLUMN_TYPE.FLOAT&&e.columns.replace(o,o.convertTo(r.COLUMN_TYPE.FLOAT)))}e.append(i,!0)}return e},n=e.temp[tB].look;setTimeout(()=>{switch(e.temp[tB].type){case r.VIEWER.LINE_CHART:let i=tw.waitBox(()=>eA(function*(){var i;let r=null!=(i=e.temp.unitedDf)?i:t(e);return e.temp.unitedDf=r,r.plot.line(ew(ex({},n),{split:tU})).root})());tE()(i).css({width:"100%"}),tx.shell.o=i;break;case r.VIEWER.SCATTER_PLOT:let s=tw.waitBox(()=>eA(function*(){var i;let r=null!=(i=e.temp.unitedDf)?i:t(e);return e.temp.unitedDf=r,r.plot.scatter(ew(ex({},n),{color:tU})).root})());tx.shell.o=s,tE()(s).css({width:"100%"});break;case r.VIEWER.HISTOGRAM:let o=tw.waitBox(()=>eA(function*(){var i;let r=null!=(i=e.temp.unitedDf)?i:t(e);return e.temp.unitedDf=r,r.plot.histogram(ew(ex({},n),{split:tU})).root})());tx.shell.o=o,tE()(o).css({width:"100%"});break;case r.VIEWER.BOX_PLOT:let a=tw.waitBox(()=>eA(function*(){var i;let r=null!=(i=e.temp.unitedDf)?i:t(e);return e.temp.unitedDf=r,r.plot.box(ew(ex({},n),{category:tU})).root})());tx.shell.o=a,tE()(a).css({width:"100%"})}})}}),u),h=[...tx.shell.views].find(t=>t.type===tN||"scripts"===t.type||"functions"===t.type);return h&&(tx.shell.v=h),new this(p,d)}).apply(this,arguments)}showAllColumns(){let t=this.dataFrame.columns.names();this.grid.columns.setVisible(t)}showChangingColumns(){let t=this.dataFrame.columns.names().filter(t=>r.TYPES_SCALAR.has(this.dataFrame.getCol(t).type)&&this.dataFrame.getCol(t).categories.length>1||!r.TYPES_SCALAR.has(this.dataFrame.getCol(t).type));this.grid.columns.setVisible(t)}defaultCustomize(){let t=tw.iconFA("compress-alt",()=>{this.showChangingColumns(),tE()(e).show(),tE()(t).hide()},"Hide constant parameters"),e=tw.iconFA("expand-arrows-alt",()=>{this.showAllColumns(),tE()(e).hide(),tE()(t).show()},"Show all parameters");tE()(t).hide(),this.setRibbonPanels([...this.getRibbonPanels(),[t,e]]),this.showChangingColumns(),this.root.style.removeProperty("width"),this.root.firstChild.style.removeProperty("width"),this.root.firstChild.firstChild.style.removeProperty("width"),this.grid.props.rowHeight=180,this.grid.props.showAddNewRowIcon=!1,this.grid.props.allowEdit=!1,this.grid.columns.byName(t_).width=70;for(let t=0;t<this.grid.columns.length;t++){var n;let e=this.grid.columns.byIndex(t);(null==(n=e.column)?void 0:n.temp[tB])&&(e.width=350,e.cellType="html")}let i=new r.LruCache;this.grid.onCellPrepare(t=>eE(function*(){if(!t.isColHeader&&!t.isRowHeader){if(t.tableColumn.name===t_){t.customText="";let e=String(t.cell.value).split(" - "),n=e.length>1?[e[0],tw.element("br"),e[1]]:e;t.element=tw.div(n,{style:{writingMode:"vertical-rl",textOrientation:"mixed",margin:"auto"}}),t.element.parentElement.style.display="flex";return}if(t.tableColumn&&t.tableColumn.temp[tB]){let e=t.cell.value,n=t.tableColumn.temp[tB],s=n.type,o=`${e.id}_${s}`;if(i.get(o))t.element=i.get(o);else{let a=yield eE(function*(){let i=Object.values(tM).includes(s)?r.Viewer.fromType(s,e):yield e.plot.fromType(s);return t.tableColumn.temp[tB].look?i.setOptions(t.tableColumn.temp[tB].look):(i.setOptions(n),t.tableColumn.temp[tB]=i.getOptions()),i.root})();i.set(o,a),t.element=a}t.element.style.width="100%",t.element.style.height="100%"}}})());let s=tw.box(tw.div([],{style:{minHeight:"100px"}})),o=tx.events.onCurrentViewChanged.subscribe(()=>{tx.shell.v.id===this.id?tx.shell.dockManager.dock(s,"down",null,"Comparison chart",.25):tx.shell.dockManager.close(s)}),a=this.grid.onCellClick.subscribe(t=>{var e;tx.shell.v.id===this.id&&t.isColHeader&&(null==(e=t.tableColumn)?void 0:e.type)===r.TYPE.DATA_FRAME&&[r.VIEWER.LINE_CHART,r.VIEWER.SCATTER_PLOT,r.VIEWER.HISTOGRAM,r.VIEWER.BOX_PLOT].includes(t.tableColumn.temp[tB].type)?(tx.shell.dockManager.findNode(s)||tx.shell.dockManager.dock(s,"down",null,"Comparison chart",.25),tw.setUpdateIndicator(s,!0),setTimeout(()=>{if(!t.tableColumn.temp.unitedPlot){var e;let n=t.tableColumn.temp[tB].look,i=(t=>{let e=r.toJs(t.get(0)).clone();e.columns.addNew(tU,r.TYPE.STRING).init(t.dataFrame.get(t_,0));for(let n=1;n<t.length;n++){let i=r.toJs(t.get(n)).clone();i.columns.addNew(tU,r.TYPE.STRING).init(t.dataFrame.get(t_,n));let s=[r.COLUMN_TYPE.INT,r.COLUMN_TYPE.FLOAT];for(let t=0;t<i.columns.length;t++){let n=i.columns.byIndex(t),o=e.columns.byIndex(t);n.type!==o.type&&s.includes(n.type)&&s.includes(o.type)&&(n.type!==r.COLUMN_TYPE.FLOAT&&i.columns.replace(n,n.convertTo(r.COLUMN_TYPE.FLOAT)),o.type!==r.COLUMN_TYPE.FLOAT&&e.columns.replace(o,o.convertTo(r.COLUMN_TYPE.FLOAT)))}e.append(i,!0)}return e})(t.tableColumn);t.tableColumn.temp.unitedPlot=((e,n,i)=>{var s;switch(null==(s=t.tableColumn)?void 0:s.temp[tB].type){case r.VIEWER.LINE_CHART:return i.plot.line(eS(eO({},n),{split:tU})).root;case r.VIEWER.SCATTER_PLOT:return i.plot.scatter(eS(eO({},n),{color:tU})).root;case r.VIEWER.HISTOGRAM:return i.plot.histogram(eS(eO({},n),{split:tU})).root;case r.VIEWER.BOX_PLOT:return i.plot.box(eS(eO({},n),{category:tU})).root}})(null==(e=t.tableColumn)||e.temp[tB].type,n,i),tw.setUpdateIndicator(s,!1)}tw.empty(s),s.appendChild(t.tableColumn.temp.unitedPlot)},10)):tx.shell.dockManager.close(s)});this.subs.push(a,o)}constructor(t,e){let n=void 0===e?{}:e;super(window.grok_TableView(t.dart,!1)),n.parentView&&(this.parentView=n.parentView),this.parentCall=n.parentCall||tx.functions.getCurrentCall()}}var ek=n(76),eD={};function eL(t,e,n,i,r,s,o){try{var a=t[s](o),l=a.value}catch(t){n(t);return}a.done?e(l):Promise.resolve(l).then(i,r)}function eV(t){return function(){var e=this,n=arguments;return new Promise(function(i,r){var s=t.apply(e,n);function o(t){eL(s,i,r,o,a,"next",t)}function a(t){eL(s,i,r,o,a,"throw",t)}o(void 0)})}}eD.styleTagTransform=er(),eD.setAttributes=et(),eD.insert=t8().bind(null,"head"),eD.domAPI=t4(),eD.insertStyleElement=en(),t5()(ek.A,eD),ek.A&&ek.A.locals&&ek.A.locals;let eF="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";class eM extends r.InputBase{get value(){return this.fileValue}set value(t){this.stringValue=(null==t?void 0:t.name)||"Drag-n-drop your file",this.fileValue=t,this.notify&&this.fireInput()}subscribeOnEvents(){this.input.readOnly=!0,this.input.classList.add("default");let t=t=>eV(function*(){if(t&&t.length&&this.enabled){if(t.length>1)throw this.isValid.next(!1),Error("Please specify single input file");if(this.fileType&&t[0].type!==this.fileType)throw this.isValid.next(!1),Error("File type is not supported");this.isValid.value?this.uploadedFile$.next(t[0]):this.uploadedFile$.next(null)}}).call(this);this.root.classList.add("fi-drop-area"),this.root.style.width="100%",this.hiddenInput.type="file",this.hiddenInput.addEventListener("change",()=>eV(function*(){return yield t(this.hiddenInput.files)}).call(this),!1),["dragenter","dragover","dragleave","drop"].forEach(t=>{this.input.addEventListener(t,t=>{t.preventDefault(),t.stopPropagation()},!1)}),["dragenter","dragover"].forEach(t=>{this.input.addEventListener(t,()=>{this.input.classList.add("drag-n-dropping")},!1)}),["dragleave","drop"].forEach(t=>{this.input.addEventListener(t,()=>{this.input.classList.remove("drag-n-dropping")},!1)}),this.input.addEventListener("drop",e=>eV(function*(){t(e.dataTransfer.files)})(),!1),this.input.addEventListener("click",()=>this.hiddenInput.click(),!1),this.addOptions(this.icon),["drag","dragenter"].forEach(t=>{document.getElementsByClassName("layout-workarea")[0].addEventListener(t,t=>{t.stopPropagation()},!1)})}reset(){this.input.classList.value="ui-input-editor default",this.hiddenInput.value="",this.uploadedFile$.next(null)}constructor(t,e,n,i){let r=void 0===i?eF:i;super(tw.input.string("Input file",{value:""}).dart),this.initialText=void 0===t?"Drag-n-drop here":t,this.initialValue=void 0===e?null:e,this.onValueChanged=void 0===n?null:n,this.fileType=r,this.uploadedFile$=new tO.Subject,this.onFileUploaded=this.uploadedFile$,this.fileValue=null,this.isValid=new tO.BehaviorSubject(!0),this.hiddenInput=document.createElement("input"),this.icon=tw.iconFA("cloud-upload",()=>this.hiddenInput.click(),"Upload"),this.subscribeOnEvents(),this.root.style.display="flex",this.isValid.subscribe(t=>{if(t){this.input.classList.remove("error"),this.input.classList.add("success");let t=tw.iconFA("times",()=>this.reset(),"Reset uploaded file");this.icon.replaceWith(t),this.icon=t}else{this.input.classList.remove("success"),this.input.classList.add("error");let t=tw.iconFA("redo",()=>this.hiddenInput.click(),"Re-upload a file");this.icon.replaceWith(t),this.icon=t}}),this.uploadedFile$.subscribe(t=>{if(this.onValueChanged&&this.onValueChanged(t),!t){let t=tw.iconFA("cloud-upload",()=>this.hiddenInput.click(),"Choose a file to upload");this.icon.replaceWith(t),this.icon=t}this.value=t}),this.reset()}}var eN=n(602),eB={};eB.styleTagTransform=er(),eB.setAttributes=et(),eB.insert=t8().bind(null,"head"),eB.domAPI=t4(),eB.insertStyleElement=en(),t5()(eN.A,eB),eN.A&&eN.A.locals&&eN.A.locals;var ej=n(474),e_=n.n(ej);function eU(t,e,n,i,r,s,o){try{var a=t[s](o),l=a.value}catch(t){n(t);return}a.done?e(l):Promise.resolve(l).then(i,r)}function e$(t){return function(){var e=this,n=arguments;return new Promise(function(i,r){var s=t.apply(e,n);function o(t){eU(s,i,r,o,a,"next",t)}function a(t){eU(s,i,r,o,a,"throw",t)}o(void 0)})}}function eW(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{},i=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(i=i.concat(Object.getOwnPropertySymbols(n).filter(function(t){return Object.getOwnPropertyDescriptor(n,t).enumerable}))),i.forEach(function(e){var i;i=n[e],e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i})}return t}class eH extends r.Dialog{static forFuncCall(t,e){var n,i,r;let s=null!=(n=t.options.title)?n:"";return new eH({title:s,description:null!=(i=t.options.description)?i:"",tags:null!=(r=t.options.tags)?r:[],isFavorite:void 0!==e&&e})}awaitMetadata(t){let e=(0,tO.race)(this.onMetadataEdit,this.onClose.pipe((0,D.map)(()=>null))).pipe((0,D.take)(1));return this.show(eW({center:!0,width:500},t)),e.toPromise()}constructor(t){var e,n,i,s,o;super(tw.dialog({title:"Save model state"}).dart),e=this,this._onMetadataEdit=new tO.Subject,this.onMetadataEdit=this._onMetadataEdit.asObservable();let a=null!=(n=null==t?void 0:t.title)?n:"",l=null!=(i=null==t?void 0:t.description)?i:"",u=null!=(s=null==t?void 0:t.isFavorite)&&s;const c=tw.input.string("Title",{value:a,onValueChanged:t=>a=t}),d=tw.input.string(" ",{value:""}),p=r.TagEditor.create();(null!=(o=null==t?void 0:t.tags)?o:[]).forEach(t=>{p.addTag(t)}),d.input.replaceWith(p.root);const h=()=>{""===f.value||p.tags.includes(f.value)||(p.addTag(f.value),f.value="")},f=tw.input.string("Tag",{value:""}).addOptions(tw.iconFA("plus",h,"Add this tag")),m=(0,tO.fromEvent)(f.input,"onkeydown").subscribe(t=>{"Enter"==t.key&&(t.stopPropagation(),h())});this.sub(m);const y=tw.input.string("Description",{value:l,onValueChanged:t=>l=t}),g=tw.input.bool("Is favorite",{value:u,onValueChanged:t=>u=t});this.add(tw.form([c,y,g,f,d])),this.addButton("Save",()=>e$(function*(){if(""!==f.value)return void tx.shell.info(`Dialog has unsaved tags: ${f.value}`);let t={title:""!==a?a:null,description:""!==l?l:null,isFavorite:u,tags:p.tags.map(t=>t)};e._onMetadataEdit.next(t),e.close()})())}}class eY extends r.Dialog{awaitDelete(t){let e=(0,tO.race)(this.onFuncCallDelete,this.onClose.pipe((0,D.map)(()=>null))).pipe((0,D.take)(1));return this.show(eW({center:!0,width:500},t)),e.toPromise()}constructor(t){var e;super(tw.dialog({title:`Delete ${t.size>1?t.size:""} ${t.size>1?"runs":"run"}`}).dart),e=this,this._onFuncCallDelete=new tO.Subject,this.onFuncCallDelete=this._onFuncCallDelete.asObservable(),this.add(tw.divText(`Deleted ${t.size>1?t.size:""} ${t.size>1?"runs":"run"} ${t.size>1?"are":"is"} impossible to restore. Are you sure?`)),this.onOK(()=>e$(function*(){return e._onFuncCallDelete.next(t)})())}}function eG(t,e,n,i,r,s,o){try{var a=t[s](o),l=a.value}catch(t){n(t);return}a.done?e(l):Promise.resolve(l).then(i,r)}function eZ(t){return function(){var e=this,n=arguments;return new Promise(function(i,r){var s=t.apply(e,n);function o(t){eG(s,i,r,o,a,"next",t)}function a(t){eG(s,i,r,o,a,"throw",t)}o(void 0)})}}let eJ=(t,e)=>eZ(function*(){let n=`${t$}_${t.func.name}_Fav`;return e?tx.dapi.userDataStorage.postValue(n,t.id,""):tx.dapi.userDataStorage.remove(n,t.id)})(),ez=t=>t.options.mainParams?JSON.parse(t.options.mainParams):null,eQ=(t,e)=>{var n,i;return null!=(n=null!=(i=null==e?void 0:e.visibleProps)?i:ez(t))?n:t.inputs.filter(t=>tX.includes(t.propertyType)).map(t=>t.name)},eK=t=>t.replace(/([A-Z])/g,t=>` ${t.toLowerCase()}`).trim().replace(/^./,t=>t.toUpperCase()),eq=(t,e)=>{var n,i,r,s,o,a,l;if(e===tZ)return null!=(n=null==(l=t.author)?void 0:l.friendlyName)?n:" ";let u=null!=(i=null!=(r=null!=(s=null!=(o=t[e])?o:t.inputs[e])?s:t.outputs[e])?r:t.options[e])?i:null;return null!=(a=null==u?void 0:u.toString())?a:""},eX="restrictedValues",e0="editState";(G=X||(X={})).INPUT="Input",G.OUTPUT="Output",(Z=tt||(tt={})).HIDDEN="hidden",Z.VISIBLE="visible",(J=te||(te={})).ENABLED="enabled",J.DISABLED="disabled",(z=tn||(tn={})).INPUTS="inputs",z.OUTPUTS="outputs";let e9={[tn.INPUTS]:"inputParams",[tn.OUTPUTS]:"outputParams"};function e1(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=Array(e);n<e;n++)i[n]=t[n];return i}function e2(t,e,n,i,r,s,o){try{var a=t[s](o),l=a.value}catch(t){n(t);return}a.done?e(l):Promise.resolve(l).then(i,r)}function e5(t){return function(){var e=this,n=arguments;return new Promise(function(i,r){var s=t.apply(e,n);function o(t){e2(s,i,r,o,a,"next",t)}function a(t){e2(s,i,r,o,a,"throw",t)}o(void 0)})}}function e6(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n,i,r=null==t?null:"u">typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var s=[],o=!0,a=!1;try{for(r=r.call(t);!(o=(n=r.next()).done)&&(s.push(n.value),!e||s.length!==e);o=!0);}catch(t){a=!0,i=t}finally{try{o||null==r.return||r.return()}finally{if(a)throw i}}return s}}(t,e)||function(t,e){if(t){if("string"==typeof t)return e1(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if("Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return e1(t,e)}}(t,e)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function e4(t){return t.dart&&r.toJs(t.dart)instanceof r.InputBase}let e3=t=>e5(function*(){let e=t.id,n=r.Func.byName(t.func.nqName).prepare([...t.inputs].reduce((t,e)=>{let n=e6(e,2),i=n[0],r=n[1];return t[i]=r,t},{}));return t.options.forEach(e=>n.options[e]=t.options[e]),e||(n.id=null),n})();function e8(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=Array(e);n<e;n++)i[n]=t[n];return i}function e7(t,e,n,i,r,s,o){try{var a=t[s](o),l=a.value}catch(t){n(t);return}a.done?e(l):Promise.resolve(l).then(i,r)}function nt(t){return function(){var e=this,n=arguments;return new Promise(function(i,r){var s=t.apply(e,n);function o(t){e7(s,i,r,o,a,"next",t)}function a(t){e7(s,i,r,o,a,"throw",t)}o(void 0)})}}function ne(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{},i=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(i=i.concat(Object.getOwnPropertySymbols(n).filter(function(t){return Object.getOwnPropertyDescriptor(n,t).enumerable}))),i.forEach(function(e){var i;i=n[e],e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i})}return t}tr().extend(e_());let nn=new r.LruCache;class ni extends r.Widget{get type(){return"HistoricalRunsList"}get onRunsDfChanged(){return this._onRunsDfChanged.asObservable()}get onChosen(){return this._onChosen.asObservable()}get chosen(){return this._onChosen.value}set chosen(t){var e;this.chosenById=null!=(e=null==t?void 0:t.id)?e:null}set chosenById(t){if(!t){this.currentDf.currentRowIdx=-1;return}for(let e=0;e<this.currentDf.rowCount;e++)if(this.currentDf.getCol("ID").get(e)===t){this.currentDf.currentRowIdx=e;break}}get selected(){return this._onSelectedChanged.value}get runs(){return this.onRunsChanged.value}get onSelectedChanged(){return this._onSelectedChanged.asObservable()}getRunByIdx(t){return this.runs.get(this.currentDf.get("ID",t))}showEditDialog(t,e){let n=eH.forFuncCall(t,e);n.onMetadataEdit.pipe((0,D.take)(1)).subscribe(n=>nt(function*(){var i;if(null==(i=this.options)?void 0:i.isHistory)try{!!n.isFavorite!==e&&(yield eJ(t,!!n.isFavorite));let i=yield q.shallowLoadRun(t.id);n.title&&(i.options.title=n.title),n.description&&(i.options.description=n.description),n.tags&&(i.options.tags=n.tags),yield q.updateRunMeta(i),this.updateRun(i),this.onMetadataEdit.next(i)}catch(t){tx.shell.error(t)}else this.updateRun(t)}).call(this)),n.show({center:!0,width:500})}isFavoriteByIndex(t){return this.currentDf.get(tH,t)}setGridCellRendering(){var t,e,n,i,r;let s=t=>{let e=this.getRunByIdx(t.tableRowIndex);this.showEditDialog(e,this.isFavoriteByIndex(t.tableRowIndex))},o=t=>{let e=new Set([this.getRunByIdx(t.tableRowIndex)]),n=new eY(e);n.onFuncCallDelete.pipe((0,D.take)(1)).subscribe(()=>nt(function*(){tw.setUpdateIndicator(this.root,!0);try{yield Promise.all(tR()(e.values()).map(t=>nt(function*(){return yield this.deleteRun(t.id),Promise.resolve()}).call(this)))}catch(t){tx.shell.error(t)}finally{tw.setUpdateIndicator(this.root,!1)}}).call(this)),n.show({center:!0,width:500})},a=t=>{let e=this.getRunByIdx(t.tableRowIndex);eJ(e,!0).then(()=>this.updateRun(e))},l=t=>{let e=this.getRunByIdx(t.tableRowIndex);eJ(e,!1).then(()=>this.updateRun(e))};n=this._historyGrid,i=this.runs,r=null!=(t=null==(e=this.options)?void 0:e.showActions)&&t,n.onCellPrepare(t=>{var e,u,c,d,p,h,f,m,y,g;if(t.isColHeader&&(null==(e=t.tableColumn)?void 0:e.name)&&[tG,tW,tH].includes(t.tableColumn.name)&&(t.customText=""),!t.isColHeader){if((null==(u=t.tableColumn)?void 0:u.name)===tG&&(t.customText="",t.element=tw.divH([tw.iconFA("trash",()=>o(t),"Remove run from history"),tw.iconFA("edit",()=>s(t),"Edit run metadata")],{style:{padding:"6px",gap:"6px",justifyContent:"space-between"}})),(null==(c=t.tableColumn)?void 0:c.name)===tH){t.customText="";let e=tw.iconFA("star",()=>l(t),"Unfavorite");tE()(e).addClass("fas"),t.element=tw.div(t.cell.value?e:tw.iconFA("star",()=>a(t),"Favorite"),{style:{padding:"6px"}})}if((null==(d=t.tableColumn)?void 0:d.name)===tW){t.customText="";let e=tw.iconFA("flask",null,"Experimental run");tE()(e).addClass("fad fa-sm"),tE()(e).removeClass("fal"),t.element=t.cell.value&&"Experimental"===t.cell.value?tw.div(e,{style:{padding:"6px"}}):tw.div()}if((null==(p=t.tableColumn)?void 0:p.name)===tK){t.customText="";let e=t.cell.value.length>0?tw.div(null==(f=t.cell.value)?void 0:f.split(",").map(t=>tw.span([t],"d4-tag")),"d4-tag-editor"):tw.div();tE()(e).css({padding:"3px","background-color":"transparent"}),t.element=e}if((null==(h=t.tableColumn)?void 0:h.name)==="ID"){let e,u;t.customText="";let c=(e=t.tableRowIndex,i.get(n.dataFrame.get("ID",e)));if(!c)return;let d=c.author.picture;tE()(d).css({width:"25px",height:"25px",fontSize:"20px"}),tw.bind(c.author,d);let p=tw.iconFA("flask",null,"Experimental run");p.classList.add("fad","fa-sm"),p.classList.remove("fal"),p.style.marginLeft="3px";let h=c.options.immutable_tags,f=tw.span([tw.label(null!=(m=null!=(y=c.options.title)?y:null==(g=c.author)?void 0:g.friendlyName)?m:tx.shell.user.friendlyName,{style:{color:"var(--blue-1)"}}),...h&&h.includes(tj)?[p]:[]]),v=tw.iconFA("edit",e=>{e.stopPropagation(),s(t)},"Edit run metadata");v.classList.add("hp-funccall-card-icon","hp-funccall-card-hover-icon");let b=tw.iconFA("trash-alt",e=>eZ(function*(){e.stopPropagation(),o(t)})(),"Delete run");b.classList.add("hp-funccall-card-icon","hp-funccall-card-hover-icon");let C=tw.iconFA("star",e=>{e.stopPropagation(),l(t)},"Unfavorite");C.classList.add("fas","hp-funccall-card-icon");let A=tw.iconFA("star",e=>{e.stopPropagation(),a(t)},"Favorite");A.classList.add("hp-funccall-card-icon","hp-funccall-card-hover-icon"),(u=t.tableRowIndex,n.dataFrame.get(tH,u))?(tw.setDisplay(A,!1),tw.setDisplay(C,!0)):(tw.setDisplay(C,!1),tw.setDisplay(A,!0));let x=eh(c),w=tw.divH([tw.divH([d,tw.divV([f,tw.span([x]),...c.options.tags&&c.options.tags.length>0?[tw.div(c.options.tags.map(t=>tw.span([t],"d4-tag")))]:[]],"hp-card-content")]),tw.divH([...r?[C,A,v,b]:[]])],"hp-funccall-card"),I=t.tableRowIndex;w.addEventListener("mouseover",()=>{t.grid.dataFrame.mouseOverRowIdx=I}),w.addEventListener("click",e=>{e.shiftKey?t.grid.dataFrame.selection.set(I,!0):e.ctrlKey?t.grid.dataFrame.selection.set(I,!1):t.grid.dataFrame.currentRowIdx=I}),t.element=w}}})}deleteRun(t){return nt(function*(){return q.shallowLoadRun(t).then(t=>nt(function*(){var e;return[(yield(null==(e=this.options)?void 0:e.isHistory)?q.deleteRun(t):Promise.resolve()),t]}).call(this)).then(e=>{var n;let i=(function(t){if(Array.isArray(t))return t}(e)||function(t){var e,n,i=null==t?null:"u">typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=i){var r=[],s=!0,o=!1;try{for(i=i.call(t);!(s=(e=i.next()).done)&&(r.push(e.value),2!==r.length);s=!0);}catch(t){o=!0,n=t}finally{try{s||null==i.return||i.return()}finally{if(o)throw n}}return r}}(e)||function(t){if(t){if("string"==typeof t)return e8(t,2);var e=Object.prototype.toString.call(t).slice(8,-1);if("Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e)return Array.from(e);if("Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e))return e8(t,2)}}(e)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())[1];return this.runs.delete(t),this.onRunsChanged.next(this.runs),(null==(n=this.options)?void 0:n.isHistory)&&this.onDelete.next(i),i}).then(t=>{eJ(t,!1)}).catch(t=>{tx.shell.error(t)})}).call(this)}editRun(t){this.showEditDialog(t,!1)}updateRun(t){this.runs.set(t.id,t),this.onRunsChanged.next(this.onRunsChanged.value)}addRun(t){this.runs.set(t.id,t),this.onRunsChanged.next(this.onRunsChanged.value)}updateRuns(t){this.onRunsChanged.next(t.reduce((t,e)=>(t.set(e.id,e),t),new Map))}get isFilterHidden(){return this._isFilterHidden.value}set isFilterHidden(t){this._isFilterHidden.next(t)}get compactMode(){return this._compactMode.value}set compactMode(t){this._compactMode.next(t)}get onCompactModeChanged(){return this._compactMode.asObservable()}styleHistoryGrid(){var t;((t,e,n,i,s,o)=>{var a;let l,u,c,d,p,h;o&&t.setOptions({showCurrentRowIndicator:!0,showCurrentCellOutline:!1,allowEdit:!1,allowBlockSelection:!1,showRowHeader:!1,showColumnLabels:!e,extendLastColumn:e}),t.sort([tJ],[!1]);for(let e=0;e<t.columns.length;e++){let n=t.columns.byIndex(e);n&&(null==(a=n.column)?void 0:a.type)===r.TYPE.DATE_TIME&&(n.format="MMM d, h:mm tt")}if((l=t.columns.byName(tG))&&(l.cellType="html",l.width=45),(u=t.columns.byName(tH))&&(u.cellType="html",u.width=30),(c=t.columns.byName(tW))&&(c.cellType="html",c.width=30),(d=t.columns.byName(tK))&&(d.cellType="html",d.width=90),(p=t.columns.byName(tJ))&&(p.width=110),(h=t.columns.byName("ID"))&&(h.cellType="html"),e)t.columns.setVisible(["ID"]),t.props.rowHeight=70,t.invalidate();else{t.props.rowHeight=28;let e=t.dataFrame.getCol(tK);t.columns.setVisible([tW,tH,tG,...i?[tJ]:[],...i?[tZ]:[],...i&&e.stats.missingValueCount<e.length?[tK]:[],...i?[tz]:[],...i?[tQ]:[],...n&&s?eQ(s).map(t=>{var e,n;let i=null!=(e=s.inputs.find(e=>e.name===t))?e:s.outputs.find(e=>e.name===t);return i?null!=(n=i.caption)?n:eK(i.name):eK(t)}):[]])}})(this._historyGrid,this._compactMode.value,this.showInputsIcon.value,this.showMetadataIcon.value,null==(t=this.runs.values().next().value)?void 0:t.func)}get currentDf(){return this._onRunsDfChanged.value}styleHistoryFilters(){var t,e,n,i,r,s,o,a,l;let u,c,d,p=null==(e=this.runs.values().next().value)?void 0:e.func;(i=this._historyFilters,r=this.showMetadataIcon.value,s=this.showInputsIcon.value,o=null!=(t=null==(n=this.options)?void 0:n.isHistory)&&t,c=(u=i.dataFrame).getCol(tK),(d=[...r&&u.getCol(tW).categories.length>1?[tW]:[],...r&&(null!=(a=null==(l=u.col(tH))?void 0:l.categories.length)?a:0)>1?[tH]:[],...r?[tJ,tY]:[],...r&&u.getCol(tZ).categories.length>1?[tZ]:[],...r&&c.stats.missingValueCount<c.length?[tK]:[],...r&&u.getCol(tz).categories.length>1?[tz]:[],...r&&u.getCol(tQ).categories.length>1?[tQ]:[],...p&&s?eQ(p).map(t=>{var e,n;let i=null!=(e=p.inputs.find(e=>e.name===t))?e:p.outputs.find(e=>e.name===t);return i?null!=(n=i.caption)?n:eK(i.name):eK(t)}).filter(t=>!o||u.getCol(t).categories.length>1).map(t=>t):[]]).length>0?(tw.setDisplay(i.root,!0),i.setOptions({columnNames:d,showHeader:!1,showBoolCombinedFilter:!0})):tw.setDisplay(i.root,!1),d.length>0)?(tE()(this.filterWithText).css({paddingTop:"10px"}),tw.setDisplay(this.defaultFiltersText,!1)):tw.setDisplay(this.defaultFiltersText,!0)}redrawSelectionState(){let t=this.currentDf.selection.trueCount;t<2?this.compareIcon.firstChild.classList.add("hp-disabled"):this.compareIcon.firstChild.classList.remove("hp-disabled"),0===t?this.trashIcon.firstChild.classList.add("hp-disabled"):this.trashIcon.firstChild.classList.remove("hp-disabled")}constructor(t,e){var n,i,s,o,a,l,u,c;super(tw.div([],{style:{height:"100%",width:"100%"}})),n=this,this.initialRuns=t,this.options=e,this.onRunsChanged=new tO.BehaviorSubject(this.initialRuns.reduce((t,e)=>(t.set(e.id,e),t),new Map)),this._onRunsDfChanged=new tO.BehaviorSubject(r.DataFrame.fromColumns([r.Column.bool(tW,0),...(null==(o=this.options)?void 0:o.isHistory)?[r.Column.bool(tH,0)]:[],...(null==(a=this.options)?void 0:a.showActions)?[r.Column.string(tG,0)]:[],r.Column.bool(tY,0),r.Column.dateTime(tJ,0),r.Column.string(tZ,0),r.Column.string(tK,0),r.Column.string(tz,0),r.Column.string(tQ,0),r.Column.fromStrings("ID",[])])),this._historyFilters=r.Viewer.filters(this._onRunsDfChanged.value,{title:"Filters",columnNames:[]}),this._historyGrid=r.Viewer.grid(this._onRunsDfChanged.value,{showRowHeader:!1,showColumnGridlines:!1,allowEdit:!1}),this.onComparisonCalled=new tO.Subject,this.onMetadataEdit=new tO.Subject,this._onChosen=new tO.BehaviorSubject(null),this.onDelete=new tO.Subject,this._onSelectedChanged=new tO.BehaviorSubject(new Set([])),this.layout=tw.splitH([],null,!0),this.defaultGridText=tw.divText(null!=(i=null==(l=this.options)?void 0:l.fallbackText)?i:"No historical runs found","hp-no-elements-label"),this.defaultFiltersText=tw.divText("No filters to show","hp-no-elements-label"),this.filterWithText=tw.divH([this.defaultFiltersText,this._historyFilters.root],"ui-box"),this.trashIcon=tw.div(tw.iconFA("trash-alt",()=>{let t=this.currentDf.selection.getSelectedIndexes(),e=new Set;t.forEach(t=>e.add(this.getRunByIdx(t)));let i=new eY(e);i.onFuncCallDelete.pipe((0,D.take)(1)).subscribe(t=>nt(function*(){tw.setUpdateIndicator(n.root,!0);try{yield Promise.all(tR()(t.values()).map(t=>nt(function*(){return yield n.deleteRun(t.id),Promise.resolve()})()))}catch(t){tx.shell.error(t)}finally{tw.setUpdateIndicator(n.root,!1)}})()),i.show({center:!0,width:500,modal:!0})},"Delete selected runs"),{style:{paddingTop:"5px"}}),this.compareIcon=tw.div(tw.iconFA("exchange",()=>nt(function*(){let t=n.currentDf.selection.getSelectedIndexes(),e=[];t.forEach(t=>{e.push(n.currentDf.getCol("ID").get(t))}),n.onComparisonCalled.next(e)})(),"Compare selected runs"),{style:{paddingTop:"5px"}}),this._isFilterHidden=new tO.BehaviorSubject(!1),this.showFiltersIcon=tw.div(tw.iconFA("filter",()=>{this._isFilterHidden.next(!this._isFilterHidden.value)},"Toggle filters"),{style:{paddingTop:"4px"}}),this._compactMode=new tO.BehaviorSubject(null!=(s=null==(u=this.options)?void 0:u.isHistory)&&s),this.toggleCompactMode=tw.div(tw.iconFA("expand-alt",()=>{this.compactMode=!this.compactMode},"Toggle compact mode"),{style:{paddingTop:"4px"}}),this.showMetadataIcon=tw.input.toggle("Metadata",{value:!0,onValueChanged:()=>{this.styleHistoryGrid(),this.styleHistoryFilters()}}),this.showInputsIcon=tw.input.toggle("Params",{value:!1,onValueChanged:t=>nt(function*(){var e;0!==n.runs.size&&(t&&(null==(e=n.options)?void 0:e.isHistory)?((yield Promise.all([...n.runs.values()].map(t=>nt(function*(){if(nn.has(t.id))return nn.get(t.id);{let e=yield q.shallowLoadRun(t.id);return nn.set(e.id,e),e}})()))).forEach(t=>{n.runs.set(t.id,t)}),n.onRunsChanged.next(n.runs)):(n.styleHistoryGrid(),n.styleHistoryFilters()))})()});const d=tw.divH([tw.divH([...(null==e?void 0:e.isHistory)?[this.toggleCompactMode]:[],this.showFiltersIcon,this.showMetadataIcon.root,this.showInputsIcon.root],{style:{gap:"5px",padding:"5px"}}),tw.divH((null==(c=this.options)?void 0:c.showBatchActions)?[this.trashIcon,this.compareIcon]:[],{style:{gap:"5px",padding:"5px"}})],{style:{justifyContent:"space-between",padding:"0px 5px"}});d.style.setProperty("overflow-y","hidden","important");const p=tw.divV([this.defaultGridText,d,this._historyGrid.root],"ui-box");tE()(p).removeClass("ui-div"),tE()(p).css("width","100%"),this.root.appendChild(this.layout),tw.setDisplayAll([this._historyGrid.root,this._historyFilters.root,this.toggleCompactMode,this.trashIcon,this.compareIcon,this.showFiltersIcon],!1);const h=this.onRunsChanged.subscribe(t=>nt(function*(){if(n.setGridCellRendering(),t.size>0){let e,i,s=yield(e=t.values().next().value.func,i=n.options,eZ(function*(){var n;let s=[...t.values()],o=t=>t===tJ?r.Column.dateTime(eK(t),s.length).init(t=>window.grok_DayJs_To_DateTime(eu(s[t])?s[t].started.utc(!0):tr().unix(s[t].options.createdOn))):t===tY?r.Column.bool(eK(t),s.length).init(t=>!ec(s[t])):r.Column.fromStrings(eK(t),s.map(e=>{var n,r,s;return null!=(n=null==i||null==(s=i.propFuncs)||null==(r=s[t])?void 0:r.call(s,e))?n:eq(e,t)})),a=Object.keys(null!=(n=yield tx.dapi.userDataStorage.get(`${t$}_${e.name}_Fav`))?n:{}),l=r.DataFrame.fromColumns([r.Column.string(tW,s.length).init(t=>{let e=s[t].options.immutable_tags;return e&&e.includes(tj)?"Experimental":"Simulated"}),...(null==i?void 0:i.isHistory)?[r.Column.bool(tH,s.length).init(t=>a.includes(s[t].id))]:[],...(null==i?void 0:i.showActions)?[r.Column.string(tG,s.length).init("")]:[],o(tJ),o(tY),o(tZ),r.Column.string(tK,s.length).init(t=>s[t].options.tags?s[t].options.tags.join(","):""),r.Column.string(tz,s.length).init(t=>s[t].options.title),r.Column.string(tQ,s.length).init(t=>s[t].options.description),r.Column.string(tq,s.length).init(t=>s[t].options.version)]);if(eQ(e).map(t=>(t=>{var n,a,l;let u=null!=(n=e.inputs.find(e=>e.name===t))?n:e.outputs.find(e=>e.name===t);return u?u.propertyType===r.TYPE.DATE_TIME?r.Column.dateTime(null!=(l=u.caption)?l:eK(u.name),s.length).init(t=>window.grok_DayJs_To_DateTime(s[t].inputs[u.name])):r.Column.fromType(u.propertyType,null!=(a=u.caption)?a:eK(u.name),s.length).init(t=>{var e,n,r;return null!=(e=null==i||null==(r=i.propFuncs)||null==(n=r[u.name])?void 0:n.call(r,s[t]))?e:eq(s[t],u.name)}):o(t)})(t)).forEach(t=>{t.name=l.columns.getUnusedName(t.name),l.columns.add(t,!1)}),l.columns.add(r.Column.fromStrings("ID",s.map(t=>t.id))),!(null==i?void 0:i.allowOtherVersions)&&(null==i?void 0:i.version)){let t=r.BitSet.create(l.rowCount,()=>!1);for(let e=0;e<l.rowCount;e++)(null==i?void 0:i.version)==l.get(tq,e)&&t.set(e,!0);return l.clone(t)}return l})()),o=t.values().next().value.func;tw.setDisplayAll([n.defaultGridText,n.defaultFiltersText],!1),tw.setDisplayAll([n._historyGrid.root,n._historyFilters.root,n.toggleCompactMode,n.showMetadataIcon.root,n.trashIcon,n.compareIcon,n.showFiltersIcon],!0),tw.setDisplay(n.showInputsIcon.root,eQ(o,n.options).length>0),n._onRunsDfChanged.next(s)}else tw.setDisplayAll([n.defaultGridText,n.defaultFiltersText],!0),tw.setDisplayAll([n._historyGrid.root,n._historyFilters.root,n.showMetadataIcon.root,n.showInputsIcon.root,n.toggleCompactMode,n.trashIcon,n.compareIcon,n.showFiltersIcon],!1)})()),f=this._onRunsDfChanged.subscribe(t=>{this._historyFilters.dataFrame=t,this._historyGrid.dataFrame=t,this.currentDf.getCol(tK).meta.multiValueSeparator=",",this.styleHistoryGrid(),this.styleHistoryFilters();let e=t.onCurrentRowChanged.subscribe(()=>{var t;this.currentDf.rows.select(()=>!1),this._onChosen.next(null!=(t=this.getRunByIdx(this.currentDf.currentRowIdx))?t:null)}),n=t.onSelectionChanged.subscribe(()=>{let e=[...t.selection.getSelectedIndexes()].map(t=>this.getRunByIdx(t));this._onSelectedChanged.next(new Set(e)),this.redrawSelectionState()});this.redrawSelectionState(),this.subs.push(e,n)}),m=this._isFilterHidden.subscribe(t=>{t?(tE()(this.showFiltersIcon.firstChild).addClass("fal"),tE()(this.showFiltersIcon.firstChild).removeClass("fad"),tw.setDisplay(this.filterWithText,!1)):(tE()(this.showFiltersIcon.firstChild).addClass("fad"),tE()(this.showFiltersIcon.firstChild).removeClass("fal"),tE()(this.filterWithText).css(this.compactMode?"height":"width","320px"),tE()(this.filterWithText).css(this.compactMode?"width":"height","100%"),tw.setDisplay(this.filterWithText,!0))}),y=this._compactMode.subscribe(t=>{let e=[p,this.filterWithText];tE()(this.filterWithText).removeClass("ui-div");let n={style:{width:"100%",height:"100%"}};tE()(this.toggleCompactMode.firstChild).addClass(t?"fa-expand-alt":"fa-compress-alt"),tE()(this.toggleCompactMode.firstChild).removeClass(t?"fa-compress-alt":"fa-expand-alt");let i=t?tw.splitV(e,n,!0):tw.splitH(e,n,!0);this.layout.replaceWith(i),this.layout=i,tw.tools.waitForElementInDom(this.layout).then(t=>{tE()(t).css(this.compactMode?"height":"width","100%"),tE()(this._historyFilters.root).css(ne({},this.compactMode?{width:"100%"}:{height:"100%"})),tE()(this.filterWithText).css(ne({},this.compactMode?{height:"310px",width:"100%"}:{width:"310px",height:"100%"})),tE()(p).css(ne({},this.compactMode?{width:"100%"}:{height:"100%"})),setTimeout(()=>{this.styleHistoryGrid(),this.styleHistoryFilters()},100)})});this.subs.push(h,y,f,m)}}function nr(t,e,n,i,r,s,o){try{var a=t[s](o),l=a.value}catch(t){n(t);return}a.done?e(l):Promise.resolve(l).then(i,r)}function ns(t){return function(){var e=this,n=arguments;return new Promise(function(i,r){var s=t.apply(e,n);function o(t){nr(s,i,r,o,a,"next",t)}function a(t){nr(s,i,r,o,a,"throw",t)}o(void 0)})}}class no{static getHistoryRuns(t,e){let n=void 0===e||e;return(0,tO.from)(ns(function*(){return yield q.pullRunsByName(t,[{author:tx.shell.user}],{order:"started"},["func.params","session.user","options"],n)})())}}class na extends r.InputBase{setCurrentRow(){this.getValue()?this._historyList.chosen=this.getValue():this.chosenRunId&&(this._historyList.chosenById=this.chosenRunId)}showSelectionDialog(){this.renderGridAndFilters(),this._historyDialog.getButton("OK").disabled=1!==this._historyList.selected.size,this._historyDialog.show({modal:!0,fullScreen:!0,center:!0,width:window.innerWidth-50,height:window.innerHeight-50})}renderGridAndFilters(){var t,e,n,i;let r=new ni([...this._historyList.runs.values()],(n=function(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{},i=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(i=i.concat(Object.getOwnPropertySymbols(n).filter(function(t){return Object.getOwnPropertyDescriptor(n,t).enumerable}))),i.forEach(function(e){var i;i=n[e],e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i})}return t}({},this.options),i=i={visibleProps:null==(t=this.options)?void 0:t.mainProps,propFuncs:null==(e=this.options)?void 0:e.propFuncs},Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(i)):(function(t){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e.push.apply(e,n)}return e})(Object(i)).forEach(function(t){Object.defineProperty(n,t,Object.getOwnPropertyDescriptor(i,t))}),n));this._historyList.root.replaceWith(r.root),this._historyList=r,this._historyList.onChosen.subscribe(t=>{this._historyDialog.getButton("OK").disabled=!t}),this._historyList.onRunsDfChanged.pipe((0,D.filter)(t=>t.rowCount>0),(0,D.take)(1)).subscribe(()=>{this.setCurrentRow()})}getHistoryDialog(){let t=tw.dialog();return tE()(t.root.querySelector(".d4-dialog-contents")).removeClass("ui-form"),t.onOK(()=>ns(function*(){let t=this._historyList.chosen;if(t){var e,n;(null==(e=null==(n=this.options)?void 0:n.skipDfsOnInit)||e)&&(t=yield q.loadRun(t.id)),this.setValue(t)}this.fireInput()}).call(this)),t.addButton("Refresh",()=>{this.experimentRunsUpdate.next()},2,"Reload list of runs"),t.addButton("Discard",()=>{this.setValue(null),this.fireInput(),t.close()},1,"Discard the previous choice"),tE()(t.getButton("CANCEL")).hide(),t.add(this._historyList.root),t}setValue(t){var e,n,i,r,s,o,a;this._chosenRun=t,this._chosenRunId=null!=(e=null==(n=this._chosenRun)?void 0:n.id)?e:null,this.onHistoricalRunChosen.next(t),t?this.stringValue=(null==(s=this.options)?void 0:s.stringValueFunc)?null==(o=this.options)?void 0:o.stringValueFunc(t):[`${eh(t)} \\ ${t.author.name}`,(null!=(i=null!=(r=null==(a=this.options)?void 0:a.mainProps)?r:ez(t.func))?i:[]).map(e=>eq(t,e)).join(" \\ ")].join(" \\ "):this.stringValue="No run chosen",this.notify&&this.fireChanged()}getValue(){return this._chosenRun}get chosenRun(){return this._chosenRun}get chosenRunId(){return this._chosenRunId}set chosenRunId(t){this._chosenRunId=t}get root(){return this._visibleInput.root}set stringValue(t){this._visibleInput.value=t,this._visibleInput.setTooltip(this._visibleInput.value)}get stringValue(){return this._visibleInput.value}get iconRoot(){return this._visibleIcon}toggleLoaderExpRuns(t){this.store.isExperimentRunsLoading.next(t)}constructor(t,e,n){var i,r;const s=tw.input.string(t,{value:""});super(s.dart),this.label=t,this._funcName=e,this.options=n,this.onHistoricalRunChosen=new tO.BehaviorSubject(null),this.experimentRunsUpdate=new tO.Subject,this.store={experimentRuns:new tO.Observable,isExperimentRunsLoading:new tO.Subject,experimentRunData:new tO.BehaviorSubject("")},this._historyList=new ni([],{fallbackText:"No runs are found in history",showActions:!1,showBatchActions:!1,isHistory:!1,visibleProps:null==(i=this.options)?void 0:i.mainProps,propFuncs:null==(r=this.options)?void 0:r.propFuncs}),this._historyDialog=this.getHistoryDialog(),this._visibleInput=tw.input.string(this.label,{value:""}),this._visibleIcon=tw.iconFA("search",()=>this.showSelectionDialog(),"Search"),this._chosenRun=null,this._chosenRunId=null,this._visibleInput=s,this._visibleInput.readOnly=!0,this._visibleInput.input.addEventListener("click",()=>this.showSelectionDialog()),this._visibleInput.addOptions(this._visibleIcon),this.store.experimentRuns=this.experimentRunsUpdate.pipe((0,D.tap)(()=>this.toggleLoaderExpRuns(!0)),(0,D.switchMap)(()=>{var t,e;return no.getHistoryRuns(this._funcName,null==(t=null==(e=this.options)?void 0:e.skipDfsOnInit)||t).pipe((0,D.catchError)(t=>(console.error(t),tO.EMPTY)),(0,D.finalize)(()=>this.toggleLoaderExpRuns(!1)))}),(0,D.shareReplay)(1)),this.store.experimentRuns.subscribe(t=>{this._historyList.updateRuns(t.filter(t=>!ec(t)))}),this.store.isExperimentRunsLoading.subscribe(t=>{tw.setUpdateIndicator(this._visibleInput.root,t),tw.setUpdateIndicator(this._historyList.root,t)}),this.experimentRunsUpdate.next()}}class nl extends na{set value(t){this.setValue(t)}get value(){return this.getValue()}}class nu extends na{get value(){let t=this.getValue();return t?JSON.stringify({visualValue:this.stringValue,id:t.id.split("-")}):null}set value(t){this.setValue(null),this.stringValue=t?JSON.parse(t).visualValue:"No run is chosen",this.chosenRunId=t?JSON.parse(t).id.join("-"):""}}var nc=n(128),nd={};function np(t,e,n,i,r,s,o){try{var a=t[s](o),l=a.value}catch(t){n(t);return}a.done?e(l):Promise.resolve(l).then(i,r)}nd.styleTagTransform=er(),nd.setAttributes=et(),nd.insert=t8().bind(null,"head"),nd.domAPI=t4(),nd.insertStyleElement=en(),t5()(nc.A,nd),nc.A&&nc.A.locals&&nc.A.locals;class nh extends r.Widget{get type(){return"HistoryPanel"}updateHistoryPane(t){this.historyList.updateRuns(t)}showEditDialog(t){this.historyList.editRun(t)}addRun(t){this.historyList.addRun(t)}get history(){return this.historyList.runs}get onCompactModeChanged(){return this.historyList.onCompactModeChanged}get compactMode(){return this.historyList.compactMode}constructor(t){var e;super(tw.box(tw.divText("No historical runs loaded","hp-no-elements-label"),{style:{width:"100%",height:"100%"}})),e=this,this.func=t,this.onRunChosen=new tO.Subject,this.onComparison=new tO.Subject,this.afterRunEdited=new tO.Subject,this.afterRunDeleted=new tO.Subject,this.allRunsFetch=new tO.Subject,this.historyList=new ni([],{fallbackText:"No runs are found in history",showActions:!0,showBatchActions:!0,isHistory:!0}),this.panel=this.historyList.root;const n=this.historyList.onChosen.pipe((0,D.filter)(t=>!!t)).subscribe(t=>this.onRunChosen.next(t.id)),i=this.historyList.onComparisonCalled.subscribe(t=>this.onComparison.next(t)),r=this.allRunsFetch.subscribe(()=>{var t;return(t=function*(){tw.setUpdateIndicator(e.root,!0),q.pullRunsByName(e.func.name,[{author:tx.shell.user}],{},["session.user","options"]).then(t=>{tw.empty(e.root),e.root.appendChild(e.panel),e.updateHistoryPane(t)}).catch(t=>tx.shell.error(t)).finally(()=>tw.setUpdateIndicator(e.root,!1))},function(){var e=this,n=arguments;return new Promise(function(i,r){var s=t.apply(e,n);function o(t){np(s,i,r,o,a,"next",t)}function a(t){np(s,i,r,o,a,"throw",t)}o(void 0)})})()}),s=this.historyList.onMetadataEdit.subscribe(t=>{this.afterRunEdited.next(t)}),o=this.historyList.onDelete.subscribe(t=>{this.afterRunDeleted.next(t)});this.subs.push(n,r,s,i,o),this.allRunsFetch.next()}}function nf(t,e,n,i,r,s,o){try{var a=t[s](o),l=a.value}catch(t){n(t);return}a.done?e(l):Promise.resolve(l).then(i,r)}function nm(t){return function(){var e=this,n=arguments;return new Promise(function(i,r){var s=t.apply(e,n);function o(t){nf(s,i,r,o,a,"next",t)}function a(t){nf(s,i,r,o,a,"throw",t)}o(void 0)})}}(Q=ti||(ti={})).fileInput=function(t,e,n,i){return new eM(void 0===t?"Drag-n-drop here":t,void 0===e?null:e,void 0===n?null:n,void 0===i?eF:i)},Q.historyInput=function(t,e,n){return new nl(t,e,n)},Q.historyInputJSON=function(t,e,n){return new nu(t,e,n)},Q.historyPanel=function(t){return new nh(t)};let ny=new URL(tx.shell.startUri),ng=()=>nm(function*(){let t=yield navigator.mediaDevices.getDisplayMedia({video:!0,audio:!1,selfBrowserSurface:"include"}),e=new MediaRecorder(t),n=[];e.ondataavailable=t=>n.push(t.data),e.onstop=()=>{let e=new Blob(n,{type:n[0].type});t.getVideoTracks()[0].stop(),r.Utils.download(`Recording ${new Date().toLocaleString("en-us",{month:"short",day:"numeric",hour:"numeric",minute:"numeric"})}.mkv`,e,n[0].type)},e.start()})();class nv extends r.ViewBase{onFuncCallReady(){return nm(function*(){if(!this.options.isTabbed){this.name&&"New view"!==this.name||(this.name=this.funcCall.func.friendlyName);try{this.func.package&&(yield this.getPackageData())}catch(t){console.log(t)}}this.build();let t=this.getStartId();if(t&&!this.options.isTabbed&&(tw.setUpdateIndicator(this.root,!0),this.loadRun(t),tw.setUpdateIndicator(this.root,!1),this.setAsLoaded()),this.isHistoryEnabled&&this.func){let t=this.options.isTabbed?this.isHistorical.subscribe(t=>{t||(this.funcCall.id=null)}):this.isHistorical.subscribe(t=>{if(t){var e,n;this.path=`?id=${this.funcCall.id}`;let t=eh(this.funcCall);0>this.name.indexOf(" — ")?this.name=`${this.name} — ${null!=(e=this.funcCall.options.title)?e:t}`:this.name=`${this.name.substring(0,this.name.indexOf(" — "))} — ${null!=(n=this.funcCall.options.title)?n:t}`}else this.path="",this.funcCall.id=null,this.name=`${this.name.substring(0,this.name.indexOf(" — ")>0?this.name.indexOf(" — "):void 0)}`});this.subs.push(t)}}).call(this)}getStartId(){return tx.shell.getVar("isLoaded")?void 0:ny.searchParams.get("id")}setAsLoaded(){return tx.shell.setVar("isLoaded",!0)}get funcCall(){return this._funcCall}get func(){var t;return null==(t=this.funcCall)?void 0:t.func}get lastCall(){return this._lastCall}set lastCall(t){this._lastCall=t}get type(){return this._type}getPackageData(){return nm(function*(){var t,e;let n=this.func.package;if(!n)return;let i=null==(t=yield null==n?void 0:n.getProperties())?void 0:t.REPORT_BUG_URL;i&&!this.reportBug&&(this.reportBug=()=>nm(function*(){window.open(i,"_blank")})());let r=null==(e=yield null==n?void 0:n.getProperties())?void 0:e.REQUEST_FEATURE_URL;r&&!this.requestFeature&&(this.requestFeature=()=>nm(function*(){window.open(r,"_blank")})());let s=`${n.friendlyName}.
|
|
179
|
-
Last updated on ${tr()(n.updatedOn).format("YYYY MMM D, HH:mm")}`;this.getAbout||(this.getAbout=()=>nm(function*(){return s})())}).call(this)}linkFunccall(t){this._funcCall=t,this.funcCallReplaced.next(!0)}loadFuncCallById(){return nm(function*(){if(this.initValue instanceof r.FuncCall){yield new Promise(t=>setTimeout(t,0)),this.linkFunccall(this.initValue);return}tw.setUpdateIndicator(this.root,!0);let t=this.getStartId();if(t&&!this.options.isTabbed)this.linkFunccall((yield q.loadRun(t)));else{let t=r.Func.byName(this.initValue);this.linkFunccall(t.prepare({}))}tw.setUpdateIndicator(this.root,!1)}).call(this)}init(){return nm(function*(){yield this.loadFuncCallById(),yield this.onFuncCallReady(),this.isReady.next(!0)}).call(this)}build(){tw.empty(this.root),this.root.appendChild(this.buildIO()),this.options.historyEnabled&&this.isHistoryEnabled&&this.buildHistoryBlock(),this.buildRibbonMenu(),this.buildRibbonPanels()}onComparisonLaunch(t){return nm(function*(){let e=this.comparatorFunc;if(e){let n=r.Func.byName(e),i=(yield n.prepare({params:{comparedRuns:t}}).call()).outputs.comparisonView;tx.shell.addView(i);return}let n=tx.shell.v.parentCall,i=[...tx.shell.views].find(t=>t.type===tN),s=yield eP.fromComparedRuns(t,this.func,{parentView:i,parentCall:n});tx.shell.addView(s),s.defaultCustomize();let o=this.compareCustomizer;if(o){let t=r.Func.byName(o);yield t.prepare({params:{defaultView:s}}).call();return}}).call(this)}onSaveClick(){return nm(function*(){yield this.saveRun(this.funcCall)}).call(this)}buildHistoryBlock(){let t=ti.historyPanel(this.func),e=!1;return this.subs.push(t.onCompactModeChanged.subscribe(t=>{let e=tx.shell.dockManager.findNode(this.historyRoot);e&&(tx.shell.dockManager.close(e),t?tx.shell.dockManager.dock(this.historyRoot,"right",null,"History",.3):tx.shell.dockManager.dock(this.historyRoot,"down",null,"History",.3))}),t.onRunChosen.subscribe(t=>nm(function*(){tw.setUpdateIndicator(this.root,!0),yield this.loadRun(t),tw.setUpdateIndicator(this.root,!1)}).call(this)),t.onComparison.subscribe(e=>nm(function*(){eR(t.root,!0);let n=yield Promise.all(e.map(t=>q.loadRun(t)));yield this.onComparisonLaunch(n),eR(t.root,!1)}).call(this)),t.afterRunEdited.subscribe(t=>{if(t.id===this.funcCall.id&&t.options.title){var e,n;this.path=`?id=${this.funcCall.id}`;let i=eh(t);0>this.name.indexOf(" — ")?this.name=`${this.name} — ${null!=(e=t.options.title)?e:i}`:this.name=`${this.name.substring(0,this.name.indexOf(" — "))} — ${null!=(n=t.options.title)?n:i}`}}),tx.events.onViewRemoving.subscribe(t=>{if(t.args.view==this){let t=tx.shell.dockManager.findNode(this.historyRoot);t?(tx.shell.dockManager.close(t),e=!0):e=!1}}),tx.events.onCurrentViewChanged.subscribe(()=>{if(tx.shell.v==this){if(e){var t;(null==(t=this.historyBlock)?void 0:t.compactMode)?tx.shell.dockManager.dock(this.historyRoot,"right",null,"History",.3):tx.shell.dockManager.dock(this.historyRoot,"down",null,"History",.3)}}else{let t=tx.shell.dockManager.findNode(this.historyRoot);t?(tx.shell.dockManager.close(t),e=!0):e=!1}})),tw.empty(this.historyRoot),this.historyRoot.style.removeProperty("justify-content"),this.historyRoot.append(t.root),this.historyBlock=t,t.root}buildRibbonPanels(){let t=tw.iconFA("history",()=>{if(!tx.shell.dockManager.findNode(this.historyRoot)){var t;(null==(t=this.historyBlock)?void 0:t.compactMode)?tx.shell.dockManager.dock(this.historyRoot,"right",null,"History",.3):tx.shell.dockManager.dock(this.historyRoot,"down",null,"History",.3),this.historyRoot.parentElement.classList.add("ui-box"),this.historyRoot.classList.add("ui-box")}},"History"),e=tw.iconFA("save",()=>nm(function*(){yield this.onSaveClick()}).call(this),"Save current state"),n=tw.comboPopup(tw.iconFA("arrow-to-bottom"),this.getFormats(),this.exportRun.bind(this)),i=tw.iconFA("edit",()=>{this.historyBlock&&this.lastCall&&this.historyBlock.showEditDialog(this.historyBlock.history.get(this.funcCall.id))},"Edit this run metadata"),r=this.isHistorical.subscribe(t=>{t?(tw.setDisplay(n,!ec(this.funcCall)),tw.setDisplay(i,!0)):(tE()(n).hide(),tE()(i).hide())});if(this.subs.push(r),tw.tooltip.bind(n,()=>"inconsistent"===this.consistencyState.value&&this.mandatoryConsistent?"Current run is inconsistent. Export feature is disabled.":null),!this.options.isTabbed&&this.mandatoryConsistent){let t=this.consistencyState.pipe((0,D.distinctUntilChanged)()).subscribe(t=>{"inconsistent"===t?(tE()(n).addClass("d4-disabled"),tE()(n.lastChild).css("color","unset")):(tE()(n).removeClass("d4-disabled"),tE()(n.lastChild).removeProp("color"))});this.subs.push(t)}let s=[[...!this.options.isTabbed&&this.isHistoryEnabled&&this.options.historyEnabled?[t]:[],...!this.options.isTabbed&&this.isHistoryEnabled?[e]:[],...!this.options.isTabbed&&this.isExportEnabled&&this.exportConfig&&this.exportConfig.supportedFormats.length>0?[n]:[],...this.options.isTabbed?[]:[i]]];return this.setRibbonPanels(s),s}buildRibbonMenu(){if(this.ribbonMenu.clear(),!this.exportConfig&&!this.reportBug&&!this.requestFeature&&!this.getHelp&&!this.getMocks&&!this.getTemplates)return;let t=this.ribbonMenu.group("Model");if(this.getMocks&&this.getMocks.length>0)if(1===this.getMocks.length)t.item("Input data mock",this.getMocks[0].action);else{let e=t.group("Input data mocks");this.getMocks.forEach(t=>{e.item(t.mockName,t.action)}),t.endGroup()}if(this.getTemplates&&this.getTemplates.length>0)if(1===this.getTemplates.length)t.item("Input data template",this.getTemplates[0].action);else{let e=t.group("Input data templates");this.getTemplates.forEach(t=>{e.item(t.name,t.action)}),t.endGroup()}this.isExportEnabled&&this.exportConfig&&this.exportConfig.supportedFormats.length>0&&t.group("Export").items(this.getFormats(),this.exportRun.bind(this),{isValid:()=>this.isHistorical.value?this.mandatoryConsistent&&"inconsistent"===this.consistencyState.value?"Run should be consistent to be exported":null:"Run should be completed to be exported"}).endGroup(),this.reportBug&&t.item("Report a bug",()=>this.reportBug()),this.requestFeature&&t.item("Request a feature",()=>this.requestFeature()),this.getHelp&&t.item("Help",()=>this.getHelp()),t.item("Record the screen",ng),this.getAbout&&t.item("About",()=>nm(function*(){let t=yield this.getAbout();if(t){let e=tw.dialog("Current version");t.split("\n").forEach(t=>e.add(tw.label(t))),e.onOK(()=>{}),e.getButton("CANCEL").style.display="none",e.show({center:!0})}}).call(this))}exportRun(t){return nm(function*(){r.Utils.download(this.exportConfig.filename(t),(yield this.exportConfig.export(t)))}).call(this)}getFormats(){var t,e;return null!=(t=null==(e=this.exportConfig)?void 0:e.supportedFormats)?t:[]}onBeforeSaveRun(t){return nm(function*(){})()}onAfterSaveRun(t){return nm(function*(){})()}saveRun(t){return nm(function*(){let e=ed(t);yield this.onBeforeSaveRun(e),ec(e)&&(e=yield e3(t)),e.id&&e.newId();let n=yield q.saveRun(e),i=yield q.loadRun(n.id);return this.options.historyEnabled&&this.isHistoryEnabled&&this.historyBlock&&this.historyBlock.addRun(i),this.linkFunccall(i),this.isHistorical.next(!0),yield this.onAfterSaveRun(n),n}).call(this)}onBeforeDeleteRun(t){return nm(function*(){})()}onAfterDeleteRun(t){return nm(function*(){})()}deleteRun(t){return nm(function*(){return yield this.onBeforeDeleteRun(t),yield q.deleteRun(t),yield this.onAfterDeleteRun(t),t.id}).call(this)}onBeforeLoadRun(){return nm(function*(){})()}onAfterLoadRun(t){return nm(function*(){})()}loadRun(t){return nm(function*(){yield this.onBeforeLoadRun();let e=yield q.loadRun(t);return this.lastCall=ed(e),this.linkFunccall(e),this.isHistorical.next(!0),yield this.onAfterLoadRun(e),e}).call(this)}onBeforeRun(t){return nm(function*(){})()}onAfterRun(t){return nm(function*(){})()}run(){return nm(function*(){if(!this.funcCall)throw Error("The correspoding function is not specified");yield this.onBeforeRun(this.funcCall);let t=r.TaskBarProgressIndicator.create("Calculating...");try{this.funcCall.newId(),yield this.funcCall.call(),yield this.onAfterRun(this.funcCall),this.lastCall=ed(this.funcCall),!(this.options.isTabbed||this.runningOnInput)&&this.isHistoryEnabled&&(yield this.saveRun(this.funcCall))}catch(t){tx.shell.error(t.toString())}finally{t.close()}}).call(this)}exportRunJson(){return nm(function*(){if(this._lastCall){var t,e;let n;return JSON.stringify((yield(t=this._lastCall,e=this,e5(function*(){let n={};var i=!0,s=!1,o=void 0;try{for(var a,l=Object.entries(t.inputs)[Symbol.iterator]();!(i=(a=l.next()).done);i=!0){let t=e6(a.value,2),i=t[0],s=t[1],o=e.funcCall.inputParams[i].property;n[i]=yield function(t,e,n){return e5(function*(){if("file"===t.propertyType&&n.getInput){let e=n.getInput(t.name).value;return e instanceof r.FileInfo?(yield e.readAsBytes()).buffer:yield e.arrayBuffer()}return e})()}(o,s,e)}}catch(t){s=!0,o=t}finally{try{i||null==l.return||l.return()}finally{if(s)throw o}}return{inputs:n,outputs:t.outputs}})())),function(t,e){return e===1/0?{[ts]:"Infinity",value:!0}:e===-1/0?{[ts]:"-Infinity",value:!0}:Number.isNaN(e)?{[ts]:"NaN",value:!0}:e instanceof r.DataFrame&&!n.useJsonDF?{[ts]:"DataFrame",value:_(e.toByteArray())}:e instanceof r.DataFrame&&n.useJsonDF?{[ts]:"DataFrameJSON",value:e.toJson()}:e instanceof ArrayBuffer?{[ts]:"ArrayBuffer",value:_(new Uint8Array(e))}:e instanceof Map?{[ts]:"Map",value:Array.from(e)}:e instanceof Set?{[ts]:"Set",value:Array.from(e)}:tr().isDayjs(this[t])?{[ts]:"DayJs",value:this[t].toISOString()}:e},(n={}).space)}}).call(this)}getRunJSON(){return nm(function*(){let t=yield this.exportRunJson();t&&r.Utils.download(this.defaultExportFilename("","json"),t)}).call(this)}get compareCustomizer(){var t;return null!=(t=this.func.options.compareCustomizer)?t:null}get comparatorFunc(){var t;return null!=(t=this.func.options.comparatorFunc)?t:null}get uploadFunc(){var t;return null!=(t=this.func.options.uploadFunc)?t:null}get runningOnInput(){return"true"===this.func.options.runOnInput}get runningOnStart(){return"true"===this.func.options.runOnOpen}get mainParams(){return this.func.options.mainParams?JSON.parse(this.func.options.mainParams):null}get mandatoryConsistent(){var t;return(null==(t=this.parentCall)?void 0:t.func.options.mandatoryConsistent)==="true"}get hasContextHelp(){var t,e,n,i;return!!(null!=(e=null==(t=this.func)||null==(n=t.options)?void 0:n.help)?e:null==t||null==(i=t.options)?void 0:i.readme)}getContextHelp(){return nm(function*(){var t,e;return t=this.func,(e=function*(){var e;let n=null!=(e=t.options.help)?e:t.options.readme;if(!n)return;if(el.get(t.id))return el.get(t.id);let i="";try{i=t.package.name}catch(t){}let r=`System:AppData/${i}/${n}`;if(i&&(yield tx.dapi.files.exists(r))){let e=yield tx.dapi.files.readAsText(r);return el.set(t.id,e),e}let s=`${tx.shell.user.name}.home/${n}`;if(yield tx.dapi.files.exists(s)){let e=yield tx.dapi.files.readAsText(s);return el.set(t.id,e),e}},function(){var t=this,n=arguments;return new Promise(function(i,r){var s=e.apply(t,n);function o(t){ea(s,i,r,o,a,"next",t)}function a(t){ea(s,i,r,o,a,"throw",t)}o(void 0)})})()}).call(this)}get features(){var t;return JSON.parse(null!=(t=this.func.options.features)?t:"{}")}getFeature(t,e){var n,i;return n=this.features,n instanceof Array?n.includes(t):n instanceof Object&&null!=(i=n[t])?i:e}get isExportEnabled(){return this.getFeature("export",!0)}get isHistoryEnabled(){return this.getFeature("history",!0)}get isSaEnabled(){return this.getFeature("sens-analysis",!1)}get hasUploadMode(){return this.getFeature("upload",!1)}get isFittingEnabled(){return this.getFeature("fitting",!1)}get isOptimizationEnabled(){return this.getFeature("optimization",!1)}constructor(t,e){var n,i,s,o,a;let l=void 0===e?{historyEnabled:!0,isTabbed:!1,skipInit:!1}:e;super(),this.initValue=t,this.options=l,this._type="function",this.funcCallReplaced=new tO.Subject,this.isReady=new tO.BehaviorSubject(!1),this.exportConfig=null,this.getMocks=null,this.getTemplates=null,this.getHelp=null,this.reportBug=null,this.requestFeature=null,this.getAbout=null,this.historyBlock=null,this.isHistorical=new tO.BehaviorSubject(!1),this.historyRoot=tw.div(),this.consistencyState=new tO.BehaviorSubject("consistent"),this.defaultExportFilename=(t,e)=>`${this.name} - ${new Date().toLocaleString("en-US").replaceAll(/:|\//g,"-")}.${null!=e?e:this.exportConfig.supportedExtensions[t]}`,this.defaultSupportedExportExtensions=()=>({Excel:"xlsx"}),this.defaultSupportedExportFormats=()=>["Excel"],this.box=!0,this.parentCall=tx.functions.getCurrentCall(),t instanceof r.FuncCall&&(this.parentCall=t),this.parentView=null==(s=this.parentCall)||null==(i=s.parentCall)||null==(n=i.aux)?void 0:n.view,(null==(a=this.parentCall)||null==(o=a.func)?void 0:o.name)&&(this.basePath=`/${this.parentCall.func.name}`),l.skipInit||this.init()}}function nb(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=Array(e);n<e;n++)i[n]=t[n];return i}function nC(t,e,n,i,r,s,o){try{var a=t[s](o),l=a.value}catch(t){n(t);return}a.done?e(l):Promise.resolve(l).then(i,r)}function nA(t){return function(){var e=this,n=arguments;return new Promise(function(i,r){var s=t.apply(e,n);function o(t){nC(s,i,r,o,a,"next",t)}function a(t){nC(s,i,r,o,a,"throw",t)}o(void 0)})}}function nx(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n,i,r=null==t?null:"u">typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var s=[],o=!0,a=!1;try{for(r=r.call(t);!(o=(n=r.next()).done)&&(s.push(n.value),!e||s.length!==e);o=!0);}catch(t){a=!0,i=t}finally{try{o||null==r.return||r.return()}finally{if(a)throw i}}return s}}(t,e)||function(t,e){if(t){if("string"==typeof t)return nb(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if("Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return nb(t,e)}}(t,e)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}let nw=Math.ceil(36)+1,nI=(t,e,n)=>{tw.setUpdateIndicator(t,e);let i=t.querySelector(".d4-update-shadow .ui-label");e&&n&&i&&(i.textContent=n)},nR=(t,e)=>{try{return Number.isFinite(t)&&e?r.format(t,e):t}catch(e){return t}},nT=(t,e,n,i)=>{let r=["Parameter","Value","Units"];n&&r.push("Validation"),i&&r.push("Consistency"),t.addRow(r).font={bold:!0},e.forEach(e=>{let r=[e.caption,nR(e.value,e.format),e.units];r.push(nE(null==n?void 0:n[e.name])),r.push(nO(null==i?void 0:i[e.name])),t.addRow(r)}),t.getColumn(1).width=1.2*Math.max(...e.map(t=>t.caption.toString().length),9),t.getColumn(2).width=1.2*Math.max(...e.map(t=>t.value.toString().length),5),t.getColumn(3).width=1.2*Math.max(...e.map(t=>t.units.toString().length),5),t.getColumn(4).width=100,t.getColumn(5).width=100},nE=t=>null==t?"":["errors","warnings"].filter(e=>{var n;return!!(null==t||null==(n=t[e])?void 0:n.length)}).flatMap(e=>t[e].map(t=>({category:e,advice:t}))).map(t=>{let e=t.category,n=t.advice;return`${e}: ${"string"==typeof n?n:n.description}`}).join("\n"),nO=t=>{if(null==t)return"";if(t.inconsistent&&("disabled"===t.restriction||"restricted"===t.restriction)){let e=t.assignedValue,n="number"==typeof e&&Number.isFinite(e)?r.format(e,tF):String(e);return`Inconsistent: value should be ${n}`}},nS=t=>{let e=t.sheet,n=t.dfCounter,i=t.df,r=t.column,s=t.row,o=t.validation,a=t.consistency;if(!i)return;let l=e.getColumn(null!=r?r:1).letter,u=i.columns.length,c=[];for(let t=0;t<i.rowCount;t++){let e=[];for(let n=0;n<i.columns.length;n++){let r=i.col(n),s=i.get(r.name,t);if((null==r?void 0:r.type)==="double"){var d,p;let t=nR(s,null!=(d=null==r||null==(p=r.tags)?void 0:p.format)?d:tF);e.push(t)}else e.push(s)}c.push(e)}let h={name:`ID_${n.toString()}`,ref:`${l}${null!=s?s:1}`,columns:i.columns.toList().map(t=>({name:t.name,filterButton:!1})),rows:c};e.addTable(h),e.columns.forEach(t=>{t.width=25,t.alignment={wrapText:!0}});let f=u+1;e.getColumn(f).width=100,e.getCell(1,f).value="Validation and Consistency",o&&(e.getCell(2,f).value=nE(o)),a&&(e.getCell(3,f).value=nO(a))},nP=t=>!t||0===t.rowCount;function nk(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=Array(e);n<e;n++)i[n]=t[n];return i}function nD(t,e,n,i,r,s,o){try{var a=t[s](o),l=a.value}catch(t){n(t);return}a.done?e(l):Promise.resolve(l).then(i,r)}function nL(t){return function(){var e=this,n=arguments;return new Promise(function(i,r){var s=t.apply(e,n);function o(t){nD(s,i,r,o,a,"next",t)}function a(t){nD(s,i,r,o,a,"throw",t)}o(void 0)})}}function nV(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{},i=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(i=i.concat(Object.getOwnPropertySymbols(n).filter(function(t){return Object.getOwnPropertyDescriptor(n,t).enumerable}))),i.forEach(function(e){var i;i=n[e],e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i})}return t}function nF(t,e){return e=null!=e?e:{},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):(function(t){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e.push.apply(e,n)}return e})(Object(e)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(e,n))}),t}function nM(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n,i,r=null==t?null:"u">typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var s=[],o=!0,a=!1;try{for(r=r.call(t);!(o=(n=r.next()).done)&&(s.push(n.value),!e||s.length!==e);o=!0);}catch(t){a=!0,i=t}finally{try{o||null==r.return||r.return()}finally{if(a)throw i}}return s}}(t,e)||function(t,e){if(t){if("string"==typeof t)return nk(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if("Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return nk(t,e)}}(t,e)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}let nN=()=>tw.divText("[No data to display]",{style:{"text-align":"center","align-content":"center",width:"100%",height:"100%"}});class nB extends nv{static fromFuncCall(t,e){return new this(t,void 0===e?{historyEnabled:!0,isTabbed:!1}:e)}onFuncCallReady(){var t=this,e=()=>super.onFuncCallReady;return nL(function*(){yield this.loadInputsOverrides(),yield this.loadValidators(tn.INPUTS),yield this.loadValidators(tn.OUTPUTS),yield e().call(t);let n=this.funcCallReplaced.subscribe(()=>{this.inputValidationRequests.next({isRevalidation:!1}),this.outputValidationRequests.next({isRevalidation:!1})});this.subs.push(n);let i=t=>(0,D.mergeMap)(e=>e.pipe((0,D.tap)(e=>{t===tn.INPUTS?this.setInputValidationPending(e.field):this.setOutputValidationPending(e.field)}),(0,D.switchMap)(e=>{let n=new AbortController,i=n.signal,r=!1;return new tO.Observable(s=>{let o=(0,tO.from)(this.runValidation(nV({},e),i,t)).subscribe(t=>{r=!0,s.next(t)});return()=>{r||n.abort(),o.unsubscribe()}}).pipe((0,D.tap)(n=>{t===tn.INPUTS?this.setInputValidationResults(n):this.setOutputValidationResults(n),this.runRevalidations(e,n,t),t===tn.INPUTS?this.inputValidationUpdates.next(null):this.outputValidationUpdates.next(null)}),(0,D.mapTo)(e))}))),r=this.inputValidationRequests.pipe((0,D.groupBy)(t=>t.field),i(tn.INPUTS)).subscribe(t=>{t.field&&this.runningOnInput&&this.isRunnable()&&this.doRun()});this.subs.push(r);let s=this.outputValidationRequests.pipe((0,D.groupBy)(t=>t.field),i(tn.OUTPUTS)).subscribe();this.subs.push(s);let o=this.externalValidatorsUpdates.subscribe(t=>{this.updateInputValidationResults(t)});this.subs.push(o);let a=(0,tO.combineLatest)([this.runRequests.pipe((0,D.switchMap)(()=>(0,tO.of)(!1).pipe((0,D.delay)(500),(0,D.startWith)(!0)))),this.inputValidationUpdates.pipe((0,D.debounceTime)(0))]).pipe((0,D.filter)(t=>nM(t,1)[0]&&this.isRunnable())).subscribe(()=>this.doRun());this.subs.push(a);let l=this.options.isTabbed?null:yield this.loadLastInputs();if(l)tx.shell.info(tw.div([tw.divText("Do you want to load last inputs?"),tw.divH([tw.bigButton("Load",()=>{var t=!0,e=!1,n=void 0;try{for(var i,r=Object.entries(l)[Symbol.iterator]();!(t=(i=r.next()).done);t=!0){let t=nM(i.value,2),e=t[0],n=t[1],r=this.getInput(e);r.notify=!1,r.value=n,r.notify=!0,this.funcCall.inputs[e]=n,this.inputValidationRequests.next({field:e,isRevalidation:!1})}}catch(t){e=!0,n=t}finally{try{t||null==r.return||r.return()}finally{if(e)throw n}}tx.shell.info(tw.divText("Change the loaded inputs to run computations"))})])]));else{let t=new AbortController,e=yield this.runValidation({isRevalidation:!1},t.signal);this.setInputValidationResults(e),this.runRevalidations({isRevalidation:!1},e),this.inputValidationUpdates.next(null),this.runningOnStart&&this.isRunnable()&&(yield this.doRun())}}).call(this)}onBeforeRun(){return this.tabsElem.currentPane&&(this.prevOpenedTab=this.inputTabsLabels.includes(this.tabsElem.currentPane.name)?null:this.tabsElem.currentPane),Promise.resolve()}onAfterRun(){if(this.showOutput(),this.tabsElem.panes.forEach(t=>{tE()(t.header).show()}),this.prevOpenedTab)return this.tabsElem.currentPane=this.prevOpenedTab,Promise.resolve();let t=this.tabsElem.panes.find(t=>this.outputTabsLabels.includes(t.name));return t&&(this.tabsElem.currentPane=t),Promise.resolve()}getRunButton(t){var e;let n=tw.bigButton(null!=(e=this.func.options.runLabel)?e:void 0===t?"Run":t,()=>nL(function*(){return yield this.doRun()}).call(this)),i=(0,tO.merge)(this.inputValidationUpdates,this.externalValidatorsUpdates,this.isRunning,this.blockRuns).subscribe(()=>{n.disabled=!this.isRunnable()});return this.subs.push(i),n}loadInputsOverrides(){return nL(function*(){let t=[...this.funcCall.inputParams.values()];yield Promise.all(t.map(t=>nL(function*(){if(t.property.options.input){let e=r.Func.byName(t.property.options.input).prepare({params:JSON.parse(t.property.options.inputOptions||"{}")});yield e.call(),this.inputsOverride[t.name]=e.outputs.input}}).call(this)))}).call(this)}loadValidators(){return nL(function*(t){var e;let n,i=void 0===t?tn.INPUTS:t,s=yield(e=this.funcCall,n=void 0===i?tn.INPUTS:i,e5(function*(){let t=[...e[e9[n]].values()];return(yield Promise.all(t.filter(t=>!!t.property.options.validatorFunc).map(t=>e5(function*(){let e=r.Func.byName(t.property.options.validatorFunc).prepare({params:JSON.parse(t.property.options.validatorFuncOptions||"{}")});return yield e.call(),[t.name,e.outputs.validator]})()))).reduce((t,e)=>{let n=e6(e,2),i=n[0],r=n[1];return t[i]=r,t},{})})());i===tn.INPUTS?this.inputValidators=s:this.outputValidators=s}).apply(this,arguments)}keepOutput(){var t;return(null==(t=this.func)?void 0:t.options.keepOutput)==="true"}getSaveButton(t){let e=tw.bigButton(void 0===t?"Save":t,()=>nL(function*(){return yield this.saveExperimentalRun(this.funcCall)}).call(this),"Save uploaded data"),n=this.isUploadMode.subscribe(t=>{this.buildRibbonPanels(),t?tE()(e).show():tE()(e).hide()});return this.subs.push(n),e}getStandardButtons(){let t=this.getRunButton(),e=tw.div([t]);tw.tooltip.bind(e,()=>t.disabled?this.isRunning.value?"Computations are in progress":this.getValidationMessage():"");let n=this.getSaveButton();return[...this.isHistoryEnabled&&!this.options.isTabbed?[n]:[],...this.runningOnInput?[]:[e]]}buildFormButtons(){var t;let e=this.getStandardButtons(),n=tw.buttonsInput();return tE()(n.firstChild).css({display:"none"}),null==(t=n.lastChild)||t.replaceWith(tw.div([...this.navBtns,...this.additionalBtns,...e],"ui-input-editor")),tE()(n).addClass("rfv-buttons"),tE()(n).css({"max-width":"100%"}),this.formButtons.replaceWith(n),this.formButtons=n,n}setAdditionalButtons(t){this.additionalBtns=t,this.buildFormButtons()}setNavigationButtons(t){this.navBtns=t,this.buildFormButtons()}buildIO(){let t=this.buildInputBlock(),e=t.inputBlock,n=t.inputForm,i=t.outputForm,r=t.controlsWrapper,s=[...Array.from(n.childNodes),...this.isUploadMode.value?[Array.from(i.childNodes)]:[]];tw.tools.handleResize(e,()=>{300>tE()(e).width()?(tE()(n).addClass("ui-form-condensed"),tE()(i).addClass("ui-form-condensed"),tE()(r).addClass("ui-form-condensed"),s.forEach(t=>tE()(t).css("min-width","100px"))):(tE()(n).removeClass("ui-form-condensed"),tE()(i).removeClass("ui-form-condensed"),tE()(r).removeClass("ui-form-condensed"),s.forEach(t=>tE()(t).css("min-width","100%")))});let o=this.buildOutputBlock();o.style.height="100%",o.style.width="100%",this.hideOutput();let a=tw.splitH([e,tw.panel([o],{style:{paddingTop:"0px"}})],null,!0);return a.style.padding="0 12px",e.style.maxWidth="360px",a}buildInputBlock(){let t=this.renderInputForm(),e=this.renderOutputForm();this.buildFormButtons();let n=tw.div(this.formButtons,"ui-form ui-form-wide");tE()(n).css({"padding-left":"0px","padding-bottom":"0px","padding-right":"6px","max-width":"100%","min-height":"50px"});let i=tw.input.toggle("",{value:this.isUploadMode.value,onValueChanged:t=>this.isUploadMode.next(t)}),r=this.isUploadMode.subscribe(t=>{i.notify=!1,i.value=t,i.notify=!0,t?tE()(e).show():tE()(e).hide()});return this.subs.push(r),{inputBlock:tw.divV([t,...this.hasUploadMode&&!this.uploadFunc?[tw.divH([tw.h2("Experimental data"),i.root],{style:{flexGrow:"0"}}),e]:[],n],"ui-box rfv-form"),inputForm:t,outputForm:e,controlsWrapper:n}}processCustomDataUpload(){return nL(function*(){let t=()=>{let t=r.Dialog.create({title:"Select to compare"}),e=new ni(a.length>0?a:[...this.historyBlock.history.values()],{fallbackText:"No historical runs found",showActions:!(a.length>0),showBatchActions:!(a.length>0)}),n=new ni(o,{fallbackText:"No runs uploaded",showActions:!1,showBatchActions:!1});t.add(tw.divV([tw.divV([tw.label("Uploaded runs"),tw.element("div","splitbar-horizontal"),n.root],{style:{height:"50%",overflowY:"hidden"}}),tw.divV([tw.label(a.length>0?"Simulated":"History",{style:{padding:"0px 10px 0px 9px"}}),tw.element("div","splitbar-horizontal"),e.root],{style:{height:"50%",overflowY:"hidden"}})],{style:{justifyContent:"space-between",gap:"10px",overflowY:"scroll",height:"100%"}})),tE()(t.root.querySelector(".d4-dialog-contents")).removeClass("ui-form");let i="Compare selected";return 0===a.length?t.addButton(i,()=>nL(function*(){let i=yield Promise.all([...e.selected].map(t=>q.loadRun(t.id)));this.onComparisonLaunch([...i,...n.selected.values()]),t.close()}).call(this)):t.addButton(i,()=>nL(function*(){this.onComparisonLaunch([...e.selected.values(),...n.selected.values()]),t.close()}).call(this)),t.getButton(i).disabled=!0,this.subs.push((0,tO.merge)(e.onSelectedChanged,n.onSelectedChanged).subscribe(()=>{e.selected.size+n.selected.size>1?t.getButton(i).disabled=!1:t.getButton(i).disabled=!0})),this.isHistorical.value&&t.addButton(d,()=>nL(function*(){this.onComparisonLaunch([this.funcCall,...n.selected.values()]),t.close()}).call(this)),tE()(t.getButton("CANCEL")).hide(),t},e=r.Func.byName(this.uploadFunc),n=yield e.prepare({params:{func:this.func}}).call(),i=n.outputs.uploadWidget,s=n.outputs.uploadFuncCall,o=[],a=[],l=r.Dialog.create({title:"Upload"});tE()(l.root.querySelector(".d4-dialog-contents")).removeClass("ui-form");let u=r.Dialog.create({title:"Review uploaded runs"});tE()(u.root.querySelector(".d4-dialog-contents")).removeClass("ui-form");let c="Save to history",d="Compare w/ current";l.add(i.root),l.addButton(c,()=>nL(function*(){return eR(l.root,!0),o.forEach(t=>{t.options.immutable_tags?t.options.immutable_tags.push(tj):t.options.immutable_tags=[tj]}),Promise.all(o.map(t=>nL(function*(){let e=yield this.getValidExpRun(t);return q.saveRun(e)}).call(this))).then(t=>Promise.all(t.map(t=>q.loadRun(t.id)))).then(t=>{t.forEach(t=>this.historyBlock.addRun(t))}).catch(t=>{tx.shell.error(t)}).finally(()=>{eR(l.root,!1),l.close();let t=new ni(o,{fallbackText:"No runs uploaded",showActions:!0,showBatchActions:!0});u.add(t),u.show({modal:!0,fullScreen:!0})})}).call(this)),l.addButton("Next",()=>{l.close(),o.forEach(t=>{t.options.immutable_tags?t.options.immutable_tags.push(tj):t.options.immutable_tags=[tj]});let t=new ni(o,{fallbackText:"No runs uploaded",showActions:!0,showBatchActions:!0});u.add(t.root),u.show({modal:!0,fullScreen:!0})}),tE()(l.getButton("CANCEL")).hide(),l.getButton(c).disabled=!0,l.getButton("Next").disabled=!0,tE()(u.getButton("CANCEL")).hide(),u.addButton("Simulate w/ same inputs",()=>{eR(l.root,!0),Promise.all(o.map(t=>nL(function*(){return(yield e3(t)).call()})())).then(e=>{a=e,u.close(),t().show({modal:!0,fullScreen:!0})}).catch(t=>{tx.shell.error(t)}).finally(()=>{eR(l.root,!1)})}),u.addButton("Compare w/ history",()=>{u.close(),t().show({modal:!0,fullScreen:!0})});let p=tx.functions.onAfterRunAction.pipe((0,D.filter)(t=>t.id===s.id)).subscribe(()=>{o=s.outputs.uploadedCalls,l.getButton(c).disabled=!1,l.getButton("Next").disabled=!1}),h=l.onClose.subscribe(()=>{this.isUploadMode.next(!1)});l.subs.push(h,p),l.show({modal:!0,center:!0,resizable:!0})}).call(this)}onSaveClick(){return nL(function*(){this.isUploadMode.value?yield this.saveExperimentalRun(this.funcCall):yield this.saveRun(this.funcCall)}).call(this)}buildRibbonPanels(){super.buildRibbonPanels();let t=tw.iconFA("play",()=>nL(function*(){return yield this.doRun()}).call(this),"Run computations");t.classList.add("fas");let e=tw.iconFA("arrow-to-top",()=>nL(function*(){this.uploadFunc?yield this.processCustomDataUpload():(this.isUploadMode.next(!this.isUploadMode.value),e.classList.toggle("d4-current"))}).call(this),"Upload experimental data");e.classList.add("d4-toggle-button",...this.isUploadMode.value?["d4-current"]:[]);let n=tw.iconFA("info",()=>nL(function*(){this.hasContextHelp&&(tx.shell.windows.help.visible=!0,yield new Promise(t=>setTimeout(t,100)),tx.shell.windows.help.showHelp(tw.markdown((yield this.getContextHelp()))))}).call(this),"Info"),i=[[...super.buildRibbonPanels().flat(),...this.runningOnInput||this.options.isTabbed?[]:[t],...this.hasUploadMode?[e]:[],...!this.options.isTabbed&&this.hasContextHelp?[n]:[]]];return this.setRibbonPanels(i),i}showOutput(){tw.setDisplay(this.tabsElem.root,!0),this._isOutputOutdated.next(!1)}getViewers(t){return this.dfToViewerMapping[t]}buildOutputBlock(){this.tabsElem.root.style.width="100%",this.tabsLabels.forEach(t=>{let e=nM(this.categoryToDfParamMap.outputs[t]?[this.categoryToDfParamMap.outputs[t],!1]:[this.categoryToDfParamMap.inputs[t],!0],2),n=e[0],i=e[1],s=n.filter(t=>t.propertyType===r.TYPE.DATA_FRAME||t.propertyType===r.TYPE.GRAPHICS),o=n.filter(t=>t.propertyType!==r.TYPE.DATA_FRAME&&t.propertyType!==r.TYPE.GRAPHICS),a=s.map(t=>ep(t).config),l="",u=s.reduce((t,e,n)=>{var s,o;this.dfToViewerMapping[e.name]=[];let u=a[n].map((t,n)=>nL(function*(){var n,i,s,o;let a=null!=(n=null!=(i=null==(s=this.funcCall.outputs[e.name])?void 0:s.value)?i:null==(o=this.funcCall.inputParams[e.name])?void 0:o.value)?n:tx.data.demo.demog(0),l=t.type,u=Object.values(tM).includes(l)?r.Viewer.fromType(l,a):yield a.plot.fromType(l);u.setOptions(t),this.dfToViewerMapping[e.name].push(u),this.afterOutputPropertyRender.next({prop:e,output:u});let c=nN();return 0===a.rowCount&&"demog 0"===a.name&&(tw.setDisplay(u.root,!1),tw.setDisplay(c,!0)),{viewer:u,stub:c}}).call(this)).map((t,i)=>t.then(t=>{let r=t.viewer,s=t.stub,o=()=>nL(function*(){var t;let o=null!=(t=this.funcCall.outputParams[e.name])?t:this.funcCall.inputParams[e.name];if(o.value){if(tw.setDisplay(r.root,!0),tw.setDisplay(s,!1),Object.values(tM).includes(r.type))r.dataFrame=o.value;else{let t=yield o.value.plot.fromType(r.type);r.root.replaceWith(t.root),r=t}try{a[n][i]&&r.setOptions(a[n][i])}catch(t){console.error("Error setting viewer properties: ",t)}Object.keys(a[n][i]).includes("color")&&r.setOptions({color:a[n][i].color}),this.afterOutputPropertyRender.next({prop:e,output:r})}else tw.setDisplay(r.root,!1),tw.setDisplay(s,!0)}).call(this),l=this.funcCallReplaced.pipe((0,D.startWith)(null),(0,D.switchMap)(()=>{var t;return(null!=(t=this.funcCall.outputParams[e.name])?t:this.funcCall.inputParams[e.name]).onChanged.pipe((0,D.startWith)(null))}),(0,D.skip)(1)).subscribe(o);return this.subs.push(l),{loadedViewer:r,stub:s}})),c=l!==(null!=(s=e.options.caption)?s:e.name)?null!=(o=e.options.caption)?o:e.name:" ";if(l=c,i){let t=this.funcCallReplaced.pipe((0,D.switchMap)(()=>{var t;return(null!=(t=this.funcCall.outputParams[e.name])?t:this.funcCall.inputParams[e.name]).onChanged})).subscribe(()=>{this.showOutput(),this.inputTabsLabels.forEach(t=>{tE()(this.tabsElem.getPane(t).header).show()})});this.subs.push(t)}let d=u.map((t,i)=>{let r=a[n][i].block,s=tw.wait(()=>nL(function*(){let e=yield t;return tE()(e.loadedViewer.root).css({height:"100%",width:"100%"}),tw.divV([e.loadedViewer.root,e.stub],{style:{width:"100%"}})})());tE()(s).css({"min-height":"300px","flex-grow":"1"});let o=tL();return this.outputValidationSigns[e.name]=o,tw.divV([tw.divH([tw.h2(0===i?c:" ",{style:{whiteSpace:"pre"}}),...0===i?[tw.div([this.outputValidationSigns[e.name][0],this.outputValidationSigns[e.name][1]],{style:{margin:"10.79px"}})]:[]]),s],{style:nV({},r?{width:`${r}%`,"max-width":`${r}%`,"max-height":"100%"}:{"flex-grow":"1"})})});if(e.propertyType===r.TYPE.GRAPHICS){let n=e.options.block,i=nN();i.classList.add("grok-scripting-image-container");let r=tw.divV([tw.h2(c,{style:{whiteSpace:"pre"}}),i],{style:nV({},n?{width:`${n}%`,"max-width":`${n}%`,"max-height":"100%"}:{"flex-grow":"1"})}),s=()=>{var t;let n=null!=(t=this.funcCall.outputParams[e.name])?t:this.funcCall.inputParams[e.name];n.value?(i.style.backgroundImage=`url("data:image/png;base64,${n.value}")`,i.textContent=""):(i.style.removeProperty("background-image"),i.textContent="[No data to display]")},o=this.funcCallReplaced.pipe((0,D.startWith)(null),(0,D.switchMap)(()=>{var t;return(null!=(t=this.funcCall.outputParams[e.name])?t:this.funcCall.inputParams[e.name]).onChanged.pipe((0,D.startWith)(null))}),(0,D.skip)(1)).subscribe(s);this.subs.push(o),t.append(r)}return t.append(...d),t},tw.divH([],{style:{flexWrap:"wrap",flexGrow:"1",maxHeight:"100%"}}));o.forEach(t=>{let e=tL();this.outputValidationSigns[t.name]=e});let c=()=>{let t=r.HtmlTable.create(o,t=>{var e;let n=t.options.precision,i=n&&t.propertyType===r.TYPE.FLOAT&&this.funcCall.outputs[t.name]?this.funcCall.outputs[t.name].toPrecision(n):this.funcCall.outputs[t.name],s=t.options.units?` [${t.options.units}]`:"";return[`${null!=(e=t.caption)?e:t.name}${s}`,null!=i?i:"[No value]",tw.div([this.outputValidationSigns[t.name][0],this.outputValidationSigns[t.name][1]])]}).root;return tE()(t).addClass("rfv-scalar-table"),this.afterOutputSacalarTableRender.next(t),t},d=c(),p=(0,tO.merge)(this.funcCallReplaced,this.isRunning.pipe((0,D.filter)(t=>!1===t),(0,D.skip)(1))).subscribe(()=>{let e=c();d.replaceWith(e),d=e,tE()(this.tabsElem.getPane(t).header).show()});this.subs.push(p),this.tabsElem.addPane(t,()=>tw.divV([...s.length?[u]:[],...o.length?[d]:[]]))});let t=tw.box();return t.append(this.tabsElem.root),t}onAfterLoadRun(t){return nL(function*(){this.showOutput()}).call(this)}get tabsLabels(){return[...this.inputTabsLabels,...this.outputTabsLabels]}get outputTabsLabels(){return Object.keys(this.categoryToDfParamMap.outputs)}get inputTabsLabels(){return Object.keys(this.categoryToDfParamMap.inputs)}get categoryToDfParamMap(){var t;let e;return t=this.funcCall.func,e={inputs:{},outputs:{}},t.inputs.filter(t=>t.propertyType===r.TYPE.DATA_FRAME&&0!==ep(t).config.length).forEach(t=>{let n="Misc"===t.category?"Input":t.category;e.inputs[n]?e.inputs[n].push(t):e.inputs[n]=[t]}),t.outputs.forEach(t=>{let n="Misc"===t.category?"Output":t.category;(t.propertyType!==r.TYPE.DATA_FRAME||0!==ep(t).config.length)&&(e.outputs[n]?e.outputs[n].push(t):e.outputs[n]=[t])}),e}get inputsStorage(){return`RFV_LastInputs_${this.funcCall.func.name}`}saveLastInputs(){return nL(function*(){try{let t=tR()(this.funcCall.inputParams.values()).reduce((t,e)=>{let n=e.property.propertyType!==r.TYPE.DATA_FRAME?this.funcCall.inputs[e.name]:Array.from(this.funcCall.inputs[e.name].toByteArray());return nF(nV({},t),{[e.name]:n})},{});return localStorage.setItem(this.inputsStorage,JSON.stringify(t))}catch(t){tx.shell.error(t.toString())}}).call(this)}loadLastInputs(){return nL(function*(){try{var t;let e=JSON.parse(null!=(t=localStorage.getItem(this.inputsStorage))?t:"{}");if(0===Object.keys(e).length)return null;return tR()(this.funcCall.inputParams.values()).reduce((t,n)=>{let i=n.property.propertyType!==r.TYPE.DATA_FRAME?e[n.name]:r.DataFrame.fromByteArray(new Uint8Array(e[n.name]));return nF(nV({},t),{[n.name]:i})},{})}catch(t){tx.shell.error(t.toString())}}).call(this)}deleteLastInputs(){return nL(function*(){try{return localStorage.removeItem(this.inputsStorage)}catch(t){tx.shell.error(t.toString())}}).call(this)}doRun(){return nL(function*(){this.isRunning.next(!0);try{this.options.isTabbed||(yield this.saveLastInputs()),yield this.run(),this.options.isTabbed||(yield this.deleteLastInputs())}catch(t){tx.shell.error(t.toString()),console.log(t)}finally{this.isRunning.next(!1),this.inputValidationRequests.next({isRevalidation:!1,isNewOutput:!0}),this.outputValidationRequests.next({isRevalidation:!1})}}).call(this)}setExternalValidationResults(t,e){this.externalValidatorsState[t]=e,this.externalValidatorsUpdates.next(t)}saveInputLockState(t,e,n){"restricted"===n&&(this.funcCall.options[eX]=nF(nV({},this.funcCall.options[eX]),{[t]:e})),n&&(this.funcCall.options[e0]=nF(nV({},this.funcCall.options[e0]),{[t]:n})),this.updateConsistencyState()}getInputLockState(t){var e;return null==(e=this.funcCall.options[e0])?void 0:e[t]}updateConsistencyState(){let t=Object.values(this.funcCall.options[e0]).some(t=>"inconsistent"===t);this.consistencyState.next(t?"inconsistent":"consistent")}getInput(t){return this.inputsMap[t]}setInput(t,e,n){let i=this.getInput(t);if(!i)throw Error(`No input named ${t}`);if(this.funcCall.inputParams[t].property.propertyType===r.TYPE.DATA_FRAME&&"restricted"===n)throw Error(`Param ${t} is dataframe. Restricted state is not supported for them.`);n||(n=this.funcCall.inputParams[t].property.propertyType===r.TYPE.DATA_FRAME?"disabled":"restricted"),this.funcCall.inputs[t]=e,this.setInputLockState(i,t,e,n)}getParamChanges(t){return this.funcCallReplaced.pipe((0,D.startWith)(null),(0,D.filter)(()=>!!this.funcCall),(0,D.map)(()=>this.funcCall.inputParams[t]?"inputParams":"outputParams"),(0,D.switchMap)(e=>this.funcCall[e][t].onChanged.pipe((0,D.startWith)(null),(0,D.map)(()=>this.funcCall[e][t].value))))}getParamValue(t){var e,n;let i=(null==(e=this.funcCall)?void 0:e.inputParams[t])?"inputParams":"outputParams";return null==(n=this.funcCall)?void 0:n[i][t].value}setInputLockState(t,e,n,i){i&&this.saveInputLockState(e,n,i),t1(t)&&("disabled"===i&&t.setDisabled(),"restricted"===i&&t.setRestricted(),"restricted unlocked"===i&&t.setRestrictedUnlocked(),"inconsistent"===i&&t.setInconsistent(),"user input"===i&&t.setUserInput())}getRestrictedValue(t){var e;return null==(e=this.funcCall.options[eX])?void 0:e[t]}renderOutputForm(){return this.renderIOForm(tn.OUTPUTS)}renderInputForm(){return this.renderIOForm(tn.INPUTS)}renderIOForm(t){let e=tw.divH([],"ui-form ui-form-wide");tE()(e).css({"flex-wrap":"wrap","flex-grow":"0","padding-right":"12px","padding-top":"0px","padding-left":"0px","max-width":"100%",gap:"4px"});let n="Misc",i=this.funcCall[e9[t]].values();return tR()(i).filter(t=>!!t).forEach(i=>{let r=i.property;this.beforeInputPropertyRender.next(r);let s=this.getInputForVal(i);if(!s){n=r.category;return}this.inputsMap[i.property.name]=s,t===tn.INPUTS&&(this.syncInput(i,s,t),this.checkForMapping(i,s),this.runningOnInput||this.disableInputsOnRun(i.property.name,s),this.bindOnHotkey(s)),this.renderCategory(e,i.property.category,n),this.renderInput(e,i,s),this.afterInputPropertyRender.next({prop:r,input:s}),n=r.category}),Object.keys(this.foldedCategoryInputs).forEach(t=>this.foldedCategoryInputs[t].forEach(t=>tE()(t.input.root).hide())),e.classList.remove("ui-panel"),e}saveFocusedElement(t){this.focusedInput=t}restoreFocusedElement(){var t;null==(t=this.focusedInput)||t.focus()}disableInputsOnRun(t,e){let n=this.isRunning.subscribe(n=>{!("user input"!==this.getInputLockState(t)&&this.getInputLockState(t))&&(n?(e4(e)&&tE()(e.input).is(":focus")&&this.saveFocusedElement(e.input),e.enabled=!1):(e.enabled=!0,e4(e)&&this.restoreFocusedElement()))});this.subs.push(n)}checkForMapping(t,e){if(!e.hasOwnProperty("_chosenRun"))return;let n=t.property.options.funccallMapping;if(!n)return;let i=JSON.parse(n),r=this.funcCallReplaced.pipe((0,D.startWith)(!0),(0,D.switchMap)(()=>this.funcCall.inputParams[t.property.name].onChanged)).subscribe(()=>{Object.entries(i).forEach(t=>{var n,i,r,s,o,a;let l=nM(t,2),u=l[0],c=l[1];return this.setInput(u,e.chosenRun?null!=(n=null!=(i=null!=(r=null==(s=e.chosenRun)?void 0:s.inputs[c])?r:null==(o=e.chosenRun)?void 0:o.outputs[c])?i:null==(a=e.chosenRun)?void 0:a.options[c])?n:null:eI(this.funcCall.inputParams[u].property),e.chosenRun?"restricted":"user input")})});this.subs.push(r)}getInputForVal(t){var e,n;let i=t.property;if(this.inputsOverride[t.property.name])return this.inputsOverride[t.property.name];if(i.propertyType===r.TYPE.STRING&&i.options.choices&&!i.options.propagateChoice)return tw.input.choice(null!=(e=i.caption)?e:i.name,{value:eI(i),items:JSON.parse(i.options.choices),nullable:i.nullable});switch(i.propertyType){case"file":return ti.fileInput(null!=(n=i.caption)?n:i.name,null,null,null);case r.TYPE.FLOAT:let s=tw.input.forProperty(i),o=i.options.format;return o&&(s.format=o),s;default:return tw.input.forProperty(i)}}bindOnHotkey(t){e4(t)&&(t.input.onkeydown=t=>nL(function*(){"Enter"==t.key&&this.runRequests.next()}).call(this))}get foldedCategories(){var t;return JSON.parse(null!=(t=this.func.options.foldedCategories)?t:"[]")}getCategoryWarningIcon(t){let e=tw.iconFA("exclamation-circle",null,"This category has inconsistent inputs");tE()(e).css({color:"var(--orange-2)","padding-left":"5px"}).hide();let n=this.funcCallReplaced.subscribe(()=>{this.foldedCategoryInputs[t].some(t=>"inconsistent"===this.getInputLockState(t.paramName)&&t.input.value!==this.getRestrictedValue(t.paramName))?tE()(e).show():tE()(e).hide()});return this.subs.push(n),e}renderCategory(t,e,n){if(e!==n)if(this.foldedCategories.includes(e)){let n=this.getCategoryWarningIcon(e),i=tw.iconFA("chevron-right",()=>{var t;tE()(r).show(),tE()(i).hide(),tE()(n).hide(),(null!=(t=this.foldedCategoryInputs[e])?t:[]).forEach(t=>tE()(t.input.root).css({display:""}))},"Open category");tE()(i).css("padding-right","5px");let r=tw.iconFA("chevron-down",()=>{var t;tE()(r).hide(),tE()(i).show(),this.foldedCategoryInputs[e].some(t=>"inconsistent"===this.getInputLockState(t.paramName))?tE()(n).show():tE()(n).hide(),(null!=(t=this.foldedCategoryInputs[e])?t:[]).forEach(t=>tE()(t.input.root).hide())},"Close category");tE()(r).css("padding-right","5px"),t.append(tw.h2([i,r,tw.h2(e,{style:{display:"inline"}}),n],{style:{width:"100%"}})),tE()(r).hide()}else t.append(tw.h2(e,{style:{width:"100%"}}))}renderInput(t,e,n){var i,r;let s=e.property;if(this.foldedCategories.includes(s.category)&&(this.foldedCategoryInputs[s.category]=[...null!=(i=this.foldedCategoryInputs[s.category])?i:[],{paramName:e.property.name,input:n}]),this.injectLockIcons(e,n),t1(n)||(n.setDisabled=function(){n.enabled=!1,tE()(n.root).removeClass("rfv-restricted-unlocked-input"),tE()(n.root).removeClass("rfv-inconsistent-input"),tE()(n.root).removeClass("rfv-restricted-input")},n.setRestricted=function(){n.enabled=!1,tE()(n.root).addClass("rfv-restricted-input"),tE()(n.root).removeClass("rfv-restricted-unlocked-input"),tE()(n.root).removeClass("rfv-inconsistent-input")},n.setRestrictedUnlocked=function(){n.enabled=!0,tE()(n.root).addClass("rfv-restricted-unlocked-input"),tE()(n.root).removeClass("rfv-restricted-input"),tE()(n.root).removeClass("rfv-inconsistent-input")},n.setInconsistent=function(){n.enabled=!0,tE()(n.root).addClass("rfv-inconsistent-input"),tE()(n.root).removeClass("rfv-restricted-input"),tE()(n.root).removeClass("rfv-restricted-unlocked-input")},n.setUserInput=function(){n.enabled=!0,tE()(n.root).removeClass("rfv-inconsistent-input"),tE()(n.root).removeClass("rfv-restricted-input"),tE()(n.root).removeClass("rfv-restricted-unlocked-input")}),e4(n)){let t,i;t=e.property,tE()(n.root).css({width:`calc(${null!=(r=t.options.block)?r:"100"}% - ${t.options.block?"2":"0"}px)`,"box-sizing":"border-box"}),this.bindTooltips(e,n),i=tw.element("i"),n.addOptions(i),n.setValidation=function(t){for(;i.firstChild&&i.removeChild(i.firstChild););let e=e6(tL(t),2),r=e[0],s=e[1];r&&s&&(i.appendChild(r),i.appendChild(s)),n.input.classList.remove("d4-invalid"),n.input.classList.remove("d4-partially-invalid"),(null==t?void 0:t.errors)&&t.errors.length||(null==t?void 0:t.warnings)&&t.warnings.length||(null==t?void 0:t.notifications)&&t.notifications.length||(null==t?void 0:t.pending)?tE()(i).css("display","flex"):tE()(i).hide(),(null==t?void 0:t.errors)&&t.errors.length?n.input.classList.add("d4-invalid"):(null==t?void 0:t.warnings)&&t.warnings.length&&n.input.classList.add("d4-partially-invalid")}}t.append(n.root)}bindTooltips(t,e){let n=t.property.name,i=()=>{var e,i;let r=`${null!=(e=null!=(i=t.property.description)?i:t.property.caption)?e:t.property.name}.`,s="disabled"===this.getInputLockState(n)?"Input is disabled to prevent inconsistency.":"inconsistent"===this.getInputLockState(n)?"The entered value is inconsistent to the computed value.":"restricted"===this.getInputLockState(n)?"The value is dependent and computed automatically. Click to edit":null;return r||s?tw.divV([...r?[tw.divText(r)]:[],...s?[tw.divText(s)]:[]],{style:{maxWidth:"300px"}}):null};tw.tooltip.bind(e.captionLabel,i),tw.tooltip.bind(e.input,i)}injectLockIcons(t,e){let n=t.property.name;e.root.addEventListener("click",()=>{"restricted"===this.getInputLockState(n)&&this.setInputLockState(e,t.name,t.value,"restricted unlocked")});let i=tw.iconFA("lock");tE()(i).addClass("rfv-icon-lock"),tE()(i).css({color:"var(--grey-2)"});let s=tw.iconFA("lock-open");tE()(s).addClass("rfv-icon-unlock"),tE()(s).css({color:"var(--grey-2)"});let o=tw.iconFA("undo",e=>{this.setInput(t.name,this.getRestrictedValue(n),"restricted"),e.stopPropagation()},"Reset value to computed value");tE()(o).addClass("rfv-icon-undo"),tE()(o).css({color:"var(--blue-2)"});let a=tw.iconFA("exclamation-circle",null,"Validation");tw.tooltip.bind(a,()=>`Current value is incosistent. Computed value was ${r.TYPES_SCALAR.has(t.property.propertyType)?this.getRestrictedValue(n):"different"}`),tE()(a).addClass("rfv-icon-warning"),tE()(a).css({color:"var(--orange-2)"}),e.placeLockStateIcons||(e.placeLockStateIcons=function(t,n,i,r){e4(e)&&(e.addOptions(t),e.addOptions(n),e.addOptions(i),e.addOptions(r))}),e.placeLockStateIcons(i,s,o,a)}syncInput(t,e,n){var i;let s=t.name,o=!1,a=this.funcCallReplaced.pipe((0,D.startWith)(!0)).subscribe(()=>{var t,i;let r=this.funcCall[e9[n]][s],o=null!=(t=null!=(i=this.funcCall[n][s])?i:eI(r.property))?t:null;e.notify=!1,e.value=o,e.notify=!0,this.funcCall[n][s]=o,this.setInputLockState(e,s,o,this.getInputLockState(s))});this.subs.push(a);let l=this.funcCallReplaced.pipe((0,D.startWith)(!0),(0,D.switchMap)(()=>{let t=this.funcCall[e9[n]][s];return t.onChanged.pipe((0,D.mapTo)(t))})).subscribe(t=>{let i=this.funcCall[n][t.name];if(o||(e.notify=!1,e.value=i,e.notify=!0),n===tn.INPUTS){this.isHistorical.next(!1),this.hideOutput(),this.inputValidationRequests.next({field:t.name,isRevalidation:!1});let n=this.getInputLockState(t.name);("restricted unlocked"===n||"inconsistent"===n)&&this.setInputLockState(e,t.name,i,i===this.getRestrictedValue(t.name)?"restricted unlocked":"inconsistent")}});this.subs.push(l);let u=this.funcCallReplaced.pipe((0,D.startWith)(!0),(0,D.switchMap)(()=>{let t=this.funcCall[e9[n]][s];return t.onChanged.pipe((0,D.mapTo)(t),(0,D.startWith)(t))}),(0,D.filter)(t=>t.property.propertyType===r.TYPE.DATA_FRAME&&t.value),(0,D.switchMap)(t=>t.value.onDataChanged.pipe((0,D.mapTo)(t)))).subscribe(t=>{n===tn.INPUTS?this.inputValidationRequests.next({field:t.name,isRevalidation:!1}):this.outputValidationRequests.next({field:t.name,isRevalidation:!1})});this.subs.push(u);let c=(e4(e)?e.onInput:(i=e.onInput.bind(e),new tO.Observable(t=>{let e=i(e=>{t.next(e)});return()=>e.unsubscribe()}))).pipe((0,D.debounceTime)(250)).subscribe(()=>{try{o=!0,this.funcCall[n][t.name]=e.value}finally{o=!1}});this.subs.push(c)}isRunnable(){return!this.isRunning.value&&!this.blockRuns.value&&this.isValid()}isValid(){var t=!0,e=!1,n=void 0;try{for(var i,r=Object.entries(this.inputValidationState)[Symbol.iterator]();!(t=(i=r.next()).done);t=!0){let t=nM(i.value,2),e=(t[0],t[1]);if(!tP(e))return!1}}catch(t){e=!0,n=t}finally{try{t||null==r.return||r.return()}finally{if(e)throw n}}var s=!0,o=!1,a=void 0;try{for(var l,u=Object.entries(this.externalValidatorsState)[Symbol.iterator]();!(s=(l=u.next()).done);s=!0){let t=nM(l.value,2),e=(t[0],t[1]);if(!tP(e))return!1}}catch(t){o=!0,a=t}finally{try{s||null==u.return||u.return()}finally{if(o)throw a}}return!0}getValidationState(){return this.inputValidationState}getValidationMessage(){let t=[];var e=!0,n=!1,i=void 0;try{for(var r,s=Object.entries(this.inputValidationState)[Symbol.iterator]();!(e=(r=s.next()).done);e=!0){let e=nM(r.value,2),n=e[0],i=e[1];tP(i)||t.push(`${n}: ${function(t){if(null==t?void 0:t.errors)return t.errors.map(t=>t.description).join("; ")}(i)}`)}}catch(t){n=!0,i=t}finally{try{e||null==s.return||s.return()}finally{if(n)throw i}}return t.join("\n")}runValidation(t,e){return nL(function*(t,e,n){let i,r,s=void 0===n?tn.INPUTS:n,o=t.field,a=this.getValidatedNames(o,s);return i={view:this,funcCall:this.funcCall,lastCall:this.lastCall},r=s===tn.INPUTS?this.inputValidators:this.outputValidators,e5(function*(){let n=i.view,o=i.funcCall,l=i.lastCall;return Object.fromEntries((yield Promise.all(a.map(i=>e5(function*(){var a;let u,c=s===tn.INPUTS?o.inputs[i]:o.outputs[i],d=yield(t.isNewOutput,t.isRevalidation,(a=function*(){if(null==c){var t,e,n,i;let r;return t={errors:["Missing value"]},r=t=>"string"==typeof t?{description:t,actions:void 0}:t,{errors:null==t||null==(e=t.errors)?void 0:e.map(t=>r(t)),warnings:null==t||null==(n=t.warnings)?void 0:n.map(t=>r(t)),notifications:null==t||null==(i=t.notifications)?void 0:i.map(t=>r(t))}}},function(){var t=this,e=arguments;return new Promise(function(n,i){var r=a.apply(t,e);function s(t){tS(r,n,i,s,o,"next",t)}function o(t){tS(r,n,i,s,o,"throw",t)}s(void 0)})})()),p=r[i];p&&(u=yield p(c,{param:i,funcCall:o,lastCall:l,signal:e,isNewOutput:!!t.isNewOutput,isRevalidation:t.isRevalidation,context:t.context,view:n}));let h=s===tn.INPUTS&&o.inputParams[i].property.options.nullable;return[i,tk(...h?[]:[d],u)]})()))))})()}).apply(this,arguments)}setInputValidationPending(t){let e=this.getValidatedNames(t);var n=!0,i=!1,r=void 0;try{for(var s,o=e[Symbol.iterator]();!(n=(s=o.next()).done);n=!0){let t=s.value;this.inputValidationState[t]=tD();let e=this.inputsMap[t];t9(e)&&e.setValidation(tD())}}catch(t){i=!0,r=t}finally{try{n||null==o.return||o.return()}finally{if(i)throw r}}this.inputValidationUpdates.next(null)}setOutputValidationPending(t){let e=this.getValidatedNames(t,tn.OUTPUTS);var n=!0,i=!1,r=void 0;try{for(var s,o=e[Symbol.iterator]();!(n=(s=o.next()).done);n=!0){let t=s.value;this.outputValidationState[t]=tD();let e=this.outputValidationSigns[t];if(e){let n=tL(tD());e[0].replaceWith(n[0]),e[1].replaceWith(n[1]),this.outputValidationSigns[t]=n}}}catch(t){i=!0,r=t}finally{try{n||null==o.return||o.return()}finally{if(i)throw r}}this.outputValidationUpdates.next(null)}setInputValidationResults(t){var e=!0,n=!1,i=void 0;try{for(var r,s=Object.entries(t)[Symbol.iterator]();!(e=(r=s.next()).done);e=!0){let t=nM(r.value,2),e=t[0],n=t[1];this.inputValidationState[e]=n,this.updateInputValidationResults(e)}}catch(t){n=!0,i=t}finally{try{e||null==s.return||s.return()}finally{if(n)throw i}}}setOutputValidationResults(t){var e=!0,n=!1,i=void 0;try{for(var r,s=Object.entries(t)[Symbol.iterator]();!(e=(r=s.next()).done);e=!0){let t=nM(r.value,2),e=t[0],n=t[1];this.outputValidationState[e]=n,this.updateOutputValidationResults(e)}}catch(t){n=!0,i=t}finally{try{e||null==s.return||s.return()}finally{if(n)throw i}}}updateOutputValidationResults(t){let e,n=this.outputValidationState[t],i=this.outputValidationSigns[t];i&&(this.outputValidationSigns[t]=(e=tL(n),i[0].replaceWith(e[0]),i[1].replaceWith(e[1]),e))}updateInputValidationResults(t){let e=tk(this.inputValidationState[t],this.externalValidatorsState[t]),n=this.inputsMap[t];t9(n)&&n.setValidation(e)}runRevalidations(t,e,n){let i=void 0===n?tn.INPUTS:n;if(!t.isRevalidation){var r=!0,s=!1,o=void 0;try{for(var a,l=Object.entries(e)[Symbol.iterator]();!(r=(a=l.next()).done);r=!0){let t=nM(a.value,2)[1];if(null==t?void 0:t.revalidate){var u=!0,c=!1,d=void 0;try{for(var p,h=t.revalidate[Symbol.iterator]();!(u=(p=h.next()).done);u=!0){let e=p.value;i===tn.INPUTS?this.inputValidationRequests.next({field:e,context:t.context,isRevalidation:!0}):this.outputValidationRequests.next({field:e,context:t.context,isRevalidation:!0})}}catch(t){c=!0,d=t}finally{try{u||null==h.return||h.return()}finally{if(c)throw d}}}}}catch(t){s=!0,o=t}finally{try{r||null==l.return||l.return()}finally{if(s)throw o}}}}getValidatedNames(t,e){let n=void 0===e?tn.INPUTS:e;return t?[t]:[...n===tn.INPUTS?this.funcCall.inputs.keys():this.funcCall.outputs.keys()]}getValidExpRun(t){return nL(function*(){t.started=tr()();let e=t.options.immutable_tags||[];return t.options.immutable_tags=e.includes(tj)?e:[...e,tj],t.newId(),t})()}saveExperimentalRun(t){return nL(function*(){let e=yield this.getValidExpRun(t);yield this.saveRun(e)}).call(this)}hideOutput(){if(this._isOutputOutdated.next(!0),this.keepOutput())return;this.outputTabsLabels.forEach(t=>{var e;return tE()(null==(e=this.tabsElem.getPane(t))?void 0:e.header).hide()});let t=this.tabsElem.panes.find(t=>this.inputTabsLabels.includes(t.name));t?this.tabsElem.currentPane=t:tE()(this.tabsElem.root).hide()}richFunctionViewSupportedFormats(){return["Excel"]}richFunctionViewExportExtensions(){return{Excel:"xlsx"}}constructor(t,e){var n;let i=void 0===e?{historyEnabled:!0,isTabbed:!1}:e;super(t,i),n=this,this.options=i,this.inputValidationRequests=new tO.Subject,this.outputValidationRequests=new tO.Subject,this.inputValidationUpdates=new tO.Subject,this.outputValidationUpdates=new tO.Subject,this.runRequests=new tO.Subject,this.isRunning=new tO.BehaviorSubject(!1),this.isUploadMode=new tO.BehaviorSubject(!1),this.inputsOverride={},this.inputsMap={},this.outputValidationSigns={},this.inputValidators={},this.outputValidators={},this.inputValidationState={},this.outputValidationState={},this.externalValidatorsUpdates=new tO.Subject,this.externalValidatorsState={},this.pendingInputValidations=this.inputValidationUpdates.pipe((0,D.startWith)(null),(0,D.map)(()=>this.inputValidationState)),this._isOutputOutdated=new tO.BehaviorSubject(!0),this.isOutputOutdated=this._isOutputOutdated.pipe((0,D.distinctUntilChanged)()),this.blockRuns=new tO.BehaviorSubject(!1),this.prevOpenedTab=null,this.beforeInputPropertyRender=new tO.Subject,this.afterInputPropertyRender=new tO.Subject,this.afterOutputPropertyRender=new tO.Subject,this.afterOutputSacalarTableRender=new tO.Subject,this.formButtons=tw.div(),this.additionalBtns=[],this.navBtns=[],this.tabsElem=tw.tabControl(),this.dfToViewerMapping={},this.focusedInput=null,this.foldedCategoryInputs={},this.richFunctionExport=t=>nL(function*(){let e,i,s,o,a;if(!n.lastCall)throw Error("Function was not called");if(!n.exportConfig.supportedFormats.includes(t))throw Error(`Format "${t}" is not supported.`);if(!n.func)throw Error("The correspoding function is not specified");return nM((yield(e=n.func,i=n.lastCall,s=n.dfToViewerMapping,nA(function*(){let n={},l=(t,e)=>{if(n[t])return n[t];let i=`${t}`;i.length>31&&(i=`${i.slice(0,31)}`);let r=1;for(;e.worksheets.some(t=>t.name.toLowerCase()===i.toLowerCase());){let e=`${t}`;e.length>31-`-${r}`.length&&(e=`${t.slice(0,31-`-${r}`.length)}`),i=`${e}-${r}`,r++}return n[t]=i,i};if("Excel"===t)try{yield r.Utils.loadJsCss(["/js/common/exceljs.min.js","/js/common/html2canvas.min.js"]);let t=window.ExcelJS,n=window.html2canvas,k=new t.Workbook;tw.setDisplay(tx.shell.v.root,!1),nI(tx.shell.v.root.parentElement,!0,"Generating report. Please do not switch the browser tab...");let D=0,L=(t,e,i,s)=>{let o=void 0===s?0:s;return nA(function*(){if(!e||!e.dataFrame)return;let s=r.Viewer.fromType(e.type,e.dataFrame.clone());s.copyViewersLook(e);let a=tw.div(s.root,{style:{width:"1280px",height:"720px"}});a.classList.add("ui-box"),a.classList.remove("ui-div"),tx.shell.v.root.insertAdjacentElement("afterend",a),yield new Promise(t=>setTimeout(t,1e3));let l=(yield n(a)).toDataURL();a.remove(),s.detach();let u=k.addImage({base64:l,extension:"png"});t.addImage(u,{tl:{col:i,row:o},ext:{width:1280,height:720}})})()},V=t=>t.propertyType===r.TYPE.DATA_FRAME,F=e.inputs.filter(t=>V(t)),M=e.inputs.filter(t=>{let e;return e=t.propertyType,r.TYPES_SCALAR.has(e)}),N=e.outputs.filter(t=>V(t)),B=e.outputs.filter(t=>{let e;return e=t.propertyType,r.TYPES_SCALAR.has(e)});if(F.forEach(t=>{var e;let n=i.inputs[t.name];if(nP(n))return;let r=t.options.caption||t.name,s=null!=(e=k.worksheets.find(t=>t.name===l(r,k)))?e:k.addWorksheet(l(r,k)),u=null==o?void 0:o[t.name],c=null==a?void 0:a[t.name];nS({sheet:s,dfCounter:D,df:n,validation:u,consistency:c}),D++}),M.length){let t=k.addWorksheet("Input scalars");nT(t,M.map(t=>{var e,n,r;return{name:t.name,caption:null!=(e=t.options.caption)?e:t.name,value:null!=(n=i.inputs[t.name])?n:"",units:null!=(r=t.options.units)?r:"",format:t.format||tF}}),o,a)}if(N.forEach(t=>{var e;let n=i.outputs[t.name];if(nP(n))return;let r=t.options.caption||t.name,s=null!=(e=k.worksheets.find(t=>t.name===l(r,k)))?e:k.addWorksheet(l(r,k)),u=null==o?void 0:o[t.name],c=null==a?void 0:a[t.name];nS({sheet:s,dfCounter:D,df:n,validation:u,consistency:c}),D++}),B.length){let t=k.addWorksheet("Output scalars");nT(t,B.map(t=>{var e,n,r;return{name:t.name,caption:null!=(e=t.options.caption)?e:t.name,value:null!=(n=i.outputs[t.name])?n:"",units:null!=(r=t.options.units)?r:"",format:t.format||tF}}),o,a)}var u=!0,c=!1,d=void 0;try{for(var p,h=e.inputs.filter(t=>V(t))[Symbol.iterator]();!(u=(p=h.next()).done);u=!0){let t=p.value,e=i.inputs[t.name];if(nP(e))continue;let n=(null!=(g=s[t.name])?g:[]).filter(t=>t&&t.type!==r.VIEWER.GRID).filter(t=>Object.values(tM).includes(t.type));if(0===n.length)continue;let o=t.options.caption||t.name;var f=!0,m=!1,y=void 0;try{for(var g,v,b=n.entries()[Symbol.iterator]();!(f=(v=b.next()).done);f=!0){let t=nx(v.value,2),n=t[0],i=t[1];yield L(k.getWorksheet(l(o,k)),i,e.columns.length+2,n*nw)}}catch(t){m=!0,y=t}finally{try{f||null==b.return||b.return()}finally{if(m)throw y}}}}catch(t){c=!0,d=t}finally{try{u||null==h.return||h.return()}finally{if(c)throw d}}var C=!0,A=!1,x=void 0;try{for(var w,I=e.outputs.filter(t=>V(t))[Symbol.iterator]();!(C=(w=I.next()).done);C=!0){let t=w.value,e=i.outputs[t.name];if(nP(e))continue;let n=(null!=(O=s[t.name])?O:[]).filter(t=>t&&t.type!==r.VIEWER.GRID).filter(t=>Object.values(tM).includes(t.type));if(0===n.length)continue;let o=t.options.caption||t.name;var R=!0,T=!1,E=void 0;try{for(var O,S,P=n.entries()[Symbol.iterator]();!(R=(S=P.next()).done);R=!0){let t=nx(S.value,2),n=t[0],i=t[1];if(i)if(i.type===r.VIEWER.STATISTICS){let t=e.columns.length,i=r.DataFrame.fromColumns([r.Column.string("Name",t).init(t=>e.columns.byIndex(t).name),r.Column.int("Values",t).init(t=>e.columns.byIndex(t).stats.valueCount),r.Column.int("Nulls",t).init(t=>e.columns.byIndex(t).stats.missingValueCount),r.Column.float("Min",t).init(t=>e.columns.byIndex(t).stats.min),r.Column.float("Max",t).init(t=>e.columns.byIndex(t).stats.max),r.Column.float("Avg",t).init(t=>e.columns.byIndex(t).stats.avg),r.Column.float("Stdev",t).init(t=>e.columns.byIndex(t).stats.stdev)]);nS({sheet:k.getWorksheet(l(o,k)),dfCounter:D,df:i,column:e.columns.length+2,row:n*nw}),D++}else yield L(k.getWorksheet(l(o,k)),i,e.columns.length+2,n*nw)}}catch(t){T=!0,E=t}finally{try{R||null==P.return||P.return()}finally{if(T)throw E}}}}catch(t){A=!0,x=t}finally{try{C||null==I.return||I.return()}finally{if(A)throw x}}let j=yield k.xlsx.writeBuffer();return[new Blob([j],{type:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=UTF-8"}),k]}catch(t){console.log(t)}finally{tw.setDisplay(tx.shell.v.root,!0),nI(tx.shell.v.root.parentElement,!1)}throw Error("Format is not supported")})())),1)[0]})(),this.exportConfig={supportedExtensions:this.richFunctionViewExportExtensions(),supportedFormats:this.richFunctionViewSupportedFormats(),export:this.richFunctionExport,filename:this.defaultExportFilename}}}function nj(t,e,n,i,r,s,o){try{var a=t[s](o),l=a.value}catch(t){n(t);return}a.done?e(l):Promise.resolve(l).then(i,r)}function n_(t){return function(){var e=this,n=arguments;return new Promise(function(i,r){var s=t.apply(e,n);function o(t){nj(s,i,r,o,a,"next",t)}function a(t){nj(s,i,r,o,a,"throw",t)}o(void 0)})}}function nU(t,e,n,i,r,s,o){try{var a=t[s](o),l=a.value}catch(t){n(t);return}a.done?e(l):Promise.resolve(l).then(i,r)}function n$(t){return function(){var e=this,n=arguments;return new Promise(function(i,r){var s=t.apply(e,n);function o(t){nU(s,i,r,o,a,"next",t)}function a(t){nU(s,i,r,o,a,"throw",t)}o(void 0)})}}C("Compute: RichFunctionView Inputs",()=>n_(function*(){A(()=>n_(function*(){})()),v("Simple inputs setParamValue",()=>n_(function*(){let t=new nB("Compute:simpleInputs",{historyEnabled:!1,isTabbed:!1}),e={};t.afterInputPropertyRender.subscribe(({prop:t,input:n})=>{e[t.name]=n}),yield t.isReady.pipe((0,D.filter)(t=>t),(0,D.take)(1)).toPromise(),t.funcCall.setParamValue("a",1),t.funcCall.setParamValue("b",2.2),t.funcCall.setParamValue("c","test"),yield t.doRun();let n={inputs:[["a",1],["b",2.2],["c","test"]],outputs:[["aout",1],["bout",2.2],["cout","test"]]};for(let[i,r]of(tp(tu(t.funcCall),n,{prefix:"funcCall"}),tp(tu(t.lastCall),n,{prefix:"lastCall"}),Object.entries({a:1,b:2.2,c:"test"})))tp(e[i].value,r,{prefix:`input ${i}`})})()),v("Simple inputs inputs tweak",()=>n_(function*(){let t=new nB("Compute:simpleInputs",{historyEnabled:!1,isTabbed:!1}),e={a:1,b:2.2,c:"test"},n={};for(let[i,r]of(t.afterInputPropertyRender.subscribe(({prop:t,input:e})=>{n[t.name]=e}),yield t.isReady.pipe((0,D.filter)(t=>t),(0,D.take)(1)).toPromise(),yield E(100),Object.entries(n)))r.value=e[i],r.input.dispatchEvent(new Event("input",{bubbles:!0}));yield E(300),yield t.doRun();let i={inputs:[["a",1],["b",2.2],["c","test"]],outputs:[["aout",1],["bout",2.2],["cout","test"]]};tp(tu(t.funcCall),i,{prefix:"funcCall"}),tp(tu(t.lastCall),i,{prefix:"lastCall"})})()),v("Simple inputs setParamValue rerun",()=>n_(function*(){let t=new nB("Compute:simpleInputsDefaultValues",{historyEnabled:!1,isTabbed:!1}),e={};t.afterInputPropertyRender.subscribe(({prop:t,input:n})=>{e[t.name]=n}),yield t.isReady.pipe((0,D.filter)(t=>t),(0,D.take)(1)).toPromise(),yield E(100),yield t.doRun(),t.funcCall.setParamValue("a",2),t.funcCall.setParamValue("b",3.2),t.funcCall.setParamValue("c","test2"),yield t.doRun();let n={inputs:[["a",2],["b",3.2],["c","test2"]],outputs:[["aout",2],["bout",3.2],["cout","test2"]]};for(let[i,r]of(tp(tu(t.funcCall),n,{prefix:"funcCall"}),tp(tu(t.lastCall),n,{prefix:"lastCall"}),Object.entries({a:2,b:3.2,c:"test2"})))tp(e[i].value,r,{prefix:`input ${i}`})})()),v("Simple inputs inputs tweak rerun",()=>n_(function*(){let t=new nB("Compute:simpleInputsDefaultValues",{historyEnabled:!1,isTabbed:!1}),e={a:2,b:3.2,c:"test2"},n={};for(let[i,r]of(t.afterInputPropertyRender.subscribe(({prop:t,input:e})=>{n[t.name]=e}),yield t.isReady.pipe((0,D.filter)(t=>t),(0,D.take)(1)).toPromise(),yield E(100),yield t.doRun(),yield E(100),Object.entries(n)))r.value=e[i],r.input.dispatchEvent(new Event("input",{bubbles:!0}));yield E(300),yield t.doRun();let i={inputs:[["a",2],["b",3.2],["c","test2"]],outputs:[["aout",2],["bout",3.2],["cout","test2"]]};tp(tu(t.funcCall),i,{prefix:"funcCall"}),tp(tu(t.lastCall),i,{prefix:"lastCall"})})()),v("Simple inputs default values",()=>n_(function*(){let t=new nB("Compute:simpleInputsDefaultValues",{historyEnabled:!1,isTabbed:!1});yield t.isReady.pipe((0,D.filter)(t=>t),(0,D.take)(1)).toPromise(),yield E(100),tp(tu(t.funcCall).inputs,[["a",1],["b",2.2],["c","test"]])})()),v("Complex inputs setParamValue",()=>n_(function*(){let t=new nB("Compute:complexInputs",{historyEnabled:!1,isTabbed:!1}),e={df:r.DataFrame.fromColumns([r.Column.fromList("double","col",[1.1,2.2,3.3])]),data:JSON.stringify({a:1,b:"test"})},n={};t.afterInputPropertyRender.subscribe(({prop:t,input:e})=>{n[t.name]=e}),t.funcCall.setParamValue("df",e.df),t.funcCall.setParamValue("data",e.data),yield t.doRun(),tp(tu(t.funcCall),ta(tb),{prefix:"funcCall"}),tp(tu(t.lastCall),ta(tb),{prefix:"lastCall"}),tp(n.data.value,e.data,{prefix:"data"})})()),v("Complex inputs inputs tweak",()=>n_(function*(){let t=new nB("Compute:complexInputs",{historyEnabled:!1,isTabbed:!1}),e={df:r.DataFrame.fromColumns([r.Column.fromList("double","col",[1.1,2.2,3.3])]),data:JSON.stringify({a:1,b:"test"})},n={};t.afterInputPropertyRender.subscribe(({prop:t,input:e})=>{n[t.name]=e}),yield t.isReady.pipe((0,D.filter)(t=>t),(0,D.take)(1)).toPromise(),yield E(100),n.data.value=e.data,t.funcCall.setParamValue("df",e.df),yield E(300),yield t.doRun(),tp(tu(t.funcCall),ta(tb),{prefix:"funcCall"}),tp(tu(t.lastCall),ta(tb),{prefix:"lastCall"}),tp(n.data.value,e.data,{prefix:"data"})})()),v("Complex inputs setParamValue rerun",()=>n_(function*(){let t=new nB("Compute:complexInputs",{historyEnabled:!1,isTabbed:!1}),e={df:r.DataFrame.fromColumns([r.Column.fromList("double","col",[11.1,12.2,13.3])]),data:JSON.stringify({a:2,b:"pretest"})},n={};t.afterInputPropertyRender.subscribe(({prop:t,input:e})=>{n[t.name]=e}),yield t.isReady.pipe((0,D.filter)(t=>t),(0,D.take)(1)).toPromise(),t.funcCall.setParamValue("df",e.df),t.funcCall.setParamValue("data",e.data),yield t.doRun();let i={df:r.DataFrame.fromColumns([r.Column.fromList("double","col",[1.1,2.2,3.3])]),data:JSON.stringify({a:1,b:"test"})};t.funcCall.setParamValue("df",i.df),t.funcCall.setParamValue("data",i.data),yield t.doRun(),tp(tu(t.funcCall),ta(tb),{prefix:"funcCall"}),tp(tu(t.lastCall),ta(tb),{prefix:"lastCall"}),tp(n.data.value,i.data,{prefix:"data"})})()),v("Complex inputs inputs tweak rerun",()=>n_(function*(){let t=new nB("Compute:complexInputs",{historyEnabled:!1,isTabbed:!1}),e={df:r.DataFrame.fromColumns([r.Column.fromList("double","col",[11.1,12.2,13.3])]),data:JSON.stringify({a:2,b:"pretest"})},n={};t.afterInputPropertyRender.subscribe(({prop:t,input:e})=>{n[t.name]=e}),yield t.isReady.pipe((0,D.filter)(t=>t),(0,D.take)(1)).toPromise(),yield E(100),n.data.value=e.data,t.funcCall.setParamValue("df",e.df),yield E(300),yield t.doRun();let i={df:r.DataFrame.fromColumns([r.Column.fromList("double","col",[1.1,2.2,3.3])]),data:JSON.stringify({a:1,b:"test"})};n.data.value=i.data,t.funcCall.setParamValue("df",i.df),yield E(300),yield t.doRun(),tp(tu(t.funcCall),ta(tb),{prefix:"funcCall"}),tp(tu(t.lastCall),ta(tb),{prefix:"lastCall"}),tp(n.data.value,i.data,{prefix:"data"})})())})()),C("Compute: RichFunctionView Validation",()=>n_(function*(){A(()=>n_(function*(){})()),v("Validate on start",()=>n_(function*(){let t=new nB("Compute:validationTest",{historyEnabled:!1,isTabbed:!1});yield t.isReady.pipe((0,D.filter)(t=>t),(0,D.take)(1)).toPromise(),yield E(1500),tp(t.getValidationState(),{a:{errors:[{description:"Missing value"},{description:"Out of range [1, 10] value: null"}],warnings:[],notifications:[],revalidate:[],context:{}},b:{errors:[{description:"Missing value"},{description:"Out of range [20, 100] value: null"}],warnings:[],notifications:[],revalidate:[],context:{}},x:{errors:[],warnings:[{description:"Try non-null value"}],notifications:[],revalidate:[],context:{}}})})()),v("Validate on input",()=>n_(function*(){let t=new nB("Compute:validationTest",{historyEnabled:!1,isTabbed:!1}),e={a:2.3,b:3.2,x:-1},n={};for(let[i,r]of(t.afterInputPropertyRender.subscribe(({prop:t,input:e})=>{n[t.name]=e}),yield t.isReady.pipe((0,D.filter)(t=>t),(0,D.take)(1)).toPromise(),yield E(1500),Object.entries(n)))r.value=e[i],r.input.dispatchEvent(new Event("input",{bubbles:!0}));yield E(400),tp(t.getValidationState(),{b:{errors:[{description:"Out of range [20, 100] value: 3.2"}]}})})()),v("Revalidation sequence",()=>n_(function*(){let t=new nB("Compute:globalValidationTest",{historyEnabled:!1,isTabbed:!1}),e={a:30,b:40,c:50},n={};for(let[i,r]of(t.afterInputPropertyRender.subscribe(({prop:t,input:e})=>{n[t.name]=e}),yield t.isReady.pipe((0,D.filter)(t=>t),(0,D.take)(1)).toPromise(),yield E(1500),Object.entries(n)))r.value=e[i],r.input.dispatchEvent(new Event("input",{bubbles:!0}));yield E(1e3),tp(t.getValidationState(),{a:{revalidate:["b","c"],context:{isOk:!1},warnings:[{description:"Try lowering a value"}]},b:{warnings:[{description:"Try lowering a value as well"}]},c:{warnings:[{description:"Try lowering a value as well"}]}})})())})());let nW=new r.Package;function nH(t,e,n){return n$(function*(){let i=yield I({category:t,test:e,testContext:n});return r.DataFrame.fromObjects(i)})()}function nY(){return n$(function*(){yield w(nW,nW.getModule("package-test.js"))})()}})(),compute_test=i})();
|
|
176
|
+
,,,,,,,,,,,,,,,,,,,,,`),s=Uint8Array.from(atob("iVBORw0KGgoAAAANSUhEUgAAABgAAAAQCAIAAACDRijCAAAAQElEQVR4nGO8Y2PDQA3ARBVTGKhoEAucpXz4MBn679ra0sxFaDYQBMqoPhh8gc00fA1iQeOTl5oYqOgixuGbaQF0Bgp24E7RmwAAAABJRU5ErkJggg=="),t=>t.charCodeAt(0));function a(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=Array(e);n<e;n++)i[n]=t[n];return i}function l(t,e,n,i,r,o,s){try{var a=t[o](s),l=a.value}catch(t){n(t);return}a.done?e(l):Promise.resolve(l).then(i,r)}function u(t){return function(){var e=this,n=arguments;return new Promise(function(i,r){var o=t.apply(e,n);function s(t){l(o,i,r,s,a,"next",t)}function a(t){l(o,i,r,s,a,"throw",t)}s(void 0)})}}function c(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{},i=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(i=i.concat(Object.getOwnPropertySymbols(n).filter(function(t){return Object.getOwnPropertyDescriptor(n,t).enumerable}))),i.forEach(function(e){var i;i=n[e],e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i})}return t}function d(t,e){return e=null!=e?e:{},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):(function(t){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e.push.apply(e,n)}return e})(Object(e)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(e,n))}),t}o.columns.add(DG.Column.fromList(DG.TYPE.BYTE_ARRAY,"BinaryImage",Array.from({length:11},()=>s)));let p=console.log.bind(console),h=console.info.bind(console),f=console.warn.bind(console),m=console.error.bind(console),y={},v="Auto Tests",g="Demo",b="Detectors",A="Core",C={};(to||(to={})).notNull=function(t,e){if(null==t)throw Error(`${null==e?"Value":e} not defined`)};class x{constructor(t,e,n){this.catchUnhandled=!0,this.report=!1,this.returnOnFail=!1,this.closeAll=!0,void 0!==t&&(this.catchUnhandled=t),void 0!==e&&(this.report=e),void 0!==n&&(this.returnOnFail=n)}}class w{constructor(t,e,n,i){this.category=t,this.name=e,null!=i||(i={}),null!=i.timeout||(i.timeout=3e4),this.options=i,this.test=()=>u(function*(){return new Promise((t,e)=>u(function*(){let i="";try{DG.Test.isInDebug;let t=yield n();try{var r;i=null!=(r=null==t?void 0:t.toString())?r:""}catch(t){i="Can't convert test's result to string",console.error(`Can't convert test's result to string in the ${this.category}:${this.name} test`)}}catch(t){e(t)}t(i)}).call(this))}).call(this)}}function I(e,n,i){void 0==y[t]&&(y[t]={}),void 0==y[t].tests&&(y[t].tests=[]),y[t].tests.push(new w(t,e,n,i))}function R(t,e,n){let i=void 0===e||e;if(n=n?`${n}, `:"",t!==i)throw Error(`${n}Expected "${i}", got "${t}"`)}function E(e,n,i){if(t=e,n(),y[t]){var r;y[t].clear=null==(r=null==i?void 0:i.clear)||r,y[t].timeout=null==i?void 0:i.timeout,y[t].benchmarks=null==i?void 0:i.benchmarks,y[t].stressTests=null==i?void 0:i.stressTests,y[t].owner=null==i?void 0:i.owner,y[t].node=null==i?void 0:i.node}}function T(e){void 0==y[t]&&(y[t]={}),y[t].before=e}function O(t,e,n){var i,r,o;let s=null!=(i=null!=(r=null==(o=t.options)?void 0:o.node)?r:e.node)&&i;return n.nodeOnly?s:!n.excludeNodeTests||!s}function S(t,e){return u(function*(){let n=t.id;if(C[n])return;let i=e?e.tests:y;if("DevTools"===t.name||e&&"DevTools"===e._package.name){var r=!0,s=!1,a=void 0;try{for(var l,c,d,p,h,f,m,x,I=window.dartTests[Symbol.iterator]();!(r=(x=I.next()).done);r=!0){let t=x.value,e=t.name.split(/\s*\|\s*!/g),n=null!=(l=e.pop())?l:t.name,r=e.length?A+": "+e.join(": "):A,o=n.split(" | ");n=o[o.length-1],o.unshift(r),o.pop(),r=o.join(": "),void 0===i[r]&&(i[r]={tests:[],clear:!0}),i[r].tests.push(new w(r,n,t.test,{isAggregated:!1,timeout:null!=(c=null==(p=t.options)?void 0:p.timeout)?c:3e4,skipReason:null==(h=t.options)?void 0:h.skipReason,owner:null==(f=t.options)?void 0:f.owner,benchmark:null!=(d=null==(m=t.options)?void 0:m.benchmark)&&d}))}}catch(t){s=!0,a=t}finally{try{r||null==I.return||I.return()}finally{if(s)throw a}}}let E=[],T=[],O=null,S=[],P=yield grok.dapi.functions.filter(`package.id = "${n}"`).list(),k=new RegExp(/skip:\s*([^,\s]+)|wait:\s*(\d+)|cat:\s*([^,\s]+)|timeout:\s*(\d+)/g);var D=!0,F=!1,V=void 0;try{for(var M,N,j,B,_=P[Symbol.iterator]();!(D=(B=_.next()).done);D=!0){let e=B.value,n=e.options.test,r=e.options.demoPath;if(n&&Array.isArray(n)&&n.length)for(let t=0;t<n.length;t++){let r=n[t].matchAll(k),o={};Array.from(r).forEach(t=>{t[0].startsWith("skip")?o.skip=t[1]:t[0].startsWith("wait")?o.wait=parseInt(t[2]):t[0].startsWith("cat")?o.cat=t[3]:t[0].startsWith("timeout")&&(o.timeout=parseInt(t[4]))});let s=new w(null!=(M=o.cat)?M:v,1===n.length?e.name:`${e.name} ${t+1}`,()=>u(function*(){var i;let r=yield grok.functions.eval((i=n[t],i.replace(RegExp(e.name,"gi"),e.nqName)));if(o.wait&&(yield L(e.name)),"boolean"==typeof r&&!r)throw`Failed: ${n[t]}, expected true, got ${r}`})(),{skipReason:o.skip,timeout:DG.Test.isInBenchmark?null!=(N=o.benchmarkTimeout)?N:108e5:null!=(j=o.timeout)?j:3e4,node:e instanceof DG.DataQuery});if(o.cat){let t=o.cat;void 0===i[t]&&(i[t]={tests:[],clear:!0}),i[t].tests||(i[t].tests=[]),i[t].tests.push(s)}else E.push(s)}if(r){let t=new w(g,e.friendlyName,()=>u(function*(){yield L("the views the previous test closed");let t=O?yield grok.shell.lastError:null;if(grok.shell.clearLastError(),t)throw Error(`${O} raised an error after it finished: ${t}`);O=e.friendlyName,yield e.apply(),yield L(e.friendlyName);let n=yield grok.shell.lastError;if(grok.shell.clearLastError(),n)throw Error(n)})(),{skipReason:e.options.demoSkip});T.push(t)}if(e.hasTag("semTypeDetector")){let n=o;e.options.testData&&(n=yield grok.data.files.openTable(`System:AppData/${t.nqName}/${e.options.testData}`));let i=new w(b,e.friendlyName,()=>u(function*(){let i=[];console.log(`System:AppData/${t.nqName}/${e.options.testData}`);var r=!0,o=!1,s=void 0;try{for(var a,l=n.clone().columns[Symbol.iterator]();!(r=(a=l.next()).done);r=!0){let t=a.value,n=yield e.apply([t]);i.push(n||t.semType)}}catch(t){o=!0,s=t}finally{try{r||null==l.return||l.return()}finally{if(o)throw s}}let u=i.filter(t=>t);R(u.length,1),e.options.testDataColumnName&&R(u[0],e.options.testDataColumnName)})(),{skipReason:e.options.skipTest});S.push(i)}}}catch(t){F=!0,V=t}finally{try{D||null==_.return||_.return()}finally{if(F)throw V}}C[n]=!0,E.length>0&&(i[v]={tests:E,clear:!0}),T.length>0&&(i[g]={tests:T,clear:!0}),S.length>0&&(i[b]={tests:S,clear:!1})})()}class P{add(t,e){this.enabled&&(this.sent=this.sent.then(()=>grok.shell.reportTest(t,e)).catch(t=>{var e;return f(`A test result was not reported: ${null!=(e=null==t?void 0:t.message)?e:t}`)}))}constructor(t){this.enabled=void 0===t||t,this.sent=Promise.resolve()}}function k(t){return u(function*(){return`${t.toString()}
|
|
177
|
+
${t.stack?yield DG.Logger.translateStackTrace(t.stack):""}`})()}function D(t,e,n,i,r,o){return u(function*(t,e,n,i,r,o,s){var a,l,u,h,f,y,v,g,b,A,C,x,w,I;let R,E=void 0===s?new P:s;n.length=0;let T=void 0!=e&&t.name.toLowerCase()!==e.toLowerCase(),O=(null==(l=t.options)?void 0:l.skipReason)||T,S=T?"skipped":null==(u=t.options)?void 0:u.skipReason;if(DG.Test.isInBenchmark&&!(null==(h=t.options)?void 0:h.benchmark))return void p(`Package testing: Skipped {{${t.category}}} {{${t.name}}} doesnt available in benchmark mode`);O&&!DG.Test.isInBenchmark&&p(`Package testing: Skipped {{${t.category}}} {{${t.name}}}`),O||p(`Package testing: Started {{${t.category}}} {{${t.name}}}`);let D=Date.now(),F=new Date(D).toISOString();try{O?R={name:t.name,owner:null!=(v=null==(g=t.options)?void 0:g.owner)?v:"",category:t.category,logs:"",date:F,success:!0,result:S,ms:0,skipped:!0,package:null!=r?r:"",flaking:DG.Test.isReproducing}:(DG.Test.isProfiling&&console.profile(`${t.category}: ${t.name}`),R={name:t.name,owner:null!=(b=null==(C=t.options)?void 0:C.owner)?b:"",category:t.category,logs:"",date:F,success:!0,result:null!=(A=(yield M(t.test,null!=i?i:3e4)).toString())?A:"OK",ms:0,skipped:!1,package:null!=r?r:"",flaking:DG.Test.isReproducing},DG.Test.isProfiling&&(console.profileEnd(`${t.category}: ${t.name}`),grok.shell.info(`Profiling of ${t.category}: ${t.name} finished
|
|
178
|
+
Please ensure that you have opened DevTools (F12) / Performance panel before test starts.`)))}catch(e){m(e),R={name:t.name,owner:null!=(x=null==(w=t.options)?void 0:w.owner)?x:"",category:t.category,logs:"",date:F,success:!1,result:yield k(e),ms:0,skipped:!1,package:null!=r?r:"",flaking:!1}}if((null==(f=t.options)?void 0:f.isAggregated)&&R.result.constructor===DG.DataFrame){let t=R.result.col("success");if(t&&(R.success=t.stats.sum===t.length),!o){let t=R.result;t.columns.remove("stack"),t.rows.removeWhere(t=>t.get("success")),R.result=t}R.result=R.result.toCsv()}if(R.logs=n.join("\n"),R.ms=Date.now()-D,O||p(`Package testing: Finished {{${t.category}}} {{${t.name}}} with {{${R.success?"success":"error"}}} for ${R.ms} ms`),R.success||p(`Package testing: Result for {{${t.category}}} {{${t.name}}}: ${R.result}`),R.category=t.category,R.name=t.name,R.owner=null!=(a=null==(y=t.options)?void 0:y.owner)?a:"",!T){let e={success:R.success,result:R.result,ms:R.ms,date:R.date,skipped:R.skipped,category:t.category,name:t.name,logs:R.logs,owner:R.owner,flaking:DG.Test.isReproducing&&R.success,package:R.package};if(R.result.constructor==Object){let t=Object.keys(R.result).reduce((t,e)=>d(c({},t),{["result."+e]:R.result[e]}),{});e=c({},e,t)}e.result instanceof DG.DataFrame&&(e.result=JSON.stringify(null==(I=e.result)?void 0:I.toJson())||""),E.add("package",e)}return R}).apply(this,arguments)}function F(t){return u(function*(){yield new Promise(e=>setTimeout(e,t))})()}function V(t,e,n,i){let r=void 0===n?1e4:n,o=void 0===i?20:i;return u(function*(){let n=Date.now();for(;!t();){if(Date.now()-n>r)throw Error(`${"string"==typeof e?e:e()} (after ${r} ms)`);yield F(o)}})()}function L(t,e){let n=void 0===e?2e4:e;return u(function*(){if("u">typeof process)return;let e=0;yield V(()=>{var t;return(e=[null==(t=grok.shell.v)?void 0:t.root,...document.querySelectorAll(".d4-dialog")].some(t=>null!=t&&Array.from(t.querySelectorAll('.grok-wait .grok-loader, .d4-update-shadow, [aria-busy="true"]')).some(t=>null!==t.offsetParent))||Array.from(grok.shell.tableViews).some(t=>Array.from(t.viewers).some(t=>null!==t.root.offsetParent&&function(t){try{return t.isRenderPending}catch(t){return!1}}(t)))?0:e+1)>=2},`${t}: still loading`,n,16)})()}function M(t,e,n){let i=void 0===n?"EXECUTION TIMEOUT":n;return u(function*(){let n=null,r=new Promise((t,r)=>{n=setTimeout(()=>{r(i)},e)});try{return yield Promise.race([t(),r])}finally{n&&clearTimeout(n)}})()}function N(t,e,n,i,r,o,s){try{var a=t[o](s),l=a.value}catch(t){n(t);return}a.done?e(l):Promise.resolve(l).then(i,r)}function j(){var t;return(t=function*(){let t=r.Func.find({package:"Compute",name:"init"})[0];t&&(yield t.prepare().call())},function(){var e=this,n=arguments;return new Promise(function(i,r){var o=t.apply(e,n);function s(t){N(o,i,r,s,a,"next",t)}function a(t){N(o,i,r,s,a,"throw",t)}s(void 0)})})()}function B(...t){return new window.compute.RFV(...t)}DG.DataFrame.fromColumns([DG.Column.fromStrings("col",["val1","val2","val3"])]);let _=rxjs.operators;"function"==typeof TextDecoder&&new TextDecoder("utf-8",{ignoreBOM:!0}),"function"==typeof TextEncoder&&new TextEncoder;let U=Array.prototype.slice.call("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="),W=(e={},U.forEach((t,n)=>e[t]=n),e),H=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,Y=String.fromCharCode.bind(String),G="function"==typeof Uint8Array.from?Uint8Array.from.bind(Uint8Array):t=>new Uint8Array(Array.prototype.slice.call(t,0)),Z="function"==typeof btoa?t=>btoa(t):t=>{let e,n,i,r,o="",s=t.length%3;for(let s=0;s<t.length;){if((n=t.charCodeAt(s++))>255||(i=t.charCodeAt(s++))>255||(r=t.charCodeAt(s++))>255)throw TypeError("invalid character found");o+=U[(e=n<<16|i<<8|r)>>18&63]+U[e>>12&63]+U[e>>6&63]+U[63&e]}return s?o.slice(0,s-3)+"===".substring(s):o},J="function"==typeof Uint8Array.prototype.toBase64?t=>t.toBase64():t=>{let e=[];for(let n=0,i=t.length;n<i;n+=4096)e.push(Y.apply(null,t.subarray(n,n+4096)));return Z(e.join(""))},z=(t,e=!1)=>e?J(t).replace(/=/g,"").replace(/[+\/]/g,t=>"+"==t?"-":"_"):J(t),Q="function"==typeof atob?t=>atob(t.replace(/[^A-Za-z0-9\+\/]/g,"")):t=>{let e,n,i;if(t=t.replace(/\s+/g,""),!H.test(t))throw TypeError("malformed base64.");t+="==".slice(2-(3&t.length));let r=[];for(let o=0;o<t.length;)e=W[t.charAt(o++)]<<18|W[t.charAt(o++)]<<12|(n=W[t.charAt(o++)])<<6|(i=W[t.charAt(o++)]),64===n?r.push(Y(e>>16&255)):64===i?r.push(Y(e>>16&255,e>>8&255)):r.push(Y(e>>16&255,e>>8&255,255&e));return r.join("")},q="function"==typeof Uint8Array.fromBase64?t=>Uint8Array.fromBase64(t):t=>G(Q(t).split("").map(t=>t.charCodeAt(0))),K=t=>t.replace(/[-_]/g,t=>"-"==t?"+":"/").replace(/[^A-Za-z0-9\+\/]/g,""),X=dayjs;var tt,te,tn,ti,tr,to,ts,ta,tl,tu,tc,td,tp=n.n(X);let th="_DG_CUSTOM_SERIALIZED_TOKEN_";function tf(t){return JSON.parse(t,ty)}function tm(t){return tf(JSON.stringify(t))}function ty(t,e){if(e&&e[th]&&e.value)switch(e[th]){case"DataFrame":return r.DataFrame.fromByteArray(q(K(e.value)));case"DataFrameJSON":return r.DataFrame.fromJson(JSON.stringify(e.value));case"ArrayBuffer":return q(K(e.value)).buffer;case"Map":return new Map(e.value);case"DayJs":return tp()(e.value);case"Set":return new Set(e.value);case"Infinity":return 1/0;case"-Infinity":return-1/0;case"NaN":return NaN}return e}function tv(t,e,n,i,r,o,s){try{var a=t[o](s),l=a.value}catch(t){n(t);return}a.done?e(l):Promise.resolve(l).then(i,r)}function tg(t){return function(){var e=this,n=arguments;return new Promise(function(i,r){var o=t.apply(e,n);function s(t){tv(o,i,r,s,a,"next",t)}function a(t){tv(o,i,r,s,a,"throw",t)}s(void 0)})}}function tb(t){return{inputs:[...t.inputs.entries()],outputs:[...t.outputs.entries()]}}function tA(t,e){return tg(function*(){yield V(()=>t.funcCall.func.inputs.every(t=>null!=e[t.name]),()=>`inputs not rendered: ${t.funcCall.func.inputs.map(t=>t.name).filter(t=>null==e[t])}`)})()}function tC(t,e){return tg(function*(){let n=n=>{var i;return e[n]instanceof r.DataFrame?(null==(i=t.funcCall.inputs[n])?void 0:i.dart)===e[n].dart:t.funcCall.inputs[n]===e[n]};yield V(()=>Object.keys(e).every(n),()=>`the call did not take the inputs: ${JSON.stringify(Object.keys(e).filter(t=>!n(t)))}`)})()}function tx(t,e=1e4){return tg(function*(){let n=null;yield V(()=>{try{return t(),!0}catch(t){return n=t,!1}},"unreached",e).catch(()=>{throw n})})()}function tw(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=Array(e);n<e;n++)i[n]=t[n];return i}class tI extends Error{}function tR(t,e,n){new tk(n).run(t,e)}function tE(){}function tT(t,e){if(t!==e)return[{msg:`Expected ${e}, got ${t}`}]}function tO(t,e,n,i){let r=[];if(t.length!==e.length){let n={msg:`Arrays are of different length: actual array length is ${t.length} and expected array length is ${e.length}`};r.push(n)}for(let n=0;n<t.length;n++)i([String(n)],t[n],e[n]);return r}function tS(t,e){let n=[],i=new Set(e);var r=!0,o=!1,s=void 0;try{for(var a,l=t[Symbol.iterator]();!(r=(a=l.next()).done);r=!0){let t=a.value;if(!i.has(t)){let e={msg:`Additional key/col item in actual data found: ${t}`};n.push(e)}}}catch(t){o=!0,s=t}finally{try{r||null==l.return||l.return()}finally{if(o)throw s}}return n}let tP={floatTolerance:.001,maxErrorsReport:5,forbidAdditionalProps:!1,maxDepth:128,checkersSeq:[{name:"NaN",predicate:function(t,e){return Number.isNaN(t)&&Number.isNaN(e)},checker:tE},{name:"Null",predicate:function(t,e){return null==t&&null==e},checker:tE},{name:"Boolean",predicate:function(t,e){return"boolean"==typeof t&&"boolean"==typeof e},checker:tT},{name:"String",predicate:function(t,e){return"string"==typeof t&&"string"==typeof e},checker:tT},{name:"Integer",predicate:function(t,e){return Number.isInteger(t)&&Number.isInteger(e)},checker:tT},{name:"BigInt",predicate:function(t,e){return"bigint"==typeof t&&"bigint"==typeof e},checker:tT},{name:"Float",predicate:function(t,e){return"number"==typeof t&&"number"==typeof e},checker:function(t,e,n){if(!(t===1/0&&e===1/0||t===-1/0&&e===-1/0||isNaN(t)&&isNaN(e))&&!(Math.abs(t-e)<n.options.floatTolerance))return[{msg:`Expected ${e}, got ${t} (tolerance = ${n.options.floatTolerance})`}]}},{name:"Map",predicate:function(t,e){return t instanceof Map&&e instanceof Map},checker:function(t,e,n,i){let r=[];n.options.forbidAdditionalProps&&r.push(...tS([...t.keys()],[...e.keys()]));var o=!0,s=!1,a=void 0;try{for(var l,u=e.keys()[Symbol.iterator]();!(o=(l=u.next()).done);o=!0){let n=l.value,r=t.get(n),o=e.get(n);i([String(n)],r,o)}}catch(t){s=!0,a=t}finally{try{o||null==u.return||u.return()}finally{if(s)throw a}}return r}},{name:"Set",predicate:function(t,e){return t instanceof Set&&e instanceof Set},checker:function(t,e,n,i){let r=[];if(t.size!==e.size){let n={msg:`Sets are of different size: actual set size is ${t.size} and expected set size is ${e.size}`};r.push(n)}var o=!0,s=!1,a=void 0;try{for(var l,u=e.values()[Symbol.iterator]();!(o=(l=u.next()).done);o=!0){let e=l.value,n=t.has(e);i([String(e)],n,!0)}}catch(t){s=!0,a=t}finally{try{o||null==u.return||u.return()}finally{if(s)throw a}}return r}},{name:"ArrayBuffer",predicate:function(t,e){return t instanceof ArrayBuffer&&e instanceof ArrayBuffer},checker:function(t,e,n,i){return tO(Array.from(new Uint8Array(t)),Array.from(new Uint8Array(e)),n,i)}},{name:"Array",predicate:function(t,e){return t instanceof Array&&e instanceof Array},checker:tO},{name:"DataFrame",predicate:function(t,e){return t instanceof r.DataFrame&&e instanceof r.DataFrame},checker:function(t,e,n,i){let r=[];if(t.rowCount!==e.rowCount){let n={msg:`Dataframes has different row count: actual row count is ${t.rowCount} and expected row count is ${e.rowCount}`};r.push(n)}n.options.forbidAdditionalProps&&r.push(...tS([...t.columns].map(t=>t.name),[...e.columns].map(t=>t.name)));var o=!0,s=!1,a=void 0;try{for(var l,u=e.columns[Symbol.iterator]();!(o=(l=u.next()).done);o=!0){let n=l.value,o=t.columns.byName(n.name);if(!o){let t={msg:`Column ${n.name} not found`};r.push(t);continue}if(o.type!==n.type){let t={msg:`Column ${n.name} type expected ${n.type} got ${o.type}`};r.push(t);continue}for(let t=0;t<e.rowCount;t++){let e=o.get(t),r=n.get(t);i([n.name,String(t)],e,r)}}}catch(t){s=!0,a=t}finally{try{o||null==u.return||u.return()}finally{if(s)throw a}}return r}},{name:"DayJs",predicate:function(t,e){return tp().isDayjs(t)&&tp().isDayjs(e)},checker:function(t,e){if(!e.isSame(t))return[{msg:`Different date, expected ${e.toISOString()} actual ${t.toISOString()}`}]}},{name:"Object",predicate:function(t,e){return"object"==typeof t&&"object"==typeof e},checker:function(t,e,n,i){let r=[];n.options.forbidAdditionalProps&&r.push(...tS([...Object.keys(t)],[...Object.keys(e)]));var o=!0,s=!1,a=void 0;try{for(var l,u,c=Object.entries(e)[Symbol.iterator]();!(o=(u=c.next()).done);o=!0){let e=(l=u.value,function(t){if(Array.isArray(t))return t}(l)||function(t){var e,n,i=null==t?null:"u">typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=i){var r=[],o=!0,s=!1;try{for(i=i.call(t);!(o=(e=i.next()).done)&&(r.push(e.value),2!==r.length);o=!0);}catch(t){s=!0,n=t}finally{try{o||null==i.return||i.return()}finally{if(s)throw n}}return r}}(l)||function(t){if(t){if("string"==typeof t)return tw(t,2);var e=Object.prototype.toString.call(t).slice(8,-1);if("Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e)return Array.from(e);if("Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e))return tw(t,2)}}(l)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),n=e[0],r=e[1],o=t[n];i([n],o,r)}}catch(t){s=!0,a=t}finally{try{o||null==c.return||c.return()}finally{if(s)throw a}}return r}}],prefix:""};class tk{run(t,e){this.matchChecker(t,e),this.checkErrorsLimit(0)}checkDeep(t,e,n){let i=t.length;if(this.state.currentPath.push(...t),this.state.currentPath.length>this.options.maxDepth)throw new tI(`Max depth ${this.options.maxDepth} is exceeded, potentially a circular structure`);this.matchChecker(e,n),this.state.currentPath.splice(-i)}matchChecker(t,e){let n=!1;var i=!0,r=!1,o=void 0;try{for(var s,a=this.options.checkersSeq[Symbol.iterator]();!(i=(s=a.next()).done);i=!0){let i=s.value,r=i.predicate,o=i.checker;if(r(t,e)){n=!0;let i=o(t,e,this.state,this.checkDeep.bind(this));i&&i.map(t=>this.addError(t));break}}}catch(t){r=!0,o=t}finally{try{i||null==a.return||a.return()}finally{if(r)throw o}}if(!n){let n={msg:`Type mismatch or no checker defined: expected ${e}, got ${t}`};this.addError(n)}}addError(t){var e,n;let i={path:[...null!=(e=this.state.currentPath)?e:[],...null!=(n=t.path)?n:[]],msg:t.msg};this.state.errors.push(i),this.checkErrorsLimit()}checkErrorsLimit(t){let e=void 0===t?this.options.maxErrorsReport:t;if(this.state.errors.length>e)throw new tI(this.makeReport())}makeReport(){return this.state.errors.map(t=>{var e;let n=(null!=(e=t.path)?e:[]).map(t=>`['${String(t)}']`).join("."),i=n?`${n}: ${t.msg}`:t.msg;return this.options.prefix?`${this.options.prefix}: ${i}`:i}).slice(0,this.options.maxErrorsReport).join("\n")}constructor(t){this.options=function(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{},i=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(i=i.concat(Object.getOwnPropertySymbols(n).filter(function(t){return Object.getOwnPropertyDescriptor(n,t).enumerable}))),i.forEach(function(e){var i;i=n[e],e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i})}return t}({},tP,void 0===t?{}:t),this.state={errors:[],currentPath:[],options:this.options}}}var tD=JSON.parse('{"inputs":[["df",{"_DG_CUSTOM_SERIALIZED_TOKEN_":"DataFrame","value":"KaAAAAAAAAAIQAAAAAAAAPA/A6EAAAAAAAAUQGRmb3V0KqABAAAAA6EAAAAAAAAIQC5pZAOhAAAAAAAAQkBlNDk0MWE2MC05YjAwLTExZWYtY2JjMC1jOTUzNzQ3OGNkZTcooAOhAAAAAAAACEBjb2wDoQAAAAAAABhAZG91YmxlKqACAAAAA6EAAAAAAAAIQC5pZAOhAAAAAAAAQkBlNDRhOGU0MC05YjAwLTExZWYtZDA4ZC0yM2QxNzBmZGJiY2IDoQAAAAAAADxALnNlbWFudGljLWRldGVjdGlvbi1kdXJhdGlvbgOhAAAAAAAA8D8zBQAAAAEAAAACoQAAAAAAAAhAzcyMP83MDEAzM1NAA6EAAAAAAFCDQHsiI3R5cGUiOiJUYWJsZXNCbG9iIiwidmVyc2lvbiI6IjAuNi4wLTMwYTc1NjlkIiwidGFibGVzIjpbeyJjb2x1bW5zIjpbeyJuYW1lIjoiY29sIiwidHlwZSI6ImRvdWJsZSIsImlkIjoiZTQ0YThlNDAtOWIwMC0xMWVmLWQwOGQtMjNkMTcwZmRiYmNiIiwiZnJpZW5kbHlOYW1lIjoiQ29sIiwiZW50aXR5VGFncyI6W3sidGFnIjoiLmlkIiwiaWQiOiJlNGVlZTQ5MC05YjAwLTExZWYtZGNhZi1iM2JlNTZkYWFiMjEifSx7InRhZyI6Ii5zZW1hbnRpYy1kZXRlY3Rpb24tZHVyYXRpb24iLCJpZCI6ImU0ZWVlNDkwLTliMDAtMTFlZi1kZmM2LWM5ODIzZjZmZWMyYSJ9XSwibWV0YVBhcmFtcyI6eyIuaWQiOiJlNDRhOGU0MC05YjAwLTExZWYtZDA4ZC0yM2QxNzBmZGJiY2IiLCIuc2VtYW50aWMtZGV0ZWN0aW9uLWR1cmF0aW9uIjoiMyJ9fV0sInJvd0NvdW50IjozLCJjb2xDb3VudCI6MSwiaWQiOiJlNDk0MWE2MC05YjAwLTExZWYtY2JjMC1jOTUzNzQ3OGNkZTciLCJuYW1lIjoiRGZvdXQiLCJmcmllbmRseU5hbWUiOiJkZm91dCIsImVudGl0eVRhZ3MiOlt7InRhZyI6Ii5pZCIsImlkIjoiZTRlZWU0OTAtOWIwMC0xMWVmLWY1YzMtYjVlNTEyZTlkMDQ1In1dLCJtZXRhUGFyYW1zIjp7fX1dfQihAAAAAAAA8D8AAAAACKEAAAAAAADwP2IAAAADoQAAAAAAACxAMC42LjAtMzBhNzU2OWSoAgAA"}],["data","{\\"a\\":1,\\"b\\":\\"test\\"}"]],"outputs":[["dfout",{"_DG_CUSTOM_SERIALIZED_TOKEN_":"DataFrame","value":"KaAAAAAAAAAIQAAAAAAAAPA/A6EAAAAAAAAUQGRmb3V0KqABAAAAA6EAAAAAAAAIQC5pZAOhAAAAAAAAQkBlNDU5MGQzMC05YjAwLTExZWYtYmM0Mi1iYmZhMDBhYzUxM2IooAOhAAAAAAAACEBjb2wDoQAAAAAAABhAZG91YmxlKqACAAAAA6EAAAAAAAAIQC5pZAOhAAAAAAAAQkBlNDRhOGU0MC05YjAwLTExZWYtZDA4ZC0yM2QxNzBmZGJiY2IDoQAAAAAAADxALnNlbWFudGljLWRldGVjdGlvbi1kdXJhdGlvbgOhAAAAAAAA8D8zBQAAAAEAAAACoQAAAAAAAAhAzcyMP83MDEAzM1NAA6EAAAAAAFCDQHsiI3R5cGUiOiJUYWJsZXNCbG9iIiwidmVyc2lvbiI6IjAuNi4wLTMwYTc1NjlkIiwidGFibGVzIjpbeyJjb2x1bW5zIjpbeyJuYW1lIjoiY29sIiwidHlwZSI6ImRvdWJsZSIsImlkIjoiZTQ0YThlNDAtOWIwMC0xMWVmLWQwOGQtMjNkMTcwZmRiYmNiIiwiZnJpZW5kbHlOYW1lIjoiQ29sIiwiZW50aXR5VGFncyI6W3sidGFnIjoiLmlkIiwiaWQiOiJlNGVmMGJhMC05YjAwLTExZWYtOTEwZC02OTA2ZDYxM2FjMDEifSx7InRhZyI6Ii5zZW1hbnRpYy1kZXRlY3Rpb24tZHVyYXRpb24iLCJpZCI6ImU0ZWYzMmIwLTliMDAtMTFlZi1iZmUxLTBkYmZmMzQxYTRmZiJ9XSwibWV0YVBhcmFtcyI6eyIuaWQiOiJlNDRhOGU0MC05YjAwLTExZWYtZDA4ZC0yM2QxNzBmZGJiY2IiLCIuc2VtYW50aWMtZGV0ZWN0aW9uLWR1cmF0aW9uIjoiMyJ9fV0sInJvd0NvdW50IjozLCJjb2xDb3VudCI6MSwiaWQiOiJlNDU5MGQzMC05YjAwLTExZWYtYmM0Mi1iYmZhMDBhYzUxM2IiLCJuYW1lIjoiRGZvdXQiLCJmcmllbmRseU5hbWUiOiJkZm91dCIsImVudGl0eVRhZ3MiOlt7InRhZyI6Ii5pZCIsImlkIjoiZTRlZjMyYjAtOWIwMC0xMWVmLTkzZDAtNmI4MjEwMDE4OTFhIn1dLCJtZXRhUGFyYW1zIjp7fX1dfQihAAAAAAAA8D8AAAAACKEAAAAAAADwP2IAAAADoQAAAAAAACxAMC42LjAtMzBhNzU2OWSoAgAA"}],["dataout","{\\"a\\":1,\\"b\\":\\"test\\"}"]]}');function tF(t,e,n,i,r,o,s){try{var a=t[o](s),l=a.value}catch(t){n(t);return}a.done?e(l):Promise.resolve(l).then(i,r)}function tV(t){return function(){var e=this,n=arguments;return new Promise(function(i,r){var o=t.apply(e,n);function s(t){tF(o,i,r,s,a,"next",t)}function a(t){tF(o,i,r,s,a,"throw",t)}s(void 0)})}}E("Compute API: RFV Inputs",()=>tV(function*(){T(()=>tV(function*(){yield j()})()),I("Simple inputs setParamValue",()=>tV(function*(){let t=B("Compute:simpleInputs",{historyEnabled:!1,isTabbed:!1}),e={};t.afterInputPropertyRender.subscribe(({prop:t,input:n})=>{e[t.name]=n}),yield t.isReady.pipe((0,_.filter)(t=>t),(0,_.take)(1)).toPromise(),t.funcCall.setParamValue("a",1),t.funcCall.setParamValue("b",2.2),t.funcCall.setParamValue("c","test"),yield t.doRun();let n={inputs:[["a",1],["b",2.2],["c","test"]],outputs:[["aout",1],["bout",2.2],["cout","test"]]};for(let[i,r]of(tR(tb(t.funcCall),n,{prefix:"funcCall"}),tR(tb(t.lastCall),n,{prefix:"lastCall"}),Object.entries({a:1,b:2.2,c:"test"})))tR(e[i].value,r,{prefix:`input ${i}`})})()),I("Simple inputs inputs tweak",()=>tV(function*(){let t=B("Compute:simpleInputs",{historyEnabled:!1,isTabbed:!1}),e={a:1,b:2.2,c:"test"},n={};for(let[i,r]of(t.afterInputPropertyRender.subscribe(({prop:t,input:e})=>{n[t.name]=e}),yield t.isReady.pipe((0,_.filter)(t=>t),(0,_.take)(1)).toPromise(),yield tA(t,n),Object.entries(n)))r.value=e[i],r.input.dispatchEvent(new Event("input",{bubbles:!0}));yield tC(t,e),yield t.doRun();let i={inputs:[["a",1],["b",2.2],["c","test"]],outputs:[["aout",1],["bout",2.2],["cout","test"]]};tR(tb(t.funcCall),i,{prefix:"funcCall"}),tR(tb(t.lastCall),i,{prefix:"lastCall"})})()),I("Simple inputs setParamValue rerun",()=>tV(function*(){let t=B("Compute:simpleInputsDefaultValues",{historyEnabled:!1,isTabbed:!1}),e={};t.afterInputPropertyRender.subscribe(({prop:t,input:n})=>{e[t.name]=n}),yield t.isReady.pipe((0,_.filter)(t=>t),(0,_.take)(1)).toPromise(),yield tA(t,e),yield t.doRun(),t.funcCall.setParamValue("a",2),t.funcCall.setParamValue("b",3.2),t.funcCall.setParamValue("c","test2"),yield t.doRun();let n={inputs:[["a",2],["b",3.2],["c","test2"]],outputs:[["aout",2],["bout",3.2],["cout","test2"]]};for(let[i,r]of(tR(tb(t.funcCall),n,{prefix:"funcCall"}),tR(tb(t.lastCall),n,{prefix:"lastCall"}),Object.entries({a:2,b:3.2,c:"test2"})))tR(e[i].value,r,{prefix:`input ${i}`})})()),I("Simple inputs inputs tweak rerun",()=>tV(function*(){let t=B("Compute:simpleInputsDefaultValues",{historyEnabled:!1,isTabbed:!1}),e={a:2,b:3.2,c:"test2"},n={};for(let[i,r]of(t.afterInputPropertyRender.subscribe(({prop:t,input:e})=>{n[t.name]=e}),yield t.isReady.pipe((0,_.filter)(t=>t),(0,_.take)(1)).toPromise(),yield tA(t,n),yield t.doRun(),Object.entries(n)))r.value=e[i],r.input.dispatchEvent(new Event("input",{bubbles:!0}));yield tC(t,e),yield t.doRun();let i={inputs:[["a",2],["b",3.2],["c","test2"]],outputs:[["aout",2],["bout",3.2],["cout","test2"]]};tR(tb(t.funcCall),i,{prefix:"funcCall"}),tR(tb(t.lastCall),i,{prefix:"lastCall"})})()),I("Simple inputs default values",()=>tV(function*(){let t=B("Compute:simpleInputsDefaultValues",{historyEnabled:!1,isTabbed:!1});yield t.isReady.pipe((0,_.filter)(t=>t),(0,_.take)(1)).toPromise();let e=[["a",1],["b",2.2],["c","test"]];yield tx(()=>tR(tb(t.funcCall).inputs,e))})()),I("Complex inputs setParamValue",()=>tV(function*(){let t=B("Compute:complexInputs",{historyEnabled:!1,isTabbed:!1}),e={df:r.DataFrame.fromColumns([r.Column.fromList("double","col",[1.1,2.2,3.3])]),data:JSON.stringify({a:1,b:"test"})},n={};t.afterInputPropertyRender.subscribe(({prop:t,input:e})=>{n[t.name]=e}),t.funcCall.setParamValue("df",e.df),t.funcCall.setParamValue("data",e.data),yield t.doRun(),tR(tb(t.funcCall),tm(tD),{prefix:"funcCall"}),tR(tb(t.lastCall),tm(tD),{prefix:"lastCall"}),tR(n.data.value,e.data,{prefix:"data"})})()),I("Complex inputs inputs tweak",()=>tV(function*(){let t=B("Compute:complexInputs",{historyEnabled:!1,isTabbed:!1}),e={df:r.DataFrame.fromColumns([r.Column.fromList("double","col",[1.1,2.2,3.3])]),data:JSON.stringify({a:1,b:"test"})},n={};t.afterInputPropertyRender.subscribe(({prop:t,input:e})=>{n[t.name]=e}),yield t.isReady.pipe((0,_.filter)(t=>t),(0,_.take)(1)).toPromise(),yield tA(t,n),n.data.value=e.data,t.funcCall.setParamValue("df",e.df),yield tC(t,e),yield t.doRun(),tR(tb(t.funcCall),tm(tD),{prefix:"funcCall"}),tR(tb(t.lastCall),tm(tD),{prefix:"lastCall"}),tR(n.data.value,e.data,{prefix:"data"})})()),I("Complex inputs setParamValue rerun",()=>tV(function*(){let t=B("Compute:complexInputs",{historyEnabled:!1,isTabbed:!1}),e={df:r.DataFrame.fromColumns([r.Column.fromList("double","col",[11.1,12.2,13.3])]),data:JSON.stringify({a:2,b:"pretest"})},n={};t.afterInputPropertyRender.subscribe(({prop:t,input:e})=>{n[t.name]=e}),yield t.isReady.pipe((0,_.filter)(t=>t),(0,_.take)(1)).toPromise(),t.funcCall.setParamValue("df",e.df),t.funcCall.setParamValue("data",e.data),yield t.doRun();let i={df:r.DataFrame.fromColumns([r.Column.fromList("double","col",[1.1,2.2,3.3])]),data:JSON.stringify({a:1,b:"test"})};t.funcCall.setParamValue("df",i.df),t.funcCall.setParamValue("data",i.data),yield t.doRun(),tR(tb(t.funcCall),tm(tD),{prefix:"funcCall"}),tR(tb(t.lastCall),tm(tD),{prefix:"lastCall"}),tR(n.data.value,i.data,{prefix:"data"})})()),I("Complex inputs inputs tweak rerun",()=>tV(function*(){let t=B("Compute:complexInputs",{historyEnabled:!1,isTabbed:!1}),e={df:r.DataFrame.fromColumns([r.Column.fromList("double","col",[11.1,12.2,13.3])]),data:JSON.stringify({a:2,b:"pretest"})},n={};t.afterInputPropertyRender.subscribe(({prop:t,input:e})=>{n[t.name]=e}),yield t.isReady.pipe((0,_.filter)(t=>t),(0,_.take)(1)).toPromise(),yield tA(t,n),n.data.value=e.data,t.funcCall.setParamValue("df",e.df),yield tC(t,e),yield t.doRun();let i={df:r.DataFrame.fromColumns([r.Column.fromList("double","col",[1.1,2.2,3.3])]),data:JSON.stringify({a:1,b:"test"})};n.data.value=i.data,t.funcCall.setParamValue("df",i.df),yield tC(t,i),yield t.doRun(),tR(tb(t.funcCall),tm(tD),{prefix:"funcCall"}),tR(tb(t.lastCall),tm(tD),{prefix:"lastCall"}),tR(n.data.value,i.data,{prefix:"data"})})())})()),E("Compute API: RFV Validation",()=>tV(function*(){T(()=>tV(function*(){yield j()})()),I("Validate on start",()=>tV(function*(){let t=B("Compute:validationTest",{historyEnabled:!1,isTabbed:!1});yield t.isReady.pipe((0,_.filter)(t=>t),(0,_.take)(1)).toPromise(),yield tx(()=>tR(t.getValidationState(),{a:{errors:[{description:"Missing value"},{description:"Out of range [1, 10] value: null"}],warnings:[],notifications:[],revalidate:[],context:{}},b:{errors:[{description:"Missing value"},{description:"Out of range [20, 100] value: null"}],warnings:[],notifications:[],revalidate:[],context:{}},x:{errors:[],warnings:[{description:"Try non-null value"}],notifications:[],revalidate:[],context:{}}}))})()),I("Validate on input",()=>tV(function*(){let t=B("Compute:validationTest",{historyEnabled:!1,isTabbed:!1}),e={a:2.3,b:3.2,x:-1},n={};for(let[i,r]of(t.afterInputPropertyRender.subscribe(({prop:t,input:e})=>{n[t.name]=e}),yield t.isReady.pipe((0,_.filter)(t=>t),(0,_.take)(1)).toPromise(),yield tA(t,n),Object.entries(n)))r.value=e[i],r.input.dispatchEvent(new Event("input",{bubbles:!0}));yield tx(()=>tR(t.getValidationState(),{b:{errors:[{description:"Out of range [20, 100] value: 3.2"}]}}))})()),I("Revalidation sequence",()=>tV(function*(){let t=B("Compute:globalValidationTest",{historyEnabled:!1,isTabbed:!1}),e={a:30,b:40,c:50},n={};for(let[i,r]of(t.afterInputPropertyRender.subscribe(({prop:t,input:e})=>{n[t.name]=e}),yield t.isReady.pipe((0,_.filter)(t=>t),(0,_.take)(1)).toPromise(),yield tA(t,n),Object.entries(n)))r.value=e[i],r.input.dispatchEvent(new Event("input",{bubbles:!0}));yield tx(()=>tR(t.getValidationState(),{a:{revalidate:["b","c"],context:{isOk:!1},warnings:[{description:"Try lowering a value"}]},b:{warnings:[{description:"Try lowering a value as well"}]},c:{warnings:[{description:"Try lowering a value as well"}]}}))})())})());let tL=grok,tM=ui,tN=wu;var tj=n.n(tN);let tB=$;var t_=n.n(tB);let tU=rxjs;function t$(t,e,n,i,r,o,s){try{var a=t[o](s),l=a.value}catch(t){n(t);return}a.done?e(l):Promise.resolve(l).then(i,r)}function tW(t){var e;return!(null==t||null==(e=t.errors)?void 0:e.length)&&!(null==t?void 0:t.pending)}function tH(...t){let e=[],n=[],i=[],r=[],o={};var s=!0,a=!1,l=void 0;try{for(var u,c,d,p,h,f,m=t[Symbol.iterator]();!(s=(f=m.next()).done);s=!0){let t=f.value;t&&(e.push(...null!=(u=t.errors)?u:[]),n.push(...null!=(c=t.warnings)?c:[]),i.push(...null!=(d=t.notifications)?d:[]),r.push(...null!=(p=t.revalidate)?p:[]),o=function(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{},i=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(i=i.concat(Object.getOwnPropertySymbols(n).filter(function(t){return Object.getOwnPropertyDescriptor(n,t).enumerable}))),i.forEach(function(e){var i;i=n[e],e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i})}return t}({},o,null!=(h=t.context)?h:{}))}}catch(t){a=!0,l=t}finally{try{s||null==m.return||m.return()}finally{if(a)throw l}}return{errors:e,warnings:n,notifications:i,revalidate:r,context:o}}function tY(){return{pending:!0}}function tG(t){var e,n;let i,r,o;return(null==t?void 0:t.pending)&&(r=tM.iconFA("spinner",()=>{tZ(t,r,i)},"Validating")).classList.add("fa-spin"),(null==t?void 0:t.errors)&&t.errors.length?(r=tM.iconFA("exclamation-circle",()=>{tZ(t,r,i)},"Validation")).style.color="var(--red-3)":(null==t?void 0:t.warnings)&&t.warnings.length?(r=tM.iconFA("exclamation-circle",()=>{tZ(t,r,i)},"Validation")).style.color="var(--orange-2)":(null==t?void 0:t.notifications)&&t.notifications.length&&((r=tM.iconFA("info-circle",()=>{tZ(t,r,i)},"Info")).style.color="var(--blue-1)"),r&&(r.classList.remove("fal"),r.classList.add("far"),e=r,(n=o=tM.div([],"d4-tooltip")).popover="auto",n.style.fontStyle="normal",n.style.pointerEvents="all",n.style.maxWidth="300px",n.style.textWrap="pretty",e.appendChild(o),i=o),[null!=r?r:tM.div(),null!=i?i:tM.div()]}function tZ(t,e,n){if(n&&e){var i,r;let o;for(i=e,r=n,o=i.getBoundingClientRect().toJSON(),r.style.inset="unset",r.style.top=o.y+"px",r.style.left=o.x+20+"px";n.firstChild&&n.removeChild(n.firstChild););let s=function(t){let e=tM.divV([],{style:{gap:"10px"}});for(let l=0,u=["errors","warnings","notifications"];l<u.length;l++){let c=u[l],d=t[c];if(null==d?void 0:d.length){var n=!0,i=!1,r=void 0;try{for(var o,s,a=d[Symbol.iterator]();!(n=(s=a.next()).done);n=!0){let t=s.value,n=function(t){let e;return"errors"===t?(e=tM.iconFA("exclamation-circle")).style.color="var(--red-3)":"warnings"===t?(e=tM.iconFA("exclamation-circle")).style.color="var(--orange-2)":"notifications"===t&&((e=tM.iconFA("info-circle")).style.color="var(--blue-1)"),e&&(e.classList.remove("fal"),e.classList.add("far")),e}(c);n.style.marginRight="4px",e.appendChild(tM.divV([tM.divH([n,tM.span([t.description])]),...(null!=(o=t.actions)?o:[]).map(t=>tM.link(t.actionName,t.action,void 0,{style:{paddingLeft:"20px"}}))]))}}catch(t){i=!0,r=t}finally{try{n||null==a.return||a.return()}finally{if(i)throw r}}}}return e}(t);n.appendChild(s),n.showPopover()}}let tJ={barchart:r.VIEWER.BAR_CHART,boxplot:r.VIEWER.BOX_PLOT,calendar:r.VIEWER.CALENDAR,corrplot:r.VIEWER.CORR_PLOT,densityplot:r.VIEWER.DENSITY_PLOT,filters:r.VIEWER.FILTERS,form:r.VIEWER.FORM,globe:r.VIEWER.GLOBE,googlemap:r.VIEWER.GOOGLE_MAP,grid:r.VIEWER.GRID,heatmap:r.VIEWER.HEAT_MAP,histogram:r.VIEWER.HISTOGRAM,linechart:r.VIEWER.LINE_CHART,markup:r.VIEWER.MARKUP,matrixplot:r.VIEWER.MATRIX_PLOT,networkdiagram:r.VIEWER.NETWORK_DIAGRAM,pcplot:r.VIEWER.PC_PLOT,piechart:r.VIEWER.PIE_CHART,scatterplot:r.VIEWER.SCATTER_PLOT,"3dscatterplot":r.VIEWER.SCATTER_PLOT_3D,shapemap:r.VIEWER.SHAPE_MAP,statistics:r.VIEWER.STATISTICS,tileviewer:r.VIEWER.TILE_VIEWER,timelines:r.VIEWER.TIMELINES,treemap:r.VIEWER.TREE_MAP,trellisplot:r.VIEWER.TRELLIS_PLOT,wordcloud:r.VIEWER.WORD_CLOUD,diffstudiofacet:"DiffStudio Facet"},tz="JsCardView",tQ="viewer",tq="Run name",tK="RunId",tX="experimental",t0="ModelStorage",t9="Source",t1="Is favorite",t2="Is complete",t5="Delete",t6="Author",t4="Date",t3="Title",t8="Desc.",t7="Tags",et="Version",ee=Object.values(r.COLUMN_TYPE).filter(t=>t!==r.TYPE.DATA_FRAME);function en(t){return t&&t.root&&t.onInput}function ei(t){return(null==t?void 0:t.setValidation)&&en(t)}function er(t){return(null==t?void 0:t.setDisabled)&&(null==t?void 0:t.setRestricted)&&(null==t?void 0:t.setRestrictedUnlocked)&&(null==t?void 0:t.setInconsistent)&&(null==t?void 0:t.setUserInput)&&en(t)}var eo=n(2),es=n.n(eo),ea=n(611),el=n.n(ea),eu=n(129),ec=n.n(eu),ed=n(986),ep=n.n(ed),eh=n(838),ef=n.n(eh),em=n(515),ey=n.n(em),ev=n(902),eg={};function eb(t,e){try{return JSON.parse(t,null==e?void 0:e.reviver)}catch(n){return(null==e?void 0:e.warning)&&console.warn(`${e.warning}: malformed JSON: ${t}`,n),null}}function eA(t,e,n,i,r,o,s){try{var a=t[o](s),l=a.value}catch(t){n(t);return}a.done?e(l):Promise.resolve(l).then(i,r)}eg.styleTagTransform=ey(),eg.setAttributes=ep(),eg.insert=ec().bind(null,"head"),eg.domAPI=el(),eg.insertStyleElement=ef(),es()(ev.A,eg),ev.A&&ev.A.locals&&ev.A.locals,"u">typeof window?window:n.g.window,new Intl.NumberFormat("en-US",{minimumFractionDigits:2,maximumFractionDigits:2});let eC=new r.LruCache,ex=(t,e)=>{let n=t[e];return n?eb(n,{warning:e}):null},ew=t=>{try{return null==t?void 0:t.started}catch(t){return}},eI=t=>{var e;return tf(null!=(e=t.options.OUTPUT_OUTDATED)?e:"false")||!ew(t)||!t.id},eR=t=>{let e=(null==(l=t.func)||null==(a=l.nqName)?void 0:a.includes(":"))?r.Func.byName(t.func.nqName).prepare():t.func.prepare();e.id=t.id,t.options.forEach(n=>e.options[n]=t.options[n]);let n=tj()(e.outputParams.values()).filter(e=>null!=t.outputs[e.name]);var i=!0,o=!1,s=void 0;try{for(var a,l,u,c=n[Symbol.iterator]();!(i=(u=c.next()).done);i=!0){let n=u.value;n.property.propertyType===r.TYPE.DATA_FRAME?e.outputs[n.name]=t.outputs[n.name].clone():e.outputs[n.name]=t.outputs[n.name]}}catch(t){o=!0,s=t}finally{try{i||null==c.return||c.return()}finally{if(o)throw s}}let d=tj()(e.inputParams.values()).filter(e=>null!=t.inputs[e.name]);var p=!0,h=!1,f=void 0;try{for(var m,y=d[Symbol.iterator]();!(p=(m=y.next()).done);p=!0){let n=m.value;n.property.propertyType===r.TYPE.DATA_FRAME?e.inputs[n.name]=t.inputs[n.name].clone():e.inputs[n.name]=t.inputs[n.name]}}catch(t){h=!0,f=t}finally{try{p||null==y.return||y.return()}finally{if(h)throw f}}return ew(t)&&(e.started=t.started),e},eE=t=>{var e;let n=t.options[tQ];return n?{name:t.name,config:null!=(e=eb(n,{warning:`${t.name} viewer`,reviver:(t,e)=>{if("true"===e)return!0;if("false"===e)return!1;if("type"===t)return tJ[e]||e;if(!t.toLowerCase().includes("color")){let t=Number.parseFloat(e);if(!Number.isNaN(t))return t}return e}}))?e:[]}:{name:t.name,config:[]}},eT=t=>t.trimStart().startsWith("<"),eO=t=>{try{return t.started.toDate().toLocaleString("en-us",{month:"short",day:"numeric",hour:"numeric",minute:"numeric"})}catch(t){return"Not completed"}},eS="createdById",eP="createdAt",ek="customView",eD="nestedEntity",eF=t=>{var e,n;if(null==(e=t.options)?void 0:e[eS])return t.options[eS];try{return null==(n=t.author)?void 0:n.id}catch(t){return}},eV=t=>{var e;return(null==(e=t.options)?void 0:e.title)||t.friendlyName||""};function eL(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=Array(e);n<e;n++)i[n]=t[n];return i}function eM(t,e,n,i,r,o,s){try{var a=t[o](s),l=a.value}catch(t){n(t);return}a.done?e(l):Promise.resolve(l).then(i,r)}function eN(t){return function(){var e=this,n=arguments;return new Promise(function(i,r){var o=t.apply(e,n);function s(t){eM(o,i,r,s,a,"next",t)}function a(t){eM(o,i,r,s,a,"throw",t)}s(void 0)})}}function ej(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n,i,r=null==t?null:"u">typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var o=[],s=!0,a=!1;try{for(r=r.call(t);!(s=(n=r.next()).done)&&(o.push(n.value),!e||o.length!==e);s=!0);}catch(t){a=!0,i=t}finally{try{s||null==r.return||r.return()}finally{if(a)throw i}}return o}}(t,e)||function(t,e){if(t){if("string"==typeof t)return eL(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if("Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return eL(t,e)}}(t,e)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}let eB='((options.isDeleted != "true") or (options.isDeleted = null))',e_=t=>t.trim().toLowerCase();function eU(t,e,n,i,r,o,s){try{var a=t[o](s),l=a.value}catch(t){n(t);return}a.done?e(l):Promise.resolve(l).then(i,r)}function e$(t){return function(){var e=this,n=arguments;return new Promise(function(i,r){var o=t.apply(e,n);function s(t){eU(o,i,r,s,a,"next",t)}function a(t){eU(o,i,r,s,a,"throw",t)}s(void 0)})}}function eW(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{},i=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(i=i.concat(Object.getOwnPropertySymbols(n).filter(function(t){return Object.getOwnPropertyDescriptor(n,t).enumerable}))),i.forEach(function(e){var i;i=n[e],e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i})}return t}function eH(t,e){return e=null!=e?e:{},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):(function(t){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e.push.apply(e,n)}return e})(Object(e)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(e,n))}),t}!function(t){let e=new r.LruCache;function n(t,e){var n,r;t.friendlyName=e.name.trim(),t.options.title=t.friendlyName;let o=i(t);t.options.description=null!=(n=e.description)?n:o.description,t.options.tags=null!=(r=e.tags)?r:o.tags}function i(t){var e,n,i;let r=null==(n=t.options)?void 0:n.tags;return{name:eV(t),description:null!=(e=null==(i=t.options)?void 0:i.description)?e:"",tags:Array.isArray(r)?r:[]}}function o(t){return eN(function*(){var e,n,i;let r,o;if(t.options[eS])return;let a=eF(t)?t:yield s(t.id);t.options[eS]=eF(a),t.options[eP]=null==(e=(null==(o=(r=(null==(n=a.options)?void 0:n[eS])?null==(i=a.options)?void 0:i[eP]:void 0)?tp()(r):ew(a))?void 0:o.isValid())?o:void 0)?void 0:e.toISOString()})()}function s(t){return eN(function*(){return yield tL.dapi.functions.calls.allPackageVersions().include("session.user,func.package, inputs, outputs").find(t)})()}function a(t,e){return eN(function*(t,e,n){let i=tL.dapi.spaces.id(e);yield i.addEntity(t,!0);var r=!0,o=!1,s=void 0;try{for(var a,l=(void 0===n?[]:n)[Symbol.iterator]();!(r=(a=l.next()).done);r=!0){let e=a.value;e.id!==t&&(yield i.removeEntity(e.id))}}catch(t){o=!0,s=t}finally{try{r||null==l.return||l.return()}finally{if(o)throw s}}}).apply(this,arguments)}function l(t){return eN(function*(){let e=ej((yield Promise.all([tL.dapi.spaces.id(t).children.list(),u(t)])),2);return{items:e[0],runs:e[1]}})()}function u(t){return eN(function*(){return yield tL.dapi.spaces.id(t).children.ofTypes("FuncCall",!0).list()})()}function c(e,n){let i=e_(n),r=e.items.find(e=>t.isNamedSpaceItem(e)&&e_(e.friendlyName||e.name||"")===i);return{runs:e.runs.filter(t=>e_(eV(t))===i),other:r}}t.setRunMetadata=n,t.getRunMetadata=i,t.canEditRunDetails=function(t,e){return!!t&&t===r.User.current().id||e},t.shallowLoadRun=s,t.loadRun=function(t){return eN(function*(){let e=yield tL.dapi.functions.calls.allPackageVersions().include("session.user,func.package, inputs, outputs").find(t),n=tj()(e.inputParams.values()).filter(t=>t.property.propertyType===r.TYPE.FILE&&!!e.inputs[t.name]);yield Promise.all(n.map(t=>eN(function*(){let n=JSON.parse(e.inputs[t.name]),i=n.id,o=n.name,s=yield tL.dapi.files.readAsBytes(i),a=r.FileInfo.fromBytes(o,s);return a.id=i,e.inputs[t.name]=a,Promise.resolve()})()));let i=tj()(e.outputParams.values()).filter(t=>t.property.propertyType===r.TYPE.DATA_FRAME&&!!e.outputs[t.name]);yield Promise.all(i.map(t=>eN(function*(){return e.outputs[t.name]=yield tL.dapi.tables.getTable(e.outputs[t.name]),Promise.resolve()})()));let o=tj()(e.inputParams.values()).filter(t=>t.property.propertyType===r.TYPE.DATA_FRAME&&!!e.inputs[t.name]);return yield Promise.all(o.map(t=>eN(function*(){return e.inputs[t.name]=yield tL.dapi.tables.getTable(e.inputs[t.name]),Promise.resolve()})())),e})()},t.updateRunMeta=function(t){return eN(function*(){yield o(t);let e=yield tL.dapi.functions.calls.allPackageVersions().save(t);tL.log.audit("@user edited metadata of @model model run",{user:r.User.current(),model:e.func})})()},t.saveRun=function(t,i){return eN(function*(){var o,s,l,u;let c=e.get("All users");c||(c=yield tL.dapi.groups.find(r.Group.defaultGroupsIds["All users"]),e.set("All users",c));let d=null!=(o=null==i?void 0:i.audience)?o:c;(null==i?void 0:i.newId)&&t.newId(),(null==i?void 0:i.metadata)&&n(t,i.metadata),t.options[eS]=r.User.current().id,t.options[eP]=tp()().toISOString(),(null==i?void 0:i.nested)?t.options[eD]="true":delete t.options[eD];let p=eR(t);delete p.options.isDeleted,(null==i?void 0:i.metadata)&&(p.friendlyName=t.friendlyName),eI(p)&&(p.options.createdOn=tp()().utc(!0).unix());let h=tj()(p.inputParams.values()).filter(t=>t.property.propertyType===r.TYPE.FILE&&!!p.inputs[t.name]);yield Promise.all(h.map(t=>eN(function*(){var e;let n=p.inputs[t.name],i=n instanceof r.FileInfo?yield n.readAsBytes():new Uint8Array((yield n.arrayBuffer())),o=n instanceof r.FileInfo&&null!=(e=n.fileName)?e:n.name,s=r.FileInfo.fromBytes(o,i);return yield tL.dapi.files.write(s),p.inputs[t.name]={id:s.id,name:s.name},Promise.resolve()})()));let f=tj()(p.outputParams.values()).filter(t=>t.property.propertyType===r.TYPE.DATA_FRAME&&!!p.outputs[t.name]);yield Promise.all(f.map(t=>eN(function*(){yield tL.dapi.tables.uploadDataFrame(p.outputs[t.name]),yield tL.dapi.permissions.grant(p.outputs[t.name].getTableInfo(),d,!1)})()));let m=tj()(p.inputParams.values()).filter(t=>t.property.propertyType===r.TYPE.DATA_FRAME&&!!p.inputs[t.name]);yield Promise.all(m.map(t=>eN(function*(){yield tL.dapi.tables.uploadDataFrame(p.inputs[t.name]),yield tL.dapi.permissions.grant(p.inputs[t.name].getTableInfo(),d,!1)})()));let y=yield tL.dapi.functions.calls.allPackageVersions().save(p);if(tL.log.audit("@user saved run of the @model model",{user:r.User.current(),model:y.func}),null==i||null==(s=i.target)?void 0:s.spaceId)try{yield a(y.id,i.target.spaceId,i.target.replace)}catch(t){tL.shell.error(`Saved the run, but couldn't add it to the space: ${null!=(u=null==t?void 0:t.message)?u:t}`)}return i&&!i.nested&&tL.events.fireCustomEvent("compute-run-saved",{spaceIds:(null==(l=i.target)?void 0:l.spaceId)?[i.target.spaceId]:[]}),y})()},t.linkRun=a,t.unlinkRun=function(t,e){return eN(function*(){yield tL.dapi.spaces.id(e).removeEntity(t)})()},t.listMyRuns=function(e){return eN(function*(){let n=Array.isArray(e)?e:[e];if(0===n.length)return[];let i=r.User.current().id,o=`(options.${eS} = "${i}") or ((session.user.id="${i}") and (options.${eS} = null))`,s=[...new Set(n.map(t=>t.name))],a=n.map(t=>`(options.${ek} = "${t.nqName}")`),l=t=>tL.dapi.functions.calls.allPackageVersions().filter(`(${o}) and (${eB}) and (options.${eD} = null) and (${t})`).include("session,options,func.package").list(),u=ej((yield Promise.all([l(`func.name in (${s.map(t=>`"${t}"`).join(",")})`),l(a.join(" or "))])),2);return[...new Map([...u[0],...u[1]].map(t=>[t.id,t])).values()].filter(e=>n.some(n=>{var i,r,o,s;return t.isRunOf(n,e)&&((null==(i=e.options)?void 0:i[ek])===n.nqName||(null==(r=n.package)?void 0:r.name)===(null==(s=e.func)||null==(o=s.package)?void 0:o.name))}))})()},t.listSpace=l,t.listSpaceRuns=u,t.findNameConflict=function(t,e){return eN(function*(){return c((yield l(e)),t)})()},t.isRunOf=(t,e)=>{var n,i;return t.name===(null==(n=e.func)?void 0:n.name)||t.nqName===(null==(i=e.options)?void 0:i[ek])},t.sameRunName=(t,e)=>e_(t)===e_(e),t.isNamedSpaceItem=t=>"FuncCall"!==t.entityType&&"DataConnection"!==t.entityType,t.nameConflictIn=c,t.deleteRun=function(t){return eN(function*(){yield o(t),t.options.isDeleted=!0,yield tL.dapi.functions.calls.allPackageVersions().save(t)})()}}(ts||(ts={}));let eY=t=>{var e,n;if(null==(e=t.options)?void 0:e.default)return JSON.parse(null==(n=t.options)?void 0:n.default);let i=t.defaultValue;return t.propertyType===r.TYPE.STRING&&i?i.substring(1,i.length-1):i};function eG(t,e){e?(t_()(t).addClass("ui-box").css({width:"auto",height:"auto"}),tM.setUpdateIndicator(t,!0)):(tM.setUpdateIndicator(t,!1),t_()(t).removeClass("ui-box"))}function eZ(t,e,n,i,r,o,s){try{var a=t[o](s),l=a.value}catch(t){n(t);return}a.done?e(l):Promise.resolve(l).then(i,r)}function eJ(t){return function(){var e=this,n=arguments;return new Promise(function(i,r){var o=t.apply(e,n);function s(t){eZ(o,i,r,s,a,"next",t)}function a(t){eZ(o,i,r,s,a,"throw",t)}s(void 0)})}}function ez(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{},i=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(i=i.concat(Object.getOwnPropertySymbols(n).filter(function(t){return Object.getOwnPropertyDescriptor(n,t).enumerable}))),i.forEach(function(e){var i;i=n[e],e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i})}return t}function eQ(t,e){return e=null!=e?e:{},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):(function(t){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e.push.apply(e,n)}return e})(Object(e)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(e,n))}),t}class eq extends r.TableView{static fromComparedRuns(t,e){return eJ(function*(t,e,n){var i,o;let s,a,l,u,c,d=void 0===n?{parentView:void 0,parentCall:void 0}:n,p=(s=void 0===d?{parentView:void 0,parentCall:void 0}:d,a=[...e.inputs,...e.outputs].map(t=>eE(t)).reduce((t,e)=>(t[e.name]?t[e.name].push(...e.config):t[e.name]=e.config,t),{}),l=e=>{if(e.propertyType===r.TYPE.DATA_FRAME)return a[e.name].map(n=>{var i;let o=null!=(i=e.caption)?i:e.name,s=r.Column.fromType(r.TYPE.DATA_FRAME,o,t.length);s.init(n=>{var i;return null!=(i=t[n].inputs[e.name])?i:t[n].outputs[e.name]});let a=u.columns.getUnusedName(`${s.name} (${n.type})`);return s.name=a,o=a,s.temp[tQ]=n,u.columns.add(s),s});{var n;let i=null!=(n=e.caption)?n:e.name,o=r.Column.fromType(e.propertyType,i,t.length);o.init(n=>{var i;return null!=(i=t[n].inputs[e.name])?i:t[n].outputs[e.name]});let s=u.columns.getUnusedName(o.name);return o.name=s,i=s,u.columns.add(o),[o]}},u=r.DataFrame.create(t.length),c=[],t.forEach(t=>{let e=eV(t)||`${t.func.name} - ${eO(t)}`,n=2;for(;c.includes(e);)e=`${t.func.name} - ${eO(t)} - ${n}`,n++;c.push(e)}),u.columns.add(r.Column.fromStrings(tq,c)),u.name=(null==(i=s.parentCall)?void 0:i.func.name)?`${null==(o=s.parentCall)?void 0:o.func.name} - comparison`:`${e.name} - comparison`,e.inputs.forEach(t=>l(t)),e.outputs.forEach(t=>l(t)),tL.events.onCurrentObjectChanged.subscribe(t=>{let e=t.sender;if(e instanceof r.Column&&e.type===r.TYPE.DATA_FRAME&&tL.shell.tv&&tL.shell.tv.temp.isComparison&&[r.VIEWER.LINE_CHART,r.VIEWER.SCATTER_PLOT,r.VIEWER.HISTOGRAM,r.VIEWER.BOX_PLOT].includes(e.temp[tQ].type)){tL.shell.windows.showContextPanel=!0;let t=t=>{let e=t.get(0).clone();e.columns.addNew(tK,r.TYPE.STRING).init(t.dataFrame.get(tq,0));for(let n=1;n<t.length;n++){let i=t.get(n).clone();i.columns.addNew(tK,r.TYPE.STRING).init(t.dataFrame.get(tq,n));let o=[r.COLUMN_TYPE.INT,r.COLUMN_TYPE.FLOAT];for(let t=0;t<i.columns.length;t++){let n=i.columns.byIndex(t),s=e.columns.byIndex(t);n.type!==s.type&&o.includes(n.type)&&o.includes(s.type)&&(n.type!==r.COLUMN_TYPE.FLOAT&&i.columns.replace(n,n.convertTo(r.COLUMN_TYPE.FLOAT)),s.type!==r.COLUMN_TYPE.FLOAT&&e.columns.replace(s,s.convertTo(r.COLUMN_TYPE.FLOAT)))}e.append(i,!0)}return e},n=e.temp[tQ].look;setTimeout(()=>{switch(e.temp[tQ].type){case r.VIEWER.LINE_CHART:let i=tM.waitBox(()=>e$(function*(){var i;let r=null!=(i=e.temp.unitedDf)?i:t(e);return e.temp.unitedDf=r,r.plot.line(eH(eW({},n),{split:tK})).root})());t_()(i).css({width:"100%"}),tL.shell.o=i;break;case r.VIEWER.SCATTER_PLOT:let o=tM.waitBox(()=>e$(function*(){var i;let r=null!=(i=e.temp.unitedDf)?i:t(e);return e.temp.unitedDf=r,r.plot.scatter(eH(eW({},n),{color:tK})).root})());tL.shell.o=o,t_()(o).css({width:"100%"});break;case r.VIEWER.HISTOGRAM:let s=tM.waitBox(()=>e$(function*(){var i;let r=null!=(i=e.temp.unitedDf)?i:t(e);return e.temp.unitedDf=r,r.plot.histogram(eH(eW({},n),{split:tK})).root})());tL.shell.o=s,t_()(s).css({width:"100%"});break;case r.VIEWER.BOX_PLOT:let a=tM.waitBox(()=>e$(function*(){var i;let r=null!=(i=e.temp.unitedDf)?i:t(e);return e.temp.unitedDf=r,r.plot.box(eH(eW({},n),{category:tK})).root})());tL.shell.o=a,t_()(a).css({width:"100%"})}})}}),u),h=[...tL.shell.views].find(t=>t.type===tz||"scripts"===t.type||"functions"===t.type);return h&&(tL.shell.v=h),new this(p,d)}).apply(this,arguments)}showAllColumns(){let t=this.dataFrame.columns.names();this.grid.columns.setVisible(t)}showChangingColumns(){let t=this.dataFrame.columns.names().filter(t=>r.TYPES_SCALAR.has(this.dataFrame.getCol(t).type)&&this.dataFrame.getCol(t).categories.length>1||!r.TYPES_SCALAR.has(this.dataFrame.getCol(t).type));this.grid.columns.setVisible(t)}defaultCustomize(){let t=tM.iconFA("compress-alt",()=>{this.showChangingColumns(),t_()(e).show(),t_()(t).hide()},"Hide constant parameters"),e=tM.iconFA("expand-arrows-alt",()=>{this.showAllColumns(),t_()(e).hide(),t_()(t).show()},"Show all parameters");t_()(t).hide(),this.setRibbonPanels([...this.getRibbonPanels(),[t,e]]),this.showChangingColumns(),this.root.style.removeProperty("width"),this.root.firstChild.style.removeProperty("width"),this.root.firstChild.firstChild.style.removeProperty("width"),this.grid.props.rowHeight=180,this.grid.props.showAddNewRowIcon=!1,this.grid.props.allowEdit=!1,this.grid.columns.byName(tq).width=70;for(let t=0;t<this.grid.columns.length;t++){var n;let e=this.grid.columns.byIndex(t);(null==(n=e.column)?void 0:n.temp[tQ])&&(e.width=350,e.cellType="html")}let i=new r.LruCache;this.grid.onCellPrepare(t=>eJ(function*(){if(!t.isColHeader&&!t.isRowHeader){if(t.tableColumn.name===tq){t.customText="";let e=String(t.cell.value).split(" - "),n=e.length>1?[e[0],tM.element("br"),e[1]]:e;t.element=tM.div(n,{style:{writingMode:"vertical-rl",textOrientation:"mixed",margin:"auto"}}),t.element.parentElement.style.display="flex";return}if(t.tableColumn&&t.tableColumn.temp[tQ]){let e=t.cell.value,n=t.tableColumn.temp[tQ],o=n.type,s=`${e.id}_${o}`;if(i.get(s))t.element=i.get(s);else{let a=yield eJ(function*(){let i=Object.values(tJ).includes(o)?r.Viewer.fromType(o,e):yield e.plot.fromType(o);return t.tableColumn.temp[tQ].look?i.setOptions(t.tableColumn.temp[tQ].look):(i.setOptions(n),t.tableColumn.temp[tQ]=i.getOptions()),i.root})();i.set(s,a),t.element=a}t.element.style.width="100%",t.element.style.height="100%"}}})());let o=tM.box(tM.div([],{style:{minHeight:"100px"}})),s=tL.events.onCurrentViewChanged.subscribe(()=>{tL.shell.v.id===this.id?tL.shell.dockManager.dock(o,"down",null,"Comparison chart",.25):tL.shell.dockManager.close(o)}),a=this.grid.onCellClick.subscribe(t=>{var e;tL.shell.v.id===this.id&&t.isColHeader&&(null==(e=t.tableColumn)?void 0:e.type)===r.TYPE.DATA_FRAME&&[r.VIEWER.LINE_CHART,r.VIEWER.SCATTER_PLOT,r.VIEWER.HISTOGRAM,r.VIEWER.BOX_PLOT].includes(t.tableColumn.temp[tQ].type)?(tL.shell.dockManager.findNode(o)||tL.shell.dockManager.dock(o,"down",null,"Comparison chart",.25),tM.setUpdateIndicator(o,!0),setTimeout(()=>{if(!t.tableColumn.temp.unitedPlot){var e;let n=t.tableColumn.temp[tQ].look,i=(t=>{let e=r.toJs(t.get(0)).clone();e.columns.addNew(tK,r.TYPE.STRING).init(t.dataFrame.get(tq,0));for(let n=1;n<t.length;n++){let i=r.toJs(t.get(n)).clone();i.columns.addNew(tK,r.TYPE.STRING).init(t.dataFrame.get(tq,n));let o=[r.COLUMN_TYPE.INT,r.COLUMN_TYPE.FLOAT];for(let t=0;t<i.columns.length;t++){let n=i.columns.byIndex(t),s=e.columns.byIndex(t);n.type!==s.type&&o.includes(n.type)&&o.includes(s.type)&&(n.type!==r.COLUMN_TYPE.FLOAT&&i.columns.replace(n,n.convertTo(r.COLUMN_TYPE.FLOAT)),s.type!==r.COLUMN_TYPE.FLOAT&&e.columns.replace(s,s.convertTo(r.COLUMN_TYPE.FLOAT)))}e.append(i,!0)}return e})(t.tableColumn);t.tableColumn.temp.unitedPlot=((e,n,i)=>{var o;switch(null==(o=t.tableColumn)?void 0:o.temp[tQ].type){case r.VIEWER.LINE_CHART:return i.plot.line(eQ(ez({},n),{split:tK})).root;case r.VIEWER.SCATTER_PLOT:return i.plot.scatter(eQ(ez({},n),{color:tK})).root;case r.VIEWER.HISTOGRAM:return i.plot.histogram(eQ(ez({},n),{split:tK})).root;case r.VIEWER.BOX_PLOT:return i.plot.box(eQ(ez({},n),{category:tK})).root}})(null==(e=t.tableColumn)||e.temp[tQ].type,n,i),tM.setUpdateIndicator(o,!1)}tM.empty(o),o.appendChild(t.tableColumn.temp.unitedPlot)},10)):tL.shell.dockManager.close(o)});this.subs.push(a,s)}constructor(t,e){let n=void 0===e?{}:e;super(window.grok_TableView(t.dart,!1)),n.parentView&&(this.parentView=n.parentView),this.parentCall=n.parentCall||tL.functions.getCurrentCall()}}var eK=n(76),eX={};function e0(t,e,n,i,r,o,s){try{var a=t[o](s),l=a.value}catch(t){n(t);return}a.done?e(l):Promise.resolve(l).then(i,r)}function e9(t){return function(){var e=this,n=arguments;return new Promise(function(i,r){var o=t.apply(e,n);function s(t){e0(o,i,r,s,a,"next",t)}function a(t){e0(o,i,r,s,a,"throw",t)}s(void 0)})}}eX.styleTagTransform=ey(),eX.setAttributes=ep(),eX.insert=ec().bind(null,"head"),eX.domAPI=el(),eX.insertStyleElement=ef(),es()(eK.A,eX),eK.A&&eK.A.locals&&eK.A.locals;let e1="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";class e2 extends r.InputBase{get value(){return this.fileValue}set value(t){this.stringValue=(null==t?void 0:t.name)||"Drag-n-drop your file",this.fileValue=t,this.notify&&this.fireInput()}subscribeOnEvents(){this.input.readOnly=!0,this.input.classList.add("default");let t=t=>e9(function*(){if(t&&t.length&&this.enabled){if(t.length>1)throw this.isValid.next(!1),Error("Please specify single input file");if(this.fileType&&t[0].type!==this.fileType)throw this.isValid.next(!1),Error("File type is not supported");this.isValid.value?this.uploadedFile$.next(t[0]):this.uploadedFile$.next(null)}}).call(this);this.root.classList.add("fi-drop-area"),this.root.style.width="100%",this.hiddenInput.type="file",this.hiddenInput.addEventListener("change",()=>e9(function*(){return yield t(this.hiddenInput.files)}).call(this),!1),["dragenter","dragover","dragleave","drop"].forEach(t=>{this.input.addEventListener(t,t=>{t.preventDefault(),t.stopPropagation()},!1)}),["dragenter","dragover"].forEach(t=>{this.input.addEventListener(t,()=>{this.input.classList.add("drag-n-dropping")},!1)}),["dragleave","drop"].forEach(t=>{this.input.addEventListener(t,()=>{this.input.classList.remove("drag-n-dropping")},!1)}),this.input.addEventListener("drop",e=>e9(function*(){t(e.dataTransfer.files)})(),!1),this.input.addEventListener("click",()=>this.hiddenInput.click(),!1),this.addOptions(this.icon),["drag","dragenter"].forEach(t=>{document.getElementsByClassName("layout-workarea")[0].addEventListener(t,t=>{t.stopPropagation()},!1)})}reset(){this.input.classList.value="ui-input-editor default",this.hiddenInput.value="",this.uploadedFile$.next(null)}constructor(t,e,n,i){let r=void 0===i?e1:i;super(tM.input.string("Input file",{value:""}).dart),this.initialText=void 0===t?"Drag-n-drop here":t,this.initialValue=void 0===e?null:e,this.onValueChanged=void 0===n?null:n,this.fileType=r,this.uploadedFile$=new tU.Subject,this.onFileUploaded=this.uploadedFile$,this.fileValue=null,this.isValid=new tU.BehaviorSubject(!0),this.hiddenInput=document.createElement("input"),this.icon=tM.iconFA("cloud-upload",()=>this.hiddenInput.click(),"Upload"),this.subscribeOnEvents(),this.root.style.display="flex",this.isValid.subscribe(t=>{if(t){this.input.classList.remove("error"),this.input.classList.add("success");let t=tM.iconFA("times",()=>this.reset(),"Reset uploaded file");this.icon.replaceWith(t),this.icon=t}else{this.input.classList.remove("success"),this.input.classList.add("error");let t=tM.iconFA("redo",()=>this.hiddenInput.click(),"Re-upload a file");this.icon.replaceWith(t),this.icon=t}}),this.uploadedFile$.subscribe(t=>{if(this.onValueChanged&&this.onValueChanged(t),!t){let t=tM.iconFA("cloud-upload",()=>this.hiddenInput.click(),"Choose a file to upload");this.icon.replaceWith(t),this.icon=t}this.value=t}),this.reset()}}function e5(t,e,n,i,r,o,s){try{var a=t[o](s),l=a.value}catch(t){n(t);return}a.done?e(l):Promise.resolve(l).then(i,r)}let e6=t=>{switch(t){case"Today":return"started > -1d";case"Yesterday":return"started > -2d and started < -1d";case"Any time":return"";case"Last year":return"started > -2y and started < -1y";case"This year":return"started > -1y";case"Last month":return"started > -2m and started < -1m";case"This month":return"started > -1m";case"Last week":return"started > -2w and started < -1w";case"This week":return"started > -1w"}};function e4(t){var e;return(e=function*(t,e,n,i,o){let s=void 0===i?[]:i,a=void 0!==o&&o,l="";var u=!0,c=!1,d=void 0;try{for(var p,h=(void 0===e?[]:e)[Symbol.iterator]();!(u=(p=h.next()).done);u=!0){let t=p.value,e=[];t.author&&e.push(`session.user.id="${t.author.id}"`),t.date&&e.push(e6(t.date)),t.text&&e.push(`((options.title like "${t.text}") or (options.annotation like "${t.text}"))`),t.includeDeleted||e.push(eB);let n=e.join(" and ");""!==n&&(""===l?l+=`(${n})`:l+=` or (${n})`)}}catch(t){c=!0,d=t}finally{try{u||null==h.return||h.return()}finally{if(c)throw d}}""!==l&&(l=` and (${l})`);let f=yield tL.dapi.functions.calls.allPackageVersions().filter(`func.name="${t}"${l}`).include(`${[...s,"func.package"].join(",")}`).list(void 0===n?{}:n);if((s.includes("inputs")||s.includes("func.params"))&&!a){var m=!0,y=!1,v=void 0;try{for(var g,b=f[Symbol.iterator]();!(m=(g=b.next()).done);m=!0){let t=g.value,e=tj()(t.inputParams.values()).filter(e=>e.property.propertyType===r.TYPE.DATA_FRAME&&!!t.inputs[e.name]);var A=!0,C=!1,x=void 0;try{for(var w,I=e[Symbol.iterator]();!(A=(w=I.next()).done);A=!0){let e=w.value;t.inputs[e.name]=yield tL.dapi.tables.getTable(t.inputs[e.name])}}catch(t){C=!0,x=t}finally{try{A||null==I.return||I.return()}finally{if(C)throw x}}}}catch(t){y=!0,v=t}finally{try{m||null==b.return||b.return()}finally{if(y)throw v}}}if((s.includes("outputs")||s.includes("func.params"))&&!a){var R=!0,E=!1,T=void 0;try{for(var O,S=f[Symbol.iterator]();!(R=(O=S.next()).done);R=!0){let t=O.value,e=tj()(t.outputParams.values()).filter(e=>e.property.propertyType===r.TYPE.DATA_FRAME&&!!t.outputs[e.name]);var P=!0,k=!1,D=void 0;try{for(var F,V=e[Symbol.iterator]();!(P=(F=V.next()).done);P=!0){let e=F.value;t.outputs[e.name]=yield tL.dapi.tables.getTable(t.outputs[e.name])}}catch(t){k=!0,D=t}finally{try{P||null==V.return||V.return()}finally{if(k)throw D}}}}catch(t){E=!0,T=t}finally{try{R||null==S.return||S.return()}finally{if(E)throw T}}}return f},function(){var t=this,n=arguments;return new Promise(function(i,r){var o=e.apply(t,n);function s(t){e5(o,i,r,s,a,"next",t)}function a(t){e5(o,i,r,s,a,"throw",t)}s(void 0)})}).apply(this,arguments)}var e3=n(602),e8={};e8.styleTagTransform=ey(),e8.setAttributes=ep(),e8.insert=ec().bind(null,"head"),e8.domAPI=el(),e8.insertStyleElement=ef(),es()(e3.A,e8),e3.A&&e3.A.locals&&e3.A.locals;var e7=n(474),nt=n.n(e7);function ne(t,e,n,i,r,o,s){try{var a=t[o](s),l=a.value}catch(t){n(t);return}a.done?e(l):Promise.resolve(l).then(i,r)}function nn(t){return function(){var e=this,n=arguments;return new Promise(function(i,r){var o=t.apply(e,n);function s(t){ne(o,i,r,s,a,"next",t)}function a(t){ne(o,i,r,s,a,"throw",t)}s(void 0)})}}function ni(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{},i=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(i=i.concat(Object.getOwnPropertySymbols(n).filter(function(t){return Object.getOwnPropertyDescriptor(n,t).enumerable}))),i.forEach(function(e){var i;i=n[e],e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i})}return t}class nr extends r.Dialog{static forFuncCall(t,e){var n,i,r;let o=null!=(n=t.options.title)?n:"";return new nr({title:o,description:null!=(i=t.options.description)?i:"",tags:null!=(r=t.options.tags)?r:[],isFavorite:void 0!==e&&e})}awaitMetadata(t){let e=(0,tU.race)(this.onMetadataEdit,this.onClose.pipe((0,_.map)(()=>null))).pipe((0,_.take)(1));return this.show(ni({center:!0,width:500},t)),e.toPromise()}constructor(t){var e,n,i,o,s;super(tM.dialog({title:"Save model state"}).dart),e=this,this._onMetadataEdit=new tU.Subject,this.onMetadataEdit=this._onMetadataEdit.asObservable();let a=null!=(n=null==t?void 0:t.title)?n:"",l=null!=(i=null==t?void 0:t.description)?i:"",u=null!=(o=null==t?void 0:t.isFavorite)&&o;const c=tM.input.string("Title",{value:a,onValueChanged:t=>a=t}),d=tM.input.string(" ",{value:""}),p=r.TagEditor.create();(null!=(s=null==t?void 0:t.tags)?s:[]).forEach(t=>{p.addTag(t)}),d.input.replaceWith(p.root);const h=()=>{""===f.value||p.tags.includes(f.value)||(p.addTag(f.value),f.value="")},f=tM.input.string("Tag",{value:""}).addOptions(tM.iconFA("plus",h,"Add this tag")),m=(0,tU.fromEvent)(f.input,"onkeydown").subscribe(t=>{"Enter"==t.key&&(t.stopPropagation(),h())});this.sub(m);const y=tM.input.string("Description",{value:l,onValueChanged:t=>l=t}),v=tM.input.bool("Is favorite",{value:u,onValueChanged:t=>u=t});this.add(tM.form([c,y,v,f,d])),this.addButton("Save",()=>nn(function*(){if(""!==f.value)return void tL.shell.info(`Dialog has unsaved tags: ${f.value}`);let t={title:""!==a?a:null,description:""!==l?l:null,isFavorite:u,tags:p.tags.map(t=>t)};e._onMetadataEdit.next(t),e.close()})())}}class no extends r.Dialog{awaitDelete(t){let e=(0,tU.race)(this.onFuncCallDelete,this.onClose.pipe((0,_.map)(()=>null))).pipe((0,_.take)(1));return this.show(ni({center:!0,width:500},t)),e.toPromise()}constructor(t){var e;super(tM.dialog({title:`Delete ${t.size>1?t.size:""} ${t.size>1?"runs":"run"}`}).dart),e=this,this._onFuncCallDelete=new tU.Subject,this.onFuncCallDelete=this._onFuncCallDelete.asObservable(),this.add(tM.divText(`Deleted ${t.size>1?t.size:""} ${t.size>1?"runs":"run"} ${t.size>1?"are":"is"} impossible to restore. Are you sure?`)),this.onOK(()=>nn(function*(){return e._onFuncCallDelete.next(t)})())}}function ns(t,e,n,i,r,o,s){try{var a=t[o](s),l=a.value}catch(t){n(t);return}a.done?e(l):Promise.resolve(l).then(i,r)}function na(t){return function(){var e=this,n=arguments;return new Promise(function(i,r){var o=t.apply(e,n);function s(t){ns(o,i,r,s,a,"next",t)}function a(t){ns(o,i,r,s,a,"throw",t)}s(void 0)})}}let nl=(t,e)=>na(function*(){let n=`${t0}_${t.func.name}_Fav`;return e?tL.dapi.userDataStorage.postValue(n,t.id,""):tL.dapi.userDataStorage.remove(n,t.id)})(),nu=(t,e)=>{var n,i;return null!=(n=null!=(i=null==e?void 0:e.visibleProps)?i:ex(t.options,"mainParams"))?n:t.inputs.filter(t=>ee.includes(t.propertyType)).map(t=>t.name)},nc=t=>t.replace(/([A-Z])/g,t=>` ${t.toLowerCase()}`).trim().replace(/^./,t=>t.toUpperCase()),nd=(t,e)=>{var n,i,r,o,s,a,l;if(e===t6)return null!=(n=null==(l=t.author)?void 0:l.friendlyName)?n:" ";let u=null!=(i=null!=(r=null!=(o=null!=(s=t[e])?s:t.inputs[e])?o:t.outputs[e])?r:t.options[e])?i:null;return null!=(a=null==u?void 0:u.toString())?a:""},np="restrictedValues",nh="editState";(tt=ta||(ta={})).INPUT="Input",tt.OUTPUT="Output",(te=tl||(tl={})).HIDDEN="hidden",te.VISIBLE="visible",(tn=tu||(tu={})).ENABLED="enabled",tn.DISABLED="disabled",(ti=tc||(tc={})).INPUTS="inputs",ti.OUTPUTS="outputs";let nf={[tc.INPUTS]:"inputParams",[tc.OUTPUTS]:"outputParams"};function nm(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=Array(e);n<e;n++)i[n]=t[n];return i}function ny(t,e,n,i,r,o,s){try{var a=t[o](s),l=a.value}catch(t){n(t);return}a.done?e(l):Promise.resolve(l).then(i,r)}function nv(t){return function(){var e=this,n=arguments;return new Promise(function(i,r){var o=t.apply(e,n);function s(t){ny(o,i,r,s,a,"next",t)}function a(t){ny(o,i,r,s,a,"throw",t)}s(void 0)})}}function ng(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n,i,r=null==t?null:"u">typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var o=[],s=!0,a=!1;try{for(r=r.call(t);!(s=(n=r.next()).done)&&(o.push(n.value),!e||o.length!==e);s=!0);}catch(t){a=!0,i=t}finally{try{s||null==r.return||r.return()}finally{if(a)throw i}}return o}}(t,e)||function(t,e){if(t){if("string"==typeof t)return nm(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if("Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return nm(t,e)}}(t,e)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function nb(t){return t.dart&&r.toJs(t.dart)instanceof r.InputBase}let nA=t=>nv(function*(){let e=t.id,n=r.Func.byName(t.func.nqName).prepare([...t.inputs].reduce((t,e)=>{let n=ng(e,2),i=n[0],r=n[1];return t[i]=r,t},{}));return t.options.forEach(e=>n.options[e]=t.options[e]),e||(n.id=null),n})();function nC(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=Array(e);n<e;n++)i[n]=t[n];return i}function nx(t,e,n,i,r,o,s){try{var a=t[o](s),l=a.value}catch(t){n(t);return}a.done?e(l):Promise.resolve(l).then(i,r)}function nw(t){return function(){var e=this,n=arguments;return new Promise(function(i,r){var o=t.apply(e,n);function s(t){nx(o,i,r,s,a,"next",t)}function a(t){nx(o,i,r,s,a,"throw",t)}s(void 0)})}}function nI(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{},i=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(i=i.concat(Object.getOwnPropertySymbols(n).filter(function(t){return Object.getOwnPropertyDescriptor(n,t).enumerable}))),i.forEach(function(e){var i;i=n[e],e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i})}return t}tp().extend(nt());let nR=new r.LruCache;class nE extends r.Widget{get type(){return"HistoricalRunsList"}get onRunsDfChanged(){return this._onRunsDfChanged.asObservable()}get onChosen(){return this._onChosen.asObservable()}get chosen(){return this._onChosen.value}set chosen(t){var e;this.chosenById=null!=(e=null==t?void 0:t.id)?e:null}set chosenById(t){if(!t){this.currentDf.currentRowIdx=-1;return}for(let e=0;e<this.currentDf.rowCount;e++)if(this.currentDf.getCol("ID").get(e)===t){this.currentDf.currentRowIdx=e;break}}get selected(){return this._onSelectedChanged.value}get runs(){return this.onRunsChanged.value}get onSelectedChanged(){return this._onSelectedChanged.asObservable()}getRunByIdx(t){return this.runs.get(this.currentDf.get("ID",t))}showEditDialog(t,e){let n=nr.forFuncCall(t,e);n.onMetadataEdit.pipe((0,_.take)(1)).subscribe(n=>nw(function*(){var i;if(null==(i=this.options)?void 0:i.isHistory)try{!!n.isFavorite!==e&&(yield nl(t,!!n.isFavorite));let i=yield ts.shallowLoadRun(t.id);n.title&&(i.options.title=n.title),n.description&&(i.options.description=n.description),n.tags&&(i.options.tags=n.tags),yield ts.updateRunMeta(i),this.updateRun(i),this.onMetadataEdit.next(i)}catch(t){tL.shell.error(t)}else this.updateRun(t)}).call(this)),n.show({center:!0,width:500})}isFavoriteByIndex(t){return this.currentDf.get(t1,t)}setGridCellRendering(){var t,e,n,i,r;let o=t=>{let e=this.getRunByIdx(t.tableRowIndex);this.showEditDialog(e,this.isFavoriteByIndex(t.tableRowIndex))},s=t=>{let e=new Set([this.getRunByIdx(t.tableRowIndex)]),n=new no(e);n.onFuncCallDelete.pipe((0,_.take)(1)).subscribe(()=>nw(function*(){tM.setUpdateIndicator(this.root,!0);try{yield Promise.all(tj()(e.values()).map(t=>nw(function*(){return yield this.deleteRun(t.id),Promise.resolve()}).call(this)))}catch(t){tL.shell.error(t)}finally{tM.setUpdateIndicator(this.root,!1)}}).call(this)),n.show({center:!0,width:500})},a=t=>{let e=this.getRunByIdx(t.tableRowIndex);nl(e,!0).then(()=>this.updateRun(e))},l=t=>{let e=this.getRunByIdx(t.tableRowIndex);nl(e,!1).then(()=>this.updateRun(e))};n=this._historyGrid,i=this.runs,r=null!=(t=null==(e=this.options)?void 0:e.showActions)&&t,n.onCellPrepare(t=>{var e,u,c,d,p,h,f,m,y,v;if(t.isColHeader&&(null==(e=t.tableColumn)?void 0:e.name)&&[t5,t9,t1].includes(t.tableColumn.name)&&(t.customText=""),!t.isColHeader){if((null==(u=t.tableColumn)?void 0:u.name)===t5&&(t.customText="",t.element=tM.divH([tM.iconFA("trash",()=>s(t),"Remove run from history"),tM.iconFA("edit",()=>o(t),"Edit run metadata")],{style:{padding:"6px",gap:"6px",justifyContent:"space-between"}})),(null==(c=t.tableColumn)?void 0:c.name)===t1){t.customText="";let e=tM.iconFA("star",()=>l(t),"Unfavorite");t_()(e).addClass("fas"),t.element=tM.div(t.cell.value?e:tM.iconFA("star",()=>a(t),"Favorite"),{style:{padding:"6px"}})}if((null==(d=t.tableColumn)?void 0:d.name)===t9){t.customText="";let e=tM.iconFA("flask",null,"Experimental run");t_()(e).addClass("fad fa-sm"),t_()(e).removeClass("fal"),t.element=t.cell.value&&"Experimental"===t.cell.value?tM.div(e,{style:{padding:"6px"}}):tM.div()}if((null==(p=t.tableColumn)?void 0:p.name)===t7){t.customText="";let e=t.cell.value.length>0?tM.div(null==(f=t.cell.value)?void 0:f.split(",").map(t=>tM.span([t],"d4-tag")),"d4-tag-editor"):tM.div();t_()(e).css({padding:"3px","background-color":"transparent"}),t.element=e}if((null==(h=t.tableColumn)?void 0:h.name)==="ID"){let e,u;t.customText="";let c=(e=t.tableRowIndex,i.get(n.dataFrame.get("ID",e)));if(!c)return;let d=c.author.picture;t_()(d).css({width:"25px",height:"25px",fontSize:"20px"}),tM.bind(c.author,d);let p=tM.iconFA("flask",null,"Experimental run");p.classList.add("fad","fa-sm"),p.classList.remove("fal"),p.style.marginLeft="3px";let h=c.options.immutable_tags,f=tM.span([tM.label(null!=(m=null!=(y=c.options.title)?y:null==(v=c.author)?void 0:v.friendlyName)?m:tL.shell.user.friendlyName,{style:{color:"var(--blue-1)"}}),...h&&h.includes(tX)?[p]:[]]),g=tM.iconFA("edit",e=>{e.stopPropagation(),o(t)},"Edit run metadata");g.classList.add("hp-funccall-card-icon","hp-funccall-card-hover-icon");let b=tM.iconFA("trash-alt",e=>na(function*(){e.stopPropagation(),s(t)})(),"Delete run");b.classList.add("hp-funccall-card-icon","hp-funccall-card-hover-icon");let A=tM.iconFA("star",e=>{e.stopPropagation(),l(t)},"Unfavorite");A.classList.add("fas","hp-funccall-card-icon");let C=tM.iconFA("star",e=>{e.stopPropagation(),a(t)},"Favorite");C.classList.add("hp-funccall-card-icon","hp-funccall-card-hover-icon"),(u=t.tableRowIndex,n.dataFrame.get(t1,u))?(tM.setDisplay(C,!1),tM.setDisplay(A,!0)):(tM.setDisplay(A,!1),tM.setDisplay(C,!0));let x=eO(c),w=tM.divH([tM.divH([d,tM.divV([f,tM.span([x]),...c.options.tags&&c.options.tags.length>0?[tM.div(c.options.tags.map(t=>tM.span([t],"d4-tag")))]:[]],"hp-card-content")]),tM.divH([...r?[A,C,g,b]:[]])],"hp-funccall-card"),I=t.tableRowIndex;w.addEventListener("mouseover",()=>{t.grid.dataFrame.mouseOverRowIdx=I}),w.addEventListener("click",e=>{e.shiftKey?t.grid.dataFrame.selection.set(I,!0):e.ctrlKey?t.grid.dataFrame.selection.set(I,!1):t.grid.dataFrame.currentRowIdx=I}),t.element=w}}})}deleteRun(t){return nw(function*(){return ts.shallowLoadRun(t).then(t=>nw(function*(){var e;return[(yield(null==(e=this.options)?void 0:e.isHistory)?ts.deleteRun(t):Promise.resolve()),t]}).call(this)).then(e=>{var n;let i=(function(t){if(Array.isArray(t))return t}(e)||function(t){var e,n,i=null==t?null:"u">typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=i){var r=[],o=!0,s=!1;try{for(i=i.call(t);!(o=(e=i.next()).done)&&(r.push(e.value),2!==r.length);o=!0);}catch(t){s=!0,n=t}finally{try{o||null==i.return||i.return()}finally{if(s)throw n}}return r}}(e)||function(t){if(t){if("string"==typeof t)return nC(t,2);var e=Object.prototype.toString.call(t).slice(8,-1);if("Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e)return Array.from(e);if("Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e))return nC(t,2)}}(e)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())[1];return this.runs.delete(t),this.onRunsChanged.next(this.runs),(null==(n=this.options)?void 0:n.isHistory)&&this.onDelete.next(i),i}).then(t=>{nl(t,!1)}).catch(t=>{tL.shell.error(t)})}).call(this)}editRun(t){this.showEditDialog(t,!1)}updateRun(t){this.runs.set(t.id,t),this.onRunsChanged.next(this.onRunsChanged.value)}addRun(t){this.runs.set(t.id,t),this.onRunsChanged.next(this.onRunsChanged.value)}updateRuns(t){this.onRunsChanged.next(t.reduce((t,e)=>(t.set(e.id,e),t),new Map))}get isFilterHidden(){return this._isFilterHidden.value}set isFilterHidden(t){this._isFilterHidden.next(t)}get compactMode(){return this._compactMode.value}set compactMode(t){this._compactMode.next(t)}get onCompactModeChanged(){return this._compactMode.asObservable()}styleHistoryGrid(){var t;((t,e,n,i,o,s)=>{var a;let l,u,c,d,p,h;s&&t.setOptions({showCurrentRowIndicator:!0,showCurrentCellOutline:!1,allowEdit:!1,allowBlockSelection:!1,showRowHeader:!1,showColumnLabels:!e,extendLastColumn:e}),t.sort([t4],[!1]);for(let e=0;e<t.columns.length;e++){let n=t.columns.byIndex(e);n&&(null==(a=n.column)?void 0:a.type)===r.TYPE.DATE_TIME&&(n.format="MMM d, h:mm tt")}if((l=t.columns.byName(t5))&&(l.cellType="html",l.width=45),(u=t.columns.byName(t1))&&(u.cellType="html",u.width=30),(c=t.columns.byName(t9))&&(c.cellType="html",c.width=30),(d=t.columns.byName(t7))&&(d.cellType="html",d.width=90),(p=t.columns.byName(t4))&&(p.width=110),(h=t.columns.byName("ID"))&&(h.cellType="html"),e)t.columns.setVisible(["ID"]),t.props.rowHeight=70,t.invalidate();else{t.props.rowHeight=28;let e=t.dataFrame.getCol(t7);t.columns.setVisible([t9,t1,t5,...i?[t4]:[],...i?[t6]:[],...i&&e.stats.missingValueCount<e.length?[t7]:[],...i?[t3]:[],...i?[t8]:[],...n&&o?nu(o).map(t=>{var e,n;let i=null!=(e=o.inputs.find(e=>e.name===t))?e:o.outputs.find(e=>e.name===t);return i?null!=(n=i.caption)?n:nc(i.name):nc(t)}):[]])}})(this._historyGrid,this._compactMode.value,this.showInputsIcon.value,this.showMetadataIcon.value,null==(t=this.runs.values().next().value)?void 0:t.func)}get currentDf(){return this._onRunsDfChanged.value}styleHistoryFilters(){var t,e,n,i,r,o,s,a,l;let u,c,d,p=null==(e=this.runs.values().next().value)?void 0:e.func;(i=this._historyFilters,r=this.showMetadataIcon.value,o=this.showInputsIcon.value,s=null!=(t=null==(n=this.options)?void 0:n.isHistory)&&t,c=(u=i.dataFrame).getCol(t7),(d=[...r&&u.getCol(t9).categories.length>1?[t9]:[],...r&&(null!=(a=null==(l=u.col(t1))?void 0:l.categories.length)?a:0)>1?[t1]:[],...r?[t4,t2]:[],...r&&u.getCol(t6).categories.length>1?[t6]:[],...r&&c.stats.missingValueCount<c.length?[t7]:[],...r&&u.getCol(t3).categories.length>1?[t3]:[],...r&&u.getCol(t8).categories.length>1?[t8]:[],...p&&o?nu(p).map(t=>{var e,n;let i=null!=(e=p.inputs.find(e=>e.name===t))?e:p.outputs.find(e=>e.name===t);return i?null!=(n=i.caption)?n:nc(i.name):nc(t)}).filter(t=>!s||u.getCol(t).categories.length>1).map(t=>t):[]]).length>0?(tM.setDisplay(i.root,!0),i.setOptions({columnNames:d,showHeader:!1,showBoolCombinedFilter:!0})):tM.setDisplay(i.root,!1),d.length>0)?(t_()(this.filterWithText).css({paddingTop:"10px"}),tM.setDisplay(this.defaultFiltersText,!1)):tM.setDisplay(this.defaultFiltersText,!0)}redrawSelectionState(){let t=this.currentDf.selection.trueCount;t<2?this.compareIcon.firstChild.classList.add("hp-disabled"):this.compareIcon.firstChild.classList.remove("hp-disabled"),0===t?this.trashIcon.firstChild.classList.add("hp-disabled"):this.trashIcon.firstChild.classList.remove("hp-disabled")}constructor(t,e){var n,i,o,s,a,l,u,c;super(tM.div([],{style:{height:"100%",width:"100%"}})),n=this,this.initialRuns=t,this.options=e,this.onRunsChanged=new tU.BehaviorSubject(this.initialRuns.reduce((t,e)=>(t.set(e.id,e),t),new Map)),this._onRunsDfChanged=new tU.BehaviorSubject(r.DataFrame.fromColumns([r.Column.bool(t9,0),...(null==(s=this.options)?void 0:s.isHistory)?[r.Column.bool(t1,0)]:[],...(null==(a=this.options)?void 0:a.showActions)?[r.Column.string(t5,0)]:[],r.Column.bool(t2,0),r.Column.dateTime(t4,0),r.Column.string(t6,0),r.Column.string(t7,0),r.Column.string(t3,0),r.Column.string(t8,0),r.Column.fromStrings("ID",[])])),this._historyFilters=r.Viewer.filters(this._onRunsDfChanged.value,{title:"Filters",columnNames:[]}),this._historyGrid=r.Viewer.grid(this._onRunsDfChanged.value,{showRowHeader:!1,showColumnGridlines:!1,allowEdit:!1}),this.onComparisonCalled=new tU.Subject,this.onMetadataEdit=new tU.Subject,this._onChosen=new tU.BehaviorSubject(null),this.onDelete=new tU.Subject,this._onSelectedChanged=new tU.BehaviorSubject(new Set([])),this.layout=tM.splitH([],null,!0),this.defaultGridText=tM.divText(null!=(i=null==(l=this.options)?void 0:l.fallbackText)?i:"No historical runs found","hp-no-elements-label"),this.defaultFiltersText=tM.divText("No filters to show","hp-no-elements-label"),this.filterWithText=tM.divH([this.defaultFiltersText,this._historyFilters.root],"ui-box"),this.trashIcon=tM.div(tM.iconFA("trash-alt",()=>{let t=this.currentDf.selection.getSelectedIndexes(),e=new Set;t.forEach(t=>e.add(this.getRunByIdx(t)));let i=new no(e);i.onFuncCallDelete.pipe((0,_.take)(1)).subscribe(t=>nw(function*(){tM.setUpdateIndicator(n.root,!0);try{yield Promise.all(tj()(t.values()).map(t=>nw(function*(){return yield n.deleteRun(t.id),Promise.resolve()})()))}catch(t){tL.shell.error(t)}finally{tM.setUpdateIndicator(n.root,!1)}})()),i.show({center:!0,width:500,modal:!0})},"Delete selected runs"),{style:{paddingTop:"5px"}}),this.compareIcon=tM.div(tM.iconFA("exchange",()=>nw(function*(){let t=n.currentDf.selection.getSelectedIndexes(),e=[];t.forEach(t=>{e.push(n.currentDf.getCol("ID").get(t))}),n.onComparisonCalled.next(e)})(),"Compare selected runs"),{style:{paddingTop:"5px"}}),this._isFilterHidden=new tU.BehaviorSubject(!1),this.showFiltersIcon=tM.div(tM.iconFA("filter",()=>{this._isFilterHidden.next(!this._isFilterHidden.value)},"Toggle filters"),{style:{paddingTop:"4px"}}),this._compactMode=new tU.BehaviorSubject(null!=(o=null==(u=this.options)?void 0:u.isHistory)&&o),this.toggleCompactMode=tM.div(tM.iconFA("expand-alt",()=>{this.compactMode=!this.compactMode},"Toggle compact mode"),{style:{paddingTop:"4px"}}),this.showMetadataIcon=tM.input.toggle("Metadata",{value:!0,onValueChanged:()=>{this.styleHistoryGrid(),this.styleHistoryFilters()}}),this.showInputsIcon=tM.input.toggle("Params",{value:!1,onValueChanged:t=>nw(function*(){var e;0!==n.runs.size&&(t&&(null==(e=n.options)?void 0:e.isHistory)?((yield Promise.all([...n.runs.values()].map(t=>nw(function*(){if(nR.has(t.id))return nR.get(t.id);{let e=yield ts.shallowLoadRun(t.id);return nR.set(e.id,e),e}})()))).forEach(t=>{n.runs.set(t.id,t)}),n.onRunsChanged.next(n.runs)):(n.styleHistoryGrid(),n.styleHistoryFilters()))})()});const d=tM.divH([tM.divH([...(null==e?void 0:e.isHistory)?[this.toggleCompactMode]:[],this.showFiltersIcon,this.showMetadataIcon.root,this.showInputsIcon.root],{style:{gap:"5px",padding:"5px"}}),tM.divH((null==(c=this.options)?void 0:c.showBatchActions)?[this.trashIcon,this.compareIcon]:[],{style:{gap:"5px",padding:"5px"}})],{style:{justifyContent:"space-between",padding:"0px 5px"}});d.style.setProperty("overflow-y","hidden","important");const p=tM.divV([this.defaultGridText,d,this._historyGrid.root],"ui-box");t_()(p).removeClass("ui-div"),t_()(p).css("width","100%"),this.root.appendChild(this.layout),tM.setDisplayAll([this._historyGrid.root,this._historyFilters.root,this.toggleCompactMode,this.trashIcon,this.compareIcon,this.showFiltersIcon],!1);const h=this.onRunsChanged.subscribe(t=>nw(function*(){if(n.setGridCellRendering(),t.size>0){let e,i,o=yield(e=t.values().next().value.func,i=n.options,na(function*(){var n;let o=[...t.values()],s=t=>t===t4?r.Column.dateTime(nc(t),o.length).init(t=>window.grok_DayJs_To_DateTime(ew(o[t])?o[t].started.utc(!0):tp().unix(o[t].options.createdOn))):t===t2?r.Column.bool(nc(t),o.length).init(t=>!eI(o[t])):r.Column.fromStrings(nc(t),o.map(e=>{var n,r,o;return null!=(n=null==i||null==(o=i.propFuncs)||null==(r=o[t])?void 0:r.call(o,e))?n:nd(e,t)})),a=Object.keys(null!=(n=yield tL.dapi.userDataStorage.get(`${t0}_${e.name}_Fav`))?n:{}),l=r.DataFrame.fromColumns([r.Column.string(t9,o.length).init(t=>{let e=o[t].options.immutable_tags;return e&&e.includes(tX)?"Experimental":"Simulated"}),...(null==i?void 0:i.isHistory)?[r.Column.bool(t1,o.length).init(t=>a.includes(o[t].id))]:[],...(null==i?void 0:i.showActions)?[r.Column.string(t5,o.length).init("")]:[],s(t4),s(t2),s(t6),r.Column.string(t7,o.length).init(t=>o[t].options.tags?o[t].options.tags.join(","):""),r.Column.string(t3,o.length).init(t=>o[t].options.title),r.Column.string(t8,o.length).init(t=>o[t].options.description),r.Column.string(et,o.length).init(t=>o[t].options.version)]);if(nu(e).map(t=>(t=>{var n,a,l;let u=null!=(n=e.inputs.find(e=>e.name===t))?n:e.outputs.find(e=>e.name===t);return u?u.propertyType===r.TYPE.DATE_TIME?r.Column.dateTime(null!=(l=u.caption)?l:nc(u.name),o.length).init(t=>window.grok_DayJs_To_DateTime(o[t].inputs[u.name])):r.Column.fromType(u.propertyType,null!=(a=u.caption)?a:nc(u.name),o.length).init(t=>{var e,n,r;return null!=(e=null==i||null==(r=i.propFuncs)||null==(n=r[u.name])?void 0:n.call(r,o[t]))?e:nd(o[t],u.name)}):s(t)})(t)).forEach(t=>{t.name=l.columns.getUnusedName(t.name),l.columns.add(t,!1)}),l.columns.add(r.Column.fromStrings("ID",o.map(t=>t.id))),!(null==i?void 0:i.allowOtherVersions)&&(null==i?void 0:i.version)){let t=r.BitSet.create(l.rowCount,()=>!1);for(let e=0;e<l.rowCount;e++)(null==i?void 0:i.version)==l.get(et,e)&&t.set(e,!0);return l.clone(t)}return l})()),s=t.values().next().value.func;tM.setDisplayAll([n.defaultGridText,n.defaultFiltersText],!1),tM.setDisplayAll([n._historyGrid.root,n._historyFilters.root,n.toggleCompactMode,n.showMetadataIcon.root,n.trashIcon,n.compareIcon,n.showFiltersIcon],!0),tM.setDisplay(n.showInputsIcon.root,nu(s,n.options).length>0),n._onRunsDfChanged.next(o)}else tM.setDisplayAll([n.defaultGridText,n.defaultFiltersText],!0),tM.setDisplayAll([n._historyGrid.root,n._historyFilters.root,n.showMetadataIcon.root,n.showInputsIcon.root,n.toggleCompactMode,n.trashIcon,n.compareIcon,n.showFiltersIcon],!1)})()),f=this._onRunsDfChanged.subscribe(t=>{this._historyFilters.dataFrame=t,this._historyGrid.dataFrame=t,this.currentDf.getCol(t7).meta.multiValueSeparator=",",this.styleHistoryGrid(),this.styleHistoryFilters();let e=t.onCurrentRowChanged.subscribe(()=>{var t;this.currentDf.rows.select(()=>!1),this._onChosen.next(null!=(t=this.getRunByIdx(this.currentDf.currentRowIdx))?t:null)}),n=t.onSelectionChanged.subscribe(()=>{let e=[...t.selection.getSelectedIndexes()].map(t=>this.getRunByIdx(t));this._onSelectedChanged.next(new Set(e)),this.redrawSelectionState()});this.redrawSelectionState(),this.subs.push(e,n)}),m=this._isFilterHidden.subscribe(t=>{t?(t_()(this.showFiltersIcon.firstChild).addClass("fal"),t_()(this.showFiltersIcon.firstChild).removeClass("fad"),tM.setDisplay(this.filterWithText,!1)):(t_()(this.showFiltersIcon.firstChild).addClass("fad"),t_()(this.showFiltersIcon.firstChild).removeClass("fal"),t_()(this.filterWithText).css(this.compactMode?"height":"width","320px"),t_()(this.filterWithText).css(this.compactMode?"width":"height","100%"),tM.setDisplay(this.filterWithText,!0))}),y=this._compactMode.subscribe(t=>{let e=[p,this.filterWithText];t_()(this.filterWithText).removeClass("ui-div");let n={style:{width:"100%",height:"100%"}};t_()(this.toggleCompactMode.firstChild).addClass(t?"fa-expand-alt":"fa-compress-alt"),t_()(this.toggleCompactMode.firstChild).removeClass(t?"fa-compress-alt":"fa-expand-alt");let i=t?tM.splitV(e,n,!0):tM.splitH(e,n,!0);this.layout.replaceWith(i),this.layout=i,tM.tools.waitForElementInDom(this.layout).then(t=>{t_()(t).css(this.compactMode?"height":"width","100%"),t_()(this._historyFilters.root).css(nI({},this.compactMode?{width:"100%"}:{height:"100%"})),t_()(this.filterWithText).css(nI({},this.compactMode?{height:"310px",width:"100%"}:{width:"310px",height:"100%"})),t_()(p).css(nI({},this.compactMode?{width:"100%"}:{height:"100%"})),setTimeout(()=>{this.styleHistoryGrid(),this.styleHistoryFilters()},100)})});this.subs.push(h,y,f,m)}}function nT(t,e,n,i,r,o,s){try{var a=t[o](s),l=a.value}catch(t){n(t);return}a.done?e(l):Promise.resolve(l).then(i,r)}function nO(t){return function(){var e=this,n=arguments;return new Promise(function(i,r){var o=t.apply(e,n);function s(t){nT(o,i,r,s,a,"next",t)}function a(t){nT(o,i,r,s,a,"throw",t)}s(void 0)})}}class nS{static getHistoryRuns(t,e){let n=void 0===e||e;return(0,tU.from)(nO(function*(){return yield e4(t,[{author:tL.shell.user}],{order:"started"},["func.params","session.user","options"],n)})())}}class nP extends r.InputBase{setCurrentRow(){this.getValue()?this._historyList.chosen=this.getValue():this.chosenRunId&&(this._historyList.chosenById=this.chosenRunId)}showSelectionDialog(){this.renderGridAndFilters(),this._historyDialog.getButton("OK").disabled=1!==this._historyList.selected.size,this._historyDialog.show({modal:!0,fullScreen:!0,center:!0,width:window.innerWidth-50,height:window.innerHeight-50})}renderGridAndFilters(){var t,e,n,i;let r=new nE([...this._historyList.runs.values()],(n=function(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{},i=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(i=i.concat(Object.getOwnPropertySymbols(n).filter(function(t){return Object.getOwnPropertyDescriptor(n,t).enumerable}))),i.forEach(function(e){var i;i=n[e],e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i})}return t}({},this.options),i=i={visibleProps:null==(t=this.options)?void 0:t.mainProps,propFuncs:null==(e=this.options)?void 0:e.propFuncs},Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(i)):(function(t){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e.push.apply(e,n)}return e})(Object(i)).forEach(function(t){Object.defineProperty(n,t,Object.getOwnPropertyDescriptor(i,t))}),n));this._historyList.root.replaceWith(r.root),this._historyList=r,this._historyList.onChosen.subscribe(t=>{this._historyDialog.getButton("OK").disabled=!t}),this._historyList.onRunsDfChanged.pipe((0,_.filter)(t=>t.rowCount>0),(0,_.take)(1)).subscribe(()=>{this.setCurrentRow()})}getHistoryDialog(){let t=tM.dialog();return t_()(t.root.querySelector(".d4-dialog-contents")).removeClass("ui-form"),t.onOK(()=>nO(function*(){let t=this._historyList.chosen;if(t){var e,n;(null==(e=null==(n=this.options)?void 0:n.skipDfsOnInit)||e)&&(t=yield ts.loadRun(t.id)),this.setValue(t)}this.fireInput()}).call(this)),t.addButton("Refresh",()=>{this.experimentRunsUpdate.next()},2,"Reload list of runs"),t.addButton("Discard",()=>{this.setValue(null),this.fireInput(),t.close()},1,"Discard the previous choice"),t_()(t.getButton("CANCEL")).hide(),t.add(this._historyList.root),t}setValue(t){var e,n,i,r,o,s,a;(this._chosenRun=t,this._chosenRunId=null!=(e=null==(n=this._chosenRun)?void 0:n.id)?e:null,this.onHistoricalRunChosen.next(t),t)?this.stringValue=(null==(o=this.options)?void 0:o.stringValueFunc)?null==(s=this.options)?void 0:s.stringValueFunc(t):[`${eO(t)} \\ ${t.author.name}`,(null!=(i=null!=(r=null==(a=this.options)?void 0:a.mainProps)?r:ex(t.func.options,"mainParams"))?i:[]).map(e=>nd(t,e)).join(" \\ ")].join(" \\ "):this.stringValue="No run chosen",this.notify&&this.fireChanged()}getValue(){return this._chosenRun}get chosenRun(){return this._chosenRun}get chosenRunId(){return this._chosenRunId}set chosenRunId(t){this._chosenRunId=t}get root(){return this._visibleInput.root}set stringValue(t){this._visibleInput.value=t,this._visibleInput.setTooltip(this._visibleInput.value)}get stringValue(){return this._visibleInput.value}get iconRoot(){return this._visibleIcon}toggleLoaderExpRuns(t){this.store.isExperimentRunsLoading.next(t)}constructor(t,e,n){var i,r;const o=tM.input.string(t,{value:""});super(o.dart),this.label=t,this._funcName=e,this.options=n,this.onHistoricalRunChosen=new tU.BehaviorSubject(null),this.experimentRunsUpdate=new tU.Subject,this.store={experimentRuns:new tU.Observable,isExperimentRunsLoading:new tU.Subject,experimentRunData:new tU.BehaviorSubject("")},this._historyList=new nE([],{fallbackText:"No runs are found in history",showActions:!1,showBatchActions:!1,isHistory:!1,visibleProps:null==(i=this.options)?void 0:i.mainProps,propFuncs:null==(r=this.options)?void 0:r.propFuncs}),this._historyDialog=this.getHistoryDialog(),this._visibleInput=tM.input.string(this.label,{value:""}),this._visibleIcon=tM.iconFA("search",()=>this.showSelectionDialog(),"Search"),this._chosenRun=null,this._chosenRunId=null,this._visibleInput=o,this._visibleInput.readOnly=!0,this._visibleInput.input.addEventListener("click",()=>this.showSelectionDialog()),this._visibleInput.addOptions(this._visibleIcon),this.store.experimentRuns=this.experimentRunsUpdate.pipe((0,_.tap)(()=>this.toggleLoaderExpRuns(!0)),(0,_.switchMap)(()=>{var t,e;return nS.getHistoryRuns(this._funcName,null==(t=null==(e=this.options)?void 0:e.skipDfsOnInit)||t).pipe((0,_.catchError)(t=>(console.error(t),tU.EMPTY)),(0,_.finalize)(()=>this.toggleLoaderExpRuns(!1)))}),(0,_.shareReplay)(1)),this.store.experimentRuns.subscribe(t=>{this._historyList.updateRuns(t.filter(t=>!eI(t)))}),this.store.isExperimentRunsLoading.subscribe(t=>{tM.setUpdateIndicator(this._visibleInput.root,t),tM.setUpdateIndicator(this._historyList.root,t)}),this.experimentRunsUpdate.next()}}class nk extends nP{set value(t){this.setValue(t)}get value(){return this.getValue()}}class nD extends nP{get value(){let t=this.getValue();return t?JSON.stringify({visualValue:this.stringValue,id:t.id.split("-")}):null}set value(t){this.setValue(null),this.stringValue=t?JSON.parse(t).visualValue:"No run is chosen",this.chosenRunId=t?JSON.parse(t).id.join("-"):""}}var nF=n(128),nV={};function nL(t,e,n,i,r,o,s){try{var a=t[o](s),l=a.value}catch(t){n(t);return}a.done?e(l):Promise.resolve(l).then(i,r)}nV.styleTagTransform=ey(),nV.setAttributes=ep(),nV.insert=ec().bind(null,"head"),nV.domAPI=el(),nV.insertStyleElement=ef(),es()(nF.A,nV),nF.A&&nF.A.locals&&nF.A.locals;class nM extends r.Widget{get type(){return"HistoryPanel"}updateHistoryPane(t){this.historyList.updateRuns(t)}showEditDialog(t){this.historyList.editRun(t)}addRun(t){this.historyList.addRun(t)}get history(){return this.historyList.runs}get onCompactModeChanged(){return this.historyList.onCompactModeChanged}get compactMode(){return this.historyList.compactMode}constructor(t){var e;super(tM.box(tM.divText("No historical runs loaded","hp-no-elements-label"),{style:{width:"100%",height:"100%"}})),e=this,this.func=t,this.onRunChosen=new tU.Subject,this.onComparison=new tU.Subject,this.afterRunEdited=new tU.Subject,this.afterRunDeleted=new tU.Subject,this.allRunsFetch=new tU.Subject,this.historyList=new nE([],{fallbackText:"No runs are found in history",showActions:!0,showBatchActions:!0,isHistory:!0}),this.panel=this.historyList.root;const n=this.historyList.onChosen.pipe((0,_.filter)(t=>!!t)).subscribe(t=>this.onRunChosen.next(t.id)),i=this.historyList.onComparisonCalled.subscribe(t=>this.onComparison.next(t)),r=this.allRunsFetch.subscribe(()=>{var t;return(t=function*(){tM.setUpdateIndicator(e.root,!0),e4(e.func.name,[{author:tL.shell.user}],{},["session.user","options"]).then(t=>{tM.empty(e.root),e.root.appendChild(e.panel),e.updateHistoryPane(t)}).catch(t=>tL.shell.error(t)).finally(()=>tM.setUpdateIndicator(e.root,!1))},function(){var e=this,n=arguments;return new Promise(function(i,r){var o=t.apply(e,n);function s(t){nL(o,i,r,s,a,"next",t)}function a(t){nL(o,i,r,s,a,"throw",t)}s(void 0)})})()}),o=this.historyList.onMetadataEdit.subscribe(t=>{this.afterRunEdited.next(t)}),s=this.historyList.onDelete.subscribe(t=>{this.afterRunDeleted.next(t)});this.subs.push(n,r,o,i,s),this.allRunsFetch.next()}}function nN(t,e,n,i,r,o,s){try{var a=t[o](s),l=a.value}catch(t){n(t);return}a.done?e(l):Promise.resolve(l).then(i,r)}function nj(t){return function(){var e=this,n=arguments;return new Promise(function(i,r){var o=t.apply(e,n);function s(t){nN(o,i,r,s,a,"next",t)}function a(t){nN(o,i,r,s,a,"throw",t)}s(void 0)})}}(tr=td||(td={})).fileInput=function(t,e,n,i){return new e2(void 0===t?"Drag-n-drop here":t,void 0===e?null:e,void 0===n?null:n,void 0===i?e1:i)},tr.historyInput=function(t,e,n){return new nk(t,e,n)},tr.historyInputJSON=function(t,e,n){return new nD(t,e,n)},tr.historyPanel=function(t){return new nM(t)};let nB=new URL(tL.shell.startUri),n_=()=>nj(function*(){let t=yield navigator.mediaDevices.getDisplayMedia({video:!0,audio:!1,selfBrowserSurface:"include"}),e=new MediaRecorder(t),n=[];e.ondataavailable=t=>n.push(t.data),e.onstop=()=>{let e=new Blob(n,{type:n[0].type});t.getVideoTracks()[0].stop(),r.Utils.download(`Recording ${new Date().toLocaleString("en-us",{month:"short",day:"numeric",hour:"numeric",minute:"numeric"})}.mkv`,e,n[0].type)},e.start()})();class nU extends r.ViewBase{onFuncCallReady(){return nj(function*(){if(!this.options.isTabbed){this.name&&"New view"!==this.name||(this.name=this.funcCall.func.friendlyName);try{this.func.package&&(yield this.getPackageData())}catch(t){console.log(t)}}this.build();let t=this.getStartId();if(t&&!this.options.isTabbed&&(tM.setUpdateIndicator(this.root,!0),this.loadRun(t),tM.setUpdateIndicator(this.root,!1),this.setAsLoaded()),this.isHistoryEnabled&&this.func){let t=this.options.isTabbed?this.isHistorical.subscribe(t=>{t||(this.funcCall.id=null)}):this.isHistorical.subscribe(t=>{if(t){var e,n;this.path=`?id=${this.funcCall.id}`;let t=eO(this.funcCall);0>this.name.indexOf(" — ")?this.name=`${this.name} — ${null!=(e=this.funcCall.options.title)?e:t}`:this.name=`${this.name.substring(0,this.name.indexOf(" — "))} — ${null!=(n=this.funcCall.options.title)?n:t}`}else this.path="",this.funcCall.id=null,this.name=`${this.name.substring(0,this.name.indexOf(" — ")>0?this.name.indexOf(" — "):void 0)}`});this.subs.push(t)}}).call(this)}getStartId(){return tL.shell.getVar("isLoaded")?void 0:nB.searchParams.get("id")}setAsLoaded(){return tL.shell.setVar("isLoaded",!0)}get funcCall(){return this._funcCall}get func(){var t;return null==(t=this.funcCall)?void 0:t.func}get lastCall(){return this._lastCall}set lastCall(t){this._lastCall=t}get type(){return this._type}getPackageData(){return nj(function*(){var t,e;let n=this.func.package;if(!n)return;let i=null==(t=yield null==n?void 0:n.getProperties())?void 0:t.REPORT_BUG_URL;i&&!this.reportBug&&(this.reportBug=()=>nj(function*(){window.open(i,"_blank")})());let r=null==(e=yield null==n?void 0:n.getProperties())?void 0:e.REQUEST_FEATURE_URL;r&&!this.requestFeature&&(this.requestFeature=()=>nj(function*(){window.open(r,"_blank")})());let o=`${n.friendlyName}.
|
|
179
|
+
Last updated on ${tp()(n.updatedOn).format("YYYY MMM D, HH:mm")}`;this.getAbout||(this.getAbout=()=>nj(function*(){return o})())}).call(this)}linkFunccall(t){this._funcCall=t,this.funcCallReplaced.next(!0)}loadFuncCallById(){return nj(function*(){if(this.initValue instanceof r.FuncCall){yield new Promise(t=>setTimeout(t,0)),this.linkFunccall(this.initValue);return}tM.setUpdateIndicator(this.root,!0);let t=this.getStartId();if(t&&!this.options.isTabbed)this.linkFunccall((yield ts.loadRun(t)));else{let t=r.Func.byName(this.initValue);this.linkFunccall(t.prepare({}))}tM.setUpdateIndicator(this.root,!1)}).call(this)}init(){return nj(function*(){yield this.loadFuncCallById(),yield this.onFuncCallReady(),this.isReady.next(!0)}).call(this)}build(){tM.empty(this.root),this.root.appendChild(this.buildIO()),this.options.historyEnabled&&this.isHistoryEnabled&&this.buildHistoryBlock(),this.buildRibbonMenu(),this.buildRibbonPanels()}onComparisonLaunch(t){return nj(function*(){let e=this.comparatorFunc;if(e){let n=r.Func.byName(e),i=(yield n.prepare({params:{comparedRuns:t}}).call()).outputs.comparisonView;tL.shell.addView(i);return}let n=tL.shell.v.parentCall,i=[...tL.shell.views].find(t=>t.type===tz),o=yield eq.fromComparedRuns(t,this.func,{parentView:i,parentCall:n});tL.shell.addView(o),o.defaultCustomize();let s=this.compareCustomizer;if(s){let t=r.Func.byName(s);yield t.prepare({params:{defaultView:o}}).call();return}}).call(this)}onSaveClick(){return nj(function*(){yield this.saveRun(this.funcCall)}).call(this)}buildHistoryBlock(){let t=td.historyPanel(this.func),e=!1;return this.subs.push(t.onCompactModeChanged.subscribe(t=>{let e=tL.shell.dockManager.findNode(this.historyRoot);e&&(tL.shell.dockManager.close(e),t?tL.shell.dockManager.dock(this.historyRoot,"right",null,"History",.3):tL.shell.dockManager.dock(this.historyRoot,"down",null,"History",.3))}),t.onRunChosen.subscribe(t=>nj(function*(){tM.setUpdateIndicator(this.root,!0),yield this.loadRun(t),tM.setUpdateIndicator(this.root,!1)}).call(this)),t.onComparison.subscribe(e=>nj(function*(){eG(t.root,!0);let n=yield Promise.all(e.map(t=>ts.loadRun(t)));yield this.onComparisonLaunch(n),eG(t.root,!1)}).call(this)),t.afterRunEdited.subscribe(t=>{if(t.id===this.funcCall.id&&t.options.title){var e,n;this.path=`?id=${this.funcCall.id}`;let i=eO(t);0>this.name.indexOf(" — ")?this.name=`${this.name} — ${null!=(e=t.options.title)?e:i}`:this.name=`${this.name.substring(0,this.name.indexOf(" — "))} — ${null!=(n=t.options.title)?n:i}`}}),tL.events.onViewRemoving.subscribe(t=>{if(t.args.view==this){let t=tL.shell.dockManager.findNode(this.historyRoot);t?(tL.shell.dockManager.close(t),e=!0):e=!1}}),tL.events.onCurrentViewChanged.subscribe(()=>{if(tL.shell.v==this){if(e){var t;(null==(t=this.historyBlock)?void 0:t.compactMode)?tL.shell.dockManager.dock(this.historyRoot,"right",null,"History",.3):tL.shell.dockManager.dock(this.historyRoot,"down",null,"History",.3)}}else{let t=tL.shell.dockManager.findNode(this.historyRoot);t?(tL.shell.dockManager.close(t),e=!0):e=!1}})),tM.empty(this.historyRoot),this.historyRoot.style.removeProperty("justify-content"),this.historyRoot.append(t.root),this.historyBlock=t,t.root}buildRibbonPanels(){let t=tM.iconFA("history",()=>{if(!tL.shell.dockManager.findNode(this.historyRoot)){var t;(null==(t=this.historyBlock)?void 0:t.compactMode)?tL.shell.dockManager.dock(this.historyRoot,"right",null,"History",.3):tL.shell.dockManager.dock(this.historyRoot,"down",null,"History",.3),this.historyRoot.parentElement.classList.add("ui-box"),this.historyRoot.classList.add("ui-box")}},"History"),e=tM.iconFA("save",()=>nj(function*(){yield this.onSaveClick()}).call(this),"Save current state"),n=tM.comboPopup(tM.iconFA("arrow-to-bottom"),this.getFormats(),this.exportRun.bind(this)),i=tM.iconFA("edit",()=>{this.historyBlock&&this.lastCall&&this.historyBlock.showEditDialog(this.historyBlock.history.get(this.funcCall.id))},"Edit this run metadata"),r=this.isHistorical.subscribe(t=>{t?(tM.setDisplay(n,!eI(this.funcCall)),tM.setDisplay(i,!0)):(t_()(n).hide(),t_()(i).hide())});if(this.subs.push(r),tM.tooltip.bind(n,()=>"inconsistent"===this.consistencyState.value&&this.mandatoryConsistent?"Current run is inconsistent. Export feature is disabled.":null),!this.options.isTabbed&&this.mandatoryConsistent){let t=this.consistencyState.pipe((0,_.distinctUntilChanged)()).subscribe(t=>{"inconsistent"===t?(t_()(n).addClass("d4-disabled"),t_()(n.lastChild).css("color","unset")):(t_()(n).removeClass("d4-disabled"),t_()(n.lastChild).removeProp("color"))});this.subs.push(t)}let o=[[...!this.options.isTabbed&&this.isHistoryEnabled&&this.options.historyEnabled?[t]:[],...!this.options.isTabbed&&this.isHistoryEnabled?[e]:[],...!this.options.isTabbed&&this.isExportEnabled&&this.exportConfig&&this.exportConfig.supportedFormats.length>0?[n]:[],...this.options.isTabbed?[]:[i]]];return this.setRibbonPanels(o),o}buildRibbonMenu(){if(this.ribbonMenu.clear(),!this.exportConfig&&!this.reportBug&&!this.requestFeature&&!this.getHelp&&!this.getMocks&&!this.getTemplates)return;let t=this.ribbonMenu.group("Model");if(this.getMocks&&this.getMocks.length>0)if(1===this.getMocks.length)t.item("Input data mock",this.getMocks[0].action);else{let e=t.group("Input data mocks");this.getMocks.forEach(t=>{e.item(t.mockName,t.action)}),t.endGroup()}if(this.getTemplates&&this.getTemplates.length>0)if(1===this.getTemplates.length)t.item("Input data template",this.getTemplates[0].action);else{let e=t.group("Input data templates");this.getTemplates.forEach(t=>{e.item(t.name,t.action)}),t.endGroup()}this.isExportEnabled&&this.exportConfig&&this.exportConfig.supportedFormats.length>0&&t.group("Export").items(this.getFormats(),this.exportRun.bind(this),{isValid:()=>this.isHistorical.value?this.mandatoryConsistent&&"inconsistent"===this.consistencyState.value?"Run should be consistent to be exported":null:"Run should be completed to be exported"}).endGroup(),this.reportBug&&t.item("Report a bug",()=>this.reportBug()),this.requestFeature&&t.item("Request a feature",()=>this.requestFeature()),this.getHelp&&t.item("Help",()=>this.getHelp()),t.item("Record the screen",n_),this.getAbout&&t.item("About",()=>nj(function*(){let t=yield this.getAbout();if(t){let e=tM.dialog("Current version");t.split("\n").forEach(t=>e.add(tM.label(t))),e.onOK(()=>{}),e.getButton("CANCEL").style.display="none",e.show({center:!0})}}).call(this))}exportRun(t){return nj(function*(){r.Utils.download(this.exportConfig.filename(t),(yield this.exportConfig.export(t)))}).call(this)}getFormats(){var t,e;return null!=(t=null==(e=this.exportConfig)?void 0:e.supportedFormats)?t:[]}onBeforeSaveRun(t){return nj(function*(){})()}onAfterSaveRun(t){return nj(function*(){})()}saveRun(t){return nj(function*(){let e=eR(t);yield this.onBeforeSaveRun(e),eI(e)&&(e=yield nA(t)),e.id&&e.newId();let n=yield ts.saveRun(e),i=yield ts.loadRun(n.id);return this.options.historyEnabled&&this.isHistoryEnabled&&this.historyBlock&&this.historyBlock.addRun(i),this.linkFunccall(i),this.isHistorical.next(!0),yield this.onAfterSaveRun(n),n}).call(this)}onBeforeDeleteRun(t){return nj(function*(){})()}onAfterDeleteRun(t){return nj(function*(){})()}deleteRun(t){return nj(function*(){return yield this.onBeforeDeleteRun(t),yield ts.deleteRun(t),yield this.onAfterDeleteRun(t),t.id}).call(this)}onBeforeLoadRun(){return nj(function*(){})()}onAfterLoadRun(t){return nj(function*(){})()}loadRun(t){return nj(function*(){yield this.onBeforeLoadRun();let e=yield ts.loadRun(t);return this.lastCall=eR(e),this.linkFunccall(e),this.isHistorical.next(!0),yield this.onAfterLoadRun(e),e}).call(this)}onBeforeRun(t){return nj(function*(){})()}onAfterRun(t){return nj(function*(){})()}run(){return nj(function*(){if(!this.funcCall)throw Error("The correspoding function is not specified");yield this.onBeforeRun(this.funcCall);let t=r.TaskBarProgressIndicator.create("Calculating...");try{this.funcCall.newId(),yield this.funcCall.call(),yield this.onAfterRun(this.funcCall),this.lastCall=eR(this.funcCall),!(this.options.isTabbed||this.runningOnInput)&&this.isHistoryEnabled&&(yield this.saveRun(this.funcCall))}catch(t){tL.shell.error(t.toString())}finally{t.close()}}).call(this)}exportRunJson(){return nj(function*(){if(this._lastCall){var t,e;let n;return JSON.stringify((yield(t=this._lastCall,e=this,nv(function*(){let n={};var i=!0,o=!1,s=void 0;try{for(var a,l=Object.entries(t.inputs)[Symbol.iterator]();!(i=(a=l.next()).done);i=!0){let t=ng(a.value,2),i=t[0],o=t[1],s=e.funcCall.inputParams[i].property;n[i]=yield function(t,e,n){return nv(function*(){if("file"===t.propertyType&&n.getInput){let e=n.getInput(t.name).value;return e instanceof r.FileInfo?(yield e.readAsBytes()).buffer:yield e.arrayBuffer()}return e})()}(s,o,e)}}catch(t){o=!0,s=t}finally{try{i||null==l.return||l.return()}finally{if(o)throw s}}return{inputs:n,outputs:t.outputs}})())),function(t,e){return e===1/0?{[th]:"Infinity",value:!0}:e===-1/0?{[th]:"-Infinity",value:!0}:Number.isNaN(e)?{[th]:"NaN",value:!0}:e instanceof r.DataFrame&&!n.useJsonDF?{[th]:"DataFrame",value:z(e.toByteArray())}:e instanceof r.DataFrame&&n.useJsonDF?{[th]:"DataFrameJSON",value:e.toJson()}:e instanceof ArrayBuffer?{[th]:"ArrayBuffer",value:z(new Uint8Array(e))}:e instanceof Map?{[th]:"Map",value:Array.from(e)}:e instanceof Set?{[th]:"Set",value:Array.from(e)}:tp().isDayjs(this[t])?{[th]:"DayJs",value:this[t].toISOString()}:e},(n={}).space)}}).call(this)}getRunJSON(){return nj(function*(){let t=yield this.exportRunJson();t&&r.Utils.download(this.defaultExportFilename("","json"),t)}).call(this)}get compareCustomizer(){var t;return null!=(t=this.func.options.compareCustomizer)?t:null}get comparatorFunc(){var t;return null!=(t=this.func.options.comparatorFunc)?t:null}get uploadFunc(){var t;return null!=(t=this.func.options.uploadFunc)?t:null}get runningOnInput(){return"true"===this.func.options.runOnInput}get runningOnStart(){return"true"===this.func.options.runOnOpen}get mainParams(){return this.func.options.mainParams?JSON.parse(this.func.options.mainParams):null}get mandatoryConsistent(){var t;return(null==(t=this.parentCall)?void 0:t.func.options.mandatoryConsistent)==="true"}get hasContextHelp(){var t,e,n,i;return!!(null!=(e=null==(t=this.func)||null==(n=t.options)?void 0:n.help)?e:null==t||null==(i=t.options)?void 0:i.readme)}getContextHelp(){return nj(function*(){var t,e;return t=this.func,(e=function*(){var e;let n=null!=(e=t.options.help)?e:t.options.readme;if(!n)return;if(eC.get(t.id))return eC.get(t.id);let i="";try{i=t.package.name}catch(t){}let r=`System:AppData/${i}/${n}`;if(i&&(yield tL.dapi.files.exists(r))){let e=yield tL.dapi.files.readAsText(r);return eC.set(t.id,e),e}let o=`${tL.shell.user.name}.home/${n}`;if(yield tL.dapi.files.exists(o)){let e=yield tL.dapi.files.readAsText(o);return eC.set(t.id,e),e}},function(){var t=this,n=arguments;return new Promise(function(i,r){var o=e.apply(t,n);function s(t){eA(o,i,r,s,a,"next",t)}function a(t){eA(o,i,r,s,a,"throw",t)}s(void 0)})})()}).call(this)}get features(){var t;return null!=(t=ex(this.func.options,"features"))?t:{}}getFeature(t,e){var n,i;return n=this.features,n instanceof Array?n.includes(t):n instanceof Object&&null!=(i=n[t])?i:e}get isExportEnabled(){return this.getFeature("export",!0)}get isHistoryEnabled(){return this.getFeature("history",!0)}get isSaEnabled(){return this.getFeature("sens-analysis",!1)}get hasUploadMode(){return this.getFeature("upload",!1)}get isFittingEnabled(){return this.getFeature("fitting",!1)}get isOptimizationEnabled(){return this.getFeature("optimization",!1)}constructor(t,e){var n,i,o,s,a;let l=void 0===e?{historyEnabled:!0,isTabbed:!1,skipInit:!1}:e;super(),this.initValue=t,this.options=l,this._type="function",this.funcCallReplaced=new tU.Subject,this.isReady=new tU.BehaviorSubject(!1),this.exportConfig=null,this.getMocks=null,this.getTemplates=null,this.getHelp=null,this.reportBug=null,this.requestFeature=null,this.getAbout=null,this.historyBlock=null,this.isHistorical=new tU.BehaviorSubject(!1),this.historyRoot=tM.div(),this.consistencyState=new tU.BehaviorSubject("consistent"),this.defaultExportFilename=(t,e)=>`${this.name} - ${new Date().toLocaleString("en-US").replaceAll(/:|\//g,"-")}.${null!=e?e:this.exportConfig.supportedExtensions[t]}`,this.defaultSupportedExportExtensions=()=>({Excel:"xlsx"}),this.defaultSupportedExportFormats=()=>["Excel"],this.box=!0,this.parentCall=tL.functions.getCurrentCall(),t instanceof r.FuncCall&&(this.parentCall=t),this.parentView=null==(o=this.parentCall)||null==(i=o.parentCall)||null==(n=i.aux)?void 0:n.view,(null==(a=this.parentCall)||null==(s=a.func)?void 0:s.name)&&(this.basePath=`/${this.parentCall.func.name}`),l.skipInit||this.init()}}function n$(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=Array(e);n<e;n++)i[n]=t[n];return i}function nW(t,e,n,i,r,o,s){try{var a=t[o](s),l=a.value}catch(t){n(t);return}a.done?e(l):Promise.resolve(l).then(i,r)}function nH(t){return function(){var e=this,n=arguments;return new Promise(function(i,r){var o=t.apply(e,n);function s(t){nW(o,i,r,s,a,"next",t)}function a(t){nW(o,i,r,s,a,"throw",t)}s(void 0)})}}function nY(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n,i,r=null==t?null:"u">typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var o=[],s=!0,a=!1;try{for(r=r.call(t);!(s=(n=r.next()).done)&&(o.push(n.value),!e||o.length!==e);s=!0);}catch(t){a=!0,i=t}finally{try{s||null==r.return||r.return()}finally{if(a)throw i}}return o}}(t,e)||function(t,e){if(t){if("string"==typeof t)return n$(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if("Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return n$(t,e)}}(t,e)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}let nG=Math.ceil(36)+1,nZ=(t,e,n)=>{tM.setUpdateIndicator(t,e);let i=t.querySelector(".d4-update-shadow .ui-label");e&&n&&i&&(i.textContent=n)},nJ=(t,e)=>{try{return Number.isFinite(t)&&e?r.format(t,e):t}catch(e){return t}},nz=(t,e,n,i)=>{let r=["Parameter","Value","Units"];n&&r.push("Validation"),i&&r.push("Consistency"),t.addRow(r).font={bold:!0},e.forEach(e=>{let r=[e.caption,nJ(e.value,e.format),e.units];r.push(nQ(null==n?void 0:n[e.name])),r.push(nq(null==i?void 0:i[e.name])),t.addRow(r)}),t.getColumn(1).width=1.2*Math.max(...e.map(t=>t.caption.toString().length),9),t.getColumn(2).width=1.2*Math.max(...e.map(t=>t.value.toString().length),5),t.getColumn(3).width=1.2*Math.max(...e.map(t=>t.units.toString().length),5),t.getColumn(4).width=100,t.getColumn(5).width=100},nQ=t=>null==t?"":["errors","warnings"].filter(e=>{var n;return!!(null==t||null==(n=t[e])?void 0:n.length)}).flatMap(e=>t[e].map(t=>({category:e,advice:t}))).map(t=>{let e=t.category,n=t.advice;return`${e}: ${"string"==typeof n?n:n.description}`}).join("\n"),nq=t=>{if(null==t)return"";if(t.inconsistent&&("disabled"===t.restriction||"restricted"===t.restriction)){let e=t.assignedValue,n="number"==typeof e&&Number.isFinite(e)?r.format(e,"#0.###"):String(e);return`Inconsistent: value should be ${n}`}},nK=t=>{let e=t.sheet,n=t.df,i=t.column,r=t.row,o=t.validation,s=t.consistency;if(!n)return;let a=e.getColumn(null!=i?i:1).letter,l=n.columns.length,u=n.columns.toList(),c=u.map(t=>{var e,n;return"double"===t.type?null!=(e=null==(n=t.tags)?void 0:n.format)?e:"#0.###":void 0}),d=[];for(let t=0;t<n.rowCount;t++)d.push(u.map((e,n)=>c[n]?nJ(e.get(t),c[n]):e.get(t)));let p={name:`ID_${e.workbook.worksheets.reduce((t,e)=>t+e.getTables().length,0)}`,ref:`${a}${null!=r?r:1}`,columns:u.map(t=>({name:t.name,filterButton:!1})),rows:d};l>0&&(e.addTable(p),e.columns.forEach(t=>{t.width=25,t.alignment={wrapText:!0}}));let h=l+1;e.getColumn(h).width=100,e.getCell(1,h).value="Validation and Consistency",o&&(e.getCell(2,h).value=nQ(o)),s&&(e.getCell(3,h).value=nq(s))},nX=t=>nH(function*(){let e=eT(t)?`data:image/svg+xml;charset=utf-8,${encodeURIComponent(t)}`:`data:image/png;base64,${t}`,n=yield new Promise((t,n)=>{let i=new Image;i.onload=()=>t(i),i.onerror=()=>n(Error("Failed to load a graphics output")),i.src=e});if(!eT(t))return{dataUrl:e,width:n.naturalWidth,height:n.naturalHeight};let i=(t=>{var e;let n=new DOMParser().parseFromString(t,"image/svg+xml").documentElement,i=t=>{var e;return/^\s*[\d.]+(px)?\s*$/.test(null!=(e=n.getAttribute(t))?e:"")?parseFloat(n.getAttribute(t)):NaN},r=[i("width"),i("height")],o=r[0],s=r[1];if(o>0&&s>0)return{width:o,height:s};let a=nY((null!=(e=n.getAttribute("viewBox"))?e:"").trim().split(/[\s,]+/).map(Number),4),l=a[2],u=a[3];return l>0&&u>0?{width:l,height:u}:{width:1,height:1}})(t),r=Math.min(1280/i.width,720/i.height),o=Math.round(i.width*r),s=Math.round(i.height*r),a=document.createElement("canvas");return a.width=o,a.height=s,a.getContext("2d").drawImage(n,0,0,o,s),{dataUrl:a.toDataURL("image/png"),width:o,height:s}})(),n0=t=>!t||0===t.rowCount;function n9(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=Array(e);n<e;n++)i[n]=t[n];return i}function n1(t,e,n,i,r,o,s){try{var a=t[o](s),l=a.value}catch(t){n(t);return}a.done?e(l):Promise.resolve(l).then(i,r)}function n2(t){return function(){var e=this,n=arguments;return new Promise(function(i,r){var o=t.apply(e,n);function s(t){n1(o,i,r,s,a,"next",t)}function a(t){n1(o,i,r,s,a,"throw",t)}s(void 0)})}}function n5(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{},i=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(i=i.concat(Object.getOwnPropertySymbols(n).filter(function(t){return Object.getOwnPropertyDescriptor(n,t).enumerable}))),i.forEach(function(e){var i;i=n[e],e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i})}return t}function n6(t,e){return e=null!=e?e:{},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):(function(t){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e.push.apply(e,n)}return e})(Object(e)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(e,n))}),t}function n4(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n,i,r=null==t?null:"u">typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var o=[],s=!0,a=!1;try{for(r=r.call(t);!(s=(n=r.next()).done)&&(o.push(n.value),!e||o.length!==e);s=!0);}catch(t){a=!0,i=t}finally{try{s||null==r.return||r.return()}finally{if(a)throw i}}return o}}(t,e)||function(t,e){if(t){if("string"==typeof t)return n9(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if("Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return n9(t,e)}}(t,e)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}let n3=()=>tM.divText("[No data to display]",{style:{"text-align":"center","align-content":"center",width:"100%",height:"100%"}});class n8 extends nU{static fromFuncCall(t,e){return new this(t,void 0===e?{historyEnabled:!0,isTabbed:!1}:e)}onFuncCallReady(){var t=this,e=()=>super.onFuncCallReady;return n2(function*(){yield this.loadInputsOverrides(),yield this.loadValidators(tc.INPUTS),yield this.loadValidators(tc.OUTPUTS),yield e().call(t);let n=this.funcCallReplaced.subscribe(()=>{this.inputValidationRequests.next({isRevalidation:!1}),this.outputValidationRequests.next({isRevalidation:!1})});this.subs.push(n);let i=t=>(0,_.mergeMap)(e=>e.pipe((0,_.tap)(e=>{t===tc.INPUTS?this.setInputValidationPending(e.field):this.setOutputValidationPending(e.field)}),(0,_.switchMap)(e=>{let n=new AbortController,i=n.signal,r=!1;return new tU.Observable(o=>{let s=(0,tU.from)(this.runValidation(n5({},e),i,t)).subscribe(t=>{r=!0,o.next(t)});return()=>{r||n.abort(),s.unsubscribe()}}).pipe((0,_.tap)(n=>{t===tc.INPUTS?this.setInputValidationResults(n):this.setOutputValidationResults(n),this.runRevalidations(e,n,t),t===tc.INPUTS?this.inputValidationUpdates.next(null):this.outputValidationUpdates.next(null)}),(0,_.mapTo)(e))}))),r=this.inputValidationRequests.pipe((0,_.groupBy)(t=>t.field),i(tc.INPUTS)).subscribe(t=>{t.field&&this.runningOnInput&&this.isRunnable()&&this.doRun()});this.subs.push(r);let o=this.outputValidationRequests.pipe((0,_.groupBy)(t=>t.field),i(tc.OUTPUTS)).subscribe();this.subs.push(o);let s=this.externalValidatorsUpdates.subscribe(t=>{this.updateInputValidationResults(t)});this.subs.push(s);let a=(0,tU.combineLatest)([this.runRequests.pipe((0,_.switchMap)(()=>(0,tU.of)(!1).pipe((0,_.delay)(500),(0,_.startWith)(!0)))),this.inputValidationUpdates.pipe((0,_.debounceTime)(0))]).pipe((0,_.filter)(t=>n4(t,1)[0]&&this.isRunnable())).subscribe(()=>this.doRun());this.subs.push(a);let l=this.options.isTabbed?null:yield this.loadLastInputs();if(l)tL.shell.info(tM.div([tM.divText("Do you want to load last inputs?"),tM.divH([tM.bigButton("Load",()=>{var t=!0,e=!1,n=void 0;try{for(var i,r=Object.entries(l)[Symbol.iterator]();!(t=(i=r.next()).done);t=!0){let t=n4(i.value,2),e=t[0],n=t[1],r=this.getInput(e);r.notify=!1,r.value=n,r.notify=!0,this.funcCall.inputs[e]=n,this.inputValidationRequests.next({field:e,isRevalidation:!1})}}catch(t){e=!0,n=t}finally{try{t||null==r.return||r.return()}finally{if(e)throw n}}tL.shell.info(tM.divText("Change the loaded inputs to run computations"))})])]));else{let t=new AbortController,e=yield this.runValidation({isRevalidation:!1},t.signal);this.setInputValidationResults(e),this.runRevalidations({isRevalidation:!1},e),this.inputValidationUpdates.next(null),this.runningOnStart&&this.isRunnable()&&(yield this.doRun())}}).call(this)}onBeforeRun(){return this.tabsElem.currentPane&&(this.prevOpenedTab=this.inputTabsLabels.includes(this.tabsElem.currentPane.name)?null:this.tabsElem.currentPane),Promise.resolve()}onAfterRun(){if(this.showOutput(),this.tabsElem.panes.forEach(t=>{t_()(t.header).show()}),this.prevOpenedTab)return this.tabsElem.currentPane=this.prevOpenedTab,Promise.resolve();let t=this.tabsElem.panes.find(t=>this.outputTabsLabels.includes(t.name));return t&&(this.tabsElem.currentPane=t),Promise.resolve()}getRunButton(t){var e;let n=tM.bigButton(null!=(e=this.func.options.runLabel)?e:void 0===t?"Run":t,()=>n2(function*(){return yield this.doRun()}).call(this)),i=(0,tU.merge)(this.inputValidationUpdates,this.externalValidatorsUpdates,this.isRunning,this.blockRuns).subscribe(()=>{n.disabled=!this.isRunnable()});return this.subs.push(i),n}loadInputsOverrides(){return n2(function*(){let t=[...this.funcCall.inputParams.values()];yield Promise.all(t.map(t=>n2(function*(){if(t.property.options.input){let e=r.Func.byName(t.property.options.input).prepare({params:JSON.parse(t.property.options.inputOptions||"{}")});yield e.call(),this.inputsOverride[t.name]=e.outputs.input}}).call(this)))}).call(this)}loadValidators(){return n2(function*(t){var e;let n,i=void 0===t?tc.INPUTS:t,o=yield(e=this.funcCall,n=void 0===i?tc.INPUTS:i,nv(function*(){let t=[...e[nf[n]].values()];return(yield Promise.all(t.filter(t=>!!t.property.options.validatorFunc).map(t=>nv(function*(){let e=r.Func.byName(t.property.options.validatorFunc).prepare({params:JSON.parse(t.property.options.validatorFuncOptions||"{}")});return yield e.call(),[t.name,e.outputs.validator]})()))).reduce((t,e)=>{let n=ng(e,2),i=n[0],r=n[1];return t[i]=r,t},{})})());i===tc.INPUTS?this.inputValidators=o:this.outputValidators=o}).apply(this,arguments)}keepOutput(){var t;return(null==(t=this.func)?void 0:t.options.keepOutput)==="true"}getSaveButton(t){let e=tM.bigButton(void 0===t?"Save":t,()=>n2(function*(){return yield this.saveExperimentalRun(this.funcCall)}).call(this),"Save uploaded data"),n=this.isUploadMode.subscribe(t=>{this.buildRibbonPanels(),t?t_()(e).show():t_()(e).hide()});return this.subs.push(n),e}getStandardButtons(){let t=this.getRunButton(),e=tM.div([t]);tM.tooltip.bind(e,()=>t.disabled?this.isRunning.value?"Computations are in progress":this.getValidationMessage():"");let n=this.getSaveButton();return[...this.isHistoryEnabled&&!this.options.isTabbed?[n]:[],...this.runningOnInput?[]:[e]]}buildFormButtons(){var t;let e=this.getStandardButtons(),n=tM.buttonsInput();return t_()(n.firstChild).css({display:"none"}),null==(t=n.lastChild)||t.replaceWith(tM.div([...this.navBtns,...this.additionalBtns,...e],"ui-input-editor")),t_()(n).addClass("rfv-buttons"),t_()(n).css({"max-width":"100%"}),this.formButtons.replaceWith(n),this.formButtons=n,n}setAdditionalButtons(t){this.additionalBtns=t,this.buildFormButtons()}setNavigationButtons(t){this.navBtns=t,this.buildFormButtons()}buildIO(){let t=this.buildInputBlock(),e=t.inputBlock,n=t.inputForm,i=t.outputForm,r=t.controlsWrapper,o=[...Array.from(n.childNodes),...this.isUploadMode.value?[Array.from(i.childNodes)]:[]];tM.tools.handleResize(e,()=>{300>t_()(e).width()?(t_()(n).addClass("ui-form-condensed"),t_()(i).addClass("ui-form-condensed"),t_()(r).addClass("ui-form-condensed"),o.forEach(t=>t_()(t).css("min-width","100px"))):(t_()(n).removeClass("ui-form-condensed"),t_()(i).removeClass("ui-form-condensed"),t_()(r).removeClass("ui-form-condensed"),o.forEach(t=>t_()(t).css("min-width","100%")))});let s=this.buildOutputBlock();s.style.height="100%",s.style.width="100%",this.hideOutput();let a=tM.splitH([e,tM.panel([s],{style:{paddingTop:"0px"}})],null,!0);return a.style.padding="0 12px",e.style.maxWidth="360px",a}buildInputBlock(){let t=this.renderInputForm(),e=this.renderOutputForm();this.buildFormButtons();let n=tM.div(this.formButtons,"ui-form ui-form-wide");t_()(n).css({"padding-left":"0px","padding-bottom":"0px","padding-right":"6px","max-width":"100%","min-height":"50px"});let i=tM.input.toggle("",{value:this.isUploadMode.value,onValueChanged:t=>this.isUploadMode.next(t)}),r=this.isUploadMode.subscribe(t=>{i.notify=!1,i.value=t,i.notify=!0,t?t_()(e).show():t_()(e).hide()});return this.subs.push(r),{inputBlock:tM.divV([t,...this.hasUploadMode&&!this.uploadFunc?[tM.divH([tM.h2("Experimental data"),i.root],{style:{flexGrow:"0"}}),e]:[],n],"ui-box rfv-form"),inputForm:t,outputForm:e,controlsWrapper:n}}processCustomDataUpload(){return n2(function*(){let t=()=>{let t=r.Dialog.create({title:"Select to compare"}),e=new nE(a.length>0?a:[...this.historyBlock.history.values()],{fallbackText:"No historical runs found",showActions:!(a.length>0),showBatchActions:!(a.length>0)}),n=new nE(s,{fallbackText:"No runs uploaded",showActions:!1,showBatchActions:!1});t.add(tM.divV([tM.divV([tM.label("Uploaded runs"),tM.element("div","splitbar-horizontal"),n.root],{style:{height:"50%",overflowY:"hidden"}}),tM.divV([tM.label(a.length>0?"Simulated":"History",{style:{padding:"0px 10px 0px 9px"}}),tM.element("div","splitbar-horizontal"),e.root],{style:{height:"50%",overflowY:"hidden"}})],{style:{justifyContent:"space-between",gap:"10px",overflowY:"scroll",height:"100%"}})),t_()(t.root.querySelector(".d4-dialog-contents")).removeClass("ui-form");let i="Compare selected";return 0===a.length?t.addButton(i,()=>n2(function*(){let i=yield Promise.all([...e.selected].map(t=>ts.loadRun(t.id)));this.onComparisonLaunch([...i,...n.selected.values()]),t.close()}).call(this)):t.addButton(i,()=>n2(function*(){this.onComparisonLaunch([...e.selected.values(),...n.selected.values()]),t.close()}).call(this)),t.getButton(i).disabled=!0,this.subs.push((0,tU.merge)(e.onSelectedChanged,n.onSelectedChanged).subscribe(()=>{e.selected.size+n.selected.size>1?t.getButton(i).disabled=!1:t.getButton(i).disabled=!0})),this.isHistorical.value&&t.addButton(d,()=>n2(function*(){this.onComparisonLaunch([this.funcCall,...n.selected.values()]),t.close()}).call(this)),t_()(t.getButton("CANCEL")).hide(),t},e=r.Func.byName(this.uploadFunc),n=yield e.prepare({params:{func:this.func}}).call(),i=n.outputs.uploadWidget,o=n.outputs.uploadFuncCall,s=[],a=[],l=r.Dialog.create({title:"Upload"});t_()(l.root.querySelector(".d4-dialog-contents")).removeClass("ui-form");let u=r.Dialog.create({title:"Review uploaded runs"});t_()(u.root.querySelector(".d4-dialog-contents")).removeClass("ui-form");let c="Save to history",d="Compare w/ current";l.add(i.root),l.addButton(c,()=>n2(function*(){return eG(l.root,!0),s.forEach(t=>{t.options.immutable_tags?t.options.immutable_tags.push(tX):t.options.immutable_tags=[tX]}),Promise.all(s.map(t=>n2(function*(){let e=yield this.getValidExpRun(t);return ts.saveRun(e)}).call(this))).then(t=>Promise.all(t.map(t=>ts.loadRun(t.id)))).then(t=>{t.forEach(t=>this.historyBlock.addRun(t))}).catch(t=>{tL.shell.error(t)}).finally(()=>{eG(l.root,!1),l.close();let t=new nE(s,{fallbackText:"No runs uploaded",showActions:!0,showBatchActions:!0});u.add(t),u.show({modal:!0,fullScreen:!0})})}).call(this)),l.addButton("Next",()=>{l.close(),s.forEach(t=>{t.options.immutable_tags?t.options.immutable_tags.push(tX):t.options.immutable_tags=[tX]});let t=new nE(s,{fallbackText:"No runs uploaded",showActions:!0,showBatchActions:!0});u.add(t.root),u.show({modal:!0,fullScreen:!0})}),t_()(l.getButton("CANCEL")).hide(),l.getButton(c).disabled=!0,l.getButton("Next").disabled=!0,t_()(u.getButton("CANCEL")).hide(),u.addButton("Simulate w/ same inputs",()=>{eG(l.root,!0),Promise.all(s.map(t=>n2(function*(){return(yield nA(t)).call()})())).then(e=>{a=e,u.close(),t().show({modal:!0,fullScreen:!0})}).catch(t=>{tL.shell.error(t)}).finally(()=>{eG(l.root,!1)})}),u.addButton("Compare w/ history",()=>{u.close(),t().show({modal:!0,fullScreen:!0})});let p=tL.functions.onAfterRunAction.pipe((0,_.filter)(t=>t.id===o.id)).subscribe(()=>{s=o.outputs.uploadedCalls,l.getButton(c).disabled=!1,l.getButton("Next").disabled=!1}),h=l.onClose.subscribe(()=>{this.isUploadMode.next(!1)});l.subs.push(h,p),l.show({modal:!0,center:!0,resizable:!0})}).call(this)}onSaveClick(){return n2(function*(){this.isUploadMode.value?yield this.saveExperimentalRun(this.funcCall):yield this.saveRun(this.funcCall)}).call(this)}buildRibbonPanels(){super.buildRibbonPanels();let t=tM.iconFA("play",()=>n2(function*(){return yield this.doRun()}).call(this),"Run computations");t.classList.add("fas");let e=tM.iconFA("arrow-to-top",()=>n2(function*(){this.uploadFunc?yield this.processCustomDataUpload():(this.isUploadMode.next(!this.isUploadMode.value),e.classList.toggle("d4-current"))}).call(this),"Upload experimental data");e.classList.add("d4-toggle-button",...this.isUploadMode.value?["d4-current"]:[]);let n=tM.iconFA("info",()=>n2(function*(){this.hasContextHelp&&(tL.shell.windows.help.visible=!0,yield new Promise(t=>setTimeout(t,100)),tL.shell.windows.help.showHelp(tM.markdown((yield this.getContextHelp()))))}).call(this),"Info"),i=[[...super.buildRibbonPanels().flat(),...this.runningOnInput||this.options.isTabbed?[]:[t],...this.hasUploadMode?[e]:[],...!this.options.isTabbed&&this.hasContextHelp?[n]:[]]];return this.setRibbonPanels(i),i}showOutput(){tM.setDisplay(this.tabsElem.root,!0),this._isOutputOutdated.next(!1)}getViewers(t){return this.dfToViewerMapping[t]}buildOutputBlock(){this.tabsElem.root.style.width="100%",this.tabsLabels.forEach(t=>{let e=n4(this.categoryToDfParamMap.outputs[t]?[this.categoryToDfParamMap.outputs[t],!1]:[this.categoryToDfParamMap.inputs[t],!0],2),n=e[0],i=e[1],o=n.filter(t=>t.propertyType===r.TYPE.DATA_FRAME||t.propertyType===r.TYPE.GRAPHICS),s=n.filter(t=>t.propertyType!==r.TYPE.DATA_FRAME&&t.propertyType!==r.TYPE.GRAPHICS),a=o.map(t=>eE(t).config),l="",u=o.reduce((t,e,n)=>{var o,s;this.dfToViewerMapping[e.name]=[];let u=a[n].map((t,n)=>n2(function*(){var n,i,o,s;let a=null!=(n=null!=(i=null==(o=this.funcCall.outputs[e.name])?void 0:o.value)?i:null==(s=this.funcCall.inputParams[e.name])?void 0:s.value)?n:tL.data.demo.demog(0),l=t.type,u=Object.values(tJ).includes(l)?r.Viewer.fromType(l,a):yield a.plot.fromType(l);u.setOptions(t),this.dfToViewerMapping[e.name].push(u),this.afterOutputPropertyRender.next({prop:e,output:u});let c=n3();return 0===a.rowCount&&"demog 0"===a.name&&(tM.setDisplay(u.root,!1),tM.setDisplay(c,!0)),{viewer:u,stub:c}}).call(this)).map((t,i)=>t.then(t=>{let r=t.viewer,o=t.stub,s=()=>n2(function*(){var t;let s=null!=(t=this.funcCall.outputParams[e.name])?t:this.funcCall.inputParams[e.name];if(s.value){if(tM.setDisplay(r.root,!0),tM.setDisplay(o,!1),Object.values(tJ).includes(r.type))r.dataFrame=s.value;else{let t=yield s.value.plot.fromType(r.type);r.root.replaceWith(t.root),r=t}try{a[n][i]&&r.setOptions(a[n][i])}catch(t){console.error("Error setting viewer properties: ",t)}Object.keys(a[n][i]).includes("color")&&r.setOptions({color:a[n][i].color}),this.afterOutputPropertyRender.next({prop:e,output:r})}else tM.setDisplay(r.root,!1),tM.setDisplay(o,!0)}).call(this),l=this.funcCallReplaced.pipe((0,_.startWith)(null),(0,_.switchMap)(()=>{var t;return(null!=(t=this.funcCall.outputParams[e.name])?t:this.funcCall.inputParams[e.name]).onChanged.pipe((0,_.startWith)(null))}),(0,_.skip)(1)).subscribe(s);return this.subs.push(l),{loadedViewer:r,stub:o}})),c=l!==(null!=(o=e.options.caption)?o:e.name)?null!=(s=e.options.caption)?s:e.name:" ";if(l=c,i){let t=this.funcCallReplaced.pipe((0,_.switchMap)(()=>{var t;return(null!=(t=this.funcCall.outputParams[e.name])?t:this.funcCall.inputParams[e.name]).onChanged})).subscribe(()=>{this.showOutput(),this.inputTabsLabels.forEach(t=>{t_()(this.tabsElem.getPane(t).header).show()})});this.subs.push(t)}let d=u.map((t,i)=>{let r=a[n][i].block,o=tM.wait(()=>n2(function*(){let e=yield t;return t_()(e.loadedViewer.root).css({height:"100%",width:"100%"}),tM.divV([e.loadedViewer.root,e.stub],{style:{width:"100%"}})})());t_()(o).css({"min-height":"300px","flex-grow":"1"});let s=tG();return this.outputValidationSigns[e.name]=s,tM.divV([tM.divH([tM.h2(0===i?c:" ",{style:{whiteSpace:"pre"}}),...0===i?[tM.div([this.outputValidationSigns[e.name][0],this.outputValidationSigns[e.name][1]],{style:{margin:"10.79px"}})]:[]]),o],{style:n5({},r?{width:`${r}%`,"max-width":`${r}%`,"max-height":"100%"}:{"flex-grow":"1"})})});if(e.propertyType===r.TYPE.GRAPHICS){let n=e.options.block,i=n3();i.classList.add("grok-scripting-image-container");let r=tM.divV([tM.h2(c,{style:{whiteSpace:"pre"}}),i],{style:n5({},n?{width:`${n}%`,"max-width":`${n}%`,"max-height":"100%"}:{"flex-grow":"1"})}),o=()=>{var t;let n=null!=(t=this.funcCall.outputParams[e.name])?t:this.funcCall.inputParams[e.name];n.value?(i.style.backgroundImage=`url("data:image/png;base64,${n.value}")`,i.textContent=""):(i.style.removeProperty("background-image"),i.textContent="[No data to display]")},s=this.funcCallReplaced.pipe((0,_.startWith)(null),(0,_.switchMap)(()=>{var t;return(null!=(t=this.funcCall.outputParams[e.name])?t:this.funcCall.inputParams[e.name]).onChanged.pipe((0,_.startWith)(null))}),(0,_.skip)(1)).subscribe(o);this.subs.push(s),t.append(r)}return t.append(...d),t},tM.divH([],{style:{flexWrap:"wrap",flexGrow:"1",maxHeight:"100%"}}));s.forEach(t=>{let e=tG();this.outputValidationSigns[t.name]=e});let c=()=>{let t=r.HtmlTable.create(s,t=>{var e;let n=t.options.precision,i=n&&t.propertyType===r.TYPE.FLOAT&&this.funcCall.outputs[t.name]?this.funcCall.outputs[t.name].toPrecision(n):this.funcCall.outputs[t.name],o=t.options.units?` [${t.options.units}]`:"";return[`${null!=(e=t.caption)?e:t.name}${o}`,null!=i?i:"[No value]",tM.div([this.outputValidationSigns[t.name][0],this.outputValidationSigns[t.name][1]])]}).root;return t_()(t).addClass("rfv-scalar-table"),this.afterOutputSacalarTableRender.next(t),t},d=c(),p=(0,tU.merge)(this.funcCallReplaced,this.isRunning.pipe((0,_.filter)(t=>!1===t),(0,_.skip)(1))).subscribe(()=>{let e=c();d.replaceWith(e),d=e,t_()(this.tabsElem.getPane(t).header).show()});this.subs.push(p),this.tabsElem.addPane(t,()=>tM.divV([...o.length?[u]:[],...s.length?[d]:[]]))});let t=tM.box();return t.append(this.tabsElem.root),t}onAfterLoadRun(t){return n2(function*(){this.showOutput()}).call(this)}get tabsLabels(){return[...this.inputTabsLabels,...this.outputTabsLabels]}get outputTabsLabels(){return Object.keys(this.categoryToDfParamMap.outputs)}get inputTabsLabels(){return Object.keys(this.categoryToDfParamMap.inputs)}get categoryToDfParamMap(){var t;let e;return t=this.funcCall.func,e={inputs:{},outputs:{}},t.inputs.filter(t=>t.propertyType===r.TYPE.DATA_FRAME&&0!==eE(t).config.length).forEach(t=>{let n="Misc"===t.category?"Input":t.category;e.inputs[n]?e.inputs[n].push(t):e.inputs[n]=[t]}),t.outputs.forEach(t=>{let n="Misc"===t.category?"Output":t.category;(t.propertyType!==r.TYPE.DATA_FRAME||0!==eE(t).config.length)&&(e.outputs[n]?e.outputs[n].push(t):e.outputs[n]=[t])}),e}get inputsStorage(){return`RFV_LastInputs_${this.funcCall.func.name}`}saveLastInputs(){return n2(function*(){try{let t=tj()(this.funcCall.inputParams.values()).reduce((t,e)=>{let n=e.property.propertyType!==r.TYPE.DATA_FRAME?this.funcCall.inputs[e.name]:Array.from(this.funcCall.inputs[e.name].toByteArray());return n6(n5({},t),{[e.name]:n})},{});return localStorage.setItem(this.inputsStorage,JSON.stringify(t))}catch(t){tL.shell.error(t.toString())}}).call(this)}loadLastInputs(){return n2(function*(){try{var t;let e=JSON.parse(null!=(t=localStorage.getItem(this.inputsStorage))?t:"{}");if(0===Object.keys(e).length)return null;return tj()(this.funcCall.inputParams.values()).reduce((t,n)=>{let i=n.property.propertyType!==r.TYPE.DATA_FRAME?e[n.name]:r.DataFrame.fromByteArray(new Uint8Array(e[n.name]));return n6(n5({},t),{[n.name]:i})},{})}catch(t){tL.shell.error(t.toString())}}).call(this)}deleteLastInputs(){return n2(function*(){try{return localStorage.removeItem(this.inputsStorage)}catch(t){tL.shell.error(t.toString())}}).call(this)}doRun(){return n2(function*(){this.isRunning.next(!0);try{this.options.isTabbed||(yield this.saveLastInputs()),yield this.run(),this.options.isTabbed||(yield this.deleteLastInputs())}catch(t){tL.shell.error(t.toString()),console.log(t)}finally{this.isRunning.next(!1),this.inputValidationRequests.next({isRevalidation:!1,isNewOutput:!0}),this.outputValidationRequests.next({isRevalidation:!1})}}).call(this)}setExternalValidationResults(t,e){this.externalValidatorsState[t]=e,this.externalValidatorsUpdates.next(t)}saveInputLockState(t,e,n){"restricted"===n&&(this.funcCall.options[np]=n6(n5({},this.funcCall.options[np]),{[t]:e})),n&&(this.funcCall.options[nh]=n6(n5({},this.funcCall.options[nh]),{[t]:n})),this.updateConsistencyState()}getInputLockState(t){var e;return null==(e=this.funcCall.options[nh])?void 0:e[t]}updateConsistencyState(){let t=Object.values(this.funcCall.options[nh]).some(t=>"inconsistent"===t);this.consistencyState.next(t?"inconsistent":"consistent")}getInput(t){return this.inputsMap[t]}setInput(t,e,n){let i=this.getInput(t);if(!i)throw Error(`No input named ${t}`);if(this.funcCall.inputParams[t].property.propertyType===r.TYPE.DATA_FRAME&&"restricted"===n)throw Error(`Param ${t} is dataframe. Restricted state is not supported for them.`);n||(n=this.funcCall.inputParams[t].property.propertyType===r.TYPE.DATA_FRAME?"disabled":"restricted"),this.funcCall.inputs[t]=e,this.setInputLockState(i,t,e,n)}getParamChanges(t){return this.funcCallReplaced.pipe((0,_.startWith)(null),(0,_.filter)(()=>!!this.funcCall),(0,_.map)(()=>this.funcCall.inputParams[t]?"inputParams":"outputParams"),(0,_.switchMap)(e=>this.funcCall[e][t].onChanged.pipe((0,_.startWith)(null),(0,_.map)(()=>this.funcCall[e][t].value))))}getParamValue(t){var e,n;let i=(null==(e=this.funcCall)?void 0:e.inputParams[t])?"inputParams":"outputParams";return null==(n=this.funcCall)?void 0:n[i][t].value}setInputLockState(t,e,n,i){i&&this.saveInputLockState(e,n,i),er(t)&&("disabled"===i&&t.setDisabled(),"restricted"===i&&t.setRestricted(),"restricted unlocked"===i&&t.setRestrictedUnlocked(),"inconsistent"===i&&t.setInconsistent(),"user input"===i&&t.setUserInput())}getRestrictedValue(t){var e;return null==(e=this.funcCall.options[np])?void 0:e[t]}renderOutputForm(){return this.renderIOForm(tc.OUTPUTS)}renderInputForm(){return this.renderIOForm(tc.INPUTS)}renderIOForm(t){let e=tM.divH([],"ui-form ui-form-wide");t_()(e).css({"flex-wrap":"wrap","flex-grow":"0","padding-right":"12px","padding-top":"0px","padding-left":"0px","max-width":"100%",gap:"4px"});let n="Misc",i=this.funcCall[nf[t]].values();return tj()(i).filter(t=>!!t).forEach(i=>{let r=i.property;this.beforeInputPropertyRender.next(r);let o=this.getInputForVal(i);if(!o){n=r.category;return}this.inputsMap[i.property.name]=o,t===tc.INPUTS&&(this.syncInput(i,o,t),this.checkForMapping(i,o),this.runningOnInput||this.disableInputsOnRun(i.property.name,o),this.bindOnHotkey(o)),this.renderCategory(e,i.property.category,n),this.renderInput(e,i,o),this.afterInputPropertyRender.next({prop:r,input:o}),n=r.category}),Object.keys(this.foldedCategoryInputs).forEach(t=>this.foldedCategoryInputs[t].forEach(t=>t_()(t.input.root).hide())),e.classList.remove("ui-panel"),e}saveFocusedElement(t){this.focusedInput=t}restoreFocusedElement(){var t;null==(t=this.focusedInput)||t.focus()}disableInputsOnRun(t,e){let n=this.isRunning.subscribe(n=>{!("user input"!==this.getInputLockState(t)&&this.getInputLockState(t))&&(n?(nb(e)&&t_()(e.input).is(":focus")&&this.saveFocusedElement(e.input),e.enabled=!1):(e.enabled=!0,nb(e)&&this.restoreFocusedElement()))});this.subs.push(n)}checkForMapping(t,e){if(!e.hasOwnProperty("_chosenRun"))return;let n=t.property.options.funccallMapping;if(!n)return;let i=JSON.parse(n),r=this.funcCallReplaced.pipe((0,_.startWith)(!0),(0,_.switchMap)(()=>this.funcCall.inputParams[t.property.name].onChanged)).subscribe(()=>{Object.entries(i).forEach(t=>{var n,i,r,o,s,a;let l=n4(t,2),u=l[0],c=l[1];return this.setInput(u,e.chosenRun?null!=(n=null!=(i=null!=(r=null==(o=e.chosenRun)?void 0:o.inputs[c])?r:null==(s=e.chosenRun)?void 0:s.outputs[c])?i:null==(a=e.chosenRun)?void 0:a.options[c])?n:null:eY(this.funcCall.inputParams[u].property),e.chosenRun?"restricted":"user input")})});this.subs.push(r)}getInputForVal(t){var e,n;let i=t.property;if(this.inputsOverride[t.property.name])return this.inputsOverride[t.property.name];if(i.propertyType===r.TYPE.STRING&&i.options.choices&&!i.options.propagateChoice)return tM.input.choice(null!=(e=i.caption)?e:i.name,{value:eY(i),items:JSON.parse(i.options.choices),nullable:i.nullable});switch(i.propertyType){case"file":return td.fileInput(null!=(n=i.caption)?n:i.name,null,null,null);case r.TYPE.FLOAT:let o=tM.input.forProperty(i),s=i.options.format;return s&&(o.format=s),o;default:return tM.input.forProperty(i)}}bindOnHotkey(t){nb(t)&&(t.input.onkeydown=t=>n2(function*(){"Enter"==t.key&&this.runRequests.next()}).call(this))}get foldedCategories(){var t;return JSON.parse(null!=(t=this.func.options.foldedCategories)?t:"[]")}getCategoryWarningIcon(t){let e=tM.iconFA("exclamation-circle",null,"This category has inconsistent inputs");t_()(e).css({color:"var(--orange-2)","padding-left":"5px"}).hide();let n=this.funcCallReplaced.subscribe(()=>{this.foldedCategoryInputs[t].some(t=>"inconsistent"===this.getInputLockState(t.paramName)&&t.input.value!==this.getRestrictedValue(t.paramName))?t_()(e).show():t_()(e).hide()});return this.subs.push(n),e}renderCategory(t,e,n){if(e!==n)if(this.foldedCategories.includes(e)){let n=this.getCategoryWarningIcon(e),i=tM.iconFA("chevron-right",()=>{var t;t_()(r).show(),t_()(i).hide(),t_()(n).hide(),(null!=(t=this.foldedCategoryInputs[e])?t:[]).forEach(t=>t_()(t.input.root).css({display:""}))},"Open category");t_()(i).css("padding-right","5px");let r=tM.iconFA("chevron-down",()=>{var t;t_()(r).hide(),t_()(i).show(),this.foldedCategoryInputs[e].some(t=>"inconsistent"===this.getInputLockState(t.paramName))?t_()(n).show():t_()(n).hide(),(null!=(t=this.foldedCategoryInputs[e])?t:[]).forEach(t=>t_()(t.input.root).hide())},"Close category");t_()(r).css("padding-right","5px"),t.append(tM.h2([i,r,tM.h2(e,{style:{display:"inline"}}),n],{style:{width:"100%"}})),t_()(r).hide()}else t.append(tM.h2(e,{style:{width:"100%"}}))}renderInput(t,e,n){var i,r;let o=e.property;if(this.foldedCategories.includes(o.category)&&(this.foldedCategoryInputs[o.category]=[...null!=(i=this.foldedCategoryInputs[o.category])?i:[],{paramName:e.property.name,input:n}]),this.injectLockIcons(e,n),er(n)||(n.setDisabled=function(){n.enabled=!1,t_()(n.root).removeClass("rfv-restricted-unlocked-input"),t_()(n.root).removeClass("rfv-inconsistent-input"),t_()(n.root).removeClass("rfv-restricted-input")},n.setRestricted=function(){n.enabled=!1,t_()(n.root).addClass("rfv-restricted-input"),t_()(n.root).removeClass("rfv-restricted-unlocked-input"),t_()(n.root).removeClass("rfv-inconsistent-input")},n.setRestrictedUnlocked=function(){n.enabled=!0,t_()(n.root).addClass("rfv-restricted-unlocked-input"),t_()(n.root).removeClass("rfv-restricted-input"),t_()(n.root).removeClass("rfv-inconsistent-input")},n.setInconsistent=function(){n.enabled=!0,t_()(n.root).addClass("rfv-inconsistent-input"),t_()(n.root).removeClass("rfv-restricted-input"),t_()(n.root).removeClass("rfv-restricted-unlocked-input")},n.setUserInput=function(){n.enabled=!0,t_()(n.root).removeClass("rfv-inconsistent-input"),t_()(n.root).removeClass("rfv-restricted-input"),t_()(n.root).removeClass("rfv-restricted-unlocked-input")}),nb(n)){let t,i;t=e.property,t_()(n.root).css({width:`calc(${null!=(r=t.options.block)?r:"100"}% - ${t.options.block?"2":"0"}px)`,"box-sizing":"border-box"}),this.bindTooltips(e,n),i=tM.element("i"),n.addOptions(i),n.setValidation=function(t){for(;i.firstChild&&i.removeChild(i.firstChild););let e=ng(tG(t),2),r=e[0],o=e[1];r&&o&&(i.appendChild(r),i.appendChild(o)),n.input.classList.remove("d4-invalid"),n.input.classList.remove("d4-partially-invalid"),(null==t?void 0:t.errors)&&t.errors.length||(null==t?void 0:t.warnings)&&t.warnings.length||(null==t?void 0:t.notifications)&&t.notifications.length||(null==t?void 0:t.pending)?t_()(i).css("display","flex"):t_()(i).hide(),(null==t?void 0:t.errors)&&t.errors.length?n.input.classList.add("d4-invalid"):(null==t?void 0:t.warnings)&&t.warnings.length&&n.input.classList.add("d4-partially-invalid")}}t.append(n.root)}bindTooltips(t,e){let n=t.property.name,i=()=>{var e,i;let r=`${null!=(e=null!=(i=t.property.description)?i:t.property.caption)?e:t.property.name}.`,o="disabled"===this.getInputLockState(n)?"Input is disabled to prevent inconsistency.":"inconsistent"===this.getInputLockState(n)?"The entered value is inconsistent to the computed value.":"restricted"===this.getInputLockState(n)?"The value is dependent and computed automatically. Click to edit":null;return r||o?tM.divV([...r?[tM.divText(r)]:[],...o?[tM.divText(o)]:[]],{style:{maxWidth:"300px"}}):null};tM.tooltip.bind(e.captionLabel,i),tM.tooltip.bind(e.input,i)}injectLockIcons(t,e){let n=t.property.name;e.root.addEventListener("click",()=>{"restricted"===this.getInputLockState(n)&&this.setInputLockState(e,t.name,t.value,"restricted unlocked")});let i=tM.iconFA("lock");t_()(i).addClass("rfv-icon-lock"),t_()(i).css({color:"var(--grey-2)"});let o=tM.iconFA("lock-open");t_()(o).addClass("rfv-icon-unlock"),t_()(o).css({color:"var(--grey-2)"});let s=tM.iconFA("undo",e=>{this.setInput(t.name,this.getRestrictedValue(n),"restricted"),e.stopPropagation()},"Reset value to computed value");t_()(s).addClass("rfv-icon-undo"),t_()(s).css({color:"var(--blue-2)"});let a=tM.iconFA("exclamation-circle",null,"Validation");tM.tooltip.bind(a,()=>`Current value is incosistent. Computed value was ${r.TYPES_SCALAR.has(t.property.propertyType)?this.getRestrictedValue(n):"different"}`),t_()(a).addClass("rfv-icon-warning"),t_()(a).css({color:"var(--orange-2)"}),e.placeLockStateIcons||(e.placeLockStateIcons=function(t,n,i,r){nb(e)&&(e.addOptions(t),e.addOptions(n),e.addOptions(i),e.addOptions(r))}),e.placeLockStateIcons(i,o,s,a)}syncInput(t,e,n){var i;let o=t.name,s=!1,a=this.funcCallReplaced.pipe((0,_.startWith)(!0)).subscribe(()=>{var t,i;let r=this.funcCall[nf[n]][o],s=null!=(t=null!=(i=this.funcCall[n][o])?i:eY(r.property))?t:null;e.notify=!1,e.value=s,e.notify=!0,this.funcCall[n][o]=s,this.setInputLockState(e,o,s,this.getInputLockState(o))});this.subs.push(a);let l=this.funcCallReplaced.pipe((0,_.startWith)(!0),(0,_.switchMap)(()=>{let t=this.funcCall[nf[n]][o];return t.onChanged.pipe((0,_.mapTo)(t))})).subscribe(t=>{let i=this.funcCall[n][t.name];if(s||(e.notify=!1,e.value=i,e.notify=!0),n===tc.INPUTS){this.isHistorical.next(!1),this.hideOutput(),this.inputValidationRequests.next({field:t.name,isRevalidation:!1});let n=this.getInputLockState(t.name);("restricted unlocked"===n||"inconsistent"===n)&&this.setInputLockState(e,t.name,i,i===this.getRestrictedValue(t.name)?"restricted unlocked":"inconsistent")}});this.subs.push(l);let u=this.funcCallReplaced.pipe((0,_.startWith)(!0),(0,_.switchMap)(()=>{let t=this.funcCall[nf[n]][o];return t.onChanged.pipe((0,_.mapTo)(t),(0,_.startWith)(t))}),(0,_.filter)(t=>t.property.propertyType===r.TYPE.DATA_FRAME&&t.value),(0,_.switchMap)(t=>t.value.onDataChanged.pipe((0,_.mapTo)(t)))).subscribe(t=>{n===tc.INPUTS?this.inputValidationRequests.next({field:t.name,isRevalidation:!1}):this.outputValidationRequests.next({field:t.name,isRevalidation:!1})});this.subs.push(u);let c=(nb(e)?e.onInput:(i=e.onInput.bind(e),new tU.Observable(t=>{let e=i(e=>{t.next(e)});return()=>e.unsubscribe()}))).pipe((0,_.debounceTime)(250)).subscribe(()=>{try{s=!0,this.funcCall[n][t.name]=e.value}finally{s=!1}});this.subs.push(c)}isRunnable(){return!this.isRunning.value&&!this.blockRuns.value&&this.isValid()}isValid(){var t=!0,e=!1,n=void 0;try{for(var i,r=Object.entries(this.inputValidationState)[Symbol.iterator]();!(t=(i=r.next()).done);t=!0){let t=n4(i.value,2),e=(t[0],t[1]);if(!tW(e))return!1}}catch(t){e=!0,n=t}finally{try{t||null==r.return||r.return()}finally{if(e)throw n}}var o=!0,s=!1,a=void 0;try{for(var l,u=Object.entries(this.externalValidatorsState)[Symbol.iterator]();!(o=(l=u.next()).done);o=!0){let t=n4(l.value,2),e=(t[0],t[1]);if(!tW(e))return!1}}catch(t){s=!0,a=t}finally{try{o||null==u.return||u.return()}finally{if(s)throw a}}return!0}getValidationState(){return this.inputValidationState}getValidationMessage(){let t=[];var e=!0,n=!1,i=void 0;try{for(var r,o=Object.entries(this.inputValidationState)[Symbol.iterator]();!(e=(r=o.next()).done);e=!0){let e=n4(r.value,2),n=e[0],i=e[1];tW(i)||t.push(`${n}: ${function(t){if(null==t?void 0:t.errors)return t.errors.map(t=>t.description).join("; ")}(i)}`)}}catch(t){n=!0,i=t}finally{try{e||null==o.return||o.return()}finally{if(n)throw i}}return t.join("\n")}runValidation(t,e){return n2(function*(t,e,n){let i,r,o=void 0===n?tc.INPUTS:n,s=t.field,a=this.getValidatedNames(s,o);return i={view:this,funcCall:this.funcCall,lastCall:this.lastCall},r=o===tc.INPUTS?this.inputValidators:this.outputValidators,nv(function*(){let n=i.view,s=i.funcCall,l=i.lastCall;return Object.fromEntries((yield Promise.all(a.map(i=>nv(function*(){var a;let u,c=o===tc.INPUTS?s.inputs[i]:s.outputs[i],d=yield(t.isNewOutput,t.isRevalidation,(a=function*(){if(null==c){var t,e,n,i;let r;return t={errors:["Missing value"]},r=t=>"string"==typeof t?{description:t,actions:void 0}:t,{errors:null==t||null==(e=t.errors)?void 0:e.map(t=>r(t)),warnings:null==t||null==(n=t.warnings)?void 0:n.map(t=>r(t)),notifications:null==t||null==(i=t.notifications)?void 0:i.map(t=>r(t))}}},function(){var t=this,e=arguments;return new Promise(function(n,i){var r=a.apply(t,e);function o(t){t$(r,n,i,o,s,"next",t)}function s(t){t$(r,n,i,o,s,"throw",t)}o(void 0)})})()),p=r[i];p&&(u=yield p(c,{param:i,funcCall:s,lastCall:l,signal:e,isNewOutput:!!t.isNewOutput,isRevalidation:t.isRevalidation,context:t.context,view:n}));let h=o===tc.INPUTS&&s.inputParams[i].property.options.nullable;return[i,tH(...h?[]:[d],u)]})()))))})()}).apply(this,arguments)}setInputValidationPending(t){let e=this.getValidatedNames(t);var n=!0,i=!1,r=void 0;try{for(var o,s=e[Symbol.iterator]();!(n=(o=s.next()).done);n=!0){let t=o.value;this.inputValidationState[t]=tY();let e=this.inputsMap[t];ei(e)&&e.setValidation(tY())}}catch(t){i=!0,r=t}finally{try{n||null==s.return||s.return()}finally{if(i)throw r}}this.inputValidationUpdates.next(null)}setOutputValidationPending(t){let e=this.getValidatedNames(t,tc.OUTPUTS);var n=!0,i=!1,r=void 0;try{for(var o,s=e[Symbol.iterator]();!(n=(o=s.next()).done);n=!0){let t=o.value;this.outputValidationState[t]=tY();let e=this.outputValidationSigns[t];if(e){let n=tG(tY());e[0].replaceWith(n[0]),e[1].replaceWith(n[1]),this.outputValidationSigns[t]=n}}}catch(t){i=!0,r=t}finally{try{n||null==s.return||s.return()}finally{if(i)throw r}}this.outputValidationUpdates.next(null)}setInputValidationResults(t){var e=!0,n=!1,i=void 0;try{for(var r,o=Object.entries(t)[Symbol.iterator]();!(e=(r=o.next()).done);e=!0){let t=n4(r.value,2),e=t[0],n=t[1];this.inputValidationState[e]=n,this.updateInputValidationResults(e)}}catch(t){n=!0,i=t}finally{try{e||null==o.return||o.return()}finally{if(n)throw i}}}setOutputValidationResults(t){var e=!0,n=!1,i=void 0;try{for(var r,o=Object.entries(t)[Symbol.iterator]();!(e=(r=o.next()).done);e=!0){let t=n4(r.value,2),e=t[0],n=t[1];this.outputValidationState[e]=n,this.updateOutputValidationResults(e)}}catch(t){n=!0,i=t}finally{try{e||null==o.return||o.return()}finally{if(n)throw i}}}updateOutputValidationResults(t){let e,n=this.outputValidationState[t],i=this.outputValidationSigns[t];i&&(this.outputValidationSigns[t]=(e=tG(n),i[0].replaceWith(e[0]),i[1].replaceWith(e[1]),e))}updateInputValidationResults(t){let e=tH(this.inputValidationState[t],this.externalValidatorsState[t]),n=this.inputsMap[t];ei(n)&&n.setValidation(e)}runRevalidations(t,e,n){let i=void 0===n?tc.INPUTS:n;if(!t.isRevalidation){var r=!0,o=!1,s=void 0;try{for(var a,l=Object.entries(e)[Symbol.iterator]();!(r=(a=l.next()).done);r=!0){let t=n4(a.value,2)[1];if(null==t?void 0:t.revalidate){var u=!0,c=!1,d=void 0;try{for(var p,h=t.revalidate[Symbol.iterator]();!(u=(p=h.next()).done);u=!0){let e=p.value;i===tc.INPUTS?this.inputValidationRequests.next({field:e,context:t.context,isRevalidation:!0}):this.outputValidationRequests.next({field:e,context:t.context,isRevalidation:!0})}}catch(t){c=!0,d=t}finally{try{u||null==h.return||h.return()}finally{if(c)throw d}}}}}catch(t){o=!0,s=t}finally{try{r||null==l.return||l.return()}finally{if(o)throw s}}}}getValidatedNames(t,e){let n=void 0===e?tc.INPUTS:e;return t?[t]:[...n===tc.INPUTS?this.funcCall.inputs.keys():this.funcCall.outputs.keys()]}getValidExpRun(t){return n2(function*(){t.started=tp()();let e=t.options.immutable_tags||[];return t.options.immutable_tags=e.includes(tX)?e:[...e,tX],t.newId(),t})()}saveExperimentalRun(t){return n2(function*(){let e=yield this.getValidExpRun(t);yield this.saveRun(e)}).call(this)}hideOutput(){if(this._isOutputOutdated.next(!0),this.keepOutput())return;this.outputTabsLabels.forEach(t=>{var e;return t_()(null==(e=this.tabsElem.getPane(t))?void 0:e.header).hide()});let t=this.tabsElem.panes.find(t=>this.inputTabsLabels.includes(t.name));t?this.tabsElem.currentPane=t:t_()(this.tabsElem.root).hide()}richFunctionViewSupportedFormats(){return["Excel"]}richFunctionViewExportExtensions(){return{Excel:"xlsx"}}constructor(t,e){var n;let i=void 0===e?{historyEnabled:!0,isTabbed:!1}:e;super(t,i),n=this,this.options=i,this.inputValidationRequests=new tU.Subject,this.outputValidationRequests=new tU.Subject,this.inputValidationUpdates=new tU.Subject,this.outputValidationUpdates=new tU.Subject,this.runRequests=new tU.Subject,this.isRunning=new tU.BehaviorSubject(!1),this.isUploadMode=new tU.BehaviorSubject(!1),this.inputsOverride={},this.inputsMap={},this.outputValidationSigns={},this.inputValidators={},this.outputValidators={},this.inputValidationState={},this.outputValidationState={},this.externalValidatorsUpdates=new tU.Subject,this.externalValidatorsState={},this.pendingInputValidations=this.inputValidationUpdates.pipe((0,_.startWith)(null),(0,_.map)(()=>this.inputValidationState)),this._isOutputOutdated=new tU.BehaviorSubject(!0),this.isOutputOutdated=this._isOutputOutdated.pipe((0,_.distinctUntilChanged)()),this.blockRuns=new tU.BehaviorSubject(!1),this.prevOpenedTab=null,this.beforeInputPropertyRender=new tU.Subject,this.afterInputPropertyRender=new tU.Subject,this.afterOutputPropertyRender=new tU.Subject,this.afterOutputSacalarTableRender=new tU.Subject,this.formButtons=tM.div(),this.additionalBtns=[],this.navBtns=[],this.tabsElem=tM.tabControl(),this.dfToViewerMapping={},this.focusedInput=null,this.foldedCategoryInputs={},this.richFunctionExport=t=>n2(function*(){let e,i,o,s,a;if(!n.lastCall)throw Error("Function was not called");if(!n.exportConfig.supportedFormats.includes(t))throw Error(`Format "${t}" is not supported.`);if(!n.func)throw Error("The correspoding function is not specified");return n4((yield(e=n.func,i=n.lastCall,o=n.dfToViewerMapping,nH(function*(){let n={},l=(t,e)=>{if(n[t])return n[t];let i=`${t}`;i.length>31&&(i=`${i.slice(0,31)}`);let r=1;for(;e.worksheets.some(t=>t.name.toLowerCase()===i.toLowerCase());){let e=`${t}`;e.length>31-`-${r}`.length&&(e=`${t.slice(0,31-`-${r}`.length)}`),i=`${e}-${r}`,r++}return n[t]=i,i};if("Excel"===t)try{yield r.Utils.loadJsCss(["/js/common/exceljs.min.js","/js/common/html2canvas.min.js"]);let t=window.ExcelJS,n=window.html2canvas,M=new t.Workbook;tM.setDisplay(tL.shell.v.root,!1),nZ(tL.shell.v.root.parentElement,!0,"Generating report. Please do not switch the browser tab...");let N=[],j=t=>t.propertyType===r.TYPE.DATA_FRAME,B=e.inputs.filter(t=>j(t)),U=e.inputs.filter(t=>{let e;return e=t.propertyType,r.TYPES_SCALAR.has(e)}),W=e.outputs.filter(t=>j(t)),H=e.outputs.filter(t=>{let e;return e=t.propertyType,r.TYPES_SCALAR.has(e)});if(B.forEach(t=>{var e;let n=i.inputs[t.name];if(n0(n))return;let r=t.options.caption||t.name,o=null!=(e=M.worksheets.find(t=>t.name===l(r,M)))?e:M.addWorksheet(l(r,M)),u=null==s?void 0:s[t.name],c=null==a?void 0:a[t.name];nK({sheet:o,df:n,validation:u,consistency:c})}),U.length){let t=M.addWorksheet("Input scalars");nz(t,U.map(t=>{var e,n,o;return{name:t.name,caption:null!=(e=t.options.caption)?e:t.name,value:null!=(n=i.inputs[t.name])?n:"",units:null!=(o=t.options.units)?o:"",format:t.format||(t.propertyType===r.TYPE.FLOAT?"G7":"#0.###")}}),s,a)}if(W.forEach(t=>{var e;let n=i.outputs[t.name];if(n0(n))return;let r=t.options.caption||t.name,o=null!=(e=M.worksheets.find(t=>t.name===l(r,M)))?e:M.addWorksheet(l(r,M)),u=null==s?void 0:s[t.name],c=null==a?void 0:a[t.name];nK({sheet:o,df:n,validation:u,consistency:c})}),H.length){let t=M.addWorksheet("Output scalars");nz(t,H.map(t=>{var e,n,r;return{name:t.name,caption:null!=(e=t.options.caption)?e:t.name,value:null!=(n=i.outputs[t.name])?n:"",units:null!=(r=t.options.units)?r:"",format:t.format||"#0.###"}}),s,a)}var u=!0,c=!1,d=void 0;try{for(var p,h=e.outputs.filter(t=>t.propertyType===r.TYPE.GRAPHICS)[Symbol.iterator]();!(u=(p=h.next()).done);u=!0){let t=p.value,e=i.outputs[t.name];if(null==e||""===e)continue;let n=t.options.caption||t.name,r=M.addWorksheet(l(n,M)),o=yield nX(e),s=o.dataUrl,a=o.width,u=o.height;r.addImage(M.addImage({base64:s,extension:"png"}),{tl:{col:0,row:0},ext:{width:a,height:u}})}}catch(t){c=!0,d=t}finally{try{u||null==h.return||h.return()}finally{if(c)throw d}}var f=!0,m=!1,y=void 0;try{for(var v,g=e.inputs.filter(t=>j(t))[Symbol.iterator]();!(f=(v=g.next()).done);f=!0){let t=v.value,e=i.inputs[t.name];if(n0(e))continue;let n=(null!=(x=o[t.name])?x:[]).filter(t=>t&&t.type!==r.VIEWER.GRID).filter(t=>Object.values(tJ).includes(t.type));if(0===n.length)continue;let s=t.options.caption||t.name;var b=!0,A=!1,C=void 0;try{for(var x,w,I=n.entries()[Symbol.iterator]();!(b=(w=I.next()).done);b=!0){let t=nY(w.value,2),n=t[0],i=t[1];N.push({sheet:M.getWorksheet(l(s,M)),viewer:i,col:e.columns.length+2,row:n*nG})}}catch(t){A=!0,C=t}finally{try{b||null==I.return||I.return()}finally{if(A)throw C}}}}catch(t){m=!0,y=t}finally{try{f||null==g.return||g.return()}finally{if(m)throw y}}var R=!0,E=!1,T=void 0;try{for(var O,S=e.outputs.filter(t=>j(t))[Symbol.iterator]();!(R=(O=S.next()).done);R=!0){let t=O.value,e=i.outputs[t.name];if(n0(e))continue;let n=(null!=(F=o[t.name])?F:[]).filter(t=>t&&t.type!==r.VIEWER.GRID).filter(t=>Object.values(tJ).includes(t.type));if(0===n.length)continue;let s=t.options.caption||t.name;var P=!0,k=!1,D=void 0;try{for(var F,V,L=n.entries()[Symbol.iterator]();!(P=(V=L.next()).done);P=!0){let t=nY(V.value,2),n=t[0],i=t[1];if(i)if(i.type===r.VIEWER.STATISTICS){let t=e.columns.length,i=r.DataFrame.fromColumns([r.Column.string("Name",t).init(t=>e.columns.byIndex(t).name),r.Column.int("Values",t).init(t=>e.columns.byIndex(t).stats.valueCount),r.Column.int("Nulls",t).init(t=>e.columns.byIndex(t).stats.missingValueCount),r.Column.float("Min",t).init(t=>e.columns.byIndex(t).stats.min),r.Column.float("Max",t).init(t=>e.columns.byIndex(t).stats.max),r.Column.float("Avg",t).init(t=>e.columns.byIndex(t).stats.avg),r.Column.float("Stdev",t).init(t=>e.columns.byIndex(t).stats.stdev)]);nK({sheet:M.getWorksheet(l(s,M)),df:i,column:e.columns.length+2,row:n*nG})}else N.push({sheet:M.getWorksheet(l(s,M)),viewer:i,col:e.columns.length+2,row:n*nG})}}catch(t){k=!0,D=t}finally{try{P||null==L.return||L.return()}finally{if(k)throw D}}}}catch(t){E=!0,T=t}finally{try{R||null==S.return||S.return()}finally{if(E)throw T}}yield nH(function*(){let t=N.filter(t=>{let e=t.viewer;return null==e?void 0:e.dataFrame}).map(t=>{var e,n;let i=r.Viewer.fromType(t.viewer.type,t.viewer.dataFrame.clone());i.copyViewersLook(t.viewer);let o=tM.div(i.root,{style:{width:"1280px",height:"720px",flex:"none"}});return o.classList.add("ui-box"),o.classList.remove("ui-div"),e=function(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{},i=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(i=i.concat(Object.getOwnPropertySymbols(n).filter(function(t){return Object.getOwnPropertyDescriptor(n,t).enumerable}))),i.forEach(function(e){var i;i=n[e],e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i})}return t}({},t),n={newViewer:i,box:o,rendered:(0,tU.race)(i.onViewerRendered.pipe((0,_.take)(1),(0,_.switchMap)(()=>(0,tU.interval)(10)),(0,_.filter)(()=>!i.isRenderPending)),(0,tU.timer)(2e3)).pipe((0,_.take)(1)).toPromise()},n=null!=n?n:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):(function(t){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e.push.apply(e,n)}return e})(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}),e});try{tL.shell.v.root.after(...t.map(t=>t.box)),yield Promise.all(t.map(t=>t.rendered));var e=!0,i=!1,o=void 0;try{for(var s,a=t[Symbol.iterator]();!(e=(s=a.next()).done);e=!0){let t=s.value,e=t.sheet,i=t.box,r=t.col,o=t.row,a=yield n(i,{logging:!1,ignoreElements:t=>!t.contains(i)&&!i.contains(t)&&!document.head.contains(t)});e.addImage(M.addImage({base64:a.toDataURL(),extension:"png"}),{tl:{col:r,row:o},ext:{width:1280,height:720}})}}catch(t){i=!0,o=t}finally{try{e||null==a.return||a.return()}finally{if(i)throw o}}}finally{var l=!0,u=!1,c=void 0;try{for(var d,p=t[Symbol.iterator]();!(l=(d=p.next()).done);l=!0){let t=d.value,e=t.box,n=t.newViewer;e.remove(),n.detach()}}catch(t){u=!0,c=t}finally{try{l||null==p.return||p.return()}finally{if(u)throw c}}}})();let Y=yield M.xlsx.writeBuffer();return[new Blob([Y],{type:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=UTF-8"}),M]}finally{tM.setDisplay(tL.shell.v.root,!0),nZ(tL.shell.v.root.parentElement,!1)}throw Error("Format is not supported")})())),1)[0]})(),this.exportConfig={supportedExtensions:this.richFunctionViewExportExtensions(),supportedFormats:this.richFunctionViewSupportedFormats(),export:this.richFunctionExport,filename:this.defaultExportFilename}}}function n7(t,e,n,i,r,o,s){try{var a=t[o](s),l=a.value}catch(t){n(t);return}a.done?e(l):Promise.resolve(l).then(i,r)}function it(t){return function(){var e=this,n=arguments;return new Promise(function(i,r){var o=t.apply(e,n);function s(t){n7(o,i,r,s,a,"next",t)}function a(t){n7(o,i,r,s,a,"throw",t)}s(void 0)})}}function ie(t,e,n,i,r,o,s){try{var a=t[o](s),l=a.value}catch(t){n(t);return}a.done?e(l):Promise.resolve(l).then(i,r)}function ii(t){return function(){var e=this,n=arguments;return new Promise(function(i,r){var o=t.apply(e,n);function s(t){ie(o,i,r,s,a,"next",t)}function a(t){ie(o,i,r,s,a,"throw",t)}s(void 0)})}}E("Compute: RichFunctionView Inputs",()=>it(function*(){T(()=>it(function*(){})()),I("Simple inputs setParamValue",()=>it(function*(){let t=new n8("Compute:simpleInputs",{historyEnabled:!1,isTabbed:!1}),e={};t.afterInputPropertyRender.subscribe(({prop:t,input:n})=>{e[t.name]=n}),yield t.isReady.pipe((0,_.filter)(t=>t),(0,_.take)(1)).toPromise(),t.funcCall.setParamValue("a",1),t.funcCall.setParamValue("b",2.2),t.funcCall.setParamValue("c","test"),yield t.doRun();let n={inputs:[["a",1],["b",2.2],["c","test"]],outputs:[["aout",1],["bout",2.2],["cout","test"]]};for(let[i,r]of(tR(tb(t.funcCall),n,{prefix:"funcCall"}),tR(tb(t.lastCall),n,{prefix:"lastCall"}),Object.entries({a:1,b:2.2,c:"test"})))tR(e[i].value,r,{prefix:`input ${i}`})})()),I("Simple inputs inputs tweak",()=>it(function*(){let t=new n8("Compute:simpleInputs",{historyEnabled:!1,isTabbed:!1}),e={a:1,b:2.2,c:"test"},n={};for(let[i,r]of(t.afterInputPropertyRender.subscribe(({prop:t,input:e})=>{n[t.name]=e}),yield t.isReady.pipe((0,_.filter)(t=>t),(0,_.take)(1)).toPromise(),yield tA(t,n),Object.entries(n)))r.value=e[i],r.input.dispatchEvent(new Event("input",{bubbles:!0}));yield tC(t,e),yield t.doRun();let i={inputs:[["a",1],["b",2.2],["c","test"]],outputs:[["aout",1],["bout",2.2],["cout","test"]]};tR(tb(t.funcCall),i,{prefix:"funcCall"}),tR(tb(t.lastCall),i,{prefix:"lastCall"})})()),I("Simple inputs setParamValue rerun",()=>it(function*(){let t=new n8("Compute:simpleInputsDefaultValues",{historyEnabled:!1,isTabbed:!1}),e={};t.afterInputPropertyRender.subscribe(({prop:t,input:n})=>{e[t.name]=n}),yield t.isReady.pipe((0,_.filter)(t=>t),(0,_.take)(1)).toPromise(),yield tA(t,e),yield t.doRun(),t.funcCall.setParamValue("a",2),t.funcCall.setParamValue("b",3.2),t.funcCall.setParamValue("c","test2"),yield t.doRun();let n={inputs:[["a",2],["b",3.2],["c","test2"]],outputs:[["aout",2],["bout",3.2],["cout","test2"]]};for(let[i,r]of(tR(tb(t.funcCall),n,{prefix:"funcCall"}),tR(tb(t.lastCall),n,{prefix:"lastCall"}),Object.entries({a:2,b:3.2,c:"test2"})))tR(e[i].value,r,{prefix:`input ${i}`})})()),I("Simple inputs inputs tweak rerun",()=>it(function*(){let t=new n8("Compute:simpleInputsDefaultValues",{historyEnabled:!1,isTabbed:!1}),e={a:2,b:3.2,c:"test2"},n={};for(let[i,r]of(t.afterInputPropertyRender.subscribe(({prop:t,input:e})=>{n[t.name]=e}),yield t.isReady.pipe((0,_.filter)(t=>t),(0,_.take)(1)).toPromise(),yield tA(t,n),yield t.doRun(),Object.entries(n)))r.value=e[i],r.input.dispatchEvent(new Event("input",{bubbles:!0}));yield tC(t,e),yield t.doRun();let i={inputs:[["a",2],["b",3.2],["c","test2"]],outputs:[["aout",2],["bout",3.2],["cout","test2"]]};tR(tb(t.funcCall),i,{prefix:"funcCall"}),tR(tb(t.lastCall),i,{prefix:"lastCall"})})()),I("Simple inputs default values",()=>it(function*(){let t=new n8("Compute:simpleInputsDefaultValues",{historyEnabled:!1,isTabbed:!1});yield t.isReady.pipe((0,_.filter)(t=>t),(0,_.take)(1)).toPromise();let e=[["a",1],["b",2.2],["c","test"]];yield tx(()=>tR(tb(t.funcCall).inputs,e))})()),I("Complex inputs setParamValue",()=>it(function*(){let t=new n8("Compute:complexInputs",{historyEnabled:!1,isTabbed:!1}),e={df:r.DataFrame.fromColumns([r.Column.fromList("double","col",[1.1,2.2,3.3])]),data:JSON.stringify({a:1,b:"test"})},n={};t.afterInputPropertyRender.subscribe(({prop:t,input:e})=>{n[t.name]=e}),t.funcCall.setParamValue("df",e.df),t.funcCall.setParamValue("data",e.data),yield t.doRun(),tR(tb(t.funcCall),tm(tD),{prefix:"funcCall"}),tR(tb(t.lastCall),tm(tD),{prefix:"lastCall"}),tR(n.data.value,e.data,{prefix:"data"})})()),I("Complex inputs inputs tweak",()=>it(function*(){let t=new n8("Compute:complexInputs",{historyEnabled:!1,isTabbed:!1}),e={df:r.DataFrame.fromColumns([r.Column.fromList("double","col",[1.1,2.2,3.3])]),data:JSON.stringify({a:1,b:"test"})},n={};t.afterInputPropertyRender.subscribe(({prop:t,input:e})=>{n[t.name]=e}),yield t.isReady.pipe((0,_.filter)(t=>t),(0,_.take)(1)).toPromise(),yield tA(t,n),n.data.value=e.data,t.funcCall.setParamValue("df",e.df),yield tC(t,e),yield t.doRun(),tR(tb(t.funcCall),tm(tD),{prefix:"funcCall"}),tR(tb(t.lastCall),tm(tD),{prefix:"lastCall"}),tR(n.data.value,e.data,{prefix:"data"})})()),I("Complex inputs setParamValue rerun",()=>it(function*(){let t=new n8("Compute:complexInputs",{historyEnabled:!1,isTabbed:!1}),e={df:r.DataFrame.fromColumns([r.Column.fromList("double","col",[11.1,12.2,13.3])]),data:JSON.stringify({a:2,b:"pretest"})},n={};t.afterInputPropertyRender.subscribe(({prop:t,input:e})=>{n[t.name]=e}),yield t.isReady.pipe((0,_.filter)(t=>t),(0,_.take)(1)).toPromise(),t.funcCall.setParamValue("df",e.df),t.funcCall.setParamValue("data",e.data),yield t.doRun();let i={df:r.DataFrame.fromColumns([r.Column.fromList("double","col",[1.1,2.2,3.3])]),data:JSON.stringify({a:1,b:"test"})};t.funcCall.setParamValue("df",i.df),t.funcCall.setParamValue("data",i.data),yield t.doRun(),tR(tb(t.funcCall),tm(tD),{prefix:"funcCall"}),tR(tb(t.lastCall),tm(tD),{prefix:"lastCall"}),tR(n.data.value,i.data,{prefix:"data"})})()),I("Complex inputs inputs tweak rerun",()=>it(function*(){let t=new n8("Compute:complexInputs",{historyEnabled:!1,isTabbed:!1}),e={df:r.DataFrame.fromColumns([r.Column.fromList("double","col",[11.1,12.2,13.3])]),data:JSON.stringify({a:2,b:"pretest"})},n={};t.afterInputPropertyRender.subscribe(({prop:t,input:e})=>{n[t.name]=e}),yield t.isReady.pipe((0,_.filter)(t=>t),(0,_.take)(1)).toPromise(),yield tA(t,n),n.data.value=e.data,t.funcCall.setParamValue("df",e.df),yield tC(t,e),yield t.doRun();let i={df:r.DataFrame.fromColumns([r.Column.fromList("double","col",[1.1,2.2,3.3])]),data:JSON.stringify({a:1,b:"test"})};n.data.value=i.data,t.funcCall.setParamValue("df",i.df),yield tC(t,i),yield t.doRun(),tR(tb(t.funcCall),tm(tD),{prefix:"funcCall"}),tR(tb(t.lastCall),tm(tD),{prefix:"lastCall"}),tR(n.data.value,i.data,{prefix:"data"})})())})()),E("Compute: RichFunctionView Validation",()=>it(function*(){T(()=>it(function*(){})()),I("Validate on start",()=>it(function*(){let t=new n8("Compute:validationTest",{historyEnabled:!1,isTabbed:!1});yield t.isReady.pipe((0,_.filter)(t=>t),(0,_.take)(1)).toPromise(),yield tx(()=>tR(t.getValidationState(),{a:{errors:[{description:"Missing value"},{description:"Out of range [1, 10] value: null"}],warnings:[],notifications:[],revalidate:[],context:{}},b:{errors:[{description:"Missing value"},{description:"Out of range [20, 100] value: null"}],warnings:[],notifications:[],revalidate:[],context:{}},x:{errors:[],warnings:[{description:"Try non-null value"}],notifications:[],revalidate:[],context:{}}}))})()),I("Validate on input",()=>it(function*(){let t=new n8("Compute:validationTest",{historyEnabled:!1,isTabbed:!1}),e={a:2.3,b:3.2,x:-1},n={};for(let[i,r]of(t.afterInputPropertyRender.subscribe(({prop:t,input:e})=>{n[t.name]=e}),yield t.isReady.pipe((0,_.filter)(t=>t),(0,_.take)(1)).toPromise(),yield tA(t,n),Object.entries(n)))r.value=e[i],r.input.dispatchEvent(new Event("input",{bubbles:!0}));yield tx(()=>tR(t.getValidationState(),{b:{errors:[{description:"Out of range [20, 100] value: 3.2"}]}}))})()),I("Revalidation sequence",()=>it(function*(){let t=new n8("Compute:globalValidationTest",{historyEnabled:!1,isTabbed:!1}),e={a:30,b:40,c:50},n={};for(let[i,r]of(t.afterInputPropertyRender.subscribe(({prop:t,input:e})=>{n[t.name]=e}),yield t.isReady.pipe((0,_.filter)(t=>t),(0,_.take)(1)).toPromise(),yield tA(t,n),Object.entries(n)))r.value=e[i],r.input.dispatchEvent(new Event("input",{bubbles:!0}));yield tx(()=>tR(t.getValidationState(),{a:{revalidate:["b","c"],context:{isOk:!1},warnings:[{description:"Try lowering a value"}]},b:{warnings:[{description:"Try lowering a value as well"}]},c:{warnings:[{description:"Try lowering a value as well"}]}}))})())})());let ir=new r.Package;function io(t,e,n){return ii(function*(){var i;let o=yield(i={category:t,test:e,testContext:n},u(function*(){let t,e=(null==i?void 0:i.nodeOptions)?i.nodeOptions.package:grok.functions.getCurrentCall().func.package;if(!e)throw Error("Can't run tests outside of the package");let n=null==(R=e.packageOwner)?void 0:R.match(/<([^>]*)>/),r=n?n[1]:"";void 0!=e&&(yield S(e));let o=[],s=Date.now(),l=new P(!(null==i?void 0:i.stressTest));console.log("Running tests..."),console.log(i),null!=i||(i={}),null!=(E=i).testContext||(E.testContext=new x),grok.shell.clearLastError();let v=(t=[],console.log=(...e)=>{t.push(...e),p(...e)},console.info=(...e)=>{t.push(...e),h(...e)},console.warn=(...e)=>{t.push(...e),f(...e)},console.error=(...e)=>{t.push(...e),m(...e)},t);yield(C=y,w=i,u(function*(){try{let h=(null==w?void 0:w.skipToCategory)!=void 0,f=!1;var t=!0,n=!1,i=void 0;try{for(var s,y,g,b,A,x,I=Object.entries(C)[Symbol.iterator]();!(t=(x=I.next()).done);t=!0){let t,n=(s=x.value,function(t){if(Array.isArray(t))return t}(s)||function(t){var e,n,i=null==t?null:"u">typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=i){var r=[],o=!0,s=!1;try{for(i=i.call(t);!(o=(e=i.next()).done)&&(r.push(e.value),2!==r.length);o=!0);}catch(t){s=!0,n=t}finally{try{o||null==i.return||i.return()}finally{if(s)throw n}}return r}}(s)||function(t){if(t){if("string"==typeof t)return a(t,2);var e=Object.prototype.toString.call(t).slice(8,-1);if("Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e)return Array.from(e);if("Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e))return a(t,2)}}(s)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),i=n[0],m=n[1];if((null==(b=w.exclude)?void 0:b.some(t=>i.startsWith(t)))||(null==w?void 0:w.category)!=null&&!i.toLowerCase().startsWith(null==w?void 0:w.category.toLowerCase().trim()))continue;if(h)if(f)h=!1;else{if((null==w?void 0:w.skipToCategory)==null||i.toLowerCase().trim()!==(null==w?void 0:w.skipToCategory.toLowerCase().trim()))continue;f=!0}let C=(null!=(y=m.tests)?y:[]).filter(t=>O(t,m,w));if((w.nodeOnly||w.excludeNodeTests)&&0===C.length||DG.Test.isInBenchmark&&!C.some(t=>{var e,n,i;return null!=(e=null!=(n=null==(i=t.options)?void 0:i.benchmark)?n:m.benchmarks)&&e}))continue;let I=void 0==m.tests?void 0:C.every(t=>{var e;return(null==(e=t.options)?void 0:e.skipReason)||(null==w?void 0:w.test)!=null&&w.test.toLowerCase()!==t.name.toLowerCase()});if(!I){let t=C.filter(t=>{var e;return(null==(e=t.options)?void 0:e.skipReason)||(null==w?void 0:w.test)!=null&&w.test.toLowerCase()!==t.name.toLowerCase()}).length;p(`Package testing: Started {{${i}}}${t>0?` skipped {{${t}}}`:""}`),m.beforeStatus=yield N(m.before,i)}if(w.stressTest&&(C=C.filter(t=>{var e;return null==(e=t.options)?void 0:e.stressTest}),C=function(t){let e=t.slice();return e.sort(()=>Math.random()-.5),e}(C)),(null!=(g=null==(A=w.tags)?void 0:A.length)?g:0)>0&&(C=C.filter(t=>{var e,n;return null==(n=t.options)||null==(e=n.tags)?void 0:e.some(t=>{var e;return(null!=(e=null==w?void 0:w.tags)?e:[]).includes(t)})})),m.beforeStatus){let n=m.beforeStatus.split("\n")[0].trim();(t=Array.from(C.map(t=>({date:new Date().toISOString(),category:i,name:t.name,success:!1,result:n?`before() failed: ${n}`:"before() failed",ms:0,skipped:!1,logs:"",owner:r,package:e.name,widgetsDifference:0,flaking:DG.Test.isReproducing})))).forEach(t=>l.add("package",t))}else t=yield function(t,n,i){return u(function*(){var o,s,a,u,p,h,f,m,y,g,b,A,C,x,w,I,R,E,T;let S=(null!=(o=t.tests)?o:[]).filter(e=>O(e,t,n)),P=[],k=B();if(t.clear){let o=i&&void 0!=n.skipToTest;for(let i=0;i<S.length;i++){S[i].options&&(null==(f=S[i].options)?void 0:f.benchmark)===void 0&&(S[i].options||(S[i].options={}),S[i].options.benchmark=null!=(m=t.benchmarks)&&m);let C=S[i];if(n.test&&n.test.toLowerCase()!==C.name.toLowerCase())continue;if(o)if((null==n?void 0:n.skipToTest)==void 0||C.name.toLowerCase().trim()!==(null==n?void 0:n.skipToTest.toLowerCase().trim()))continue;else o=!1;(null==C?void 0:C.options)&&(C.options.owner=null!=(y=null!=(g=null!=(b=null==(A=S[i].options)?void 0:A.owner)?b:null==t?void 0:t.owner)?g:r)?y:"");let x=yield D(C,null==n?void 0:n.test,v,DG.Test.isInBenchmark?null!=(s=null==(u=S[i].options)?void 0:u.benchmarkTimeout)?s:108e5:null!=(a=null==(p=S[i].options)?void 0:p.timeout)?a:3e4,e.name,n.verbose,l);if(x&&!x.skipped&&(yield j()),x&&(P.push(d(c({},x),{widgetsDifference:B()-k})),n.returnOnFail&&n.skipToTest!==C.name&&!x.success&&!x.skipped))break;n.nodeOptions||(null==(h=n.testContext)?void 0:h.closeAll)===!1||(grok.shell.closeAll(),DG.Balloon.closeAll())}}else{let o=i&&void 0!=n.skipToTest;for(let i=0;i<S.length;i++){let s=S[i];if(n.test&&n.test.toLowerCase()!==s.name.toLowerCase())continue;if(o){(null==n?void 0:n.skipToTest)!=void 0&&s.name.toLowerCase().trim()===(null==n?void 0:n.skipToTest.toLowerCase().trim())&&(o=!1);continue}(null==s?void 0:s.options)&&(s.options.owner=null!=(I=null!=(R=null!=(E=null==(T=S[i].options)?void 0:T.owner)?E:null==t?void 0:t.owner)?R:r)?I:"");let a=yield D(s,null==n?void 0:n.test,v,DG.Test.isInBenchmark?null!=(C=null==(x=S[i].options)?void 0:x.benchmarkTimeout)?C:108e5:null==(w=S[i].options)?void 0:w.timeout,e.name,n.verbose,l);if(a&&!a.skipped&&(yield j()),a&&(P.push(d(c({},a),{widgetsDifference:B()-k})),n.returnOnFail&&n.skipToTest!==s.name&&!a.success&&!a.skipped))break}}return P})()}(m,w,h);let R=t.filter(t=>"skipped"!=t.result);if(I||(m.afterStatus=yield N(m.after,i)),m.afterStatus&&(p(`Package testing: Category after() {{${i}}} failed`),p(`Package testing: Result for {{${i}}} after: ${m.afterStatus}`),R.push({date:new Date().toISOString(),category:i,name:"after",success:!1,result:m.afterStatus,ms:0,skipped:!1,logs:"",owner:r,package:e.name,widgetsDifference:0,flaking:DG.Test.isReproducing})),m.beforeStatus&&(p(`Package testing: Category before() {{${i}}} failed`),p(`Package testing: Result for {{${i}}} before: ${m.beforeStatus}`),R.push({date:new Date().toISOString(),category:i,name:"before",success:!1,result:m.beforeStatus,ms:0,skipped:!1,logs:"",owner:r,package:e.name,widgetsDifference:0,flaking:DG.Test.isReproducing})),o.push(...R),w.returnOnFail&&R.some(t=>!t.success&&!t.skipped&&t.name!==w.skipToTest))break}}catch(t){n=!0,i=t}finally{try{t||null==I.return||I.return()}finally{if(n)throw i}}}finally{console.log=p,console.info=h,console.warn=f,console.error=m}if(w.testContext.catchUnhandled&&!DG.Test.isInBenchmark){let t;try{yield L("the last test"),t=yield grok.shell.lastError}catch(e){t=e.message}if(void 0!=t){let n={logs:"",date:new Date().toISOString(),category:"Unhandled exceptions",name:"Exception",result:null!=t?t:"",success:!t,ms:0,skipped:!1,owner:null!=r?r:"",package:e.name,widgetsDifference:0};p(`Package testing: Unhandled Exception: ${t}`),o.push(d(c({},n),{flaking:DG.Test.isReproducing&&!t})),n.package=e.name,l.add("package",n)}}})()),yield Promise.race([l.sent,F(6e4)]);var g=!0,b=!1,A=void 0;try{for(var C,w,I,R,E,T,V=o[Symbol.iterator]();!(g=(T=V.next()).done);g=!0){let t=T.value;t.result=t.result.toString().replace(/"/g,"'"),void 0!=t.logs&&(t.logs=t.logs.toString().replace(/"/g,"'"))}}catch(t){b=!0,A=t}finally{try{g||null==V.return||V.return()}finally{if(b)throw A}}return o;function N(t,e){return u(function*(){let n;try{void 0!==t&&(yield M(()=>u(function*(){yield t()})(),1e5,`before ${e}: timeout error`))}catch(t){n=yield k(t)}return n})()}function j(){return u(function*(){let t=globalThis.gc;!t||Date.now()-s<5e3||(yield t(),s=Date.now())})()}function B(){if("u">typeof process)return 0;let t=-1;try{t=DG.Widget.getAll().length}catch(t){var e;console.warn(null!=(e=t.message)?e:t)}return t}})());return r.DataFrame.fromObjects(o)})()}function is(){return ii(function*(){yield S(ir,ir.getModule("package-test.js"))})()}})(),compute_test=i})();
|
|
180
180
|
//# sourceMappingURL=package-test.js.map
|