@datagrok/compute 1.45.3 → 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 +10 -0
- package/CHANGELOG.md +16 -0
- package/LICENSE.md +16 -0
- package/dist/package-test.js +179 -1
- package/dist/package-test.js.map +1 -1
- package/dist/package.js +170 -1
- package/dist/package.js.map +1 -1
- package/package.json +21 -51
- package/src/package-api.ts +6 -6
- package/src/package.ts +0 -4
- 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 +230 -0
- package/test-record-1.mp4 +0 -0
- package/tsconfig.json +4 -70
- package/webpack.config.js +3 -69
- package/.eslintrc.json +0 -47
package/dist/package.js
CHANGED
|
@@ -1,2 +1,171 @@
|
|
|
1
|
-
var compute;(()=>{var t={3775(t,e,n){"use strict";n.d(e,{A:()=>a});var i=n(5516),o=n.n(i),s=n(1364),r=n.n(s)()(o());r.push([t.id,".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","",{version:3,sources:["webpack://./node_modules/@datagrok-libraries/compute-utils/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:""}]);const a=r},5167(t,e,n){"use strict";n.d(e,{A:()=>a});var i=n(5516),o=n.n(i),s=n(1364),r=n.n(s)()(o());r.push([t.id,"","",{version:3,sources:[],names:[],mappings:"",sourceRoot:""}]);const a=r},1261(t,e,n){"use strict";n.d(e,{A:()=>a});var i=n(5516),o=n.n(i),s=n(1364),r=n.n(s)()(o());r.push([t.id,".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","",{version:3,sources:["webpack://./node_modules/@datagrok-libraries/compute-utils/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:""}]);const a=r},5366(t,e,n){"use strict";n.d(e,{A:()=>a});var i=n(5516),o=n.n(i),s=n(1364),r=n.n(s)()(o());r.push([t.id,".pipeline-view .d4-ribbon-name.selected {\n color: var(--grey-6)\n}\n\n.pipeline-view .d4-ribbon-name {\n color: var(--blue-1);\n margin: 12px 6px;\n font-weight: normal;\n place-content: center;\n}\n\n.pipeline-view .d4-ribbon-name + .d4-ribbon-name::before {\n color: var(--grey-3);\n}\n\n.pipeline-view .d4-ribbon-name.d4-disabled {\n cursor: default;\n pointer-events: none;\n color: var(--grey-3);\n}\n\n.ui-input-editor button.ui-btn-nav.ui-btn.d4-disabled {\n color: var(--grey-3)\n}","",{version:3,sources:["webpack://./node_modules/@datagrok-libraries/compute-utils/old-views/css/pipeline-view.css"],names:[],mappings:"AAAA;EACE;AACF;;AAEA;EACE,oBAAoB;EACpB,gBAAgB;EAChB,mBAAmB;EACnB,qBAAqB;AACvB;;AAEA;EACE,oBAAoB;AACtB;;AAEA;EACE,eAAe;EACf,oBAAoB;EACpB,oBAAoB;AACtB;;AAEA;EACE;AACF",sourcesContent:[".pipeline-view .d4-ribbon-name.selected {\n color: var(--grey-6)\n}\n\n.pipeline-view .d4-ribbon-name {\n color: var(--blue-1);\n margin: 12px 6px;\n font-weight: normal;\n place-content: center;\n}\n\n.pipeline-view .d4-ribbon-name + .d4-ribbon-name::before {\n color: var(--grey-3);\n}\n\n.pipeline-view .d4-ribbon-name.d4-disabled {\n cursor: default;\n pointer-events: none;\n color: var(--grey-3);\n}\n\n.ui-input-editor button.ui-btn-nav.ui-btn.d4-disabled {\n color: var(--grey-3)\n}"],sourceRoot:""}]);const a=r},1179(t,e,n){"use strict";n.d(e,{A:()=>a});var i=n(5516),o=n.n(i),s=n(1364),r=n.n(s)()(o());r.push([t.id,".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}","",{version:3,sources:["webpack://./node_modules/@datagrok-libraries/compute-utils/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:""}]);const a=r},4350(t,e,n){"use strict";n.d(e,{SJ:()=>l});var i=n(6082),o=n(3508),s=n.n(o);const r=[{name:"NaN",predicate:function(t,e){return Number.isNaN(t)&&Number.isNaN(e)},checker:u},{name:"Null",predicate:function(t,e){return null==t&&null==e},checker:u},{name:"Boolean",predicate:function(t,e){return"boolean"==typeof t&&"boolean"==typeof e},checker:c},{name:"String",predicate:function(t,e){return"string"==typeof t&&"string"==typeof e},checker:c},{name:"Integer",predicate:function(t,e){return Number.isInteger(t)&&Number.isInteger(e)},checker:c},{name:"BigInt",predicate:function(t,e){return"bigint"==typeof t&&"bigint"==typeof e},checker:c},{name:"Float",predicate:function(t,e){return"number"==typeof t&&"number"==typeof e},checker:function(t,e,n){if(!(t===Number.POSITIVE_INFINITY&&e===Number.POSITIVE_INFINITY||t===Number.NEGATIVE_INFINITY&&e===Number.NEGATIVE_INFINITY||isNaN(t)&&isNaN(e)))return Math.abs(t-e)<n.options.floatTolerance?void 0:[{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){const o=[];n.options.forbidAdditionalProps&&o.push(...p([...t.keys()],[...e.keys()]));for(const n of e.keys()){const o=t.get(n),s=e.get(n);i([String(n)],o,s)}return o}},{name:"Set",predicate:function(t,e){return t instanceof Set&&e instanceof Set},checker:function(t,e,n,i){const o=[];if(t.size!==e.size){const n={msg:`Sets are of different size: actual set size is ${t.size} and expected set size is ${e.size}`};o.push(n)}for(const n of e.values()){const e=t.has(n);i([String(n)],e,!0)}return o}},{name:"ArrayBuffer",predicate:function(t,e){return t instanceof ArrayBuffer&&e instanceof ArrayBuffer},checker:function(t,e,n,i){return d(Array.from(new Uint8Array(t)),Array.from(new Uint8Array(e)),0,i)}},{name:"Array",predicate:function(t,e){return t instanceof Array&&e instanceof Array},checker:d},{name:"DataFrame",predicate:function(t,e){return t instanceof i.DataFrame&&e instanceof i.DataFrame},checker:function(t,e,n,i){const o=[];if(t.rowCount!==e.rowCount){const n={msg:`Dataframes has different row count: actual row count is ${t.rowCount} and expected row count is ${e.rowCount}`};o.push(n)}n.options.forbidAdditionalProps&&o.push(...p([...t.columns].map(t=>t.name),[...e.columns].map(t=>t.name)));for(const n of e.columns){const s=t.columns.byName(n.name);if(!s){const t={msg:`Column ${n.name} not found`};o.push(t);continue}if(s.type!==n.type){const t={msg:`Column ${n.name} type expected ${n.type} got ${s.type}`};o.push(t);continue}for(let t=0;t<e.rowCount;t++){const e=s.get(t),o=n.get(t);i([n.name,String(t)],e,o)}}return o}},{name:"DayJs",predicate:function(t,e){return s().isDayjs(t)&&s().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){const o=[];n.options.forbidAdditionalProps&&o.push(...p([...Object.keys(t)],[...Object.keys(e)]));for(const[n,o]of Object.entries(e))i([n],t[n],o);return o}}];class a extends Error{}function l(t,e,n){new f(n).run(t,e)}function u(){}function c(t,e){if(t!==e)return[{msg:`Expected ${e}, got ${t}`}]}function d(t,e,n,i){const o=[];if(t.length!==e.length){const n={msg:`Arrays are of different length: actual array length is ${t.length} and expected array length is ${e.length}`};o.push(n)}for(let n=0;n<t.length;n++)i([String(n)],t[n],e[n]);return o}function p(t,e){const n=[],i=new Set(e);for(const e of t)if(!i.has(e)){const t={msg:`Additional key/col item in actual data found: ${e}`};n.push(t)}return n}const h={floatTolerance:.001,maxErrorsReport:5,forbidAdditionalProps:!1,maxDepth:128,checkersSeq:r,prefix:""};class f{constructor(t={}){this.options=Object.assign(Object.assign({},h),t),this.state={errors:[],currentPath:[],options:this.options}}run(t,e){this.matchChecker(t,e),this.checkErrorsLimit(0)}checkDeep(t,e,n){const i=t.length;if(this.state.currentPath.push(...t),this.state.currentPath.length>this.options.maxDepth)throw new a(`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;for(const{predicate:i,checker:o}of this.options.checkersSeq)if(i(t,e)){n=!0;const i=o(t,e,this.state,this.checkDeep.bind(this));i&&i.map(t=>this.addError(t));break}if(!n){const n={msg:`Type mismatch or no checker defined: expected ${e}, got ${t}`};this.addError(n)}}addError(t){var e,n;const i={path:[...null!==(e=this.state.currentPath)&&void 0!==e?e:[],...null!==(n=t.path)&&void 0!==n?n:[]],msg:t.msg};this.state.errors.push(i),this.checkErrorsLimit()}checkErrorsLimit(t=this.options.maxErrorsReport){if(this.state.errors.length>t){const t=this.makeReport();throw new a(t)}}makeReport(){return this.state.errors.map(t=>{var e;const n=(null!==(e=t.path)&&void 0!==e?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")}}},5520(t,e,n){"use strict";n.d(e,{iu:()=>u,lK:()=>l});var i=n(6082),o=n(1825),s=n(3508),r=n.n(s);const a="_DG_CUSTOM_SERIALIZED_TOKEN_";function l(t,e={}){return JSON.stringify(t,function(t,n){return n===1/0?{[a]:"Infinity",value:!0}:n===-1/0?{[a]:"-Infinity",value:!0}:Number.isNaN(n)?{[a]:"NaN",value:!0}:n instanceof i.DataFrame&&!e.useJsonDF?{[a]:"DataFrame",value:(0,o.SM)(n.toByteArray())}:n instanceof i.DataFrame&&e.useJsonDF?{[a]:"DataFrameJSON",value:n.toJson()}:n instanceof ArrayBuffer?{[a]:"ArrayBuffer",value:(0,o.SM)(new Uint8Array(n))}:n instanceof Map?{[a]:"Map",value:Array.from(n)}:n instanceof Set?{[a]:"Set",value:Array.from(n)}:r().isDayjs(this[t])?{[a]:"DayJs",value:this[t].toISOString()}:n},e.space)}function u(t){return JSON.parse(t,c)}function c(t,e){if(e&&e[a]&&e.value)switch(e[a]){case"DataFrame":return i.DataFrame.fromByteArray((0,o.Fo)(e.value));case"DataFrameJSON":return i.DataFrame.fromJson(JSON.stringify(e.value));case"ArrayBuffer":return(0,o.Fo)(e.value).buffer;case"Map":return new Map(e.value);case"DayJs":return r()(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}},1364(t){"use strict";t.exports=function(t){var e=[];return e.toString=function(){return this.map(function(e){var n="",i=void 0!==e[5];return e[4]&&(n+="@supports (".concat(e[4],") {")),e[2]&&(n+="@media ".concat(e[2]," {")),i&&(n+="@layer".concat(e[5].length>0?" ".concat(e[5]):""," {")),n+=t(e),i&&(n+="}"),e[2]&&(n+="}"),e[4]&&(n+="}"),n}).join("")},e.i=function(t,n,i,o,s){"string"==typeof t&&(t=[[null,t,void 0]]);var r={};if(i)for(var a=0;a<this.length;a++){var l=this[a][0];null!=l&&(r[l]=!0)}for(var u=0;u<t.length;u++){var c=[].concat(t[u]);i&&r[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):c[2]=n),o&&(c[4]?(c[1]="@supports (".concat(c[4],") {").concat(c[1],"}"),c[4]=o):c[4]="".concat(o)),e.push(c))}},e}},5516(t){"use strict";t.exports=function(t){var e=t[1],n=t[3];if(!n)return e;if("function"==typeof btoa){var i=btoa(unescape(encodeURIComponent(JSON.stringify(n)))),o="sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(i),s="/*# ".concat(o," */");return[e].concat([s]).join("\n")}return[e].join("\n")}},4112(t){t.exports=function(){"use strict";var t="minute",e=/[+-]\d\d(?::?\d\d)?/g,n=/([+-]|\d\d)/g;return function(i,o,s){var r=o.prototype;s.utc=function(t){return new o({date:t,utc:!0,args:arguments})},r.utc=function(e){var n=s(this.toDate(),{locale:this.$L,utc:!0});return e?n.add(this.utcOffset(),t):n},r.local=function(){return s(this.toDate(),{locale:this.$L,utc:!1})};var a=r.parse;r.parse=function(t){t.utc&&(this.$u=!0),this.$utils().u(t.$offset)||(this.$offset=t.$offset),a.call(this,t)};var l=r.init;r.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=r.utcOffset;r.utcOffset=function(i,o){var s=this.$utils().u;if(s(i))return this.$u?0:s(this.$offset)?u.call(this):this.$offset;if("string"==typeof i&&(i=function(t){void 0===t&&(t="");var i=t.match(e);if(!i)return null;var o=(""+i[0]).match(n)||["-",0,0],s=o[0],r=60*+o[1]+ +o[2];return 0===r?0:"+"===s?r:-r}(i),null===i))return this;var r=Math.abs(i)<=16?60*i:i;if(0===r)return this.utc(o);var a=this.clone();if(o)return a.$offset=r,a.$u=!1,a;var l=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();return(a=this.local().add(r+l,t)).$offset=r,a.$x.$localOffset=l,a};var c=r.format;r.format=function(t){var e=t||(this.$u?"YYYY-MM-DDTHH:mm:ss[Z]":"");return c.call(this,e)},r.valueOf=function(){var t=this.$utils().u(this.$offset)?0:this.$offset+(this.$x.$localOffset||this.$d.getTimezoneOffset());return this.$d.valueOf()-6e4*t},r.isUTC=function(){return!!this.$u},r.toISOString=function(){return this.toDate().toISOString()},r.toString=function(){return this.toDate().toUTCString()};var d=r.toDate;r.toDate=function(t){return"s"===t&&this.$offset?s(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate():d.call(this)};var p=r.diff;r.diff=function(t,e,n){if(t&&this.$u===t.$u)return p.call(this,t,e,n);var i=this.local(),o=s(t).local();return p.call(i,o,e,n)}}}()},6267(t,e,n){"use strict";n.d(e,{L:()=>z});var i=Uint8Array,o=Uint16Array,s=Uint32Array,r=new i([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),a=new i([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),l=new i([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),u=function(t,e){for(var n=new o(31),i=0;i<31;++i)n[i]=e+=1<<t[i-1];var r=new s(n[30]);for(i=1;i<30;++i)for(var a=n[i];a<n[i+1];++a)r[a]=a-n[i]<<5|i;return[n,r]},c=u(r,2),d=c[0],p=c[1];d[28]=258,p[258]=28;for(var h=u(a,0),f=(h[0],h[1]),v=new o(32768),m=0;m<32768;++m){var g=(43690&m)>>>1|(21845&m)<<1;g=(61680&(g=(52428&g)>>>2|(13107&g)<<2))>>>4|(3855&g)<<4,v[m]=((65280&g)>>>8|(255&g)<<8)>>>1}var y=function(t,e,n){for(var i=t.length,s=0,r=new o(e);s<i;++s)t[s]&&++r[t[s]-1];var a,l=new o(e);for(s=0;s<e;++s)l[s]=l[s-1]+r[s-1]<<1;if(n){a=new o(1<<e);var u=15-e;for(s=0;s<i;++s)if(t[s])for(var c=s<<4|t[s],d=e-t[s],p=l[t[s]-1]++<<d,h=p|(1<<d)-1;p<=h;++p)a[v[p]>>>u]=c}else for(a=new o(i),s=0;s<i;++s)t[s]&&(a[s]=v[l[t[s]-1]++]>>>15-t[s]);return a},b=new i(288);for(m=0;m<144;++m)b[m]=8;for(m=144;m<256;++m)b[m]=9;for(m=256;m<280;++m)b[m]=7;for(m=280;m<288;++m)b[m]=8;var C=new i(32);for(m=0;m<32;++m)C[m]=5;var w=y(b,9,0),A=y(C,5,0),x=function(t){return(t+7)/8|0},I=function(t,e,n){(null==e||e<0)&&(e=0),(null==n||n>t.length)&&(n=t.length);var r=new(2==t.BYTES_PER_ELEMENT?o:4==t.BYTES_PER_ELEMENT?s:i)(n-e);return r.set(t.subarray(e,n)),r},E=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],T=function(t,e,n){var i=new Error(e||E[t]);if(i.code=t,Error.captureStackTrace&&Error.captureStackTrace(i,T),!n)throw i;return i},R=function(t,e,n){n<<=7&e;var i=e/8|0;t[i]|=n,t[i+1]|=n>>>8},S=function(t,e,n){n<<=7&e;var i=e/8|0;t[i]|=n,t[i+1]|=n>>>8,t[i+2]|=n>>>16},F=function(t,e){for(var n=[],s=0;s<t.length;++s)t[s]&&n.push({s,f:t[s]});var r=n.length,a=n.slice();if(!r)return[D,0];if(1==r){var l=new i(n[0].s+1);return l[n[0].s]=1,[l,1]}n.sort(function(t,e){return t.f-e.f}),n.push({s:-1,f:25001});var u=n[0],c=n[1],d=0,p=1,h=2;for(n[0]={s:-1,f:u.f+c.f,l:u,r:c};p!=r-1;)u=n[n[d].f<n[h].f?d++:h++],c=n[d!=p&&n[d].f<n[h].f?d++:h++],n[p++]={s:-1,f:u.f+c.f,l:u,r:c};var f=a[0].s;for(s=1;s<r;++s)a[s].s>f&&(f=a[s].s);var v=new o(f+1),m=P(n[p-1],v,0);if(m>e){s=0;var g=0,y=m-e,b=1<<y;for(a.sort(function(t,e){return v[e.s]-v[t.s]||t.f-e.f});s<r;++s){var C=a[s].s;if(!(v[C]>e))break;g+=b-(1<<m-v[C]),v[C]=e}for(g>>>=y;g>0;){var w=a[s].s;v[w]<e?g-=1<<e-v[w]++-1:++s}for(;s>=0&&g;--s){var A=a[s].s;v[A]==e&&(--v[A],++g)}m=e}return[new i(v),m]},P=function(t,e,n){return-1==t.s?Math.max(P(t.l,e,n+1),P(t.r,e,n+1)):e[t.s]=n},O=function(t){for(var e=t.length;e&&!t[--e];);for(var n=new o(++e),i=0,s=t[0],r=1,a=function(t){n[i++]=t},l=1;l<=e;++l)if(t[l]==s&&l!=e)++r;else{if(!s&&r>2){for(;r>138;r-=138)a(32754);r>2&&(a(r>10?r-11<<5|28690:r-3<<5|12305),r=0)}else if(r>3){for(a(s),--r;r>6;r-=6)a(8304);r>2&&(a(r-3<<5|8208),r=0)}for(;r--;)a(s);r=1,s=t[l]}return[n.subarray(0,i),e]},k=function(t,e){for(var n=0,i=0;i<e.length;++i)n+=t[i]*e[i];return n},B=function(t,e,n){var i=n.length,o=x(e+2);t[o]=255&i,t[o+1]=i>>>8,t[o+2]=255^t[o],t[o+3]=255^t[o+1];for(var s=0;s<i;++s)t[o+s+4]=n[s];return 8*(o+4+i)},V=function(t,e,n,i,s,u,c,d,p,h,f){R(e,f++,n),++s[256];for(var v=F(s,15),m=v[0],g=v[1],x=F(u,15),I=x[0],E=x[1],T=O(m),P=T[0],V=T[1],L=O(I),D=L[0],N=L[1],M=new o(19),_=0;_<P.length;++_)M[31&P[_]]++;for(_=0;_<D.length;++_)M[31&D[_]]++;for(var j=F(M,7),U=j[0],$=j[1],H=19;H>4&&!U[l[H-1]];--H);var W,Y,J,G,q=h+5<<3,z=k(s,b)+k(u,C)+c,Z=k(s,m)+k(u,I)+c+14+3*H+k(M,U)+(2*M[16]+3*M[17]+7*M[18]);if(q<=z&&q<=Z)return B(e,f,t.subarray(p,p+h));if(R(e,f,1+(Z<z)),f+=2,Z<z){W=y(m,g,0),Y=m,J=y(I,E,0),G=I;var K=y(U,$,0);for(R(e,f,V-257),R(e,f+5,N-1),R(e,f+10,H-4),f+=14,_=0;_<H;++_)R(e,f+3*_,U[l[_]]);f+=3*H;for(var X=[P,D],Q=0;Q<2;++Q){var tt=X[Q];for(_=0;_<tt.length;++_){var et=31&tt[_];R(e,f,K[et]),f+=U[et],et>15&&(R(e,f,tt[_]>>>5&127),f+=tt[_]>>>12)}}}else W=w,Y=b,J=A,G=C;for(_=0;_<d;++_)if(i[_]>255){et=i[_]>>>18&31,S(e,f,W[et+257]),f+=Y[et+257],et>7&&(R(e,f,i[_]>>>23&31),f+=r[et]);var nt=31&i[_];S(e,f,J[nt]),f+=G[nt],nt>3&&(S(e,f,i[_]>>>5&8191),f+=a[nt])}else S(e,f,W[i[_]]),f+=Y[i[_]];return S(e,f,W[256]),f+Y[256]},L=new s([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),D=new i(0),N=function(){for(var t=new Int32Array(256),e=0;e<256;++e){for(var n=e,i=9;--i;)n=(1&n&&-306674912)^n>>>1;t[e]=n}return t}(),M=function(){var t=-1;return{p:function(e){for(var n=t,i=0;i<e.length;++i)n=N[255&n^e[i]]^n>>>8;t=n},d:function(){return~t}}},_=function(t,e,n,l,u){return function(t,e,n,l,u,c){var d=t.length,h=new i(l+d+5*(1+Math.ceil(d/7e3))+u),v=h.subarray(l,h.length-u),m=0;if(!e||d<8)for(var g=0;g<=d;g+=65535){var y=g+65535;y>=d&&(v[m>>3]=c),m=B(v,m+1,t.subarray(g,y))}else{for(var b=L[e-1],C=b>>>13,w=8191&b,A=(1<<n)-1,E=new o(32768),T=new o(A+1),R=Math.ceil(n/3),S=2*R,F=function(e){return(t[e]^t[e+1]<<R^t[e+2]<<S)&A},P=new s(25e3),O=new o(288),k=new o(32),N=0,M=0,_=(g=0,0),j=0,U=0;g<d;++g){var $=F(g),H=32767&g,W=T[$];if(E[H]=W,T[$]=H,j<=g){var Y=d-g;if((N>7e3||_>24576)&&Y>423){m=V(t,v,0,P,O,k,M,_,U,g-U,m),_=N=M=0,U=g;for(var J=0;J<286;++J)O[J]=0;for(J=0;J<30;++J)k[J]=0}var G=2,q=0,z=w,Z=H-W&32767;if(Y>2&&$==F(g-Z))for(var K=Math.min(C,Y)-1,X=Math.min(32767,g),Q=Math.min(258,Y);Z<=X&&--z&&H!=W;){if(t[g+G]==t[g+G-Z]){for(var tt=0;tt<Q&&t[g+tt]==t[g+tt-Z];++tt);if(tt>G){if(G=tt,q=Z,tt>K)break;var et=Math.min(Z,tt-2),nt=0;for(J=0;J<et;++J){var it=g-Z+J+32768&32767,ot=it-E[it]+32768&32767;ot>nt&&(nt=ot,W=it)}}}Z+=(H=W)-(W=E[H])+32768&32767}if(q){P[_++]=268435456|p[G]<<18|f[q];var st=31&p[G],rt=31&f[q];M+=r[st]+a[rt],++O[257+st],++k[rt],j=g+G,++N}else P[_++]=t[g],++O[t[g]]}}m=V(t,v,c,P,O,k,M,_,U,g-U,m),!c&&7&m&&(m=B(v,m+1,D))}return I(h,0,l+x(m)+u)}(t,null==e.level?6:e.level,null==e.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(t.length)))):12+e.mem,n,l,!u)},j=function(t,e){var n={};for(var i in t)n[i]=t[i];for(var i in e)n[i]=e[i];return n},U=function(t,e,n){for(;n;++e)t[e]=n,n>>>=8};function $(t,e){return _(t,e||{},0,0)}var H=function(t,e,n,o){for(var s in t){var r=t[s],a=e+s,l=o;Array.isArray(r)&&(l=j(o,r[1]),r=r[0]),r instanceof i?n[a]=[r,l]:(n[a+="/"]=[new i(0),l],H(r,a,n,o))}},W="undefined"!=typeof TextEncoder&&new TextEncoder,Y="undefined"!=typeof TextDecoder&&new TextDecoder;try{Y.decode(D,{stream:!0})}catch(t){}function J(t,e){if(e){for(var n=new i(t.length),o=0;o<t.length;++o)n[o]=t.charCodeAt(o);return n}if(W)return W.encode(t);var s=t.length,r=new i(t.length+(t.length>>1)),a=0,l=function(t){r[a++]=t};for(o=0;o<s;++o){if(a+5>r.length){var u=new i(a+8+(s-o<<1));u.set(r),r=u}var c=t.charCodeAt(o);c<128||e?l(c):c<2048?(l(192|c>>6),l(128|63&c)):c>55295&&c<57344?(l(240|(c=65536+(1047552&c)|1023&t.charCodeAt(++o))>>18),l(128|c>>12&63),l(128|c>>6&63),l(128|63&c)):(l(224|c>>12),l(128|c>>6&63),l(128|63&c))}return I(r,0,a)}var G=function(t){var e=0;if(t)for(var n in t){var i=t[n].length;i>65535&&T(9),e+=i+4}return e},q=function(t,e,n,i,o,s,r,a){var l=i.length,u=n.extra,c=a&&a.length,d=G(u);U(t,e,null!=r?33639248:67324752),e+=4,null!=r&&(t[e++]=20,t[e++]=n.os),t[e]=20,e+=2,t[e++]=n.flag<<1|(s<0&&8),t[e++]=o&&8,t[e++]=255&n.compression,t[e++]=n.compression>>8;var p=new Date(null==n.mtime?Date.now():n.mtime),h=p.getFullYear()-1980;if((h<0||h>119)&&T(10),U(t,e,h<<25|p.getMonth()+1<<21|p.getDate()<<16|p.getHours()<<11|p.getMinutes()<<5|p.getSeconds()>>>1),e+=4,-1!=s&&(U(t,e,n.crc),U(t,e+4,s<0?-s-2:s),U(t,e+8,n.size)),U(t,e+12,l),U(t,e+14,d),e+=16,null!=r&&(U(t,e,c),U(t,e+6,n.attrs),U(t,e+10,r),e+=14),t.set(i,e),e+=l,d)for(var f in u){var v=u[f],m=v.length;U(t,e,+f),U(t,e+2,m),t.set(v,e+4),e+=4+m}return c&&(t.set(a,e),e+=c),e};function z(t,e){e||(e={});var n={},o=[];H(t,"",n,e);var s=0,r=0;for(var a in n){var l=n[a],u=l[0],c=l[1],d=0==c.level?0:8,p=(I=J(a)).length,h=c.comment,f=h&&J(h),v=f&&f.length,m=G(c.extra);p>65535&&T(11);var g=d?$(u,c):u,y=g.length,b=M();b.p(u),o.push(j(c,{size:u.length,crc:b.d(),c:g,f:I,m:f,u:p!=a.length||f&&h.length!=v,o:s,compression:d})),s+=30+p+m+y,r+=76+2*(p+m)+(v||0)+y}for(var C=new i(r+22),w=s,A=r-s,x=0;x<o.length;++x){var I=o[x];q(C,I.o,I,I.f,I.u,I.c.length);var E=30+I.f.length+G(I.extra);C.set(I.c,I.o+E),q(C,s,I,I.f,I.u,I.c.length,I.o,I.m),s+=16+E+(I.m?I.m.length:0)}return function(t,e,n,i,o){U(t,e,101010256),U(t,e+8,n),U(t,e+10,n),U(t,e+12,i),U(t,e+16,o)}(C,s,o.length,A,w),C}"function"==typeof queueMicrotask?queueMicrotask:"function"==typeof setTimeout&&setTimeout},6186(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 s={},r=[],a=0;a<t.length;a++){var l=t[a],u=i.base?l[0]+i.base:l[0],c=s[u]||0,d="".concat(u," ").concat(c);s[u]=c+1;var p=n(d),h={css:l[1],media:l[2],sourceMap:l[3],supports:l[4],layer:l[5]};if(-1!==p)e[p].references++,e[p].updater(h);else{var f=o(h,i);i.byIndex=a,e.splice(a,0,{identifier:d,updater:f,references:1})}r.push(d)}return r}function o(t,e){var n=e.domAPI(e);return n.update(t),function(e){if(e){if(e.css===t.css&&e.media===t.media&&e.sourceMap===t.sourceMap&&e.supports===t.supports&&e.layer===t.layer)return;n.update(t=e)}else n.remove()}}t.exports=function(t,o){var s=i(t=t||[],o=o||{});return function(t){t=t||[];for(var r=0;r<s.length;r++){var a=n(s[r]);e[a].references--}for(var l=i(t,o),u=0;u<s.length;u++){var c=n(s[u]);0===e[c].references&&(e[c].updater(),e.splice(c,1))}s=l}}},7433(t){"use strict";var e={};t.exports=function(t,n){var i=function(t){if(void 0===e[t]){var n=document.querySelector(t);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(t){n=null}e[t]=n}return e[t]}(t);if(!i)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");i.appendChild(n)}},8990(t){"use strict";t.exports=function(t){var e=document.createElement("style");return t.setAttributes(e,t.attributes),t.insert(e,t.options),e}},8626(t,e,n){"use strict";t.exports=function(t){var e=n.nc;e&&t.setAttribute("nonce",e)}},2155(t){"use strict";t.exports=function(t){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var e=t.insertStyleElement(t);return{update:function(n){!function(t,e,n){var i="";n.supports&&(i+="@supports (".concat(n.supports,") {")),n.media&&(i+="@media ".concat(n.media," {"));var o=void 0!==n.layer;o&&(i+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),i+=n.css,o&&(i+="}"),n.media&&(i+="}"),n.supports&&(i+="}");var s=n.sourceMap;s&&"undefined"!=typeof btoa&&(i+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(s))))," */")),e.styleTagTransform(i,t,e.options)}(e,t,n)},remove:function(){!function(t){if(null===t.parentNode)return!1;t.parentNode.removeChild(t)}(e)}}}},9827(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))}}},6998(t,e,n){"use strict";var i=n(6186),o=n.n(i),s=n(2155),r=n.n(s),a=n(7433),l=n.n(a),u=n(8626),c=n.n(u),d=n(8990),p=n.n(d),h=n(9827),f=n.n(h),v=n(3775),m={};m.styleTagTransform=f(),m.setAttributes=c(),m.insert=l().bind(null,"head"),m.domAPI=r(),m.insertStyleElement=p(),o()(v.A,m),v.A&&v.A.locals&&v.A.locals},9192(t,e,n){"use strict";var i=n(6186),o=n.n(i),s=n(2155),r=n.n(s),a=n(7433),l=n.n(a),u=n(8626),c=n.n(u),d=n(8990),p=n.n(d),h=n(9827),f=n.n(h),v=n(5167),m={};m.styleTagTransform=f(),m.setAttributes=c(),m.insert=l().bind(null,"head"),m.domAPI=r(),m.insertStyleElement=p(),o()(v.A,m),v.A&&v.A.locals&&v.A.locals},8550(t,e,n){"use strict";var i=n(6186),o=n.n(i),s=n(2155),r=n.n(s),a=n(7433),l=n.n(a),u=n(8626),c=n.n(u),d=n(8990),p=n.n(d),h=n(9827),f=n.n(h),v=n(1261),m={};m.styleTagTransform=f(),m.setAttributes=c(),m.insert=l().bind(null,"head"),m.domAPI=r(),m.insertStyleElement=p(),o()(v.A,m),v.A&&v.A.locals&&v.A.locals},4315(t,e,n){"use strict";var i=n(6186),o=n.n(i),s=n(2155),r=n.n(s),a=n(7433),l=n.n(a),u=n(8626),c=n.n(u),d=n(8990),p=n.n(d),h=n(9827),f=n.n(h),v=n(5366),m={};m.styleTagTransform=f(),m.setAttributes=c(),m.insert=l().bind(null,"head"),m.domAPI=r(),m.insertStyleElement=p(),o()(v.A,m),v.A&&v.A.locals&&v.A.locals},5940(t,e,n){"use strict";var i=n(6186),o=n.n(i),s=n(2155),r=n.n(s),a=n(7433),l=n.n(a),u=n(8626),c=n.n(u),d=n(8990),p=n.n(d),h=n(9827),f=n.n(h),v=n(1179),m={};m.styleTagTransform=f(),m.setAttributes=c(),m.insert=l().bind(null,"head"),m.domAPI=r(),m.insertStyleElement=p(),o()(v.A,m),v.A&&v.A.locals&&v.A.locals},8476(t,e,n){"use strict";n.d(e,{S:()=>d});var i=n(4328),o=n(7389),s=n(6082),r=n(1757),a=n.n(r),l=n(4260),u=n(810),c=function(t,e,n,i){return new(n||(n=Promise))(function(o,s){function r(t){try{l(i.next(t))}catch(t){s(t)}}function a(t){try{l(i.throw(t))}catch(t){s(t)}}function l(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(r,a)}l((i=i.apply(t,e||[])).next())})};class d extends s.TableView{static fromComparedRuns(t,e){return c(this,arguments,void 0,function*(t,e,n={parentView:void 0,parentCall:void 0}){const o=(0,u.fo)(t,e,n),s=[...i.shell.views].find(t=>t.type===l.sk||t.type===l.eP||t.type===l.r0);return s&&(i.shell.v=s),new this(o,n)})}constructor(t,e={}){super(window.grok_TableView(t.dart,!1)),e.parentView&&(this.parentView=e.parentView),this.parentCall=e.parentCall||i.functions.getCurrentCall()}showAllColumns(){const t=this.dataFrame.columns.names();this.grid.columns.setVisible(t)}showChangingColumns(){const t=this.dataFrame.columns.names().filter(t=>s.TYPES_SCALAR.has(this.dataFrame.getCol(t).type)&&this.dataFrame.getCol(t).categories.length>1||!s.TYPES_SCALAR.has(this.dataFrame.getCol(t).type));this.grid.columns.setVisible(t)}defaultCustomize(){var t;const e=o.iconFA("compress-alt",()=>{this.showChangingColumns(),a()(n).show(),a()(e).hide()},"Hide constant parameters"),n=o.iconFA("expand-arrows-alt",()=>{this.showAllColumns(),a()(n).hide(),a()(e).show()},"Show all parameters");a()(e).hide(),this.setRibbonPanels([...this.getRibbonPanels(),[e,n]]),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(l._W).width=70;for(let e=0;e<this.grid.columns.length;e++){const n=this.grid.columns.byIndex(e);(null===(t=n.column)||void 0===t?void 0:t.temp[l.NT])&&(n.width=350,n.cellType="html")}const r=new s.LruCache;this.grid.onCellPrepare(t=>c(this,void 0,void 0,function*(){if(!t.isColHeader&&!t.isRowHeader){if(t.tableColumn.name===l._W){t.customText="";const e=String(t.cell.value).split(" - "),n=e.length>1?[e[0],o.element("br"),e[1]]:e;return t.element=o.div(n,{style:{writingMode:"vertical-rl",textOrientation:"mixed",margin:"auto"}}),void(t.element.parentElement.style.display="flex")}if(t.tableColumn&&t.tableColumn.temp[l.NT]){const e=t.cell.value,n=t.tableColumn.temp[l.NT],i=n.type,o=()=>c(this,void 0,void 0,function*(){const o=Object.values(l.CB).includes(i)?s.Viewer.fromType(i,e):yield e.plot.fromType(i);return t.tableColumn.temp[l.NT].look?o.setOptions(t.tableColumn.temp[l.NT].look):(o.setOptions(n),t.tableColumn.temp[l.NT]=o.getOptions()),o.root}),a=`${e.id}_${i}`;if(r.get(a))t.element=r.get(a);else{const e=yield o();r.set(a,e),t.element=e}t.element.style.width="100%",t.element.style.height="100%"}}}));const u=o.box(o.div([],{style:{minHeight:"100px"}})),d=i.events.onCurrentViewChanged.subscribe(()=>{i.shell.v.id===this.id?i.shell.dockManager.dock(u,"down",null,"Comparison chart",.25):i.shell.dockManager.close(u)}),p=this.grid.onCellClick.subscribe(t=>{var e;if(i.shell.v.id===this.id&&t.isColHeader&&(null===(e=t.tableColumn)||void 0===e?void 0:e.type)===s.TYPE.DATA_FRAME&&[s.VIEWER.LINE_CHART,s.VIEWER.SCATTER_PLOT,s.VIEWER.HISTOGRAM,s.VIEWER.BOX_PLOT].includes(t.tableColumn.temp[l.NT].type)){i.shell.dockManager.findNode(u)||i.shell.dockManager.dock(u,"down",null,"Comparison chart",.25);const e=t=>{const e=s.toJs(t.get(0)).clone();e.columns.addNew(l.eX,s.TYPE.STRING).init(t.dataFrame.get(l._W,0));for(let n=1;n<t.length;n++){const i=s.toJs(t.get(n)).clone();i.columns.addNew(l.eX,s.TYPE.STRING).init(t.dataFrame.get(l._W,n));const o=[s.COLUMN_TYPE.INT,s.COLUMN_TYPE.FLOAT];for(let t=0;t<i.columns.length;t++){const n=i.columns.byIndex(t),r=e.columns.byIndex(t);n.type!==r.type&&o.includes(n.type)&&o.includes(r.type)&&(n.type!==s.COLUMN_TYPE.FLOAT&&i.columns.replace(n,n.convertTo(s.COLUMN_TYPE.FLOAT)),r.type!==s.COLUMN_TYPE.FLOAT&&e.columns.replace(r,r.convertTo(s.COLUMN_TYPE.FLOAT)))}e.append(i,!0)}return e},n=(e,n,i)=>{var o;switch(null===(o=t.tableColumn)||void 0===o?void 0:o.temp[l.NT].type){case s.VIEWER.LINE_CHART:return i.plot.line(Object.assign(Object.assign({},n),{split:l.eX})).root;case s.VIEWER.SCATTER_PLOT:return i.plot.scatter(Object.assign(Object.assign({},n),{color:l.eX})).root;case s.VIEWER.HISTOGRAM:return i.plot.histogram(Object.assign(Object.assign({},n),{split:l.eX})).root;case s.VIEWER.BOX_PLOT:return i.plot.box(Object.assign(Object.assign({},n),{category:l.eX})).root}};o.setUpdateIndicator(u,!0),setTimeout(()=>{var i;if(!t.tableColumn.temp.unitedPlot){const s=t.tableColumn.temp[l.NT].look,r=e(t.tableColumn);t.tableColumn.temp.unitedPlot=n(null===(i=t.tableColumn)||void 0===i?void 0:i.temp[l.NT].type,s,r),o.setUpdateIndicator(u,!1)}o.empty(u),u.appendChild(t.tableColumn.temp.unitedPlot)},10)}else i.shell.dockManager.close(u)});this.subs.push(p,d)}}},810(t,e,n){"use strict";n.d(e,{Bu:()=>d,ZD:()=>p,fo:()=>h});var i=n(4328),o=n(7389),s=n(6082),r=n(1757),a=n.n(r),l=n(4260),u=n(1599),c=function(t,e,n,i){return new(n||(n=Promise))(function(o,s){function r(t){try{l(i.next(t))}catch(t){s(t)}}function a(t){try{l(i.throw(t))}catch(t){s(t)}}function l(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(r,a)}l((i=i.apply(t,e||[])).next())})};const d=t=>{var e,n;if(null===(e=t.options)||void 0===e?void 0:e.default)return JSON.parse(null===(n=t.options)||void 0===n?void 0:n.default);const i=t.defaultValue;return t.propertyType===s.TYPE.STRING&&i?i.substring(1,i.length-1):i};function p(t,e){e?(a()(t).addClass("ui-box").css({width:"auto",height:"auto"}),o.setUpdateIndicator(t,!0)):(o.setUpdateIndicator(t,!1),a()(t).removeClass("ui-box"))}const h=(t,e,n={parentView:void 0,parentCall:void 0})=>{var r,d;const p=e,h=[...p.inputs,...p.outputs].map(t=>(0,u.jJ)(t)).reduce((t,e)=>(t[e.name]?t[e.name].push(...e.config):t[e.name]=e.config,t),{}),f=e=>{var n;if(e.propertyType===s.TYPE.DATA_FRAME){const n=h[e.name].map(n=>{var i;let o=null!==(i=e.caption)&&void 0!==i?i:e.name;const r=s.Column.fromType(s.TYPE.DATA_FRAME,o,t.length);r.init(n=>{var i;return null!==(i=t[n].inputs[e.name])&&void 0!==i?i:t[n].outputs[e.name]});const a=v.columns.getUnusedName(`${r.name} (${n.type})`);return r.name=a,o=a,r.temp[l.NT]=n,v.columns.add(r),r});return n}{let i=null!==(n=e.caption)&&void 0!==n?n:e.name;const o=s.Column.fromType(e.propertyType,i,t.length);o.init(n=>{var i;return null!==(i=t[n].inputs[e.name])&&void 0!==i?i:t[n].outputs[e.name]});const r=v.columns.getUnusedName(o.name);return o.name=r,i=r,v.columns.add(o),[o]}},v=s.DataFrame.create(t.length),m=[];return t.forEach(t=>{var e;let n=null!==(e=t.options.title)&&void 0!==e?e:`${t.func.name} - ${(0,u.eK)(t)}`,i=2;for(;m.includes(n);)n=`${t.func.name} - ${(0,u.eK)(t)} - ${i}`,i++;m.push(n)}),v.columns.add(s.Column.fromStrings(l._W,m)),v.name=(null===(r=n.parentCall)||void 0===r?void 0:r.func.name)?`${null===(d=n.parentCall)||void 0===d?void 0:d.func.name} - comparison`:`${e.name} - comparison`,p.inputs.forEach(t=>f(t)),p.outputs.forEach(t=>f(t)),i.events.onCurrentObjectChanged.subscribe(({sender:t})=>{if(t instanceof s.Column&&t.type===s.TYPE.DATA_FRAME&&i.shell.tv&&i.shell.tv.temp.isComparison&&[s.VIEWER.LINE_CHART,s.VIEWER.SCATTER_PLOT,s.VIEWER.HISTOGRAM,s.VIEWER.BOX_PLOT].includes(t.temp[l.NT].type)){i.shell.windows.showProperties=!0;const e=t=>{const e=t.get(0).clone();e.columns.addNew(l.eX,s.TYPE.STRING).init(t.dataFrame.get(l._W,0));for(let n=1;n<t.length;n++){const i=t.get(n).clone();i.columns.addNew(l.eX,s.TYPE.STRING).init(t.dataFrame.get(l._W,n));const o=[s.COLUMN_TYPE.INT,s.COLUMN_TYPE.FLOAT];for(let t=0;t<i.columns.length;t++){const n=i.columns.byIndex(t),r=e.columns.byIndex(t);n.type!==r.type&&o.includes(n.type)&&o.includes(r.type)&&(n.type!==s.COLUMN_TYPE.FLOAT&&i.columns.replace(n,n.convertTo(s.COLUMN_TYPE.FLOAT)),r.type!==s.COLUMN_TYPE.FLOAT&&e.columns.replace(r,r.convertTo(s.COLUMN_TYPE.FLOAT)))}e.append(i,!0)}return e},n=t.temp[l.NT].look;setTimeout(()=>{switch(t.temp[l.NT].type){case s.VIEWER.LINE_CHART:const r=o.waitBox(()=>c(void 0,void 0,void 0,function*(){var i;const o=null!==(i=t.temp.unitedDf)&&void 0!==i?i:e(t);return t.temp.unitedDf=o,o.plot.line(Object.assign(Object.assign({},n),{split:l.eX})).root}));a()(r).css({width:"100%"}),i.shell.o=r;break;case s.VIEWER.SCATTER_PLOT:const u=o.waitBox(()=>c(void 0,void 0,void 0,function*(){var i;const o=null!==(i=t.temp.unitedDf)&&void 0!==i?i:e(t);return t.temp.unitedDf=o,o.plot.scatter(Object.assign(Object.assign({},n),{color:l.eX})).root}));i.shell.o=u,a()(u).css({width:"100%"});break;case s.VIEWER.HISTOGRAM:const d=o.waitBox(()=>c(void 0,void 0,void 0,function*(){var i;const o=null!==(i=t.temp.unitedDf)&&void 0!==i?i:e(t);return t.temp.unitedDf=o,o.plot.histogram(Object.assign(Object.assign({},n),{split:l.eX})).root}));i.shell.o=d,a()(d).css({width:"100%"});break;case s.VIEWER.BOX_PLOT:const p=o.waitBox(()=>c(void 0,void 0,void 0,function*(){var i;const o=null!==(i=t.temp.unitedDf)&&void 0!==i?i:e(t);return t.temp.unitedDf=o,o.plot.box(Object.assign(Object.assign({},n),{category:l.eX})).root}));i.shell.o=p,a()(p).css({width:"100%"})}})}}),v}},5092(t,e,n){"use strict";n.d(e,{W:()=>p});var i=n(4328),o=n(6082),s=n(1991),r=n.n(s),a=n(1599),l=n(3508),u=n.n(l),c=function(t,e,n,i){return new(n||(n=Promise))(function(o,s){function r(t){try{l(i.next(t))}catch(t){s(t)}}function a(t){try{l(i.throw(t))}catch(t){s(t)}}function l(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(r,a)}l((i=i.apply(t,e||[])).next())})};const d=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 p;!function(t){const e=new o.LruCache;function n(t){return c(this,void 0,void 0,function*(){const e=yield i.dapi.functions.calls.allPackageVersions().include("session.user,func.package, inputs, outputs").find(t),n=r()(e.inputParams.values()).filter(t=>t.property.propertyType===o.TYPE.FILE&&!!e.inputs[t.name]);yield Promise.all(n.map(t=>c(this,void 0,void 0,function*(){const{id:n,name:s}=JSON.parse(e.inputs[t.name]),r=yield i.dapi.files.readAsBytes(n),a=o.FileInfo.fromBytes(s,r);return a.id=n,e.inputs[t.name]=a,Promise.resolve()})));const s=r()(e.outputParams.values()).filter(t=>t.property.propertyType===o.TYPE.DATA_FRAME&&!!e.outputs[t.name]);yield Promise.all(s.map(t=>c(this,void 0,void 0,function*(){return e.outputs[t.name]=yield i.dapi.tables.getTable(e.outputs[t.name]),Promise.resolve()})));const a=r()(e.inputParams.values()).filter(t=>t.property.propertyType===o.TYPE.DATA_FRAME&&!!e.inputs[t.name]);return yield Promise.all(a.map(t=>c(this,void 0,void 0,function*(){return e.inputs[t.name]=yield i.dapi.tables.getTable(e.inputs[t.name]),Promise.resolve()}))),e})}t.loadChildRuns=function(t){return c(this,void 0,void 0,function*(){return{parentRun:yield n(t),childRuns:yield i.dapi.functions.calls.allPackageVersions().include("func, func.package").filter(`options.parentCallId="${t}"`).list()}})},t.shallowLoadRun=function(t){return c(this,void 0,void 0,function*(){return yield i.dapi.functions.calls.allPackageVersions().include("session.user,func.package, inputs, outputs").find(t)})},t.loadRun=n,t.updateRunMeta=function(t){return c(this,void 0,void 0,function*(){const e=yield i.dapi.functions.calls.allPackageVersions().save(t);i.log.audit("@user edited metadata of @model model run",{user:o.User.current(),model:e.func})})},t.saveRun=function(t){return c(this,void 0,void 0,function*(){let n=e.get("All users");n||(n=yield i.dapi.groups.find(o.Group.defaultGroupsIds["All users"]),e.set("All users",n));const s=(0,a.A4)(t);(0,a.Ne)(s)&&(s.options.createdOn=u()().utc(!0).unix());const l=r()(s.inputParams.values()).filter(t=>t.property.propertyType===o.TYPE.FILE&&!!s.inputs[t.name]);yield Promise.all(l.map(t=>c(this,void 0,void 0,function*(){var e;const n=s.inputs[t.name],r=n instanceof o.FileInfo?yield n.readAsBytes():new Uint8Array(yield n.arrayBuffer()),a=n instanceof o.FileInfo&&null!==(e=n.fileName)&&void 0!==e?e:n.name,l=o.FileInfo.fromBytes(a,r);return yield i.dapi.files.write(l),s.inputs[t.name]={id:l.id,name:l.name},Promise.resolve()})));const d=r()(s.outputParams.values()).filter(t=>t.property.propertyType===o.TYPE.DATA_FRAME&&!!s.outputs[t.name]);yield Promise.all(d.map(t=>c(this,void 0,void 0,function*(){yield i.dapi.tables.uploadDataFrame(s.outputs[t.name]),yield i.dapi.permissions.grant(s.outputs[t.name].getTableInfo(),n,!1)})));const p=r()(s.inputParams.values()).filter(t=>t.property.propertyType===o.TYPE.DATA_FRAME&&!!s.inputs[t.name]);yield Promise.all(p.map(t=>c(this,void 0,void 0,function*(){yield i.dapi.tables.uploadDataFrame(s.inputs[t.name]),yield i.dapi.permissions.grant(s.inputs[t.name].getTableInfo(),n,!1)})));const h=yield i.dapi.functions.calls.allPackageVersions().save(s);return i.log.audit("@user saved run of the @model model",{user:o.User.current(),model:h.func}),h})},t.deleteRun=function(t){return c(this,void 0,void 0,function*(){t.options.isDeleted=!0,yield i.dapi.functions.calls.allPackageVersions().save(t)})},t.pullRuns=function(t){return c(this,arguments,void 0,function*(t,e={},n={}){let o=`func.id="${t}"`;return o+=e.author?` and session.user.id="${e.author.id}"`:"",o+=e.date?d(e.date):"",i.dapi.functions.calls.allPackageVersions().filter(o).include("session.user, options").list(n)})},t.pullRunsByName=function(t){return c(this,arguments,void 0,function*(t,e=[],n={},s=[],a=!1){let l="";for(const t of e){const e=[];t.author&&e.push(`session.user.id="${t.author.id}"`),t.date&&e.push(d(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))');const n=e.join(" and ");""!==n&&(l+=""===l?`(${n})`:` or (${n})`)}""!==l&&(l=` and (${l})`);const u=yield i.dapi.functions.calls.allPackageVersions().filter(`func.name="${t}"${l}`).include(`${[...s,"func.package"].join(",")}`).list(n);if((s.includes("inputs")||s.includes("func.params"))&&!a)for(const t of u){const e=r()(t.inputParams.values()).filter(e=>e.property.propertyType===o.TYPE.DATA_FRAME&&!!t.inputs[e.name]);for(const n of e)t.inputs[n.name]=yield i.dapi.tables.getTable(t.inputs[n.name])}if((s.includes("outputs")||s.includes("func.params"))&&!a)for(const t of u){const e=r()(t.outputParams.values()).filter(e=>e.property.propertyType===o.TYPE.DATA_FRAME&&!!t.outputs[e.name]);for(const n of e)t.outputs[n.name]=yield i.dapi.tables.getTable(t.outputs[n.name])}return u})}}(p||(p={}))},9939(t,e,n){"use strict";n.d(e,{sg:()=>d});var i=n(4328),o=n(7389),s=n(6082),r=n(1858),a=n(9713),l=n(1599),u=function(t,e,n,i){return new(n||(n=Promise))(function(o,s){function r(t){try{l(i.next(t))}catch(t){s(t)}}function a(t){try{l(i.throw(t))}catch(t){s(t)}}function l(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(r,a)}l((i=i.apply(t,e||[])).next())})};function c(){const t=o.iconFA("times");return t.style.marginRight="6px",t.classList.remove("grok-icon"),t}class d extends s.ObjectHandler{get type(){return"Model"}get helpUrl(){return null}getById(t){return u(this,void 0,void 0,function*(){return yield i.dapi.functions.find(t)})}refresh(t){return u(this,void 0,void 0,function*(){return yield this.getById(t.id)})}static openHelp(t){return u(this,void 0,void 0,function*(){const e=yield(0,l.zF)(t);i.shell.windows.showHelp=!0,i.shell.windows.help.showHelp(o.markdown(null!=e?e:""))})}static openModel(t){t.prepare().edit()}static openModelFromFunccall(t){t.edit()}static getUserGroups(){return u(this,void 0,void 0,function*(){return yield(0,l.lD)()})}static getMissingGroups(t,e){return JSON.parse(t.options.mandatoryUserGroups?`${t.options.mandatoryUserGroups}`:"[]").filter(t=>!e.map(t=>t.friendlyName).includes(t.name))}static openVersionSelectDialog(t){var e;const n=JSON.parse(t.options.versions?`${t.options.versions}`:"[]");if((null!==(e=null==n?void 0:n.length)&&void 0!==e?e:0)<2)return void i.shell.info("No other versions avaliable");const s=o.dialog({title:"Choose version"}),r=o.input.choice("Select version",{items:n,value:n[0]});s.add(r).onOK(()=>{const e=r.value;t.prepare({params:{version:e}}).edit()}),s.show()}isApplicable(t){return function(t){var e,n;if(!(t instanceof s.Func))return!1;const i=(null!==(n=null===(e=null==t?void 0:t.options)||void 0===e?void 0:e.role)&&void 0!==n?n:"").split(",").includes("model"),o=t.hasTag("model");return i||o}(s.toJs(t))}constructor(){super(),this.userGroups=new r.BehaviorSubject(void 0)}getLanguageIcon(t){return"grok"==t?o.iconSvg("project"):o.iconImage("script",`/images/entities/${t}.png`)}renderMarkup(t){const e=o.divH([],{style:{justifyContent:"space-between",width:"100%"}});return setTimeout(()=>u(this,void 0,void 0,function*(){const n=yield this.awaitUserGroups(),s=d.getMissingGroups(t,n),r=s.length>0,a=o.iconFA("exclamation-triangle",null);a.classList.remove("grok-icon");const l=this.makeMandatoryGroupsInfo(s),u=o.span([this.renderIcon(t),o.label(t.friendlyName)]);var c;e.onclick=()=>{i.shell.windows.help.visible&&d.openHelp(t)},r?u.classList.add("d4-disabled"):e.ondblclick=()=>{d.openModel(t)},r&&(function(t){t.popover="auto",t.style.cursor="default",t.style.padding="10px",t.style.background="#fdffe5",t.style.border="1px solid #E4E6CE",t.style.borderRadius="2px",t.style.boxShadow="0 0 5px #E4E6CE",t.style.maxWidth="500px",t.style.color="var(--gray-6)"}(c=l),document.body.append(c),e.addEventListener("click",()=>{!function(t,e){!function(t,e){const n=t.getBoundingClientRect().toJSON();e.style.inset="unset",e.style.top=n.y+"px",e.style.left=n.x+20+"px"}(t,e),e.showPopover()}(a,l)})),e.append(u),r&&e.append(o.span([a],{style:{paddingLeft:"10px"}}))})),e}renderIcon(t){if(null!=t.options.icon&&(t.options.icon.startsWith("http://")||t.options.icon.startsWith("https://")))return o.iconImage("model-icon",t.options.icon);let e=(0,l.bP)(t);if(t instanceof s.Script&&(null==e||null==t.options.icon))return this.getLanguageIcon(t.language);if(t=s.Func.find({package:t.package.name,name:t.name})[0],e=(0,l.bP)(t),!e)return o.iconSvg("project");let n=null==e?void 0:e.getIconUrl();if(null!=t.options.icon){const e=n.split("/");e.pop(),e.push(t.options.icon),n=e.join("/")}return o.iconImage(t.package.name,n)}renderView(t){const e=o.div();return this.renderPreview(t).then(t=>e.appendChild(t.root)),e}renderPreview(t){const e=Object.create(null,{renderPreview:{get:()=>super.renderPreview}});return u(this,void 0,void 0,function*(){const n=yield this.awaitUserGroups(),i=d.getMissingGroups(t,n);if(!(null==i?void 0:i.length)&&("Compute2:TreeWizardEditor"===t.options.editor||"Compute2:RichFunctionViewEditor"===t.options.editor)){const e=t.prepare();return(yield s.Func.byName(t.options.editor).prepare({call:e}).call()).getOutputParamValue()}return s.View.fromViewAsync(()=>u(this,void 0,void 0,function*(){var n,s,r;const a=yield(0,l.zF)(t),u=yield e.renderPreview.call(this,t);u.name=(null!==(n=t.friendlyName)&&void 0!==n?n:t.name)+" preview";const c=(null==i?void 0:i.length)?o.div([this.makeMandatoryGroupsInfo(i)],{style:{border:"2px solid var(--red-3)",padding:"10px",maxWidth:"400px"}}):o.div([o.bigButton("Launch",()=>t.prepare().edit())]);return u.append(o.div([o.h1(null!==(s=t.friendlyName)&&void 0!==s?s:t.name),o.divText(null!==(r=t.description)&&void 0!==r?r:t.name,{style:{marginBottom:"10px"}}),c,o.div([],{style:{padding:"20px "}}),o.markdown(null!=a?a:"")],{style:{display:"flex",flexDirection:"column",height:"100%",overflow:"auto"}})),u}))})}renderProperties(t){const e=o.accordion("ComputeModel");e.context=t;const n=o.div([o.span([this.renderIcon(t),o.label(t.friendlyName),o.contextActions(t),o.star(t.id)])]);return e.addTitle(n),null!=t.description&&n.appendChild(o.div([o.markdown(t.description)],"model-catalog-description")),n.appendChild(o.tags(t)),null!=t.options["dev.status"]&&n.appendChild(o.tableFromMap({Status:t.options["dev.status"]})),e.end(),e.root}renderTooltip(t){const e=o.span([this.renderIcon(t),o.label(t.friendlyName)]);return e.classList.add("d4-link-label"),o.bind(t,o.divV([o.h2(e),o.divV([o.divText(t.description,"ui-description")],{style:{lineHeight:"150%"}})]))}renderCard(t){const e=this.renderMarkup(t);return e.classList.add("d4-link-label"),o.bind(t,o.h2(e))}init(){this.registerParamFunc("Choose version",t=>{d.openVersionSelectDialog(s.toJs(t))}),this.registerParamFunc("Help",t=>{d.openHelp(s.toJs(t))});const t=new s.Functions,e=t=>t instanceof s.Entity,n=t=>i.shell.favorites.some(e=>e.id==t.id);t.registerParamFunc("Add to favorites",this.type,t=>u(this,void 0,void 0,function*(){return yield s.Favorites.add(s.toJs(t))}),t=>{const i=s.toJs(t);return this.isApplicable(i)&&e(i)&&!n(i)}),t.registerParamFunc("Remove from favorites",this.type,t=>u(this,void 0,void 0,function*(){return yield s.Favorites.remove(s.toJs(t))}),t=>{const i=s.toJs(t);return this.isApplicable(i)&&e(i)&&n(i)}),setTimeout(()=>u(this,void 0,void 0,function*(){const t=yield d.getUserGroups();this.userGroups.next(t)}))}makeMandatoryGroupsInfo(t){const e=o.div(o.divV([o.label("You should be a member of the following group(s):",{style:{marginLeft:"0px"}}),...t.map(t=>o.divV([o.span([c(),t.name],{style:{fontWeight:"600"}}),...t.help?[o.span([t.help],{style:{marginLeft:"16px"}})]:[],o.link("Request group membership",()=>u(this,void 0,void 0,function*(){yield function(t){return u(this,void 0,void 0,function*(){try{const e=yield i.dapi.groups.filter(`friendlyName="${t}"`).list();if(0===e.length)throw new Error("group with specified name is not found");if(e.length>1)throw new Error("found more than one group with specified name");const n=e[0];yield(0,l.N2)(n,i.shell.user.group),i.shell.info(`Request to join ${t} has been initiated. Please allow some time for approval.`)}catch(t){i.shell.error(t.toString())}})}(t.name),e.hidePopover()}),void 0,{style:{marginLeft:"16px"}})]))],{style:{gap:"10px"}}));return e}awaitUserGroups(){return u(this,void 0,void 0,function*(){return this.userGroups.pipe((0,a.filter)(t=>!!t),(0,a.map)(t=>t),(0,a.take)(1)).toPromise()})}}},3143(t,e,n){"use strict";n.d(e,{A:()=>i});var i,o=n(9879),s=n(8867),r=n(7109);!function(t){t.fileInput=function(t="Drag-n-drop here",e=null,n=null,i=o.R){return new o.z(t,e,n,i)},t.historyInput=function(t,e,n){return new s.PT(t,e,n)},t.historyInputJSON=function(t,e,n){return new s.RP(t,e,n)},t.historyPanel=function(t){return new r.b(t)}}(i||(i={}))},9879(t,e,n){"use strict";n.d(e,{R:()=>a,z:()=>l});var i=n(7389),o=n(6082),s=n(1858),r=(n(6998),function(t,e,n,i){return new(n||(n=Promise))(function(o,s){function r(t){try{l(i.next(t))}catch(t){s(t)}}function a(t){try{l(i.throw(t))}catch(t){s(t)}}function l(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(r,a)}l((i=i.apply(t,e||[])).next())})});const a="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";class l extends o.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()}constructor(t="Drag-n-drop here",e=null,n=null,o=a){super(i.input.string("Input file",{value:""}).dart),this.initialText=t,this.initialValue=e,this.onValueChanged=n,this.fileType=o,this.uploadedFile$=new s.Subject,this.onFileUploaded=this.uploadedFile$,this.fileValue=null,this.isValid=new s.BehaviorSubject(!0),this.hiddenInput=document.createElement("input"),this.icon=i.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");const t=i.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");const t=i.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){const t=i.iconFA("cloud-upload",()=>this.hiddenInput.click(),"Choose a file to upload");this.icon.replaceWith(t),this.icon=t}this.value=t}),this.reset()}subscribeOnEvents(){this.input.readOnly=!0,this.input.classList.add("default");const t=t=>r(this,void 0,void 0,function*(){if(t&&t.length&&this.enabled){if(t.length>1)throw this.isValid.next(!1),new Error("Please specify single input file");if(this.fileType&&t[0].type!==this.fileType)throw this.isValid.next(!1),new Error("File type is not supported");this.isValid.value?this.uploadedFile$.next(t[0]):this.uploadedFile$.next(null)}});this.root.classList.add("fi-drop-area"),this.root.style.width="100%",this.hiddenInput.type="file",this.hiddenInput.addEventListener("change",()=>r(this,void 0,void 0,function*(){return yield t(this.hiddenInput.files)}),!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=>r(this,void 0,void 0,function*(){const n=e.dataTransfer.files;t(n)}),!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)}}},8867(t,e,n){"use strict";n.d(e,{PT:()=>g,RP:()=>y});var i=n(4328),o=n(7389),s=n(6082),r=n(1858),a=n(9713),l=n(1757),u=n.n(l),c=n(5092),d=(n(9192),n(5355)),p=n(1599),h=n(6910),f=function(t,e,n,i){return new(n||(n=Promise))(function(o,s){function r(t){try{l(i.next(t))}catch(t){s(t)}}function a(t){try{l(i.throw(t))}catch(t){s(t)}}function l(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(r,a)}l((i=i.apply(t,e||[])).next())})};class v{static getHistoryRuns(t,e=!0){return(0,r.from)((()=>f(this,void 0,void 0,function*(){return yield c.W.pullRunsByName(t,[{author:i.shell.user}],{order:"started"},["func.params","session.user","options"],e)}))())}}class m extends s.InputBase{constructor(t,e,n){var i,s;const l=o.input.string(t,{value:""});super(l.dart),this.label=t,this._funcName=e,this.options=n,this.onHistoricalRunChosen=new r.BehaviorSubject(null),this.experimentRunsUpdate=new r.Subject,this.store={experimentRuns:new r.Observable,isExperimentRunsLoading:new r.Subject,experimentRunData:new r.BehaviorSubject("")},this._historyList=new d.H([],{fallbackText:"No runs are found in history",showActions:!1,showBatchActions:!1,isHistory:!1,visibleProps:null===(i=this.options)||void 0===i?void 0:i.mainProps,propFuncs:null===(s=this.options)||void 0===s?void 0:s.propFuncs}),this._historyDialog=this.getHistoryDialog(),this._visibleInput=o.input.string(this.label,{value:""}),this._visibleIcon=o.iconFA("search",()=>this.showSelectionDialog(),"Search"),this._chosenRun=null,this._chosenRunId=null,this._visibleInput=l,this._visibleInput.readOnly=!0,this._visibleInput.input.addEventListener("click",()=>this.showSelectionDialog()),this._visibleInput.addOptions(this._visibleIcon),this.store.experimentRuns=this.experimentRunsUpdate.pipe((0,a.tap)(()=>this.toggleLoaderExpRuns(!0)),(0,a.switchMap)(()=>{var t,e;return v.getHistoryRuns(this._funcName,null===(e=null===(t=this.options)||void 0===t?void 0:t.skipDfsOnInit)||void 0===e||e).pipe((0,a.catchError)(t=>(console.error(t),r.EMPTY)),(0,a.finalize)(()=>this.toggleLoaderExpRuns(!1)))}),(0,a.shareReplay)(1)),this.store.experimentRuns.subscribe(t=>{this._historyList.updateRuns(t.filter(t=>!(0,p.Ne)(t)))}),this.store.isExperimentRunsLoading.subscribe(t=>{o.setUpdateIndicator(this._visibleInput.root,t),o.setUpdateIndicator(this._historyList.root,t)}),this.experimentRunsUpdate.next()}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;const n=new d.H([...this._historyList.runs.values()],Object.assign(Object.assign({},this.options),{visibleProps:null===(t=this.options)||void 0===t?void 0:t.mainProps,propFuncs:null===(e=this.options)||void 0===e?void 0:e.propFuncs}));this._historyList.root.replaceWith(n.root),this._historyList=n,this._historyList.onChosen.subscribe(t=>{this._historyDialog.getButton("OK").disabled=!t}),this._historyList.onRunsDfChanged.pipe((0,a.filter)(t=>t.rowCount>0),(0,a.take)(1)).subscribe(()=>{this.setCurrentRow()})}getHistoryDialog(){const t=o.dialog();return u()(t.root.querySelector(".d4-dialog-contents")).removeClass("ui-form"),t.onOK(()=>f(this,void 0,void 0,function*(){var t,e;let n=this._historyList.chosen;n&&((null===(e=null===(t=this.options)||void 0===t?void 0:t.skipDfsOnInit)||void 0===e||e)&&(n=yield c.W.loadRun(n.id)),this.setValue(n)),this.fireInput()})),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"),u()(t.getButton("CANCEL")).hide(),t.add(this._historyList.root),t}setValue(t){var e,n,i,o,s,r,a;this._chosenRun=t,this._chosenRunId=null!==(n=null===(e=this._chosenRun)||void 0===e?void 0:e.id)&&void 0!==n?n:null,this.onHistoricalRunChosen.next(t),this.stringValue=t?(null===(i=this.options)||void 0===i?void 0:i.stringValueFunc)?null===(o=this.options)||void 0===o?void 0:o.stringValueFunc(t):[`${(0,p.eK)(t)} \\ ${t.author.name}`,(null!==(a=null!==(r=null===(s=this.options)||void 0===s?void 0:s.mainProps)&&void 0!==r?r:(0,h.qg)(t.func))&&void 0!==a?a:[]).map(e=>(0,h.u8)(t,e)).join(" \\ ")].join(" \\ "):"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)}}class g extends m{set value(t){this.setValue(t)}get value(){return this.getValue()}}class y extends m{get value(){const 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("-"):""}}},5355(t,e,n){"use strict";n.d(e,{H:()=>x});var i=n(4328),o=n(7389),s=n(6082),r=n(1991),a=n.n(r),l=n(1757),u=n.n(l),c=n(1858),d=n(9713),p=n(5092),h=n(4260),f=n(3508),v=n.n(f),m=n(4112),g=n.n(m),y=n(8804),b=n(6910),C=n(4795),w=function(t,e,n,i){return new(n||(n=Promise))(function(o,s){function r(t){try{l(i.next(t))}catch(t){s(t)}}function a(t){try{l(i.throw(t))}catch(t){s(t)}}function l(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(r,a)}l((i=i.apply(t,e||[])).next())})};v().extend(g());const A=new s.LruCache;class x extends s.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)&&void 0!==e?e:null}set chosenById(t){if(t){for(let e=0;e<this.currentDf.rowCount;e++)if(this.currentDf.getCol(h.vw).get(e)===t){this.currentDf.currentRowIdx=e;break}}else this.currentDf.currentRowIdx=-1}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(h.vw,t))}showEditDialog(t,e){const n=y.V.forFuncCall(t,e);n.onMetadataEdit.pipe((0,d.take)(1)).subscribe(n=>w(this,void 0,void 0,function*(){var o;if(null===(o=this.options)||void 0===o?void 0:o.isHistory)try{!!n.isFavorite!==e&&(yield(0,b.WM)(t,!!n.isFavorite));const i=yield p.W.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 p.W.updateRunMeta(i),this.updateRun(i),this.onMetadataEdit.next(i)}catch(t){i.shell.error(t)}else this.updateRun(t)})),n.show({center:!0,width:500})}constructor(t,e){var n,r,l,f,v,m,g;super(o.div([],{style:{height:"100%",width:"100%"}})),this.initialRuns=t,this.options=e,this.onRunsChanged=new c.BehaviorSubject(this.initialRuns.reduce((t,e)=>(t.set(e.id,e),t),new Map)),this._onRunsDfChanged=new c.BehaviorSubject(s.DataFrame.fromColumns([s.Column.bool(h.d1,0),...(null===(n=this.options)||void 0===n?void 0:n.isHistory)?[s.Column.bool(h.iL,0)]:[],...(null===(r=this.options)||void 0===r?void 0:r.showActions)?[s.Column.string(h.zY,0)]:[],s.Column.bool(h.pC,0),s.Column.dateTime(h.bV,0),s.Column.string(h.l8,0),s.Column.string(h.lv,0),s.Column.string(h.qh,0),s.Column.string(h.Ts,0),s.Column.fromStrings(h.vw,[])])),this._historyFilters=s.Viewer.filters(this._onRunsDfChanged.value,{title:"Filters",columnNames:[]}),this._historyGrid=s.Viewer.grid(this._onRunsDfChanged.value,{showRowHeader:!1,showColumnGridlines:!1,allowEdit:!1}),this.onComparisonCalled=new c.Subject,this.onMetadataEdit=new c.Subject,this._onChosen=new c.BehaviorSubject(null),this.onDelete=new c.Subject,this._onSelectedChanged=new c.BehaviorSubject(new Set([])),this.layout=o.splitH([],null,!0),this.defaultGridText=o.divText(null!==(f=null===(l=this.options)||void 0===l?void 0:l.fallbackText)&&void 0!==f?f:"No historical runs found","hp-no-elements-label"),this.defaultFiltersText=o.divText("No filters to show","hp-no-elements-label"),this.filterWithText=o.divH([this.defaultFiltersText,this._historyFilters.root],"ui-box"),this.trashIcon=o.div(o.iconFA("trash-alt",()=>{const t=this.currentDf.selection.getSelectedIndexes(),e=new Set;t.forEach(t=>e.add(this.getRunByIdx(t)));const n=new y.C(e);n.onFuncCallDelete.pipe((0,d.take)(1)).subscribe(t=>w(this,void 0,void 0,function*(){o.setUpdateIndicator(this.root,!0);try{yield Promise.all(a()(t.values()).map(t=>w(this,void 0,void 0,function*(){return yield this.deleteRun(t.id),Promise.resolve()})))}catch(t){i.shell.error(t)}finally{o.setUpdateIndicator(this.root,!1)}})),n.show({center:!0,width:500,modal:!0})},"Delete selected runs"),{style:{paddingTop:"5px"}}),this.compareIcon=o.div(o.iconFA("exchange",()=>w(this,void 0,void 0,function*(){const t=this.currentDf.selection.getSelectedIndexes(),e=[];t.forEach(t=>{e.push(this.currentDf.getCol(h.vw).get(t))}),this.onComparisonCalled.next(e)}),"Compare selected runs"),{style:{paddingTop:"5px"}}),this._isFilterHidden=new c.BehaviorSubject(!1),this.showFiltersIcon=o.div(o.iconFA("filter",()=>{this._isFilterHidden.next(!this._isFilterHidden.value)},"Toggle filters"),{style:{paddingTop:"4px"}}),this._compactMode=new c.BehaviorSubject(null!==(m=null===(v=this.options)||void 0===v?void 0:v.isHistory)&&void 0!==m&&m),this.toggleCompactMode=o.div(o.iconFA("expand-alt",()=>{this.compactMode=!this.compactMode},"Toggle compact mode"),{style:{paddingTop:"4px"}}),this.showMetadataIcon=o.input.toggle("Metadata",{value:!0,onValueChanged:()=>{this.styleHistoryGrid(),this.styleHistoryFilters()}}),this.showInputsIcon=o.input.toggle("Params",{value:!1,onValueChanged:t=>w(this,void 0,void 0,function*(){var e;0!==this.runs.size&&(t&&(null===(e=this.options)||void 0===e?void 0:e.isHistory)?((yield Promise.all([...this.runs.values()].map(t=>w(this,void 0,void 0,function*(){if(A.has(t.id))return A.get(t.id);{const e=yield p.W.shallowLoadRun(t.id);return A.set(e.id,e),e}})))).forEach(t=>{this.runs.set(t.id,t)}),this.onRunsChanged.next(this.runs)):(this.styleHistoryGrid(),this.styleHistoryFilters()))})});const C=o.divH([o.divH([...(null==e?void 0:e.isHistory)?[this.toggleCompactMode]:[],this.showFiltersIcon,this.showMetadataIcon.root,this.showInputsIcon.root],{style:{gap:"5px",padding:"5px"}}),o.divH((null===(g=this.options)||void 0===g?void 0:g.showBatchActions)?[this.trashIcon,this.compareIcon]:[],{style:{gap:"5px",padding:"5px"}})],{style:{justifyContent:"space-between",padding:"0px 5px"}});C.style.setProperty("overflow-y","hidden","important");const x=o.divV([this.defaultGridText,C,this._historyGrid.root],"ui-box");u()(x).removeClass("ui-div"),u()(x).css("width","100%"),this.root.appendChild(this.layout),o.setDisplayAll([this._historyGrid.root,this._historyFilters.root,this.toggleCompactMode,this.trashIcon,this.compareIcon,this.showFiltersIcon],!1);const I=this.onRunsChanged.subscribe(t=>w(this,void 0,void 0,function*(){if(this.setGridCellRendering(),t.size>0){const e=yield(0,b.BV)(t,t.values().next().value.func,this.options),n=t.values().next().value.func;o.setDisplayAll([this.defaultGridText,this.defaultFiltersText],!1),o.setDisplayAll([this._historyGrid.root,this._historyFilters.root,this.toggleCompactMode,this.showMetadataIcon.root,this.trashIcon,this.compareIcon,this.showFiltersIcon],!0),o.setDisplay(this.showInputsIcon.root,(0,b.rs)(n,this.options).length>0),this._onRunsDfChanged.next(e)}else o.setDisplayAll([this.defaultGridText,this.defaultFiltersText],!0),o.setDisplayAll([this._historyGrid.root,this._historyFilters.root,this.showMetadataIcon.root,this.showInputsIcon.root,this.toggleCompactMode,this.trashIcon,this.compareIcon,this.showFiltersIcon],!1)})),E=this._onRunsDfChanged.subscribe(t=>{this._historyFilters.dataFrame=t,this._historyGrid.dataFrame=t,this.currentDf.getCol(h.lv).meta.multiValueSeparator=",",this.styleHistoryGrid(),this.styleHistoryFilters();const e=t.onCurrentRowChanged.subscribe(()=>{var t;this.currentDf.rows.select(()=>!1),this._onChosen.next(null!==(t=this.getRunByIdx(this.currentDf.currentRowIdx))&&void 0!==t?t:null)}),n=t.onSelectionChanged.subscribe(()=>{const e=[...t.selection.getSelectedIndexes()].map(t=>this.getRunByIdx(t));this._onSelectedChanged.next(new Set(e)),this.redrawSelectionState()});this.redrawSelectionState(),this.subs.push(e,n)}),T=this._isFilterHidden.subscribe(t=>{t?(u()(this.showFiltersIcon.firstChild).addClass("fal"),u()(this.showFiltersIcon.firstChild).removeClass("fad"),o.setDisplay(this.filterWithText,!1)):(u()(this.showFiltersIcon.firstChild).addClass("fad"),u()(this.showFiltersIcon.firstChild).removeClass("fal"),u()(this.filterWithText).css(this.compactMode?"height":"width","320px"),u()(this.filterWithText).css(this.compactMode?"width":"height","100%"),o.setDisplay(this.filterWithText,!0))}),R=this._compactMode.subscribe(t=>{const e=[x,this.filterWithText];u()(this.filterWithText).removeClass("ui-div");const n={style:{width:"100%",height:"100%"}};u()(this.toggleCompactMode.firstChild).addClass(t?"fa-expand-alt":"fa-compress-alt"),u()(this.toggleCompactMode.firstChild).removeClass(t?"fa-compress-alt":"fa-expand-alt");const i=t?o.splitV(e,n,!0):o.splitH(e,n,!0);this.layout.replaceWith(i),this.layout=i,o.tools.waitForElementInDom(this.layout).then(t=>{u()(t).css(this.compactMode?"height":"width","100%"),u()(this._historyFilters.root).css(Object.assign({},this.compactMode?{width:"100%"}:{height:"100%"})),u()(this.filterWithText).css(Object.assign({},this.compactMode?{height:"310px",width:"100%"}:{width:"310px",height:"100%"})),u()(x).css(Object.assign({},this.compactMode?{width:"100%"}:{height:"100%"})),setTimeout(()=>{this.styleHistoryGrid(),this.styleHistoryFilters()},100)})});this.subs.push(I,R,E,T)}isFavoriteByIndex(t){return this.currentDf.get(h.iL,t)}setGridCellRendering(){var t,e;(0,b.VI)(this._historyGrid,this.runs,t=>{const e=this.getRunByIdx(t.tableRowIndex);this.showEditDialog(e,this.isFavoriteByIndex(t.tableRowIndex))},t=>{const e=new Set([this.getRunByIdx(t.tableRowIndex)]),n=new y.C(e);n.onFuncCallDelete.pipe((0,d.take)(1)).subscribe(()=>w(this,void 0,void 0,function*(){o.setUpdateIndicator(this.root,!0);try{yield Promise.all(a()(e.values()).map(t=>w(this,void 0,void 0,function*(){return yield this.deleteRun(t.id),Promise.resolve()})))}catch(t){i.shell.error(t)}finally{o.setUpdateIndicator(this.root,!1)}})),n.show({center:!0,width:500})},t=>{const e=this.getRunByIdx(t.tableRowIndex);(0,b.WM)(e,!0).then(()=>this.updateRun(e))},t=>{const e=this.getRunByIdx(t.tableRowIndex);(0,b.WM)(e,!1).then(()=>this.updateRun(e))},null!==(e=null===(t=this.options)||void 0===t?void 0:t.showActions)&&void 0!==e&&e)}deleteRun(t){return w(this,void 0,void 0,function*(){return p.W.shallowLoadRun(t).then(t=>w(this,void 0,void 0,function*(){var e;return[yield(null===(e=this.options)||void 0===e?void 0:e.isHistory)?p.W.deleteRun(t):Promise.resolve(),t]})).then(([,e])=>{var n;return this.runs.delete(t),this.onRunsChanged.next(this.runs),(null===(n=this.options)||void 0===n?void 0:n.isHistory)&&this.onDelete.next(e),e}).then(t=>{(0,b.WM)(t,!1)}).catch(t=>{i.shell.error(t)})})}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;(0,C.sy)(this._historyGrid,this._compactMode.value,this.showInputsIcon.value,this.showMetadataIcon.value,null===(t=this.runs.values().next().value)||void 0===t?void 0:t.func)}get currentDf(){return this._onRunsDfChanged.value}styleHistoryFilters(){var t,e,n;const i=null===(t=this.runs.values().next().value)||void 0===t?void 0:t.func;(0,C.LL)(this._historyFilters,this.showMetadataIcon.value,this.showInputsIcon.value,null!==(n=null===(e=this.options)||void 0===e?void 0:e.isHistory)&&void 0!==n&&n,i)?(u()(this.filterWithText).css({paddingTop:"10px"}),o.setDisplay(this.defaultFiltersText,!1)):o.setDisplay(this.defaultFiltersText,!0)}redrawSelectionState(){const 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")}}},7109(t,e,n){"use strict";n.d(e,{b:()=>c});var i=n(4328),o=n(7389),s=n(6082),r=n(1858),a=n(5092),l=(n(8550),n(5355)),u=n(9713);class c extends s.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){super(o.box(o.divText("No historical runs loaded","hp-no-elements-label"),{style:{width:"100%",height:"100%"}})),this.func=t,this.onRunChosen=new r.Subject,this.onComparison=new r.Subject,this.afterRunEdited=new r.Subject,this.afterRunDeleted=new r.Subject,this.allRunsFetch=new r.Subject,this.historyList=new l.H([],{fallbackText:"No runs are found in history",showActions:!0,showBatchActions:!0,isHistory:!0}),this.panel=this.historyList.root;const e=this.historyList.onChosen.pipe((0,u.filter)(t=>!!t)).subscribe(t=>this.onRunChosen.next(t.id)),n=this.historyList.onComparisonCalled.subscribe(t=>this.onComparison.next(t)),s=this.allRunsFetch.subscribe(()=>{return t=this,e=void 0,s=function*(){o.setUpdateIndicator(this.root,!0),a.W.pullRunsByName(this.func.name,[{author:i.shell.user}],{},["session.user","options"]).then(t=>{o.empty(this.root),this.root.appendChild(this.panel),this.updateHistoryPane(t)}).catch(t=>i.shell.error(t)).finally(()=>o.setUpdateIndicator(this.root,!1))},new((n=void 0)||(n=Promise))(function(i,o){function r(t){try{l(s.next(t))}catch(t){o(t)}}function a(t){try{l(s.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(r,a)}l((s=s.apply(t,e||[])).next())});var t,e,n,s}),c=this.historyList.onMetadataEdit.subscribe(t=>{this.afterRunEdited.next(t)}),d=this.historyList.onDelete.subscribe(t=>{this.afterRunDeleted.next(t)});this.subs.push(e,s,c,n,d),this.allRunsFetch.next()}}},5727(t,e,n){"use strict";n.d(e,{Ee:()=>s.E,HJ:()=>o.H,bS:()=>r.b,uf:()=>i.u}),n(2244);var i=n(8194),o=n(1059),s=n(873),r=n(6318)},1059(t,e,n){"use strict";n.d(e,{H:()=>o});var i=n(2244);class o extends i.s{}},2244(t,e,n){"use strict";n.d(e,{s:()=>E});var i=n(4328),o=n(7389),s=n(6082),r=n(1858),a=n(1757),l=n.n(a),u=n(3508),c=n.n(u),d=n(5092),p=n(4260),h=n(1599),f=n(5520),v=n(8476),m=n(3143),g=n(810),y=n(9713),b=n(4795),C=n(9879),w=n(6318),A=function(t,e,n,i){return new(n||(n=Promise))(function(o,s){function r(t){try{l(i.next(t))}catch(t){s(t)}}function a(t){try{l(i.throw(t))}catch(t){s(t)}}function l(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(r,a)}l((i=i.apply(t,e||[])).next())})};const x=new URL(i.shell.startUri),I=()=>A(void 0,void 0,void 0,function*(){const 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=()=>{const e=new Blob(n,{type:n[0].type});t.getVideoTracks()[0].stop(),s.Utils.download(`Recording ${(new Date).toLocaleString("en-us",{month:"short",day:"numeric",hour:"numeric",minute:"numeric"})}.mkv`,e,n[0].type)},e.start()});class E extends s.ViewBase{constructor(t,e={historyEnabled:!0,isTabbed:!1,skipInit:!1}){var n,a,l,u,c;super(),this.initValue=t,this.options=e,this._type="function",this.funcCallReplaced=new r.Subject,this.isReady=new r.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 r.BehaviorSubject(!1),this.historyRoot=o.div(),this.consistencyState=new r.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=i.functions.getCurrentCall(),t instanceof s.FuncCall&&(this.parentCall=t),this.parentView=null===(l=null===(a=null===(n=this.parentCall)||void 0===n?void 0:n.parentCall)||void 0===a?void 0:a.aux)||void 0===l?void 0:l.view,(null===(c=null===(u=this.parentCall)||void 0===u?void 0:u.func)||void 0===c?void 0:c.name)&&(this.basePath=`/${this.parentCall.func.name}`),e.skipInit||this.init()}onFuncCallReady(){return A(this,void 0,void 0,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();const t=this.getStartId();if(t&&!this.options.isTabbed&&(o.setUpdateIndicator(this.root,!0),this.loadRun(t),o.setUpdateIndicator(this.root,!1),this.setAsLoaded()),this.isHistoryEnabled&&this.func){const t=this.options.isTabbed?this.isHistorical.subscribe(t=>{t||(this.funcCall.id=null)}):this.isHistorical.subscribe(t=>{var e,n;if(t){this.path=`?id=${this.funcCall.id}`;const t=(0,h.eK)(this.funcCall);this.name.indexOf(" — ")<0?this.name=`${this.name} — ${null!==(e=this.funcCall.options.title)&&void 0!==e?e:t}`:this.name=`${this.name.substring(0,this.name.indexOf(" — "))} — ${null!==(n=this.funcCall.options.title)&&void 0!==n?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)}})}getStartId(){return i.shell.getVar("isLoaded")?void 0:x.searchParams.get("id")}setAsLoaded(){return i.shell.setVar("isLoaded",!0)}get funcCall(){return this._funcCall}get func(){var t;return null===(t=this.funcCall)||void 0===t?void 0:t.func}get lastCall(){return this._lastCall}set lastCall(t){this._lastCall=t}get type(){return this._type}getPackageData(){return A(this,void 0,void 0,function*(){var t,e;const n=this.func.package;if(!n)return;const i=null===(t=yield null==n?void 0:n.getProperties())||void 0===t?void 0:t.REPORT_BUG_URL;i&&!this.reportBug&&(this.reportBug=()=>A(this,void 0,void 0,function*(){window.open(i,"_blank")}));const o=null===(e=yield null==n?void 0:n.getProperties())||void 0===e?void 0:e.REQUEST_FEATURE_URL;o&&!this.requestFeature&&(this.requestFeature=()=>A(this,void 0,void 0,function*(){window.open(o,"_blank")}));const s=`${n.friendlyName}.\nLast updated on ${c()(n.updatedOn).format("YYYY MMM D, HH:mm")}`;this.getAbout||(this.getAbout=()=>A(this,void 0,void 0,function*(){return s}))})}linkFunccall(t){this._funcCall=t,this.funcCallReplaced.next(!0)}loadFuncCallById(){return A(this,void 0,void 0,function*(){if(this.initValue instanceof s.FuncCall)return yield new Promise(t=>setTimeout(t,0)),void this.linkFunccall(this.initValue);o.setUpdateIndicator(this.root,!0);const t=this.getStartId();if(t&&!this.options.isTabbed)this.linkFunccall(yield d.W.loadRun(t));else{const t=s.Func.byName(this.initValue);this.linkFunccall(t.prepare({}))}o.setUpdateIndicator(this.root,!1)})}init(){return A(this,void 0,void 0,function*(){yield this.loadFuncCallById(),yield this.onFuncCallReady(),this.isReady.next(!0)})}build(){o.empty(this.root),this.root.appendChild(this.buildIO()),this.options.historyEnabled&&this.isHistoryEnabled&&this.buildHistoryBlock(),this.buildRibbonMenu(),this.buildRibbonPanels()}onComparisonLaunch(t){return A(this,void 0,void 0,function*(){const e=this.comparatorFunc;if(e){const n=s.Func.byName(e),o=(yield n.prepare({params:{comparedRuns:t}}).call()).outputs.comparisonView;return void i.shell.addView(o)}const n=i.shell.v.parentCall,o=[...i.shell.views].find(t=>t.type===p.sk),r=yield v.S.fromComparedRuns(t,this.func,{parentView:o,parentCall:n});i.shell.addView(r),r.defaultCustomize();const a=this.compareCustomizer;if(a){const t=s.Func.byName(a);return void(yield t.prepare({params:{defaultView:r}}).call())}})}onSaveClick(){return A(this,void 0,void 0,function*(){yield this.saveRun(this.funcCall)})}buildHistoryBlock(){const t=m.A.historyPanel(this.func);let e=!1;return this.subs.push(t.onCompactModeChanged.subscribe(t=>{const e=i.shell.dockManager.findNode(this.historyRoot);e&&(i.shell.dockManager.close(e),t?i.shell.dockManager.dock(this.historyRoot,"right",null,"History",.3):i.shell.dockManager.dock(this.historyRoot,"down",null,"History",.3))}),t.onRunChosen.subscribe(t=>A(this,void 0,void 0,function*(){o.setUpdateIndicator(this.root,!0),yield this.loadRun(t),o.setUpdateIndicator(this.root,!1)})),t.onComparison.subscribe(e=>A(this,void 0,void 0,function*(){(0,g.ZD)(t.root,!0);const n=yield Promise.all(e.map(t=>d.W.loadRun(t)));yield this.onComparisonLaunch(n),(0,g.ZD)(t.root,!1)})),t.afterRunEdited.subscribe(t=>{var e,n;if(t.id===this.funcCall.id&&t.options.title){this.path=`?id=${this.funcCall.id}`;const i=(0,h.eK)(t);this.name.indexOf(" — ")<0?this.name=`${this.name} — ${null!==(e=t.options.title)&&void 0!==e?e:i}`:this.name=`${this.name.substring(0,this.name.indexOf(" — "))} — ${null!==(n=t.options.title)&&void 0!==n?n:i}`}}),i.events.onViewRemoving.subscribe(t=>{if(t.args.view==this){const t=i.shell.dockManager.findNode(this.historyRoot);t?(i.shell.dockManager.close(t),e=!0):e=!1}}),i.events.onCurrentViewChanged.subscribe(()=>{var t;if(i.shell.v==this)e&&((null===(t=this.historyBlock)||void 0===t?void 0:t.compactMode)?i.shell.dockManager.dock(this.historyRoot,"right",null,"History",.3):i.shell.dockManager.dock(this.historyRoot,"down",null,"History",.3));else{const t=i.shell.dockManager.findNode(this.historyRoot);t?(i.shell.dockManager.close(t),e=!0):e=!1}})),o.empty(this.historyRoot),this.historyRoot.style.removeProperty("justify-content"),this.historyRoot.append(t.root),this.historyBlock=t,t.root}buildRibbonPanels(){const t=o.iconFA("history",()=>{var t;i.shell.dockManager.findNode(this.historyRoot)||((null===(t=this.historyBlock)||void 0===t?void 0:t.compactMode)?i.shell.dockManager.dock(this.historyRoot,"right",null,"History",.3):i.shell.dockManager.dock(this.historyRoot,"down",null,"History",.3),this.historyRoot.parentElement.classList.add("ui-box"),this.historyRoot.classList.add("ui-box"))},"History"),e=o.iconFA("save",()=>A(this,void 0,void 0,function*(){yield this.onSaveClick()}),"Save current state"),n=o.comboPopup(o.iconFA("arrow-to-bottom"),this.getFormats(),this.exportRun.bind(this)),s=o.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?(o.setDisplay(n,!(0,h.Ne)(this.funcCall)),o.setDisplay(s,!0)):(l()(n).hide(),l()(s).hide())});if(this.subs.push(r),o.tooltip.bind(n,()=>"inconsistent"===this.consistencyState.value&&this.mandatoryConsistent?"Current run is inconsistent. Export feature is disabled.":null),!this.options.isTabbed&&this.mandatoryConsistent){const t=this.consistencyState.pipe((0,y.distinctUntilChanged)()).subscribe(t=>{"inconsistent"===t?(l()(n).addClass("d4-disabled"),l()(n.lastChild).css("color","unset")):(l()(n).removeClass("d4-disabled"),l()(n.lastChild).removeProp("color"))});this.subs.push(t)}const a=[[...!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?[]:[s]]];return this.setRibbonPanels(a),a}buildRibbonMenu(){if(this.ribbonMenu.clear(),!(this.exportConfig||this.reportBug||this.requestFeature||this.getHelp||this.getMocks||this.getTemplates))return;const 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{const 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{const 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()),setTimeout(()=>A(this,void 0,void 0,function*(){if((yield(0,h.lD)()).find(t=>"Developers"===t.friendlyName)){const e=t.group("Test runner");e.item("Run Data JSON",()=>this.importRunJsonDialog()),e.item("Execute Test JSON",()=>this.importRunJsonDialog()),e.item("Update Test JSON",()=>this.importRunJsonDialog(!0)),t.endGroup()}}),0),t.item("Record the screen",I),this.getAbout&&t.item("About",()=>A(this,void 0,void 0,function*(){const t=yield this.getAbout();if(t){const e=o.dialog("Current version");t.split("\n").forEach(t=>e.add(o.label(t))),e.onOK(()=>{}),e.getButton("CANCEL").style.display="none",e.show({center:!0})}}))}exportRun(t){return A(this,void 0,void 0,function*(){s.Utils.download(this.exportConfig.filename(t),yield this.exportConfig.export(t))})}getFormats(){var t,e;return null!==(e=null===(t=this.exportConfig)||void 0===t?void 0:t.supportedFormats)&&void 0!==e?e:[]}onBeforeSaveRun(t){return A(this,void 0,void 0,function*(){})}onAfterSaveRun(t){return A(this,void 0,void 0,function*(){})}saveRun(t){return A(this,void 0,void 0,function*(){let e=(0,h.A4)(t);yield this.onBeforeSaveRun(e),(0,h.Ne)(e)&&(e=yield(0,b.Hs)(t)),e.id&&e.newId();const n=yield d.W.saveRun(e),i=yield d.W.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})}onBeforeDeleteRun(t){return A(this,void 0,void 0,function*(){})}onAfterDeleteRun(t){return A(this,void 0,void 0,function*(){})}deleteRun(t){return A(this,void 0,void 0,function*(){return yield this.onBeforeDeleteRun(t),yield d.W.deleteRun(t),yield this.onAfterDeleteRun(t),t.id})}onBeforeLoadRun(){return A(this,void 0,void 0,function*(){})}onAfterLoadRun(t){return A(this,void 0,void 0,function*(){})}loadRun(t){return A(this,void 0,void 0,function*(){yield this.onBeforeLoadRun();const e=yield d.W.loadRun(t);return this.lastCall=(0,h.A4)(e),this.linkFunccall(e),this.isHistorical.next(!0),yield this.onAfterLoadRun(e),e})}onBeforeRun(t){return A(this,void 0,void 0,function*(){})}onAfterRun(t){return A(this,void 0,void 0,function*(){})}run(){return A(this,void 0,void 0,function*(){if(!this.funcCall)throw new Error("The correspoding function is not specified");yield this.onBeforeRun(this.funcCall);const t=s.TaskBarProgressIndicator.create("Calculating...");try{this.funcCall.newId(),yield this.funcCall.call(),yield this.onAfterRun(this.funcCall),this.lastCall=(0,h.A4)(this.funcCall),this.options.isTabbed||this.runningOnInput||!this.isHistoryEnabled||(yield this.saveRun(this.funcCall))}catch(t){i.shell.error(t.toString())}finally{t.close()}})}exportRunJson(){return A(this,void 0,void 0,function*(){if(this._lastCall){const t=yield(0,b.wB)(this._lastCall,this);return(0,f.lK)(t)}})}getRunJSON(){return A(this,void 0,void 0,function*(){const t=yield this.exportRunJson();t&&s.Utils.download(this.defaultExportFilename("","json"),t)})}importRunJsonDialog(){return A(this,arguments,void 0,function*(t=!1){const e=new C.z("JSON file",null,null,"application/json"),n={modal:!0,fullScreen:!0,width:500,height:200,center:!0};if(!(yield new Promise((t,i)=>{o.dialog({title:"Import Run JSON"}).add(o.div([o.inputs([e])])).onOK(()=>t(!0)).onCancel(()=>t(!1)).show(n)}))||!e.value)return;const i=(0,f.iu)(yield e.value.text());t?(yield this.executeTest(i,!0),yield this.isHistorical.pipe((0,y.filter)(t=>t),(0,y.take)(1),(0,y.delay)(0)).toPromise(),yield this.getRunJSON()):yield this.executeTest(i)})}executeTest(t){return A(this,arguments,void 0,function*(t,e=!1){yield(0,w.c)(t,this,{updateMode:e,interactive:!0})})}get compareCustomizer(){var t;return null!==(t=this.func.options.compareCustomizer)&&void 0!==t?t:null}get comparatorFunc(){var t;return null!==(t=this.func.options.comparatorFunc)&&void 0!==t?t:null}get uploadFunc(){var t;return null!==(t=this.func.options.uploadFunc)&&void 0!==t?t:null}get runningOnInput(){return(0,h.vk)(this.func)}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"true"===(null===(t=this.parentCall)||void 0===t?void 0:t.func.options.mandatoryConsistent)}get hasContextHelp(){return!!(0,h.HP)(this.func)}getContextHelp(){return A(this,void 0,void 0,function*(){return(0,h.zF)(this.func)})}get features(){return(0,h.i)(this.func)}getFeature(t,e){return(0,h.x$)(this.features,t,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)}}},8194(t,e,n){"use strict";n.d(e,{u:()=>x});var i=n(4328),o=n(7389),s=n(6082),r=n(6267),a=n(1858),l=n(9713),u=n(1757),c=n.n(u),d=n(5092),p=n(4260),h=n(2244),f=(n(4315),n(5520)),v=n(1599),m=n(8920),g=n(8476),y=n(4795),b=n(6318),C=function(t,e,n,i){return new(n||(n=Promise))(function(o,s){function r(t){try{l(i.next(t))}catch(t){s(t)}}function a(t){try{l(i.throw(t))}catch(t){s(t)}}function l(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(r,a)}l((i=i.apply(t,e||[])).next())})};const w=t=>{var e,n;return null!==(n=null===(e=t.options)||void 0===e?void 0:e.friendlyName)&&void 0!==n?n:t.func.name},A=t=>{var e;return null!==(e=t.customId)&&void 0!==e?e:t.funcName};class x extends h.s{set currentTabName(t){this.stepTabs.getPane(t)&&(this.stepTabs.currentPane=this.stepTabs.getPane(t))}getStepView(t){var e;return null===(e=this.steps[t])||void 0===e?void 0:e.view}getRunningUpdates(){return[]}disableSetters(t){}constructor(t,e,n={historyEnabled:!0,isTabbed:!1,skipInit:!1}){super(t,n),this.initialConfig=e,this.steps={},this.onStepCompleted=new a.Subject,this.isUpdating=new a.BehaviorSubject(!1),this.pipelineViewExportExtensions=()=>({Archive:"zip","Single Excel":"xlsx"}),this.pipelineViewExportFormats=()=>["Archive","Single Excel"],this.pipelineViewExport=t=>C(this,void 0,void 0,function*(){if(!this.stepTabs)throw new Error("Set step tabs please for export");if("Archive"===t){const t={};for(const e of Object.values(this.steps).filter(t=>t.visibility.value===m.L_.VISIBLE)){this.stepTabs.currentPane=this.stepTabs.getPane(w(e)),yield new Promise(t=>setTimeout(t,100));const n=yield e.view.exportConfig.export("Excel");t[e.view.exportConfig.filename("Excel")]=[new Uint8Array(yield n.arrayBuffer()),{level:0}]}return new Blob([(0,r.L)(t)])}if("Single Excel"===t){yield s.Utils.loadJsCss(["/js/common/exceljs.min.js"]);const t=window.ExcelJS,e="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=UTF-8",n=new t.Workbook,i=(t,e,n)=>{let i=`${w(n)}>${e}`;i.length>31&&(i=`${i.slice(0,31)}`);let o=2;for(;t.worksheets.some(t=>t.name.toLowerCase()===i.toLowerCase());){let t=`${w(n)}>${e}`;t.length>31-`-${o}`.length&&(t=`${t.slice(0,31-`-${o}`.length)}`),i=`${t}-${o}`,o++}return i};for(const e of Object.values(this.steps).filter(t=>t.visibility.value===m.L_.VISIBLE)){const o=new t.Workbook;this.stepTabs.currentPane=this.stepTabs.getPane(w(e)),yield new Promise(t=>setTimeout(t,100)),yield o.xlsx.load(yield(yield e.view.exportConfig.export("Excel")).arrayBuffer()),o.eachSheet(t=>{const s=i(n,t.name,e),r=n.addWorksheet("New sheet");r.model=t.model,r.name=s,t.getImages().forEach(t=>{const e=n.addImage(o.getImage(t.imageId));r.addImage(e,t.range)})})}return new Blob([yield n.xlsx.writeBuffer()],{type:e})}throw new Error("This format is not supported")}),this.exportConfig={supportedExtensions:this.pipelineViewExportExtensions(),supportedFormats:this.pipelineViewExportFormats(),export:this.pipelineViewExport,filename:this.defaultExportFilename},this.helpFiles={}}init(){return C(this,void 0,void 0,function*(){yield this.loadFuncCallById(),this.initialConfig.forEach((t,e)=>{var n;this.steps[A(t)]={idx:e,visibility:new a.BehaviorSubject(null!==(n=t.hiddenOnInit)&&void 0!==n?n:m.L_.VISIBLE),ability:new a.BehaviorSubject(this.isHistorical.value||0===e?m.D.ENABLED:m.D.DISABLED),options:{friendlyName:t.friendlyName,helpUrl:t.helpUrl,customId:t.customId}}}),this.subs.push(i.functions.onAfterRunAction.pipe((0,l.filter)(t=>Object.values(this.steps).some(({view:e})=>{var n;return(null===(n=null==e?void 0:e.funcCall)||void 0===n?void 0:n.id)===(null==t?void 0:t.id)&&!!t}))).subscribe(t=>{this.onStepCompleted.next(t),"true"!==t.func.options.isMain&&t.func.nqName!==this.initialConfig[this.initialConfig.length-1].funcName||this.run()}));const t=this.initialConfig.map(t=>C(this,void 0,void 0,function*(){return{stepScript:s.Func.byName(t.funcName),stepId:A(t)}})),e=yield Promise.all(t);e.forEach(t=>{this.steps[t.stepId].func=t.stepScript}),this.root.classList.remove("ui-panel");const n={},r="Compute:PipelineStepEditor",u=e.map(t=>C(this,void 0,void 0,function*(){const e=t.stepScript.script?(t=>{const e=t.script,n=e.indexOf("editor:");if(n<0)return r;const i=e.indexOf("\n",n);return e.substring(n+7,i).trim()})(t.stepScript):r;return n[e]||(n[e]=s.Func.byName(e.split(" ").join(""))),this.steps[t.stepId].editor=e,Promise.resolve()}));yield Promise.all(u);const d=e.map(t=>C(this,void 0,void 0,function*(){const e=this.steps[t.stepId],r=t.stepScript.prepare(),u=n[e.editor];yield this.onBeforeStepFuncCallApply(t.stepScript.nqName,r,u);const d=yield u.apply({call:r});yield d.isReady.pipe((0,l.filter)(t=>!!t),(0,l.take)(1)).toPromise();const p=o.button("Back",()=>{},"Go to the previous step");c()(p).addClass("ui-btn-nav");const h=o.button("Next",()=>{},"Go to the next step");c()(h).addClass("ui-btn-nav"),this.syncNavButtons(e,p,h),d.setNavigationButtons([p,h]),this.steps[t.stepId].view=d;const f=this.steps[t.stepId],v=()=>{Object.values(this.steps).forEach(t=>{t.idx>f.idx&&t.visibility.value===m.L_.VISIBLE&&t.ability.value===m.D.ENABLED&&t.ability.next(m.D.DISABLED)})},g=f.view.funcCallReplaced.pipe((0,l.switchMap)(()=>{const t=[...f.view.funcCall.inputParams.values()].map(t=>t.onChanged.pipe((0,l.mapTo)(t)));return(0,a.merge)(...t)})),y=g.subscribe(v);this.subs.push(y);const b=g.pipe((0,l.filter)(t=>t.property.propertyType===s.TYPE.DATA_FRAME&&t.value),(0,l.switchMap)(t=>t.value.onDataChanged)).subscribe(v);this.subs.push(b);const C=i.functions.onAfterRunAction.pipe((0,l.filter)(t=>f.view.funcCall&&t&&!!t.id&&f.view.funcCall.id===t.id),(0,l.withLatestFrom)(f.visibility,f.ability),(0,l.filter)(([,t,e])=>!(t===m.L_.HIDDEN||e===m.D.DISABLED))).subscribe(()=>{const t=(()=>Object.values(this.steps).find(t=>t.idx>f.idx&&t.visibility.value===m.L_.VISIBLE&&t.ability.value===m.D.ENABLED)?null:Object.values(this.steps).find(t=>t.idx>f.idx&&t.visibility.value===m.L_.VISIBLE&&t.ability.value===m.D.DISABLED))();null==t||t.ability.next(m.D.ENABLED)});return this.subs.push(C),yield this.onAfterStepFuncCallApply(t.stepScript.nqName,r,d),d})),p=yield Promise.all(d),h=(0,a.combineLatest)(p.map(t=>t.isHistorical)).subscribe(t=>{t.some((t,e)=>{var n;return!t&&(null===(n=Object.values(this.steps).find(t=>t.idx===e))||void 0===n?void 0:n.visibility.value)===m.L_.VISIBLE})&&this.isHistorical.value&&this.isHistorical.next(!1)});this.subs.push(h);const f=this.isUpdating.subscribe(t=>{for(const e of Object.values(this.steps)){const n=e.view;(null==n?void 0:n.blockRuns)&&n.blockRuns.next(t)}});this.subs.push(f),yield this.onFuncCallReady(),this.isReady.next(!0),this.loadHelp().then(()=>{this.buildRibbonPanels();const t=()=>{const t=this.findCurrentStep();t&&this.helpFiles[t.func.nqName]&&"opened"===this.getHelpState()&&this.showHelpWithDelay(t)},e=i.events.onCurrentViewChanged.pipe((0,l.filter)(()=>i.shell.v==this)).subscribe(t);t(),this.subs.push(e)})})}loadHelp(){return C(this,void 0,void 0,function*(){return Promise.all(Object.values(this.steps).map(t=>C(this,void 0,void 0,function*(){var e,n,o,s;const r=null!==(n=null===(e=t.options)||void 0===e?void 0:e.helpUrl)&&void 0!==n?n:t.func.options.help;if(r){const e=`System:AppData/${this.func.package.name}/${r}`,n=(yield i.dapi.files.exists(e))?yield i.dapi.files.readAsText(e):yield t.view.getContextHelp();n&&(this.helpFiles[null!==(s=null===(o=t.options)||void 0===o?void 0:o.customId)&&void 0!==s?s:t.func.nqName]=n)}})))})}syncNavButtons(t,e,n){let i,o;n.addEventListener("click",()=>{i&&(this.currentTabName=w(i))}),e.addEventListener("click",()=>{o&&(this.currentTabName=w(o))});const s=this.getPipelineStateChanges().pipe((0,l.startWith)(!0),(0,l.debounceTime)(0)).subscribe(()=>{i=this.getNextStep(t),o=this.getPreviousStep(t),i?(c()(n).show(),i.ability.value===m.D.DISABLED&&c()(n).addClass("d4-disabled"),i.ability.value===m.D.ENABLED&&c()(n).removeClass("d4-disabled")):c()(n).hide(),o?(c()(e).show(),o.ability.value===m.D.DISABLED&&c()(e).addClass("d4-disabled"),o.ability.value===m.D.ENABLED&&c()(e).removeClass("d4-disabled")):c()(e).hide()});this.subs.push(s)}getPreviousStep(t){return Object.values(this.steps).slice().reverse().find(e=>e.idx<t.idx&&e.visibility.value===m.L_.VISIBLE)}getNextStep(t){return Object.values(this.steps).find(e=>e.idx>t.idx&&e.visibility.value===m.L_.VISIBLE)}getPipelineStateChanges(){const t=Object.values(this.steps).flatMap(t=>[t.ability,t.visibility]);return(0,a.merge)(...t).pipe((0,l.mapTo)(!0))}onComparisonLaunch(t){return C(this,void 0,void 0,function*(){const e=i.shell.v.parentCall,n=yield Promise.all(t.map(t=>d.W.loadChildRuns(t.id))),o=yield Promise.all(n.map(t=>{var e;return null!==(e=t.childRuns.find(t=>"true"===t.func.options.isMain))&&void 0!==e?e:t.childRuns.find(t=>t.func.nqName===this.initialConfig[this.initialConfig.length-1].funcName)}).map(t=>d.W.loadRun(t.id))),s=[...i.shell.views].find(t=>t.type===p.sk),r=yield g.S.fromComparedRuns(o,o[0].func,{parentView:s,parentCall:e});i.shell.addView(r)})}onBeforeStepFuncCallApply(t,e,n){return C(this,void 0,void 0,function*(){})}onAfterStepFuncCallApply(t,e,n){return C(this,void 0,void 0,function*(){})}buildIO(){const t=Object.values(this.steps).reduce((t,e)=>Object.assign(Object.assign({},t),{[w(e)]:e.view.root}),{}),e=o.tabControl(t),n=Object.values(this.steps).map(t=>{const n=o.iconFA("exclamation-circle",null,"This step has inconsistent inputs");return c()(n).css({color:"var(--orange-2)","margin-left":"3px","padding-top":"1px"}),e.getPane(w(t)).header.appendChild(n),t.view.consistencyState.subscribe(t=>{"consistent"===t&&c()(n).hide(),"inconsistent"===t&&c()(n).show()})});this.subs.push(...n);const i=Object.values(this.steps).map(t=>t.view.consistencyState),s=(0,a.merge)(...i).subscribe(()=>{i.map(t=>t.value).some(t=>"inconsistent"===t)?this.consistencyState.next("inconsistent"):this.consistencyState.next("consistent")});this.subs.push(s);const r=e.panes[0].header.parentElement;r.classList.add("d4-ribbon","pipeline-view"),r.classList.remove("d4-tab-header-stripe"),r.firstChild.remove();for(let t=0;t<e.panes.length;t++)e.panes[t].header.classList.add("d4-ribbon-name"),e.panes[t].header.classList.remove("d4-tab-header");return e.panes[0].header.style.marginLeft="12px",e.root.style.height="100%",e.root.style.width="100%",this.stepTabs=e,this.initialConfig.forEach(t=>{const e=A(t);this.subs.push(this.steps[e].visibility.subscribe(t=>{t===m.L_.VISIBLE&&c()(this.stepTabs.getPane(w(this.steps[e])).header).css("display","inherit"),t===m.L_.HIDDEN&&c()(this.stepTabs.getPane(w(this.steps[e])).header).hide()}))}),Object.values(this.steps).forEach(t=>{this.subs.push(t.ability.subscribe(e=>{e===m.D.ENABLED&&c()(this.stepTabs.getPane(w(t)).header).removeClass("d4-disabled"),e===m.D.DISABLED&&c()(this.stepTabs.getPane(w(t)).header).addClass("d4-disabled")}))}),this.hideSteps(...this.initialConfig.filter(t=>t.hiddenOnInit===m.L_.HIDDEN).map(t=>t.funcName)),e.root}showHelpWithDelay(t){return C(this,void 0,void 0,function*(){(0,y.aB)(this.helpFiles[t.func.nqName])})}findCurrentStep(){return Object.values(this.steps).find(t=>w(t)===this.stepTabs.currentPane.name)}buildHistoryBlock(){const t=super.buildHistoryBlock(),e=this.historyBlock.afterRunDeleted.subscribe(t=>C(this,void 0,void 0,function*(){(yield i.dapi.functions.calls.allPackageVersions().filter(`options.parentCallId="${t.id}"`).list()).map(t=>C(this,void 0,void 0,function*(){return d.W.deleteRun(t)}))}));return this.subs.push(e),t}getHelpState(){return"closed"===i.userSettings.getValue(p.Jc,`${this.func.name}_help_state`)?"closed":"opened"}saveHelpState(t){i.userSettings.add(p.Jc,`${this.func.name}_help_state`,t)}buildRibbonPanels(){const t=o.iconFA("info",()=>C(this,void 0,void 0,function*(){const t=this.findCurrentStep();t&&this.helpFiles[t.func.nqName]&&(yield this.showHelpWithDelay(t),this.saveHelpState("opened"))}),"Show help for this step"),e=()=>{const e=this.findCurrentStep();o.setDisplay(t,!(!e||!this.helpFiles[e.func.nqName])),e&&this.helpFiles[e.func.nqName]&&i.shell.windows.help.visible&&this.showHelpWithDelay(e),this.setRibbonPanels([...this.getRibbonPanels().slice(0,1),...e?e.view.buildRibbonPanels():[],...this.getRibbonPanels().length>2?this.getRibbonPanels().slice(-1):[]])};if(!this.isReady.value){const t=this.stepTabs.onTabChanged.subscribe(e),n=i.events.onEvent("grok-panels-changed").pipe((0,l.filter)(()=>i.shell.v===this)).subscribe(()=>C(this,void 0,void 0,function*(){const t=yield this.getHelpState();if(i.shell.windows.help.visible&&"closed"===t)this.saveHelpState("opened");else if(!i.shell.windows.help.visible&&"opened"===t){const t=o.iconFA("info");return c()(t).css("margin","0px 3px"),i.shell.info(o.span(["You can open help panel by clicking the",t,"button on the ribbon menu"])),void this.saveHelpState("closed")}}));this.subs.push(t,n)}const n=this.findCurrentStep(),s=[[...super.buildRibbonPanels().flat(),t],...n?n.view.buildRibbonPanels():[]];return this.setRibbonPanels(s),e(),s}saveRun(t){return C(this,void 0,void 0,function*(){let e=(0,v.A4)(t);yield this.onBeforeSaveRun(e),(0,v.Ne)(e)&&(e=yield(0,y.Hs)(t)),e.newId();const n=Object.values(this.steps).filter(t=>t.visibility.value===m.L_.VISIBLE).map(t=>C(this,void 0,void 0,function*(){var n,i;const o=t.view.funcCall;return o.options.parentCallId=e.id,(null===(n=t.options)||void 0===n?void 0:n.customId)&&(o.options.customId=null===(i=t.options)||void 0===i?void 0:i.customId),yield t.view.saveRun(o),Promise.resolve()}));yield Promise.all(n),e.options.title&&(e.options.title=`${e.options.title} (copy)`);const i=yield d.W.saveRun(e),o=yield d.W.loadRun(i.id);return this.options.historyEnabled&&this.isHistoryEnabled&&this.historyBlock&&this.historyBlock.addRun(yield d.W.loadRun(i.id)),this.linkFunccall(o),this.isHistorical.next(!0),yield this.onAfterSaveRun(e),i})}loadRun(t){return C(this,void 0,void 0,function*(){const{parentRun:e,childRuns:n}=yield d.W.loadChildRuns(t),i=Object.values(this.steps).filter(t=>t.visibility.value===m.L_.VISIBLE).findIndex(t=>w(t)===this.stepTabs.currentPane.name);yield this.onBeforeLoadRun();for(const t of Object.values(this.steps)){const e=n.filter(e=>e.func.nqName===t.func.nqName);if(0===e.length&&(t.visibility.next(m.L_.HIDDEN),t.ability.next(m.D.DISABLED)),1===e.length&&(yield t.view.loadRun(e[0].id),t.visibility.next(m.L_.VISIBLE),(0,v.Ne)(e[0])?t.ability.next(m.D.DISABLED):t.ability.next(m.D.ENABLED)),e.length>1){const n=e.find(e=>{var n;return e.options.customId===(null===(n=t.options)||void 0===n?void 0:n.customId)});yield t.view.loadRun(n.id),t.visibility.next(m.L_.VISIBLE),(0,v.Ne)(n)?t.ability.next(m.D.DISABLED):t.ability.next(m.D.ENABLED)}}const o=Object.values(this.steps).find(t=>t.ability.value===m.D.DISABLED&&t.visibility.value===m.L_.VISIBLE),s=null!=o?o:Object.values(this.steps)[0];if(s.ability.next(m.D.ENABLED),o){let t=this.getNextStep(o);for(;t;)t.ability.next(m.D.DISABLED),t=this.getNextStep(t)}this.lastCall=e,this.linkFunccall(e),this.isHistorical.next(!0);const r=Object.values(this.steps).filter(t=>t.visibility.value==m.L_.VISIBLE).at(i);return r&&r.ability.value===m.D.ENABLED?this.currentTabName=w(r):this.currentTabName=w(s),yield this.onAfterLoadRun(e),e})}hideSteps(...t){return C(this,void 0,void 0,function*(){t.forEach(t=>{this.steps[t].visibility.next(m.L_.HIDDEN)})})}showSteps(...t){return C(this,void 0,void 0,function*(){t.forEach(t=>{this.steps[t].visibility.next(m.L_.VISIBLE)})})}exportRunJson(){return C(this,void 0,void 0,function*(){if(this._lastCall){const t={isPipeline:!0};for(const[e,n]of Object.entries(this.steps)){const i=n.view.lastCall;i&&(t[e]=yield(0,y.wB)(i,n.view))}return(0,f.lK)(t)}})}executeTest(t){return C(this,arguments,void 0,function*(t,e=!1){yield(0,b.b)(t,this,{updateMode:e,interactive:!0})})}getStepViewRuns(t){return this.onStepCompleted.pipe((0,l.filter)(e=>e.func.nqName===t),(0,l.map)(()=>this.getStepView(t)))}}},873(t,e,n){"use strict";n.d(e,{E:()=>S});var i=n(4328),o=n(7389),s=n(6082),r=n(3508),a=n.n(r),l=n(1991),u=n.n(l),c=n(1757),d=n.n(c),p=n(1858),h=n(9713),f=n(1927),v=n(4260),m=n(7375),g=(n(5940),n(2244)),y=n(5092),b=n(8920),C=n(4795),w=n(5355),A=n(810),x=n(1599),I=n(3143),E=n(4386),T=function(t,e,n,i){return new(n||(n=Promise))(function(o,s){function r(t){try{l(i.next(t))}catch(t){s(t)}}function a(t){try{l(i.throw(t))}catch(t){s(t)}}function l(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(r,a)}l((i=i.apply(t,e||[])).next())})};const R=()=>o.divText("[No data to display]",{style:{"text-align":"center","align-content":"center",width:"100%",height:"100%"}});class S extends g.s{static fromFuncCall(t,e={historyEnabled:!0,isTabbed:!1}){return new this(t,e)}constructor(t,e={historyEnabled:!0,isTabbed:!1}){super(t,e),this.options=e,this.inputValidationRequests=new p.Subject,this.outputValidationRequests=new p.Subject,this.inputValidationUpdates=new p.Subject,this.outputValidationUpdates=new p.Subject,this.runRequests=new p.Subject,this.isRunning=new p.BehaviorSubject(!1),this.isUploadMode=new p.BehaviorSubject(!1),this.inputsOverride={},this.inputsMap={},this.outputValidationSigns={},this.inputValidators={},this.outputValidators={},this.inputValidationState={},this.outputValidationState={},this.externalValidatorsUpdates=new p.Subject,this.externalValidatorsState={},this.pendingInputValidations=this.inputValidationUpdates.pipe((0,h.startWith)(null),(0,h.map)(()=>this.inputValidationState)),this._isOutputOutdated=new p.BehaviorSubject(!0),this.isOutputOutdated=this._isOutputOutdated.pipe((0,h.distinctUntilChanged)()),this.blockRuns=new p.BehaviorSubject(!1),this.prevOpenedTab=null,this.beforeInputPropertyRender=new p.Subject,this.afterInputPropertyRender=new p.Subject,this.afterOutputPropertyRender=new p.Subject,this.afterOutputSacalarTableRender=new p.Subject,this.formButtons=o.div(),this.additionalBtns=[],this.navBtns=[],this.tabsElem=o.tabControl(),this.dfToViewerMapping={},this.focusedInput=null,this.foldedCategoryInputs={},this.richFunctionExport=t=>T(this,void 0,void 0,function*(){if(!this.lastCall)throw new Error("Function was not called");if(!this.exportConfig.supportedFormats.includes(t))throw new Error(`Format "${t}" is not supported.`);if(!this.func)throw new Error("The correspoding function is not specified");const[e]=yield(0,E.aK)(t,this.func,this.lastCall,this.dfToViewerMapping);return e}),this.exportConfig={supportedExtensions:this.richFunctionViewExportExtensions(),supportedFormats:this.richFunctionViewSupportedFormats(),export:this.richFunctionExport,filename:this.defaultExportFilename}}onFuncCallReady(){const t=Object.create(null,{onFuncCallReady:{get:()=>super.onFuncCallReady}});return T(this,void 0,void 0,function*(){yield this.loadInputsOverrides(),yield this.loadValidators(b.bZ.INPUTS),yield this.loadValidators(b.bZ.OUTPUTS),yield t.onFuncCallReady.call(this);const e=this.funcCallReplaced.subscribe(()=>{this.inputValidationRequests.next({isRevalidation:!1}),this.outputValidationRequests.next({isRevalidation:!1})});this.subs.push(e);const n=t=>(0,h.mergeMap)(e=>e.pipe((0,h.tap)(e=>{t===b.bZ.INPUTS?this.setInputValidationPending(e.field):this.setOutputValidationPending(e.field)}),(0,h.switchMap)(e=>{const n=new AbortController,i=n.signal;let o=!1;return new p.Observable(s=>{const r=(0,p.from)(this.runValidation(Object.assign({},e),i,t)).subscribe(t=>{o=!0,s.next(t)});return()=>{o||n.abort(),r.unsubscribe()}}).pipe((0,h.tap)(n=>{t===b.bZ.INPUTS?this.setInputValidationResults(n):this.setOutputValidationResults(n),this.runRevalidations(e,n,t),t===b.bZ.INPUTS?this.inputValidationUpdates.next(null):this.outputValidationUpdates.next(null)}),(0,h.mapTo)(e))}))),s=this.inputValidationRequests.pipe((0,h.groupBy)(t=>t.field),n(b.bZ.INPUTS)).subscribe(t=>{t.field&&this.runningOnInput&&this.isRunnable()&&this.doRun()});this.subs.push(s);const r=this.outputValidationRequests.pipe((0,h.groupBy)(t=>t.field),n(b.bZ.OUTPUTS)).subscribe();this.subs.push(r);const a=this.externalValidatorsUpdates.subscribe(t=>{this.updateInputValidationResults(t)});this.subs.push(a);const l=(0,p.combineLatest)([this.runRequests.pipe((0,h.switchMap)(()=>(0,p.of)(!1).pipe((0,h.delay)(500),(0,h.startWith)(!0)))),this.inputValidationUpdates.pipe((0,h.debounceTime)(0))]).pipe((0,h.filter)(([t])=>t&&this.isRunnable())).subscribe(()=>this.doRun());this.subs.push(l);const u=this.options.isTabbed?null:yield this.loadLastInputs();if(u)i.shell.info(o.div([o.divText("Do you want to load last inputs?"),o.divH([o.bigButton("Load",()=>{for(const[t,e]of Object.entries(u)){const n=this.getInput(t);n.notify=!1,n.value=e,n.notify=!0,this.funcCall.inputs[t]=e,this.inputValidationRequests.next({field:t,isRevalidation:!1})}i.shell.info(o.divText("Change the loaded inputs to run computations"))})])]));else{const 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())}})}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=>{d()(t.header).show()}),this.prevOpenedTab)return this.tabsElem.currentPane=this.prevOpenedTab,Promise.resolve();const t=this.tabsElem.panes.find(t=>this.outputTabsLabels.includes(t.name));return t&&(this.tabsElem.currentPane=t),Promise.resolve()}getRunButton(t="Run"){var e;const n=o.bigButton(null!==(e=(0,C.O0)(this.func))&&void 0!==e?e:t,()=>T(this,void 0,void 0,function*(){return yield this.doRun()})),i=(0,p.merge)(this.inputValidationUpdates,this.externalValidatorsUpdates,this.isRunning,this.blockRuns).subscribe(()=>{const t=this.isRunnable();n.disabled=!t});return this.subs.push(i),n}loadInputsOverrides(){return T(this,void 0,void 0,function*(){const t=[...this.funcCall.inputParams.values()];yield Promise.all(t.map(t=>T(this,void 0,void 0,function*(){if(t.property.options.input){const e=s.Func.byName(t.property.options.input).prepare({params:JSON.parse(t.property.options.inputOptions||"{}")});yield e.call(),this.inputsOverride[t.name]=e.outputs.input}})))})}loadValidators(){return T(this,arguments,void 0,function*(t=b.bZ.INPUTS){const e=yield(0,C.QL)(this.funcCall,t);t===b.bZ.INPUTS?this.inputValidators=e:this.outputValidators=e})}keepOutput(){var t;return"true"===(null===(t=this.func)||void 0===t?void 0:t.options.keepOutput)}getSaveButton(t="Save"){const e=o.bigButton(t,()=>T(this,void 0,void 0,function*(){return yield this.saveExperimentalRun(this.funcCall)}),"Save uploaded data"),n=this.isUploadMode.subscribe(t=>{this.buildRibbonPanels(),t?d()(e).show():d()(e).hide()});return this.subs.push(n),e}getStandardButtons(){const t=this.getRunButton(),e=o.div([t]);o.tooltip.bind(e,()=>t.disabled?this.isRunning.value?"Computations are in progress":this.getValidationMessage():"");const n=this.getSaveButton();return[...this.isHistoryEnabled&&!this.options.isTabbed?[n]:[],...this.runningOnInput?[]:[e]]}buildFormButtons(){var t;const e=this.getStandardButtons(),n=o.buttonsInput();return d()(n.firstChild).css({display:"none"}),null===(t=n.lastChild)||void 0===t||t.replaceWith(o.div([...this.navBtns,...this.additionalBtns,...e],"ui-input-editor")),d()(n).addClass("rfv-buttons"),d()(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(){const{inputBlock:t,inputForm:e,outputForm:n,controlsWrapper:i}=this.buildInputBlock(),s=[...Array.from(e.childNodes),...this.isUploadMode.value?[Array.from(n.childNodes)]:[]];o.tools.handleResize(t,()=>{d()(t).width()<300?(d()(e).addClass("ui-form-condensed"),d()(n).addClass("ui-form-condensed"),d()(i).addClass("ui-form-condensed"),s.forEach(t=>d()(t).css("min-width","100px"))):(d()(e).removeClass("ui-form-condensed"),d()(n).removeClass("ui-form-condensed"),d()(i).removeClass("ui-form-condensed"),s.forEach(t=>d()(t).css("min-width","100%")))});const r=this.buildOutputBlock();r.style.height="100%",r.style.width="100%",this.hideOutput();const a=o.splitH([t,o.panel([r],{style:{paddingTop:"0px"}})],null,!0);return a.style.padding="0 12px",t.style.maxWidth="360px",a}buildInputBlock(){const t=this.renderInputForm(),e=this.renderOutputForm();this.buildFormButtons();const n=o.div(this.formButtons,"ui-form ui-form-wide");d()(n).css({"padding-left":"0px","padding-bottom":"0px","padding-right":"6px","max-width":"100%","min-height":"50px"});const i=o.input.toggle("",{value:this.isUploadMode.value,onValueChanged:t=>this.isUploadMode.next(t)}),s=this.isUploadMode.subscribe(t=>{i.notify=!1,i.value=t,i.notify=!0,t?d()(e).show():d()(e).hide()});return this.subs.push(s),{inputBlock:o.divV([t,...this.hasUploadMode&&!this.uploadFunc?[o.divH([o.h2("Experimental data"),i.root],{style:{flexGrow:"0"}}),e]:[],n],"ui-box rfv-form"),inputForm:t,outputForm:e,controlsWrapper:n}}processCustomDataUpload(){return T(this,void 0,void 0,function*(){const t=()=>{const t=s.Dialog.create({title:"Select to compare"}),e=new w.H(u.length>0?u:[...this.historyBlock.history.values()],{fallbackText:"No historical runs found",showActions:!(u.length>0),showBatchActions:!(u.length>0)}),n=new w.H(l,{fallbackText:"No runs uploaded",showActions:!1,showBatchActions:!1});t.add(o.divV([o.divV([o.label("Uploaded runs"),o.element("div","splitbar-horizontal"),n.root],{style:{height:"50%",overflowY:"hidden"}}),o.divV([o.label(u.length>0?"Simulated":"History",{style:{padding:"0px 10px 0px 9px"}}),o.element("div","splitbar-horizontal"),e.root],{style:{height:"50%",overflowY:"hidden"}})],{style:{justifyContent:"space-between",gap:"10px",overflowY:"scroll",height:"100%"}})),d()(t.root.querySelector(".d4-dialog-contents")).removeClass("ui-form");const i="Compare selected";return 0===u.length?t.addButton(i,()=>T(this,void 0,void 0,function*(){const i=yield Promise.all([...e.selected].map(t=>y.W.loadRun(t.id)));this.onComparisonLaunch([...i,...n.selected.values()]),t.close()})):t.addButton(i,()=>T(this,void 0,void 0,function*(){this.onComparisonLaunch([...e.selected.values(),...n.selected.values()]),t.close()})),t.getButton(i).disabled=!0,this.subs.push((0,p.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(g,()=>T(this,void 0,void 0,function*(){this.onComparisonLaunch([this.funcCall,...n.selected.values()]),t.close()})),d()(t.getButton("CANCEL")).hide(),t},e=s.Func.byName(this.uploadFunc),n=yield e.prepare({params:{func:this.func}}).call(),r=n.outputs.uploadWidget,a=n.outputs.uploadFuncCall;let l=[],u=[];const c=s.Dialog.create({title:"Upload"});d()(c.root.querySelector(".d4-dialog-contents")).removeClass("ui-form");const f=s.Dialog.create({title:"Review uploaded runs"});d()(f.root.querySelector(".d4-dialog-contents")).removeClass("ui-form");const m="Save to history",g="Compare w/ current";c.add(r.root),c.addButton(m,()=>T(this,void 0,void 0,function*(){return(0,A.ZD)(c.root,!0),l.forEach(t=>{t.options.immutable_tags?t.options.immutable_tags.push(v.ec):t.options.immutable_tags=[v.ec]}),Promise.all(l.map(t=>T(this,void 0,void 0,function*(){const e=yield this.getValidExpRun(t);return y.W.saveRun(e)}))).then(t=>Promise.all(t.map(t=>y.W.loadRun(t.id)))).then(t=>{t.forEach(t=>this.historyBlock.addRun(t))}).catch(t=>{i.shell.error(t)}).finally(()=>{(0,A.ZD)(c.root,!1),c.close();const t=new w.H(l,{fallbackText:"No runs uploaded",showActions:!0,showBatchActions:!0});f.add(t),f.show({modal:!0,fullScreen:!0})})})),c.addButton("Next",()=>{c.close(),l.forEach(t=>{t.options.immutable_tags?t.options.immutable_tags.push(v.ec):t.options.immutable_tags=[v.ec]});const t=new w.H(l,{fallbackText:"No runs uploaded",showActions:!0,showBatchActions:!0});f.add(t.root),f.show({modal:!0,fullScreen:!0})}),d()(c.getButton("CANCEL")).hide(),c.getButton(m).disabled=!0,c.getButton("Next").disabled=!0,d()(f.getButton("CANCEL")).hide(),f.addButton("Simulate w/ same inputs",()=>{(0,A.ZD)(c.root,!0),Promise.all(l.map(t=>T(this,void 0,void 0,function*(){return(yield(0,C.Hs)(t)).call()}))).then(e=>{u=e,f.close(),t().show({modal:!0,fullScreen:!0})}).catch(t=>{i.shell.error(t)}).finally(()=>{(0,A.ZD)(c.root,!1)})}),f.addButton("Compare w/ history",()=>{f.close(),t().show({modal:!0,fullScreen:!0})});const b=i.functions.onAfterRunAction.pipe((0,h.filter)(t=>t.id===a.id)).subscribe(()=>{l=a.outputs.uploadedCalls,c.getButton(m).disabled=!1,c.getButton("Next").disabled=!1}),x=c.onClose.subscribe(()=>{this.isUploadMode.next(!1)});c.subs.push(x,b),c.show({modal:!0,center:!0,resizable:!0})})}onSaveClick(){return T(this,void 0,void 0,function*(){this.isUploadMode.value?yield this.saveExperimentalRun(this.funcCall):yield this.saveRun(this.funcCall)})}buildRibbonPanels(){super.buildRibbonPanels();const t=o.iconFA("play",()=>T(this,void 0,void 0,function*(){return yield this.doRun()}),"Run computations");t.classList.add("fas");const e=o.iconFA("arrow-to-top",()=>T(this,void 0,void 0,function*(){this.uploadFunc?yield this.processCustomDataUpload():(this.isUploadMode.next(!this.isUploadMode.value),e.classList.toggle("d4-current"))}),"Upload experimental data");e.classList.add("d4-toggle-button",...this.isUploadMode.value?["d4-current"]:[]);const n=o.iconFA("info",()=>T(this,void 0,void 0,function*(){this.hasContextHelp&&(i.shell.windows.help.visible=!0,yield new Promise(t=>setTimeout(t,100)),i.shell.windows.help.showHelp(o.markdown(yield this.getContextHelp())))}),"Info"),s=[[...super.buildRibbonPanels().flat(),...this.runningOnInput||this.options.isTabbed?[]:[t],...this.hasUploadMode?[e]:[],...!this.options.isTabbed&&this.hasContextHelp?[n]:[]]];return this.setRibbonPanels(s),s}showOutput(){o.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=>{const[e,n]=this.categoryToDfParamMap.outputs[t]?[this.categoryToDfParamMap.outputs[t],!1]:[this.categoryToDfParamMap.inputs[t],!0],r=e.filter(t=>t.propertyType===s.TYPE.DATA_FRAME||t.propertyType===s.TYPE.GRAPHICS),a=e.filter(t=>t.propertyType!==s.TYPE.DATA_FRAME&&t.propertyType!==s.TYPE.GRAPHICS),l=r.map(t=>(0,x.jJ)(t).config);let u="";const c=r.reduce((t,e,r)=>{var a,c;this.dfToViewerMapping[e.name]=[];const p=l[r].map((t,n)=>T(this,void 0,void 0,function*(){var n,r,a,l;const u=null!==(l=null!==(r=null===(n=this.funcCall.outputs[e.name])||void 0===n?void 0:n.value)&&void 0!==r?r:null===(a=this.funcCall.inputParams[e.name])||void 0===a?void 0:a.value)&&void 0!==l?l:i.data.demo.demog(0),c=t.type,d=Object.values(v.CB).includes(c)?s.Viewer.fromType(c,u):yield u.plot.fromType(c);d.setOptions(t),this.dfToViewerMapping[e.name].push(d),this.afterOutputPropertyRender.next({prop:e,output:d});const p=R();return 0===u.rowCount&&"demog 0"===u.name&&(o.setDisplay(d.root,!1),o.setDisplay(p,!0)),{viewer:d,stub:p}})),m=p.map((t,n)=>t.then(({viewer:t,stub:i})=>{const s=this.funcCallReplaced.pipe((0,h.startWith)(null),(0,h.switchMap)(()=>{var t;return(null!==(t=this.funcCall.outputParams[e.name])&&void 0!==t?t:this.funcCall.inputParams[e.name]).onChanged.pipe((0,h.startWith)(null))}),(0,h.skip)(1)).subscribe(()=>T(this,void 0,void 0,function*(){var s;const a=null!==(s=this.funcCall.outputParams[e.name])&&void 0!==s?s:this.funcCall.inputParams[e.name];if(a.value){if(o.setDisplay(t.root,!0),o.setDisplay(i,!1),Object.values(v.CB).includes(t.type))t.dataFrame=a.value;else{const e=yield a.value.plot.fromType(t.type);t.root.replaceWith(e.root),t=e}try{l[r][n]&&t.setOptions(l[r][n])}catch(t){console.error("Error setting viewer properties: ",t)}Object.keys(l[r][n]).includes("color")&&t.setOptions({color:l[r][n].color}),this.afterOutputPropertyRender.next({prop:e,output:t})}else o.setDisplay(t.root,!1),o.setDisplay(i,!0)}));return this.subs.push(s),{loadedViewer:t,stub:i}})),g=u!==(null!==(a=e.options.caption)&&void 0!==a?a:e.name)?null!==(c=e.options.caption)&&void 0!==c?c:e.name:" ";if(u=g,n){const t=this.funcCallReplaced.pipe((0,h.switchMap)(()=>{var t;return(null!==(t=this.funcCall.outputParams[e.name])&&void 0!==t?t:this.funcCall.inputParams[e.name]).onChanged})).subscribe(()=>{this.showOutput(),this.inputTabsLabels.forEach(t=>{d()(this.tabsElem.getPane(t).header).show()})});this.subs.push(t)}const y=m.map((t,n)=>{const i=l[r][n].block,s=o.wait(()=>T(this,void 0,void 0,function*(){const e=yield t;return d()(e.loadedViewer.root).css({height:"100%",width:"100%"}),o.divV([e.loadedViewer.root,e.stub],{style:{width:"100%"}})}));d()(s).css({"min-height":"300px","flex-grow":"1"});const a=(0,f.JC)();return this.outputValidationSigns[e.name]=a,o.divV([o.divH([o.h2(0===n?g:" ",{style:{whiteSpace:"pre"}}),...0===n?[o.div([this.outputValidationSigns[e.name][0],this.outputValidationSigns[e.name][1]],{style:{margin:"10.79px"}})]:[]]),s],{style:Object.assign({},i?{width:`${i}%`,"max-width":`${i}%`,"max-height":"100%"}:{"flex-grow":"1"})})});if(e.propertyType===s.TYPE.GRAPHICS){const n=e.options.block,i=R();i.classList.add("grok-scripting-image-container");const s=o.divV([o.h2(g,{style:{whiteSpace:"pre"}}),i],{style:Object.assign({},n?{width:`${n}%`,"max-width":`${n}%`,"max-height":"100%"}:{"flex-grow":"1"})}),r=()=>{var t;const n=null!==(t=this.funcCall.outputParams[e.name])&&void 0!==t?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]")},a=this.funcCallReplaced.pipe((0,h.startWith)(null),(0,h.switchMap)(()=>{var t;return(null!==(t=this.funcCall.outputParams[e.name])&&void 0!==t?t:this.funcCall.inputParams[e.name]).onChanged.pipe((0,h.startWith)(null))}),(0,h.skip)(1)).subscribe(r);this.subs.push(a),t.append(s)}return t.append(...y),t},o.divH([],{style:{flexWrap:"wrap",flexGrow:"1",maxHeight:"100%"}}));a.forEach(t=>{const e=(0,f.JC)();this.outputValidationSigns[t.name]=e});const m=()=>{const t=s.HtmlTable.create(a,t=>{var e;const n=t.options.precision,i=n&&t.propertyType===s.TYPE.FLOAT&&this.funcCall.outputs[t.name]?this.funcCall.outputs[t.name].toPrecision(n):this.funcCall.outputs[t.name],r=t.options.units?` [${t.options.units}]`:"";return[`${null!==(e=t.caption)&&void 0!==e?e:t.name}${r}`,null!=i?i:"[No value]",o.div([this.outputValidationSigns[t.name][0],this.outputValidationSigns[t.name][1]])]}).root;return d()(t).addClass("rfv-scalar-table"),this.afterOutputSacalarTableRender.next(t),t};let g=m();const y=(0,p.merge)(this.funcCallReplaced,this.isRunning.pipe((0,h.filter)(t=>!1===t),(0,h.skip)(1))).subscribe(()=>{const e=m();g.replaceWith(e),g=e,d()(this.tabsElem.getPane(t).header).show()});this.subs.push(y),this.tabsElem.addPane(t,()=>o.divV([...r.length?[c]:[],...a.length?[g]:[]]))});const t=o.box();return t.append(this.tabsElem.root),t}onAfterLoadRun(t){return T(this,void 0,void 0,function*(){this.showOutput()})}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(){return(0,C.r6)(this.funcCall.func)}get inputsStorage(){return`RFV_LastInputs_${this.funcCall.func.name}`}saveLastInputs(){return T(this,void 0,void 0,function*(){try{const t=u()(this.funcCall.inputParams.values()).reduce((t,e)=>{const n=e.property.propertyType!==s.TYPE.DATA_FRAME?this.funcCall.inputs[e.name]:Array.from(this.funcCall.inputs[e.name].toByteArray());return Object.assign(Object.assign({},t),{[e.name]:n})},{});return localStorage.setItem(this.inputsStorage,JSON.stringify(t))}catch(t){i.shell.error(t.toString())}})}loadLastInputs(){return T(this,void 0,void 0,function*(){var t;try{const e=JSON.parse(null!==(t=localStorage.getItem(this.inputsStorage))&&void 0!==t?t:"{}");return 0===Object.keys(e).length?null:u()(this.funcCall.inputParams.values()).reduce((t,n)=>{const i=n.property.propertyType!==s.TYPE.DATA_FRAME?e[n.name]:s.DataFrame.fromByteArray(new Uint8Array(e[n.name]));return Object.assign(Object.assign({},t),{[n.name]:i})},{})}catch(t){i.shell.error(t.toString())}})}deleteLastInputs(){return T(this,void 0,void 0,function*(){try{return localStorage.removeItem(this.inputsStorage)}catch(t){i.shell.error(t.toString())}})}doRun(){return T(this,void 0,void 0,function*(){this.isRunning.next(!0);try{this.options.isTabbed||(yield this.saveLastInputs()),yield this.run(),this.options.isTabbed||(yield this.deleteLastInputs())}catch(t){i.shell.error(t.toString()),console.log(t)}finally{this.isRunning.next(!1),this.inputValidationRequests.next({isRevalidation:!1,isNewOutput:!0}),this.outputValidationRequests.next({isRevalidation:!1})}})}setExternalValidationResults(t,e){this.externalValidatorsState[t]=e,this.externalValidatorsUpdates.next(t)}saveInputLockState(t,e,n){"restricted"===n&&(this.funcCall.options[b.AY]=Object.assign(Object.assign({},this.funcCall.options[b.AY]),{[t]:e})),n&&(this.funcCall.options[b.Jl]=Object.assign(Object.assign({},this.funcCall.options[b.Jl]),{[t]:n})),this.updateConsistencyState()}getInputLockState(t){var e;return null===(e=this.funcCall.options[b.Jl])||void 0===e?void 0:e[t]}updateConsistencyState(){const t=Object.values(this.funcCall.options[b.Jl]).some(t=>"inconsistent"===t);this.consistencyState.next(t?"inconsistent":"consistent")}getInput(t){return this.inputsMap[t]}setInput(t,e,n){const i=this.getInput(t);if(!i)throw new Error(`No input named ${t}`);if(this.funcCall.inputParams[t].property.propertyType===s.TYPE.DATA_FRAME&&"restricted"===n)throw new Error(`Param ${t} is dataframe. Restricted state is not supported for them.`);n||(n=this.funcCall.inputParams[t].property.propertyType===s.TYPE.DATA_FRAME?"disabled":"restricted"),this.funcCall.inputs[t]=e,this.setInputLockState(i,t,e,n)}getParamChanges(t){return this.funcCallReplaced.pipe((0,h.startWith)(null),(0,h.filter)(()=>!!this.funcCall),(0,h.map)(()=>this.funcCall.inputParams[t]?"inputParams":"outputParams"),(0,h.switchMap)(e=>this.funcCall[e][t].onChanged.pipe((0,h.startWith)(null),(0,h.map)(()=>this.funcCall[e][t].value))))}getParamValue(t){var e,n;const i=(null===(e=this.funcCall)||void 0===e?void 0:e.inputParams[t])?"inputParams":"outputParams";return null===(n=this.funcCall)||void 0===n?void 0:n[i][t].value}setInputLockState(t,e,n,i){i&&this.saveInputLockState(e,n,i),(0,m.gD)(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[b.AY])||void 0===e?void 0:e[t]}renderOutputForm(){return this.renderIOForm(b.bZ.OUTPUTS)}renderInputForm(){return this.renderIOForm(b.bZ.INPUTS)}renderIOForm(t){const e=o.divH([],"ui-form ui-form-wide");d()(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";const i=this.funcCall[b.wl[t]].values();return u()(i).filter(t=>!!t).forEach(i=>{const o=i.property;this.beforeInputPropertyRender.next(o);const s=this.getInputForVal(i);s?(this.inputsMap[i.property.name]=s,t===b.bZ.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:o,input:s}),n=o.category):n=o.category}),Object.keys(this.foldedCategoryInputs).forEach(t=>this.foldedCategoryInputs[t].forEach(t=>d()(t.input.root).hide())),e.classList.remove("ui-panel"),e}saveFocusedElement(t){this.focusedInput=t}restoreFocusedElement(){var t;null===(t=this.focusedInput)||void 0===t||t.focus()}disableInputsOnRun(t,e){const n=this.isRunning.subscribe(n=>{"user input"!==this.getInputLockState(t)&&this.getInputLockState(t)||(n?((0,C.KL)(e)&&d()(e.input).is(":focus")&&this.saveFocusedElement(e.input),e.enabled=!1):(e.enabled=!0,(0,C.KL)(e)&&this.restoreFocusedElement()))});this.subs.push(n)}checkForMapping(t,e){if(!e.hasOwnProperty("_chosenRun"))return;const n=t.property.options.funccallMapping;if(!n)return;const i=JSON.parse(n),o=this.funcCallReplaced.pipe((0,h.startWith)(!0),(0,h.switchMap)(()=>this.funcCall.inputParams[t.property.name].onChanged)).subscribe(()=>{Object.entries(i).forEach(([t,n])=>this.setInput(t,e.chosenRun?(t=>{var n,i,o,s,r,a;return null!==(a=null!==(s=null!==(i=null===(n=e.chosenRun)||void 0===n?void 0:n.inputs[t])&&void 0!==i?i:null===(o=e.chosenRun)||void 0===o?void 0:o.outputs[t])&&void 0!==s?s:null===(r=e.chosenRun)||void 0===r?void 0:r.options[t])&&void 0!==a?a:null})(n):(0,A.Bu)(this.funcCall.inputParams[t].property),e.chosenRun?"restricted":"user input"))});this.subs.push(o)}getInputForVal(t){var e,n;const i=t.property;if(this.inputsOverride[t.property.name])return this.inputsOverride[t.property.name];if(i.propertyType===s.TYPE.STRING&&i.options.choices&&!i.options.propagateChoice)return o.input.choice(null!==(e=i.caption)&&void 0!==e?e:i.name,{value:(0,A.Bu)(i),items:JSON.parse(i.options.choices),nullable:i.nullable});switch(i.propertyType){case"file":return I.A.fileInput(null!==(n=i.caption)&&void 0!==n?n:i.name,null,null,null);case s.TYPE.FLOAT:const t=o.input.forProperty(i),e=i.options.format;return e&&(t.format=e),t;default:return o.input.forProperty(i)}}bindOnHotkey(t){(0,C.KL)(t)&&(t.input.onkeydown=t=>T(this,void 0,void 0,function*(){"Enter"==t.key&&this.runRequests.next()}))}get foldedCategories(){var t;return JSON.parse(null!==(t=this.func.options.foldedCategories)&&void 0!==t?t:"[]")}getCategoryWarningIcon(t){const e=o.iconFA("exclamation-circle",null,"This category has inconsistent inputs");d()(e).css({color:"var(--orange-2)","padding-left":"5px"}).hide();const n=this.funcCallReplaced.subscribe(()=>{this.foldedCategoryInputs[t].some(t=>"inconsistent"===this.getInputLockState(t.paramName)&&t.input.value!==this.getRestrictedValue(t.paramName))?d()(e).show():d()(e).hide()});return this.subs.push(n),e}renderCategory(t,e,n){if(e!==n)if(this.foldedCategories.includes(e)){const n=this.getCategoryWarningIcon(e),i=o.iconFA("chevron-right",()=>{var t;d()(s).show(),d()(i).hide(),d()(n).hide(),(null!==(t=this.foldedCategoryInputs[e])&&void 0!==t?t:[]).forEach(t=>d()(t.input.root).css({display:""}))},"Open category");d()(i).css("padding-right","5px");const s=o.iconFA("chevron-down",()=>{var t;d()(s).hide(),d()(i).show(),this.foldedCategoryInputs[e].some(t=>"inconsistent"===this.getInputLockState(t.paramName))?d()(n).show():d()(n).hide(),(null!==(t=this.foldedCategoryInputs[e])&&void 0!==t?t:[]).forEach(t=>d()(t.input.root).hide())},"Close category");d()(s).css("padding-right","5px"),t.append(o.h2([i,s,o.h2(e,{style:{display:"inline"}}),n],{style:{width:"100%"}})),d()(s).hide()}else t.append(o.h2(e,{style:{width:"100%"}}))}renderInput(t,e,n){var i;const o=e.property;this.foldedCategories.includes(o.category)&&(this.foldedCategoryInputs[o.category]=[...null!==(i=this.foldedCategoryInputs[o.category])&&void 0!==i?i:[],{paramName:e.property.name,input:n}]),this.injectLockIcons(e,n),(0,C.JU)(n),(0,C.KL)(n)&&((0,C.hg)(e,n),this.bindTooltips(e,n),(0,C._t)(n)),t.append(n.root)}bindTooltips(t,e){const n=t.property.name,i=()=>{var e,i;const s=`${null!==(i=null!==(e=t.property.description)&&void 0!==e?e:t.property.caption)&&void 0!==i?i:t.property.name}.`,r=(()=>"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 s||r?o.divV([...s?[o.divText(s)]:[],...r?[o.divText(r)]:[]],{style:{maxWidth:"300px"}}):null};o.tooltip.bind(e.captionLabel,i),o.tooltip.bind(e.input,i)}injectLockIcons(t,e){const n=t.property.name;e.root.addEventListener("click",()=>{"restricted"===this.getInputLockState(n)&&this.setInputLockState(e,t.name,t.value,"restricted unlocked")});const i=o.iconFA("lock");d()(i).addClass("rfv-icon-lock"),d()(i).css({color:"var(--grey-2)"});const r=o.iconFA("lock-open");d()(r).addClass("rfv-icon-unlock"),d()(r).css({color:"var(--grey-2)"});const a=o.iconFA("undo",e=>{this.setInput(t.name,this.getRestrictedValue(n),"restricted"),e.stopPropagation()},"Reset value to computed value");d()(a).addClass("rfv-icon-undo"),d()(a).css({color:"var(--blue-2)"});const l=o.iconFA("exclamation-circle",null,"Validation");o.tooltip.bind(l,()=>`Current value is incosistent. Computed value was ${s.TYPES_SCALAR.has(t.property.propertyType)?this.getRestrictedValue(n):"different"}`),d()(l).addClass("rfv-icon-warning"),d()(l).css({color:"var(--orange-2)"});const u=e;u.placeLockStateIcons||(u.placeLockStateIcons=function(t,n,i,o){(0,C.KL)(e)&&(e.addOptions(t),e.addOptions(n),e.addOptions(i),e.addOptions(o))}),u.placeLockStateIcons(i,r,a,l)}syncInput(t,e,n){const i=t.name;let o=!1;const r=this.funcCallReplaced.pipe((0,h.startWith)(!0)).subscribe(()=>{var t,o;const s=this.funcCall[b.wl[n]][i],r=null!==(o=null!==(t=this.funcCall[n][i])&&void 0!==t?t:(0,A.Bu)(s.property))&&void 0!==o?o:null;e.notify=!1,e.value=r,e.notify=!0,this.funcCall[n][i]=r,this.setInputLockState(e,i,r,this.getInputLockState(i))});this.subs.push(r);const a=this.funcCallReplaced.pipe((0,h.startWith)(!0),(0,h.switchMap)(()=>{const t=this.funcCall[b.wl[n]][i];return t.onChanged.pipe((0,h.mapTo)(t))})).subscribe(t=>{const i=this.funcCall[n][t.name];if(o||(e.notify=!1,e.value=i,e.notify=!0),n===b.bZ.INPUTS){this.isHistorical.next(!1),this.hideOutput(),this.inputValidationRequests.next({field:t.name,isRevalidation:!1});const 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(a);const l=this.funcCallReplaced.pipe((0,h.startWith)(!0),(0,h.switchMap)(()=>{const t=this.funcCall[b.wl[n]][i];return t.onChanged.pipe((0,h.mapTo)(t),(0,h.startWith)(t))}),(0,h.filter)(t=>t.property.propertyType===s.TYPE.DATA_FRAME&&t.value),(0,h.switchMap)(t=>t.value.onDataChanged.pipe((0,h.mapTo)(t)))).subscribe(t=>{n===b.bZ.INPUTS?this.inputValidationRequests.next({field:t.name,isRevalidation:!1}):this.outputValidationRequests.next({field:t.name,isRevalidation:!1})});this.subs.push(l);const u=((0,C.KL)(e)?e.onInput:(0,C.Gb)(e.onInput.bind(e))).pipe((0,h.debounceTime)(250)).subscribe(()=>{try{o=!0,this.funcCall[n][t.name]=e.value}finally{o=!1}});this.subs.push(u)}isRunnable(){return!this.isRunning.value&&!this.blockRuns.value&&this.isValid()}isValid(){for(const[t,e]of Object.entries(this.inputValidationState))if(!(0,f.Aw)(e))return!1;for(const[t,e]of Object.entries(this.externalValidatorsState))if(!(0,f.Aw)(e))return!1;return!0}getValidationState(){return this.inputValidationState}getValidationMessage(){const t=[];for(const[e,n]of Object.entries(this.inputValidationState))(0,f.Aw)(n)||t.push(`${e}: ${(0,f.u1)(n)}`);return t.join("\n")}runValidation(t,e){return T(this,arguments,void 0,function*(t,e,n=b.bZ.INPUTS){const i=t.field,o=this.getValidatedNames(i,n);return(0,C.tf)(t,o,e,n,{view:this,funcCall:this.funcCall,lastCall:this.lastCall},n===b.bZ.INPUTS?this.inputValidators:this.outputValidators)})}setInputValidationPending(t){const e=this.getValidatedNames(t);for(const t of e){this.inputValidationState[t]=(0,f.Ur)();const e=this.inputsMap[t];(0,m.LB)(e)&&e.setValidation((0,f.Ur)())}this.inputValidationUpdates.next(null)}setOutputValidationPending(t){const e=this.getValidatedNames(t,b.bZ.OUTPUTS);for(const t of e){this.outputValidationState[t]=(0,f.Ur)();const e=this.outputValidationSigns[t];if(e){const n=(0,f.JC)((0,f.Ur)());e[0].replaceWith(n[0]),e[1].replaceWith(n[1]),this.outputValidationSigns[t]=n}}this.outputValidationUpdates.next(null)}setInputValidationResults(t){for(const[e,n]of Object.entries(t))this.inputValidationState[e]=n,this.updateInputValidationResults(e)}setOutputValidationResults(t){for(const[e,n]of Object.entries(t))this.outputValidationState[e]=n,this.updateOutputValidationResults(e)}updateOutputValidationResults(t){const e=this.outputValidationState[t],n=this.outputValidationSigns[t];n&&(this.outputValidationSigns[t]=(0,C.Fd)(n,e))}updateInputValidationResults(t){const e=(0,f.uD)(this.inputValidationState[t],this.externalValidatorsState[t]),n=this.inputsMap[t];(0,m.LB)(n)&&n.setValidation(e)}runRevalidations(t,e,n=b.bZ.INPUTS){if(!t.isRevalidation)for(const[,t]of Object.entries(e))if(null==t?void 0:t.revalidate)for(const e of t.revalidate)n===b.bZ.INPUTS?this.inputValidationRequests.next({field:e,context:t.context,isRevalidation:!0}):this.outputValidationRequests.next({field:e,context:t.context,isRevalidation:!0})}getValidatedNames(t,e=b.bZ.INPUTS){return t?[t]:[...e===b.bZ.INPUTS?this.funcCall.inputs.keys():this.funcCall.outputs.keys()]}getValidExpRun(t){return T(this,void 0,void 0,function*(){t.started=a()();const e=t.options.immutable_tags||[];return t.options.immutable_tags=e.includes(v.ec)?e:[...e,v.ec],t.newId(),t})}saveExperimentalRun(t){return T(this,void 0,void 0,function*(){const e=yield this.getValidExpRun(t);yield this.saveRun(e)})}hideOutput(){if(this._isOutputOutdated.next(!0),this.keepOutput())return;this.outputTabsLabels.forEach(t=>{var e;return d()(null===(e=this.tabsElem.getPane(t))||void 0===e?void 0:e.header).hide()});const t=this.tabsElem.panes.find(t=>this.inputTabsLabels.includes(t.name));t?this.tabsElem.currentPane=t:d()(this.tabsElem.root).hide()}richFunctionViewSupportedFormats(){return["Excel"]}richFunctionViewExportExtensions(){return{Excel:"xlsx"}}}},8920(t,e,n){"use strict";n.d(e,{AY:()=>i,D:()=>a,Jl:()=>o,L_:()=>r,bZ:()=>l,wl:()=>u});const i="restrictedValues",o="editState";var s,r,a,l;!function(t){t.INPUT="Input",t.OUTPUT="Output"}(s||(s={})),function(t){t.HIDDEN="hidden",t.VISIBLE="visible"}(r||(r={})),function(t){t.ENABLED="enabled",t.DISABLED="disabled"}(a||(a={})),function(t){t.INPUTS="inputs",t.OUTPUTS="outputs"}(l||(l={}));const u={[l.INPUTS]:"inputParams",[l.OUTPUTS]:"outputParams"}},6318(t,e,n){"use strict";n.d(e,{b:()=>d,c:()=>p});var i=n(4328),o=n(5727),s=n(4350),r=n(9713),a=n(1858),l=n(4795),u=function(t,e,n,i){return new(n||(n=Promise))(function(o,s){function r(t){try{l(i.next(t))}catch(t){s(t)}}function a(t){try{l(i.throw(t))}catch(t){s(t)}}function l(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(r,a)}l((i=i.apply(t,e||[])).next())})};const c=2e4;function d(t,e){return u(this,arguments,void 0,function*(t,e,n={}){var o,s,r;yield h(e,null!==(o=n.initWaitTimeout)&&void 0!==o?o:c),e.disableSetters(!0);try{for(const[i,o]of Object.entries(e.steps)){const a=t[i];if(!a)continue;const l=null!==(r=null===(s=n.stepOptions)||void 0===s?void 0:s[i])&&void 0!==r?r:{},u=l.prefix?`${l.prefix}: ${i}`:i,{updateMode:d}=n,h={validatorsWaitTimeout:5e3,initWaitTimeout:c,parent:e,interactive:n.interactive,updateMode:d};yield p(a,o.view,Object.assign(Object.assign(Object.assign({},h),l),{prefix:u}))}}finally{e.disableSetters(!1)}n.interactive&&i.shell.info(`${e.name} test passed`)})}function p(t,e){return u(this,arguments,void 0,function*(t,e,n={}){var d;yield h(e,null!==(d=n.initWaitTimeout)&&void 0!==d?d:c);const p=()=>u(this,void 0,void 0,function*(){var t;if(n.parent){const e=null!==(t=n.parentWaitTimeout)&&void 0!==t?t:5e3,o=yield n.parent.isUpdating.pipe((0,r.map)(()=>n.parent.getRunningUpdates()),(0,r.debounceTime)(100),(0,r.takeUntil)((0,a.of)(null).pipe((0,r.delay)(e))),(0,r.takeWhile)(t=>0!==t.length,!0),(0,r.last)()).toPromise();if(null==o?void 0:o.length){const t=`{options.prefix}: parent updates failed to complete in ${e}ms, updates: ${o.join(",")}`,s=new Error(t);throw n.interactive&&i.shell.error(String(s)),s}}});yield p();for(const[i,o]of Object.entries(t.inputs)){const t=e.funcCall.inputParams[i].property.propertyType;n.updateMode?null==e.funcCall.inputs[i]&&(e.funcCall.inputs[i]=yield(0,l.$X)(t,o)):e.funcCall.inputs[i]=yield(0,l.$X)(t,o)}if(yield p(),yield(()=>u(this,void 0,void 0,function*(){var t;if(e instanceof o.Ee){const o=null!==(t=n.validatorsWaitTimeout)&&void 0!==t?t:5e3,s=yield e.pendingInputValidations.pipe((0,r.map)(t=>Object.keys(t)),(0,r.debounceTime)(100),(0,r.takeUntil)((0,a.of)(null).pipe((0,r.delay)(o))),(0,r.takeWhile)(()=>!e.isValid(),!0),(0,r.last)()).toPromise();if(null==s?void 0:s.length){const t=`{options.prefix}: validators failed to accept input in ${o}ms, inputs: ${s.join(",")}`,e=new Error(t);throw n.interactive&&i.shell.error(String(e)),e}}}))(),console.log(`running ${e.func.nqName}`),yield e.run(),!n.updateMode){console.log(`checking ${e.func.nqName} results`);try{(0,s.SJ)(e.funcCall.outputs,t.outputs,n),!n.parent&&n.interactive&&i.shell.info(`${e.name} test passed`)}catch(t){throw n.interactive&&i.shell.error(String(t)),t}console.log(`${e.func.nqName} ok`)}})}function h(t,e){return u(this,void 0,void 0,function*(){if(!(yield t.isReady.pipe((0,r.takeUntil)((0,a.of)(null).pipe((0,r.delay)(e))),(0,r.takeWhile)(t=>!t,!0),(0,r.last)()).toPromise()))throw new Error(`Waiting for view ${t.name} timeout`)})}},7375(t,e,n){"use strict";function i(t){return t&&t.root&&t.onInput}function o(t){return(null==t?void 0:t.setValidation)&&i(t)}function s(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)&&i(t)}n.d(e,{LB:()=>o,gD:()=>s})},4795(t,e,n){"use strict";n.d(e,{$X:()=>k,Fd:()=>R,Gb:()=>g,Hs:()=>A,JU:()=>I,KL:()=>m,LL:()=>b,O0:()=>x,QL:()=>T,_t:()=>F,aB:()=>C,hg:()=>E,r6:()=>w,sy:()=>y,tf:()=>S,wB:()=>P});var i=n(4328),o=n(7389),s=n(6082),r=n(1757),a=n.n(r),l=n(4260),u=n(7375),c=n(1927),d=n(6910),p=n(1858),h=n(1599),f=n(8920),v=function(t,e,n,i){return new(n||(n=Promise))(function(o,s){function r(t){try{l(i.next(t))}catch(t){s(t)}}function a(t){try{l(i.throw(t))}catch(t){s(t)}}function l(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(r,a)}l((i=i.apply(t,e||[])).next())})};function m(t){const e=t;return e.dart&&s.toJs(e.dart)instanceof s.InputBase}function g(t){return new p.Observable(e=>{const n=t(t=>{e.next(t)});return()=>n.unsubscribe()})}const y=(t,e,n,i,o,r)=>{var a;r&&t.setOptions({showCurrentRowIndicator:!0,showCurrentCellOutline:!1,allowEdit:!1,allowBlockSelection:!1,showRowHeader:!1,showColumnLabels:!e,extendLastColumn:e}),t.sort([l.bV],[!1]);for(let e=0;e<t.columns.length;e++){const n=t.columns.byIndex(e);n&&(null===(a=n.column)||void 0===a?void 0:a.type)===s.TYPE.DATE_TIME&&(n.format="MMM d, h:mm tt")}if((0,d.eF)(t),e)t.columns.setVisible([l.vw]),t.props.rowHeight=70,t.invalidate();else{t.props.rowHeight=28;const e=t.dataFrame.getCol(l.lv);t.columns.setVisible([l.d1,l.iL,l.zY,...i?[l.bV]:[],...i?[l.l8]:[],...i&&e.stats.missingValueCount<e.length?[l.lv]:[],...i?[l.qh]:[],...i?[l.Ts]:[],...n&&o?(0,d.rs)(o).map(t=>{var e,n;const i=null!==(e=o.inputs.find(e=>e.name===t))&&void 0!==e?e:o.outputs.find(e=>e.name===t);return i?null!==(n=i.caption)&&void 0!==n?n:(0,d.Uo)(i.name):(0,d.Uo)(t)}):[]])}},b=(t,e,n,i,s)=>{var r,a;const u=t.dataFrame,c=u.getCol(l.lv),p=[...e&&u.getCol(l.d1).categories.length>1?[l.d1]:[],...e&&(null!==(a=null===(r=u.col(l.iL))||void 0===r?void 0:r.categories.length)&&void 0!==a?a:0)>1?[l.iL]:[],...e?[l.bV,l.pC]:[],...e&&u.getCol(l.l8).categories.length>1?[l.l8]:[],...e&&c.stats.missingValueCount<c.length?[l.lv]:[],...e&&u.getCol(l.qh).categories.length>1?[l.qh]:[],...e&&u.getCol(l.Ts).categories.length>1?[l.Ts]:[],...s&&n?(0,d.rs)(s).map(t=>{var e,n;const i=null!==(e=s.inputs.find(e=>e.name===t))&&void 0!==e?e:s.outputs.find(e=>e.name===t);return i?null!==(n=i.caption)&&void 0!==n?n:(0,d.Uo)(i.name):(0,d.Uo)(t)}).filter(t=>!i||u.getCol(t).categories.length>1).map(t=>t):[]];return p.length>0?(o.setDisplay(t.root,!0),t.setOptions({columnNames:p,showHeader:!1,showBoolCombinedFilter:!0})):o.setDisplay(t.root,!1),p.length>0},C=t=>v(void 0,void 0,void 0,function*(){i.shell.windows.help.visible=!0,yield new Promise(t=>setTimeout(t,100)),i.shell.windows.help.showHelp(o.markdown(t))}),w=t=>{const e={inputs:{},outputs:{}};return t.inputs.filter(t=>t.propertyType===s.TYPE.DATA_FRAME&&0!==(0,h.jJ)(t).config.length).forEach(t=>{const n="Misc"===t.category?"Input":t.category;e.inputs[n]?e.inputs[n].push(t):e.inputs[n]=[t]}),t.outputs.forEach(t=>{const n="Misc"===t.category?"Output":t.category;t.propertyType===s.TYPE.DATA_FRAME&&0===(0,h.jJ)(t).config.length||(e.outputs[n]?e.outputs[n].push(t):e.outputs[n]=[t])}),e},A=t=>v(void 0,void 0,void 0,function*(){const e=t.id,n=s.Func.byName(t.func.nqName).prepare([...t.inputs].reduce((t,[e,n])=>(t[e]=n,t),{}));return t.options.forEach(e=>n.options[e]=t.options[e]),e||(n.id=null),n}),x=t=>t.options.runLabel,I=t=>{if((0,u.gD)(t))return;const e=t;e.setDisabled=function(){t.enabled=!1,a()(t.root).removeClass("rfv-restricted-unlocked-input"),a()(t.root).removeClass("rfv-inconsistent-input"),a()(t.root).removeClass("rfv-restricted-input")},e.setRestricted=function(){t.enabled=!1,a()(t.root).addClass("rfv-restricted-input"),a()(t.root).removeClass("rfv-restricted-unlocked-input"),a()(t.root).removeClass("rfv-inconsistent-input")},e.setRestrictedUnlocked=function(){t.enabled=!0,a()(t.root).addClass("rfv-restricted-unlocked-input"),a()(t.root).removeClass("rfv-restricted-input"),a()(t.root).removeClass("rfv-inconsistent-input")},e.setInconsistent=function(){t.enabled=!0,a()(t.root).addClass("rfv-inconsistent-input"),a()(t.root).removeClass("rfv-restricted-input"),a()(t.root).removeClass("rfv-restricted-unlocked-input")},e.setUserInput=function(){t.enabled=!0,a()(t.root).removeClass("rfv-inconsistent-input"),a()(t.root).removeClass("rfv-restricted-input"),a()(t.root).removeClass("rfv-restricted-unlocked-input")}},E=(t,e)=>{var n;const i=t.property;a()(e.root).css({width:`calc(${null!==(n=i.options.block)&&void 0!==n?n:"100"}% - ${i.options.block?"2":"0"}px)`,"box-sizing":"border-box"})},T=(t,...e)=>v(void 0,[t,...e],void 0,function*(t,e=f.bZ.INPUTS){const n=[...t[f.wl[e]].values()];return(yield Promise.all(n.filter(t=>!!t.property.options.validatorFunc).map(t=>v(void 0,void 0,void 0,function*(){const e=s.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,n])=>(t[e]=n,t),{})}),R=(t,e)=>{const n=(0,c.JC)(e);return t[0].replaceWith(n[0]),t[1].replaceWith(n[1]),n},S=(t,e,n,i,o,s)=>v(void 0,void 0,void 0,function*(){const{view:r,funcCall:a,lastCall:l}=o,u=yield Promise.all(e.map(e=>v(void 0,void 0,void 0,function*(){const o=i===f.bZ.INPUTS?a.inputs[e]:a.outputs[e],u=yield(0,c.Td)(o,{param:e,funcCall:a,lastCall:l,signal:n,isNewOutput:!!t.isNewOutput,isRevalidation:t.isRevalidation,view:r});let d;const p=s[e];p&&(d=yield p(o,{param:e,funcCall:a,lastCall:l,signal:n,isNewOutput:!!t.isNewOutput,isRevalidation:t.isRevalidation,context:t.context,view:r}));const h=i===f.bZ.INPUTS&&a.inputParams[e].property.options.nullable;return[e,(0,c.uD)(...h?[]:[u],d)]})));return Object.fromEntries(u)}),F=t=>{const e=o.element("i");t.addOptions(e),t.setValidation=function(n){for(;e.firstChild&&e.removeChild(e.firstChild););const[i,o]=(0,c.JC)(n);i&&o&&(e.appendChild(i),e.appendChild(o)),t.input.classList.remove("d4-invalid"),t.input.classList.remove("d4-partially-invalid"),(null==n?void 0:n.errors)&&n.errors.length||(null==n?void 0:n.warnings)&&n.warnings.length||(null==n?void 0:n.notifications)&&n.notifications.length||(null==n?void 0:n.pending)?a()(e).css("display","flex"):a()(e).hide(),(null==n?void 0:n.errors)&&n.errors.length?t.input.classList.add("d4-invalid"):(null==n?void 0:n.warnings)&&n.warnings.length&&t.input.classList.add("d4-partially-invalid")}};function P(t,e){return v(this,void 0,void 0,function*(){const n={};for(const[i,o]of Object.entries(t.inputs)){const{property:t}=e.funcCall.inputParams[i];n[i]=yield O(t,o,e)}return{inputs:n,outputs:t.outputs}})}function O(t,e,n){return v(this,void 0,void 0,function*(){if("file"===t.propertyType&&n.getInput){const e=n.getInput(t.name).value;return e instanceof s.FileInfo?(yield e.readAsBytes()).buffer:yield e.arrayBuffer()}return e})}function k(t,e){return v(this,void 0,void 0,function*(){return"file"===t?new File([e],""):e})}},1927(t,e,n){"use strict";n.d(e,{Aw:()=>o,B5:()=>s,JC:()=>p,Td:()=>d,Ur:()=>u,ZS:()=>a,dQ:()=>c,u1:()=>r,uD:()=>l});var i=n(7389);function o(t){var e;return!(null===(e=null==t?void 0:t.errors)||void 0===e?void 0:e.length)&&!(null==t?void 0:t.pending)}function s(t,e){return{description:t,actions:e}}function r(t){if(null==t?void 0:t.errors)return t.errors.map(t=>t.description).join("; ")}function a(t){var e,n,i;const o=t=>"string"==typeof t?s(t):t;return{errors:null===(e=null==t?void 0:t.errors)||void 0===e?void 0:e.map(t=>o(t)),warnings:null===(n=null==t?void 0:t.warnings)||void 0===n?void 0:n.map(t=>o(t)),notifications:null===(i=null==t?void 0:t.notifications)||void 0===i?void 0:i.map(t=>o(t))}}function l(...t){var e,n,i,o,s;const r=[],a=[],l=[],u=[];let c={};for(const d of t)d&&(r.push(...null!==(e=d.errors)&&void 0!==e?e:[]),a.push(...null!==(n=d.warnings)&&void 0!==n?n:[]),l.push(...null!==(i=d.notifications)&&void 0!==i?i:[]),u.push(...null!==(o=d.revalidate)&&void 0!==o?o:[]),c=Object.assign(Object.assign({},c),null!==(s=d.context)&&void 0!==s?s:{}));return{errors:r,warnings:a,notifications:l,revalidate:u,context:c}}function u(){return{pending:!0}}function c(t,e,n){return Object.assign({revalidate:t,context:e},n)}const d=t=>{return e=void 0,n=void 0,o=function*(){if(null==t)return a({errors:["Missing value"]})},new((i=void 0)||(i=Promise))(function(t,s){function r(t){try{l(o.next(t))}catch(t){s(t)}}function a(t){try{l(o.throw(t))}catch(t){s(t)}}function l(e){var n;e.done?t(e.value):(n=e.value,n instanceof i?n:new i(function(t){t(n)})).then(r,a)}l((o=o.apply(e,n||[])).next())});var e,n,i,o};function p(t){let e,n;return(null==t?void 0:t.pending)&&(n=i.iconFA("spinner",()=>{h(t,n,e)},"Validating"),n.classList.add("fa-spin")),(null==t?void 0:t.errors)&&t.errors.length?(n=i.iconFA("exclamation-circle",()=>{h(t,n,e)},"Validation"),n.style.color="var(--red-3)"):(null==t?void 0:t.warnings)&&t.warnings.length?(n=i.iconFA("exclamation-circle",()=>{h(t,n,e)},"Validation"),n.style.color="var(--orange-2)"):(null==t?void 0:t.notifications)&&t.notifications.length&&(n=i.iconFA("info-circle",()=>{h(t,n,e)},"Info"),n.style.color="var(--blue-1)"),n&&(n.classList.remove("fal"),n.classList.add("far"),e=function(t){const e=i.div([],"d4-tooltip");return function(t){t.popover="auto",t.style.fontStyle="normal",t.style.pointerEvents="all",t.style.maxWidth="300px",t.style.textWrap="pretty"}(e),t.appendChild(e),e}(n)),[null!=n?n:i.div(),null!=e?e:i.div()]}function h(t,e,n){if(n&&e){for(function(t,e){const n=t.getBoundingClientRect().toJSON();e.style.inset="unset",e.style.top=n.y+"px",e.style.left=n.x+20+"px"}(e,n);n.firstChild&&n.removeChild(n.firstChild););const o=function(t){var e;const n=i.divV([],{style:{gap:"10px"}});for(const o of["errors","warnings","notifications"]){const s=t[o];if(null==s?void 0:s.length)for(const t of s){const s=f(o);s.style.marginRight="4px",n.appendChild(i.divV([i.divH([s,i.span([t.description])]),...(null!==(e=t.actions)&&void 0!==e?e:[]).map(t=>i.link(t.actionName,t.action,void 0,{style:{paddingLeft:"20px"}}))]))}}return n}(t);n.appendChild(o),n.showPopover()}}function f(t){let e;return"errors"===t?(e=i.iconFA("exclamation-circle"),e.style.color="var(--red-3)"):"warnings"===t?(e=i.iconFA("exclamation-circle"),e.style.color="var(--orange-2)"):"notifications"===t&&(e=i.iconFA("info-circle"),e.style.color="var(--blue-1)"),e&&(e.classList.remove("fal"),e.classList.add("far")),e}},4778(t,e,n){"use strict";n.d(e,{fj:()=>i}),n(4328),n(6082),n(5520),n(3508);const i="OUTPUT_OUTDATED"},8804(t,e,n){"use strict";n.d(e,{C:()=>u,V:()=>l});var i=n(4328),o=n(7389),s=n(6082),r=n(1858),a=function(t,e,n,i){return new(n||(n=Promise))(function(o,s){function r(t){try{l(i.next(t))}catch(t){s(t)}}function a(t){try{l(i.throw(t))}catch(t){s(t)}}function l(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(r,a)}l((i=i.apply(t,e||[])).next())})};class l extends s.Dialog{static forFuncCall(t,e=!1){var n,i,o;const s=null!==(n=t.options.title)&&void 0!==n?n:"",r=null!==(i=t.options.description)&&void 0!==i?i:"",a=null!==(o=t.options.tags)&&void 0!==o?o:[];return new l({title:s,description:r,tags:a,isFavorite:e})}constructor(t){var e,n,l,u;super(o.dialog({title:"Save model state"}).dart),this._onMetadataEdit=new r.Subject,this.onMetadataEdit=this._onMetadataEdit.asObservable();let c=null!==(e=null==t?void 0:t.title)&&void 0!==e?e:"",d=null!==(n=null==t?void 0:t.description)&&void 0!==n?n:"",p=null!==(l=null==t?void 0:t.isFavorite)&&void 0!==l&&l;const h=o.input.string("Title",{value:c,onValueChanged:t=>c=t}),f=o.input.string(" ",{value:""}),v=s.TagEditor.create();(null!==(u=null==t?void 0:t.tags)&&void 0!==u?u:[]).forEach(t=>{v.addTag(t)}),f.input.replaceWith(v.root);const m=()=>{""===g.value||v.tags.includes(g.value)||(v.addTag(g.value),g.value="")},g=o.input.string("Tag",{value:""}).addOptions(o.iconFA("plus",m,"Add this tag")),y=(0,r.fromEvent)(g.input,"onkeydown").subscribe(t=>{"Enter"==t.key&&(t.stopPropagation(),m())});this.sub(y);const b=o.input.string("Description",{value:d,onValueChanged:t=>d=t}),C=o.input.bool("Is favorite",{value:p,onValueChanged:t=>p=t});this.add(o.form([h,b,C,g,f])),this.addButton("Save",()=>a(this,void 0,void 0,function*(){if(""!==g.value)return void i.shell.info(`Dialog has unsaved tags: ${g.value}`);const t={title:""!==c?c:null,description:""!==d?d:null,isFavorite:p,tags:v.tags.map(t=>t)};this._onMetadataEdit.next(t),this.close()}))}}class u extends s.Dialog{constructor(t){super(o.dialog({title:`Delete ${t.size>1?t.size:""} ${t.size>1?"runs":"run"}`}).dart),this._onFuncCallDelete=new r.Subject,this.onFuncCallDelete=this._onFuncCallDelete.asObservable(),this.add(o.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(()=>a(this,void 0,void 0,function*(){return this._onFuncCallDelete.next(t)}))}}},4260(t,e,n){"use strict";n.d(e,{CB:()=>s,Jc:()=>h,NT:()=>u,Ts:()=>A,_W:()=>d,aQ:()=>I,bV:()=>C,d1:()=>v,eP:()=>a,eX:()=>p,ec:()=>c,iL:()=>m,l8:()=>b,lv:()=>x,nw:()=>o,pC:()=>g,qh:()=>w,r0:()=>l,sk:()=>r,t6:()=>E,vw:()=>f,zY:()=>y});var i=n(6082);const o="#0.###",s={barchart:i.VIEWER.BAR_CHART,boxplot:i.VIEWER.BOX_PLOT,calendar:i.VIEWER.CALENDAR,corrplot:i.VIEWER.CORR_PLOT,densityplot:i.VIEWER.DENSITY_PLOT,filters:i.VIEWER.FILTERS,form:i.VIEWER.FORM,globe:i.VIEWER.GLOBE,googlemap:i.VIEWER.GOOGLE_MAP,grid:i.VIEWER.GRID,heatmap:i.VIEWER.HEAT_MAP,histogram:i.VIEWER.HISTOGRAM,linechart:i.VIEWER.LINE_CHART,markup:i.VIEWER.MARKUP,matrixplot:i.VIEWER.MATRIX_PLOT,networkdiagram:i.VIEWER.NETWORK_DIAGRAM,pcplot:i.VIEWER.PC_PLOT,piechart:i.VIEWER.PIE_CHART,scatterplot:i.VIEWER.SCATTER_PLOT,"3dscatterplot":i.VIEWER.SCATTER_PLOT_3D,shapemap:i.VIEWER.SHAPE_MAP,statistics:i.VIEWER.STATISTICS,tileviewer:i.VIEWER.TILE_VIEWER,timelines:i.VIEWER.TIMELINES,treemap:i.VIEWER.TREE_MAP,trellisplot:i.VIEWER.TRELLIS_PLOT,wordcloud:i.VIEWER.WORD_CLOUD,diffstudiofacet:"DiffStudio Facet"},r="JsCardView",a="scripts",l="functions",u="viewer",c="experimental",d="Run name",p="RunId",h="ModelStorage",f="ID",v="Source",m="Is favorite",g="Is complete",y="Delete",b="Author",C="Date",w="Title",A="Desc.",x="Tags",I="Version",E=Object.values(i.COLUMN_TYPE).filter(t=>t!==i.TYPE.DATA_FRAME)},4386(t,e,n){"use strict";n.d(e,{aK:()=>d});var i=n(4328),o=n(7389),s=n(6082),r=n(4260),a=n(1599),l=function(t,e,n,i){return new(n||(n=Promise))(function(o,s){function r(t){try{l(i.next(t))}catch(t){s(t)}}function a(t){try{l(i.throw(t))}catch(t){s(t)}}function l(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(r,a)}l((i=i.apply(t,e||[])).next())})};const u=Math.ceil(36)+1,c=(t,e,n)=>{o.setUpdateIndicator(t,e);const i=t.querySelector(".d4-update-shadow .ui-label");e&&n&&i&&(i.textContent=n)},d=(t,e,n,d,p,f)=>l(void 0,void 0,void 0,function*(){var v,y;const b={},C=(t,e)=>{if(b[t])return b[t];let n=`${t}`;n.length>31&&(n=`${n.slice(0,31)}`);let i=1;for(;e.worksheets.some(t=>t.name.toLowerCase()===n.toLowerCase());){let e=`${t}`;e.length>31-`-${i}`.length&&(e=`${t.slice(0,31-`-${i}`.length)}`),n=`${e}-${i}`,i++}return b[t]=n,n};if("Excel"===t)try{yield s.Utils.loadJsCss(["/js/common/exceljs.min.js","/js/common/html2canvas.min.js"]);const t=window.ExcelJS,b=window.html2canvas,w="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=UTF-8",A=new t.Workbook;o.setDisplay(i.shell.v.root,!1),c(i.shell.v.root.parentElement,!0,"Generating report. Please do not switch the browser tab...");let x=0;const I=(t,e,n,...r)=>l(void 0,[t,e,n,...r],void 0,function*(t,e,n,r=0){if(!e||!e.dataFrame)return;const l=s.Viewer.fromType(e.type,e.dataFrame.clone());l.copyViewersLook(e);const u=o.div(l.root,{style:{width:"1280px",height:"720px"}});u.classList.add("ui-box"),u.classList.remove("ui-div"),i.shell.v.root.insertAdjacentElement("afterend",u),yield(0,a.cb)(1e3);const c=(yield b(u)).toDataURL();u.remove();const d=A.addImage({base64:c,extension:"png"});t.addImage(d,{tl:{col:n,row:r},ext:{width:1280,height:720}})}),E=t=>s.TYPES_SCALAR.has(t),T=t=>t.propertyType===s.TYPE.DATA_FRAME,R=e.inputs.filter(t=>T(t)),S=e.inputs.filter(t=>E(t.propertyType)),F=e.outputs.filter(t=>T(t)),P=e.outputs.filter(t=>E(t.propertyType));if(R.forEach(t=>{var e;const i=n.inputs[t.name];if(g(i))return;const o=t.options.caption||t.name,s=null!==(e=A.worksheets.find(t=>t.name===C(o,A)))&&void 0!==e?e:A.addWorksheet(C(o,A)),r=null==p?void 0:p[t.name],a=null==f?void 0:f[t.name];m({sheet:s,dfCounter:x,df:i,validation:r,consistency:a}),x++}),S.length){const t=A.addWorksheet("Input scalars");h(t,S.map(t=>{var e,i,o;return{name:t.name,caption:null!==(e=t.options.caption)&&void 0!==e?e:t.name,value:null!==(i=n.inputs[t.name])&&void 0!==i?i:"",units:null!==(o=t.options.units)&&void 0!==o?o:"",format:t.format||r.nw}}),p,f)}if(F.forEach(t=>{var e;const i=n.outputs[t.name];if(g(i))return;const o=t.options.caption||t.name,s=null!==(e=A.worksheets.find(t=>t.name===C(o,A)))&&void 0!==e?e:A.addWorksheet(C(o,A)),r=null==p?void 0:p[t.name],a=null==f?void 0:f[t.name];m({sheet:s,dfCounter:x,df:i,validation:r,consistency:a}),x++}),P.length){const t=A.addWorksheet("Output scalars");h(t,P.map(t=>{var e,i,o;return{name:t.name,caption:null!==(e=t.options.caption)&&void 0!==e?e:t.name,value:null!==(i=n.outputs[t.name])&&void 0!==i?i:"",units:null!==(o=t.options.units)&&void 0!==o?o:"",format:t.format||r.nw}}),p,f)}for(const t of e.inputs.filter(t=>T(t))){const e=n.inputs[t.name];if(g(e))continue;const i=(null!==(v=d[t.name])&&void 0!==v?v:[]).filter(t=>t&&t.type!==s.VIEWER.GRID).filter(t=>Object.values(r.CB).includes(t.type));if(0===i.length)continue;const o=t.options.caption||t.name;for(const[t,n]of i.entries())yield I(A.getWorksheet(C(o,A)),n,e.columns.length+2,t*u)}for(const t of e.outputs.filter(t=>T(t))){const e=n.outputs[t.name];if(g(e))continue;const i=(null!==(y=d[t.name])&&void 0!==y?y:[]).filter(t=>t&&t.type!==s.VIEWER.GRID).filter(t=>Object.values(r.CB).includes(t.type));if(0===i.length)continue;const o=t.options.caption||t.name;for(const[t,n]of i.entries())if(n)if(n.type===s.VIEWER.STATISTICS){const n=e.columns.length,i=s.DataFrame.fromColumns([s.Column.string("Name",n).init(t=>e.columns.byIndex(t).name),s.Column.int("Values",n).init(t=>e.columns.byIndex(t).stats.valueCount),s.Column.int("Nulls",n).init(t=>e.columns.byIndex(t).stats.missingValueCount),s.Column.float("Min",n).init(t=>e.columns.byIndex(t).stats.min),s.Column.float("Max",n).init(t=>e.columns.byIndex(t).stats.max),s.Column.float("Avg",n).init(t=>e.columns.byIndex(t).stats.avg),s.Column.float("Stdev",n).init(t=>e.columns.byIndex(t).stats.stdev)]);m({sheet:A.getWorksheet(C(o,A)),dfCounter:x,df:i,column:e.columns.length+2,row:t*u}),x++}else yield I(A.getWorksheet(C(o,A)),n,e.columns.length+2,t*u)}const O=yield A.xlsx.writeBuffer();return[new Blob([O],{type:w}),A]}catch(t){console.log(t)}finally{o.setDisplay(i.shell.v.root,!0),c(i.shell.v.root.parentElement,!1)}throw new Error("Format is not supported")}),p=(t,e)=>{try{return Number.isFinite(t)&&e?s.format(t,e):t}catch(e){return t}},h=(t,e,n,i)=>{const o=["Parameter","Value","Units"];n&&o.push("Validation"),i&&o.push("Consistency"),t.addRow(o).font={bold:!0},e.forEach(e=>{const o=[e.caption,p(e.value,e.format),e.units];o.push(f(null==n?void 0:n[e.name])),o.push(v(null==i?void 0:i[e.name])),t.addRow(o)}),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},f=t=>null==t?"":["errors","warnings"].filter(e=>{var n;return!!(null===(n=null==t?void 0:t[e])||void 0===n?void 0:n.length)}).flatMap(e=>t[e].map(t=>({category:e,advice:t}))).map(({category:t,advice:e})=>`${t}: ${"string"==typeof e?e:e.description}`).join("\n"),v=t=>{if(null==t)return"";if(t.inconsistent&&("disabled"===t.restriction||"restricted"===t.restriction)){const e=t.assignedValue;return`Inconsistent: value should be ${"number"==typeof e&&Number.isFinite(e)?s.format(e,r.nw):String(e)}`}},m=({sheet:t,dfCounter:e,df:n,column:i,row:o,validation:s,consistency:a})=>{var l,u;if(!n)return;const c=t.getColumn(null!=i?i:1).letter,d=n.columns.length,h=[];for(let t=0;t<n.rowCount;t++){const e=[];for(let i=0;i<n.columns.length;i++){const o=n.col(i),s=n.get(o.name,t);if("double"===(null==o?void 0:o.type)){const t=null!==(u=null===(l=null==o?void 0:o.tags)||void 0===l?void 0:l.format)&&void 0!==u?u:r.nw,n=p(s,t);e.push(n)}else e.push(s)}h.push(e)}const m={name:`ID_${e.toString()}`,ref:`${c}${null!=o?o:1}`,columns:n.columns.toList().map(t=>({name:t.name,filterButton:!1})),rows:h};t.addTable(m),t.columns.forEach(t=>{t.width=25,t.alignment={wrapText:!0}});const g=d+1;t.getColumn(g).width=100,t.getCell(1,g).value="Validation and Consistency",s&&(t.getCell(2,g).value=f(s)),a&&(t.getCell(3,g).value=v(a))},g=t=>!t||0===t.rowCount},6910(t,e,n){"use strict";n.d(e,{BV:()=>C,Uo:()=>y,VI:()=>m,WM:()=>h,eF:()=>g,qg:()=>f,rs:()=>v,u8:()=>b});var i=n(4328),o=n(7389),s=n(6082),r=n(1757),a=n.n(r),l=n(4260),u=n(3508),c=n.n(u),d=n(1599),p=function(t,e,n,i){return new(n||(n=Promise))(function(o,s){function r(t){try{l(i.next(t))}catch(t){s(t)}}function a(t){try{l(i.throw(t))}catch(t){s(t)}}function l(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(r,a)}l((i=i.apply(t,e||[])).next())})};const h=(t,e)=>p(void 0,void 0,void 0,function*(){const n=`${l.Jc}_${t.func.name}_Fav`;return e?i.dapi.userDataStorage.postValue(n,t.id,""):i.dapi.userDataStorage.remove(n,t.id)}),f=t=>t.options.mainParams?JSON.parse(t.options.mainParams):null,v=(t,e)=>{var n,i;return null!==(i=null!==(n=null==e?void 0:e.visibleProps)&&void 0!==n?n:f(t))&&void 0!==i?i:t.inputs.filter(t=>l.t6.includes(t.propertyType)).map(t=>t.name)},m=(t,e,n,s,r,u,c)=>{t.onCellPrepare(h=>{var f,v,m,g,y,b,C,w,A,x;if(h.isColHeader&&(null===(f=h.tableColumn)||void 0===f?void 0:f.name)&&[l.zY,l.d1,l.iL].includes(h.tableColumn.name)&&(h.customText=""),!h.isColHeader){if((null===(v=h.tableColumn)||void 0===v?void 0:v.name)===l.zY&&(h.customText="",h.element=o.divH([o.iconFA("trash",()=>s(h),"Remove run from history"),o.iconFA("edit",()=>n(h),"Edit run metadata")],{style:{padding:"6px",gap:"6px",justifyContent:"space-between"}})),(null===(m=h.tableColumn)||void 0===m?void 0:m.name)===l.iL){h.customText="";const t=o.iconFA("star",()=>u(h),"Unfavorite");a()(t).addClass("fas"),h.element=o.div(h.cell.value?t:o.iconFA("star",()=>r(h),"Favorite"),{style:{padding:"6px"}})}if((null===(g=h.tableColumn)||void 0===g?void 0:g.name)===l.d1){h.customText="";const t=o.iconFA("flask",null,"Experimental run");a()(t).addClass("fad fa-sm"),a()(t).removeClass("fal"),h.element=h.cell.value&&"Experimental"===h.cell.value?o.div(t,{style:{padding:"6px"}}):o.div()}if((null===(y=h.tableColumn)||void 0===y?void 0:y.name)===l.lv){h.customText="";const t=h.cell.value.length>0?o.div(null===(b=h.cell.value)||void 0===b?void 0:b.split(",").map(t=>o.span([t],"d4-tag")),"d4-tag-editor"):o.div();a()(t).css({padding:"3px","background-color":"transparent"}),h.element=t}if((null===(C=h.tableColumn)||void 0===C?void 0:C.name)===l.vw){h.customText="";const f=(I=h.tableRowIndex,e.get(t.dataFrame.get(l.vw,I)));if(!f)return;const v=f.author.picture;a()(v).css({width:"25px",height:"25px",fontSize:"20px"}),o.bind(f.author,v);const m=o.iconFA("flask",null,"Experimental run");m.classList.add("fad","fa-sm"),m.classList.remove("fal"),m.style.marginLeft="3px";const g=f.options.immutable_tags,y=o.span([o.label(null!==(x=null!==(w=f.options.title)&&void 0!==w?w:null===(A=f.author)||void 0===A?void 0:A.friendlyName)&&void 0!==x?x:i.shell.user.friendlyName,{style:{color:"var(--blue-1)"}}),...g&&g.includes(l.ec)?[m]:[]]),b=o.iconFA("edit",t=>{t.stopPropagation(),n(h)},"Edit run metadata");b.classList.add("hp-funccall-card-icon","hp-funccall-card-hover-icon");const C=o.iconFA("trash-alt",t=>p(void 0,void 0,void 0,function*(){t.stopPropagation(),s(h)}),"Delete run");C.classList.add("hp-funccall-card-icon","hp-funccall-card-hover-icon");const E=o.iconFA("star",t=>{t.stopPropagation(),u(h)},"Unfavorite");E.classList.add("fas","hp-funccall-card-icon");const T=o.iconFA("star",t=>{t.stopPropagation(),r(h)},"Favorite");T.classList.add("hp-funccall-card-icon","hp-funccall-card-hover-icon"),(e=>t.dataFrame.get(l.iL,e))(h.tableRowIndex)?(o.setDisplay(T,!1),o.setDisplay(E,!0)):(o.setDisplay(E,!1),o.setDisplay(T,!0));const R=(0,d.eK)(f),S=o.divH([o.divH([v,o.divV([y,o.span([R]),...f.options.tags&&f.options.tags.length>0?[o.div(f.options.tags.map(t=>o.span([t],"d4-tag")))]:[]],"hp-card-content")]),o.divH([...c?[E,T,b,C]:[]])],"hp-funccall-card"),F=h.tableRowIndex;S.addEventListener("mouseover",()=>{h.grid.dataFrame.mouseOverRowIdx=F}),S.addEventListener("click",t=>{t.shiftKey?h.grid.dataFrame.selection.set(F,!0):t.ctrlKey?h.grid.dataFrame.selection.set(F,!1):h.grid.dataFrame.currentRowIdx=F}),h.element=S}var I}})},g=t=>{const e=t.columns.byName(l.zY);e&&(e.cellType="html",e.width=45);const n=t.columns.byName(l.iL);n&&(n.cellType="html",n.width=30);const i=t.columns.byName(l.d1);i&&(i.cellType="html",i.width=30);const o=t.columns.byName(l.lv);o&&(o.cellType="html",o.width=90);const s=t.columns.byName(l.bV);s&&(s.width=110);const r=t.columns.byName(l.vw);r&&(r.cellType="html")},y=t=>t.replace(/([A-Z])/g,t=>` ${t.toLowerCase()}`).trim().replace(/^./,t=>t.toUpperCase()),b=(t,e)=>{var n,i,o,s,r,a,u;if(e===l.l8)return null!==(i=null===(n=t.author)||void 0===n?void 0:n.friendlyName)&&void 0!==i?i:" ";const c=null!==(a=null!==(r=null!==(s=null!==(o=t[e])&&void 0!==o?o:t.inputs[e])&&void 0!==s?s:t.outputs[e])&&void 0!==r?r:t.options[e])&&void 0!==a?a:null;return null!==(u=null==c?void 0:c.toString())&&void 0!==u?u:""},C=(t,e,n)=>p(void 0,void 0,void 0,function*(){var o;const r=[...t.values()],a=t=>t===l.bV?s.Column.dateTime(y(t),r.length).init(t=>window.grok_DayJs_To_DateTime((0,d.Yj)(r[t])?r[t].started.utc(!0):c().unix(r[t].options.createdOn))):t===l.pC?s.Column.bool(y(t),r.length).init(t=>!(0,d.Ne)(r[t])):s.Column.fromStrings(y(t),r.map(e=>{var i,o,s;return null!==(s=null===(o=null===(i=null==n?void 0:n.propFuncs)||void 0===i?void 0:i[t])||void 0===o?void 0:o.call(i,e))&&void 0!==s?s:b(e,t)})),u=null!==(o=yield i.dapi.userDataStorage.get((t=>`${l.Jc}_${t.name}_Fav`)(e)))&&void 0!==o?o:{},p=Object.keys(u),h=s.DataFrame.fromColumns([s.Column.string(l.d1,r.length).init(t=>{const e=r[t].options.immutable_tags;return e&&e.includes(l.ec)?"Experimental":"Simulated"}),...(null==n?void 0:n.isHistory)?[s.Column.bool(l.iL,r.length).init(t=>p.includes(r[t].id))]:[],...(null==n?void 0:n.showActions)?[s.Column.string(l.zY,r.length).init("")]:[],a(l.bV),a(l.pC),a(l.l8),s.Column.string(l.lv,r.length).init(t=>r[t].options.tags?r[t].options.tags.join(","):""),s.Column.string(l.qh,r.length).init(t=>r[t].options.title),s.Column.string(l.Ts,r.length).init(t=>r[t].options.description),s.Column.string(l.aQ,r.length).init(t=>r[t].options.version)]);if(v(e).map(t=>(t=>{var i;const o=null!==(i=e.inputs.find(e=>e.name===t))&&void 0!==i?i:e.outputs.find(e=>e.name===t);return o?(t=>{var e,i;return t.propertyType===s.TYPE.DATE_TIME?s.Column.dateTime(null!==(e=t.caption)&&void 0!==e?e:y(t.name),r.length).init(e=>window.grok_DayJs_To_DateTime(r[e].inputs[t.name])):s.Column.fromType(t.propertyType,null!==(i=t.caption)&&void 0!==i?i:y(t.name),r.length).init(e=>{var i,o,s;return null!==(s=null===(o=null===(i=null==n?void 0:n.propFuncs)||void 0===i?void 0:i[t.name])||void 0===o?void 0:o.call(i,r[e]))&&void 0!==s?s:b(r[e],t.name)})})(o):a(t)})(t)).forEach(t=>{t.name=h.columns.getUnusedName(t.name),h.columns.add(t,!1)}),h.columns.add(s.Column.fromStrings(l.vw,r.map(t=>t.id))),!(null==n?void 0:n.allowOtherVersions)&&(null==n?void 0:n.version)){const t=s.BitSet.create(h.rowCount,()=>!1);for(let e=0;e<h.rowCount;e++)(null==n?void 0:n.version)==h.get(l.aQ,e)&&t.set(e,!0);return h.clone(t)}return h})},1599(t,e,n){"use strict";n.d(e,{A4:()=>C,HP:()=>f,N2:()=>E,Ne:()=>b,Yj:()=>y,bP:()=>h,cb:()=>x,eK:()=>A,i:()=>m,jJ:()=>w,lD:()=>I,vk:()=>v,x$:()=>g,zF:()=>p});var i=n(4328),o=n(6082),s=n(1991),r=n.n(s),a=n(4260),l=n(5520),u=n(4778),c=function(t,e,n,i){return new(n||(n=Promise))(function(o,s){function r(t){try{l(i.next(t))}catch(t){s(t)}}function a(t){try{l(i.throw(t))}catch(t){s(t)}}function l(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(r,a)}l((i=i.apply(t,e||[])).next())})};const d=new o.LruCache,p=t=>c(void 0,void 0,void 0,function*(){var e;const n=null!==(e=t.options.help)&&void 0!==e?e:t.options.readme;if(!n)return;if(d.get(t.id))return d.get(t.id);let o="";try{o=t.package.name}catch(t){}const s=`System:AppData/${o}/${n}`;if(o&&(yield i.dapi.files.exists(s))){const e=yield i.dapi.files.readAsText(s);return d.set(t.id,e),e}const r=`${i.shell.user.name}.home/${n}`;if(yield i.dapi.files.exists(r)){const e=yield i.dapi.files.readAsText(r);return d.set(t.id,e),e}}),h=t=>{let e;try{e=t.package}catch(t){}return e},f=t=>{var e;return!!(null===(e=null==t?void 0:t.options)||void 0===e?void 0:e.help)},v=t=>"true"===t.options.runOnInput,m=t=>{var e;return JSON.parse(null!==(e=t.options.features)&&void 0!==e?e:"{}")},g=(t,e,n)=>{var i;return t instanceof Array?t.includes(e):t instanceof Object&&null!==(i=t[e])&&void 0!==i?i:n},y=t=>{try{return null==t?void 0:t.started}catch(t){return}},b=t=>{var e;return(0,l.iu)(null!==(e=t.options[u.fj])&&void 0!==e?e:"false")||!y(t)||!t.id},C=t=>{var e,n;const i=(null===(n=null===(e=t.func)||void 0===e?void 0:e.nqName)||void 0===n?void 0:n.includes(":"))?o.Func.byName(t.func.nqName).prepare():t.func.prepare();i.id=t.id,t.options.forEach(e=>i.options[e]=t.options[e]);const s=r()(i.outputParams.values()).filter(e=>null!=t.outputs[e.name]);for(const e of s)e.property.propertyType===o.TYPE.DATA_FRAME?i.outputs[e.name]=t.outputs[e.name].clone():i.outputs[e.name]=t.outputs[e.name];const a=r()(i.inputParams.values()).filter(e=>null!=t.inputs[e.name]);for(const e of a)e.property.propertyType===o.TYPE.DATA_FRAME?i.inputs[e.name]=t.inputs[e.name].clone():i.inputs[e.name]=t.inputs[e.name];return y(t)&&(i.started=t.started),i},w=t=>{const e=t.options[a.NT];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 a.CB[e]||e;if(!t.toLowerCase().includes("color")){const t=Number.parseFloat(e);if(!Number.isNaN(t))return t}return e})}:{name:t.name,config:[]}},A=t=>{try{return t.started.toDate().toLocaleString("en-us",{month:"short",day:"numeric",hour:"numeric",minute:"numeric"})}catch(t){return"Not completed"}},x=t=>new Promise(e=>setTimeout(e,t));function I(){return c(this,void 0,void 0,function*(){const t=i.dapi.groups;return"function"==typeof t.currentUserGroups?yield t.currentUserGroups():yield(yield fetch(`${window.location.origin}/api/groups/all_parents`)).json()})}function E(t,e){return c(this,void 0,void 0,function*(){const n=i.dapi.groups;if("function"==typeof n.requestMembership)return yield n.requestMembership(t,e);yield fetch(`${window.location.origin}/api/groups/${t.id}/requests/${e.id}`,{method:"POST"})})}},6126(t,e,n){"use strict";n.d(e,{A:()=>u});var i=n(4328),o=n(7389),s=n(6082),r=n(1757),a=n.n(r);const l=()=>document.querySelector(".d4-balloon-container");class u extends s.JsViewer{constructor(){super()}onFrameAttached(t){this.render()}onTableAttached(){this.render()}render(){if(!this.dataFrame||this.dataFrame.rowCount<=0)return void(this.root.innerHTML="");const t=this.dataFrame,e="isOutlier",n="isOutlierSecondary",r="Rationale",u="Count",c="isConfirmed";t.columns.byName(e)||t.columns.add(s.Column.fromList(s.TYPE.STRING,e,new Array(t.rowCount).fill("Inlier"))),t.columns.byName(n)||t.columns.add(s.Column.fromList(s.TYPE.STRING,n,new Array(t.rowCount).fill("Inlier"))),t.columns.byName(r)||t.columns.add(s.Column.fromStrings(r,Array.from({length:t.rowCount},()=>"")));const d=()=>s.DataFrame.fromColumns([s.Column.fromStrings(r,[]),s.Column.fromInt32Array(u,new Int32Array([])),s.Column.fromStrings("Actions",[]),s.Column.fromBitSet(c,s.BitSet.create(0,()=>!1))]),p=s.Viewer.grid(d());p.root.style.width="100%",p.root.style.minWidth="230px",p.columns.setVisible([r,u,"Actions"]),this.root.append(o.divV([o.divV([p.root],{style:{height:"75%"}})],{style:{height:"100%"}}));const h=()=>{var i,o,u,c,d,h,f;if(!p.dataFrame)return;null===(i=t.col(e))||void 0===i||i.meta.markers.assign("Outlier",s.MARKER_TYPE.OUTLIER),null===(o=t.col(e))||void 0===o||o.meta.markers.assign("Last Inlier",s.MARKER_TYPE.STAR),null===(u=t.col(e))||void 0===u||u.meta.colors.setCategorical({Outlier:s.Color.scatterPlotMarker,Inlier:s.Color.scatterPlotMarker,"Last Inlier":s.Color.red}),null===(c=t.col(n))||void 0===c||c.meta.markers.assign("Outlier",s.MARKER_TYPE.OUTLIER),null===(d=t.col(n))||void 0===d||d.meta.markers.assign("Last Inlier",s.MARKER_TYPE.STAR),null===(h=t.col(n))||void 0===h||h.meta.colors.setCategorical({Outlier:s.Color.cyan,Inlier:s.Color.cyan,"Last Inlier":s.Color.red});const v=null===(f=p.dataFrame)||void 0===f?void 0:f.cell(p.dataFrame.rowCount-1,r).value;t.selection.getSelectedIndexes().forEach(i=>{t.col(e).set(i,"Outlier",!1),t.col(n).set(i,"Outlier",!1),t.col(r).set(i,v,!1)}),t.selection.setAll(!1),t.fireValuesChanged(),a()(l()).empty()},f=()=>{p.dataFrame&&(p.dataFrame.rows.removeAt(p.dataFrame.rowCount-1),t.selection.setAll(!1),a()(l()).empty())};p.onCellPrepare(i=>{var s,a,l;i.isTableCell&&("Actions"===i.gridColumn.name&&(i.gridColumn.cellType="html",i.style.element=o.divH([...(null===(s=i.grid.dataFrame)||void 0===s?void 0:s.get(c,i.gridRow))?[(l=null===(a=i.grid.dataFrame)||void 0===a?void 0:a.get(r,i.gridRow),o.div(o.icons.delete(()=>{for(let i=0;i<t.rowCount;i++)t.columns.byName(r).get(i)===l&&(t.columns.byName(r).set(i,"",!1),t.columns.byName(e).set(i,"Inlier",!1),t.columns.byName(n).set(i,"Inlier",!1));t.fireValuesChanged()},"Remove the outliers group"),{style:{textAlign:"center",margin:"6px"}}))]:[o.div(o.iconFA("check",h,"Confirm the outliers"),{style:{textAlign:"center",margin:"6px"}}),o.div(o.iconFA("times",f,"Cancel the outliers"),{style:{textAlign:"center",margin:"6px"}})]])))}),p.onCellValueEdited.subscribe(e=>{var n,i;if(!p.dataFrame||e.gridColumn.name!==r)return;if(!p.dataFrame.columns.byName(c).get(e.gridRow))return;const o=new Set;for(let t=0;t<(null===(n=p.dataFrame)||void 0===n?void 0:n.rowCount);t++){const e=null===(i=p.dataFrame)||void 0===i?void 0:i.columns.byName(r).get(t);o.add(e)}for(let n=0;n<t.rowCount;n++){const i=t.columns.byName(r).get(n);""==i||o.has(i)||t.columns.byName(r).set(n,e.cell.value)}});const v=()=>{if(t.columns.byName(r))for(let n=0;n<t.rowCount;n++)"Outlier"===t.columns.byName(e).get(n)?""===t.columns.byName(r).get(n)&&t.columns.byName(r).set(n,"Manual",!1):""!==t.columns.byName(r).get(n)&&t.columns.byName(r).set(n,"",!1);const n={};if(t.columns.byName(r))for(let e=0;e<t.rowCount;e++){const i=t.columns.byName(r).get(e),o=n[i];""!=i&&(o?n[i]++:n[i]=1)}p.dataFrame=d(),p.columns.setVisible([r,u,"Actions"]),Object.keys(n).map(t=>{var e;null===(e=p.dataFrame)||void 0===e||e.rows.addNew([t,n[t],"",!0])})};t.onDataChanged.subscribe(v),t.onSelectionChanged.subscribe(()=>{if(!p.dataFrame||!t.selection.trueCount)return;const e=l();if(e&&!a()(e).is(":empty")||i.shell.info(o.div([o.divText("Confirm selected points as outliers?"),o.divH([o.bigButton("Confirm",h),o.button("Cancel",f)])])),p.dataFrame.columns.byName(c).toList().some(t=>!1===t))p.dataFrame.set(u,p.dataFrame.rowCount-1,t.selection.trueCount);else{const e=p.dataFrame.rows.addNew(["Manual",t.selection.trueCount,"",!1]);p.dataFrame.currentCell=p.dataFrame.cell(e.idx,r)}}),t.selection.setAll(!1),v()}}},2961(t,e,n){"use strict";n.d(e,{CY:()=>b,Fz:()=>x,Ln:()=>h,OA:()=>C,Qc:()=>a,Ts:()=>s,Vb:()=>r,Vu:()=>p,ZO:()=>m,b9:()=>g,dg:()=>y,jO:()=>l,pE:()=>v,u0:()=>u,wN:()=>c,ws:()=>w,wx:()=>d,yN:()=>A,ze:()=>f});var i=n(2650),o=function(t,e,n,i){return new(n||(n=Promise))(function(o,s){function r(t){try{l(i.next(t))}catch(t){s(t)}}function a(t){try{l(i.throw(t))}catch(t){s(t)}}function l(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(r,a)}l((i=i.apply(t,e||[])).next())})};function s(){return o(this,void 0,void 0,function*(){yield i.PackageFunctions.init()})}function r(t){i.PackageFunctions.openModelFromFuncall(t)}function a(){return i.PackageFunctions.OutliersSelection()}function l(t){return i.PackageFunctions.RichFunctionViewEditor(t)}function u(t){return i.PackageFunctions.PipelineStepEditor(t)}function c(t){return o(this,void 0,void 0,function*(){return yield i.PackageFunctions.CustomDataUploader(t)})}function d(t){return o(this,void 0,void 0,function*(){return yield i.PackageFunctions.CustomUploader(t)})}function p(t){i.PackageFunctions.CustomCustomizer(t)}function h(t){return i.PackageFunctions.SimTimeValidator(t)}function f(t){return i.PackageFunctions.DesiredTempValidator(t)}function v(t){return i.PackageFunctions.InitialTempValidator(t)}function m(t){return i.PackageFunctions.AmbTempValidator(t)}function g(t){return i.PackageFunctions.HeatCapValidator(t)}function y(t){return i.PackageFunctions.CustomStringInput(t)}function b(t){return i.PackageFunctions.ObjectCoolingSelector(t)}function C(t){return o(this,void 0,void 0,function*(){return yield i.PackageFunctions.CustomInputMock(t)})}function w(t){return i.PackageFunctions.RangeValidatorFactory(t)}function A(t){return i.PackageFunctions.AsyncValidatorDemoFactory(t)}function x(t){return i.PackageFunctions.GlobalValidatorDemoFactory(t)}},2650(t,e,n){"use strict";n.r(e),n.d(e,{AmbTempValidator:()=>f.ZO,AsyncValidatorDemoFactory:()=>f.yN,CompView:()=>x,CustomCustomizer:()=>f.Vu,CustomDataUploader:()=>f.wN,CustomInputMock:()=>f.OA,CustomStringInput:()=>f.dg,CustomUploader:()=>f.wx,DesiredTempValidator:()=>f.ze,GlobalValidatorDemoFactory:()=>f.Fz,HeatCapValidator:()=>f.b9,InitialTempValidator:()=>f.pE,ObjectCoolingSelector:()=>f.CY,OutliersSelection:()=>f.Qc,PackageFunctions:()=>V,Pipeline:()=>E,PipelineStepEditor:()=>f.u0,RFV:()=>I,RangeValidatorFactory:()=>f.ws,RichFunctionViewEditor:()=>f.jO,SimTimeValidator:()=>f.Ln,_package:()=>b,deepCopy:()=>A,fileInput:()=>P,historyInput:()=>O,historyInputJSON:()=>k,historyPanel:()=>B,init:()=>f.Ts,makeAdvice:()=>R,makeRevalidation:()=>S,makeValidationResult:()=>T,mergeValidationResults:()=>F,openModelFromFuncall:()=>f.Vb,testPipeline:()=>w});var i=n(4328),o=n(7389),s=n(6082),r=n(1858),a=n(9713),l=n(6126),u=n(5727),c=n(3143),d=n(1927),p=n(9939),h=n(1599),f=n(2961),v=function(t,e,n,i){var o,s=arguments.length,r=s<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(r=(s<3?o(r):s>3?o(e,n,r):o(e,n))||r);return s>3&&r&&Object.defineProperty(e,n,r),r},m=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},g=function(t,e){return function(n,i){e(n,i,t)}},y=function(t,e,n,i){return new(n||(n=Promise))(function(o,s){function r(t){try{l(i.next(t))}catch(t){s(t)}}function a(t){try{l(i.throw(t))}catch(t){s(t)}}function l(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(r,a)}l((i=i.apply(t,e||[])).next())})};const b=new s.Package;class C{constructor(){this._value=new r.BehaviorSubject(null),this.notify=!0,this.enabled=!0,this.root=o.div("",{style:{width:"100%"}}),this.input=o.input.toggle("test",{value:!0}),this.root.append(this.input.root)}set value(t){const e=t?JSON.parse(t):"";this._value.next(e)}get value(){return this._value.value?JSON.stringify(this._value.value):""}onInput(t){return this._value.subscribe(()=>{this.notify&&t(this.value)})}}const w=u.bS,A=h.A4,x=u.HJ,I=u.Ee,E=u.uf,T=d.ZS,R=d.B5,S=d.dQ,F=d.uD,P=c.A.fileInput,O=c.A.historyInput,k=c.A.historyInputJSON,B=c.A.historyPanel;class V{static init(){return y(this,void 0,void 0,function*(){})}static openModelFromFuncall(t){p.sg.openModelFromFunccall(t)}static OutliersSelection(){return new l.A}static RichFunctionViewEditor(t){return u.Ee.fromFuncCall(t,{historyEnabled:!0,isTabbed:!1})}static PipelineStepEditor(t){return u.Ee.fromFuncCall(t,{historyEnabled:!1,isTabbed:!0})}static CustomDataUploader(t){return y(this,void 0,void 0,function*(){return yield new Promise(t=>setTimeout(t,1e3)),[yield t.prepare({ambTemp:22,initTemp:100,desiredTemp:30,area:.06,heatCap:4200,heatTransferCoeff:8.3,simTime:21600}).call()]})}static CustomUploader(t){return y(this,void 0,void 0,function*(){const e=(yield i.functions.eval("Compute:CustomDataUploader")).prepare({func:t.func}),n=o.bigButton("Click me to get mock calls",()=>e.call()),r=s.Widget.fromRoot(o.panel([o.divV([o.label("This part of dialog comes from my custom data uploader"),o.divH([n],{style:{justifyContent:"center"}})])])),l=i.functions.onBeforeRunAction.pipe((0,a.filter)(t=>t.id===e.id)).subscribe(()=>{o.setUpdateIndicator(n,!0)}),u=i.functions.onAfterRunAction.pipe((0,a.filter)(t=>t.id===e.id)).subscribe(()=>{o.setUpdateIndicator(n,!1)});return r.subs.push(l,u),{uploadWidget:r,uploadFuncCall:e}})}static CustomCustomizer(t){t.defaultView.scatterPlot({xColumnName:"Initial temperature",yColumnName:"Time to cool"})}static SimTimeValidator(t){const{reasonableMin:e,reasonableMax:n}=t;return t=>(0,d.ZS)({warnings:t<e||t>n?[`Minimum reasonable time is ${e}. Maximum reasonable time is ${n}`]:void 0,errors:t<0?["Time should be strictly positive"]:void 0})}static DesiredTempValidator(t){return(t,e)=>{const n=e.funcCall.inputs.ambTemp,i=e.funcCall.inputs.initTemp;return(0,d.ZS)({errors:[...t<n?[(0,d.B5)(`Desired temperature cannot be less than ambient temperature (${n}). \n`,[{actionName:"Set desired equal to ambient",action:()=>e.funcCall.inputs.desiredTemp=n}])]:[],...t>i?[`Desired temperature cannot be higher than initial temperature (${i})`]:[]]})}}static InitialTempValidator(t){return(t,e)=>{const n=e.funcCall.inputs.ambTemp;return(0,d.ZS)({errors:[...t<n?[`Initial temperature cannot be less than ambient temperature (${n}).`]:[]]})}}static AmbTempValidator(t){return(t,e)=>{const n=e.funcCall.inputs.initTemp;return(0,d.ZS)({errors:[...t>n?[`Ambient temperature cannot be higher than initial temperature (${n})`]:[]]})}}static HeatCapValidator(t){return(t,e)=>(0,d.ZS)({errors:[...t<=0?["Heat capacity must be greater than zero."]:[]],notifications:[(0,d.B5)("Heat capacity is only dependent on the object material.",[{actionName:"Google it",action:()=>{window.open("http://google.com")}}])]})}static CustomStringInput(t){const e=o.input.string("Custom input",{value:""});return e.root.style.backgroundColor="aqua",e.input.style.backgroundColor="aqua",e}static ObjectCoolingSelector(t){return c.A.historyInputJSON("Previous run","ObjectCooling")}static CustomInputMock(t){return y(this,void 0,void 0,function*(){return new C})}static RangeValidatorFactory(t){const{min:e,max:n}=t;return t=>{if(t<e||t>n)return(0,d.ZS)({errors:[`Out of range [${e}, ${n}] value: ${t}`]})}}static AsyncValidatorDemoFactory(t){return t=>y(this,void 0,void 0,function*(){if(yield new Promise(t=>setTimeout(t,100)),0===t)return(0,d.ZS)({warnings:["Try non-null value"]})})}static GlobalValidatorDemoFactory(t){const{max:e}=t;return(t,n)=>y(this,void 0,void 0,function*(){var t;if(n.isRevalidation)return(null===(t=n.context)||void 0===t?void 0:t.isOk)?(0,d.ZS)():(0,d.ZS)({warnings:["Try lowering a value as well"]});yield new Promise(t=>setTimeout(t,100));const{a:i,b:o,c:s}=n.funcCall.inputs,r=i+o+s<=e,a=r?(0,d.ZS)():(0,d.ZS)({warnings:["Try lowering a value"]}),l=["a","b","c"].filter(t=>t!==n.param);return(0,d.dQ)(l,{isOk:r},a)})}}v([i.decorators.init(),m("design:type",Function),m("design:paramtypes",[]),m("design:returntype",Promise)],V,"init",null),v([i.decorators.func(),m("design:type",Function),m("design:paramtypes",[s.FuncCall]),m("design:returntype",void 0)],V,"openModelFromFuncall",null),v([i.decorators.func({name:"OutliersSelectionViewer",description:"Creates an outliers selection viewer",outputs:[{type:"viewer",name:"result"}],meta:{role:"viewer"}}),m("design:type",Function),m("design:paramtypes",[]),m("design:returntype",void 0)],V,"OutliersSelection",null),v([i.decorators.editor({outputs:[{type:"view",name:"result"}]}),m("design:type",Function),m("design:paramtypes",[s.FuncCall]),m("design:returntype",void 0)],V,"RichFunctionViewEditor",null),v([i.decorators.editor({outputs:[{type:"object",name:"result"}]}),m("design:type",Function),m("design:paramtypes",[s.FuncCall]),m("design:returntype",void 0)],V,"PipelineStepEditor",null),v([i.decorators.func({outputs:[{type:"object",name:"uploadedCalls"}]}),m("design:type",Function),m("design:paramtypes",[s.Func]),m("design:returntype",Promise)],V,"CustomDataUploader",null),v([i.decorators.func({outputs:[{name:"uploadWidget",type:"widget"},{name:"uploadFuncCall",type:"funccall"}]}),g(0,i.decorators.param({type:"object"})),m("design:type",Function),m("design:paramtypes",[Object]),m("design:returntype",Promise)],V,"CustomUploader",null),v([i.decorators.func(),g(0,i.decorators.param({type:"object"})),m("design:type",Function),m("design:paramtypes",[Object]),m("design:returntype",void 0)],V,"CustomCustomizer",null),v([i.decorators.func({outputs:[{type:"object",name:"validator"}]}),g(0,i.decorators.param({type:"object"})),m("design:type",Function),m("design:paramtypes",[Object]),m("design:returntype",void 0)],V,"SimTimeValidator",null),v([i.decorators.func({outputs:[{type:"object",name:"validator"}]}),g(0,i.decorators.param({type:"object"})),m("design:type",Function),m("design:paramtypes",[Object]),m("design:returntype",void 0)],V,"DesiredTempValidator",null),v([i.decorators.func({outputs:[{type:"object",name:"validator"}]}),g(0,i.decorators.param({type:"object"})),m("design:type",Function),m("design:paramtypes",[Object]),m("design:returntype",void 0)],V,"InitialTempValidator",null),v([i.decorators.func({outputs:[{type:"object",name:"validator"}]}),g(0,i.decorators.param({type:"object"})),m("design:type",Function),m("design:paramtypes",[Object]),m("design:returntype",void 0)],V,"AmbTempValidator",null),v([i.decorators.func({outputs:[{type:"object",name:"validator"}]}),g(0,i.decorators.param({type:"object"})),m("design:type",Function),m("design:paramtypes",[Object]),m("design:returntype",void 0)],V,"HeatCapValidator",null),v([i.decorators.func({outputs:[{type:"object",name:"result"}]}),g(0,i.decorators.param({type:"object"})),m("design:type",Function),m("design:paramtypes",[Object]),m("design:returntype",void 0)],V,"CustomStringInput",null),v([i.decorators.func({outputs:[{type:"object",name:"result"}]}),g(0,i.decorators.param({type:"object"})),m("design:type",Function),m("design:paramtypes",[Object]),m("design:returntype",void 0)],V,"ObjectCoolingSelector",null),v([i.decorators.func({outputs:[{type:"object",name:"input"}]}),g(0,i.decorators.param({type:"object"})),m("design:type",Function),m("design:paramtypes",[Object]),m("design:returntype",Promise)],V,"CustomInputMock",null),v([i.decorators.func({outputs:[{type:"object",name:"validator"}]}),g(0,i.decorators.param({type:"object"})),m("design:type",Function),m("design:paramtypes",[Object]),m("design:returntype",void 0)],V,"RangeValidatorFactory",null),v([i.decorators.func({outputs:[{type:"object",name:"validator"}]}),g(0,i.decorators.param({type:"object"})),m("design:type",Function),m("design:paramtypes",[Object]),m("design:returntype",void 0)],V,"AsyncValidatorDemoFactory",null),v([i.decorators.func({outputs:[{type:"object",name:"validator"}]}),g(0,i.decorators.param({type:"object"})),m("design:type",Function),m("design:paramtypes",[Object]),m("design:returntype",void 0)],V,"GlobalValidatorDemoFactory",null)},1757(t){"use strict";t.exports=$},6082(t){"use strict";t.exports=DG},3508(t){"use strict";t.exports=dayjs},4328(t){"use strict";t.exports=grok},1858(t){"use strict";t.exports=rxjs},9713(t){"use strict";t.exports=rxjs.operators},7389(t){"use strict";t.exports=ui},1991(t){"use strict";t.exports=wu},1825(t,e,n){"use strict";n.d(e,{Fo:()=>v,SM:()=>p});const i="function"==typeof Buffer,o=("function"==typeof TextDecoder&&new TextDecoder,"function"==typeof TextEncoder&&new TextEncoder,Array.prototype.slice.call("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=")),s=(t=>{let e={};return t.forEach((t,n)=>e[t]=n),e})(o),r=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,a=String.fromCharCode.bind(String),l="function"==typeof Uint8Array.from?Uint8Array.from.bind(Uint8Array):t=>new Uint8Array(Array.prototype.slice.call(t,0)),u=t=>t.replace(/[^A-Za-z0-9\+\/]/g,""),c="function"==typeof btoa?t=>btoa(t):i?t=>Buffer.from(t,"binary").toString("base64"):t=>{let e,n,i,s,r="";const a=t.length%3;for(let a=0;a<t.length;){if((n=t.charCodeAt(a++))>255||(i=t.charCodeAt(a++))>255||(s=t.charCodeAt(a++))>255)throw new TypeError("invalid character found");e=n<<16|i<<8|s,r+=o[e>>18&63]+o[e>>12&63]+o[e>>6&63]+o[63&e]}return a?r.slice(0,a-3)+"===".substring(a):r},d=i?t=>Buffer.from(t).toString("base64"):t=>{let e=[];for(let n=0,i=t.length;n<i;n+=4096)e.push(a.apply(null,t.subarray(n,n+4096)));return c(e.join(""))},p=(t,e=!1)=>e?d(t).replace(/=/g,"").replace(/[+\/]/g,t=>"+"==t?"-":"_"):d(t),h="function"==typeof atob?t=>atob(u(t)):i?t=>Buffer.from(t,"base64").toString("binary"):t=>{if(t=t.replace(/\s+/g,""),!r.test(t))throw new TypeError("malformed base64.");let e,n,i;t+="==".slice(2-(3&t.length));let o=[];for(let r=0;r<t.length;)e=s[t.charAt(r++)]<<18|s[t.charAt(r++)]<<12|(n=s[t.charAt(r++)])<<6|(i=s[t.charAt(r++)]),64===n?o.push(a(e>>16&255)):64===i?o.push(a(e>>16&255,e>>8&255)):o.push(a(e>>16&255,e>>8&255,255&e));return o.join("")},f=i?t=>l(Buffer.from(t,"base64")):t=>l(h(t).split("").map(t=>t.charCodeAt(0))),v=t=>f(m(t)),m=t=>u(t.replace(/[-_]/g,t=>"-"==t?"+":"/"))}},e={};function n(i){var o=e[i];if(void 0!==o)return o.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=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.nc=void 0;var i=n(2650);compute=i})();
|
|
1
|
+
var compute;(()=>{var t={76(t,e,n){"use strict";n.d(e,{A:()=>l});var i=n(126),r=n.n(i),o=n(454),s=n.n(o)()(r());s.push([t.id,`.fi-drop-area {
|
|
2
|
+
position: relative;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.fi-drop-area .default {
|
|
6
|
+
color: var(--grey-2);
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.fi-drop-area .drag-n-dropping {
|
|
10
|
+
background-color: var(--steel-1);
|
|
11
|
+
border: 1px dashed var(--blue-1);
|
|
12
|
+
color: var(--grey-3);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.fi-drop-area .error {
|
|
16
|
+
color: var(--red-3);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.fi-drop-area .success {
|
|
20
|
+
color: var(--grey-6);
|
|
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 l=s},602(t,e,n){"use strict";n.d(e,{A:()=>l});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 l=s},128(t,e,n){"use strict";n.d(e,{A:()=>l});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
|
+
margin: 12px;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.grok-icon.hp-disabled {
|
|
27
|
+
pointer-events: none;
|
|
28
|
+
opacity: 0.6;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.hp-funccall-card-hover-icon {
|
|
32
|
+
display: none;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.hp-funccall-card:hover .hp-funccall-card-hover-icon {
|
|
36
|
+
display: flex;
|
|
37
|
+
margin: 0px 0px 0px 5px;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.hp-funccall-card {
|
|
41
|
+
margin: 2px 1px;
|
|
42
|
+
padding: 5px;
|
|
43
|
+
justify-content: space-between;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.hp-funccall-card .hp-card-content {
|
|
47
|
+
justify-content: space-around;
|
|
48
|
+
margin-left: 5px;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.hp-funccall-card .hp-card-content * {
|
|
52
|
+
margin-bottom: 3px;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.hp-funccall-card .description {
|
|
56
|
+
margin-bottom: 2px;
|
|
57
|
+
color: var(--grey-3);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.hp-funccall-card .date {
|
|
61
|
+
color: var(--grey-3);
|
|
62
|
+
margin-left: 5px;
|
|
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 l=s},510(t,e,n){"use strict";n.d(e,{A:()=>l});var i=n(126),r=n.n(i),o=n(454),s=n.n(o)()(r());s.push([t.id,`.pipeline-view .d4-ribbon-name.selected {
|
|
65
|
+
color: var(--grey-6)
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.pipeline-view .d4-ribbon-name {
|
|
69
|
+
color: var(--blue-1);
|
|
70
|
+
margin: 12px 6px;
|
|
71
|
+
font-weight: normal;
|
|
72
|
+
place-content: center;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.pipeline-view .d4-ribbon-name + .d4-ribbon-name::before {
|
|
76
|
+
color: var(--grey-3);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.pipeline-view .d4-ribbon-name.d4-disabled {
|
|
80
|
+
cursor: default;
|
|
81
|
+
pointer-events: none;
|
|
82
|
+
color: var(--grey-3);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.ui-input-editor button.ui-btn-nav.ui-btn.d4-disabled {
|
|
86
|
+
color: var(--grey-3)
|
|
87
|
+
}`,"",{version:3,sources:["webpack://./../../libraries/compute-utils/dist/old-views/css/pipeline-view.css"],names:[],mappings:"AAAA;EACE;AACF;;AAEA;EACE,oBAAoB;EACpB,gBAAgB;EAChB,mBAAmB;EACnB,qBAAqB;AACvB;;AAEA;EACE,oBAAoB;AACtB;;AAEA;EACE,eAAe;EACf,oBAAoB;EACpB,oBAAoB;AACtB;;AAEA;EACE;AACF",sourcesContent:[".pipeline-view .d4-ribbon-name.selected {\n color: var(--grey-6)\n}\n\n.pipeline-view .d4-ribbon-name {\n color: var(--blue-1);\n margin: 12px 6px;\n font-weight: normal;\n place-content: center;\n}\n\n.pipeline-view .d4-ribbon-name + .d4-ribbon-name::before {\n color: var(--grey-3);\n}\n\n.pipeline-view .d4-ribbon-name.d4-disabled {\n cursor: default;\n pointer-events: none;\n color: var(--grey-3);\n}\n\n.ui-input-editor button.ui-btn-nav.ui-btn.d4-disabled {\n color: var(--grey-3)\n}"],sourceRoot:""}]);let l=s},902(t,e,n){"use strict";n.d(e,{A:()=>l});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 {
|
|
88
|
+
margin-top: 0px;
|
|
89
|
+
position: sticky;
|
|
90
|
+
align-items: flex-start;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.ui-form .ui-input-buttons.rfv-buttons .ui-input-editor {
|
|
94
|
+
flex-wrap: wrap;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.ui-input-root.rfv-restricted-input.d4-disabled {
|
|
98
|
+
pointer-events: all;
|
|
99
|
+
cursor: pointer!important;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/* Hide all state icons by default */
|
|
103
|
+
.ui-input-root > .ui-input-options .rfv-icon-lock,
|
|
104
|
+
.ui-input-root > .ui-input-options .rfv-icon-unlock,
|
|
105
|
+
.ui-input-root > .ui-input-options .rfv-icon-undo,
|
|
106
|
+
.ui-input-root > .ui-input-options .rfv-icon-warning {
|
|
107
|
+
display: none;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/* Show warning icon if input is on warning state */
|
|
111
|
+
.ui-input-root.rfv-inconsistent-input > .ui-input-options .rfv-icon-warning {
|
|
112
|
+
display: inherit;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/* Show undo icon if input is on inconstent state and hovered */
|
|
116
|
+
.ui-input-root.rfv-restricted-unlocked-input:hover .rfv-icon-undo, .ui-input-root.rfv-inconsistent-input:hover .rfv-icon-undo {
|
|
117
|
+
display: inherit;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/* Show/hide lock-unlock icons on input hover */
|
|
121
|
+
.ui-input-root.rfv-restricted-input:hover .rfv-icon-lock {
|
|
122
|
+
display: none;
|
|
123
|
+
}
|
|
124
|
+
.ui-input-root.rfv-restricted-input .rfv-icon-lock {
|
|
125
|
+
display: inherit;
|
|
126
|
+
}
|
|
127
|
+
.ui-input-root.rfv-restricted-input .rfv-icon-unlock {
|
|
128
|
+
display: none;
|
|
129
|
+
}
|
|
130
|
+
.ui-input-root.rfv-restricted-input:hover .rfv-icon-unlock {
|
|
131
|
+
display: inherit;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
.ui-form-condensed .rfv-buttons > .ui-label {
|
|
135
|
+
margin-right: 0px!important;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.rfv-form .ui-form .rfv-buttons > .ui-input-editor {
|
|
139
|
+
gap: 5px;
|
|
140
|
+
justify-content: flex-end;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
div.ui-box > div.ui-box.rfv-form > div.ui-div {
|
|
144
|
+
overflow: visible!important;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
.rfv-scalar-table {
|
|
148
|
+
border-collapse: collapse;
|
|
149
|
+
margin: 10px;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
.rfv-scalar-table td {
|
|
153
|
+
width: max-content;
|
|
154
|
+
white-space: nowrap;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
.rfv-scalar-table tr{
|
|
158
|
+
min-height: 30px;
|
|
159
|
+
border-bottom: 1pt solid var(--grey-12);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
.rfv-scalar-table tr:nth-child(odd) {
|
|
163
|
+
background-color: var(--grey-1);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
.rfv-scalar-table td:last-child {
|
|
167
|
+
width: 100%;
|
|
168
|
+
}`,"",{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 l=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 l=0;l<this.length;l++){var a=this[l][0];null!=a&&(s[a]=!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 l=s.parse;s.parse=function(t){t.utc&&(this.$u=!0),this.$utils().u(t.$offset)||(this.$offset=t.$offset),l.call(this,t)};var a=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 a.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 l=this.clone();if(r)return l.$offset=s,l.$u=!1,l;var a=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();return(l=this.local().add(s+a,t)).$offset=s,l.$x.$localOffset=a,l};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)}}}()},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 l=t[s],a=i.base?l[0]+i.base:l[0],u=r[a]||0,c="".concat(a," ").concat(u);r[a]=u+1;var d=n(c),p={css:l[1],media:l[2],sourceMap:l[3],supports:l[4],layer:l[5]};if(-1!==d)e[d].references++,e[d].updater(p);else{var 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 l=n(o[s]);e[l].references--}for(var a=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=a}}},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;n.r(i),n.d(i,{ObjectCoolingSelector:()=>iR,CustomInputMock:()=>iT,RichFunctionViewEditor:()=>iv,makeValidationResult:()=>i$,mergeValidationResults:()=>iG,CompView:()=>i_,PipelineStepEditor:()=>iy,GlobalValidatorDemoFactory:()=>iF,historyPanel:()=>iK,CustomCustomizer:()=>iw,init:()=>ip,makeAdvice:()=>iW,HeatCapValidator:()=>iE,CustomStringInput:()=>iS,RangeValidatorFactory:()=>iO,deepCopy:()=>iN,DesiredTempValidator:()=>iA,CustomUploader:()=>ib,fileInput:()=>iq,openModelFromFuncall:()=>ih,CustomDataUploader:()=>ig,AsyncValidatorDemoFactory:()=>iP,AmbTempValidator:()=>iI,SimTimeValidator:()=>iC,RFV:()=>iU,OutliersSelection:()=>im,Pipeline:()=>iH,historyInputJSON:()=>iz,InitialTempValidator:()=>ix,historyInput:()=>iJ,_package:()=>iL,PackageFunctions:()=>iZ,makeRevalidation:()=>iY});let e=grok,r=ui,o=DG,s=rxjs,l=rxjs.operators,a=$;var u,c,d,p,h,f,m,v,y,g,b,w=n.n(a);class C extends o.JsViewer{onFrameAttached(t){this.render()}onTableAttached(){this.render()}render(){if(!this.dataFrame||this.dataFrame.rowCount<=0){this.root.innerHTML="";return}let t=this.dataFrame,n="isOutlier",i="isOutlierSecondary",s="Rationale",l="Count",a="isConfirmed";t.columns.byName(n)||t.columns.add(o.Column.fromList(o.TYPE.STRING,n,Array(t.rowCount).fill("Inlier"))),t.columns.byName(i)||t.columns.add(o.Column.fromList(o.TYPE.STRING,i,Array(t.rowCount).fill("Inlier"))),t.columns.byName(s)||t.columns.add(o.Column.fromStrings(s,Array.from({length:t.rowCount},()=>"")));let u=()=>o.DataFrame.fromColumns([o.Column.fromStrings(s,[]),o.Column.fromInt32Array(l,new Int32Array([])),o.Column.fromStrings("Actions",[]),o.Column.fromBitSet(a,o.BitSet.create(0,()=>!1))]),c=o.Viewer.grid(u());c.root.style.width="100%",c.root.style.minWidth="230px",c.columns.setVisible([s,l,"Actions"]),this.root.append(r.divV([r.divV([c.root],{style:{height:"75%"}})],{style:{height:"100%"}}));let d=()=>{var e,r,l,a,u,d,p;if(!c.dataFrame)return;null==(e=t.col(n))||e.meta.markers.assign("Outlier",o.MARKER_TYPE.OUTLIER),null==(r=t.col(n))||r.meta.markers.assign("Last Inlier",o.MARKER_TYPE.STAR),null==(l=t.col(n))||l.meta.colors.setCategorical({Outlier:o.Color.scatterPlotMarker,Inlier:o.Color.scatterPlotMarker,"Last Inlier":o.Color.red}),null==(a=t.col(i))||a.meta.markers.assign("Outlier",o.MARKER_TYPE.OUTLIER),null==(u=t.col(i))||u.meta.markers.assign("Last Inlier",o.MARKER_TYPE.STAR),null==(d=t.col(i))||d.meta.colors.setCategorical({Outlier:o.Color.cyan,Inlier:o.Color.cyan,"Last Inlier":o.Color.red});let h=null==(p=c.dataFrame)?void 0:p.cell(c.dataFrame.rowCount-1,s).value;t.selection.getSelectedIndexes().forEach(e=>{t.col(n).set(e,"Outlier",!1),t.col(i).set(e,"Outlier",!1),t.col(s).set(e,h,!1)}),t.selection.setAll(!1),t.fireValuesChanged(),w()(document.querySelector(".d4-balloon-container")).empty()},p=()=>{c.dataFrame&&(c.dataFrame.rows.removeAt(c.dataFrame.rowCount-1),t.selection.setAll(!1),w()(document.querySelector(".d4-balloon-container")).empty())};c.onCellPrepare(e=>{if(e.isTableCell&&"Actions"===e.gridColumn.name){var o,l;let u;e.gridColumn.cellType="html",e.style.element=r.divH([...(null==(o=e.grid.dataFrame)?void 0:o.get(a,e.gridRow))?[(u=null==(l=e.grid.dataFrame)?void 0:l.get(s,e.gridRow),r.div(r.icons.delete(()=>{for(let e=0;e<t.rowCount;e++)t.columns.byName(s).get(e)===u&&(t.columns.byName(s).set(e,"",!1),t.columns.byName(n).set(e,"Inlier",!1),t.columns.byName(i).set(e,"Inlier",!1));t.fireValuesChanged()},"Remove the outliers group"),{style:{textAlign:"center",margin:"6px"}}))]:[r.div(r.iconFA("check",d,"Confirm the outliers"),{style:{textAlign:"center",margin:"6px"}}),r.div(r.iconFA("times",p,"Cancel the outliers"),{style:{textAlign:"center",margin:"6px"}})]])}}),c.onCellValueEdited.subscribe(e=>{var n,i;if(!c.dataFrame||e.gridColumn.name!==s||!c.dataFrame.columns.byName(a).get(e.gridRow))return;let r=new Set;for(let t=0;t<(null==(n=c.dataFrame)?void 0:n.rowCount);t++){let e=null==(i=c.dataFrame)?void 0:i.columns.byName(s).get(t);r.add(e)}for(let n=0;n<t.rowCount;n++){let i=t.columns.byName(s).get(n);""==i||r.has(i)||t.columns.byName(s).set(n,e.cell.value)}});let h=()=>{if(t.columns.byName(s))for(let e=0;e<t.rowCount;e++)"Outlier"===t.columns.byName(n).get(e)?""===t.columns.byName(s).get(e)&&t.columns.byName(s).set(e,"Manual",!1):""!==t.columns.byName(s).get(e)&&t.columns.byName(s).set(e,"",!1);let e={};if(t.columns.byName(s))for(let n=0;n<t.rowCount;n++){let i=t.columns.byName(s).get(n),r=e[i];""!=i&&(r?e[i]++:e[i]=1)}c.dataFrame=u(),c.columns.setVisible([s,l,"Actions"]),Object.keys(e).map(t=>{var n;null==(n=c.dataFrame)||n.rows.addNew([t,e[t],"",!0])})};t.onDataChanged.subscribe(h),t.onSelectionChanged.subscribe(()=>{if(!c.dataFrame||!t.selection.trueCount)return;let n=document.querySelector(".d4-balloon-container");if((!n||w()(n).is(":empty"))&&e.shell.info(r.div([r.divText("Confirm selected points as outliers?"),r.divH([r.bigButton("Confirm",d),r.button("Cancel",p)])])),c.dataFrame.columns.byName(a).toList().some(t=>!1===t))c.dataFrame.set(l,c.dataFrame.rowCount-1,t.selection.trueCount);else{let e=c.dataFrame.rows.addNew(["Manual",t.selection.trueCount,"",!1]);c.dataFrame.currentCell=c.dataFrame.cell(e.idx,s)}}),t.selection.setAll(!1),h()}constructor(){super()}}let A=dayjs;var x=n.n(A);let I=wu;var E=n.n(I);let S={barchart:o.VIEWER.BAR_CHART,boxplot:o.VIEWER.BOX_PLOT,calendar:o.VIEWER.CALENDAR,corrplot:o.VIEWER.CORR_PLOT,densityplot:o.VIEWER.DENSITY_PLOT,filters:o.VIEWER.FILTERS,form:o.VIEWER.FORM,globe:o.VIEWER.GLOBE,googlemap:o.VIEWER.GOOGLE_MAP,grid:o.VIEWER.GRID,heatmap:o.VIEWER.HEAT_MAP,histogram:o.VIEWER.HISTOGRAM,linechart:o.VIEWER.LINE_CHART,markup:o.VIEWER.MARKUP,matrixplot:o.VIEWER.MATRIX_PLOT,networkdiagram:o.VIEWER.NETWORK_DIAGRAM,pcplot:o.VIEWER.PC_PLOT,piechart:o.VIEWER.PIE_CHART,scatterplot:o.VIEWER.SCATTER_PLOT,"3dscatterplot":o.VIEWER.SCATTER_PLOT_3D,shapemap:o.VIEWER.SHAPE_MAP,statistics:o.VIEWER.STATISTICS,tileviewer:o.VIEWER.TILE_VIEWER,timelines:o.VIEWER.TIMELINES,treemap:o.VIEWER.TREE_MAP,trellisplot:o.VIEWER.TRELLIS_PLOT,wordcloud:o.VIEWER.WORD_CLOUD,diffstudiofacet:"DiffStudio Facet"},R="JsCardView",T="viewer",O="Run name",P="RunId";function F(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}}"u">typeof window?window:n.g.window,new Intl.NumberFormat("en-US",{minimumFractionDigits:2,maximumFractionDigits:2}),"function"==typeof TextDecoder&&new TextDecoder("utf-8",{ignoreBOM:!0}),"function"==typeof TextEncoder&&new TextEncoder;let V=Array.prototype.slice.call("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="),B=(t={},V.forEach((e,n)=>t[e]=n),t),D=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,k=String.fromCharCode.bind(String),j="function"==typeof Uint8Array.from?Uint8Array.from.bind(Uint8Array):t=>new Uint8Array(Array.prototype.slice.call(t,0)),L="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+=V[(e=n<<16|i<<8|r)>>18&63]+V[e>>12&63]+V[e>>6&63]+V[63&e]}return s?o.slice(0,s-3)+"===".substring(s):o},M="function"==typeof Uint8Array.prototype.toBase64?t=>t.toBase64():t=>{let e=[];for(let n=0,i=t.length;n<i;n+=4096)e.push(k.apply(null,t.subarray(n,n+4096)));return L(e.join(""))},N=(t,e=!1)=>e?M(t).replace(/=/g,"").replace(/[+\/]/g,t=>"+"==t?"-":"_"):M(t),_="function"==typeof atob?t=>atob(t.replace(/[^A-Za-z0-9\+\/]/g,"")):t=>{let e,n,i;if(t=t.replace(/\s+/g,""),!D.test(t))throw TypeError("malformed base64.");t+="==".slice(2-(3&t.length));let r=[];for(let o=0;o<t.length;)e=B[t.charAt(o++)]<<18|B[t.charAt(o++)]<<12|(n=B[t.charAt(o++)])<<6|(i=B[t.charAt(o++)]),64===n?r.push(k(e>>16&255)):64===i?r.push(k(e>>16&255,e>>8&255)):r.push(k(e>>16&255,e>>8&255,255&e));return r.join("")},U="function"==typeof Uint8Array.fromBase64?t=>Uint8Array.fromBase64(t):t=>j(_(t).split("").map(t=>t.charCodeAt(0))),H=t=>t.replace(/[-_]/g,t=>"-"==t?"+":"/").replace(/[^A-Za-z0-9\+\/]/g,""),W="_DG_CUSTOM_SERIALIZED_TOKEN_";function Y(t,e){let n=void 0===e?{}:e;return JSON.stringify(t,function(t,e){return e===1/0?{[W]:"Infinity",value:!0}:e===-1/0?{[W]:"-Infinity",value:!0}:Number.isNaN(e)?{[W]:"NaN",value:!0}:e instanceof o.DataFrame&&!n.useJsonDF?{[W]:"DataFrame",value:N(e.toByteArray())}:e instanceof o.DataFrame&&n.useJsonDF?{[W]:"DataFrameJSON",value:e.toJson()}:e instanceof ArrayBuffer?{[W]:"ArrayBuffer",value:N(new Uint8Array(e))}:e instanceof Map?{[W]:"Map",value:Array.from(e)}:e instanceof Set?{[W]:"Set",value:Array.from(e)}:x().isDayjs(this[t])?{[W]:"DayJs",value:this[t].toISOString()}:e},n.space)}function G(t,e){if(e&&e[W]&&e.value)switch(e[W]){case"DataFrame":return o.DataFrame.fromByteArray(U(H(e.value)));case"DataFrameJSON":return o.DataFrame.fromJson(JSON.stringify(e.value));case"ArrayBuffer":return U(H(e.value)).buffer;case"Map":return new Map(e.value);case"DayJs":return x()(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 q(t,e,n,i,r,o,s){try{var l=t[o](s),a=l.value}catch(t){n(t);return}l.done?e(a):Promise.resolve(a).then(i,r)}let J=new o.LruCache,z=t=>{var n;return(n=function*(){var n;let i=null!=(n=t.options.help)?n:t.options.readme;if(!i)return;if(J.get(t.id))return J.get(t.id);let r="";try{r=t.package.name}catch(t){}let o=`System:AppData/${r}/${i}`;if(r&&(yield e.dapi.files.exists(o))){let n=yield e.dapi.files.readAsText(o);return J.set(t.id,n),n}let s=`${e.shell.user.name}.home/${i}`;if(yield e.dapi.files.exists(s)){let n=yield e.dapi.files.readAsText(s);return J.set(t.id,n),n}},function(){var t=this,e=arguments;return new Promise(function(i,r){var o=n.apply(t,e);function s(t){q(o,i,r,s,l,"next",t)}function l(t){q(o,i,r,s,l,"throw",t)}s(void 0)})})()},K=t=>{let e;try{e=t.package}catch(t){}return e},Z=(t,e)=>{let n=t[e];return n?F(n,{warning:e}):null},X=t=>{try{return null==t?void 0:t.started}catch(t){return}},Q=t=>{var e;return JSON.parse(null!=(e=t.options.OUTPUT_OUTDATED)?e:"false",G)||!X(t)||!t.id},tt=t=>{let e=(null==(a=t.func)||null==(l=a.nqName)?void 0:l.includes(":"))?o.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=E()(e.outputParams.values()).filter(e=>null!=t.outputs[e.name]);var i=!0,r=!1,s=void 0;try{for(var l,a,u,c=n[Symbol.iterator]();!(i=(u=c.next()).done);i=!0){let n=u.value;n.property.propertyType===o.TYPE.DATA_FRAME?e.outputs[n.name]=t.outputs[n.name].clone():e.outputs[n.name]=t.outputs[n.name]}}catch(t){r=!0,s=t}finally{try{i||null==c.return||c.return()}finally{if(r)throw s}}let d=E()(e.inputParams.values()).filter(e=>null!=t.inputs[e.name]);var p=!0,h=!1,f=void 0;try{for(var m,v=d[Symbol.iterator]();!(p=(m=v.next()).done);p=!0){let n=m.value;n.property.propertyType===o.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==v.return||v.return()}finally{if(h)throw f}}return X(t)&&(e.started=t.started),e},te=t=>{var e;let n=t.options[T];return n?{name:t.name,config:null!=(e=F(n,{warning:`${t.name} viewer`,reviver:(t,e)=>{if("true"===e)return!0;if("false"===e)return!1;if("type"===t)return S[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:[]}},tn=t=>t.trimStart().startsWith("<"),ti=t=>{try{return t.started.toDate().toLocaleString("en-us",{month:"short",day:"numeric",hour:"numeric",minute:"numeric"})}catch(t){return"Not completed"}},tr="createdById",to="createdAt",ts="customView",tl="nestedEntity",ta=t=>{var e,n;if(null==(e=t.options)?void 0:e[tr])return t.options[tr];try{return null==(n=t.author)?void 0:n.id}catch(t){return}},tu=t=>{var e;return(null==(e=t.options)?void 0:e.title)||t.friendlyName||""};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}function td(t,e,n,i,r,o,s){try{var l=t[o](s),a=l.value}catch(t){n(t);return}l.done?e(a):Promise.resolve(a).then(i,r)}function tp(t){return function(){var e=this,n=arguments;return new Promise(function(i,r){var o=t.apply(e,n);function s(t){td(o,i,r,s,l,"next",t)}function l(t){td(o,i,r,s,l,"throw",t)}s(void 0)})}}function th(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,l=!1;try{for(r=r.call(t);!(s=(n=r.next()).done)&&(o.push(n.value),!e||o.length!==e);s=!0);}catch(t){l=!0,i=t}finally{try{s||null==r.return||r.return()}finally{if(l)throw i}}return o}}(t,e)||function(t,e){if(t){if("string"==typeof t)return tc(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 tc(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 tf='((options.isDeleted != "true") or (options.isDeleted = null))',tm=t=>t.trim().toLowerCase();function tv(t,e,n,i,r,o,s){try{var l=t[o](s),a=l.value}catch(t){n(t);return}l.done?e(a):Promise.resolve(a).then(i,r)}function ty(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,l,"next",t)}function l(t){tv(o,i,r,s,l,"throw",t)}s(void 0)})}}function tg(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 tb(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 n=new o.LruCache;function i(t,e){var n,i;t.friendlyName=e.name.trim(),t.options.title=t.friendlyName;let o=r(t);t.options.description=null!=(n=e.description)?n:o.description,t.options.tags=null!=(i=e.tags)?i:o.tags}function r(t){var e,n,i;let r=null==(n=t.options)?void 0:n.tags;return{name:tu(t),description:null!=(e=null==(i=t.options)?void 0:i.description)?e:"",tags:Array.isArray(r)?r:[]}}function s(t){return tp(function*(){var e,n,i;let r,o;if(t.options[tr])return;let s=ta(t)?t:yield l(t.id);t.options[tr]=ta(s),t.options[to]=null==(e=(null==(o=(r=(null==(n=s.options)?void 0:n[tr])?null==(i=s.options)?void 0:i[to]:void 0)?x()(r):X(s))?void 0:o.isValid())?o:void 0)?void 0:e.toISOString()})()}function l(t){return tp(function*(){return yield e.dapi.functions.calls.allPackageVersions().include("session.user,func.package, inputs, outputs").find(t)})()}function a(t,n){return tp(function*(t,n,i){let r=e.dapi.spaces.id(n);yield r.addEntity(t,!0);var o=!0,s=!1,l=void 0;try{for(var a,u=(void 0===i?[]:i)[Symbol.iterator]();!(o=(a=u.next()).done);o=!0){let e=a.value;e.id!==t&&(yield r.removeEntity(e.id))}}catch(t){s=!0,l=t}finally{try{o||null==u.return||u.return()}finally{if(s)throw l}}}).apply(this,arguments)}function u(t){return tp(function*(){let n=th((yield Promise.all([e.dapi.spaces.id(t).children.list(),c(t)])),2);return{items:n[0],runs:n[1]}})()}function c(t){return tp(function*(){return yield e.dapi.spaces.id(t).children.ofTypes("FuncCall",!0).list()})()}function d(e,n){let i=tm(n),r=e.items.find(e=>t.isNamedSpaceItem(e)&&tm(e.friendlyName||e.name||"")===i);return{runs:e.runs.filter(t=>tm(tu(t))===i),other:r}}t.setRunMetadata=i,t.getRunMetadata=r,t.canEditRunDetails=function(t,e){return!!t&&t===o.User.current().id||e},t.shallowLoadRun=l,t.loadRun=function(t){return tp(function*(){let n=yield e.dapi.functions.calls.allPackageVersions().include("session.user,func.package, inputs, outputs").find(t),i=E()(n.inputParams.values()).filter(t=>t.property.propertyType===o.TYPE.FILE&&!!n.inputs[t.name]);yield Promise.all(i.map(t=>tp(function*(){let i=JSON.parse(n.inputs[t.name]),r=i.id,s=i.name,l=yield e.dapi.files.readAsBytes(r),a=o.FileInfo.fromBytes(s,l);return a.id=r,n.inputs[t.name]=a,Promise.resolve()})()));let r=E()(n.outputParams.values()).filter(t=>t.property.propertyType===o.TYPE.DATA_FRAME&&!!n.outputs[t.name]);yield Promise.all(r.map(t=>tp(function*(){return n.outputs[t.name]=yield e.dapi.tables.getTable(n.outputs[t.name]),Promise.resolve()})()));let s=E()(n.inputParams.values()).filter(t=>t.property.propertyType===o.TYPE.DATA_FRAME&&!!n.inputs[t.name]);return yield Promise.all(s.map(t=>tp(function*(){return n.inputs[t.name]=yield e.dapi.tables.getTable(n.inputs[t.name]),Promise.resolve()})())),n})()},t.updateRunMeta=function(t){return tp(function*(){yield s(t);let n=yield e.dapi.functions.calls.allPackageVersions().save(t);e.log.audit("@user edited metadata of @model model run",{user:o.User.current(),model:n.func})})()},t.saveRun=function(t,r){return tp(function*(){var s,l,u,c;let d=n.get("All users");d||(d=yield e.dapi.groups.find(o.Group.defaultGroupsIds["All users"]),n.set("All users",d));let p=null!=(s=null==r?void 0:r.audience)?s:d;(null==r?void 0:r.newId)&&t.newId(),(null==r?void 0:r.metadata)&&i(t,r.metadata),t.options[tr]=o.User.current().id,t.options[to]=x()().toISOString(),(null==r?void 0:r.nested)?t.options[tl]="true":delete t.options[tl];let h=tt(t);delete h.options.isDeleted,(null==r?void 0:r.metadata)&&(h.friendlyName=t.friendlyName),Q(h)&&(h.options.createdOn=x()().utc(!0).unix());let f=E()(h.inputParams.values()).filter(t=>t.property.propertyType===o.TYPE.FILE&&!!h.inputs[t.name]);yield Promise.all(f.map(t=>tp(function*(){var n;let i=h.inputs[t.name],r=i instanceof o.FileInfo?yield i.readAsBytes():new Uint8Array((yield i.arrayBuffer())),s=i instanceof o.FileInfo&&null!=(n=i.fileName)?n:i.name,l=o.FileInfo.fromBytes(s,r);return yield e.dapi.files.write(l),h.inputs[t.name]={id:l.id,name:l.name},Promise.resolve()})()));let m=E()(h.outputParams.values()).filter(t=>t.property.propertyType===o.TYPE.DATA_FRAME&&!!h.outputs[t.name]);yield Promise.all(m.map(t=>tp(function*(){yield e.dapi.tables.uploadDataFrame(h.outputs[t.name]),yield e.dapi.permissions.grant(h.outputs[t.name].getTableInfo(),p,!1)})()));let v=E()(h.inputParams.values()).filter(t=>t.property.propertyType===o.TYPE.DATA_FRAME&&!!h.inputs[t.name]);yield Promise.all(v.map(t=>tp(function*(){yield e.dapi.tables.uploadDataFrame(h.inputs[t.name]),yield e.dapi.permissions.grant(h.inputs[t.name].getTableInfo(),p,!1)})()));let y=yield e.dapi.functions.calls.allPackageVersions().save(h);if(e.log.audit("@user saved run of the @model model",{user:o.User.current(),model:y.func}),null==r||null==(l=r.target)?void 0:l.spaceId)try{yield a(y.id,r.target.spaceId,r.target.replace)}catch(t){e.shell.error(`Saved the run, but couldn't add it to the space: ${null!=(c=null==t?void 0:t.message)?c:t}`)}return r&&!r.nested&&e.events.fireCustomEvent("compute-run-saved",{spaceIds:(null==(u=r.target)?void 0:u.spaceId)?[r.target.spaceId]:[]}),y})()},t.linkRun=a,t.unlinkRun=function(t,n){return tp(function*(){yield e.dapi.spaces.id(n).removeEntity(t)})()},t.listMyRuns=function(n){return tp(function*(){let i=Array.isArray(n)?n:[n];if(0===i.length)return[];let r=o.User.current().id,s=`(options.${tr} = "${r}") or ((session.user.id="${r}") and (options.${tr} = null))`,l=[...new Set(i.map(t=>t.name))],a=i.map(t=>`(options.${ts} = "${t.nqName}")`),u=t=>e.dapi.functions.calls.allPackageVersions().filter(`(${s}) and (${tf}) and (options.${tl} = null) and (${t})`).include("session,options,func.package").list(),c=th((yield Promise.all([u(`func.name in (${l.map(t=>`"${t}"`).join(",")})`),u(a.join(" or "))])),2);return[...new Map([...c[0],...c[1]].map(t=>[t.id,t])).values()].filter(e=>i.some(n=>{var i,r,o,s;return t.isRunOf(n,e)&&((null==(i=e.options)?void 0:i[ts])===n.nqName||(null==(r=n.package)?void 0:r.name)===(null==(s=e.func)||null==(o=s.package)?void 0:o.name))}))})()},t.listSpace=u,t.listSpaceRuns=c,t.findNameConflict=function(t,e){return tp(function*(){return d((yield u(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[ts])},t.sameRunName=(t,e)=>tm(t)===tm(e),t.isNamedSpaceItem=t=>"FuncCall"!==t.entityType&&"DataConnection"!==t.entityType,t.nameConflictIn=d,t.deleteRun=function(t){return tp(function*(){yield s(t),t.options.isDeleted=!0,yield e.dapi.functions.calls.allPackageVersions().save(t)})()}}(f||(f={}));let tw=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===o.TYPE.STRING&&i?i.substring(1,i.length-1):i};function tC(t,e){e?(w()(t).addClass("ui-box").css({width:"auto",height:"auto"}),r.setUpdateIndicator(t,!0)):(r.setUpdateIndicator(t,!1),w()(t).removeClass("ui-box"))}function tA(t,e,n,i,r,o,s){try{var l=t[o](s),a=l.value}catch(t){n(t);return}l.done?e(a):Promise.resolve(a).then(i,r)}function tx(t){return function(){var e=this,n=arguments;return new Promise(function(i,r){var o=t.apply(e,n);function s(t){tA(o,i,r,s,l,"next",t)}function l(t){tA(o,i,r,s,l,"throw",t)}s(void 0)})}}function tI(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 tE(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 tS extends o.TableView{static fromComparedRuns(t,n){return tx(function*(t,n,i){var s,l;let a,u,c,d,p,h=void 0===i?{parentView:void 0,parentCall:void 0}:i,f=(a=void 0===h?{parentView:void 0,parentCall:void 0}:h,u=[...n.inputs,...n.outputs].map(t=>te(t)).reduce((t,e)=>(t[e.name]?t[e.name].push(...e.config):t[e.name]=e.config,t),{}),c=e=>{if(e.propertyType===o.TYPE.DATA_FRAME)return u[e.name].map(n=>{var i;let r=null!=(i=e.caption)?i:e.name,s=o.Column.fromType(o.TYPE.DATA_FRAME,r,t.length);s.init(n=>{var i;return null!=(i=t[n].inputs[e.name])?i:t[n].outputs[e.name]});let l=d.columns.getUnusedName(`${s.name} (${n.type})`);return s.name=l,r=l,s.temp[T]=n,d.columns.add(s),s});{var n;let i=null!=(n=e.caption)?n:e.name,r=o.Column.fromType(e.propertyType,i,t.length);r.init(n=>{var i;return null!=(i=t[n].inputs[e.name])?i:t[n].outputs[e.name]});let s=d.columns.getUnusedName(r.name);return r.name=s,i=s,d.columns.add(r),[r]}},d=o.DataFrame.create(t.length),p=[],t.forEach(t=>{let e=tu(t)||`${t.func.name} - ${ti(t)}`,n=2;for(;p.includes(e);)e=`${t.func.name} - ${ti(t)} - ${n}`,n++;p.push(e)}),d.columns.add(o.Column.fromStrings(O,p)),d.name=(null==(s=a.parentCall)?void 0:s.func.name)?`${null==(l=a.parentCall)?void 0:l.func.name} - comparison`:`${n.name} - comparison`,n.inputs.forEach(t=>c(t)),n.outputs.forEach(t=>c(t)),e.events.onCurrentObjectChanged.subscribe(t=>{let n=t.sender;if(n instanceof o.Column&&n.type===o.TYPE.DATA_FRAME&&e.shell.tv&&e.shell.tv.temp.isComparison&&[o.VIEWER.LINE_CHART,o.VIEWER.SCATTER_PLOT,o.VIEWER.HISTOGRAM,o.VIEWER.BOX_PLOT].includes(n.temp[T].type)){e.shell.windows.showContextPanel=!0;let t=t=>{let e=t.get(0).clone();e.columns.addNew(P,o.TYPE.STRING).init(t.dataFrame.get(O,0));for(let n=1;n<t.length;n++){let i=t.get(n).clone();i.columns.addNew(P,o.TYPE.STRING).init(t.dataFrame.get(O,n));let r=[o.COLUMN_TYPE.INT,o.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&&r.includes(n.type)&&r.includes(s.type)&&(n.type!==o.COLUMN_TYPE.FLOAT&&i.columns.replace(n,n.convertTo(o.COLUMN_TYPE.FLOAT)),s.type!==o.COLUMN_TYPE.FLOAT&&e.columns.replace(s,s.convertTo(o.COLUMN_TYPE.FLOAT)))}e.append(i,!0)}return e},i=n.temp[T].look;setTimeout(()=>{switch(n.temp[T].type){case o.VIEWER.LINE_CHART:let s=r.waitBox(()=>ty(function*(){var e;let r=null!=(e=n.temp.unitedDf)?e:t(n);return n.temp.unitedDf=r,r.plot.line(tb(tg({},i),{split:P})).root})());w()(s).css({width:"100%"}),e.shell.o=s;break;case o.VIEWER.SCATTER_PLOT:let l=r.waitBox(()=>ty(function*(){var e;let r=null!=(e=n.temp.unitedDf)?e:t(n);return n.temp.unitedDf=r,r.plot.scatter(tb(tg({},i),{color:P})).root})());e.shell.o=l,w()(l).css({width:"100%"});break;case o.VIEWER.HISTOGRAM:let a=r.waitBox(()=>ty(function*(){var e;let r=null!=(e=n.temp.unitedDf)?e:t(n);return n.temp.unitedDf=r,r.plot.histogram(tb(tg({},i),{split:P})).root})());e.shell.o=a,w()(a).css({width:"100%"});break;case o.VIEWER.BOX_PLOT:let u=r.waitBox(()=>ty(function*(){var e;let r=null!=(e=n.temp.unitedDf)?e:t(n);return n.temp.unitedDf=r,r.plot.box(tb(tg({},i),{category:P})).root})());e.shell.o=u,w()(u).css({width:"100%"})}})}}),d),m=[...e.shell.views].find(t=>t.type===R||"scripts"===t.type||"functions"===t.type);return m&&(e.shell.v=m),new this(f,h)}).apply(this,arguments)}showAllColumns(){let t=this.dataFrame.columns.names();this.grid.columns.setVisible(t)}showChangingColumns(){let t=this.dataFrame.columns.names().filter(t=>o.TYPES_SCALAR.has(this.dataFrame.getCol(t).type)&&this.dataFrame.getCol(t).categories.length>1||!o.TYPES_SCALAR.has(this.dataFrame.getCol(t).type));this.grid.columns.setVisible(t)}defaultCustomize(){let t=r.iconFA("compress-alt",()=>{this.showChangingColumns(),w()(n).show(),w()(t).hide()},"Hide constant parameters"),n=r.iconFA("expand-arrows-alt",()=>{this.showAllColumns(),w()(n).hide(),w()(t).show()},"Show all parameters");w()(t).hide(),this.setRibbonPanels([...this.getRibbonPanels(),[t,n]]),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(O).width=70;for(let t=0;t<this.grid.columns.length;t++){var i;let e=this.grid.columns.byIndex(t);(null==(i=e.column)?void 0:i.temp[T])&&(e.width=350,e.cellType="html")}let s=new o.LruCache;this.grid.onCellPrepare(t=>tx(function*(){if(!t.isColHeader&&!t.isRowHeader){if(t.tableColumn.name===O){t.customText="";let e=String(t.cell.value).split(" - "),n=e.length>1?[e[0],r.element("br"),e[1]]:e;t.element=r.div(n,{style:{writingMode:"vertical-rl",textOrientation:"mixed",margin:"auto"}}),t.element.parentElement.style.display="flex";return}if(t.tableColumn&&t.tableColumn.temp[T]){let e=t.cell.value,n=t.tableColumn.temp[T],i=n.type,r=`${e.id}_${i}`;if(s.get(r))t.element=s.get(r);else{let l=yield tx(function*(){let r=Object.values(S).includes(i)?o.Viewer.fromType(i,e):yield e.plot.fromType(i);return t.tableColumn.temp[T].look?r.setOptions(t.tableColumn.temp[T].look):(r.setOptions(n),t.tableColumn.temp[T]=r.getOptions()),r.root})();s.set(r,l),t.element=l}t.element.style.width="100%",t.element.style.height="100%"}}})());let l=r.box(r.div([],{style:{minHeight:"100px"}})),a=e.events.onCurrentViewChanged.subscribe(()=>{e.shell.v.id===this.id?e.shell.dockManager.dock(l,"down",null,"Comparison chart",.25):e.shell.dockManager.close(l)}),u=this.grid.onCellClick.subscribe(t=>{var n;e.shell.v.id===this.id&&t.isColHeader&&(null==(n=t.tableColumn)?void 0:n.type)===o.TYPE.DATA_FRAME&&[o.VIEWER.LINE_CHART,o.VIEWER.SCATTER_PLOT,o.VIEWER.HISTOGRAM,o.VIEWER.BOX_PLOT].includes(t.tableColumn.temp[T].type)?(e.shell.dockManager.findNode(l)||e.shell.dockManager.dock(l,"down",null,"Comparison chart",.25),r.setUpdateIndicator(l,!0),setTimeout(()=>{if(!t.tableColumn.temp.unitedPlot){var e;let n=t.tableColumn.temp[T].look,i=(t=>{let e=o.toJs(t.get(0)).clone();e.columns.addNew(P,o.TYPE.STRING).init(t.dataFrame.get(O,0));for(let n=1;n<t.length;n++){let i=o.toJs(t.get(n)).clone();i.columns.addNew(P,o.TYPE.STRING).init(t.dataFrame.get(O,n));let r=[o.COLUMN_TYPE.INT,o.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&&r.includes(n.type)&&r.includes(s.type)&&(n.type!==o.COLUMN_TYPE.FLOAT&&i.columns.replace(n,n.convertTo(o.COLUMN_TYPE.FLOAT)),s.type!==o.COLUMN_TYPE.FLOAT&&e.columns.replace(s,s.convertTo(o.COLUMN_TYPE.FLOAT)))}e.append(i,!0)}return e})(t.tableColumn);t.tableColumn.temp.unitedPlot=((e,n,i)=>{var r;switch(null==(r=t.tableColumn)?void 0:r.temp[T].type){case o.VIEWER.LINE_CHART:return i.plot.line(tE(tI({},n),{split:P})).root;case o.VIEWER.SCATTER_PLOT:return i.plot.scatter(tE(tI({},n),{color:P})).root;case o.VIEWER.HISTOGRAM:return i.plot.histogram(tE(tI({},n),{split:P})).root;case o.VIEWER.BOX_PLOT:return i.plot.box(tE(tI({},n),{category:P})).root}})(null==(e=t.tableColumn)||e.temp[T].type,n,i),r.setUpdateIndicator(l,!1)}r.empty(l),l.appendChild(t.tableColumn.temp.unitedPlot)},10)):e.shell.dockManager.close(l)});this.subs.push(u,a)}constructor(t,n){let i=void 0===n?{}:n;super(window.grok_TableView(t.dart,!1)),i.parentView&&(this.parentView=i.parentView),this.parentCall=i.parentCall||e.functions.getCurrentCall()}}var tR=n(2),tT=n.n(tR),tO=n(611),tP=n.n(tO),tF=n(129),tV=n.n(tF),tB=n(986),tD=n.n(tB),tk=n(838),tj=n.n(tk),tL=n(515),tM=n.n(tL),tN=n(76),t_={};function tU(t,e,n,i,r,o,s){try{var l=t[o](s),a=l.value}catch(t){n(t);return}l.done?e(a):Promise.resolve(a).then(i,r)}function tH(t){return function(){var e=this,n=arguments;return new Promise(function(i,r){var o=t.apply(e,n);function s(t){tU(o,i,r,s,l,"next",t)}function l(t){tU(o,i,r,s,l,"throw",t)}s(void 0)})}}t_.styleTagTransform=tM(),t_.setAttributes=tD(),t_.insert=tV().bind(null,"head"),t_.domAPI=tP(),t_.insertStyleElement=tj(),tT()(tN.A,t_),tN.A&&tN.A.locals&&tN.A.locals;let t$="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";class tW extends o.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=>tH(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",()=>tH(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=>tH(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 o=void 0===i?t$:i;super(r.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=o,this.uploadedFile$=new s.Subject,this.onFileUploaded=this.uploadedFile$,this.fileValue=null,this.isValid=new s.BehaviorSubject(!0),this.hiddenInput=document.createElement("input"),this.icon=r.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=r.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=r.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=r.iconFA("cloud-upload",()=>this.hiddenInput.click(),"Choose a file to upload");this.icon.replaceWith(t),this.icon=t}this.value=t}),this.reset()}}function tY(t,e,n,i,r,o,s){try{var l=t[o](s),a=l.value}catch(t){n(t);return}l.done?e(a):Promise.resolve(a).then(i,r)}let tG=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 tq(t){var n;return(n=function*(t,n,i,r,s){let l=void 0===r?[]:r,a=void 0!==s&&s,u="";var c=!0,d=!1,p=void 0;try{for(var h,f=(void 0===n?[]:n)[Symbol.iterator]();!(c=(h=f.next()).done);c=!0){let t=h.value,e=[];t.author&&e.push(`session.user.id="${t.author.id}"`),t.date&&e.push(tG(t.date)),t.text&&e.push(`((options.title like "${t.text}") or (options.annotation like "${t.text}"))`),t.includeDeleted||e.push(tf);let n=e.join(" and ");""!==n&&(""===u?u+=`(${n})`:u+=` or (${n})`)}}catch(t){d=!0,p=t}finally{try{c||null==f.return||f.return()}finally{if(d)throw p}}""!==u&&(u=` and (${u})`);let m=yield e.dapi.functions.calls.allPackageVersions().filter(`func.name="${t}"${u}`).include(`${[...l,"func.package"].join(",")}`).list(void 0===i?{}:i);if((l.includes("inputs")||l.includes("func.params"))&&!a){var v=!0,y=!1,g=void 0;try{for(var b,w=m[Symbol.iterator]();!(v=(b=w.next()).done);v=!0){let t=b.value,n=E()(t.inputParams.values()).filter(e=>e.property.propertyType===o.TYPE.DATA_FRAME&&!!t.inputs[e.name]);var C=!0,A=!1,x=void 0;try{for(var I,S=n[Symbol.iterator]();!(C=(I=S.next()).done);C=!0){let n=I.value;t.inputs[n.name]=yield e.dapi.tables.getTable(t.inputs[n.name])}}catch(t){A=!0,x=t}finally{try{C||null==S.return||S.return()}finally{if(A)throw x}}}}catch(t){y=!0,g=t}finally{try{v||null==w.return||w.return()}finally{if(y)throw g}}}if((l.includes("outputs")||l.includes("func.params"))&&!a){var R=!0,T=!1,O=void 0;try{for(var P,F=m[Symbol.iterator]();!(R=(P=F.next()).done);R=!0){let t=P.value,n=E()(t.outputParams.values()).filter(e=>e.property.propertyType===o.TYPE.DATA_FRAME&&!!t.outputs[e.name]);var V=!0,B=!1,D=void 0;try{for(var k,j=n[Symbol.iterator]();!(V=(k=j.next()).done);V=!0){let n=k.value;t.outputs[n.name]=yield e.dapi.tables.getTable(t.outputs[n.name])}}catch(t){B=!0,D=t}finally{try{V||null==j.return||j.return()}finally{if(B)throw D}}}}catch(t){T=!0,O=t}finally{try{R||null==F.return||F.return()}finally{if(T)throw O}}}return m},function(){var t=this,e=arguments;return new Promise(function(i,r){var o=n.apply(t,e);function s(t){tY(o,i,r,s,l,"next",t)}function l(t){tY(o,i,r,s,l,"throw",t)}s(void 0)})}).apply(this,arguments)}var tJ=n(602),tz={};tz.styleTagTransform=tM(),tz.setAttributes=tD(),tz.insert=tV().bind(null,"head"),tz.domAPI=tP(),tz.insertStyleElement=tj(),tT()(tJ.A,tz),tJ.A&&tJ.A.locals&&tJ.A.locals;let tK="experimental",tZ="ModelStorage",tX="Source",tQ="Is favorite",t0="Is complete",t1="Delete",t2="Author",t3="Date",t5="Title",t4="Desc.",t6="Tags",t8="Version",t7=Object.values(o.COLUMN_TYPE).filter(t=>t!==o.TYPE.DATA_FRAME);var t9=n(474),et=n.n(t9);function ee(t,e,n,i,r,o,s){try{var l=t[o](s),a=l.value}catch(t){n(t);return}l.done?e(a):Promise.resolve(a).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){ee(o,i,r,s,l,"next",t)}function l(t){ee(o,i,r,s,l,"throw",t)}s(void 0)})}}function ei(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 er extends o.Dialog{static forFuncCall(t,e){var n,i,r;let o=null!=(n=t.options.title)?n:"";return new er({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,s.race)(this.onMetadataEdit,this.onClose.pipe((0,l.map)(()=>null))).pipe((0,l.take)(1));return this.show(ei({center:!0,width:500},t)),e.toPromise()}constructor(t){var n,i,l,a,u;super(r.dialog({title:"Save model state"}).dart),n=this,this._onMetadataEdit=new s.Subject,this.onMetadataEdit=this._onMetadataEdit.asObservable();let c=null!=(i=null==t?void 0:t.title)?i:"",d=null!=(l=null==t?void 0:t.description)?l:"",p=null!=(a=null==t?void 0:t.isFavorite)&&a;const h=r.input.string("Title",{value:c,onValueChanged:t=>c=t}),f=r.input.string(" ",{value:""}),m=o.TagEditor.create();(null!=(u=null==t?void 0:t.tags)?u:[]).forEach(t=>{m.addTag(t)}),f.input.replaceWith(m.root);const v=()=>{""===y.value||m.tags.includes(y.value)||(m.addTag(y.value),y.value="")},y=r.input.string("Tag",{value:""}).addOptions(r.iconFA("plus",v,"Add this tag")),g=(0,s.fromEvent)(y.input,"onkeydown").subscribe(t=>{"Enter"==t.key&&(t.stopPropagation(),v())});this.sub(g);const b=r.input.string("Description",{value:d,onValueChanged:t=>d=t}),w=r.input.bool("Is favorite",{value:p,onValueChanged:t=>p=t});this.add(r.form([h,b,w,y,f])),this.addButton("Save",()=>en(function*(){if(""!==y.value)return void e.shell.info(`Dialog has unsaved tags: ${y.value}`);let t={title:""!==c?c:null,description:""!==d?d:null,isFavorite:p,tags:m.tags.map(t=>t)};n._onMetadataEdit.next(t),n.close()})())}}class eo extends o.Dialog{awaitDelete(t){let e=(0,s.race)(this.onFuncCallDelete,this.onClose.pipe((0,l.map)(()=>null))).pipe((0,l.take)(1));return this.show(ei({center:!0,width:500},t)),e.toPromise()}constructor(t){var e;super(r.dialog({title:`Delete ${t.size>1?t.size:""} ${t.size>1?"runs":"run"}`}).dart),e=this,this._onFuncCallDelete=new s.Subject,this.onFuncCallDelete=this._onFuncCallDelete.asObservable(),this.add(r.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(()=>en(function*(){return e._onFuncCallDelete.next(t)})())}}function es(t,e,n,i,r,o,s){try{var l=t[o](s),a=l.value}catch(t){n(t);return}l.done?e(a):Promise.resolve(a).then(i,r)}function el(t){return function(){var e=this,n=arguments;return new Promise(function(i,r){var o=t.apply(e,n);function s(t){es(o,i,r,s,l,"next",t)}function l(t){es(o,i,r,s,l,"throw",t)}s(void 0)})}}let ea=(t,n)=>el(function*(){let i=`${tZ}_${t.func.name}_Fav`;return n?e.dapi.userDataStorage.postValue(i,t.id,""):e.dapi.userDataStorage.remove(i,t.id)})(),eu=(t,e)=>{var n,i;return null!=(n=null!=(i=null==e?void 0:e.visibleProps)?i:Z(t.options,"mainParams"))?n:t.inputs.filter(t=>t7.includes(t.propertyType)).map(t=>t.name)},ec=t=>t.replace(/([A-Z])/g,t=>` ${t.toLowerCase()}`).trim().replace(/^./,t=>t.toUpperCase()),ed=(t,e)=>{var n,i,r,o,s,l,a;if(e===t2)return null!=(n=null==(a=t.author)?void 0:a.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!=(l=null==u?void 0:u.toString())?l:""};function ep(t){return t&&t.root&&t.onInput}function eh(t){return(null==t?void 0:t.setValidation)&&ep(t)}function ef(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)&&ep(t)}function em(t,e,n,i,r,o,s){try{var l=t[o](s),a=l.value}catch(t){n(t);return}l.done?e(a):Promise.resolve(a).then(i,r)}function ev(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 ey(t){var e;return!(null==t||null==(e=t.errors)?void 0:e.length)&&!(null==t?void 0:t.pending)}function eg(t,e){return{description:t,actions:e}}function eb(t){var e,n,i;let r=t=>"string"==typeof t?eg(t):t;return{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 ew(...t){let e=[],n=[],i=[],r=[],o={};var s=!0,l=!1,a=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=ev({},o,null!=(h=t.context)?h:{}))}}catch(t){l=!0,a=t}finally{try{s||null==m.return||m.return()}finally{if(l)throw a}}return{errors:e,warnings:n,notifications:i,revalidate:r,context:o}}function eC(){return{pending:!0}}function eA(t,e,n){return ev({revalidate:t,context:e},n)}function ex(t){var e,n;let i,o,s;return(null==t?void 0:t.pending)&&(o=r.iconFA("spinner",()=>{eI(t,o,i)},"Validating")).classList.add("fa-spin"),(null==t?void 0:t.errors)&&t.errors.length?(o=r.iconFA("exclamation-circle",()=>{eI(t,o,i)},"Validation")).style.color="var(--red-3)":(null==t?void 0:t.warnings)&&t.warnings.length?(o=r.iconFA("exclamation-circle",()=>{eI(t,o,i)},"Validation")).style.color="var(--orange-2)":(null==t?void 0:t.notifications)&&t.notifications.length&&((o=r.iconFA("info-circle",()=>{eI(t,o,i)},"Info")).style.color="var(--blue-1)"),o&&(o.classList.remove("fal"),o.classList.add("far"),e=o,(n=s=r.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!=o?o:r.div(),null!=i?i:r.div()]}function eI(t,e,n){if(n&&e){var i,o;let s;for(i=e,o=n,s=i.getBoundingClientRect().toJSON(),o.style.inset="unset",o.style.top=s.y+"px",o.style.left=s.x+20+"px";n.firstChild&&n.removeChild(n.firstChild););let l=function(t){let e=r.divV([],{style:{gap:"10px"}});for(let u=0,c=["errors","warnings","notifications"];u<c.length;u++){let d=c[u],p=t[d];if(null==p?void 0:p.length){var n=!0,i=!1,o=void 0;try{for(var s,l,a=p[Symbol.iterator]();!(n=(l=a.next()).done);n=!0){let t=l.value,n=function(t){let e;return"errors"===t?(e=r.iconFA("exclamation-circle")).style.color="var(--red-3)":"warnings"===t?(e=r.iconFA("exclamation-circle")).style.color="var(--orange-2)":"notifications"===t&&((e=r.iconFA("info-circle")).style.color="var(--blue-1)"),e&&(e.classList.remove("fal"),e.classList.add("far")),e}(d);n.style.marginRight="4px",e.appendChild(r.divV([r.divH([n,r.span([t.description])]),...(null!=(s=t.actions)?s:[]).map(t=>r.link(t.actionName,t.action,void 0,{style:{paddingLeft:"20px"}}))]))}}catch(t){i=!0,o=t}finally{try{n||null==a.return||a.return()}finally{if(i)throw o}}}}return e}(t);n.appendChild(l),n.showPopover()}}let eE="restrictedValues",eS="editState";(u=m||(m={})).INPUT="Input",u.OUTPUT="Output",(c=v||(v={})).HIDDEN="hidden",c.VISIBLE="visible",(d=y||(y={})).ENABLED="enabled",d.DISABLED="disabled",(p=g||(g={})).INPUTS="inputs",p.OUTPUTS="outputs";let eR={[g.INPUTS]:"inputParams",[g.OUTPUTS]:"outputParams"};function eT(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 eO(t,e,n,i,r,o,s){try{var l=t[o](s),a=l.value}catch(t){n(t);return}l.done?e(a):Promise.resolve(a).then(i,r)}function eP(t){return function(){var e=this,n=arguments;return new Promise(function(i,r){var o=t.apply(e,n);function s(t){eO(o,i,r,s,l,"next",t)}function l(t){eO(o,i,r,s,l,"throw",t)}s(void 0)})}}function eF(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,l=!1;try{for(r=r.call(t);!(s=(n=r.next()).done)&&(o.push(n.value),!e||o.length!==e);s=!0);}catch(t){l=!0,i=t}finally{try{s||null==r.return||r.return()}finally{if(l)throw i}}return o}}(t,e)||function(t,e){if(t){if("string"==typeof t)return eT(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 eT(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 eV(t){return t.dart&&o.toJs(t.dart)instanceof o.InputBase}let eB=t=>eP(function*(){let e=t.id,n=o.Func.byName(t.func.nqName).prepare([...t.inputs].reduce((t,e)=>{let n=eF(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 eD(t,e){return eP(function*(){let n={};var i=!0,r=!1,s=void 0;try{for(var l,a=Object.entries(t.inputs)[Symbol.iterator]();!(i=(l=a.next()).done);i=!0){let t=eF(l.value,2),i=t[0],r=t[1],s=e.funcCall.inputParams[i].property;n[i]=yield function(t,e,n){return eP(function*(){if("file"===t.propertyType&&n.getInput){let e=n.getInput(t.name).value;return e instanceof o.FileInfo?(yield e.readAsBytes()).buffer:yield e.arrayBuffer()}return e})()}(s,r,e)}}catch(t){r=!0,s=t}finally{try{i||null==a.return||a.return()}finally{if(r)throw s}}return{inputs:n,outputs:t.outputs}})()}function ek(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 ej(t,e,n,i,r,o,s){try{var l=t[o](s),a=l.value}catch(t){n(t);return}l.done?e(a):Promise.resolve(a).then(i,r)}function eL(t){return function(){var e=this,n=arguments;return new Promise(function(i,r){var o=t.apply(e,n);function s(t){ej(o,i,r,s,l,"next",t)}function l(t){ej(o,i,r,s,l,"throw",t)}s(void 0)})}}function eM(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}x().extend(et());let eN=new o.LruCache;class e_ extends o.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,n){let i=er.forFuncCall(t,n);i.onMetadataEdit.pipe((0,l.take)(1)).subscribe(i=>eL(function*(){var r;if(null==(r=this.options)?void 0:r.isHistory)try{!!i.isFavorite!==n&&(yield ea(t,!!i.isFavorite));let e=yield f.shallowLoadRun(t.id);i.title&&(e.options.title=i.title),i.description&&(e.options.description=i.description),i.tags&&(e.options.tags=i.tags),yield f.updateRunMeta(e),this.updateRun(e),this.onMetadataEdit.next(e)}catch(t){e.shell.error(t)}else this.updateRun(t)}).call(this)),i.show({center:!0,width:500})}isFavoriteByIndex(t){return this.currentDf.get(tQ,t)}setGridCellRendering(){var t,n,i,o,s;let a=t=>{let e=this.getRunByIdx(t.tableRowIndex);this.showEditDialog(e,this.isFavoriteByIndex(t.tableRowIndex))},u=t=>{let n=new Set([this.getRunByIdx(t.tableRowIndex)]),i=new eo(n);i.onFuncCallDelete.pipe((0,l.take)(1)).subscribe(()=>eL(function*(){r.setUpdateIndicator(this.root,!0);try{yield Promise.all(E()(n.values()).map(t=>eL(function*(){return yield this.deleteRun(t.id),Promise.resolve()}).call(this)))}catch(t){e.shell.error(t)}finally{r.setUpdateIndicator(this.root,!1)}}).call(this)),i.show({center:!0,width:500})},c=t=>{let e=this.getRunByIdx(t.tableRowIndex);ea(e,!0).then(()=>this.updateRun(e))},d=t=>{let e=this.getRunByIdx(t.tableRowIndex);ea(e,!1).then(()=>this.updateRun(e))};i=this._historyGrid,o=this.runs,s=null!=(t=null==(n=this.options)?void 0:n.showActions)&&t,i.onCellPrepare(t=>{var n,l,p,h,f,m,v,y,g,b;if(t.isColHeader&&(null==(n=t.tableColumn)?void 0:n.name)&&[t1,tX,tQ].includes(t.tableColumn.name)&&(t.customText=""),!t.isColHeader){if((null==(l=t.tableColumn)?void 0:l.name)===t1&&(t.customText="",t.element=r.divH([r.iconFA("trash",()=>u(t),"Remove run from history"),r.iconFA("edit",()=>a(t),"Edit run metadata")],{style:{padding:"6px",gap:"6px",justifyContent:"space-between"}})),(null==(p=t.tableColumn)?void 0:p.name)===tQ){t.customText="";let e=r.iconFA("star",()=>d(t),"Unfavorite");w()(e).addClass("fas"),t.element=r.div(t.cell.value?e:r.iconFA("star",()=>c(t),"Favorite"),{style:{padding:"6px"}})}if((null==(h=t.tableColumn)?void 0:h.name)===tX){t.customText="";let e=r.iconFA("flask",null,"Experimental run");w()(e).addClass("fad fa-sm"),w()(e).removeClass("fal"),t.element=t.cell.value&&"Experimental"===t.cell.value?r.div(e,{style:{padding:"6px"}}):r.div()}if((null==(f=t.tableColumn)?void 0:f.name)===t6){t.customText="";let e=t.cell.value.length>0?r.div(null==(v=t.cell.value)?void 0:v.split(",").map(t=>r.span([t],"d4-tag")),"d4-tag-editor"):r.div();w()(e).css({padding:"3px","background-color":"transparent"}),t.element=e}if((null==(m=t.tableColumn)?void 0:m.name)==="ID"){let n,l;t.customText="";let p=(n=t.tableRowIndex,o.get(i.dataFrame.get("ID",n)));if(!p)return;let h=p.author.picture;w()(h).css({width:"25px",height:"25px",fontSize:"20px"}),r.bind(p.author,h);let f=r.iconFA("flask",null,"Experimental run");f.classList.add("fad","fa-sm"),f.classList.remove("fal"),f.style.marginLeft="3px";let m=p.options.immutable_tags,v=r.span([r.label(null!=(y=null!=(g=p.options.title)?g:null==(b=p.author)?void 0:b.friendlyName)?y:e.shell.user.friendlyName,{style:{color:"var(--blue-1)"}}),...m&&m.includes(tK)?[f]:[]]),C=r.iconFA("edit",e=>{e.stopPropagation(),a(t)},"Edit run metadata");C.classList.add("hp-funccall-card-icon","hp-funccall-card-hover-icon");let A=r.iconFA("trash-alt",e=>el(function*(){e.stopPropagation(),u(t)})(),"Delete run");A.classList.add("hp-funccall-card-icon","hp-funccall-card-hover-icon");let x=r.iconFA("star",e=>{e.stopPropagation(),d(t)},"Unfavorite");x.classList.add("fas","hp-funccall-card-icon");let I=r.iconFA("star",e=>{e.stopPropagation(),c(t)},"Favorite");I.classList.add("hp-funccall-card-icon","hp-funccall-card-hover-icon"),(l=t.tableRowIndex,i.dataFrame.get(tQ,l))?(r.setDisplay(I,!1),r.setDisplay(x,!0)):(r.setDisplay(x,!1),r.setDisplay(I,!0));let E=ti(p),S=r.divH([r.divH([h,r.divV([v,r.span([E]),...p.options.tags&&p.options.tags.length>0?[r.div(p.options.tags.map(t=>r.span([t],"d4-tag")))]:[]],"hp-card-content")]),r.divH([...s?[x,I,C,A]:[]])],"hp-funccall-card"),R=t.tableRowIndex;S.addEventListener("mouseover",()=>{t.grid.dataFrame.mouseOverRowIdx=R}),S.addEventListener("click",e=>{e.shiftKey?t.grid.dataFrame.selection.set(R,!0):e.ctrlKey?t.grid.dataFrame.selection.set(R,!1):t.grid.dataFrame.currentRowIdx=R}),t.element=S}}})}deleteRun(t){return eL(function*(){return f.shallowLoadRun(t).then(t=>eL(function*(){var e;return[(yield(null==(e=this.options)?void 0:e.isHistory)?f.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 ek(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 ek(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=>{ea(t,!1)}).catch(t=>{e.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,r,s)=>{var l;let a,u,c,d,p,h;s&&t.setOptions({showCurrentRowIndicator:!0,showCurrentCellOutline:!1,allowEdit:!1,allowBlockSelection:!1,showRowHeader:!1,showColumnLabels:!e,extendLastColumn:e}),t.sort([t3],[!1]);for(let e=0;e<t.columns.length;e++){let n=t.columns.byIndex(e);n&&(null==(l=n.column)?void 0:l.type)===o.TYPE.DATE_TIME&&(n.format="MMM d, h:mm tt")}if((a=t.columns.byName(t1))&&(a.cellType="html",a.width=45),(u=t.columns.byName(tQ))&&(u.cellType="html",u.width=30),(c=t.columns.byName(tX))&&(c.cellType="html",c.width=30),(d=t.columns.byName(t6))&&(d.cellType="html",d.width=90),(p=t.columns.byName(t3))&&(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(t6);t.columns.setVisible([tX,tQ,t1,...i?[t3]:[],...i?[t2]:[],...i&&e.stats.missingValueCount<e.length?[t6]:[],...i?[t5]:[],...i?[t4]:[],...n&&r?eu(r).map(t=>{var e,n;let i=null!=(e=r.inputs.find(e=>e.name===t))?e:r.outputs.find(e=>e.name===t);return i?null!=(n=i.caption)?n:ec(i.name):ec(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,o,s,l,a,u;let c,d,p,h=null==(e=this.runs.values().next().value)?void 0:e.func;(i=this._historyFilters,o=this.showMetadataIcon.value,s=this.showInputsIcon.value,l=null!=(t=null==(n=this.options)?void 0:n.isHistory)&&t,d=(c=i.dataFrame).getCol(t6),(p=[...o&&c.getCol(tX).categories.length>1?[tX]:[],...o&&(null!=(a=null==(u=c.col(tQ))?void 0:u.categories.length)?a:0)>1?[tQ]:[],...o?[t3,t0]:[],...o&&c.getCol(t2).categories.length>1?[t2]:[],...o&&d.stats.missingValueCount<d.length?[t6]:[],...o&&c.getCol(t5).categories.length>1?[t5]:[],...o&&c.getCol(t4).categories.length>1?[t4]:[],...h&&s?eu(h).map(t=>{var e,n;let i=null!=(e=h.inputs.find(e=>e.name===t))?e:h.outputs.find(e=>e.name===t);return i?null!=(n=i.caption)?n:ec(i.name):ec(t)}).filter(t=>!l||c.getCol(t).categories.length>1).map(t=>t):[]]).length>0?(r.setDisplay(i.root,!0),i.setOptions({columnNames:p,showHeader:!1,showBoolCombinedFilter:!0})):r.setDisplay(i.root,!1),p.length>0)?(w()(this.filterWithText).css({paddingTop:"10px"}),r.setDisplay(this.defaultFiltersText,!1)):r.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,n){var i,a,u,c,d,p,h,m;super(r.div([],{style:{height:"100%",width:"100%"}})),i=this,this.initialRuns=t,this.options=n,this.onRunsChanged=new s.BehaviorSubject(this.initialRuns.reduce((t,e)=>(t.set(e.id,e),t),new Map)),this._onRunsDfChanged=new s.BehaviorSubject(o.DataFrame.fromColumns([o.Column.bool(tX,0),...(null==(c=this.options)?void 0:c.isHistory)?[o.Column.bool(tQ,0)]:[],...(null==(d=this.options)?void 0:d.showActions)?[o.Column.string(t1,0)]:[],o.Column.bool(t0,0),o.Column.dateTime(t3,0),o.Column.string(t2,0),o.Column.string(t6,0),o.Column.string(t5,0),o.Column.string(t4,0),o.Column.fromStrings("ID",[])])),this._historyFilters=o.Viewer.filters(this._onRunsDfChanged.value,{title:"Filters",columnNames:[]}),this._historyGrid=o.Viewer.grid(this._onRunsDfChanged.value,{showRowHeader:!1,showColumnGridlines:!1,allowEdit:!1}),this.onComparisonCalled=new s.Subject,this.onMetadataEdit=new s.Subject,this._onChosen=new s.BehaviorSubject(null),this.onDelete=new s.Subject,this._onSelectedChanged=new s.BehaviorSubject(new Set([])),this.layout=r.splitH([],null,!0),this.defaultGridText=r.divText(null!=(a=null==(p=this.options)?void 0:p.fallbackText)?a:"No historical runs found","hp-no-elements-label"),this.defaultFiltersText=r.divText("No filters to show","hp-no-elements-label"),this.filterWithText=r.divH([this.defaultFiltersText,this._historyFilters.root],"ui-box"),this.trashIcon=r.div(r.iconFA("trash-alt",()=>{let t=this.currentDf.selection.getSelectedIndexes(),n=new Set;t.forEach(t=>n.add(this.getRunByIdx(t)));let o=new eo(n);o.onFuncCallDelete.pipe((0,l.take)(1)).subscribe(t=>eL(function*(){r.setUpdateIndicator(i.root,!0);try{yield Promise.all(E()(t.values()).map(t=>eL(function*(){return yield i.deleteRun(t.id),Promise.resolve()})()))}catch(t){e.shell.error(t)}finally{r.setUpdateIndicator(i.root,!1)}})()),o.show({center:!0,width:500,modal:!0})},"Delete selected runs"),{style:{paddingTop:"5px"}}),this.compareIcon=r.div(r.iconFA("exchange",()=>eL(function*(){let t=i.currentDf.selection.getSelectedIndexes(),e=[];t.forEach(t=>{e.push(i.currentDf.getCol("ID").get(t))}),i.onComparisonCalled.next(e)})(),"Compare selected runs"),{style:{paddingTop:"5px"}}),this._isFilterHidden=new s.BehaviorSubject(!1),this.showFiltersIcon=r.div(r.iconFA("filter",()=>{this._isFilterHidden.next(!this._isFilterHidden.value)},"Toggle filters"),{style:{paddingTop:"4px"}}),this._compactMode=new s.BehaviorSubject(null!=(u=null==(h=this.options)?void 0:h.isHistory)&&u),this.toggleCompactMode=r.div(r.iconFA("expand-alt",()=>{this.compactMode=!this.compactMode},"Toggle compact mode"),{style:{paddingTop:"4px"}}),this.showMetadataIcon=r.input.toggle("Metadata",{value:!0,onValueChanged:()=>{this.styleHistoryGrid(),this.styleHistoryFilters()}}),this.showInputsIcon=r.input.toggle("Params",{value:!1,onValueChanged:t=>eL(function*(){var e;0!==i.runs.size&&(t&&(null==(e=i.options)?void 0:e.isHistory)?((yield Promise.all([...i.runs.values()].map(t=>eL(function*(){if(eN.has(t.id))return eN.get(t.id);{let e=yield f.shallowLoadRun(t.id);return eN.set(e.id,e),e}})()))).forEach(t=>{i.runs.set(t.id,t)}),i.onRunsChanged.next(i.runs)):(i.styleHistoryGrid(),i.styleHistoryFilters()))})()});const v=r.divH([r.divH([...(null==n?void 0:n.isHistory)?[this.toggleCompactMode]:[],this.showFiltersIcon,this.showMetadataIcon.root,this.showInputsIcon.root],{style:{gap:"5px",padding:"5px"}}),r.divH((null==(m=this.options)?void 0:m.showBatchActions)?[this.trashIcon,this.compareIcon]:[],{style:{gap:"5px",padding:"5px"}})],{style:{justifyContent:"space-between",padding:"0px 5px"}});v.style.setProperty("overflow-y","hidden","important");const y=r.divV([this.defaultGridText,v,this._historyGrid.root],"ui-box");w()(y).removeClass("ui-div"),w()(y).css("width","100%"),this.root.appendChild(this.layout),r.setDisplayAll([this._historyGrid.root,this._historyFilters.root,this.toggleCompactMode,this.trashIcon,this.compareIcon,this.showFiltersIcon],!1);const g=this.onRunsChanged.subscribe(t=>eL(function*(){if(i.setGridCellRendering(),t.size>0){let n,s,l=yield(n=t.values().next().value.func,s=i.options,el(function*(){var i;let r=[...t.values()],l=t=>t===t3?o.Column.dateTime(ec(t),r.length).init(t=>window.grok_DayJs_To_DateTime(X(r[t])?r[t].started.utc(!0):x().unix(r[t].options.createdOn))):t===t0?o.Column.bool(ec(t),r.length).init(t=>!Q(r[t])):o.Column.fromStrings(ec(t),r.map(e=>{var n,i,r;return null!=(n=null==s||null==(r=s.propFuncs)||null==(i=r[t])?void 0:i.call(r,e))?n:ed(e,t)})),a=Object.keys(null!=(i=yield e.dapi.userDataStorage.get(`${tZ}_${n.name}_Fav`))?i:{}),u=o.DataFrame.fromColumns([o.Column.string(tX,r.length).init(t=>{let e=r[t].options.immutable_tags;return e&&e.includes(tK)?"Experimental":"Simulated"}),...(null==s?void 0:s.isHistory)?[o.Column.bool(tQ,r.length).init(t=>a.includes(r[t].id))]:[],...(null==s?void 0:s.showActions)?[o.Column.string(t1,r.length).init("")]:[],l(t3),l(t0),l(t2),o.Column.string(t6,r.length).init(t=>r[t].options.tags?r[t].options.tags.join(","):""),o.Column.string(t5,r.length).init(t=>r[t].options.title),o.Column.string(t4,r.length).init(t=>r[t].options.description),o.Column.string(t8,r.length).init(t=>r[t].options.version)]);if(eu(n).map(t=>(t=>{var e,i,a;let u=null!=(e=n.inputs.find(e=>e.name===t))?e:n.outputs.find(e=>e.name===t);return u?u.propertyType===o.TYPE.DATE_TIME?o.Column.dateTime(null!=(a=u.caption)?a:ec(u.name),r.length).init(t=>window.grok_DayJs_To_DateTime(r[t].inputs[u.name])):o.Column.fromType(u.propertyType,null!=(i=u.caption)?i:ec(u.name),r.length).init(t=>{var e,n,i;return null!=(e=null==s||null==(i=s.propFuncs)||null==(n=i[u.name])?void 0:n.call(i,r[t]))?e:ed(r[t],u.name)}):l(t)})(t)).forEach(t=>{t.name=u.columns.getUnusedName(t.name),u.columns.add(t,!1)}),u.columns.add(o.Column.fromStrings("ID",r.map(t=>t.id))),!(null==s?void 0:s.allowOtherVersions)&&(null==s?void 0:s.version)){let t=o.BitSet.create(u.rowCount,()=>!1);for(let e=0;e<u.rowCount;e++)(null==s?void 0:s.version)==u.get(t8,e)&&t.set(e,!0);return u.clone(t)}return u})()),a=t.values().next().value.func;r.setDisplayAll([i.defaultGridText,i.defaultFiltersText],!1),r.setDisplayAll([i._historyGrid.root,i._historyFilters.root,i.toggleCompactMode,i.showMetadataIcon.root,i.trashIcon,i.compareIcon,i.showFiltersIcon],!0),r.setDisplay(i.showInputsIcon.root,eu(a,i.options).length>0),i._onRunsDfChanged.next(l)}else r.setDisplayAll([i.defaultGridText,i.defaultFiltersText],!0),r.setDisplayAll([i._historyGrid.root,i._historyFilters.root,i.showMetadataIcon.root,i.showInputsIcon.root,i.toggleCompactMode,i.trashIcon,i.compareIcon,i.showFiltersIcon],!1)})()),b=this._onRunsDfChanged.subscribe(t=>{this._historyFilters.dataFrame=t,this._historyGrid.dataFrame=t,this.currentDf.getCol(t6).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)}),C=this._isFilterHidden.subscribe(t=>{t?(w()(this.showFiltersIcon.firstChild).addClass("fal"),w()(this.showFiltersIcon.firstChild).removeClass("fad"),r.setDisplay(this.filterWithText,!1)):(w()(this.showFiltersIcon.firstChild).addClass("fad"),w()(this.showFiltersIcon.firstChild).removeClass("fal"),w()(this.filterWithText).css(this.compactMode?"height":"width","320px"),w()(this.filterWithText).css(this.compactMode?"width":"height","100%"),r.setDisplay(this.filterWithText,!0))}),A=this._compactMode.subscribe(t=>{let e=[y,this.filterWithText];w()(this.filterWithText).removeClass("ui-div");let n={style:{width:"100%",height:"100%"}};w()(this.toggleCompactMode.firstChild).addClass(t?"fa-expand-alt":"fa-compress-alt"),w()(this.toggleCompactMode.firstChild).removeClass(t?"fa-compress-alt":"fa-expand-alt");let i=t?r.splitV(e,n,!0):r.splitH(e,n,!0);this.layout.replaceWith(i),this.layout=i,r.tools.waitForElementInDom(this.layout).then(t=>{w()(t).css(this.compactMode?"height":"width","100%"),w()(this._historyFilters.root).css(eM({},this.compactMode?{width:"100%"}:{height:"100%"})),w()(this.filterWithText).css(eM({},this.compactMode?{height:"310px",width:"100%"}:{width:"310px",height:"100%"})),w()(y).css(eM({},this.compactMode?{width:"100%"}:{height:"100%"})),setTimeout(()=>{this.styleHistoryGrid(),this.styleHistoryFilters()},100)})});this.subs.push(g,A,b,C)}}function eU(t,e,n,i,r,o,s){try{var l=t[o](s),a=l.value}catch(t){n(t);return}l.done?e(a):Promise.resolve(a).then(i,r)}function eH(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,l,"next",t)}function l(t){eU(o,i,r,s,l,"throw",t)}s(void 0)})}}class e${static getHistoryRuns(t,n){let i=void 0===n||n;return(0,s.from)(eH(function*(){return yield tq(t,[{author:e.shell.user}],{order:"started"},["func.params","session.user","options"],i)})())}}class eW extends o.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 e_([...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,l.filter)(t=>t.rowCount>0),(0,l.take)(1)).subscribe(()=>{this.setCurrentRow()})}getHistoryDialog(){let t=r.dialog();return w()(t.root.querySelector(".d4-dialog-contents")).removeClass("ui-form"),t.onOK(()=>eH(function*(){let t=this._historyList.chosen;if(t){var e,n;(null==(e=null==(n=this.options)?void 0:n.skipDfsOnInit)||e)&&(t=yield f.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"),w()(t.getButton("CANCEL")).hide(),t.add(this._historyList.root),t}setValue(t){var e,n,i,r,o,s,l;(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):[`${ti(t)} \\ ${t.author.name}`,(null!=(i=null!=(r=null==(l=this.options)?void 0:l.mainProps)?r:Z(t.func.options,"mainParams"))?i:[]).map(e=>ed(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,o;const a=r.input.string(t,{value:""});super(a.dart),this.label=t,this._funcName=e,this.options=n,this.onHistoricalRunChosen=new s.BehaviorSubject(null),this.experimentRunsUpdate=new s.Subject,this.store={experimentRuns:new s.Observable,isExperimentRunsLoading:new s.Subject,experimentRunData:new s.BehaviorSubject("")},this._historyList=new e_([],{fallbackText:"No runs are found in history",showActions:!1,showBatchActions:!1,isHistory:!1,visibleProps:null==(i=this.options)?void 0:i.mainProps,propFuncs:null==(o=this.options)?void 0:o.propFuncs}),this._historyDialog=this.getHistoryDialog(),this._visibleInput=r.input.string(this.label,{value:""}),this._visibleIcon=r.iconFA("search",()=>this.showSelectionDialog(),"Search"),this._chosenRun=null,this._chosenRunId=null,this._visibleInput=a,this._visibleInput.readOnly=!0,this._visibleInput.input.addEventListener("click",()=>this.showSelectionDialog()),this._visibleInput.addOptions(this._visibleIcon),this.store.experimentRuns=this.experimentRunsUpdate.pipe((0,l.tap)(()=>this.toggleLoaderExpRuns(!0)),(0,l.switchMap)(()=>{var t,e;return e$.getHistoryRuns(this._funcName,null==(t=null==(e=this.options)?void 0:e.skipDfsOnInit)||t).pipe((0,l.catchError)(t=>(console.error(t),s.EMPTY)),(0,l.finalize)(()=>this.toggleLoaderExpRuns(!1)))}),(0,l.shareReplay)(1)),this.store.experimentRuns.subscribe(t=>{this._historyList.updateRuns(t.filter(t=>!Q(t)))}),this.store.isExperimentRunsLoading.subscribe(t=>{r.setUpdateIndicator(this._visibleInput.root,t),r.setUpdateIndicator(this._historyList.root,t)}),this.experimentRunsUpdate.next()}}class eY extends eW{set value(t){this.setValue(t)}get value(){return this.getValue()}}class eG extends eW{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 eq=n(128),eJ={};function ez(t,e,n,i,r,o,s){try{var l=t[o](s),a=l.value}catch(t){n(t);return}l.done?e(a):Promise.resolve(a).then(i,r)}eJ.styleTagTransform=tM(),eJ.setAttributes=tD(),eJ.insert=tV().bind(null,"head"),eJ.domAPI=tP(),eJ.insertStyleElement=tj(),tT()(eq.A,eJ),eq.A&&eq.A.locals&&eq.A.locals;class eK extends o.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 n;super(r.box(r.divText("No historical runs loaded","hp-no-elements-label"),{style:{width:"100%",height:"100%"}})),n=this,this.func=t,this.onRunChosen=new s.Subject,this.onComparison=new s.Subject,this.afterRunEdited=new s.Subject,this.afterRunDeleted=new s.Subject,this.allRunsFetch=new s.Subject,this.historyList=new e_([],{fallbackText:"No runs are found in history",showActions:!0,showBatchActions:!0,isHistory:!0}),this.panel=this.historyList.root;const i=this.historyList.onChosen.pipe((0,l.filter)(t=>!!t)).subscribe(t=>this.onRunChosen.next(t.id)),o=this.historyList.onComparisonCalled.subscribe(t=>this.onComparison.next(t)),a=this.allRunsFetch.subscribe(()=>{var t;return(t=function*(){r.setUpdateIndicator(n.root,!0),tq(n.func.name,[{author:e.shell.user}],{},["session.user","options"]).then(t=>{r.empty(n.root),n.root.appendChild(n.panel),n.updateHistoryPane(t)}).catch(t=>e.shell.error(t)).finally(()=>r.setUpdateIndicator(n.root,!1))},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,l,"next",t)}function l(t){ez(o,i,r,s,l,"throw",t)}s(void 0)})})()}),u=this.historyList.onMetadataEdit.subscribe(t=>{this.afterRunEdited.next(t)}),c=this.historyList.onDelete.subscribe(t=>{this.afterRunDeleted.next(t)});this.subs.push(i,a,u,o,c),this.allRunsFetch.next()}}function eZ(t,e,n,i,r,o,s){try{var l=t[o](s),a=l.value}catch(t){n(t);return}l.done?e(a):Promise.resolve(a).then(i,r)}function eX(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,l,"next",t)}function l(t){eZ(o,i,r,s,l,"throw",t)}s(void 0)})}}(h=b||(b={})).fileInput=function(t,e,n,i){return new tW(void 0===t?"Drag-n-drop here":t,void 0===e?null:e,void 0===n?null:n,void 0===i?t$:i)},h.historyInput=function(t,e,n){return new eY(t,e,n)},h.historyInputJSON=function(t,e,n){return new eG(t,e,n)},h.historyPanel=function(t){return new eK(t)};let eQ=new URL(e.shell.startUri),e0=()=>eX(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(),o.Utils.download(`Recording ${new Date().toLocaleString("en-us",{month:"short",day:"numeric",hour:"numeric",minute:"numeric"})}.mkv`,e,n[0].type)},e.start()})();class e1 extends o.ViewBase{onFuncCallReady(){return eX(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&&(r.setUpdateIndicator(this.root,!0),this.loadRun(t),r.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=ti(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 e.shell.getVar("isLoaded")?void 0:eQ.searchParams.get("id")}setAsLoaded(){return e.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 eX(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=()=>eX(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=()=>eX(function*(){window.open(r,"_blank")})());let o=`${n.friendlyName}.
|
|
169
|
+
Last updated on ${x()(n.updatedOn).format("YYYY MMM D, HH:mm")}`;this.getAbout||(this.getAbout=()=>eX(function*(){return o})())}).call(this)}linkFunccall(t){this._funcCall=t,this.funcCallReplaced.next(!0)}loadFuncCallById(){return eX(function*(){if(this.initValue instanceof o.FuncCall){yield new Promise(t=>setTimeout(t,0)),this.linkFunccall(this.initValue);return}r.setUpdateIndicator(this.root,!0);let t=this.getStartId();if(t&&!this.options.isTabbed)this.linkFunccall((yield f.loadRun(t)));else{let t=o.Func.byName(this.initValue);this.linkFunccall(t.prepare({}))}r.setUpdateIndicator(this.root,!1)}).call(this)}init(){return eX(function*(){yield this.loadFuncCallById(),yield this.onFuncCallReady(),this.isReady.next(!0)}).call(this)}build(){r.empty(this.root),this.root.appendChild(this.buildIO()),this.options.historyEnabled&&this.isHistoryEnabled&&this.buildHistoryBlock(),this.buildRibbonMenu(),this.buildRibbonPanels()}onComparisonLaunch(t){return eX(function*(){let n=this.comparatorFunc;if(n){let i=o.Func.byName(n),r=(yield i.prepare({params:{comparedRuns:t}}).call()).outputs.comparisonView;e.shell.addView(r);return}let i=e.shell.v.parentCall,r=[...e.shell.views].find(t=>t.type===R),s=yield tS.fromComparedRuns(t,this.func,{parentView:r,parentCall:i});e.shell.addView(s),s.defaultCustomize();let l=this.compareCustomizer;if(l){let t=o.Func.byName(l);yield t.prepare({params:{defaultView:s}}).call();return}}).call(this)}onSaveClick(){return eX(function*(){yield this.saveRun(this.funcCall)}).call(this)}buildHistoryBlock(){let t=b.historyPanel(this.func),n=!1;return this.subs.push(t.onCompactModeChanged.subscribe(t=>{let n=e.shell.dockManager.findNode(this.historyRoot);n&&(e.shell.dockManager.close(n),t?e.shell.dockManager.dock(this.historyRoot,"right",null,"History",.3):e.shell.dockManager.dock(this.historyRoot,"down",null,"History",.3))}),t.onRunChosen.subscribe(t=>eX(function*(){r.setUpdateIndicator(this.root,!0),yield this.loadRun(t),r.setUpdateIndicator(this.root,!1)}).call(this)),t.onComparison.subscribe(e=>eX(function*(){tC(t.root,!0);let n=yield Promise.all(e.map(t=>f.loadRun(t)));yield this.onComparisonLaunch(n),tC(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=ti(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}`}}),e.events.onViewRemoving.subscribe(t=>{if(t.args.view==this){let t=e.shell.dockManager.findNode(this.historyRoot);t?(e.shell.dockManager.close(t),n=!0):n=!1}}),e.events.onCurrentViewChanged.subscribe(()=>{if(e.shell.v==this){if(n){var t;(null==(t=this.historyBlock)?void 0:t.compactMode)?e.shell.dockManager.dock(this.historyRoot,"right",null,"History",.3):e.shell.dockManager.dock(this.historyRoot,"down",null,"History",.3)}}else{let t=e.shell.dockManager.findNode(this.historyRoot);t?(e.shell.dockManager.close(t),n=!0):n=!1}})),r.empty(this.historyRoot),this.historyRoot.style.removeProperty("justify-content"),this.historyRoot.append(t.root),this.historyBlock=t,t.root}buildRibbonPanels(){let t=r.iconFA("history",()=>{if(!e.shell.dockManager.findNode(this.historyRoot)){var t;(null==(t=this.historyBlock)?void 0:t.compactMode)?e.shell.dockManager.dock(this.historyRoot,"right",null,"History",.3):e.shell.dockManager.dock(this.historyRoot,"down",null,"History",.3),this.historyRoot.parentElement.classList.add("ui-box"),this.historyRoot.classList.add("ui-box")}},"History"),n=r.iconFA("save",()=>eX(function*(){yield this.onSaveClick()}).call(this),"Save current state"),i=r.comboPopup(r.iconFA("arrow-to-bottom"),this.getFormats(),this.exportRun.bind(this)),o=r.iconFA("edit",()=>{this.historyBlock&&this.lastCall&&this.historyBlock.showEditDialog(this.historyBlock.history.get(this.funcCall.id))},"Edit this run metadata"),s=this.isHistorical.subscribe(t=>{t?(r.setDisplay(i,!Q(this.funcCall)),r.setDisplay(o,!0)):(w()(i).hide(),w()(o).hide())});if(this.subs.push(s),r.tooltip.bind(i,()=>"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,l.distinctUntilChanged)()).subscribe(t=>{"inconsistent"===t?(w()(i).addClass("d4-disabled"),w()(i.lastChild).css("color","unset")):(w()(i).removeClass("d4-disabled"),w()(i.lastChild).removeProp("color"))});this.subs.push(t)}let a=[[...!this.options.isTabbed&&this.isHistoryEnabled&&this.options.historyEnabled?[t]:[],...!this.options.isTabbed&&this.isHistoryEnabled?[n]:[],...!this.options.isTabbed&&this.isExportEnabled&&this.exportConfig&&this.exportConfig.supportedFormats.length>0?[i]:[],...this.options.isTabbed?[]:[o]]];return this.setRibbonPanels(a),a}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",e0),this.getAbout&&t.item("About",()=>eX(function*(){let t=yield this.getAbout();if(t){let e=r.dialog("Current version");t.split("\n").forEach(t=>e.add(r.label(t))),e.onOK(()=>{}),e.getButton("CANCEL").style.display="none",e.show({center:!0})}}).call(this))}exportRun(t){return eX(function*(){o.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 eX(function*(){})()}onAfterSaveRun(t){return eX(function*(){})()}saveRun(t){return eX(function*(){let e=tt(t);yield this.onBeforeSaveRun(e),Q(e)&&(e=yield eB(t)),e.id&&e.newId();let n=yield f.saveRun(e),i=yield f.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 eX(function*(){})()}onAfterDeleteRun(t){return eX(function*(){})()}deleteRun(t){return eX(function*(){return yield this.onBeforeDeleteRun(t),yield f.deleteRun(t),yield this.onAfterDeleteRun(t),t.id}).call(this)}onBeforeLoadRun(){return eX(function*(){})()}onAfterLoadRun(t){return eX(function*(){})()}loadRun(t){return eX(function*(){yield this.onBeforeLoadRun();let e=yield f.loadRun(t);return this.lastCall=tt(e),this.linkFunccall(e),this.isHistorical.next(!0),yield this.onAfterLoadRun(e),e}).call(this)}onBeforeRun(t){return eX(function*(){})()}onAfterRun(t){return eX(function*(){})()}run(){return eX(function*(){if(!this.funcCall)throw Error("The correspoding function is not specified");yield this.onBeforeRun(this.funcCall);let t=o.TaskBarProgressIndicator.create("Calculating...");try{this.funcCall.newId(),yield this.funcCall.call(),yield this.onAfterRun(this.funcCall),this.lastCall=tt(this.funcCall),!(this.options.isTabbed||this.runningOnInput)&&this.isHistoryEnabled&&(yield this.saveRun(this.funcCall))}catch(t){e.shell.error(t.toString())}finally{t.close()}}).call(this)}exportRunJson(){return eX(function*(){if(this._lastCall)return Y((yield eD(this._lastCall,this)))}).call(this)}getRunJSON(){return eX(function*(){let t=yield this.exportRunJson();t&&o.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 eX(function*(){return z(this.func)}).call(this)}get features(){var t;return null!=(t=Z(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,n){var i,l,a,u,c;let d=void 0===n?{historyEnabled:!0,isTabbed:!1,skipInit:!1}:n;super(),this.initValue=t,this.options=d,this._type="function",this.funcCallReplaced=new s.Subject,this.isReady=new s.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 s.BehaviorSubject(!1),this.historyRoot=r.div(),this.consistencyState=new s.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=e.functions.getCurrentCall(),t instanceof o.FuncCall&&(this.parentCall=t),this.parentView=null==(a=this.parentCall)||null==(l=a.parentCall)||null==(i=l.aux)?void 0:i.view,(null==(c=this.parentCall)||null==(u=c.func)?void 0:u.name)&&(this.basePath=`/${this.parentCall.func.name}`),d.skipInit||this.init()}}var e2=n(902),e3={};function e5(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 e4(t,e,n,i,r,o,s){try{var l=t[o](s),a=l.value}catch(t){n(t);return}l.done?e(a):Promise.resolve(a).then(i,r)}function e6(t){return function(){var e=this,n=arguments;return new Promise(function(i,r){var o=t.apply(e,n);function s(t){e4(o,i,r,s,l,"next",t)}function l(t){e4(o,i,r,s,l,"throw",t)}s(void 0)})}}function e8(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,l=!1;try{for(r=r.call(t);!(s=(n=r.next()).done)&&(o.push(n.value),!e||o.length!==e);s=!0);}catch(t){l=!0,i=t}finally{try{s||null==r.return||r.return()}finally{if(l)throw i}}return o}}(t,e)||function(t,e){if(t){if("string"==typeof t)return e5(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 e5(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.")}()}e3.styleTagTransform=tM(),e3.setAttributes=tD(),e3.insert=tV().bind(null,"head"),e3.domAPI=tP(),e3.insertStyleElement=tj(),tT()(e2.A,e3),e2.A&&e2.A.locals&&e2.A.locals;let e7=Math.ceil(36)+1,e9=(t,e,n)=>{r.setUpdateIndicator(t,e);let i=t.querySelector(".d4-update-shadow .ui-label");e&&n&&i&&(i.textContent=n)},nt=(t,e)=>{try{return Number.isFinite(t)&&e?o.format(t,e):t}catch(e){return t}},ne=(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,nt(e.value,e.format),e.units];r.push(nn(null==n?void 0:n[e.name])),r.push(ni(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},nn=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"),ni=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)?o.format(e,"#0.###"):String(e);return`Inconsistent: value should be ${n}`}},nr=t=>{let e=t.sheet,n=t.df,i=t.column,r=t.row,o=t.validation,s=t.consistency;if(!n)return;let l=e.getColumn(null!=i?i:1).letter,a=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]?nt(e.get(t),c[n]):e.get(t)));let p={name:`ID_${e.workbook.worksheets.reduce((t,e)=>t+e.getTables().length,0)}`,ref:`${l}${null!=r?r:1}`,columns:u.map(t=>({name:t.name,filterButton:!1})),rows:d};a>0&&(e.addTable(p),e.columns.forEach(t=>{t.width=25,t.alignment={wrapText:!0}}));let h=a+1;e.getColumn(h).width=100,e.getCell(1,h).value="Validation and Consistency",o&&(e.getCell(2,h).value=nn(o)),s&&(e.getCell(3,h).value=ni(s))},no=t=>e6(function*(){let e=tn(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(!tn(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 l=e8((null!=(e=n.getAttribute("viewBox"))?e:"").trim().split(/[\s,]+/).map(Number),4),a=l[2],u=l[3];return a>0&&u>0?{width:a,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),l=document.createElement("canvas");return l.width=o,l.height=s,l.getContext("2d").drawImage(n,0,0,o,s),{dataUrl:l.toDataURL("image/png"),width:o,height:s}})(),ns=t=>!t||0===t.rowCount;function nl(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 na(t,e,n,i,r,o,s){try{var l=t[o](s),a=l.value}catch(t){n(t);return}l.done?e(a):Promise.resolve(a).then(i,r)}function nu(t){return function(){var e=this,n=arguments;return new Promise(function(i,r){var o=t.apply(e,n);function s(t){na(o,i,r,s,l,"next",t)}function l(t){na(o,i,r,s,l,"throw",t)}s(void 0)})}}function nc(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 nd(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 np(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,l=!1;try{for(r=r.call(t);!(s=(n=r.next()).done)&&(o.push(n.value),!e||o.length!==e);s=!0);}catch(t){l=!0,i=t}finally{try{s||null==r.return||r.return()}finally{if(l)throw i}}return o}}(t,e)||function(t,e){if(t){if("string"==typeof t)return nl(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 nl(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 nh=()=>r.divText("[No data to display]",{style:{"text-align":"center","align-content":"center",width:"100%",height:"100%"}});class nf extends e1{static fromFuncCall(t,e){return new this(t,void 0===e?{historyEnabled:!0,isTabbed:!1}:e)}onFuncCallReady(){var t=this,n=()=>super.onFuncCallReady;return nu(function*(){yield this.loadInputsOverrides(),yield this.loadValidators(g.INPUTS),yield this.loadValidators(g.OUTPUTS),yield n().call(t);let i=this.funcCallReplaced.subscribe(()=>{this.inputValidationRequests.next({isRevalidation:!1}),this.outputValidationRequests.next({isRevalidation:!1})});this.subs.push(i);let o=t=>(0,l.mergeMap)(e=>e.pipe((0,l.tap)(e=>{t===g.INPUTS?this.setInputValidationPending(e.field):this.setOutputValidationPending(e.field)}),(0,l.switchMap)(e=>{let n=new AbortController,i=n.signal,r=!1;return new s.Observable(o=>{let l=(0,s.from)(this.runValidation(nc({},e),i,t)).subscribe(t=>{r=!0,o.next(t)});return()=>{r||n.abort(),l.unsubscribe()}}).pipe((0,l.tap)(n=>{t===g.INPUTS?this.setInputValidationResults(n):this.setOutputValidationResults(n),this.runRevalidations(e,n,t),t===g.INPUTS?this.inputValidationUpdates.next(null):this.outputValidationUpdates.next(null)}),(0,l.mapTo)(e))}))),a=this.inputValidationRequests.pipe((0,l.groupBy)(t=>t.field),o(g.INPUTS)).subscribe(t=>{t.field&&this.runningOnInput&&this.isRunnable()&&this.doRun()});this.subs.push(a);let u=this.outputValidationRequests.pipe((0,l.groupBy)(t=>t.field),o(g.OUTPUTS)).subscribe();this.subs.push(u);let c=this.externalValidatorsUpdates.subscribe(t=>{this.updateInputValidationResults(t)});this.subs.push(c);let d=(0,s.combineLatest)([this.runRequests.pipe((0,l.switchMap)(()=>(0,s.of)(!1).pipe((0,l.delay)(500),(0,l.startWith)(!0)))),this.inputValidationUpdates.pipe((0,l.debounceTime)(0))]).pipe((0,l.filter)(t=>np(t,1)[0]&&this.isRunnable())).subscribe(()=>this.doRun());this.subs.push(d);let p=this.options.isTabbed?null:yield this.loadLastInputs();if(p)e.shell.info(r.div([r.divText("Do you want to load last inputs?"),r.divH([r.bigButton("Load",()=>{var t=!0,n=!1,i=void 0;try{for(var o,s=Object.entries(p)[Symbol.iterator]();!(t=(o=s.next()).done);t=!0){let t=np(o.value,2),e=t[0],n=t[1],i=this.getInput(e);i.notify=!1,i.value=n,i.notify=!0,this.funcCall.inputs[e]=n,this.inputValidationRequests.next({field:e,isRevalidation:!1})}}catch(t){n=!0,i=t}finally{try{t||null==s.return||s.return()}finally{if(n)throw i}}e.shell.info(r.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=>{w()(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=r.bigButton(null!=(e=this.func.options.runLabel)?e:void 0===t?"Run":t,()=>nu(function*(){return yield this.doRun()}).call(this)),i=(0,s.merge)(this.inputValidationUpdates,this.externalValidatorsUpdates,this.isRunning,this.blockRuns).subscribe(()=>{n.disabled=!this.isRunnable()});return this.subs.push(i),n}loadInputsOverrides(){return nu(function*(){let t=[...this.funcCall.inputParams.values()];yield Promise.all(t.map(t=>nu(function*(){if(t.property.options.input){let e=o.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 nu(function*(t){var e;let n,i=void 0===t?g.INPUTS:t,r=yield(e=this.funcCall,n=void 0===i?g.INPUTS:i,eP(function*(){let t=[...e[eR[n]].values()];return(yield Promise.all(t.filter(t=>!!t.property.options.validatorFunc).map(t=>eP(function*(){let e=o.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=eF(e,2),i=n[0],r=n[1];return t[i]=r,t},{})})());i===g.INPUTS?this.inputValidators=r:this.outputValidators=r}).apply(this,arguments)}keepOutput(){var t;return(null==(t=this.func)?void 0:t.options.keepOutput)==="true"}getSaveButton(t){let e=r.bigButton(void 0===t?"Save":t,()=>nu(function*(){return yield this.saveExperimentalRun(this.funcCall)}).call(this),"Save uploaded data"),n=this.isUploadMode.subscribe(t=>{this.buildRibbonPanels(),t?w()(e).show():w()(e).hide()});return this.subs.push(n),e}getStandardButtons(){let t=this.getRunButton(),e=r.div([t]);r.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=r.buttonsInput();return w()(n.firstChild).css({display:"none"}),null==(t=n.lastChild)||t.replaceWith(r.div([...this.navBtns,...this.additionalBtns,...e],"ui-input-editor")),w()(n).addClass("rfv-buttons"),w()(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,o=t.controlsWrapper,s=[...Array.from(n.childNodes),...this.isUploadMode.value?[Array.from(i.childNodes)]:[]];r.tools.handleResize(e,()=>{300>w()(e).width()?(w()(n).addClass("ui-form-condensed"),w()(i).addClass("ui-form-condensed"),w()(o).addClass("ui-form-condensed"),s.forEach(t=>w()(t).css("min-width","100px"))):(w()(n).removeClass("ui-form-condensed"),w()(i).removeClass("ui-form-condensed"),w()(o).removeClass("ui-form-condensed"),s.forEach(t=>w()(t).css("min-width","100%")))});let l=this.buildOutputBlock();l.style.height="100%",l.style.width="100%",this.hideOutput();let a=r.splitH([e,r.panel([l],{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=r.div(this.formButtons,"ui-form ui-form-wide");w()(n).css({"padding-left":"0px","padding-bottom":"0px","padding-right":"6px","max-width":"100%","min-height":"50px"});let i=r.input.toggle("",{value:this.isUploadMode.value,onValueChanged:t=>this.isUploadMode.next(t)}),o=this.isUploadMode.subscribe(t=>{i.notify=!1,i.value=t,i.notify=!0,t?w()(e).show():w()(e).hide()});return this.subs.push(o),{inputBlock:r.divV([t,...this.hasUploadMode&&!this.uploadFunc?[r.divH([r.h2("Experimental data"),i.root],{style:{flexGrow:"0"}}),e]:[],n],"ui-box rfv-form"),inputForm:t,outputForm:e,controlsWrapper:n}}processCustomDataUpload(){return nu(function*(){let t=()=>{let t=o.Dialog.create({title:"Select to compare"}),e=new e_(d.length>0?d:[...this.historyBlock.history.values()],{fallbackText:"No historical runs found",showActions:!(d.length>0),showBatchActions:!(d.length>0)}),n=new e_(c,{fallbackText:"No runs uploaded",showActions:!1,showBatchActions:!1});t.add(r.divV([r.divV([r.label("Uploaded runs"),r.element("div","splitbar-horizontal"),n.root],{style:{height:"50%",overflowY:"hidden"}}),r.divV([r.label(d.length>0?"Simulated":"History",{style:{padding:"0px 10px 0px 9px"}}),r.element("div","splitbar-horizontal"),e.root],{style:{height:"50%",overflowY:"hidden"}})],{style:{justifyContent:"space-between",gap:"10px",overflowY:"scroll",height:"100%"}})),w()(t.root.querySelector(".d4-dialog-contents")).removeClass("ui-form");let i="Compare selected";return 0===d.length?t.addButton(i,()=>nu(function*(){let i=yield Promise.all([...e.selected].map(t=>f.loadRun(t.id)));this.onComparisonLaunch([...i,...n.selected.values()]),t.close()}).call(this)):t.addButton(i,()=>nu(function*(){this.onComparisonLaunch([...e.selected.values(),...n.selected.values()]),t.close()}).call(this)),t.getButton(i).disabled=!0,this.subs.push((0,s.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(v,()=>nu(function*(){this.onComparisonLaunch([this.funcCall,...n.selected.values()]),t.close()}).call(this)),w()(t.getButton("CANCEL")).hide(),t},n=o.Func.byName(this.uploadFunc),i=yield n.prepare({params:{func:this.func}}).call(),a=i.outputs.uploadWidget,u=i.outputs.uploadFuncCall,c=[],d=[],p=o.Dialog.create({title:"Upload"});w()(p.root.querySelector(".d4-dialog-contents")).removeClass("ui-form");let h=o.Dialog.create({title:"Review uploaded runs"});w()(h.root.querySelector(".d4-dialog-contents")).removeClass("ui-form");let m="Save to history",v="Compare w/ current";p.add(a.root),p.addButton(m,()=>nu(function*(){return tC(p.root,!0),c.forEach(t=>{t.options.immutable_tags?t.options.immutable_tags.push(tK):t.options.immutable_tags=[tK]}),Promise.all(c.map(t=>nu(function*(){let e=yield this.getValidExpRun(t);return f.saveRun(e)}).call(this))).then(t=>Promise.all(t.map(t=>f.loadRun(t.id)))).then(t=>{t.forEach(t=>this.historyBlock.addRun(t))}).catch(t=>{e.shell.error(t)}).finally(()=>{tC(p.root,!1),p.close();let t=new e_(c,{fallbackText:"No runs uploaded",showActions:!0,showBatchActions:!0});h.add(t),h.show({modal:!0,fullScreen:!0})})}).call(this)),p.addButton("Next",()=>{p.close(),c.forEach(t=>{t.options.immutable_tags?t.options.immutable_tags.push(tK):t.options.immutable_tags=[tK]});let t=new e_(c,{fallbackText:"No runs uploaded",showActions:!0,showBatchActions:!0});h.add(t.root),h.show({modal:!0,fullScreen:!0})}),w()(p.getButton("CANCEL")).hide(),p.getButton(m).disabled=!0,p.getButton("Next").disabled=!0,w()(h.getButton("CANCEL")).hide(),h.addButton("Simulate w/ same inputs",()=>{tC(p.root,!0),Promise.all(c.map(t=>nu(function*(){return(yield eB(t)).call()})())).then(e=>{d=e,h.close(),t().show({modal:!0,fullScreen:!0})}).catch(t=>{e.shell.error(t)}).finally(()=>{tC(p.root,!1)})}),h.addButton("Compare w/ history",()=>{h.close(),t().show({modal:!0,fullScreen:!0})});let y=e.functions.onAfterRunAction.pipe((0,l.filter)(t=>t.id===u.id)).subscribe(()=>{c=u.outputs.uploadedCalls,p.getButton(m).disabled=!1,p.getButton("Next").disabled=!1}),g=p.onClose.subscribe(()=>{this.isUploadMode.next(!1)});p.subs.push(g,y),p.show({modal:!0,center:!0,resizable:!0})}).call(this)}onSaveClick(){return nu(function*(){this.isUploadMode.value?yield this.saveExperimentalRun(this.funcCall):yield this.saveRun(this.funcCall)}).call(this)}buildRibbonPanels(){super.buildRibbonPanels();let t=r.iconFA("play",()=>nu(function*(){return yield this.doRun()}).call(this),"Run computations");t.classList.add("fas");let n=r.iconFA("arrow-to-top",()=>nu(function*(){this.uploadFunc?yield this.processCustomDataUpload():(this.isUploadMode.next(!this.isUploadMode.value),n.classList.toggle("d4-current"))}).call(this),"Upload experimental data");n.classList.add("d4-toggle-button",...this.isUploadMode.value?["d4-current"]:[]);let i=r.iconFA("info",()=>nu(function*(){this.hasContextHelp&&(e.shell.windows.help.visible=!0,yield new Promise(t=>setTimeout(t,100)),e.shell.windows.help.showHelp(r.markdown((yield this.getContextHelp()))))}).call(this),"Info"),o=[[...super.buildRibbonPanels().flat(),...this.runningOnInput||this.options.isTabbed?[]:[t],...this.hasUploadMode?[n]:[],...!this.options.isTabbed&&this.hasContextHelp?[i]:[]]];return this.setRibbonPanels(o),o}showOutput(){r.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 n=np(this.categoryToDfParamMap.outputs[t]?[this.categoryToDfParamMap.outputs[t],!1]:[this.categoryToDfParamMap.inputs[t],!0],2),i=n[0],a=n[1],u=i.filter(t=>t.propertyType===o.TYPE.DATA_FRAME||t.propertyType===o.TYPE.GRAPHICS),c=i.filter(t=>t.propertyType!==o.TYPE.DATA_FRAME&&t.propertyType!==o.TYPE.GRAPHICS),d=u.map(t=>te(t).config),p="",h=u.reduce((t,n,i)=>{var s,u;this.dfToViewerMapping[n.name]=[];let c=d[i].map((t,i)=>nu(function*(){var i,s,l,a;let u=null!=(i=null!=(s=null==(l=this.funcCall.outputs[n.name])?void 0:l.value)?s:null==(a=this.funcCall.inputParams[n.name])?void 0:a.value)?i:e.data.demo.demog(0),c=t.type,d=Object.values(S).includes(c)?o.Viewer.fromType(c,u):yield u.plot.fromType(c);d.setOptions(t),this.dfToViewerMapping[n.name].push(d),this.afterOutputPropertyRender.next({prop:n,output:d});let p=nh();return 0===u.rowCount&&"demog 0"===u.name&&(r.setDisplay(d.root,!1),r.setDisplay(p,!0)),{viewer:d,stub:p}}).call(this)).map((t,e)=>t.then(t=>{let o=t.viewer,s=t.stub,a=()=>nu(function*(){var t;let l=null!=(t=this.funcCall.outputParams[n.name])?t:this.funcCall.inputParams[n.name];if(l.value){if(r.setDisplay(o.root,!0),r.setDisplay(s,!1),Object.values(S).includes(o.type))o.dataFrame=l.value;else{let t=yield l.value.plot.fromType(o.type);o.root.replaceWith(t.root),o=t}try{d[i][e]&&o.setOptions(d[i][e])}catch(t){console.error("Error setting viewer properties: ",t)}Object.keys(d[i][e]).includes("color")&&o.setOptions({color:d[i][e].color}),this.afterOutputPropertyRender.next({prop:n,output:o})}else r.setDisplay(o.root,!1),r.setDisplay(s,!0)}).call(this),u=this.funcCallReplaced.pipe((0,l.startWith)(null),(0,l.switchMap)(()=>{var t;return(null!=(t=this.funcCall.outputParams[n.name])?t:this.funcCall.inputParams[n.name]).onChanged.pipe((0,l.startWith)(null))}),(0,l.skip)(1)).subscribe(a);return this.subs.push(u),{loadedViewer:o,stub:s}})),h=p!==(null!=(s=n.options.caption)?s:n.name)?null!=(u=n.options.caption)?u:n.name:" ";if(p=h,a){let t=this.funcCallReplaced.pipe((0,l.switchMap)(()=>{var t;return(null!=(t=this.funcCall.outputParams[n.name])?t:this.funcCall.inputParams[n.name]).onChanged})).subscribe(()=>{this.showOutput(),this.inputTabsLabels.forEach(t=>{w()(this.tabsElem.getPane(t).header).show()})});this.subs.push(t)}let f=c.map((t,e)=>{let o=d[i][e].block,s=r.wait(()=>nu(function*(){let e=yield t;return w()(e.loadedViewer.root).css({height:"100%",width:"100%"}),r.divV([e.loadedViewer.root,e.stub],{style:{width:"100%"}})})());w()(s).css({"min-height":"300px","flex-grow":"1"});let l=ex();return this.outputValidationSigns[n.name]=l,r.divV([r.divH([r.h2(0===e?h:" ",{style:{whiteSpace:"pre"}}),...0===e?[r.div([this.outputValidationSigns[n.name][0],this.outputValidationSigns[n.name][1]],{style:{margin:"10.79px"}})]:[]]),s],{style:nc({},o?{width:`${o}%`,"max-width":`${o}%`,"max-height":"100%"}:{"flex-grow":"1"})})});if(n.propertyType===o.TYPE.GRAPHICS){let e=n.options.block,i=nh();i.classList.add("grok-scripting-image-container");let o=r.divV([r.h2(h,{style:{whiteSpace:"pre"}}),i],{style:nc({},e?{width:`${e}%`,"max-width":`${e}%`,"max-height":"100%"}:{"flex-grow":"1"})}),s=()=>{var t;let e=null!=(t=this.funcCall.outputParams[n.name])?t:this.funcCall.inputParams[n.name];e.value?(i.style.backgroundImage=`url("data:image/png;base64,${e.value}")`,i.textContent=""):(i.style.removeProperty("background-image"),i.textContent="[No data to display]")},a=this.funcCallReplaced.pipe((0,l.startWith)(null),(0,l.switchMap)(()=>{var t;return(null!=(t=this.funcCall.outputParams[n.name])?t:this.funcCall.inputParams[n.name]).onChanged.pipe((0,l.startWith)(null))}),(0,l.skip)(1)).subscribe(s);this.subs.push(a),t.append(o)}return t.append(...f),t},r.divH([],{style:{flexWrap:"wrap",flexGrow:"1",maxHeight:"100%"}}));c.forEach(t=>{let e=ex();this.outputValidationSigns[t.name]=e});let f=()=>{let t=o.HtmlTable.create(c,t=>{var e;let n=t.options.precision,i=n&&t.propertyType===o.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]",r.div([this.outputValidationSigns[t.name][0],this.outputValidationSigns[t.name][1]])]}).root;return w()(t).addClass("rfv-scalar-table"),this.afterOutputSacalarTableRender.next(t),t},m=f(),v=(0,s.merge)(this.funcCallReplaced,this.isRunning.pipe((0,l.filter)(t=>!1===t),(0,l.skip)(1))).subscribe(()=>{let e=f();m.replaceWith(e),m=e,w()(this.tabsElem.getPane(t).header).show()});this.subs.push(v),this.tabsElem.addPane(t,()=>r.divV([...u.length?[h]:[],...c.length?[m]:[]]))});let t=r.box();return t.append(this.tabsElem.root),t}onAfterLoadRun(t){return nu(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===o.TYPE.DATA_FRAME&&0!==te(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!==o.TYPE.DATA_FRAME||0!==te(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 nu(function*(){try{let t=E()(this.funcCall.inputParams.values()).reduce((t,e)=>{let n=e.property.propertyType!==o.TYPE.DATA_FRAME?this.funcCall.inputs[e.name]:Array.from(this.funcCall.inputs[e.name].toByteArray());return nd(nc({},t),{[e.name]:n})},{});return localStorage.setItem(this.inputsStorage,JSON.stringify(t))}catch(t){e.shell.error(t.toString())}}).call(this)}loadLastInputs(){return nu(function*(){try{var t;let e=JSON.parse(null!=(t=localStorage.getItem(this.inputsStorage))?t:"{}");if(0===Object.keys(e).length)return null;return E()(this.funcCall.inputParams.values()).reduce((t,n)=>{let i=n.property.propertyType!==o.TYPE.DATA_FRAME?e[n.name]:o.DataFrame.fromByteArray(new Uint8Array(e[n.name]));return nd(nc({},t),{[n.name]:i})},{})}catch(t){e.shell.error(t.toString())}}).call(this)}deleteLastInputs(){return nu(function*(){try{return localStorage.removeItem(this.inputsStorage)}catch(t){e.shell.error(t.toString())}}).call(this)}doRun(){return nu(function*(){this.isRunning.next(!0);try{this.options.isTabbed||(yield this.saveLastInputs()),yield this.run(),this.options.isTabbed||(yield this.deleteLastInputs())}catch(t){e.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[eE]=nd(nc({},this.funcCall.options[eE]),{[t]:e})),n&&(this.funcCall.options[eS]=nd(nc({},this.funcCall.options[eS]),{[t]:n})),this.updateConsistencyState()}getInputLockState(t){var e;return null==(e=this.funcCall.options[eS])?void 0:e[t]}updateConsistencyState(){let t=Object.values(this.funcCall.options[eS]).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===o.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===o.TYPE.DATA_FRAME?"disabled":"restricted"),this.funcCall.inputs[t]=e,this.setInputLockState(i,t,e,n)}getParamChanges(t){return this.funcCallReplaced.pipe((0,l.startWith)(null),(0,l.filter)(()=>!!this.funcCall),(0,l.map)(()=>this.funcCall.inputParams[t]?"inputParams":"outputParams"),(0,l.switchMap)(e=>this.funcCall[e][t].onChanged.pipe((0,l.startWith)(null),(0,l.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),ef(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[eE])?void 0:e[t]}renderOutputForm(){return this.renderIOForm(g.OUTPUTS)}renderInputForm(){return this.renderIOForm(g.INPUTS)}renderIOForm(t){let e=r.divH([],"ui-form ui-form-wide");w()(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[eR[t]].values();return E()(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===g.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=>w()(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?(eV(e)&&w()(e.input).is(":focus")&&this.saveFocusedElement(e.input),e.enabled=!1):(e.enabled=!0,eV(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,l.startWith)(!0),(0,l.switchMap)(()=>this.funcCall.inputParams[t.property.name].onChanged)).subscribe(()=>{Object.entries(i).forEach(t=>{var n,i,r,o,s,l;let a=np(t,2),u=a[0],c=a[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==(l=e.chosenRun)?void 0:l.options[c])?n:null:tw(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===o.TYPE.STRING&&i.options.choices&&!i.options.propagateChoice)return r.input.choice(null!=(e=i.caption)?e:i.name,{value:tw(i),items:JSON.parse(i.options.choices),nullable:i.nullable});switch(i.propertyType){case"file":return b.fileInput(null!=(n=i.caption)?n:i.name,null,null,null);case o.TYPE.FLOAT:let s=r.input.forProperty(i),l=i.options.format;return l&&(s.format=l),s;default:return r.input.forProperty(i)}}bindOnHotkey(t){eV(t)&&(t.input.onkeydown=t=>nu(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=r.iconFA("exclamation-circle",null,"This category has inconsistent inputs");w()(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))?w()(e).show():w()(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=r.iconFA("chevron-right",()=>{var t;w()(o).show(),w()(i).hide(),w()(n).hide(),(null!=(t=this.foldedCategoryInputs[e])?t:[]).forEach(t=>w()(t.input.root).css({display:""}))},"Open category");w()(i).css("padding-right","5px");let o=r.iconFA("chevron-down",()=>{var t;w()(o).hide(),w()(i).show(),this.foldedCategoryInputs[e].some(t=>"inconsistent"===this.getInputLockState(t.paramName))?w()(n).show():w()(n).hide(),(null!=(t=this.foldedCategoryInputs[e])?t:[]).forEach(t=>w()(t.input.root).hide())},"Close category");w()(o).css("padding-right","5px"),t.append(r.h2([i,o,r.h2(e,{style:{display:"inline"}}),n],{style:{width:"100%"}})),w()(o).hide()}else t.append(r.h2(e,{style:{width:"100%"}}))}renderInput(t,e,n){var i,o;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),ef(n)||(n.setDisabled=function(){n.enabled=!1,w()(n.root).removeClass("rfv-restricted-unlocked-input"),w()(n.root).removeClass("rfv-inconsistent-input"),w()(n.root).removeClass("rfv-restricted-input")},n.setRestricted=function(){n.enabled=!1,w()(n.root).addClass("rfv-restricted-input"),w()(n.root).removeClass("rfv-restricted-unlocked-input"),w()(n.root).removeClass("rfv-inconsistent-input")},n.setRestrictedUnlocked=function(){n.enabled=!0,w()(n.root).addClass("rfv-restricted-unlocked-input"),w()(n.root).removeClass("rfv-restricted-input"),w()(n.root).removeClass("rfv-inconsistent-input")},n.setInconsistent=function(){n.enabled=!0,w()(n.root).addClass("rfv-inconsistent-input"),w()(n.root).removeClass("rfv-restricted-input"),w()(n.root).removeClass("rfv-restricted-unlocked-input")},n.setUserInput=function(){n.enabled=!0,w()(n.root).removeClass("rfv-inconsistent-input"),w()(n.root).removeClass("rfv-restricted-input"),w()(n.root).removeClass("rfv-restricted-unlocked-input")}),eV(n)){let t,i;t=e.property,w()(n.root).css({width:`calc(${null!=(o=t.options.block)?o:"100"}% - ${t.options.block?"2":"0"}px)`,"box-sizing":"border-box"}),this.bindTooltips(e,n),i=r.element("i"),n.addOptions(i),n.setValidation=function(t){for(;i.firstChild&&i.removeChild(i.firstChild););let e=eF(ex(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)?w()(i).css("display","flex"):w()(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 o=`${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 o||s?r.divV([...o?[r.divText(o)]:[],...s?[r.divText(s)]:[]],{style:{maxWidth:"300px"}}):null};r.tooltip.bind(e.captionLabel,i),r.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=r.iconFA("lock");w()(i).addClass("rfv-icon-lock"),w()(i).css({color:"var(--grey-2)"});let s=r.iconFA("lock-open");w()(s).addClass("rfv-icon-unlock"),w()(s).css({color:"var(--grey-2)"});let l=r.iconFA("undo",e=>{this.setInput(t.name,this.getRestrictedValue(n),"restricted"),e.stopPropagation()},"Reset value to computed value");w()(l).addClass("rfv-icon-undo"),w()(l).css({color:"var(--blue-2)"});let a=r.iconFA("exclamation-circle",null,"Validation");r.tooltip.bind(a,()=>`Current value is incosistent. Computed value was ${o.TYPES_SCALAR.has(t.property.propertyType)?this.getRestrictedValue(n):"different"}`),w()(a).addClass("rfv-icon-warning"),w()(a).css({color:"var(--orange-2)"}),e.placeLockStateIcons||(e.placeLockStateIcons=function(t,n,i,r){eV(e)&&(e.addOptions(t),e.addOptions(n),e.addOptions(i),e.addOptions(r))}),e.placeLockStateIcons(i,s,l,a)}syncInput(t,e,n){var i;let r=t.name,a=!1,u=this.funcCallReplaced.pipe((0,l.startWith)(!0)).subscribe(()=>{var t,i;let o=this.funcCall[eR[n]][r],s=null!=(t=null!=(i=this.funcCall[n][r])?i:tw(o.property))?t:null;e.notify=!1,e.value=s,e.notify=!0,this.funcCall[n][r]=s,this.setInputLockState(e,r,s,this.getInputLockState(r))});this.subs.push(u);let c=this.funcCallReplaced.pipe((0,l.startWith)(!0),(0,l.switchMap)(()=>{let t=this.funcCall[eR[n]][r];return t.onChanged.pipe((0,l.mapTo)(t))})).subscribe(t=>{let i=this.funcCall[n][t.name];if(a||(e.notify=!1,e.value=i,e.notify=!0),n===g.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(c);let d=this.funcCallReplaced.pipe((0,l.startWith)(!0),(0,l.switchMap)(()=>{let t=this.funcCall[eR[n]][r];return t.onChanged.pipe((0,l.mapTo)(t),(0,l.startWith)(t))}),(0,l.filter)(t=>t.property.propertyType===o.TYPE.DATA_FRAME&&t.value),(0,l.switchMap)(t=>t.value.onDataChanged.pipe((0,l.mapTo)(t)))).subscribe(t=>{n===g.INPUTS?this.inputValidationRequests.next({field:t.name,isRevalidation:!1}):this.outputValidationRequests.next({field:t.name,isRevalidation:!1})});this.subs.push(d);let p=(eV(e)?e.onInput:(i=e.onInput.bind(e),new s.Observable(t=>{let e=i(e=>{t.next(e)});return()=>e.unsubscribe()}))).pipe((0,l.debounceTime)(250)).subscribe(()=>{try{a=!0,this.funcCall[n][t.name]=e.value}finally{a=!1}});this.subs.push(p)}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=np(i.value,2),e=(t[0],t[1]);if(!ey(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,l=void 0;try{for(var a,u=Object.entries(this.externalValidatorsState)[Symbol.iterator]();!(o=(a=u.next()).done);o=!0){let t=np(a.value,2),e=(t[0],t[1]);if(!ey(e))return!1}}catch(t){s=!0,l=t}finally{try{o||null==u.return||u.return()}finally{if(s)throw l}}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=np(r.value,2),n=e[0],i=e[1];ey(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 nu(function*(t,e,n){let i,r,o=void 0===n?g.INPUTS:n,s=t.field,l=this.getValidatedNames(s,o);return i={view:this,funcCall:this.funcCall,lastCall:this.lastCall},r=o===g.INPUTS?this.inputValidators:this.outputValidators,eP(function*(){let n=i.view,s=i.funcCall,a=i.lastCall;return Object.fromEntries((yield Promise.all(l.map(i=>eP(function*(){var l;let u,c=o===g.INPUTS?s.inputs[i]:s.outputs[i],d=yield(t.isNewOutput,t.isRevalidation,(l=function*(){if(null==c)return eb({errors:["Missing value"]})},function(){var t=this,e=arguments;return new Promise(function(n,i){var r=l.apply(t,e);function o(t){em(r,n,i,o,s,"next",t)}function s(t){em(r,n,i,o,s,"throw",t)}o(void 0)})})()),p=r[i];p&&(u=yield p(c,{param:i,funcCall:s,lastCall:a,signal:e,isNewOutput:!!t.isNewOutput,isRevalidation:t.isRevalidation,context:t.context,view:n}));let h=o===g.INPUTS&&s.inputParams[i].property.options.nullable;return[i,ew(...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]=eC();let e=this.inputsMap[t];eh(e)&&e.setValidation(eC())}}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,g.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]=eC();let e=this.outputValidationSigns[t];if(e){let n=ex(eC());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=np(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=np(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=ex(n),i[0].replaceWith(e[0]),i[1].replaceWith(e[1]),e))}updateInputValidationResults(t){let e=ew(this.inputValidationState[t],this.externalValidatorsState[t]),n=this.inputsMap[t];eh(n)&&n.setValidation(e)}runRevalidations(t,e,n){let i=void 0===n?g.INPUTS:n;if(!t.isRevalidation){var r=!0,o=!1,s=void 0;try{for(var l,a=Object.entries(e)[Symbol.iterator]();!(r=(l=a.next()).done);r=!0){let t=np(l.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===g.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==a.return||a.return()}finally{if(o)throw s}}}}getValidatedNames(t,e){let n=void 0===e?g.INPUTS:e;return t?[t]:[...n===g.INPUTS?this.funcCall.inputs.keys():this.funcCall.outputs.keys()]}getValidExpRun(t){return nu(function*(){t.started=x()();let e=t.options.immutable_tags||[];return t.options.immutable_tags=e.includes(tK)?e:[...e,tK],t.newId(),t})()}saveExperimentalRun(t){return nu(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 w()(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:w()(this.tabsElem.root).hide()}richFunctionViewSupportedFormats(){return["Excel"]}richFunctionViewExportExtensions(){return{Excel:"xlsx"}}constructor(t,n){var i;let a=void 0===n?{historyEnabled:!0,isTabbed:!1}:n;super(t,a),i=this,this.options=a,this.inputValidationRequests=new s.Subject,this.outputValidationRequests=new s.Subject,this.inputValidationUpdates=new s.Subject,this.outputValidationUpdates=new s.Subject,this.runRequests=new s.Subject,this.isRunning=new s.BehaviorSubject(!1),this.isUploadMode=new s.BehaviorSubject(!1),this.inputsOverride={},this.inputsMap={},this.outputValidationSigns={},this.inputValidators={},this.outputValidators={},this.inputValidationState={},this.outputValidationState={},this.externalValidatorsUpdates=new s.Subject,this.externalValidatorsState={},this.pendingInputValidations=this.inputValidationUpdates.pipe((0,l.startWith)(null),(0,l.map)(()=>this.inputValidationState)),this._isOutputOutdated=new s.BehaviorSubject(!0),this.isOutputOutdated=this._isOutputOutdated.pipe((0,l.distinctUntilChanged)()),this.blockRuns=new s.BehaviorSubject(!1),this.prevOpenedTab=null,this.beforeInputPropertyRender=new s.Subject,this.afterInputPropertyRender=new s.Subject,this.afterOutputPropertyRender=new s.Subject,this.afterOutputSacalarTableRender=new s.Subject,this.formButtons=r.div(),this.additionalBtns=[],this.navBtns=[],this.tabsElem=r.tabControl(),this.dfToViewerMapping={},this.focusedInput=null,this.foldedCategoryInputs={},this.richFunctionExport=t=>nu(function*(){let n,a,u,c,d;if(!i.lastCall)throw Error("Function was not called");if(!i.exportConfig.supportedFormats.includes(t))throw Error(`Format "${t}" is not supported.`);if(!i.func)throw Error("The correspoding function is not specified");return np((yield(n=i.func,a=i.lastCall,u=i.dfToViewerMapping,e6(function*(){let i={},p=(t,e)=>{if(i[t])return i[t];let n=`${t}`;n.length>31&&(n=`${n.slice(0,31)}`);let r=1;for(;e.worksheets.some(t=>t.name.toLowerCase()===n.toLowerCase());){let e=`${t}`;e.length>31-`-${r}`.length&&(e=`${t.slice(0,31-`-${r}`.length)}`),n=`${e}-${r}`,r++}return i[t]=n,n};if("Excel"===t)try{yield o.Utils.loadJsCss(["/js/common/exceljs.min.js","/js/common/html2canvas.min.js"]);let t=window.ExcelJS,i=window.html2canvas,U=new t.Workbook;r.setDisplay(e.shell.v.root,!1),e9(e.shell.v.root.parentElement,!0,"Generating report. Please do not switch the browser tab...");let H=[],W=t=>t.propertyType===o.TYPE.DATA_FRAME,Y=n.inputs.filter(t=>W(t)),G=n.inputs.filter(t=>{let e;return e=t.propertyType,o.TYPES_SCALAR.has(e)}),q=n.outputs.filter(t=>W(t)),J=n.outputs.filter(t=>{let e;return e=t.propertyType,o.TYPES_SCALAR.has(e)});if(Y.forEach(t=>{var e;let n=a.inputs[t.name];if(ns(n))return;let i=t.options.caption||t.name,r=null!=(e=U.worksheets.find(t=>t.name===p(i,U)))?e:U.addWorksheet(p(i,U)),o=null==c?void 0:c[t.name],s=null==d?void 0:d[t.name];nr({sheet:r,df:n,validation:o,consistency:s})}),G.length){let t=U.addWorksheet("Input scalars");ne(t,G.map(t=>{var e,n,i;return{name:t.name,caption:null!=(e=t.options.caption)?e:t.name,value:null!=(n=a.inputs[t.name])?n:"",units:null!=(i=t.options.units)?i:"",format:t.format||(t.propertyType===o.TYPE.FLOAT?"G7":"#0.###")}}),c,d)}if(q.forEach(t=>{var e;let n=a.outputs[t.name];if(ns(n))return;let i=t.options.caption||t.name,r=null!=(e=U.worksheets.find(t=>t.name===p(i,U)))?e:U.addWorksheet(p(i,U)),o=null==c?void 0:c[t.name],s=null==d?void 0:d[t.name];nr({sheet:r,df:n,validation:o,consistency:s})}),J.length){let t=U.addWorksheet("Output scalars");ne(t,J.map(t=>{var e,n,i;return{name:t.name,caption:null!=(e=t.options.caption)?e:t.name,value:null!=(n=a.outputs[t.name])?n:"",units:null!=(i=t.options.units)?i:"",format:t.format||"#0.###"}}),c,d)}var h=!0,f=!1,m=void 0;try{for(var v,y=n.outputs.filter(t=>t.propertyType===o.TYPE.GRAPHICS)[Symbol.iterator]();!(h=(v=y.next()).done);h=!0){let t=v.value,e=a.outputs[t.name];if(null==e||""===e)continue;let n=t.options.caption||t.name,i=U.addWorksheet(p(n,U)),r=yield no(e),o=r.dataUrl,s=r.width,l=r.height;i.addImage(U.addImage({base64:o,extension:"png"}),{tl:{col:0,row:0},ext:{width:s,height:l}})}}catch(t){f=!0,m=t}finally{try{h||null==y.return||y.return()}finally{if(f)throw m}}var g=!0,b=!1,w=void 0;try{for(var C,A=n.inputs.filter(t=>W(t))[Symbol.iterator]();!(g=(C=A.next()).done);g=!0){let t=C.value,e=a.inputs[t.name];if(ns(e))continue;let n=(null!=(R=u[t.name])?R:[]).filter(t=>t&&t.type!==o.VIEWER.GRID).filter(t=>Object.values(S).includes(t.type));if(0===n.length)continue;let i=t.options.caption||t.name;var x=!0,I=!1,E=void 0;try{for(var R,T,O=n.entries()[Symbol.iterator]();!(x=(T=O.next()).done);x=!0){let t=e8(T.value,2),n=t[0],r=t[1];H.push({sheet:U.getWorksheet(p(i,U)),viewer:r,col:e.columns.length+2,row:n*e7})}}catch(t){I=!0,E=t}finally{try{x||null==O.return||O.return()}finally{if(I)throw E}}}}catch(t){b=!0,w=t}finally{try{g||null==A.return||A.return()}finally{if(b)throw w}}var P=!0,F=!1,V=void 0;try{for(var B,D=n.outputs.filter(t=>W(t))[Symbol.iterator]();!(P=(B=D.next()).done);P=!0){let t=B.value,e=a.outputs[t.name];if(ns(e))continue;let n=(null!=(M=u[t.name])?M:[]).filter(t=>t&&t.type!==o.VIEWER.GRID).filter(t=>Object.values(S).includes(t.type));if(0===n.length)continue;let i=t.options.caption||t.name;var k=!0,j=!1,L=void 0;try{for(var M,N,_=n.entries()[Symbol.iterator]();!(k=(N=_.next()).done);k=!0){let t=e8(N.value,2),n=t[0],r=t[1];if(r)if(r.type===o.VIEWER.STATISTICS){let t=e.columns.length,r=o.DataFrame.fromColumns([o.Column.string("Name",t).init(t=>e.columns.byIndex(t).name),o.Column.int("Values",t).init(t=>e.columns.byIndex(t).stats.valueCount),o.Column.int("Nulls",t).init(t=>e.columns.byIndex(t).stats.missingValueCount),o.Column.float("Min",t).init(t=>e.columns.byIndex(t).stats.min),o.Column.float("Max",t).init(t=>e.columns.byIndex(t).stats.max),o.Column.float("Avg",t).init(t=>e.columns.byIndex(t).stats.avg),o.Column.float("Stdev",t).init(t=>e.columns.byIndex(t).stats.stdev)]);nr({sheet:U.getWorksheet(p(i,U)),df:r,column:e.columns.length+2,row:n*e7})}else H.push({sheet:U.getWorksheet(p(i,U)),viewer:r,col:e.columns.length+2,row:n*e7})}}catch(t){j=!0,L=t}finally{try{k||null==_.return||_.return()}finally{if(j)throw L}}}}catch(t){F=!0,V=t}finally{try{P||null==D.return||D.return()}finally{if(F)throw V}}yield e6(function*(){let t=H.filter(t=>{let e=t.viewer;return null==e?void 0:e.dataFrame}).map(t=>{var e,n;let i=o.Viewer.fromType(t.viewer.type,t.viewer.dataFrame.clone());i.copyViewersLook(t.viewer);let a=r.div(i.root,{style:{width:"1280px",height:"720px",flex:"none"}});return a.classList.add("ui-box"),a.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:a,rendered:(0,s.race)(i.onViewerRendered.pipe((0,l.take)(1),(0,l.switchMap)(()=>(0,s.interval)(10)),(0,l.filter)(()=>!i.isRenderPending)),(0,s.timer)(2e3)).pipe((0,l.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{e.shell.v.root.after(...t.map(t=>t.box)),yield Promise.all(t.map(t=>t.rendered));var n=!0,a=!1,u=void 0;try{for(var c,d=t[Symbol.iterator]();!(n=(c=d.next()).done);n=!0){let t=c.value,e=t.sheet,n=t.box,r=t.col,o=t.row,s=yield i(n,{logging:!1,ignoreElements:t=>!t.contains(n)&&!n.contains(t)&&!document.head.contains(t)});e.addImage(U.addImage({base64:s.toDataURL(),extension:"png"}),{tl:{col:r,row:o},ext:{width:1280,height:720}})}}catch(t){a=!0,u=t}finally{try{n||null==d.return||d.return()}finally{if(a)throw u}}}finally{var p=!0,h=!1,f=void 0;try{for(var m,v=t[Symbol.iterator]();!(p=(m=v.next()).done);p=!0){let t=m.value,e=t.box,n=t.newViewer;e.remove(),n.detach()}}catch(t){h=!0,f=t}finally{try{p||null==v.return||v.return()}finally{if(h)throw f}}}})();let z=yield U.xlsx.writeBuffer();return[new Blob([z],{type:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=UTF-8"}),U]}finally{r.setDisplay(e.shell.v.root,!0),e9(e.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}}}var nm=Uint8Array,nv=Uint16Array,ny=Uint32Array,ng=new nm([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),nb=new nm([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),nw=new nm([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),nC=function(t,e){for(var n=new nv(31),i=0;i<31;++i)n[i]=e+=1<<t[i-1];for(var r=new ny(n[30]),i=1;i<30;++i)for(var o=n[i];o<n[i+1];++o)r[o]=o-n[i]<<5|i;return[n,r]},nA=nC(ng,2),nx=nA[0],nI=nA[1];nx[28]=258,nI[258]=28;for(var nE=nC(nb,0),nS=(nE[0],nE[1]),nR=new nv(32768),nT=0;nT<32768;++nT){var nO=(43690&nT)>>>1|(21845&nT)<<1;nO=(61680&(nO=(52428&nO)>>>2|(13107&nO)<<2))>>>4|(3855&nO)<<4,nR[nT]=((65280&nO)>>>8|(255&nO)<<8)>>>1}for(var nP=function(t,e,n){for(var i,r=t.length,o=0,s=new nv(e);o<r;++o)t[o]&&++s[t[o]-1];var l=new nv(e);for(o=0;o<e;++o)l[o]=l[o-1]+s[o-1]<<1;if(n){i=new nv(1<<e);var a=15-e;for(o=0;o<r;++o)if(t[o])for(var u=o<<4|t[o],c=e-t[o],d=l[t[o]-1]++<<c,p=d|(1<<c)-1;d<=p;++d)i[nR[d]>>>a]=u}else for(o=0,i=new nv(r);o<r;++o)t[o]&&(i[o]=nR[l[t[o]-1]++]>>>15-t[o]);return i},nF=new nm(288),nT=0;nT<144;++nT)nF[nT]=8;for(var nT=144;nT<256;++nT)nF[nT]=9;for(var nT=256;nT<280;++nT)nF[nT]=7;for(var nT=280;nT<288;++nT)nF[nT]=8;for(var nV=new nm(32),nT=0;nT<32;++nT)nV[nT]=5;var nB=nP(nF,9,0),nD=nP(nV,5,0),nk=function(t){return(t+7)/8|0},nj=function(t,e,n){(null==e||e<0)&&(e=0),(null==n||n>t.length)&&(n=t.length);var i=new(2==t.BYTES_PER_ELEMENT?nv:4==t.BYTES_PER_ELEMENT?ny:nm)(n-e);return i.set(t.subarray(e,n)),i},nL=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],nM=function(t,e,n){var i=Error(e||nL[t]);if(i.code=t,Error.captureStackTrace&&Error.captureStackTrace(i,nM),!n)throw i;return i},nN=function(t,e,n){n<<=7&e;var i=e/8|0;t[i]|=n,t[i+1]|=n>>>8},n_=function(t,e,n){n<<=7&e;var i=e/8|0;t[i]|=n,t[i+1]|=n>>>8,t[i+2]|=n>>>16},nU=function(t,e){for(var n=[],i=0;i<t.length;++i)t[i]&&n.push({s:i,f:t[i]});var r=n.length,o=n.slice();if(!r)return[nJ,0];if(1==r){var s=new nm(n[0].s+1);return s[n[0].s]=1,[s,1]}n.sort(function(t,e){return t.f-e.f}),n.push({s:-1,f:25001});var l=n[0],a=n[1],u=0,c=1,d=2;for(n[0]={s:-1,f:l.f+a.f,l:l,r:a};c!=r-1;)l=n[n[u].f<n[d].f?u++:d++],a=n[u!=c&&n[u].f<n[d].f?u++:d++],n[c++]={s:-1,f:l.f+a.f,l:l,r:a};for(var p=o[0].s,i=1;i<r;++i)o[i].s>p&&(p=o[i].s);var h=new nv(p+1),f=nH(n[c-1],h,0);if(f>e){var i=0,m=0,v=f-e,y=1<<v;for(o.sort(function(t,e){return h[e.s]-h[t.s]||t.f-e.f});i<r;++i){var g=o[i].s;if(h[g]>e)m+=y-(1<<f-h[g]),h[g]=e;else break}for(m>>>=v;m>0;){var b=o[i].s;h[b]<e?m-=1<<e-h[b]++-1:++i}for(;i>=0&&m;--i){var w=o[i].s;h[w]==e&&(--h[w],++m)}f=e}return[new nm(h),f]},nH=function(t,e,n){return -1==t.s?Math.max(nH(t.l,e,n+1),nH(t.r,e,n+1)):e[t.s]=n},n$=function(t){for(var e=t.length;e&&!t[--e];);for(var n=new nv(++e),i=0,r=t[0],o=1,s=function(t){n[i++]=t},l=1;l<=e;++l)if(t[l]==r&&l!=e)++o;else{if(!r&&o>2){for(;o>138;o-=138)s(32754);o>2&&(s(o>10?o-11<<5|28690:o-3<<5|12305),o=0)}else if(o>3){for(s(r),--o;o>6;o-=6)s(8304);o>2&&(s(o-3<<5|8208),o=0)}for(;o--;)s(r);o=1,r=t[l]}return[n.subarray(0,i),e]},nW=function(t,e){for(var n=0,i=0;i<e.length;++i)n+=t[i]*e[i];return n},nY=function(t,e,n){var i=n.length,r=nk(e+2);t[r]=255&i,t[r+1]=i>>>8,t[r+2]=255^t[r],t[r+3]=255^t[r+1];for(var o=0;o<i;++o)t[r+o+4]=n[o];return(r+4+i)*8},nG=function(t,e,n,i,r,o,s,l,a,u,c){nN(e,c++,n),++r[256];for(var d,p,h,f,m=nU(r,15),v=m[0],y=m[1],g=nU(o,15),b=g[0],w=g[1],C=n$(v),A=C[0],x=C[1],I=n$(b),E=I[0],S=I[1],R=new nv(19),T=0;T<A.length;++T)R[31&A[T]]++;for(var T=0;T<E.length;++T)R[31&E[T]]++;for(var O=nU(R,7),P=O[0],F=O[1],V=19;V>4&&!P[nw[V-1]];--V);var B=u+5<<3,D=nW(r,nF)+nW(o,nV)+s,k=nW(r,v)+nW(o,b)+s+14+3*V+nW(R,P)+(2*R[16]+3*R[17]+7*R[18]);if(B<=D&&B<=k)return nY(e,c,t.subarray(a,a+u));if(nN(e,c,1+(k<D)),c+=2,k<D){d=nP(v,y,0),p=v,h=nP(b,w,0),f=b;var j=nP(P,F,0);nN(e,c,x-257),nN(e,c+5,S-1),nN(e,c+10,V-4),c+=14;for(var T=0;T<V;++T)nN(e,c+3*T,P[nw[T]]);c+=3*V;for(var L=[A,E],M=0;M<2;++M)for(var N=L[M],T=0;T<N.length;++T){var _=31&N[T];nN(e,c,j[_]),c+=P[_],_>15&&(nN(e,c,N[T]>>>5&127),c+=N[T]>>>12)}}else d=nB,p=nF,h=nD,f=nV;for(var T=0;T<l;++T)if(i[T]>255){var _=i[T]>>>18&31;n_(e,c,d[_+257]),c+=p[_+257],_>7&&(nN(e,c,i[T]>>>23&31),c+=ng[_]);var U=31&i[T];n_(e,c,h[U]),c+=f[U],U>3&&(n_(e,c,i[T]>>>5&8191),c+=nb[U])}else n_(e,c,d[i[T]]),c+=p[i[T]];return n_(e,c,d[256]),c+p[256]},nq=new ny([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),nJ=new nm(0),nz=function(t,e,n,i,r,o){var s=t.length,l=new nm(i+s+5*(1+Math.ceil(s/7e3))+r),a=l.subarray(i,l.length-r),u=0;if(!e||s<8)for(var c=0;c<=s;c+=65535){var d=c+65535;d>=s&&(a[u>>3]=o),u=nY(a,u+1,t.subarray(c,d))}else{for(var p=nq[e-1],h=p>>>13,f=8191&p,m=(1<<n)-1,v=new nv(32768),y=new nv(m+1),g=Math.ceil(n/3),b=2*g,w=function(e){return(t[e]^t[e+1]<<g^t[e+2]<<b)&m},C=new ny(25e3),A=new nv(288),x=new nv(32),I=0,E=0,c=0,S=0,R=0,T=0;c<s;++c){var O=w(c),P=32767&c,F=y[O];if(v[P]=F,y[O]=P,R<=c){var V=s-c;if((I>7e3||S>24576)&&V>423){u=nG(t,a,0,C,A,x,E,S,T,c-T,u),S=I=E=0,T=c;for(var B=0;B<286;++B)A[B]=0;for(var B=0;B<30;++B)x[B]=0}var D=2,k=0,j=f,L=P-F&32767;if(V>2&&O==w(c-L))for(var M=Math.min(h,V)-1,N=Math.min(32767,c),_=Math.min(258,V);L<=N&&--j&&P!=F;){if(t[c+D]==t[c+D-L]){for(var U=0;U<_&&t[c+U]==t[c+U-L];++U);if(U>D){if(D=U,k=L,U>M)break;for(var H=Math.min(L,U-2),W=0,B=0;B<H;++B){var Y=c-L+B+32768&32767,G=v[Y],q=Y-G+32768&32767;q>W&&(W=q,F=Y)}}}F=v[P=F],L+=P-F+32768&32767}if(k){C[S++]=0x10000000|nI[D]<<18|nS[k];var J=31&nI[D],z=31&nS[k];E+=ng[J]+nb[z],++A[257+J],++x[z],R=c+D,++I}else C[S++]=t[c],++A[t[c]]}}u=nG(t,a,o,C,A,x,E,S,T,c-T,u),!o&&7&u&&(u=nY(a,u+1,nJ))}return nj(l,0,i+nk(u)+r)},nK=function(){for(var t=new Int32Array(256),e=0;e<256;++e){for(var n=e,i=9;--i;)n=(1&n&&-0x12477ce0)^n>>>1;t[e]=n}return t}(),nZ=function(){var t=-1;return{p:function(e){for(var n=t,i=0;i<e.length;++i)n=nK[255&n^e[i]]^n>>>8;t=n},d:function(){return~t}}},nX=function(t,e){var n={};for(var i in t)n[i]=t[i];for(var i in e)n[i]=e[i];return n},nQ=function(t,e,n){for(;n;++e)t[e]=n,n>>>=8},n0=function(t,e,n,i){for(var r in t){var o=t[r],s=e+r,l=i;Array.isArray(o)&&(l=nX(i,o[1]),o=o[0]),o instanceof nm?n[s]=[o,l]:(n[s+="/"]=[new nm(0),l],n0(o,s,n,i))}},n1="u">typeof TextEncoder&&new TextEncoder,n2="u">typeof TextDecoder&&new TextDecoder;try{n2.decode(nJ,{stream:!0})}catch(t){}function n3(t,e){if(e){for(var n=new nm(t.length),i=0;i<t.length;++i)n[i]=t.charCodeAt(i);return n}if(n1)return n1.encode(t);for(var r=t.length,o=new nm(t.length+(t.length>>1)),s=0,l=function(t){o[s++]=t},i=0;i<r;++i){if(s+5>o.length){var a=new nm(s+8+(r-i<<1));a.set(o),o=a}var u=t.charCodeAt(i);u<128||e?l(u):(u<2048?l(192|u>>6):(u>55295&&u<57344?(l(240|(u=65536+(1047552&u)|1023&t.charCodeAt(++i))>>18),l(128|u>>12&63)):l(224|u>>12),l(128|u>>6&63)),l(128|63&u))}return nj(o,0,s)}var n5=function(t){var e=0;if(t)for(var n in t){var i=t[n].length;i>65535&&nM(9),e+=i+4}return e},n4=function(t,e,n,i,r,o,s,l){var a=i.length,u=n.extra,c=l&&l.length,d=n5(u);nQ(t,e,null!=s?0x2014b50:0x4034b50),e+=4,null!=s&&(t[e++]=20,t[e++]=n.os),t[e]=20,e+=2,t[e++]=n.flag<<1|(o<0&&8),t[e++]=r&&8,t[e++]=255&n.compression,t[e++]=n.compression>>8;var p=new Date(null==n.mtime?Date.now():n.mtime),h=p.getFullYear()-1980;if((h<0||h>119)&&nM(10),nQ(t,e,h<<25|p.getMonth()+1<<21|p.getDate()<<16|p.getHours()<<11|p.getMinutes()<<5|p.getSeconds()>>>1),e+=4,-1!=o&&(nQ(t,e,n.crc),nQ(t,e+4,o<0?-o-2:o),nQ(t,e+8,n.size)),nQ(t,e+12,a),nQ(t,e+14,d),e+=16,null!=s&&(nQ(t,e,c),nQ(t,e+6,n.attrs),nQ(t,e+10,s),e+=14),t.set(i,e),e+=a,d)for(var f in u){var m=u[f],v=m.length;nQ(t,e,+f),nQ(t,e+2,v),t.set(m,e+4),e+=4+v}return c&&(t.set(l,e),e+=c),e},n6=function(t,e,n,i,r){nQ(t,e,0x6054b50),nQ(t,e+8,n),nQ(t,e+10,n),nQ(t,e+12,i),nQ(t,e+16,r)};"function"==typeof queueMicrotask&&queueMicrotask;var n8=n(510),n7={};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 it(t,e,n,i,r,o,s){try{var l=t[o](s),a=l.value}catch(t){n(t);return}l.done?e(a):Promise.resolve(a).then(i,r)}function ie(t){return function(){var e=this,n=arguments;return new Promise(function(i,r){var o=t.apply(e,n);function s(t){it(o,i,r,s,l,"next",t)}function l(t){it(o,i,r,s,l,"throw",t)}s(void 0)})}}function ii(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,l=!1;try{for(r=r.call(t);!(s=(n=r.next()).done)&&(o.push(n.value),!e||o.length!==e);s=!0);}catch(t){l=!0,i=t}finally{try{s||null==r.return||r.return()}finally{if(l)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.")}()}n7.styleTagTransform=tM(),n7.setAttributes=tD(),n7.insert=tV().bind(null,"head"),n7.domAPI=tP(),n7.insertStyleElement=tj(),tT()(n8.A,n7),n8.A&&n8.A.locals&&n8.A.locals;let ir=t=>{var e,n;return null!=(e=null==(n=t.options)?void 0:n.friendlyName)?e:t.func.name},io=t=>{var e;return null!=(e=t.customId)?e:t.funcName};function is(t){return ie(function*(){return{parentRun:yield f.loadRun(t),childRuns:yield e.dapi.functions.calls.allPackageVersions().include("func, func.package").filter(`options.parentCallId="${t}"`).list()}})()}function il(t,e,n,i,r,o,s){try{var l=t[o](s),a=l.value}catch(t){n(t);return}l.done?e(a):Promise.resolve(a).then(i,r)}function ia(t){return function(){var e=this,n=arguments;return new Promise(function(i,r){var o=t.apply(e,n);function s(t){il(o,i,r,s,l,"next",t)}function l(t){il(o,i,r,s,l,"throw",t)}s(void 0)})}}class iu extends o.ObjectHandler{get type(){return"Model"}get helpUrl(){return null}getById(t){return ia(function*(){return yield e.dapi.functions.find(t)})()}refresh(t){return ia(function*(){return yield this.getById(t.id)}).call(this)}static openHelp(t){return ia(function*(){let n=yield z(t);e.shell.windows.showHelp=!0,e.shell.windows.help.showHelp(r.markdown(null!=n?n:""))})()}static openModel(t){t.prepare().edit()}static openModelFromFunccall(t){t.edit()}static getUserGroups(){return ia(function*(){return yield e.dapi.groups.currentUserGroups()})()}static getMissingGroups(t,e){return JSON.parse(t.options.mandatoryUserGroups?`${t.options.mandatoryUserGroups}`:"[]").filter(t=>!e.map(t=>t.friendlyName).includes(t.name))}static openVersionSelectDialog(t){var n;let i=JSON.parse(t.options.versions?`${t.options.versions}`:"[]");if((null!=(n=null==i?void 0:i.length)?n:0)<2)return void e.shell.info("No other versions avaliable");let o=r.dialog({title:"Choose version"}),s=r.input.choice("Select version",{items:i,value:i[0]});o.add(s).onOK(()=>{let e=s.value;t.prepare({params:{version:e}}).edit()}),o.show()}isApplicable(t){var e,n,i=o.toJs(t);if(!(i instanceof o.Func))return!1;let r=(null!=(e=null==i||null==(n=i.options)?void 0:n.role)?e:"").split(",").includes("model"),s=i.hasTag("model");return r||s}getLanguageIcon(t){return"grok"==t?r.iconSvg("project"):r.iconImage("script",`/images/entities/${t}.png`)}renderMarkup(t){let n=r.divH([],{style:{justifyContent:"space-between",width:"100%"}});return setTimeout(()=>ia(function*(){let i=yield this.awaitUserGroups(),o=iu.getMissingGroups(t,i),s=o.length>0,l=r.iconFA("exclamation-triangle",null);l.classList.remove("grok-icon");let a=this.makeMandatoryGroupsInfo(o),u=r.span([this.renderIcon(t),r.label(t.friendlyName)]);if(n.onclick=()=>{e.shell.windows.help.visible&&iu.openHelp(t)},s?u.classList.add("d4-disabled"):n.ondblclick=()=>{iu.openModel(t)},s){var c;(c=a).popover="auto",c.style.cursor="default",c.style.padding="10px",c.style.background="#fdffe5",c.style.border="1px solid #E4E6CE",c.style.borderRadius="2px",c.style.boxShadow="0 0 5px #E4E6CE",c.style.maxWidth="500px",c.style.color="var(--gray-6)",document.body.append(a),n.addEventListener("click",()=>{var t,e;let n;t=l,e=a,n=t.getBoundingClientRect().toJSON(),e.style.inset="unset",e.style.top=n.y+"px",e.style.left=n.x+20+"px",a.showPopover()})}n.append(u),s&&n.append(r.span([l],{style:{paddingLeft:"10px"}}))}).call(this)),n}renderIcon(t){if(null!=t.options.icon&&(t.options.icon.startsWith("http://")||t.options.icon.startsWith("https://")))return r.iconImage("model-icon",t.options.icon);let e=K(t);if(t instanceof o.Script&&(null==e||null==t.options.icon))return this.getLanguageIcon(t.language);if(null==e||!(e=K(t=o.Func.find({package:e.name,name:t.name})[0])))return r.iconSvg("project");let n=e.getIconUrl();if(null!=t.options.icon){let e=n.split("/");e.pop(),e.push(t.options.icon),n=e.join("/")}return r.iconImage(e.name,n)}renderView(t){let e=r.div();return this.renderPreview(t).then(t=>e.appendChild(t.root)),e}renderPreview(t){var e=()=>super.renderPreview;return ia(function*(){let n=yield this.awaitUserGroups(),i=iu.getMissingGroups(t,n);if(!(null==i?void 0:i.length)&&("Compute2:TreeWizardEditor"===t.options.editor||"Compute2:RichFunctionViewEditor"===t.options.editor)){let e=t.prepare();return(yield o.Func.byName(t.options.editor).prepare({call:e}).call()).getOutputParamValue()}return o.View.fromViewAsync(()=>{var n=this;ia(function*(){var o,s,l;let a=yield z(t),u=yield e().call(n,t);u.name=(null!=(o=t.friendlyName)?o:t.name)+" preview";let c=(null==i?void 0:i.length)?this.makeMandatoryGroupsInfo(i):r.div([r.bigButton("Launch",()=>t.prepare().edit())]);return u.append(r.div([r.h1(null!=(s=t.friendlyName)?s:t.name),r.divText(null!=(l=t.description)?l:t.name,{style:{marginBottom:"10px"}}),c,r.div([],{style:{padding:"20px "}}),r.markdown(null!=a?a:"")],{style:{display:"flex",flexDirection:"column",height:"100%",overflow:"auto"}})),u}).call(this)})}).call(this)}renderTooltip(t){let e=r.span([this.renderIcon(t),r.label(t.friendlyName)]);return e.classList.add("d4-link-label"),r.bind(t,r.divV([r.h2(e),r.divV([r.divText(t.description,"ui-description")],{style:{lineHeight:"150%"}})]))}renderCard(t){let e=this.renderMarkup(t);return e.classList.add("d4-link-label"),r.bind(t,r.h2(e))}init(){this.registerParamFunc("Choose version",t=>{iu.openVersionSelectDialog(o.toJs(t))}),this.registerParamFunc("Help",t=>{iu.openHelp(o.toJs(t))}),setTimeout(()=>ia(function*(){let t=yield iu.getUserGroups();this.userGroups.next(t)}).call(this))}makeMandatoryGroupsInfo(t){let n=r.div(r.divV([r.divText("You should be a member of the following group(s):","model-catalog-groups-title"),...t.map(t=>{let i;return r.divV([r.divH([((i=r.iconFA("user-friends")).classList.remove("grok-icon"),i),r.span([t.name],"model-catalog-group-name"),r.link("Request membership",()=>ia(function*(){var i;yield(i=t.name,ia(function*(){try{let t=yield e.dapi.groups.filter(`friendlyName="${i}"`).list();if(0===t.length)throw Error("group with specified name is not found");if(t.length>1)throw Error("found more than one group with specified name");let n=t[0];yield e.dapi.groups.requestMembership(n,e.shell.user.group),e.shell.info(`Request to join ${i} has been initiated. Please allow some time for approval.`)}catch(t){e.shell.error(t.toString())}})()),n.popover&&n.hidePopover()})())],"model-catalog-group"),...t.help?[r.divText(t.help,"model-catalog-group-help")]:[]])})],"model-catalog-groups"));return n}awaitUserGroups(){return ia(function*(){return this.userGroups.pipe((0,l.filter)(t=>!!t),(0,l.map)(t=>t),(0,l.take)(1)).toPromise()}).call(this)}constructor(){super(),this.userGroups=new s.BehaviorSubject(void 0)}}function ic(t,e,n,i,r,o,s){try{var l=t[o](s),a=l.value}catch(t){n(t);return}l.done?e(a):Promise.resolve(a).then(i,r)}function id(t){return function(){var e=this,n=arguments;return new Promise(function(i,r){var o=t.apply(e,n);function s(t){ic(o,i,r,s,l,"next",t)}function l(t){ic(o,i,r,s,l,"throw",t)}s(void 0)})}}function ip(){return id(function*(){yield iZ.init()})()}function ih(t){iZ.openModelFromFuncall(t)}function im(){return iZ.OutliersSelection()}function iv(t){return iZ.RichFunctionViewEditor(t)}function iy(t){return iZ.PipelineStepEditor(t)}function ig(t){return id(function*(){return yield iZ.CustomDataUploader(t)})()}function ib(t){return id(function*(){return yield iZ.CustomUploader(t)})()}function iw(t){iZ.CustomCustomizer(t)}function iC(t){return iZ.SimTimeValidator(t)}function iA(t){return iZ.DesiredTempValidator(t)}function ix(t){return iZ.InitialTempValidator(t)}function iI(t){return iZ.AmbTempValidator(t)}function iE(t){return iZ.HeatCapValidator(t)}function iS(t){return iZ.CustomStringInput(t)}function iR(t){return iZ.ObjectCoolingSelector(t)}function iT(t){return id(function*(){return yield iZ.CustomInputMock(t)})()}function iO(t){return iZ.RangeValidatorFactory(t)}function iP(t){return iZ.AsyncValidatorDemoFactory(t)}function iF(t){return iZ.GlobalValidatorDemoFactory(t)}function iV(t,e,n,i,r,o,s){try{var l=t[o](s),a=l.value}catch(t){n(t);return}l.done?e(a):Promise.resolve(a).then(i,r)}function iB(t){return function(){var e=this,n=arguments;return new Promise(function(i,r){var o=t.apply(e,n);function s(t){iV(o,i,r,s,l,"next",t)}function l(t){iV(o,i,r,s,l,"throw",t)}s(void 0)})}}function iD(t,e,n,i){var r,o=arguments.length,s=o<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,n,i);else for(var l=t.length-1;l>=0;l--)(r=t[l])&&(s=(o<3?r(s):o>3?r(e,n,s):r(e,n))||s);return o>3&&s&&Object.defineProperty(e,n,s),s}function ik(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)}function ij(t,e){return function(n,i){e(n,i,t)}}let iL=new o.Package;class iM{set value(t){let e=t?JSON.parse(t):"";this._value.next(e)}get value(){return this._value.value?JSON.stringify(this._value.value):""}onInput(t){return this._value.subscribe(()=>{this.notify&&t(this.value)})}constructor(){this._value=new s.BehaviorSubject(null),this.notify=!0,this.enabled=!0,this.root=r.div("",{style:{width:"100%"}}),this.input=r.input.toggle("test",{value:!0}),this.root.append(this.input.root)}}let iN=tt,i_=class extends e1{},iU=nf,iH=class extends e1{set currentTabName(t){this.stepTabs.getPane(t)&&(this.stepTabs.currentPane=this.stepTabs.getPane(t))}getStepView(t){var e;return null==(e=this.steps[t])?void 0:e.view}getRunningUpdates(){return[]}disableSetters(t){}init(){return ie(function*(){yield this.loadFuncCallById(),this.initialConfig.forEach((t,e)=>{var n;this.steps[io(t)]={idx:e,visibility:new s.BehaviorSubject(null!=(n=t.hiddenOnInit)?n:v.VISIBLE),ability:new s.BehaviorSubject(this.isHistorical.value||0===e?y.ENABLED:y.DISABLED),options:{friendlyName:t.friendlyName,helpUrl:t.helpUrl,customId:t.customId}}}),this.subs.push(e.functions.onAfterRunAction.pipe((0,l.filter)(t=>Object.values(this.steps).some(e=>{var n;let i=e.view;return(null==i||null==(n=i.funcCall)?void 0:n.id)===(null==t?void 0:t.id)&&!!t}))).subscribe(t=>{this.onStepCompleted.next(t),("true"===t.func.options.isMain||t.func.nqName===this.initialConfig[this.initialConfig.length-1].funcName)&&this.run()}));let t=this.initialConfig.map(t=>ie(function*(){return{stepScript:o.Func.byName(t.funcName),stepId:io(t)}})()),n=yield Promise.all(t);n.forEach(t=>{this.steps[t.stepId].func=t.stepScript}),this.root.classList.remove("ui-panel");let i={},a="editor:",u="Compute:PipelineStepEditor",c=n.map(t=>ie(function*(){let e=t.stepScript.script?(t=>{let e=t.script,n=e.indexOf(a);if(n<0)return u;let i=e.indexOf("\n",n);return e.substring(n+a.length,i).trim()})(t.stepScript):u;return i[e]||(i[e]=o.Func.byName(e.split(" ").join(""))),this.steps[t.stepId].editor=e,Promise.resolve()}).call(this));yield Promise.all(c);let d=n.map(t=>ie(function*(){let n=this.steps[t.stepId],a=t.stepScript.prepare(),u=i[n.editor];yield this.onBeforeStepFuncCallApply(t.stepScript.nqName,a,u);let c=yield u.apply({call:a});yield c.isReady.pipe((0,l.filter)(t=>!!t),(0,l.take)(1)).toPromise();let d=r.button("Back",()=>{},"Go to the previous step");w()(d).addClass("ui-btn-nav");let p=r.button("Next",()=>{},"Go to the next step");w()(p).addClass("ui-btn-nav"),this.syncNavButtons(n,d,p),c.setNavigationButtons([d,p]),this.steps[t.stepId].view=c;let h=this.steps[t.stepId],f=()=>{Object.values(this.steps).forEach(t=>{t.idx>h.idx&&t.visibility.value===v.VISIBLE&&t.ability.value===y.ENABLED&&t.ability.next(y.DISABLED)})},m=h.view.funcCallReplaced.pipe((0,l.switchMap)(()=>{let t=[...h.view.funcCall.inputParams.values()].map(t=>t.onChanged.pipe((0,l.mapTo)(t)));return(0,s.merge)(...t)})),g=m.subscribe(f);this.subs.push(g);let b=m.pipe((0,l.filter)(t=>t.property.propertyType===o.TYPE.DATA_FRAME&&t.value),(0,l.switchMap)(t=>t.value.onDataChanged)).subscribe(f);this.subs.push(b);let C=e.functions.onAfterRunAction.pipe((0,l.filter)(t=>h.view.funcCall&&t&&!!t.id&&h.view.funcCall.id===t.id),(0,l.withLatestFrom)(h.visibility,h.ability),(0,l.filter)(t=>{let e=ii(t,3),n=e[1],i=e[2];return n!==v.HIDDEN&&i!==y.DISABLED})).subscribe(()=>{let t=Object.values(this.steps).find(t=>t.idx>h.idx&&t.visibility.value===v.VISIBLE&&t.ability.value===y.ENABLED)?null:Object.values(this.steps).find(t=>t.idx>h.idx&&t.visibility.value===v.VISIBLE&&t.ability.value===y.DISABLED);null==t||t.ability.next(y.ENABLED)});return this.subs.push(C),yield this.onAfterStepFuncCallApply(t.stepScript.nqName,a,c),c}).call(this)),p=yield Promise.all(d),h=(0,s.combineLatest)(p.map(t=>t.isHistorical)).subscribe(t=>{t.some((t,e)=>{var n;return!t&&(null==(n=Object.values(this.steps).find(t=>t.idx===e))?void 0:n.visibility.value)===v.VISIBLE})&&this.isHistorical.value&&this.isHistorical.next(!1)});this.subs.push(h);let f=this.isUpdating.subscribe(t=>{var e=!0,n=!1,i=void 0;try{for(var r,o=Object.values(this.steps)[Symbol.iterator]();!(e=(r=o.next()).done);e=!0){let e=r.value.view;(null==e?void 0:e.blockRuns)&&e.blockRuns.next(t)}}catch(t){n=!0,i=t}finally{try{e||null==o.return||o.return()}finally{if(n)throw i}}});this.subs.push(f),yield this.onFuncCallReady(),this.isReady.next(!0),this.loadHelp().then(()=>{this.buildRibbonPanels();let t=()=>{let t=this.findCurrentStep();t&&this.helpFiles[t.func.nqName]&&"opened"===this.getHelpState()&&this.showHelpWithDelay(t)},n=e.events.onCurrentViewChanged.pipe((0,l.filter)(()=>e.shell.v==this)).subscribe(t);t(),this.subs.push(n)})}).call(this)}loadHelp(){return ie(function*(){return Promise.all(Object.values(this.steps).map(t=>ie(function*(){var n,i,r,o;let s=null!=(n=null==(i=t.options)?void 0:i.helpUrl)?n:t.func.options.help;if(s){let n=`System:AppData/${this.func.package.name}/${s}`,i=(yield e.dapi.files.exists(n))?yield e.dapi.files.readAsText(n):yield t.view.getContextHelp();i&&(this.helpFiles[null!=(r=null==(o=t.options)?void 0:o.customId)?r:t.func.nqName]=i)}}).call(this)))}).call(this)}syncNavButtons(t,e,n){let i,r;n.addEventListener("click",()=>{i&&(this.currentTabName=ir(i))}),e.addEventListener("click",()=>{r&&(this.currentTabName=ir(r))});let o=this.getPipelineStateChanges().pipe((0,l.startWith)(!0),(0,l.debounceTime)(0)).subscribe(()=>{i=this.getNextStep(t),r=this.getPreviousStep(t),i?(w()(n).show(),i.ability.value===y.DISABLED&&w()(n).addClass("d4-disabled"),i.ability.value===y.ENABLED&&w()(n).removeClass("d4-disabled")):w()(n).hide(),r?(w()(e).show(),r.ability.value===y.DISABLED&&w()(e).addClass("d4-disabled"),r.ability.value===y.ENABLED&&w()(e).removeClass("d4-disabled")):w()(e).hide()});this.subs.push(o)}getPreviousStep(t){return Object.values(this.steps).slice().reverse().find(e=>e.idx<t.idx&&e.visibility.value===v.VISIBLE)}getNextStep(t){return Object.values(this.steps).find(e=>e.idx>t.idx&&e.visibility.value===v.VISIBLE)}getPipelineStateChanges(){let t=Object.values(this.steps).flatMap(t=>[t.ability,t.visibility]);return(0,s.merge)(...t).pipe((0,l.mapTo)(!0))}onComparisonLaunch(t){return ie(function*(){let n=e.shell.v.parentCall,i=yield Promise.all(t.map(t=>is(t.id))),r=yield Promise.all(i.map(t=>{var e;return null!=(e=t.childRuns.find(t=>"true"===t.func.options.isMain))?e:t.childRuns.find(t=>t.func.nqName===this.initialConfig[this.initialConfig.length-1].funcName)}).map(t=>f.loadRun(t.id))),o=[...e.shell.views].find(t=>t.type===R),s=yield tS.fromComparedRuns(r,r[0].func,{parentView:o,parentCall:n});e.shell.addView(s)}).call(this)}onBeforeStepFuncCallApply(t,e,n){return ie(function*(){})()}onAfterStepFuncCallApply(t,e,n){return ie(function*(){})()}buildIO(){let t=Object.values(this.steps).reduce((t,e)=>{var n,i;return 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}({},t),i=i={[ir(e)]:e.view.root},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},{}),e=r.tabControl(t),n=Object.values(this.steps).map(t=>{let n=r.iconFA("exclamation-circle",null,"This step has inconsistent inputs");return w()(n).css({color:"var(--orange-2)","margin-left":"3px","padding-top":"1px"}),e.getPane(ir(t)).header.appendChild(n),t.view.consistencyState.subscribe(t=>{"consistent"===t&&w()(n).hide(),"inconsistent"===t&&w()(n).show()})});this.subs.push(...n);let i=Object.values(this.steps).map(t=>t.view.consistencyState),o=(0,s.merge)(...i).subscribe(()=>{i.map(t=>t.value).some(t=>"inconsistent"===t)?this.consistencyState.next("inconsistent"):this.consistencyState.next("consistent")});this.subs.push(o);let l=e.panes[0].header.parentElement;l.classList.add("d4-ribbon","pipeline-view"),l.classList.remove("d4-tab-header-stripe"),l.firstChild.remove();for(let t=0;t<e.panes.length;t++)e.panes[t].header.classList.add("d4-ribbon-name"),e.panes[t].header.classList.remove("d4-tab-header");return e.panes[0].header.style.marginLeft="12px",e.root.style.height="100%",e.root.style.width="100%",this.stepTabs=e,this.initialConfig.forEach(t=>{let e=io(t);this.subs.push(this.steps[e].visibility.subscribe(t=>{t===v.VISIBLE&&w()(this.stepTabs.getPane(ir(this.steps[e])).header).css("display","inherit"),t===v.HIDDEN&&w()(this.stepTabs.getPane(ir(this.steps[e])).header).hide()}))}),Object.values(this.steps).forEach(t=>{this.subs.push(t.ability.subscribe(e=>{e===y.ENABLED&&w()(this.stepTabs.getPane(ir(t)).header).removeClass("d4-disabled"),e===y.DISABLED&&w()(this.stepTabs.getPane(ir(t)).header).addClass("d4-disabled")}))}),this.hideSteps(...this.initialConfig.filter(t=>t.hiddenOnInit===v.HIDDEN).map(t=>t.funcName)),e.root}showHelpWithDelay(t){return ie(function*(){let n;n=this.helpFiles[t.func.nqName],eP(function*(){e.shell.windows.help.visible=!0,yield new Promise(t=>setTimeout(t,100)),e.shell.windows.help.showHelp(r.markdown(n))})()}).call(this)}findCurrentStep(){return Object.values(this.steps).find(t=>ir(t)===this.stepTabs.currentPane.name)}buildHistoryBlock(){let t=super.buildHistoryBlock(),n=this.historyBlock.afterRunDeleted.subscribe(t=>ie(function*(){(yield e.dapi.functions.calls.allPackageVersions().filter(`options.parentCallId="${t.id}"`).list()).map(t=>ie(function*(){return f.deleteRun(t)})())})());return this.subs.push(n),t}getHelpState(){return"closed"===e.userSettings.getValue(tZ,`${this.func.name}_help_state`)?"closed":"opened"}saveHelpState(t){e.userSettings.add(tZ,`${this.func.name}_help_state`,t)}buildRibbonPanels(){let t=r.iconFA("info",()=>ie(function*(){let t=this.findCurrentStep();t&&this.helpFiles[t.func.nqName]&&(yield this.showHelpWithDelay(t),this.saveHelpState("opened"))}).call(this),"Show help for this step"),n=()=>{let n=this.findCurrentStep();r.setDisplay(t,!!(n&&this.helpFiles[n.func.nqName])),n&&this.helpFiles[n.func.nqName]&&e.shell.windows.help.visible&&this.showHelpWithDelay(n),this.setRibbonPanels([...this.getRibbonPanels().slice(0,1),...n?n.view.buildRibbonPanels():[],...this.getRibbonPanels().length>2?this.getRibbonPanels().slice(-1):[]])};if(!this.isReady.value){let t=this.stepTabs.onTabChanged.subscribe(n),i=e.events.onEvent("grok-panels-changed").pipe((0,l.filter)(()=>e.shell.v===this)).subscribe(()=>ie(function*(){let t=yield this.getHelpState();if(e.shell.windows.help.visible&&"closed"===t)return void this.saveHelpState("opened");if(!e.shell.windows.help.visible&&"opened"===t){let t=r.iconFA("info");w()(t).css("margin","0px 3px"),e.shell.info(r.span(["You can open help panel by clicking the",t,"button on the ribbon menu"])),this.saveHelpState("closed");return}}).call(this));this.subs.push(t,i)}let i=this.findCurrentStep(),o=[[...super.buildRibbonPanels().flat(),t],...i?i.view.buildRibbonPanels():[]];return this.setRibbonPanels(o),n(),o}saveRun(t){return ie(function*(){let e=tt(t);yield this.onBeforeSaveRun(e),Q(e)&&(e=yield eB(t)),e.newId();let n=Object.values(this.steps).filter(t=>t.visibility.value===v.VISIBLE).map(t=>ie(function*(){var n,i;let r=t.view.funcCall;return r.options.parentCallId=e.id,(null==(n=t.options)?void 0:n.customId)&&(r.options.customId=null==(i=t.options)?void 0:i.customId),yield t.view.saveRun(r),Promise.resolve()})());yield Promise.all(n),e.options.title&&(e.options.title=`${e.options.title} (copy)`);let i=yield f.saveRun(e),r=yield f.loadRun(i.id);return this.options.historyEnabled&&this.isHistoryEnabled&&this.historyBlock&&this.historyBlock.addRun((yield f.loadRun(i.id))),this.linkFunccall(r),this.isHistorical.next(!0),yield this.onAfterSaveRun(e),i}).call(this)}loadRun(t){return ie(function*(){let e=yield is(t),n=e.parentRun,i=e.childRuns,r=Object.values(this.steps).filter(t=>t.visibility.value===v.VISIBLE).findIndex(t=>ir(t)===this.stepTabs.currentPane.name);yield this.onBeforeLoadRun();var o=!0,s=!1,l=void 0;try{for(var a,u=Object.values(this.steps)[Symbol.iterator]();!(o=(a=u.next()).done);o=!0){let t=a.value,e=i.filter(e=>e.func.nqName===t.func.nqName);if(0===e.length&&(t.visibility.next(v.HIDDEN),t.ability.next(y.DISABLED)),1===e.length&&(yield t.view.loadRun(e[0].id),t.visibility.next(v.VISIBLE),Q(e[0])?t.ability.next(y.DISABLED):t.ability.next(y.ENABLED)),e.length>1){let n=e.find(e=>{var n;return e.options.customId===(null==(n=t.options)?void 0:n.customId)});yield t.view.loadRun(n.id),t.visibility.next(v.VISIBLE),Q(n)?t.ability.next(y.DISABLED):t.ability.next(y.ENABLED)}}}catch(t){s=!0,l=t}finally{try{o||null==u.return||u.return()}finally{if(s)throw l}}let c=Object.values(this.steps).find(t=>t.ability.value===y.DISABLED&&t.visibility.value===v.VISIBLE),d=null!=c?c:Object.values(this.steps)[0];if(d.ability.next(y.ENABLED),c){let t=this.getNextStep(c);for(;t;)t.ability.next(y.DISABLED),t=this.getNextStep(t)}this.lastCall=n,this.linkFunccall(n),this.isHistorical.next(!0);let p=Object.values(this.steps).filter(t=>t.visibility.value==v.VISIBLE).at(r);return p&&p.ability.value===y.ENABLED?this.currentTabName=ir(p):this.currentTabName=ir(d),yield this.onAfterLoadRun(n),n}).call(this)}hideSteps(...t){return ie(function*(){t.forEach(t=>{this.steps[t].visibility.next(v.HIDDEN)})}).call(this)}showSteps(...t){return ie(function*(){t.forEach(t=>{this.steps[t].visibility.next(v.VISIBLE)})}).call(this)}exportRunJson(){return ie(function*(){if(this._lastCall){let o={isPipeline:!0};var t=!0,e=!1,n=void 0;try{for(var i,r=Object.entries(this.steps)[Symbol.iterator]();!(t=(i=r.next()).done);t=!0){let t=ii(i.value,2),e=t[0],n=t[1],r=n.view.lastCall;r&&(o[e]=yield eD(r,n.view))}}catch(t){e=!0,n=t}finally{try{t||null==r.return||r.return()}finally{if(e)throw n}}return Y(o)}}).call(this)}getStepViewRuns(t){return this.onStepCompleted.pipe((0,l.filter)(e=>e.func.nqName===t),(0,l.map)(()=>this.getStepView(t)))}constructor(t,e,n){var i;super(t,void 0===n?{historyEnabled:!0,isTabbed:!1,skipInit:!1}:n),i=this,this.initialConfig=e,this.steps={},this.onStepCompleted=new s.Subject,this.isUpdating=new s.BehaviorSubject(!1),this.pipelineViewExportExtensions=()=>({Archive:"zip","Single Excel":"xlsx"}),this.pipelineViewExportFormats=()=>["Archive","Single Excel"],this.pipelineViewExport=t=>ie(function*(){if(!i.stepTabs)throw Error("Set step tabs please for export");if("Archive"===t){let t={};var e=!0,n=!1,r=void 0;try{for(var s,l=Object.values(i.steps).filter(t=>t.visibility.value===v.VISIBLE)[Symbol.iterator]();!(e=(s=l.next()).done);e=!0){let e=s.value;i.stepTabs.currentPane=i.stepTabs.getPane(ir(e)),yield new Promise(t=>setTimeout(t,100));let n=yield e.view.exportConfig.export("Excel");t[e.view.exportConfig.filename("Excel")]=[new Uint8Array((yield n.arrayBuffer())),{level:0}]}}catch(t){n=!0,r=t}finally{try{e||null==l.return||l.return()}finally{if(n)throw r}}return new Blob([function(t,e){e||(e={});var n={},i=[];n0(t,"",n,e);var r=0,o=0;for(var s in n){var l=n[s],a=l[0],u=l[1],c=8*(0!=u.level),d=n3(s),p=d.length,h=u.comment,f=h&&n3(h),m=f&&f.length,v=n5(u.extra);p>65535&&nM(11);var y=c?function(t,e){var n;return nz(t,null==(n=e||{}).level?6:n.level,null==n.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(t.length)))):12+n.mem,0,0,!0)}(a,u):a,g=y.length,b=nZ();b.p(a),i.push(nX(u,{size:a.length,crc:b.d(),c:y,f:d,m:f,u:p!=s.length||f&&h.length!=m,o:r,compression:c})),r+=30+p+v+g,o+=76+2*(p+v)+(m||0)+g}for(var w=new nm(o+22),C=r,A=o-r,x=0;x<i.length;++x){var d=i[x];n4(w,d.o,d,d.f,d.u,d.c.length);var I=30+d.f.length+n5(d.extra);w.set(d.c,d.o+I),n4(w,r,d,d.f,d.u,d.c.length,d.o,d.m),r+=16+I+(d.m?d.m.length:0)}return n6(w,r,i.length,A,C),w}(t)])}if("Single Excel"===t){yield o.Utils.loadJsCss(["/js/common/exceljs.min.js"]);let t=window.ExcelJS,e=new t.Workbook,n=(t,e,n)=>{let i=`${ir(n)}>${e}`;i.length>31&&(i=`${i.slice(0,31)}`);let r=2;for(;t.worksheets.some(t=>t.name.toLowerCase()===i.toLowerCase());){let t=`${ir(n)}>${e}`;t.length>31-`-${r}`.length&&(t=`${t.slice(0,31-`-${r}`.length)}`),i=`${t}-${r}`,r++}return i};var a=!0,u=!1,c=void 0;try{for(var d,p=Object.values(i.steps).filter(t=>t.visibility.value===v.VISIBLE)[Symbol.iterator]();!(a=(d=p.next()).done);a=!0){let r=d.value,o=new t.Workbook;i.stepTabs.currentPane=i.stepTabs.getPane(ir(r)),yield new Promise(t=>setTimeout(t,100)),yield o.xlsx.load((yield(yield r.view.exportConfig.export("Excel")).arrayBuffer())),o.eachSheet(t=>{let i=n(e,t.name,r),s=e.addWorksheet("New sheet");s.model=t.model,s.name=i,t.getImages().forEach(t=>{let n=e.addImage(o.getImage(t.imageId));s.addImage(n,t.range)})})}}catch(t){u=!0,c=t}finally{try{a||null==p.return||p.return()}finally{if(u)throw c}}return new Blob([(yield e.xlsx.writeBuffer())],{type:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=UTF-8"})}throw Error("This format is not supported")})(),this.exportConfig={supportedExtensions:this.pipelineViewExportExtensions(),supportedFormats:this.pipelineViewExportFormats(),export:this.pipelineViewExport,filename:this.defaultExportFilename},this.helpFiles={}}},i$=eb,iW=eg,iY=eA,iG=ew,iq=b.fileInput,iJ=b.historyInput,iz=b.historyInputJSON,iK=b.historyPanel;class iZ{static init(){return iB(function*(){})()}static openModelFromFuncall(t){iu.openModelFromFunccall(t)}static OutliersSelection(){return new C}static RichFunctionViewEditor(t){return nf.fromFuncCall(t,{historyEnabled:!0,isTabbed:!1})}static PipelineStepEditor(t){return nf.fromFuncCall(t,{historyEnabled:!1,isTabbed:!0})}static CustomDataUploader(t){return iB(function*(){return yield new Promise(t=>setTimeout(t,1e3)),[(yield t.prepare({ambTemp:22,initTemp:100,desiredTemp:30,area:.06,heatCap:4200,heatTransferCoeff:8.3,simTime:21600}).call())]})()}static CustomUploader(t){return iB(function*(){let n=(yield e.functions.eval("Compute:CustomDataUploader")).prepare({func:t.func}),i=r.bigButton("Click me to get mock calls",()=>n.call()),s=o.Widget.fromRoot(r.panel([r.divV([r.label("This part of dialog comes from my custom data uploader"),r.divH([i],{style:{justifyContent:"center"}})])])),a=e.functions.onBeforeRunAction.pipe((0,l.filter)(t=>t.id===n.id)).subscribe(()=>{r.setUpdateIndicator(i,!0)}),u=e.functions.onAfterRunAction.pipe((0,l.filter)(t=>t.id===n.id)).subscribe(()=>{r.setUpdateIndicator(i,!1)});return s.subs.push(a,u),{uploadWidget:s,uploadFuncCall:n}})()}static CustomCustomizer(t){t.defaultView.scatterPlot({xColumnName:"Initial temperature",yColumnName:"Time to cool"})}static SimTimeValidator(t){let{reasonableMin:e,reasonableMax:n}=t;return t=>eb({warnings:t<e||t>n?[`Minimum reasonable time is ${e}. Maximum reasonable time is ${n}`]:void 0,errors:t<0?["Time should be strictly positive"]:void 0})}static DesiredTempValidator(t){return(t,e)=>{let n=e.funcCall.inputs.ambTemp,i=e.funcCall.inputs.initTemp;return eb({errors:[...t<n?[eg(`Desired temperature cannot be less than ambient temperature (${n}).
|
|
170
|
+
`,[{actionName:"Set desired equal to ambient",action:()=>e.funcCall.inputs.desiredTemp=n}])]:[],...t>i?[`Desired temperature cannot be higher than initial temperature (${i})`]:[]]})}}static InitialTempValidator(t){return(t,e)=>{let n=e.funcCall.inputs.ambTemp;return eb({errors:[...t<n?[`Initial temperature cannot be less than ambient temperature (${n}).`]:[]]})}}static AmbTempValidator(t){return(t,e)=>{let n=e.funcCall.inputs.initTemp;return eb({errors:[...t>n?[`Ambient temperature cannot be higher than initial temperature (${n})`]:[]]})}}static HeatCapValidator(t){return(t,e)=>eb({errors:[...t<=0?["Heat capacity must be greater than zero."]:[]],notifications:[eg("Heat capacity is only dependent on the object material.",[{actionName:"Google it",action:()=>{window.open("http://google.com")}}])]})}static CustomStringInput(t){let e=r.input.string("Custom input",{value:""});return e.root.style.backgroundColor="aqua",e.input.style.backgroundColor="aqua",e}static ObjectCoolingSelector(t){return b.historyInputJSON("Previous run","ObjectCooling")}static CustomInputMock(t){return iB(function*(){return new iM})()}static RangeValidatorFactory(t){let{min:e,max:n}=t;return t=>{if(t<e||t>n)return eb({errors:[`Out of range [${e}, ${n}] value: ${t}`]})}}static AsyncValidatorDemoFactory(t){return t=>iB(function*(){if(yield new Promise(t=>setTimeout(t,100)),0===t)return eb({warnings:["Try non-null value"]})})()}static GlobalValidatorDemoFactory(t){let{max:e}=t;return(t,n)=>iB(function*(){if(n.isRevalidation){var t;return(null==(t=n.context)?void 0:t.isOk)?eb():eb({warnings:["Try lowering a value as well"]})}yield new Promise(t=>setTimeout(t,100));let{a:i,b:r,c:o}=n.funcCall.inputs,s=i+r+o<=e,l=s?eb():eb({warnings:["Try lowering a value"]});return eA(["a","b","c"].filter(t=>t!==n.param),{isOk:s},l)})()}}iD([e.decorators.init(),ik("design:type",Function),ik("design:paramtypes",[]),ik("design:returntype",Promise)],iZ,"init",null),iD([e.decorators.func(),ik("design:type",Function),ik("design:paramtypes",[void 0===o||void 0===o.FuncCall?Object:o.FuncCall]),ik("design:returntype",void 0)],iZ,"openModelFromFuncall",null),iD([e.decorators.func({name:"OutliersSelectionViewer",description:"Creates an outliers selection viewer",outputs:[{type:"viewer",name:"result"}],meta:{role:"viewer"}}),ik("design:type",Function),ik("design:paramtypes",[]),ik("design:returntype",void 0)],iZ,"OutliersSelection",null),iD([e.decorators.editor({outputs:[{type:"view",name:"result"}]}),ik("design:type",Function),ik("design:paramtypes",[void 0===o||void 0===o.FuncCall?Object:o.FuncCall]),ik("design:returntype",void 0)],iZ,"RichFunctionViewEditor",null),iD([e.decorators.editor({outputs:[{type:"object",name:"result"}]}),ik("design:type",Function),ik("design:paramtypes",[void 0===o||void 0===o.FuncCall?Object:o.FuncCall]),ik("design:returntype",void 0)],iZ,"PipelineStepEditor",null),iD([e.decorators.func({outputs:[{type:"object",name:"uploadedCalls"}]}),ik("design:type",Function),ik("design:paramtypes",[void 0===o||void 0===o.Func?Object:o.Func]),ik("design:returntype",Promise)],iZ,"CustomDataUploader",null),iD([e.decorators.func({outputs:[{name:"uploadWidget",type:"widget"},{name:"uploadFuncCall",type:"funccall"}]}),ij(0,e.decorators.param({type:"object"})),ik("design:type",Function),ik("design:paramtypes",[Object]),ik("design:returntype",Promise)],iZ,"CustomUploader",null),iD([e.decorators.func(),ij(0,e.decorators.param({type:"object"})),ik("design:type",Function),ik("design:paramtypes",[Object]),ik("design:returntype",void 0)],iZ,"CustomCustomizer",null),iD([e.decorators.func({outputs:[{type:"object",name:"validator"}]}),ij(0,e.decorators.param({type:"object"})),ik("design:type",Function),ik("design:paramtypes",[Object]),ik("design:returntype",void 0)],iZ,"SimTimeValidator",null),iD([e.decorators.func({outputs:[{type:"object",name:"validator"}]}),ij(0,e.decorators.param({type:"object"})),ik("design:type",Function),ik("design:paramtypes",[Object]),ik("design:returntype",void 0)],iZ,"DesiredTempValidator",null),iD([e.decorators.func({outputs:[{type:"object",name:"validator"}]}),ij(0,e.decorators.param({type:"object"})),ik("design:type",Function),ik("design:paramtypes",[Object]),ik("design:returntype",void 0)],iZ,"InitialTempValidator",null),iD([e.decorators.func({outputs:[{type:"object",name:"validator"}]}),ij(0,e.decorators.param({type:"object"})),ik("design:type",Function),ik("design:paramtypes",[Object]),ik("design:returntype",void 0)],iZ,"AmbTempValidator",null),iD([e.decorators.func({outputs:[{type:"object",name:"validator"}]}),ij(0,e.decorators.param({type:"object"})),ik("design:type",Function),ik("design:paramtypes",[Object]),ik("design:returntype",void 0)],iZ,"HeatCapValidator",null),iD([e.decorators.func({outputs:[{type:"object",name:"result"}]}),ij(0,e.decorators.param({type:"object"})),ik("design:type",Function),ik("design:paramtypes",[Object]),ik("design:returntype",void 0)],iZ,"CustomStringInput",null),iD([e.decorators.func({outputs:[{type:"object",name:"result"}]}),ij(0,e.decorators.param({type:"object"})),ik("design:type",Function),ik("design:paramtypes",[Object]),ik("design:returntype",void 0)],iZ,"ObjectCoolingSelector",null),iD([e.decorators.func({outputs:[{type:"object",name:"input"}]}),ij(0,e.decorators.param({type:"object"})),ik("design:type",Function),ik("design:paramtypes",[Object]),ik("design:returntype",Promise)],iZ,"CustomInputMock",null),iD([e.decorators.func({outputs:[{type:"object",name:"validator"}]}),ij(0,e.decorators.param({type:"object"})),ik("design:type",Function),ik("design:paramtypes",[Object]),ik("design:returntype",void 0)],iZ,"RangeValidatorFactory",null),iD([e.decorators.func({outputs:[{type:"object",name:"validator"}]}),ij(0,e.decorators.param({type:"object"})),ik("design:type",Function),ik("design:paramtypes",[Object]),ik("design:returntype",void 0)],iZ,"AsyncValidatorDemoFactory",null),iD([e.decorators.func({outputs:[{type:"object",name:"validator"}]}),ij(0,e.decorators.param({type:"object"})),ik("design:type",Function),ik("design:paramtypes",[Object]),ik("design:returntype",void 0)],iZ,"GlobalValidatorDemoFactory",null)})(),compute=i})();
|
|
2
171
|
//# sourceMappingURL=package.js.map
|