retold-facto 0.0.4
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/.claude/launch.json +11 -0
- package/.dockerignore +8 -0
- package/.quackage.json +19 -0
- package/Dockerfile +26 -0
- package/bin/retold-facto.js +909 -0
- package/examples/facto-government-data.sqlite +0 -0
- package/examples/government-data-catalog.json +137 -0
- package/examples/government-data-loader.js +1432 -0
- package/package.json +91 -0
- package/scripts/facto-download.js +425 -0
- package/source/Retold-Facto.js +1042 -0
- package/source/services/Retold-Facto-BeaconProvider.js +511 -0
- package/source/services/Retold-Facto-CatalogManager.js +1252 -0
- package/source/services/Retold-Facto-DataLakeService.js +1642 -0
- package/source/services/Retold-Facto-DatasetManager.js +417 -0
- package/source/services/Retold-Facto-IngestEngine.js +1315 -0
- package/source/services/Retold-Facto-ProjectionEngine.js +3960 -0
- package/source/services/Retold-Facto-RecordManager.js +360 -0
- package/source/services/Retold-Facto-SchemaManager.js +1110 -0
- package/source/services/Retold-Facto-SourceFolderScanner.js +2243 -0
- package/source/services/Retold-Facto-SourceManager.js +730 -0
- package/source/services/Retold-Facto-StoreConnectionManager.js +441 -0
- package/source/services/Retold-Facto-ThroughputMonitor.js +478 -0
- package/source/services/web-app/codemirror-entry.js +7 -0
- package/source/services/web-app/pict-app/Pict-Application-Facto-Configuration.json +9 -0
- package/source/services/web-app/pict-app/Pict-Application-Facto.js +70 -0
- package/source/services/web-app/pict-app/Pict-Facto-Bundle.js +11 -0
- package/source/services/web-app/pict-app/providers/Pict-Provider-Facto-UI.js +66 -0
- package/source/services/web-app/pict-app/providers/Pict-Provider-Facto.js +69 -0
- package/source/services/web-app/pict-app/providers/facto-api/Facto-API-Catalog.js +93 -0
- package/source/services/web-app/pict-app/providers/facto-api/Facto-API-Connections.js +42 -0
- package/source/services/web-app/pict-app/providers/facto-api/Facto-API-Datasets.js +605 -0
- package/source/services/web-app/pict-app/providers/facto-api/Facto-API-Projections.js +188 -0
- package/source/services/web-app/pict-app/providers/facto-api/Facto-API-Scanner.js +80 -0
- package/source/services/web-app/pict-app/providers/facto-api/Facto-API-Schema.js +116 -0
- package/source/services/web-app/pict-app/providers/facto-api/Facto-API-Sources.js +104 -0
- package/source/services/web-app/pict-app/views/PictView-Facto-Catalog.js +526 -0
- package/source/services/web-app/pict-app/views/PictView-Facto-Datasets.js +173 -0
- package/source/services/web-app/pict-app/views/PictView-Facto-Ingest.js +259 -0
- package/source/services/web-app/pict-app/views/PictView-Facto-Layout.js +191 -0
- package/source/services/web-app/pict-app/views/PictView-Facto-Projections.js +231 -0
- package/source/services/web-app/pict-app/views/PictView-Facto-Records.js +326 -0
- package/source/services/web-app/pict-app/views/PictView-Facto-Scanner.js +624 -0
- package/source/services/web-app/pict-app/views/PictView-Facto-Sources.js +201 -0
- package/source/services/web-app/pict-app/views/PictView-Facto-Throughput.js +456 -0
- package/source/services/web-app/pict-app-full/Pict-Application-Facto-Full-Configuration.json +14 -0
- package/source/services/web-app/pict-app-full/Pict-Application-Facto-Full.js +391 -0
- package/source/services/web-app/pict-app-full/providers/PictRouter-Facto-Configuration.json +56 -0
- package/source/services/web-app/pict-app-full/views/PictView-Facto-Full-BottomBar.js +68 -0
- package/source/services/web-app/pict-app-full/views/PictView-Facto-Full-Connections.js +340 -0
- package/source/services/web-app/pict-app-full/views/PictView-Facto-Full-Dashboard.js +149 -0
- package/source/services/web-app/pict-app-full/views/PictView-Facto-Full-Dashboards.js +819 -0
- package/source/services/web-app/pict-app-full/views/PictView-Facto-Full-Datasets.js +178 -0
- package/source/services/web-app/pict-app-full/views/PictView-Facto-Full-IngestJobs.js +99 -0
- package/source/services/web-app/pict-app-full/views/PictView-Facto-Full-Layout.js +62 -0
- package/source/services/web-app/pict-app-full/views/PictView-Facto-Full-MappingEditor.js +158 -0
- package/source/services/web-app/pict-app-full/views/PictView-Facto-Full-ProjectionDetail.js +1120 -0
- package/source/services/web-app/pict-app-full/views/PictView-Facto-Full-Projections.js +172 -0
- package/source/services/web-app/pict-app-full/views/PictView-Facto-Full-QueryPanel.js +119 -0
- package/source/services/web-app/pict-app-full/views/PictView-Facto-Full-RecordViewer.js +663 -0
- package/source/services/web-app/pict-app-full/views/PictView-Facto-Full-Records.js +648 -0
- package/source/services/web-app/pict-app-full/views/PictView-Facto-Full-Scanner.js +1017 -0
- package/source/services/web-app/pict-app-full/views/PictView-Facto-Full-SchemaDetail.js +1404 -0
- package/source/services/web-app/pict-app-full/views/PictView-Facto-Full-SchemaDocEditor.js +1036 -0
- package/source/services/web-app/pict-app-full/views/PictView-Facto-Full-SchemaEditor.js +636 -0
- package/source/services/web-app/pict-app-full/views/PictView-Facto-Full-SchemaResearch.js +357 -0
- package/source/services/web-app/pict-app-full/views/PictView-Facto-Full-SourceDetail.js +822 -0
- package/source/services/web-app/pict-app-full/views/PictView-Facto-Full-SourceEditor.js +1036 -0
- package/source/services/web-app/pict-app-full/views/PictView-Facto-Full-SourceResearch.js +487 -0
- package/source/services/web-app/pict-app-full/views/PictView-Facto-Full-Sources.js +165 -0
- package/source/services/web-app/pict-app-full/views/PictView-Facto-Full-Throughput.js +439 -0
- package/source/services/web-app/pict-app-full/views/PictView-Facto-Full-TopBar.js +335 -0
- package/source/services/web-app/pict-app-full/views/projections/Facto-Projections-Constants.js +71 -0
- package/source/services/web-app/web/chart.min.js +20 -0
- package/source/services/web-app/web/codemirror-bundle.js +30099 -0
- package/source/services/web-app/web/css/facto-themes.css +467 -0
- package/source/services/web-app/web/css/facto.css +502 -0
- package/source/services/web-app/web/index.html +28 -0
- package/source/services/web-app/web/retold-facto.js +12138 -0
- package/source/services/web-app/web/retold-facto.js.map +1 -0
- package/source/services/web-app/web/retold-facto.min.js +2 -0
- package/source/services/web-app/web/retold-facto.min.js.map +1 -0
- package/source/services/web-app/web/simple/index.html +17 -0
- package/test/Facto_Browser_Integration_tests.js +798 -0
- package/test/RetoldFacto_tests.js +4117 -0
- package/test/fixtures/weather-readings.csv +17 -0
- package/test/fixtures/weather-stations.csv +9 -0
- package/test/model/MeadowModel-Extended.json +8497 -0
- package/test/model/MeadowModel-PICT.json +1 -0
- package/test/model/MeadowModel.json +1355 -0
- package/test/model/ddl/Facto.ddl +225 -0
- package/test/model/fable-configuration.json +14 -0
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).retoldFacto=t()}}(function(){return function t(e,o,i){function n(r,s){if(!o[r]){if(!e[r]){var l="function"==typeof require&&require;if(!s&&l)return l(r,!0);if(a)return a(r,!0);var c=new Error("Cannot find module '"+r+"'");throw c.code="MODULE_NOT_FOUND",c}var d=o[r]={exports:{}};e[r][0].call(d.exports,function(t){return n(e[r][1][t]||t)},d,d.exports,t,e,o,i)}return o[r].exports}for(var a="function"==typeof require&&require,r=0;r<i.length;r++)n(i[r]);return n}({1:[function(t,e,o){e.exports={name:"fable-serviceproviderbase",version:"3.0.19",description:"Simple base classes for fable services.",main:"source/Fable-ServiceProviderBase.js",scripts:{start:"node source/Fable-ServiceProviderBase.js",test:"npx quack test",tests:"npx quack test -g",coverage:"npx quack coverage",build:"npx quack build",types:"tsc -p ./tsconfig.build.json",check:"tsc -p . --noEmit"},types:"types/source/Fable-ServiceProviderBase.d.ts",mocha:{diff:!0,extension:["js"],package:"./package.json",reporter:"spec",slow:"75",timeout:"5000",ui:"tdd","watch-files":["source/**/*.js","test/**/*.js"],"watch-ignore":["lib/vendor"]},repository:{type:"git",url:"https://github.com/stevenvelozo/fable-serviceproviderbase.git"},keywords:["entity","behavior"],author:"Steven Velozo <steven@velozo.com> (http://velozo.com/)",license:"MIT",bugs:{url:"https://github.com/stevenvelozo/fable-serviceproviderbase/issues"},homepage:"https://github.com/stevenvelozo/fable-serviceproviderbase",devDependencies:{"@types/mocha":"^10.0.10",fable:"^3.1.62",quackage:"^1.0.58",typescript:"^5.9.3"}}},{}],2:[function(t,e,o){const i=t("../package.json");class n{constructor(t,e,o){this.fable,this.UUID,this.options,this.services,this.servicesMap,"object"==typeof t&&t.isFable?this.connectFable(t):this.fable=!1,this._PackageFableServiceProvider=i,this.fable?(this.UUID=t.getUUID(),this.options="object"==typeof e?e:{}):(this.options="object"!=typeof t||t.isFable?"object"==typeof e?e:{}:t,this.UUID=`CORE-SVC-${Math.floor(89999*Math.random()+1e4)}`),this.serviceType=`Unknown-${this.UUID}`,this.Hash="string"==typeof o?o:this.fable||"string"!=typeof e?`${this.UUID}`:e}connectFable(t){if("object"!=typeof t||!t.isFable){let e=`Fable Service Provider Base: Cannot connect to Fable, invalid Fable object passed in. The pFable parameter was a [${typeof t}].}`;return console.log(e),new Error(e)}return this.fable||(this.fable=t),this.log||(this.log=this.fable.Logging),this.services||(this.services=this.fable.services),this.servicesMap||(this.servicesMap=this.fable.servicesMap),!0}static isFableService=!0}e.exports=n,e.exports.CoreServiceProviderBase=n},{"../package.json":1}],3:[function(t,e,o){var i,n;i="undefined"!=typeof self?self:this,n=function(){return function(){var t={407:function(t,e,o){o.d(e,{default:function(){return k}});var i=/([:*])(\w+)/g,n=/\*/g,a=/\/\?/g;function r(t){return void 0===t&&(t="/"),g()?location.pathname+location.search+location.hash:t}function s(t){return t.replace(/\/+$/,"").replace(/^\/+/,"")}function l(t){return"string"==typeof t}function c(t){return t&&t.indexOf("#")>=0&&t.split("#").pop()||""}function d(t){var e=s(t).split(/\?(.*)?$/);return[s(e[0]),e.slice(1).join("")]}function p(t){for(var e={},o=t.split("&"),i=0;i<o.length;i++){var n=o[i].split("=");if(""!==n[0]){var a=decodeURIComponent(n[0]);e[a]?(Array.isArray(e[a])||(e[a]=[e[a]]),e[a].push(decodeURIComponent(n[1]||""))):e[a]=decodeURIComponent(n[1]||"")}}return e}function h(t,e){var o,r=d(s(t.currentLocationPath)),h=r[0],u=r[1],f=""===u?null:p(u),g=[];if(l(e.path)){if(o="(?:/^|^)"+s(e.path).replace(i,function(t,e,o){return g.push(o),"([^/]+)"}).replace(n,"?(?:.*)").replace(a,"/?([^/]+|)")+"$",""===s(e.path)&&""===s(h))return{url:h,queryString:u,hashString:c(t.to),route:e,data:null,params:f}}else o=e.path;var m=new RegExp(o,""),w=h.match(m);if(w){var v=l(e.path)?function(t,e){return 0===e.length?null:t?t.slice(1,t.length).reduce(function(t,o,i){return null===t&&(t={}),t[e[i]]=decodeURIComponent(o),t},null):null}(w,g):w.groups?w.groups:w.slice(1);return{url:s(h.replace(new RegExp("^"+t.instance.root),"")),queryString:u,hashString:c(t.to),route:e,data:v,params:f}}return!1}function u(){return!("undefined"==typeof window||!window.history||!window.history.pushState)}function f(t,e){return void 0===t[e]||!0===t[e]}function g(){return"undefined"!=typeof window}function m(t,e){return void 0===t&&(t=[]),void 0===e&&(e={}),t.filter(function(t){return t}).forEach(function(t){["before","after","already","leave"].forEach(function(o){t[o]&&(e[o]||(e[o]=[]),e[o].push(t[o]))})}),e}function w(t,e,o){var i=e||{},n=0;!function e(){t[n]?Array.isArray(t[n])?(t.splice.apply(t,[n,1].concat(t[n][0](i)?t[n][1]:t[n][2])),e()):t[n](i,function(t){void 0===t||!0===t?(n+=1,e()):o&&o(i)}):o&&o(i)}()}function v(t,e){void 0===t.currentLocationPath&&(t.currentLocationPath=t.to=r(t.instance.root)),t.currentLocationPath=t.instance._checkForAHash(t.currentLocationPath),e()}function b(t,e){for(var o=0;o<t.instance.routes.length;o++){var i=h(t,t.instance.routes[o]);if(i&&(t.matches||(t.matches=[]),t.matches.push(i),"ONE"===t.resolveOptions.strategy))return void e()}e()}function y(t,e){t.navigateOptions&&(void 0!==t.navigateOptions.shouldResolve&&console.warn('"shouldResolve" is deprecated. Please check the documentation.'),void 0!==t.navigateOptions.silent&&console.warn('"silent" is deprecated. Please check the documentation.')),e()}function F(t,e){!0===t.navigateOptions.force?(t.instance._setCurrent([t.instance._pathToMatchObject(t.to)]),e(!1)):e()}w.if=function(t,e,o){return Array.isArray(e)||(e=[e]),Array.isArray(o)||(o=[o]),[t,e,o]};var S=g(),P=u();function _(t,e){if(f(t.navigateOptions,"updateBrowserURL")){var o=("/"+t.to).replace(/\/\//g,"/"),i=S&&t.resolveOptions&&!0===t.resolveOptions.hash;P?(history[t.navigateOptions.historyAPIMethod||"pushState"](t.navigateOptions.stateObj||{},t.navigateOptions.title||"",i?"#"+o:o),location&&location.hash&&(t.instance.__freezeListening=!0,setTimeout(function(){if(!i){var e=location.hash;location.hash="",location.hash=e}t.instance.__freezeListening=!1},1))):S&&(window.location.href=t.to)}e()}function x(t,e){var o=t.instance;o.lastResolved()?w(o.lastResolved().map(function(e){return function(o,i){if(e.route.hooks&&e.route.hooks.leave){var n,a=t.instance.matchLocation(e.route.path,t.currentLocationPath,!1);n="*"!==e.route.path?!a:!(t.matches&&t.matches.find(function(t){return e.route.path===t.route.path})),f(t.navigateOptions,"callHooks")&&n?w(e.route.hooks.leave.map(function(e){return function(o,i){return e(function(e){!1===e?t.instance.__markAsClean(t):i()},t.matches&&t.matches.length>0?1===t.matches.length?t.matches[0]:t.matches:void 0)}}).concat([function(){return i()}])):i()}else i()}}),{},function(){return e()}):e()}function D(t,e){f(t.navigateOptions,"updateState")&&t.instance._setCurrent(t.matches),e()}var C=[function(t,e){var o=t.instance.lastResolved();if(o&&o[0]&&o[0].route===t.match.route&&o[0].url===t.match.url&&o[0].queryString===t.match.queryString)return o.forEach(function(e){e.route.hooks&&e.route.hooks.already&&f(t.navigateOptions,"callHooks")&&e.route.hooks.already.forEach(function(e){return e(t.match)})}),void e(!1);e()},function(t,e){t.match.route.hooks&&t.match.route.hooks.before&&f(t.navigateOptions,"callHooks")?w(t.match.route.hooks.before.map(function(e){return function(o,i){return e(function(e){!1===e?t.instance.__markAsClean(t):i()},t.match)}}).concat([function(){return e()}])):e()},function(t,e){f(t.navigateOptions,"callHandler")&&t.match.route.handler(t.match),t.instance.updatePageLinks(),e()},function(t,e){t.match.route.hooks&&t.match.route.hooks.after&&f(t.navigateOptions,"callHooks")&&t.match.route.hooks.after.forEach(function(e){return e(t.match)}),e()}],T=[x,function(t,e){var o=t.instance._notFoundRoute;if(o){t.notFoundHandled=!0;var i=d(t.currentLocationPath),n=i[0],a=i[1],r=c(t.to);o.path=s(n);var l={url:o.path,queryString:a,hashString:r,data:null,route:o,params:""!==a?p(a):null};t.matches=[l],t.match=l}e()},w.if(function(t){return t.notFoundHandled},C.concat([D]),[function(t,e){t.resolveOptions&&!1!==t.resolveOptions.noMatchWarning&&void 0!==t.resolveOptions.noMatchWarning||console.warn('Navigo: "'+t.currentLocationPath+"\" didn't match any of the registered routes."),e()},function(t,e){t.instance._setCurrent(null),e()}])];function A(){return(A=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var o=arguments[e];for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(t[i]=o[i])}return t}).apply(this,arguments)}function I(t,e){var o=0;x(t,function i(){o!==t.matches.length?w(C,A({},t,{match:t.matches[o]}),function(){o+=1,i()}):D(t,e)})}function E(t){t.instance.__markAsClean(t)}function V(){return(V=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var o=arguments[e];for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(t[i]=o[i])}return t}).apply(this,arguments)}var M="[data-navigo]";function k(t,e){var o,i=e||{strategy:"ONE",hash:!1,noMatchWarning:!1,linksSelector:M},n=this,a="/",f=null,S=[],P=!1,x=u(),D=g();function C(t){return t.indexOf("#")>=0&&(t=!0===i.hash?t.split("#")[1]||"/":t.split("#")[0]),t}function A(t){return s(a+"/"+s(t))}function k(t,e,o,i){return t=l(t)?A(t):t,{name:i||s(String(t)),path:t,handler:e,hooks:m(o)}}function H(t,e){if(!n.__dirty){n.__dirty=!0,t=t?s(a)+"/"+s(t):void 0;var o={instance:n,to:t,currentLocationPath:t,navigateOptions:{},resolveOptions:V({},i,e)};return w([v,b,w.if(function(t){var e=t.matches;return e&&e.length>0},I,T)],o,E),!!o.matches&&o.matches}n.__waiting.push(function(){return n.resolve(t,e)})}function R(t,e){if(n.__dirty)n.__waiting.push(function(){return n.navigate(t,e)});else{n.__dirty=!0,t=s(a)+"/"+s(t);var o={instance:n,to:t,navigateOptions:e||{},resolveOptions:e&&e.resolveOptions?e.resolveOptions:i,currentLocationPath:C(t)};w([y,F,b,w.if(function(t){var e=t.matches;return e&&e.length>0},I,T),_,E],o,E)}}function L(){if(D)return(D?[].slice.call(document.querySelectorAll(i.linksSelector||M)):[]).forEach(function(t){"false"!==t.getAttribute("data-navigo")&&"_blank"!==t.getAttribute("target")?t.hasListenerAttached||(t.hasListenerAttached=!0,t.navigoHandler=function(e){if((e.ctrlKey||e.metaKey)&&"a"===e.target.tagName.toLowerCase())return!1;var o=t.getAttribute("href");if(null==o)return!1;if(o.match(/^(http|https)/)&&"undefined"!=typeof URL)try{var i=new URL(o);o=i.pathname+i.search}catch(t){}var a=function(t){if(!t)return{};var e,o=t.split(","),i={};return o.forEach(function(t){var o=t.split(":").map(function(t){return t.replace(/(^ +| +$)/g,"")});switch(o[0]){case"historyAPIMethod":i.historyAPIMethod=o[1];break;case"resolveOptionsStrategy":e||(e={}),e.strategy=o[1];break;case"resolveOptionsHash":e||(e={}),e.hash="true"===o[1];break;case"updateBrowserURL":case"callHandler":case"updateState":case"force":i[o[0]]="true"===o[1]}}),e&&(i.resolveOptions=e),i}(t.getAttribute("data-navigo-options"));P||(e.preventDefault(),e.stopPropagation(),n.navigate(s(o),a))},t.addEventListener("click",t.navigoHandler)):t.hasListenerAttached&&t.removeEventListener("click",t.navigoHandler)}),n}function N(t,e,o){var i=S.find(function(e){return e.name===t}),n=null;if(i){if(n=i.path,e)for(var r in e)n=n.replace(":"+r,e[r]);n=n.match(/^\//)?n:"/"+n}return n&&o&&!o.includeRoot&&(n=n.replace(new RegExp("^/"+a),"")),n}function j(t){var e=d(s(t)),i=e[0],n=e[1],a=""===n?null:p(n);return{url:i,queryString:n,hashString:c(t),route:k(i,function(){},[o],i),data:null,params:a}}function B(t,e,o){return"string"==typeof e&&(e=$(e)),e?(e.hooks[t]||(e.hooks[t]=[]),e.hooks[t].push(o),function(){e.hooks[t]=e.hooks[t].filter(function(t){return t!==o})}):(console.warn("Route doesn't exists: "+e),function(){})}function $(t){return"string"==typeof t?S.find(function(e){return e.name===A(t)}):S.find(function(e){return e.handler===t})}t?a=s(t):console.warn('Navigo requires a root path in its constructor. If not provided will use "/" as default.'),this.root=a,this.routes=S,this.destroyed=P,this.current=f,this.__freezeListening=!1,this.__waiting=[],this.__dirty=!1,this.__markAsClean=function(t){t.instance.__dirty=!1,t.instance.__waiting.length>0&&t.instance.__waiting.shift()()},this.on=function(t,e,i){var n=this;return"object"!=typeof t||t instanceof RegExp?("function"==typeof t&&(i=e,e=t,t=a),S.push(k(t,e,[o,i])),this):(Object.keys(t).forEach(function(e){if("function"==typeof t[e])n.on(e,t[e]);else{var i=t[e],a=i.uses,r=i.as,s=i.hooks;S.push(k(e,a,[o,s],r))}}),this)},this.off=function(t){return this.routes=S=S.filter(function(e){return l(t)?s(e.path)!==s(t):"function"==typeof t?t!==e.handler:String(e.path)!==String(t)}),this},this.resolve=H,this.navigate=R,this.navigateByName=function(t,e,o){var i=N(t,e);return null!==i&&(R(i.replace(new RegExp("^/?"+a),""),o),!0)},this.destroy=function(){this.routes=S=[],x&&window.removeEventListener("popstate",this.__popstateListener),this.destroyed=P=!0},this.notFound=function(t,e){return n._notFoundRoute=k("*",t,[o,e],"__NOT_FOUND__"),this},this.updatePageLinks=L,this.link=function(t){return"/"+a+"/"+s(t)},this.hooks=function(t){return o=t,this},this.extractGETParameters=function(t){return d(C(t))},this.lastResolved=function(){return f},this.generate=N,this.getLinkPath=function(t){return t.getAttribute("href")},this.match=function(t){var e={instance:n,currentLocationPath:t,to:t,navigateOptions:{},resolveOptions:i};return b(e,function(){}),!!e.matches&&e.matches},this.matchLocation=function(t,e,o){void 0===e||void 0!==o&&!o||(e=A(e));var i={instance:n,to:e,currentLocationPath:e};return v(i,function(){}),"string"==typeof t&&(t=void 0===o||o?A(t):t),h(i,{name:String(t),path:t,handler:function(){},hooks:{}})||!1},this.getCurrentLocation=function(){return j(s(r(a)).replace(new RegExp("^"+a),""))},this.addBeforeHook=B.bind(this,"before"),this.addAfterHook=B.bind(this,"after"),this.addAlreadyHook=B.bind(this,"already"),this.addLeaveHook=B.bind(this,"leave"),this.getRoute=$,this._pathToMatchObject=j,this._clean=s,this._checkForAHash=C,this._setCurrent=function(t){return f=n.current=t},function(){x&&(this.__popstateListener=function(){n.__freezeListening||H()},window.addEventListener("popstate",this.__popstateListener))}.call(this),L.call(this)}}},e={};function o(i){if(e[i])return e[i].exports;var n=e[i]={exports:{}};return t[i](n,n.exports,o),n.exports}return o.d=function(t,e){for(var i in e)o.o(e,i)&&!o.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},o.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},o(407)}().default},"object"==typeof o&&"object"==typeof e?e.exports=n():"object"==typeof o?o.Navigo=n():i.Navigo=n()},{}],4:[function(t,e,o){e.exports={name:"pict-application",version:"1.0.33",description:"Application base class for a pict view-based application",main:"source/Pict-Application.js",scripts:{test:"npx quack test",start:"node source/Pict-Application.js",coverage:"npx quack coverage",build:"npx quack build","docker-dev-build":"docker build ./ -f Dockerfile_LUXURYCode -t pict-application-image:local","docker-dev-run":'docker run -it -d --name pict-application-dev -p 30001:8080 -p 38086:8086 -v "$PWD/.config:/home/coder/.config" -v "$PWD:/home/coder/pict-application" -u "$(id -u):$(id -g)" -e "DOCKER_USER=$USER" pict-application-image:local',"docker-dev-shell":"docker exec -it pict-application-dev /bin/bash",tests:"npx quack test -g",lint:"eslint source/**",types:"tsc -p ."},types:"types/source/Pict-Application.d.ts",repository:{type:"git",url:"git+https://github.com/stevenvelozo/pict-application.git"},author:"steven velozo <steven@velozo.com>",license:"MIT",bugs:{url:"https://github.com/stevenvelozo/pict-application/issues"},homepage:"https://github.com/stevenvelozo/pict-application#readme",devDependencies:{"@eslint/js":"^9.28.0","browser-env":"^3.3.0",eslint:"^9.28.0",pict:"^1.0.348","pict-provider":"^1.0.10","pict-view":"^1.0.66",quackage:"^1.0.58",typescript:"^5.9.3"},mocha:{diff:!0,extension:["js"],package:"./package.json",reporter:"spec",slow:"75",timeout:"5000",ui:"tdd","watch-files":["source/**/*.js","test/**/*.js"],"watch-ignore":["lib/vendor"]},dependencies:{"fable-serviceproviderbase":"^3.0.19"}}},{}],5:[function(t,e,o){const i=t("fable-serviceproviderbase"),n=t("../package.json"),a={Name:"DefaultPictApplication",MainViewportViewIdentifier:"Default-View",MainViewportRenderableHash:!1,MainViewportDestinationAddress:!1,MainViewportDefaultDataAddress:!1,AutoSolveAfterInitialize:!0,AutoRenderMainViewportViewAfterInitialize:!0,AutoRenderViewsAfterInitialize:!1,AutoLoginAfterInitialize:!1,AutoLoadDataAfterLogin:!1,ConfigurationOnlyViews:[],Manifests:{},IdentifierAddressPrefix:"PICT-"};e.exports=class extends i{constructor(t,e,o){let i="object"==typeof t.settings.PictApplicationConfiguration?t.settings.PictApplicationConfiguration:{};super(t,Object.assign({},JSON.parse(JSON.stringify(a)),i,e),o),this.options,this.log,this.fable,this.UUID,this.Hash,this.servicesMap,this.serviceType="PictApplication",this._Package=n,this.pict=this.fable,this.AppData=this.fable.AppData,this.Bundle=this.fable.Bundle,this.initializeTimestamp,this.lastSolvedTimestamp,this.lastLoginTimestamp,this.lastMarshalFromViewsTimestamp,this.lastMarshalToViewsTimestamp,this.lastAutoRenderTimestamp,this.lastLoadDataTimestamp;let r=Object.keys(this.options.Manifests);if(r.length>0)for(let t=0;t<r.length;t++){let e=r[t];this.fable.instantiateServiceProvider("Manifest",this.options.Manifests[e],e)}}onPreSolve(){return this.pict.LogNoisiness>3&&this.log.trace(`PictApp [${this.UUID}]::[${this.Hash}] ${this.options.Name} onPreSolve:`),!0}onPreSolveAsync(t){return this.onPreSolve(),t()}onBeforeSolve(){return this.pict.LogNoisiness>3&&this.log.trace(`PictApp [${this.UUID}]::[${this.Hash}] ${this.options.Name} onBeforeSolve:`),!0}onBeforeSolveAsync(t){return this.onBeforeSolve(),t()}onSolve(){return this.pict.LogNoisiness>3&&this.log.trace(`PictApp [${this.UUID}]::[${this.Hash}] ${this.options.Name} onSolve:`),!0}onSolveAsync(t){return this.onSolve(),t()}solve(){this.pict.LogNoisiness>2&&this.log.trace(`PictApp [${this.UUID}]::[${this.Hash}] ${this.options.Name} executing solve() function...`);let t=Object.keys(this.pict.providers),e=[];for(let o=0;o<t.length;o++){let i=this.pict.providers[t[o]];i.options.AutoSolveWithApp&&e.push(i)}e.sort((t,e)=>t.options.AutoSolveOrdinal-e.options.AutoSolveOrdinal);for(let t=0;t<e.length;t++)e[t].solve(e[t]);this.onBeforeSolve();let o=Object.keys(this.pict.views),i=[];for(let t=0;t<o.length;t++){let e=this.pict.views[o[t]];e.options.AutoInitialize&&i.push(e)}i.sort((t,e)=>t.options.AutoInitializeOrdinal-e.options.AutoInitializeOrdinal);for(let t=0;t<i.length;t++)i[t].solve();return this.onSolve(),this.onAfterSolve(),this.lastSolvedTimestamp=this.fable.log.getTimeStamp(),!0}solveAsync(t){let e=this.fable.instantiateServiceProviderWithoutRegistration("Anticipate");e.anticipate(this.onBeforeSolveAsync.bind(this));let o="function"==typeof t&&t;o||(this.log.warn(`PictApp [${this.UUID}]::[${this.Hash}] ${this.options.Name} solveAsync was called without a valid callback. A callback will be generated but this could lead to race conditions.`),o=t=>{t&&this.log.error(`PictApp [${this.UUID}]::[${this.Hash}] ${this.options.Name} solveAsync Auto Callback Error: ${t}`,t)});let i=Object.keys(this.pict.providers),n=[];for(let t=0;t<i.length;t++){let e=this.pict.providers[i[t]];e.options.AutoSolveWithApp&&n.push(e)}n.sort((t,e)=>t.options.AutoSolveOrdinal-e.options.AutoSolveOrdinal);for(let t=0;t<n.length;t++)e.anticipate(n[t].solveAsync.bind(n[t]));let a=Object.keys(this.pict.views),r=[];for(let t=0;t<a.length;t++){let e=this.pict.views[a[t]];e.options.AutoSolveWithApp&&r.push(e)}r.sort((t,e)=>t.options.AutoSolveOrdinal-e.options.AutoSolveOrdinal);for(let t=0;t<r.length;t++)e.anticipate(r[t].solveAsync.bind(r[t]));e.anticipate(this.onSolveAsync.bind(this)),e.anticipate(this.onAfterSolveAsync.bind(this)),e.wait(t=>(this.pict.LogNoisiness>2&&this.log.trace(`PictApp [${this.UUID}]::[${this.Hash}] ${this.options.Name} solveAsync() complete.`),this.lastSolvedTimestamp=this.fable.log.getTimeStamp(),o(t)))}onAfterSolve(){return this.pict.LogNoisiness>3&&this.log.trace(`PictApp [${this.UUID}]::[${this.Hash}] ${this.options.Name} onAfterSolve:`),!0}onAfterSolveAsync(t){return this.onAfterSolve(),t()}onBeforeLoginAsync(t){return this.pict.LogNoisiness>3&&this.log.trace(`PictApp [${this.UUID}]::[${this.Hash}] ${this.options.Name} onBeforeLoginAsync:`),t()}onLoginAsync(t){return this.pict.LogNoisiness>3&&this.log.trace(`PictApp [${this.UUID}]::[${this.Hash}] ${this.options.Name} onLoginAsync:`),t()}loginAsync(t){const e=this.fable.instantiateServiceProviderWithoutRegistration("Anticipate");let o=t;"function"!=typeof o&&(this.log.warn(`PictApp [${this.UUID}]::[${this.Hash}] ${this.options.Name} loginAsync was called without a valid callback. A callback will be generated but this could lead to race conditions.`),o=t=>{t&&this.log.error(`PictApp [${this.UUID}]::[${this.Hash}] ${this.options.Name} loginAsync Auto Callback Error: ${t}`,t)}),e.anticipate(this.onBeforeLoginAsync.bind(this)),e.anticipate(this.onLoginAsync.bind(this)),e.anticipate(this.onAfterLoginAsync.bind(this)),this.options.AutoLoadDataAfterLogin&&e.anticipate(t=>{if(!this.isLoggedIn())return t();this.pict.LogNoisiness>1&&this.log.trace(`PictApp [${this.UUID}]::[${this.Hash}] ${this.options.Name} auto loading data after login...`),this.loadDataAsync(e=>{t(e)})}),e.wait(t=>(this.pict.LogNoisiness>2&&this.log.trace(`PictApp [${this.UUID}]::[${this.Hash}] ${this.options.Name} loginAsync() complete.`),this.lastLoginTimestamp=this.fable.log.getTimeStamp(),o(t)))}isLoggedIn(){return!0}onAfterLoginAsync(t){return this.pict.LogNoisiness>3&&this.log.trace(`PictApp [${this.UUID}]::[${this.Hash}] ${this.options.Name} onAfterLoginAsync:`),t()}onBeforeLoadDataAsync(t){return this.pict.LogNoisiness>3&&this.log.trace(`PictApp [${this.UUID}]::[${this.Hash}] ${this.options.Name} onBeforeLoadDataAsync:`),t()}onLoadDataAsync(t){return this.pict.LogNoisiness>3&&this.log.trace(`PictApp [${this.UUID}]::[${this.Hash}] ${this.options.Name} onLoadDataAsync:`),t()}loadDataAsync(t){const e=this.fable.instantiateServiceProviderWithoutRegistration("Anticipate");let o=t;"function"!=typeof o&&(this.log.warn(`PictApp [${this.UUID}]::[${this.Hash}] ${this.options.Name} loadDataAsync was called without a valid callback. A callback will be generated but this could lead to race conditions.`),o=t=>{t&&this.log.error(`PictApp [${this.UUID}]::[${this.Hash}] ${this.options.Name} loadDataAsync Auto Callback Error: ${t}`,t)}),e.anticipate(this.onBeforeLoadDataAsync.bind(this));let i=Object.keys(this.pict.providers),n=[];for(let t=0;t<i.length;t++){let e=this.pict.providers[i[t]];e.options.AutoLoadDataWithApp&&n.push(e)}n.sort((t,e)=>t.options.AutoLoadDataOrdinal-e.options.AutoLoadDataOrdinal);for(const t of n)e.anticipate(t.onBeforeLoadDataAsync.bind(t));e.anticipate(this.onLoadDataAsync.bind(this));for(const t of n)e.anticipate(t.onLoadDataAsync.bind(t));e.anticipate(this.onAfterLoadDataAsync.bind(this));for(const t of n)e.anticipate(t.onAfterLoadDataAsync.bind(t));e.wait(t=>(this.pict.LogNoisiness>2&&this.log.trace(`PictApp [${this.UUID}]::[${this.Hash}] ${this.options.Name} loadDataAsync() complete.`),this.lastLoadDataTimestamp=this.fable.log.getTimeStamp(),o(t)))}onAfterLoadDataAsync(t){return this.pict.LogNoisiness>3&&this.log.trace(`PictApp [${this.UUID}]::[${this.Hash}] ${this.options.Name} onAfterLoadDataAsync:`),t()}onBeforeSaveDataAsync(t){return this.pict.LogNoisiness>3&&this.log.trace(`PictApp [${this.UUID}]::[${this.Hash}] ${this.options.Name} onBeforeSaveDataAsync:`),t()}onSaveDataAsync(t){return this.pict.LogNoisiness>3&&this.log.trace(`PictApp [${this.UUID}]::[${this.Hash}] ${this.options.Name} onSaveDataAsync:`),t()}saveDataAsync(t){const e=this.fable.instantiateServiceProviderWithoutRegistration("Anticipate");let o=t;"function"!=typeof o&&(this.log.warn(`PictApp [${this.UUID}]::[${this.Hash}] ${this.options.Name} saveDataAsync was called without a valid callback. A callback will be generated but this could lead to race conditions.`),o=t=>{t&&this.log.error(`PictApp [${this.UUID}]::[${this.Hash}] ${this.options.Name} saveDataAsync Auto Callback Error: ${t}`,t)}),e.anticipate(this.onBeforeSaveDataAsync.bind(this));let i=Object.keys(this.pict.providers),n=[];for(let t=0;t<i.length;t++){let e=this.pict.providers[i[t]];e.options.AutoSaveDataWithApp&&n.push(e)}n.sort((t,e)=>t.options.AutoSaveDataOrdinal-e.options.AutoSaveDataOrdinal);for(const t of n)e.anticipate(t.onBeforeSaveDataAsync.bind(t));e.anticipate(this.onSaveDataAsync.bind(this));for(const t of n)e.anticipate(t.onSaveDataAsync.bind(t));e.anticipate(this.onAfterSaveDataAsync.bind(this));for(const t of n)e.anticipate(t.onAfterSaveDataAsync.bind(t));e.wait(t=>(this.pict.LogNoisiness>2&&this.log.trace(`PictApp [${this.UUID}]::[${this.Hash}] ${this.options.Name} saveDataAsync() complete.`),this.lastSaveDataTimestamp=this.fable.log.getTimeStamp(),o(t)))}onAfterSaveDataAsync(t){return this.pict.LogNoisiness>3&&this.log.trace(`PictApp [${this.UUID}]::[${this.Hash}] ${this.options.Name} onAfterSaveDataAsync:`),t()}onBeforeInitialize(){return this.pict.LogNoisiness>3&&this.log.trace(`PictApp [${this.UUID}]::[${this.Hash}] ${this.options.Name} onBeforeInitialize:`),!0}onBeforeInitializeAsync(t){return this.onBeforeInitialize(),t()}onInitialize(){return this.pict.LogNoisiness>3&&this.log.trace(`PictApp [${this.UUID}]::[${this.Hash}] ${this.options.Name} onInitialize:`),!0}onInitializeAsync(t){return this.onInitialize(),t()}initialize(){if(this.pict.LogControlFlow&&this.log.trace(`PICT-ControlFlow APPLICATION [${this.UUID}]::[${this.Hash}] ${this.options.Name} initialize:`),this.initializeTimestamp)return this.log.warn(`PictApp [${this.UUID}]::[${this.Hash}] ${this.options.Name} initialize called but initialization is already completed. Aborting.`),!1;{if(this.onBeforeInitialize(),"ConfigurationOnlyViews"in this.options)for(let t=0;t<this.options.ConfigurationOnlyViews.length;t++){let e=void 0===this.options.ConfigurationOnlyViews[t].ViewIdentifier?`AutoView-${this.fable.getUUID()}`:this.options.ConfigurationOnlyViews[t].ViewIdentifier;this.log.info(`PictApp [${this.UUID}]::[${this.Hash}] ${this.options.Name} adding configuration only view: ${e}`),this.pict.addView(e,this.options.ConfigurationOnlyViews[t])}this.onInitialize();let t=Object.keys(this.pict.providers),e=[];for(let o=0;o<t.length;o++){let i=this.pict.providers[t[o]];i.options.AutoInitialize&&e.push(i)}e.sort((t,e)=>t.options.AutoInitializeOrdinal-e.options.AutoInitializeOrdinal);for(let t=0;t<e.length;t++)e[t].initialize();let o=Object.keys(this.pict.views),i=[];for(let t=0;t<o.length;t++){let e=this.pict.views[o[t]];e.options.AutoInitialize&&i.push(e)}i.sort((t,e)=>t.options.AutoInitializeOrdinal-e.options.AutoInitializeOrdinal);for(let t=0;t<i.length;t++)i[t].initialize();return this.onAfterInitialize(),this.options.AutoSolveAfterInitialize&&(this.pict.LogNoisiness>1&&this.log.trace(`PictApp [${this.UUID}]::[${this.Hash}] ${this.options.Name} auto solving after initialization...`),this.solve()),this.options.AutoRenderMainViewportViewAfterInitialize&&(this.pict.LogNoisiness>1&&this.log.trace(`PictApp [${this.UUID}]::[${this.Hash}] ${this.options.Name} auto rendering after initialization...`),this.render()),this.initializeTimestamp=this.fable.log.getTimeStamp(),this.onCompletionOfInitialize(),!0}}initializeAsync(t){this.pict.LogControlFlow&&this.log.trace(`PICT-ControlFlow APPLICATION [${this.UUID}]::[${this.Hash}] ${this.options.Name} initializeAsync:`);let e="function"==typeof t&&t;if(e||(this.log.warn(`PictApp [${this.UUID}]::[${this.Hash}] ${this.options.Name} initializeAsync was called without a valid callback. A callback will be generated but this could lead to race conditions.`),e=t=>{t&&this.log.error(`PictApp [${this.UUID}]::[${this.Hash}] ${this.options.Name} initializeAsync Auto Callback Error: ${t}`,t)}),this.initializeTimestamp)return this.log.warn(`PictApp [${this.UUID}]::[${this.Hash}] ${this.options.Name} async initialize called but initialization is already completed. Aborting.`),this.onCompletionOfInitializeAsync(e);{let t=this.fable.instantiateServiceProviderWithoutRegistration("Anticipate");if(this.pict.LogNoisiness>3&&this.log.trace(`PictApp [${this.UUID}]::[${this.Hash}] ${this.options.Name} beginning initialization...`),"ConfigurationOnlyViews"in this.options)for(let t=0;t<this.options.ConfigurationOnlyViews.length;t++){let e=void 0===this.options.ConfigurationOnlyViews[t].ViewIdentifier?`AutoView-${this.fable.getUUID()}`:this.options.ConfigurationOnlyViews[t].ViewIdentifier;this.log.info(`PictApp [${this.UUID}]::[${this.Hash}] ${this.options.Name} adding configuration only view: ${e}`),this.pict.addView(e,this.options.ConfigurationOnlyViews[t])}t.anticipate(this.onBeforeInitializeAsync.bind(this)),t.anticipate(this.onInitializeAsync.bind(this));let o=Object.keys(this.pict.providers),i=[];for(let t=0;t<o.length;t++){let e=this.pict.providers[o[t]];e.options.AutoInitialize&&i.push(e)}i.sort((t,e)=>t.options.AutoInitializeOrdinal-e.options.AutoInitializeOrdinal);for(let e=0;e<i.length;e++)t.anticipate(i[e].initializeAsync.bind(i[e]));let n=Object.keys(this.pict.views),a=[];for(let t=0;t<n.length;t++){let e=this.pict.views[n[t]];e.options.AutoInitialize&&a.push(e)}a.sort((t,e)=>t.options.AutoInitializeOrdinal-e.options.AutoInitializeOrdinal);for(let e=0;e<a.length;e++){let o=a[e];t.anticipate(o.initializeAsync.bind(o))}t.anticipate(this.onAfterInitializeAsync.bind(this)),this.options.AutoLoginAfterInitialize&&(this.pict.LogNoisiness>1&&this.log.trace(`PictApp [${this.UUID}]::[${this.Hash}] ${this.options.Name} auto login (asynchronously) after initialization...`),t.anticipate(this.loginAsync.bind(this))),this.options.AutoSolveAfterInitialize&&(this.pict.LogNoisiness>1&&this.log.trace(`PictApp [${this.UUID}]::[${this.Hash}] ${this.options.Name} auto solving (asynchronously) after initialization...`),t.anticipate(this.solveAsync.bind(this))),this.options.AutoRenderMainViewportViewAfterInitialize&&(this.pict.LogNoisiness>1&&this.log.trace(`PictApp [${this.UUID}]::[${this.Hash}] ${this.options.Name} auto rendering (asynchronously) after initialization...`),t.anticipate(this.renderMainViewportAsync.bind(this))),t.wait(t=>(t&&this.log.error(`PictApp [${this.UUID}]::[${this.Hash}] ${this.options.Name} initializeAsync Error: ${t.message||t}`,{stack:t.stack}),this.initializeTimestamp=this.fable.log.getTimeStamp(),this.pict.LogNoisiness>2&&this.log.trace(`PictApp [${this.UUID}]::[${this.Hash}] ${this.options.Name} initialization complete.`),e()))}}onAfterInitialize(){return this.pict.LogNoisiness>3&&this.log.trace(`PictApp [${this.UUID}]::[${this.Hash}] ${this.options.Name} onAfterInitialize:`),!0}onAfterInitializeAsync(t){return this.onAfterInitialize(),t()}onCompletionOfInitialize(){return this.pict.LogNoisiness>3&&this.log.trace(`PictApp [${this.UUID}]::[${this.Hash}] ${this.options.Name} onCompletionOfInitialize:`),!0}onCompletionOfInitializeAsync(t){return this.onCompletionOfInitialize(),t()}onBeforeMarshalFromViews(){return this.pict.LogNoisiness>3&&this.log.trace(`PictApp [${this.UUID}]::[${this.Hash}] ${this.options.Name} onBeforeMarshalFromViews:`),!0}onBeforeMarshalFromViewsAsync(t){return this.onBeforeMarshalFromViews(),t()}onMarshalFromViews(){return this.pict.LogNoisiness>3&&this.log.trace(`PictApp [${this.UUID}]::[${this.Hash}] ${this.options.Name} onMarshalFromViews:`),!0}onMarshalFromViewsAsync(t){return this.onMarshalFromViews(),t()}marshalFromViews(){this.pict.LogNoisiness>2&&this.log.trace(`PictApp [${this.UUID}]::[${this.Hash}] ${this.options.Name} executing marshalFromViews() function...`),this.onBeforeMarshalFromViews();let t=Object.keys(this.pict.views),e=[];for(let o=0;o<t.length;o++){let i=this.pict.views[t[o]];e.push(i)}for(let t=0;t<e.length;t++)e[t].marshalFromView();return this.onMarshalFromViews(),this.onAfterMarshalFromViews(),this.lastMarshalFromViewsTimestamp=this.fable.log.getTimeStamp(),!0}marshalFromViewsAsync(t){let e=this.fable.instantiateServiceProviderWithoutRegistration("Anticipate"),o="function"==typeof t&&t;o||(this.log.warn(`PictApp [${this.UUID}]::[${this.Hash}] ${this.options.Name} marshalFromViewsAsync was called without a valid callback. A callback will be generated but this could lead to race conditions.`),o=t=>{t&&this.log.error(`PictApp [${this.UUID}]::[${this.Hash}] ${this.options.Name} marshalFromViewsAsync Auto Callback Error: ${t}`,t)}),e.anticipate(this.onBeforeMarshalFromViewsAsync.bind(this));let i=Object.keys(this.pict.views),n=[];for(let t=0;t<i.length;t++){let e=this.pict.views[i[t]];n.push(e)}for(let t=0;t<n.length;t++)e.anticipate(n[t].marshalFromViewAsync.bind(n[t]));e.anticipate(this.onMarshalFromViewsAsync.bind(this)),e.anticipate(this.onAfterMarshalFromViewsAsync.bind(this)),e.wait(t=>(this.pict.LogNoisiness>2&&this.log.trace(`PictApp [${this.UUID}]::[${this.Hash}] ${this.options.Name} marshalFromViewsAsync() complete.`),this.lastMarshalFromViewsTimestamp=this.fable.log.getTimeStamp(),o(t)))}onAfterMarshalFromViews(){return this.pict.LogNoisiness>3&&this.log.trace(`PictApp [${this.UUID}]::[${this.Hash}] ${this.options.Name} onAfterMarshalFromViews:`),!0}onAfterMarshalFromViewsAsync(t){return this.onAfterMarshalFromViews(),t()}onBeforeMarshalToViews(){return this.pict.LogNoisiness>3&&this.log.trace(`PictApp [${this.UUID}]::[${this.Hash}] ${this.options.Name} onBeforeMarshalToViews:`),!0}onBeforeMarshalToViewsAsync(t){return this.onBeforeMarshalToViews(),t()}onMarshalToViews(){return this.pict.LogNoisiness>3&&this.log.trace(`PictApp [${this.UUID}]::[${this.Hash}] ${this.options.Name} onMarshalToViews:`),!0}onMarshalToViewsAsync(t){return this.onMarshalToViews(),t()}marshalToViews(){this.pict.LogNoisiness>2&&this.log.trace(`PictApp [${this.UUID}]::[${this.Hash}] ${this.options.Name} executing marshalToViews() function...`),this.onBeforeMarshalToViews();let t=Object.keys(this.pict.views),e=[];for(let o=0;o<t.length;o++){let i=this.pict.views[t[o]];e.push(i)}for(let t=0;t<e.length;t++)e[t].marshalToView();return this.onMarshalToViews(),this.onAfterMarshalToViews(),this.lastMarshalToViewsTimestamp=this.fable.log.getTimeStamp(),!0}marshalToViewsAsync(t){let e=this.fable.instantiateServiceProviderWithoutRegistration("Anticipate"),o="function"==typeof t&&t;o||(this.log.warn(`PictApp [${this.UUID}]::[${this.Hash}] ${this.options.Name} marshalToViewsAsync was called without a valid callback. A callback will be generated but this could lead to race conditions.`),o=t=>{t&&this.log.error(`PictApp [${this.UUID}]::[${this.Hash}] ${this.options.Name} marshalToViewsAsync Auto Callback Error: ${t}`,t)}),e.anticipate(this.onBeforeMarshalToViewsAsync.bind(this));let i=Object.keys(this.pict.views),n=[];for(let t=0;t<i.length;t++){let e=this.pict.views[i[t]];n.push(e)}for(let t=0;t<n.length;t++)e.anticipate(n[t].marshalToViewAsync.bind(n[t]));e.anticipate(this.onMarshalToViewsAsync.bind(this)),e.anticipate(this.onAfterMarshalToViewsAsync.bind(this)),e.wait(t=>(this.pict.LogNoisiness>2&&this.log.trace(`PictApp [${this.UUID}]::[${this.Hash}] ${this.options.Name} marshalToViewsAsync() complete.`),this.lastMarshalToViewsTimestamp=this.fable.log.getTimeStamp(),o(t)))}onAfterMarshalToViews(){return this.pict.LogNoisiness>3&&this.log.trace(`PictApp [${this.UUID}]::[${this.Hash}] ${this.options.Name} onAfterMarshalToViews:`),!0}onAfterMarshalToViewsAsync(t){return this.onAfterMarshalToViews(),t()}onBeforeRender(){return this.pict.LogNoisiness>3&&this.log.trace(`PictApp [${this.UUID}]::[${this.Hash}] ${this.options.Name} onBeforeRender:`),!0}onBeforeRenderAsync(t){return this.onBeforeRender(),t()}render(t,e,o,i){let n="string"!=typeof t?this.options.MainViewportViewIdentifier:t,a="string"!=typeof e?this.options.MainViewportRenderableHash:e,r="string"!=typeof o?this.options.MainViewportDestinationAddress:o,s="string"!=typeof i?this.options.MainViewportDefaultDataAddress:i;this.pict.LogControlFlow&&this.log.trace(`PICT-ControlFlow APPLICATION [${this.UUID}]::[${this.Hash}] ${this.options.Name} VIEW Renderable[${a}] Destination[${r}] TemplateDataAddress[${s}] render:`),this.onBeforeRender();let l="string"==typeof n&&this.servicesMap.PictView[n];return l?(this.onRender(),l.render(a,r,s),this.onAfterRender(),!0):(this.log.error(`PictApp [${this.UUID}]::[${this.Hash}] ${this.options.Name} could not render from View ${n} because it is not a valid view.`),!1)}onRender(){return this.pict.LogNoisiness>3&&this.log.trace(`PictApp [${this.UUID}]::[${this.Hash}] ${this.options.Name} onRender:`),!0}onRenderAsync(t){return this.onRender(),t()}renderAsync(t,e,o,i,n){let a="string"!=typeof t?this.options.MainViewportViewIdentifier:t,r="string"!=typeof e?this.options.MainViewportRenderableHash:e,s="string"!=typeof o?this.options.MainViewportDestinationAddress:o,l="string"!=typeof i?this.options.MainViewportDefaultDataAddress:i,c="function"==typeof n?n:"function"==typeof i?i:"function"==typeof o?o:"function"==typeof e?e:"function"==typeof t&&t;c||(this.log.warn(`PictApp [${this.UUID}]::[${this.Hash}] ${this.options.Name} renderAsync was called without a valid callback. A callback will be generated but this could lead to race conditions.`),c=t=>{t&&this.log.error(`PictApp [${this.UUID}]::[${this.Hash}] ${this.options.Name} renderAsync Auto Callback Error: ${t}`,t)}),this.pict.LogControlFlow&&this.log.trace(`PICT-ControlFlow APPLICATION [${this.UUID}]::[${this.Hash}] ${this.options.Name} VIEW Renderable[${r}] Destination[${s}] TemplateDataAddress[${l}] renderAsync:`);let d=this.fable.newAnticipate();d.anticipate(this.onBeforeRenderAsync.bind(this));let p="string"==typeof a&&this.servicesMap.PictView[a];if(!p){let t=`PictApp [${this.UUID}]::[${this.Hash}] ${this.options.Name} could not asynchronously render from View ${a} because it is not a valid view.`;return this.pict.LogNoisiness>3&&this.log.error(t),c(new Error(t))}return d.anticipate(this.onRenderAsync.bind(this)),d.anticipate(t=>{p.renderAsync.call(p,r,s,l,t)}),d.anticipate(this.onAfterRenderAsync.bind(this)),d.wait(c)}onAfterRender(){return this.pict.LogNoisiness>3&&this.log.trace(`PictApp [${this.UUID}]::[${this.Hash}] ${this.options.Name} onAfterRender:`),!0}onAfterRenderAsync(t){return this.onAfterRender(),t()}renderMainViewport(){return this.pict.LogControlFlow&&this.log.trace(`PICT-ControlFlow APPLICATION [${this.UUID}]::[${this.Hash}] ${this.options.Name} renderMainViewport:`),this.render()}renderMainViewportAsync(t){return this.pict.LogControlFlow&&this.log.trace(`PICT-ControlFlow APPLICATION [${this.UUID}]::[${this.Hash}] ${this.options.Name} renderMainViewportAsync:`),this.renderAsync(t)}renderAutoViews(){this.pict.LogNoisiness>0&&this.log.trace(`PictApp [${this.UUID}]::[${this.Hash}] ${this.options.Name} beginning renderAutoViews...`);let t=Object.keys(this.pict.views);t.sort((t,e)=>this.pict.views[t].options.AutoRenderOrdinal-this.pict.views[e].options.AutoRenderOrdinal);for(let e=0;e<t.length;e++){let o=this.pict.views[t[e]];o.options.AutoRender&&o.render()}this.pict.LogNoisiness>0&&this.log.trace(`PictApp [${this.UUID}]::[${this.Hash}] ${this.options.Name} renderAutoViewsAsync complete.`)}renderAutoViewsAsync(t){let e=this.fable.instantiateServiceProviderWithoutRegistration("Anticipate"),o="function"==typeof t&&t;o||(this.log.warn(`PictApp [${this.UUID}]::[${this.Hash}] ${this.options.Name} renderAutoViewsAsync was called without a valid callback. A callback will be generated but this could lead to race conditions.`),o=t=>{t&&this.log.error(`PictApp [${this.UUID}]::[${this.Hash}] ${this.options.Name} renderAutoViewsAsync Auto Callback Error: ${t}`,t)}),this.pict.LogNoisiness>0&&this.log.trace(`PictApp [${this.UUID}]::[${this.Hash}] ${this.options.Name} beginning renderAutoViewsAsync...`);let i=Object.keys(this.pict.views);i.sort((t,e)=>this.pict.views[t].options.AutoRenderOrdinal-this.pict.views[e].options.AutoRenderOrdinal);for(let t=0;t<i.length;t++){let o=this.pict.views[i[t]];o.options.AutoRender&&e.anticipate(o.renderAsync.bind(o))}e.wait(t=>(this.lastAutoRenderTimestamp=this.fable.log.getTimeStamp(),this.pict.LogNoisiness>0&&this.log.trace(`PictApp [${this.UUID}]::[${this.Hash}] ${this.options.Name} renderAutoViewsAsync complete.`),o(t)))}get isPictApplication(){return!0}}},{"../package.json":4,"fable-serviceproviderbase":2}],6:[function(t,e,o){e.exports={name:"pict-provider",version:"1.0.12",description:"Pict Provider Base Class",main:"source/Pict-Provider.js",scripts:{start:"node source/Pict-Provider.js",test:"npx quack test",tests:"npx quack test -g",coverage:"npx quack coverage",build:"npx quack build","docker-dev-build":"docker build ./ -f Dockerfile_LUXURYCode -t pict-provider-image:local","docker-dev-run":'docker run -it -d --name pict-provider-dev -p 24125:8080 -p 30027:8086 -v "$PWD/.config:/home/coder/.config" -v "$PWD:/home/coder/pict-provider" -u "$(id -u):$(id -g)" -e "DOCKER_USER=$USER" pict-provider-image:local',"docker-dev-shell":"docker exec -it pict-provider-dev /bin/bash",lint:"eslint source/**",types:"tsc -p ."},types:"types/source/Pict-Provider.d.ts",repository:{type:"git",url:"git+https://github.com/stevenvelozo/pict-provider.git"},author:"steven velozo <steven@velozo.com>",license:"MIT",bugs:{url:"https://github.com/stevenvelozo/pict-provider/issues"},homepage:"https://github.com/stevenvelozo/pict-provider#readme",devDependencies:{"@eslint/js":"^9.39.1",eslint:"^9.39.1",pict:"^1.0.351",quackage:"^1.0.58",typescript:"^5.9.3"},dependencies:{"fable-serviceproviderbase":"^3.0.19"},mocha:{diff:!0,extension:["js"],package:"./package.json",reporter:"spec",slow:"75",timeout:"5000",ui:"tdd","watch-files":["source/**/*.js","test/**/*.js"],"watch-ignore":["lib/vendor"]}}},{}],7:[function(t,e,o){const i=t("fable-serviceproviderbase"),n=t("../package.json"),a={ProviderIdentifier:!1,AutoInitialize:!0,AutoInitializeOrdinal:0,AutoLoadDataWithApp:!0,AutoLoadDataOrdinal:0,AutoSolveWithApp:!0,AutoSolveOrdinal:0,Manifests:{},Templates:[]};e.exports=class extends i{constructor(t,e,o){super(t,Object.assign({},JSON.parse(JSON.stringify(a)),e),o),this.fable,this.pict,this.log,this.options,this.UUID,this.Hash,this.options.ProviderIdentifier||(this.options.ProviderIdentifier=`AutoProviderID-${this.fable.getUUID()}`),this.serviceType="PictProvider",this._Package=n,this.pict=this.fable,this.AppData=this.pict.AppData,this.Bundle=this.pict.Bundle,this.initializeTimestamp=!1,this.lastSolvedTimestamp=!1;for(let t=0;t<this.options.Templates.length;t++){let e=this.options.Templates[t];e.hasOwnProperty("Postfix")&&e.hasOwnProperty("Template")?(e.Source||(e.Source=`PictProvider [${this.UUID}]::[${this.Hash}] ${this.options.ProviderIdentifier} options object.`),this.pict.TemplateProvider.addDefaultTemplate(e.Prefix,e.Postfix,e.Template,e.Source)):this.log.error(`PictProvider [${this.UUID}]::[${this.Hash}] ${this.options.ProviderIdentifier} could not load Default Template ${t} in the options array.`,e)}}onBeforeInitialize(){return this.pict.LogNoisiness>3&&this.log.trace(`PictProvider [${this.UUID}]::[${this.Hash}] ${this.options.ProviderIdentifier} onBeforeInitialize:`),!0}onBeforeInitializeAsync(t){return this.onBeforeInitialize(),t()}onInitialize(){return this.pict.LogNoisiness>3&&this.log.trace(`PictProvider [${this.UUID}]::[${this.Hash}] ${this.options.ProviderIdentifier} onInitialize:`),!0}onInitializeAsync(t){return this.onInitialize(),t()}initialize(){return this.pict.LogControlFlow&&this.log.trace(`PICT-ControlFlow PROVIDER [${this.UUID}]::[${this.Hash}] ${this.options.ProviderIdentifier} initialize:`),this.initializeTimestamp?(this.log.warn(`PictProvider [${this.UUID}]::[${this.Hash}] ${this.options.ProviderIdentifier} initialize called but initialization is already completed. Aborting.`),!1):(this.onBeforeInitialize(),this.onInitialize(),this.onAfterInitialize(),this.initializeTimestamp=this.pict.log.getTimeStamp(),!0)}initializeAsync(t){if(this.pict.LogControlFlow&&this.log.trace(`PICT-ControlFlow PROVIDER [${this.UUID}]::[${this.Hash}] ${this.options.ProviderIdentifier} initializeAsync:`),this.initializeTimestamp)return this.log.warn(`PictProvider [${this.UUID}]::[${this.Hash}] ${this.options.ProviderIdentifier} async initialize called but initialization is already completed. Aborting.`),t();{let e=this.pict.instantiateServiceProviderWithoutRegistration("Anticipate");this.pict.LogNoisiness>0&&this.log.info(`PictProvider [${this.UUID}]::[${this.Hash}] ${this.options.ProviderIdentifier} beginning initialization...`),e.anticipate(this.onBeforeInitializeAsync.bind(this)),e.anticipate(this.onInitializeAsync.bind(this)),e.anticipate(this.onAfterInitializeAsync.bind(this)),e.wait(e=>(this.initializeTimestamp=this.pict.log.getTimeStamp(),e?this.log.error(`PictProvider [${this.UUID}]::[${this.Hash}] ${this.options.ProviderIdentifier} initialization failed: ${e.message||e}`,{Stack:e.stack}):this.pict.LogNoisiness>0&&this.log.info(`PictProvider [${this.UUID}]::[${this.Hash}] ${this.options.ProviderIdentifier} initialization complete.`),t()))}}onAfterInitialize(){return this.pict.LogNoisiness>3&&this.log.trace(`PictProvider [${this.UUID}]::[${this.Hash}] ${this.options.ProviderIdentifier} onAfterInitialize:`),!0}onAfterInitializeAsync(t){return this.onAfterInitialize(),t()}onPreRender(){return this.pict.LogNoisiness>3&&this.log.trace(`PictProvider [${this.UUID}]::[${this.Hash}] ${this.options.ProviderIdentifier} onPreRender:`),!0}onPreRenderAsync(t){return this.onPreRender(),t()}render(){return this.onPreRender()}renderAsync(t){return this.onPreRender(),t()}onPreSolve(){return this.pict.LogNoisiness>3&&this.log.trace(`PictProvider [${this.UUID}]::[${this.Hash}] ${this.options.ProviderIdentifier} onPreSolve:`),!0}onPreSolveAsync(t){return this.onPreSolve(),t()}solve(){return this.onPreSolve()}solveAsync(t){return this.onPreSolve(),t()}onBeforeLoadDataAsync(t){return t()}onLoadDataAsync(t){return this.pict.LogNoisiness>3&&this.log.trace(`PictProvider [${this.UUID}]::[${this.Hash}] ${this.options.ProviderIdentifier} onLoadDataAsync:`),t()}onAfterLoadDataAsync(t){return t()}onBeforeSaveDataAsync(t){return t()}onSaveDataAsync(t){return this.pict.LogNoisiness>3&&this.log.trace(`PictProvider [${this.UUID}]::[${this.Hash}] ${this.options.ProviderIdentifier} onSaveDataAsync:`),t()}onAfterSaveDataAsync(t){return t()}}},{"../package.json":6,"fable-serviceproviderbase":2}],8:[function(t,e,o){const i=t("pict-provider"),n=t("navigo"),a={ProviderIdentifier:"Pict-Router",AutoInitialize:!0,AutoInitializeOrdinal:0,SkipRouteResolveOnAdd:!1};e.exports=class extends i{constructor(t,e,o){if(super(t,Object.assign({},a,e),o),this.router=new n("/",{strategy:"ONE",hash:!0}),this.options.Routes)for(let t=0;t<this.options.Routes.length;t++)this.options.Routes[t].path&&this.options.Routes[t].template?this.addRoute(this.options.Routes[t].path,this.options.Routes[t].template):this.options.Routes[t].path&&this.options.Routes[t].render?this.addRoute(this.options.Routes[t].path,this.options.Routes[t].render):this.pict.log.warn(`Route ${t} is missing a render function or template string.`);this.afterPersistView="/Manyfest/Overview"}get currentScope(){return this.AppData?.ManyfestRecord?.Scope??"Default"}forwardToScopedRoute(t){this.navigate(`${t.url}/${this.currentScope}`)}onInitializeAsync(t){return super.onInitializeAsync(t)}addRoute(t,e){if("function"==typeof e)this.router.on(t,e);else{if("string"!=typeof e)return void this.pict.log.warn(`Route ${t} has an invalid renderable.`);this.router.on(t,t=>{this.pict.parseTemplate(e,t,null,this.pict)})}this.options.SkipRouteResolveOnAdd||this.pict.settings.RouterSkipRouteResolveOnAdd||this.resolve()}navigate(t){this.router.navigate(t)}navigateCurrent(){let t="undefined"!=typeof window&&window.location?window.location.hash:"";if(t&&t.length>2&&"#/"!==t){let e=t.replace(/^#/,"");return this.navigate(e),!0}return!1}resolve(){this.router.resolve()}},e.exports.default_configuration=a},{navigo:3,"pict-provider":7}],9:[function(t,e,o){const i={javascript:{tokenizer:/(\/\/[^\n]*|\/\*[\s\S]*?\*\/)|(["'])(?:(?!\2|\\).|\\.)*?\2|(`(?:[^`\\]|\\.)*?`)|(\/(?![/*])(?:\\.|\[(?:\\.|[^\]])*\]|[^/\\\n])+\/[gimsuvy]*)/g,keywords:/\b(async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|export|extends|finally|for|from|function|get|if|import|in|instanceof|let|new|of|return|set|static|super|switch|this|throw|try|typeof|var|void|while|with|yield)\b/g,builtins:/\b(true|false|null|undefined|NaN|Infinity|console|window|document|Math|JSON|Array|Object|String|Number|Boolean|Date|RegExp|Map|Set|Promise|Error|Symbol|parseInt|parseFloat|require|module|exports)\b/g,numbers:/\b(\d+\.?\d*(?:e[+-]?\d+)?|0x[0-9a-fA-F]+|0b[01]+|0o[0-7]+)\b/g},json:{tokenizer:/(\/\/[^\n]*|\/\*[\s\S]*?\*\/)|("(?:[^"\\]|\\.)*")/g,keywords:/\b(true|false|null)\b/g,numbers:/-?\b\d+\.?\d*(?:e[+-]?\d+)?\b/g},html:{tokenizer:/(<!--[\s\S]*?-->)|(["'])(?:(?!\2|\\).|\\.)*?\2|(<\/?[a-zA-Z][a-zA-Z0-9-]*(?:\s+[a-zA-Z-]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*\/?>)/g,tagGroupIndex:3},css:{tokenizer:/(\/\*[\s\S]*?\*\/)|(["'])(?:(?!\2|\\).|\\.)*?\2/g,selectors:/([.#]?[a-zA-Z_][\w-]*(?:\s*[>+~]\s*[.#]?[a-zA-Z_][\w-]*)*)\s*\{/g,properties:/\b([a-zA-Z-]+)\s*:/g,numbers:/\b(\d+\.?\d*)(px|em|rem|%|vh|vw|s|ms|deg|fr)?\b/g,keywords:/\b(important|inherit|initial|unset|none|auto|block|inline|flex|grid)\b/g},sql:{tokenizer:/(--[^\n]*|\/\*[\s\S]*?\*\/)|(["'])(?:(?!\2|\\).|\\.)*?\2/g,keywords:/\b(SELECT|FROM|WHERE|AND|OR|INSERT|INTO|VALUES|UPDATE|SET|DELETE|CREATE|TABLE|DROP|ALTER|ADD|COLUMN|INDEX|JOIN|LEFT|RIGHT|INNER|OUTER|ON|AS|ORDER|BY|GROUP|HAVING|LIMIT|OFFSET|UNION|ALL|DISTINCT|COUNT|SUM|AVG|MIN|MAX|NOT|NULL|IS|IN|BETWEEN|LIKE|EXISTS|CASE|WHEN|THEN|ELSE|END|PRIMARY|KEY|FOREIGN|REFERENCES|CONSTRAINT|DEFAULT|CHECK|UNIQUE|CASCADE|GRANT|REVOKE|COMMIT|ROLLBACK|BEGIN|TRANSACTION|INT|VARCHAR|DATETIME|AUTO_INCREMENT|CURRENT_TIMESTAMP)\b/gi,numbers:/\b\d+\.?\d*\b/g}};function n(t){return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function a(t,e){let o=t;return e.selectors&&(e.selectors.lastIndex=0,o=o.replace(e.selectors,'<span class="function-name">$1</span>{')),e.properties&&(e.properties.lastIndex=0,o=o.replace(e.properties,'<span class="property">$1</span>:')),e.keywords&&(e.keywords.lastIndex=0,o=o.replace(e.keywords,'<span class="keyword">$1</span>')),e.builtins&&(e.builtins.lastIndex=0,o=o.replace(e.builtins,'<span class="keyword">$1</span>')),e.numbers&&(e.numbers.lastIndex=0,o=o.replace(e.numbers,t=>`<span class="number">${t}</span>`)),o}function r(t){let e="",o=t,i=o.match(/^(<\/?)([a-zA-Z][a-zA-Z0-9-]*)/);if(!i)return n(t);e+=n(i[1]),e+='<span class="tag">'+n(i[2])+"</span>",o=o.substring(i[0].length);let a,r=/^(\s+)([a-zA-Z-]+)(?:(\s*=\s*)(["'])([^"']*?)\4)?/;for(;null!==(a=o.match(r));)e+=a[1],e+='<span class="attr-name">'+n(a[2])+"</span>",a[3]&&(e+=n(a[3]),e+='<span class="attr-value">'+n(a[4])+n(a[5])+n(a[4])+"</span>"),o=o.substring(a[0].length);return e+=n(o),e}i.js=i.javascript,i.htm=i.html,e.exports=function(t){return function(e){let o=e.textContent,s="string"==typeof t?t.toLowerCase():"javascript",l=i[s];if(!l)return void(e.innerHTML=n(o));if(!l.tokenizer)return void(e.innerHTML=a(n(o),l));let c,d="",p=0,h=l.tagGroupIndex||0;for(l.tokenizer.lastIndex=0;null!==(c=l.tokenizer.exec(o));){if(c.index>p){d+=a(n(o.substring(p,c.index)),l)}let t=c[0];c[1]?d+=`<span class="comment">${n(t)}</span>`:h>0&&c[h]?d+=r(t):d+=`<span class="string">${n(t)}</span>`,p=l.tokenizer.lastIndex}if(p<o.length){d+=a(n(o.substring(p)),l)}e.innerHTML=d}},e.exports.LanguageDefinitions=i},{}],10:[function(t,e,o){e.exports={RenderOnLoad:!0,DefaultRenderable:"CodeEditor-Wrap",DefaultDestinationAddress:"#CodeEditor-Container-Div",Templates:[{Hash:"CodeEditor-Container",Template:"\x3c!-- CodeEditor-Container Rendering Soon --\x3e"}],Renderables:[{RenderableHash:"CodeEditor-Wrap",TemplateHash:"CodeEditor-Container",DestinationAddress:"#CodeEditor-Container-Div"}],TargetElementAddress:"#CodeEditor-Container-Div",CodeDataAddress:!1,Language:"javascript",ReadOnly:!1,Tab:"\t",IndentOn:/[({[]$/,MoveToNewLine:/^[)}\]]/,AddClosing:!0,CatchTab:!0,LineNumbers:!0,DefaultCode:"// Enter your code here\n",CSS:".pict-code-editor-wrap\n{\n\tdisplay: flex;\n\tfont-family: 'SFMono-Regular', 'SF Mono', 'Menlo', 'Consolas', 'Liberation Mono', 'Courier New', monospace;\n\tfont-size: 14px;\n\tline-height: 1.5;\n\tborder: 1px solid #D0D0D0;\n\tborder-radius: 4px;\n\toverflow: auto;\n}\n.pict-code-editor-wrap .pict-code-line-numbers\n{\n\tposition: sticky;\n\tleft: 0;\n\twidth: 40px;\n\tmin-width: 40px;\n\tpadding: 10px 0;\n\ttext-align: right;\n\tbackground: #F5F5F5;\n\tborder-right: 1px solid #D0D0D0;\n\tcolor: #999;\n\tfont-size: 13px;\n\tline-height: 1.5;\n\tuser-select: none;\n\tpointer-events: none;\n\tbox-sizing: border-box;\n\tz-index: 1;\n}\n.pict-code-editor-wrap .pict-code-line-numbers span\n{\n\tdisplay: block;\n\tpadding: 0 8px 0 0;\n}\n.pict-code-editor-wrap .pict-code-editor\n{\n\tmargin: 0;\n\tpadding: 10px 10px 10px 8px;\n\tmin-height: 100px;\n\tflex: 1;\n\tmin-width: 0;\n\toutline: none;\n\ttab-size: 4;\n\twhite-space: pre;\n\toverflow-wrap: normal;\n\tcolor: #383A42;\n\tbackground: #FAFAFA;\n\tcaret-color: #526FFF;\n\tborder-radius: 0 4px 4px 0;\n}\n.pict-code-editor-wrap .pict-code-editor.pict-code-no-line-numbers\n{\n\tpadding-left: 10px;\n\tborder-radius: 4px;\n}\n.pict-code-editor-wrap .pict-code-editor .keyword { color: #A626A4; }\n.pict-code-editor-wrap .pict-code-editor .string { color: #50A14F; }\n.pict-code-editor-wrap .pict-code-editor .number { color: #986801; }\n.pict-code-editor-wrap .pict-code-editor .comment { color: #A0A1A7; font-style: italic; }\n.pict-code-editor-wrap .pict-code-editor .operator { color: #0184BC; }\n.pict-code-editor-wrap .pict-code-editor .punctuation { color: #383A42; }\n.pict-code-editor-wrap .pict-code-editor .function-name { color: #4078F2; }\n.pict-code-editor-wrap .pict-code-editor .property { color: #E45649; }\n.pict-code-editor-wrap .pict-code-editor .tag { color: #E45649; }\n.pict-code-editor-wrap .pict-code-editor .attr-name { color: #986801; }\n.pict-code-editor-wrap .pict-code-editor .attr-value { color: #50A14F; }\n"}},{}],11:[function(t,e,o){const i=t("pict-view"),n=t("./Pict-Code-Highlighter.js"),a=t("./Pict-Section-Code-DefaultConfiguration.js");e.exports=class extends i{constructor(t,e,o){super(t,Object.assign({},a,e),o),this.initialRenderComplete=!1,this.codeJar=null,this._highlightFunction=null,this._language=this.options.Language||"javascript"}onBeforeInitialize(){return super.onBeforeInitialize(),this._codeJarPrototype=null,this.targetElement=!1,this._highlightFunction=n(this._language),super.onBeforeInitialize()}connectCodeJarPrototype(t){if("function"!=typeof t)return"undefined"!=typeof window&&"function"==typeof window.CodeJar?(this.log.trace("PICT-Code Found CodeJar in window.CodeJar."),void(this._codeJarPrototype=window.CodeJar)):(this.log.error("PICT-Code No CodeJar prototype found. Include codejar via script tag or call connectCodeJarPrototype(CodeJar) explicitly."),!1);this._codeJarPrototype=t}onAfterRender(t){return this.pict.CSSMap.injectCSS(),this.initialRenderComplete||(this.onAfterInitialRender(),this.initialRenderComplete=!0),super.onAfterRender(t)}onAfterInitialRender(){if(this._codeJarPrototype||this.connectCodeJarPrototype(),!this._codeJarPrototype)return this.log.error("PICT-Code Cannot initialize editor; no CodeJar prototype available."),!1;if(this.codeJar)return this.log.error("PICT-Code editor is already initialized!"),!1;let t=this.services.ContentAssignment.getElement(this.options.TargetElementAddress);if(!t||t.length<1)return this.log.error(`PICT-Code Could not find target element [${this.options.TargetElementAddress}]!`),this.targetElement=!1,!1;this.targetElement=t[0],this._buildEditorDOM();let e=this._resolveCodeContent(),o={};this.options.Tab&&(o.tab=this.options.Tab),this.options.IndentOn&&(o.indentOn=this.options.IndentOn),this.options.MoveToNewLine&&(o.moveToNewLine=this.options.MoveToNewLine),void 0!==this.options.AddClosing&&(o.addClosing=this.options.AddClosing),void 0!==this.options.CatchTab&&(o.catchTab=this.options.CatchTab),this.customConfigureEditorOptions(o);let i=this._editorElement;this.codeJar=this._codeJarPrototype(i,this._highlightFunction,o),this._resetEditorWrapStyles(),e&&this.codeJar.updateCode(e),this.codeJar.onUpdate(t=>{this._updateLineNumbers(),this.onCodeChange(t)}),this._updateLineNumbers(),this.options.ReadOnly&&i.setAttribute("contenteditable","false")}_buildEditorDOM(){this.targetElement.innerHTML="";let t=document.createElement("div");if(t.className="pict-code-editor-wrap",this.options.LineNumbers){let e=document.createElement("div");e.className="pict-code-line-numbers",t.appendChild(e),this._lineNumbersElement=e}let e=document.createElement("div");e.className="pict-code-editor language-"+this._language,this.options.LineNumbers||(e.className+=" pict-code-no-line-numbers"),t.appendChild(e),this.targetElement.appendChild(t),this._editorElement=e,this._wrapElement=t}_updateLineNumbers(){if(!this.options.LineNumbers||!this._lineNumbersElement||!this._editorElement)return;let t=(this._editorElement.textContent||"").split("\n").length,e="";for(let o=1;o<=t;o++)e+=`<span>${o}</span>`;this._lineNumbersElement.innerHTML=e}_resetEditorWrapStyles(){this._editorElement&&(this._editorElement.style.whiteSpace="pre",this._editorElement.style.overflowWrap="normal")}_resolveCodeContent(){if(this.options.CodeDataAddress){const t={Fable:this.fable,Pict:this.fable,AppData:this.AppData,Bundle:this.Bundle,Options:this.options};let e=this.fable.manifest.getValueByHash(t,this.options.CodeDataAddress);if("string"==typeof e)return e;this.log.warn(`PICT-Code Address [${this.options.CodeDataAddress}] did not return a string; it was ${typeof e}.`)}return this.options.DefaultCode||""}customConfigureEditorOptions(t){}onCodeChange(t){if(this.options.CodeDataAddress){const e={Fable:this.fable,Pict:this.fable,AppData:this.AppData,Bundle:this.Bundle,Options:this.options};this.fable.manifest.setValueByHash(e,this.options.CodeDataAddress,t)}}getCode(){return this.codeJar?this.codeJar.toString():(this.log.warn("PICT-Code getCode called before editor initialized."),"")}setCode(t){this.codeJar?(this.codeJar.updateCode(t),this._updateLineNumbers()):this.log.warn("PICT-Code setCode called before editor initialized.")}setLanguage(t){if(this._language=t,this._highlightFunction=n(t),this._editorElement&&(this._editorElement.className="pict-code-editor language-"+t,this.options.LineNumbers||(this._editorElement.className+=" pict-code-no-line-numbers")),this.codeJar){let t=this.codeJar.toString();this.codeJar.destroy(),this.codeJar=this._codeJarPrototype(this._editorElement,this._highlightFunction,{tab:this.options.Tab,catchTab:this.options.CatchTab,addClosing:this.options.AddClosing}),this._resetEditorWrapStyles(),this.codeJar.updateCode(t),this.codeJar.onUpdate(t=>{this._updateLineNumbers(),this.onCodeChange(t)})}}setHighlightFunction(t){if("function"==typeof t){if(this._highlightFunction=t,this.codeJar){let t=this.codeJar.toString();this.codeJar.destroy(),this.codeJar=this._codeJarPrototype(this._editorElement,this._highlightFunction,{tab:this.options.Tab,catchTab:this.options.CatchTab,addClosing:this.options.AddClosing}),this._resetEditorWrapStyles(),this.codeJar.updateCode(t),this.codeJar.onUpdate(t=>{this._updateLineNumbers(),this.onCodeChange(t)})}}else this.log.error("PICT-Code setHighlightFunction requires a function.")}setReadOnly(t){this.options.ReadOnly=t,this._editorElement&&this._editorElement.setAttribute("contenteditable",t?"false":"true")}destroy(){this.codeJar&&(this.codeJar.destroy(),this.codeJar=null)}marshalToView(){if(super.marshalToView(),this.codeJar&&this.options.CodeDataAddress){let t=this._resolveCodeContent();"string"==typeof t&&(this.codeJar.updateCode(t),this._updateLineNumbers())}}marshalFromView(){super.marshalFromView(),this.codeJar&&this.options.CodeDataAddress&&this.onCodeChange(this.codeJar.toString())}},e.exports.default_configuration=a,e.exports.createHighlighter=n},{"./Pict-Code-Highlighter.js":9,"./Pict-Section-Code-DefaultConfiguration.js":10,"pict-view":41}],12:[function(t,e,o){e.exports=t("./views/Pict-View-Content.js"),e.exports.PictContentProvider=t("./providers/Pict-Provider-Content.js")},{"./providers/Pict-Provider-Content.js":13,"./views/Pict-View-Content.js":14}],13:[function(t,e,o){const i=t("pict-provider"),n=t("pict-section-code").createHighlighter;e.exports=class extends i{constructor(t,e,o){super(t,e,o)}highlightCode(t,e){if(!t)return"";let o={textContent:t,innerHTML:""};return n(e)(o),o.innerHTML}generateLineNumbers(t){if(!t)return"<span>1</span>";let e=t.split("\n").length,o="";for(let t=1;t<=e;t++)o+="<span>"+t+"</span>";return o}parseMarkdown(t,e,o){if(!t)return"";let i=t.split("\n"),n=[],a=!1,r=0,s="",l=[],c=!1,d="",p=!1,h=[],u=!1,f=[],g=[],m=()=>{g.length>0&&(n.push("<p>"+g.map(t=>this.parseInline(t,e,o)).join(" ")+"</p>"),g=[])};for(let t=0;t<i.length;t++){let w=i[t];if(!a&&w.trim().match(/^\$\$/)){u?(n.push('<div class="pict-content-katex-display">'+f.join("\n")+"</div>"),u=!1,f=[]):(m(),c&&(n.push("ul"===d?"</ul>":"</ol>"),c=!1),p&&(n.push("<blockquote>"+this.parseMarkdown(h.join("\n"),e,o)+"</blockquote>"),p=!1,h=[]),u=!0);continue}if(u){f.push(w);continue}let v=w.match(/^(`{3,})/);if(v){let t=v[1].length;if(a){if(t>=r&&w.trim()===v[1]){if("mermaid"===s)n.push('<pre class="mermaid">'+l.join("\n")+"</pre>");else{let t=l.join("\n"),e=this.highlightCode(t,s),o=this.generateLineNumbers(t);n.push('<div class="pict-content-code-wrap"><div class="pict-content-code-line-numbers">'+o+'</div><pre><code class="language-'+this.escapeHTML(s)+'">'+e+"</code></pre></div>")}a=!1,r=0,s="",l=[];continue}l.push(w);continue}m(),c&&(n.push("ul"===d?"</ul>":"</ol>"),c=!1),p&&(n.push("<blockquote>"+this.parseMarkdown(h.join("\n"),e,o)+"</blockquote>"),p=!1,h=[]),r=t,s=w.replace(/^`{3,}/,"").trim(),a=!0;continue}if(a){l.push(w);continue}if(w.match(/^>\s?/)){p||(m(),c&&(n.push("ul"===d?"</ul>":"</ol>"),c=!1),p=!0,h=[]),h.push(w.replace(/^>\s?/,""));continue}if(p&&(n.push("<blockquote>"+this.parseMarkdown(h.join("\n"),e,o)+"</blockquote>"),p=!1,h=[]),w.match(/^(-{3,}|\*{3,}|_{3,})\s*$/)){m(),c&&(n.push("ul"===d?"</ul>":"</ol>"),c=!1),n.push("<hr>");continue}let b=w.match(/^(#{1,6})\s+(.+)/);if(b){m(),c&&(n.push("ul"===d?"</ul>":"</ol>"),c=!1);let t=b[1].length,i=this.parseInline(b[2],e,o),a=b[2].toLowerCase().replace(/[^\w\s-]/g,"").replace(/\s+/g,"-");n.push("<h"+t+' id="'+a+'">'+i+"</h"+t+">");continue}let y=w.match(/^(\s*)[-*+]\s+(.*)/);if(y){m(),c&&"ul"===d||(c&&n.push("ul"===d?"</ul>":"</ol>"),n.push("<ul>"),c=!0,d="ul"),n.push("<li>"+this.parseInline(y[2],e,o)+"</li>");continue}let F=w.match(/^(\s*)\d+\.\s+(.*)/);if(F)m(),c&&"ol"===d||(c&&n.push("ul"===d?"</ul>":"</ol>"),n.push("<ol>"),c=!0,d="ol"),n.push("<li>"+this.parseInline(F[2],e,o)+"</li>");else if(c&&""!==w.trim()&&(n.push("ul"===d?"</ul>":"</ol>"),c=!1),""!==w.trim()){if(w.match(/^\|/)&&t+1<i.length&&i[t+1].match(/^\|[\s-:|]+\|/)){m(),c&&(n.push("ul"===d?"</ul>":"</ol>"),c=!1);let a="<table>",r=w.split("|").filter(t=>""!==t.trim());a+="<thead><tr>";for(let t=0;t<r.length;t++)a+="<th>"+this.parseInline(r[t].trim(),e,o)+"</th>";for(a+="</tr></thead>",t++,a+="<tbody>";t+1<i.length&&i[t+1].match(/^\|/);){t++;let n=i[t].split("|").filter(t=>""!==t.trim());a+="<tr>";for(let t=0;t<n.length;t++)a+="<td>"+this.parseInline(n[t].trim(),e,o)+"</td>";a+="</tr>"}a+="</tbody></table>",n.push(a);continue}g.push(w)}else m()}if(m(),c&&n.push("ul"===d?"</ul>":"</ol>"),p&&n.push("<blockquote>"+this.parseMarkdown(h.join("\n"),e,o)+"</blockquote>"),a){let t=l.join("\n"),e=this.highlightCode(t,s),o=this.generateLineNumbers(t);n.push('<div class="pict-content-code-wrap"><div class="pict-content-code-line-numbers">'+o+"</div><pre><code>"+e+"</code></pre></div>")}return n.join("\n")}parseInline(t,e,o){if(!t)return"";let i=t,n=[];return i=i.replace(/`([^`]+)`/g,(t,e)=>{let o=n.length;return n.push("<code>"+e+"</code>"),"\0CODEINLINE"+o+"\0"}),i=i.replace(/\$([^\$\s][^\$]*?[^\$\s])\$/g,'<span class="pict-content-katex-inline">$1</span>'),i=i.replace(/\$([^\$\s])\$/g,'<span class="pict-content-katex-inline">$1</span>'),i=i.replace(/!\[([^\]]*)\]\(([^)]+)\)/g,(t,e,i)=>{let n=i;if("function"==typeof o){let t=o(i,e);t&&(n=t)}return'<img src="'+n+'" alt="'+e+'">'}),i=i.replace(/\[([^\]]+)\]\(([^)]+)\)/g,(t,o,i)=>{if("function"==typeof e){let t=e(i,o);if(t){let e=t.target?' target="'+t.target+'"':"",i=t.rel?' rel="'+t.rel+'"':"";return'<a href="'+t.href+'"'+e+i+">"+o+"</a>"}}return i.match(/^https?:\/\//)?'<a href="'+i+'" target="_blank" rel="noopener">'+o+"</a>":'<a href="'+i+'">'+o+"</a>"}),i=i.replace(/\*\*([^*]+)\*\*/g,"<strong>$1</strong>"),i=i.replace(/__([^_]+)__/g,"<strong>$1</strong>"),i=i.replace(/\*([^*]+)\*/g,"<em>$1</em>"),i=i.replace(/_([^_]+)_/g,"<em>$1</em>"),i=i.replace(/\x00CODEINLINE(\d+)\x00/g,(t,e)=>n[parseInt(e)]),i}escapeHTML(t){return t?t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'"):""}},e.exports.default_configuration={ProviderIdentifier:"Pict-Content",AutoInitialize:!0,AutoInitializeOrdinal:0}},{"pict-provider":7,"pict-section-code":11}],14:[function(t,e,o){const i=t("pict-view"),n={ViewIdentifier:"Pict-Content",DefaultRenderable:"Pict-Content-Display",DefaultDestinationAddress:"#Pict-Content-Container",AutoRender:!1,CSS:"\n\t\t.pict-content {\n\t\t\tpadding: 2em 3em;\n\t\t\tmax-width: 900px;\n\t\t\tmargin: 0 auto;\n\t\t}\n\t\t.pict-content-loading {\n\t\t\tdisplay: flex;\n\t\t\talign-items: center;\n\t\t\tjustify-content: center;\n\t\t\tmin-height: 200px;\n\t\t\tcolor: #8A7F72;\n\t\t\tfont-size: 1em;\n\t\t}\n\t\t.pict-content h1 {\n\t\t\tfont-size: 2em;\n\t\t\tcolor: #3D3229;\n\t\t\tborder-bottom: 1px solid #DDD6CA;\n\t\t\tpadding-bottom: 0.3em;\n\t\t\tmargin-top: 0;\n\t\t}\n\t\t.pict-content h2 {\n\t\t\tfont-size: 1.5em;\n\t\t\tcolor: #3D3229;\n\t\t\tborder-bottom: 1px solid #EAE3D8;\n\t\t\tpadding-bottom: 0.25em;\n\t\t\tmargin-top: 1.5em;\n\t\t}\n\t\t.pict-content h3 {\n\t\t\tfont-size: 1.25em;\n\t\t\tcolor: #3D3229;\n\t\t\tmargin-top: 1.25em;\n\t\t}\n\t\t.pict-content h4, .pict-content h5, .pict-content h6 {\n\t\t\tcolor: #5E5549;\n\t\t\tmargin-top: 1em;\n\t\t}\n\t\t.pict-content p {\n\t\t\tline-height: 1.7;\n\t\t\tcolor: #423D37;\n\t\t\tmargin: 0.75em 0;\n\t\t}\n\t\t.pict-content a {\n\t\t\tcolor: #2E7D74;\n\t\t\ttext-decoration: none;\n\t\t}\n\t\t.pict-content a:hover {\n\t\t\ttext-decoration: underline;\n\t\t}\n\t\t.pict-content-code-wrap {\n\t\t\tposition: relative;\n\t\t\tfont-family: 'SFMono-Regular', 'SF Mono', 'Menlo', 'Consolas', 'Liberation Mono', 'Courier New', monospace;\n\t\t\tfont-size: 14px;\n\t\t\tline-height: 1.5;\n\t\t\tborder-radius: 6px;\n\t\t\toverflow: auto;\n\t\t\tmargin: 1em 0;\n\t\t\tbackground: #3D3229;\n\t\t}\n\t\t.pict-content-code-wrap .pict-content-code-line-numbers {\n\t\t\tposition: absolute;\n\t\t\ttop: 0;\n\t\t\tleft: 0;\n\t\t\twidth: 40px;\n\t\t\tpadding: 1.25em 0;\n\t\t\ttext-align: right;\n\t\t\tbackground: #342A22;\n\t\t\tborder-right: 1px solid #4A3F35;\n\t\t\tcolor: #8A7F72;\n\t\t\tfont-size: 13px;\n\t\t\tline-height: 1.5;\n\t\t\tuser-select: none;\n\t\t\tpointer-events: none;\n\t\t\tbox-sizing: border-box;\n\t\t}\n\t\t.pict-content-code-wrap .pict-content-code-line-numbers span {\n\t\t\tdisplay: block;\n\t\t\tpadding: 0 8px 0 0;\n\t\t}\n\t\t.pict-content-code-wrap pre {\n\t\t\tmargin: 0;\n\t\t\tbackground: #3D3229;\n\t\t\tcolor: #E8E0D4;\n\t\t\tpadding: 1.25em 1.25em 1.25em 52px;\n\t\t\tborder-radius: 6px;\n\t\t\toverflow-x: auto;\n\t\t\tline-height: 1.5;\n\t\t\tfont-size: inherit;\n\t\t}\n\t\t.pict-content-code-wrap pre code {\n\t\t\tbackground: none;\n\t\t\tpadding: 0;\n\t\t\tcolor: inherit;\n\t\t\tfont-size: inherit;\n\t\t\tfont-family: inherit;\n\t\t}\n\t\t.pict-content-code-wrap .keyword { color: #C678DD; }\n\t\t.pict-content-code-wrap .string { color: #98C379; }\n\t\t.pict-content-code-wrap .number { color: #D19A66; }\n\t\t.pict-content-code-wrap .comment { color: #7F848E; font-style: italic; }\n\t\t.pict-content-code-wrap .operator { color: #56B6C2; }\n\t\t.pict-content-code-wrap .punctuation { color: #E8E0D4; }\n\t\t.pict-content-code-wrap .function-name { color: #61AFEF; }\n\t\t.pict-content-code-wrap .property { color: #E06C75; }\n\t\t.pict-content-code-wrap .tag { color: #E06C75; }\n\t\t.pict-content-code-wrap .attr-name { color: #D19A66; }\n\t\t.pict-content-code-wrap .attr-value { color: #98C379; }\n\t\t.pict-content pre {\n\t\t\tbackground: #3D3229;\n\t\t\tcolor: #E8E0D4;\n\t\t\tpadding: 1.25em;\n\t\t\tborder-radius: 6px;\n\t\t\toverflow-x: auto;\n\t\t\tline-height: 1.5;\n\t\t\tfont-size: 0.9em;\n\t\t}\n\t\t.pict-content code {\n\t\t\tbackground: #F0ECE4;\n\t\t\tpadding: 0.15em 0.4em;\n\t\t\tborder-radius: 3px;\n\t\t\tfont-size: 0.9em;\n\t\t\tcolor: #9E6B47;\n\t\t}\n\t\t.pict-content pre code {\n\t\t\tbackground: none;\n\t\t\tpadding: 0;\n\t\t\tcolor: inherit;\n\t\t\tfont-size: inherit;\n\t\t}\n\t\t.pict-content blockquote {\n\t\t\tborder-left: 4px solid #2E7D74;\n\t\t\tmargin: 1em 0;\n\t\t\tpadding: 0.5em 1em;\n\t\t\tbackground: #F7F5F0;\n\t\t\tcolor: #5E5549;\n\t\t}\n\t\t.pict-content blockquote p {\n\t\t\tmargin: 0.25em 0;\n\t\t}\n\t\t.pict-content ul, .pict-content ol {\n\t\t\tpadding-left: 2em;\n\t\t\tline-height: 1.8;\n\t\t}\n\t\t.pict-content li {\n\t\t\tmargin: 0.25em 0;\n\t\t\tcolor: #423D37;\n\t\t}\n\t\t.pict-content hr {\n\t\t\tborder: none;\n\t\t\tborder-top: 1px solid #DDD6CA;\n\t\t\tmargin: 2em 0;\n\t\t}\n\t\t.pict-content table {\n\t\t\twidth: 100%;\n\t\t\tborder-collapse: collapse;\n\t\t\tmargin: 1em 0;\n\t\t}\n\t\t.pict-content table th {\n\t\t\tbackground: #F5F0E8;\n\t\t\tborder: 1px solid #DDD6CA;\n\t\t\tpadding: 0.6em 0.8em;\n\t\t\ttext-align: left;\n\t\t\tfont-weight: 600;\n\t\t\tcolor: #3D3229;\n\t\t}\n\t\t.pict-content table td {\n\t\t\tborder: 1px solid #DDD6CA;\n\t\t\tpadding: 0.5em 0.8em;\n\t\t\tcolor: #423D37;\n\t\t}\n\t\t.pict-content table tr:nth-child(even) {\n\t\t\tbackground: #F7F5F0;\n\t\t}\n\t\t.pict-content img {\n\t\t\tmax-width: 100%;\n\t\t\theight: auto;\n\t\t}\n\t\t.pict-content pre.mermaid {\n\t\t\tbackground: #fff;\n\t\t\tcolor: #3D3229;\n\t\t\ttext-align: center;\n\t\t\tpadding: 1em;\n\t\t}\n\t\t.pict-content .pict-content-katex-display {\n\t\t\ttext-align: center;\n\t\t\tmargin: 1em 0;\n\t\t\tpadding: 0.5em;\n\t\t\toverflow-x: auto;\n\t\t}\n\t\t.pict-content .pict-content-katex-inline {\n\t\t\tdisplay: inline;\n\t\t}\n\t",Templates:[{Hash:"Pict-Content-Template",Template:'\n<div class="pict-content" id="Pict-Content-Body">\n\t<div class="pict-content-loading">Loading content...</div>\n</div>\n'}],Renderables:[{RenderableHash:"Pict-Content-Display",TemplateHash:"Pict-Content-Template",DestinationAddress:"#Pict-Content-Container",RenderMethod:"replace"}]};e.exports=class extends i{constructor(t,e,o){super(t,e,o)}displayContent(t,e){let o=e||"Pict-Content-Body";this.pict.ContentAssignment.assignContent("#"+o,t);let i=document.getElementById(o);i&&i.parentElement&&(i.parentElement.scrollTop=0),this.renderMermaidDiagrams(o),this.renderKaTeXEquations(o)}renderMermaidDiagrams(t){if("undefined"==typeof mermaid)return;let e=t||"Pict-Content-Body",o=document.getElementById(e);if(!o)return;let i=o.querySelectorAll("pre.mermaid");if(!(i.length<1))try{mermaid.run({nodes:i})}catch(t){this.log.error("Mermaid rendering error: "+t.message)}}renderKaTeXEquations(t){if("undefined"==typeof katex)return;let e=t||"Pict-Content-Body",o=document.getElementById(e);if(!o)return;let i=o.querySelectorAll(".pict-content-katex-inline");for(let t=0;t<i.length;t++)try{katex.render(i[t].textContent,i[t],{throwOnError:!1,displayMode:!1})}catch(t){this.log.warn("KaTeX inline error: "+t.message)}let n=o.querySelectorAll(".pict-content-katex-display");for(let t=0;t<n.length;t++)try{katex.render(n[t].textContent,n[t],{throwOnError:!1,displayMode:!0})}catch(t){this.log.warn("KaTeX display error: "+t.message)}}showLoading(t,e){let o=e||"Pict-Content-Body",i=t||"Loading content...";this.pict.ContentAssignment.assignContent("#"+o,'<div class="pict-content-loading">'+i+"</div>")}},e.exports.default_configuration=n},{"pict-view":41}],15:[function(t,e,o){e.exports={RenderOnLoad:!0,DefaultRenderable:"Histogram-Wrap",DefaultDestinationAddress:"#Histogram-Container-Div",Templates:[{Hash:"Histogram-Container",Template:"\x3c!-- Histogram Container Rendering Soon --\x3e"}],Renderables:[{RenderableHash:"Histogram-Wrap",TemplateHash:"Histogram-Container",DestinationAddress:"#Histogram-Container-Div"}],TargetElementAddress:"#Histogram-Container-Div",DataAddress:!1,Bins:[],LabelProperty:"Label",ValueProperty:"Value",Orientation:"vertical",RenderMode:"browser",MaxBarSize:200,BarThickness:30,BarGap:4,ShowValues:!0,ShowLabels:!0,BarColor:"#4A90D9",SelectedBarColor:"#2ECC71",SelectionRangeColor:"#85C1E9",Selectable:!1,SelectionMode:"range",SelectionDataAddress:!1,InitialSelection:null,BarCharacter:"█",BarPartialCharacters:[" ","▁","▂","▃","▄","▅","▆","▇","█"],EmptyCharacter:" ",SliderCharacter:"│",SliderHandleCharacter:"◆",TextWidth:60,TextHeight:15,CSS:".pict-histogram-container\n{\n\tdisplay: inline-block;\n\tposition: relative;\n\tfont-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;\n\tfont-size: 12px;\n\tuser-select: none;\n}\n.pict-histogram-chart\n{\n\tdisplay: flex;\n\talign-items: flex-end;\n\tposition: relative;\n}\n.pict-histogram-container.pict-histogram-horizontal\n{\n\tdisplay: inline-flex;\n\tflex-direction: row;\n\talign-items: stretch;\n}\n.pict-histogram-chart.pict-histogram-horizontal\n{\n\tflex-direction: column;\n\talign-items: flex-start;\n}\n.pict-histogram-bar-group\n{\n\tdisplay: flex;\n\tflex-direction: column;\n\talign-items: center;\n\tcursor: default;\n\tflex-shrink: 0;\n}\n.pict-histogram-horizontal .pict-histogram-bar-group\n{\n\tflex-direction: row;\n\talign-items: center;\n}\n.pict-histogram-bar\n{\n\ttransition: background-color 0.15s ease, height 0.2s ease, width 0.2s ease;\n\tborder-radius: 2px 2px 0 0;\n\tmin-width: 1px;\n\tmin-height: 1px;\n}\n.pict-histogram-horizontal .pict-histogram-bar\n{\n\tborder-radius: 0 2px 2px 0;\n}\n.pict-histogram-bar.pict-histogram-selectable\n{\n\tcursor: pointer;\n}\n.pict-histogram-bar.pict-histogram-selectable:hover\n{\n\topacity: 0.8;\n}\n.pict-histogram-bar.pict-histogram-selected\n{\n\tbox-shadow: 0 0 0 2px rgba(46, 204, 113, 0.4);\n}\n.pict-histogram-bar.pict-histogram-in-range\n{\n\topacity: 0.9;\n}\n.pict-histogram-value-label\n{\n\ttext-align: center;\n\tcolor: #666;\n\tfont-size: 11px;\n\tpadding: 2px 0;\n\twhite-space: nowrap;\n}\n.pict-histogram-horizontal .pict-histogram-value-label\n{\n\tpadding: 0 4px;\n}\n.pict-histogram-bin-label\n{\n\ttext-align: center;\n\tcolor: #333;\n\tfont-size: 11px;\n\tpadding: 4px 2px 0 2px;\n\twhite-space: nowrap;\n\toverflow: hidden;\n\ttext-overflow: ellipsis;\n}\n.pict-histogram-horizontal .pict-histogram-bin-label\n{\n\tpadding: 0 4px 0 0;\n\ttext-align: right;\n\tmin-width: 40px;\n}\n.pict-histogram-range-slider-container\n{\n\tposition: relative;\n\twidth: 100%;\n\theight: 24px;\n\tmargin-top: 4px;\n}\n.pict-histogram-horizontal .pict-histogram-range-slider-container\n{\n\twidth: 24px;\n\theight: auto;\n\talign-self: stretch;\n\tmargin-top: 0;\n\tmargin-left: 4px;\n}\n.pict-histogram-range-track\n{\n\tposition: absolute;\n\ttop: 10px;\n\tleft: 0;\n\tright: 0;\n\theight: 4px;\n\tbackground: #E0E0E0;\n\tborder-radius: 2px;\n}\n.pict-histogram-horizontal .pict-histogram-range-track\n{\n\ttop: 0;\n\tleft: 10px;\n\tright: auto;\n\tbottom: 0;\n\twidth: 4px;\n\theight: auto;\n}\n.pict-histogram-range-fill\n{\n\tposition: absolute;\n\ttop: 10px;\n\theight: 4px;\n\tbackground: #4A90D9;\n\tborder-radius: 2px;\n}\n.pict-histogram-horizontal .pict-histogram-range-fill\n{\n\ttop: auto;\n\tleft: 10px;\n\twidth: 4px;\n\theight: auto;\n}\n.pict-histogram-range-handle\n{\n\tposition: absolute;\n\ttop: 4px;\n\twidth: 16px;\n\theight: 16px;\n\tbackground: #fff;\n\tborder: 2px solid #4A90D9;\n\tborder-radius: 50%;\n\tcursor: grab;\n\tz-index: 2;\n\ttransform: translateX(-50%);\n}\n.pict-histogram-horizontal .pict-histogram-range-handle\n{\n\ttop: auto;\n\tleft: 4px;\n\ttransform: translateY(-50%);\n}\n.pict-histogram-range-handle:active\n{\n\tcursor: grabbing;\n\tbackground: #4A90D9;\n}\n.pict-histogram-range-handle:active,\n.pict-histogram-range-handle:focus\n{\n\tbox-shadow: 0 0 0 3px rgba(74, 144, 217, 0.3);\n\toutline: none;\n}\n"}},{}],16:[function(t,e,o){const i=t("pict-view"),n=t("./Pict-Section-Histogram-DefaultConfiguration.js"),a=t("./renderers/Pict-Histogram-Renderer-Browser.js"),r=t("./renderers/Pict-Histogram-Renderer-ConsoleUI.js"),s=t("./renderers/Pict-Histogram-Renderer-CLI.js");e.exports=class extends i{constructor(t,e,o){super(t,Object.assign({},n,e),o),this.initialRenderComplete=!1,this._selectedIndices=new Set,this._selectionRangeStart=0,this._selectionRangeEnd=0,this._renderer=this._resolveRenderer(),this._applyInitialSelection()}_applyInitialSelection(){if(this.options.InitialSelection)this.setSelection(this.options.InitialSelection);else if(this.options.Selectable&&"range"===this.options.SelectionMode){let t=this.getBins();this._selectionRangeStart=0,this._selectionRangeEnd=Math.max(0,t.length-1),this._syncSelectionFromRange()}}_resolveRenderer(){switch(this.options.RenderMode){case"consoleui":return r;case"cli":return s;default:return a}}getBins(){if(this.options.DataAddress){const t={Fable:this.fable,Pict:this.fable,AppData:this.AppData,Bundle:this.Bundle,Options:this.options};let e=this.fable.manifest.getValueByHash(t,this.options.DataAddress);if(Array.isArray(e))return e;this.log.warn(`PICT-Histogram DataAddress [${this.options.DataAddress}] did not return an array.`)}return this.options.Bins||[]}setBins(t){if(Array.isArray(t)){if(this.options.Bins=t,this.options.DataAddress){const e={Fable:this.fable,Pict:this.fable,AppData:this.AppData,Bundle:this.Bundle,Options:this.options};this.fable.manifest.setValueByHash(e,this.options.DataAddress,t)}}else this.log.warn("PICT-Histogram setBins requires an array.")}isIndexSelected(t){return!!this.options.Selectable&&("range"===this.options.SelectionMode?t===this._selectionRangeStart||t===this._selectionRangeEnd:this._selectedIndices.has(t))}isIndexInRange(t){return!(!this.options.Selectable||"range"!==this.options.SelectionMode)&&(t>this._selectionRangeStart&&t<this._selectionRangeEnd)}getSelection(){if("range"===this.options.SelectionMode){let t=this.getBins(),e=[];for(let t=this._selectionRangeStart;t<=this._selectionRangeEnd;t++)e.push(t);return{Mode:"range",RangeStart:this._selectionRangeStart,RangeEnd:this._selectionRangeEnd,SelectedIndices:e,StartLabel:(t[this._selectionRangeStart]||{})[this.options.LabelProperty],EndLabel:(t[this._selectionRangeEnd]||{})[this.options.LabelProperty]}}return{Mode:this.options.SelectionMode,SelectedIndices:Array.from(this._selectedIndices).sort((t,e)=>t-e)}}setSelection(t){"range"===this.options.SelectionMode?t&&"number"==typeof t.Start&&"number"==typeof t.End&&(this._selectionRangeStart=t.Start,this._selectionRangeEnd=t.End,this._syncSelectionFromRange()):Array.isArray(t)&&(this._selectedIndices=new Set(t)),this._writeSelectionToAddress()}handleBarClick(t){"single"===this.options.SelectionMode?(this._selectedIndices.clear(),this._selectedIndices.add(t)):"multiple"===this.options.SelectionMode&&(this._selectedIndices.has(t)?this._selectedIndices.delete(t):this._selectedIndices.add(t)),this._writeSelectionToAddress(),this.onSelectionChange(this.getSelection()),this.renderHistogram()}handleRangeBarClick(t){Math.abs(t-this._selectionRangeStart)<=Math.abs(t-this._selectionRangeEnd)?this._selectionRangeStart=Math.min(t,this._selectionRangeEnd):this._selectionRangeEnd=Math.max(t,this._selectionRangeStart),this._syncSelectionFromRange(),this._writeSelectionToAddress(),this.onSelectionChange(this.getSelection()),this.renderHistogram()}_syncSelectionFromRange(){this._selectedIndices.clear();for(let t=this._selectionRangeStart;t<=this._selectionRangeEnd;t++)this._selectedIndices.add(t)}_writeSelectionToAddress(){if(!this.options.SelectionDataAddress)return;const t={Fable:this.fable,Pict:this.fable,AppData:this.AppData,Bundle:this.Bundle,Options:this.options};this.fable.manifest.setValueByHash(t,this.options.SelectionDataAddress,this.getSelection())}onSelectionChange(t){}onBeforeInitialize(){return super.onBeforeInitialize(),super.onBeforeInitialize()}onAfterRender(t){return this.pict.CSSMap.injectCSS(),this.initialRenderComplete||(this.onAfterInitialRender(),this.initialRenderComplete=!0),super.onAfterRender(t)}onAfterInitialRender(){this.renderHistogram()}renderHistogram(){this.pict.CSSMap&&this.pict.CSSMap.injectCSS(),this._renderer.render(this),this._renderer.wireEvents(this),this.initialRenderComplete=!0}marshalToView(){super.marshalToView(),this.initialRenderComplete&&this.renderHistogram()}marshalFromView(){super.marshalFromView(),this._writeSelectionToAddress()}setOrientation(t){"vertical"===t||"horizontal"===t?(this.options.Orientation=t,this.initialRenderComplete&&this.renderHistogram()):this.log.warn(`PICT-Histogram invalid orientation: ${t}`)}setRenderMode(t){this.options.RenderMode=t,this._renderer=this._resolveRenderer(),this.initialRenderComplete&&this.renderHistogram()}toText(){return"vertical"===this.options.Orientation?r.renderVertical(this):r.renderHorizontal(this)}},e.exports.default_configuration=n,e.exports.renderers={browser:a,consoleui:r,cli:s}},{"./Pict-Section-Histogram-DefaultConfiguration.js":15,"./renderers/Pict-Histogram-Renderer-Browser.js":17,"./renderers/Pict-Histogram-Renderer-CLI.js":18,"./renderers/Pict-Histogram-Renderer-ConsoleUI.js":19,"pict-view":41}],17:[function(t,e,o){function i(t,e,o,i,n,a,r){let s=t[i.LabelProperty]||"",l=t[i.ValueProperty]||0,c="vertical"===i.Orientation,d=n?i.SelectedBarColor:a?i.SelectionRangeColor:i.BarColor,p=i.Selectable?" pict-histogram-selectable":"",h=n?" pict-histogram-selected":"",u=a?" pict-histogram-in-range":"",f="";f=c?`height:${o}px;width:${i.BarThickness}px;background-color:${d};`:`width:${o}px;height:${i.BarThickness}px;background-color:${d};`;let g=i.BarThickness+i.BarGap,m="";m=c?`margin:0 ${i.BarGap/2}px;width:${g}px;`:`margin:${i.BarGap/2}px 0;`;let w=`<div class="pict-histogram-bar-group" style="${m}" data-histogram-index="${e}">`;if(c)i.ShowValues&&(w+=`<div class="pict-histogram-value-label" style="width:${g}px;">${l}</div>`),w+=`<div class="pict-histogram-bar${p}${h}${u}" style="${f}" data-histogram-index="${e}"></div>`,i.ShowLabels&&(w+=`<div class="pict-histogram-bin-label" style="width:${g}px;">${s}</div>`);else{if(i.ShowLabels){w+=`<div class="pict-histogram-bin-label" style="${r?`width:${r}px;min-width:${r}px;`:""}">${s}</div>`}w+=`<div class="pict-histogram-bar${p}${h}${u}" style="${f}" data-histogram-index="${e}"></div>`,i.ShowValues&&(w+=`<div class="pict-histogram-value-label">${l}</div>`)}return w+="</div>",w}function n(t,e,o){let i=e.getAttribute("data-handle"),n="vertical"===t.options.Orientation,a=!1;function r(e){if(!a)return;let r=t.getBins();if(!r||0===r.length)return;let s=function(){let t=o.querySelector(".pict-histogram-range-slider-container");if(!t)return{start:0,size:1};let e=t.getBoundingClientRect();return n?{start:e.left,size:e.width||1}:{start:e.top,size:e.height||1}}(),l=((n?e.clientX:e.clientY)-s.start)/s.size;l=Math.max(0,Math.min(1,l));let c=Math.round(l*(r.length-1));"start"===i?(c>t._selectionRangeEnd&&(c=t._selectionRangeEnd),t._selectionRangeStart=c):(c<t._selectionRangeStart&&(c=t._selectionRangeStart),t._selectionRangeEnd=c),t._syncSelectionFromRange(),t.renderHistogram()}function s(){a&&(a=!1,"undefined"!=typeof document&&(document.removeEventListener("mousemove",r),document.removeEventListener("mouseup",s)))}e.addEventListener("mousedown",t=>{t.preventDefault(),a=!0,"undefined"!=typeof document&&(document.addEventListener("mousemove",r),document.addEventListener("mouseup",s))})}e.exports={render:function(t){let e=t.getBins();if(!e||0===e.length)return void t.services.ContentAssignment.assignContent(t.options.TargetElementAddress,'<div class="pict-histogram-container"><em>No histogram data</em></div>');let o=0;for(let i=0;i<e.length;i++){let n=e[i][t.options.ValueProperty]||0;n>o&&(o=n)}0===o&&(o=1);let n="vertical"===t.options.Orientation,a=n?"pict-histogram-vertical":"pict-histogram-horizontal",r=0;if(!n&&t.options.ShowLabels){for(let o=0;o<e.length;o++){let i=6.5*String(e[o][t.options.LabelProperty]||"").length+8;i>r&&(r=i)}r=Math.max(r,40)}let s=`<div class="pict-histogram-container ${a}">`;s+=`<div class="pict-histogram-chart ${a}">`;for(let n=0;n<e.length;n++){let a=e[n][t.options.ValueProperty]||0,l=Math.round(a/o*t.options.MaxBarSize);a>0&&l<1&&(l=1);let c=t.isIndexSelected(n),d=!c&&t.isIndexInRange(n);s+=i(e[n],n,l,t.options,c,d,r)}s+="</div>",t.options.Selectable&&"range"===t.options.SelectionMode&&(s+=function(t){let e=t.getBins();if(!e||0===e.length)return"";let o=t._selectionRangeStart,i=t._selectionRangeEnd,n=e.length-1,a=n>0?o/n*100:0,r=n>0?i/n*100:100,s='<div class="pict-histogram-range-slider-container">';return s+='<div class="pict-histogram-range-track"></div>',"vertical"===t.options.Orientation?(s+=`<div class="pict-histogram-range-fill" style="left:${a}%;right:${100-r}%;"></div>`,s+=`<div class="pict-histogram-range-handle pict-histogram-range-handle-start" tabindex="0" style="left:${a}%;" data-handle="start"></div>`,s+=`<div class="pict-histogram-range-handle pict-histogram-range-handle-end" tabindex="0" style="left:${r}%;" data-handle="end"></div>`):(s+=`<div class="pict-histogram-range-fill" style="top:${a}%;bottom:${100-r}%;"></div>`,s+=`<div class="pict-histogram-range-handle pict-histogram-range-handle-start" tabindex="0" style="top:${a}%;" data-handle="start"></div>`,s+=`<div class="pict-histogram-range-handle pict-histogram-range-handle-end" tabindex="0" style="top:${r}%;" data-handle="end"></div>`),s+="</div>",s}(t)),s+="</div>",t.services.ContentAssignment.assignContent(t.options.TargetElementAddress,s)},wireEvents:function(t){if(!t.options.Selectable)return;let e=t.services.ContentAssignment.getElement(t.options.TargetElementAddress);if(!e||e.length<1)return;let o=e[0];if(o){if("single"===t.options.SelectionMode||"multiple"===t.options.SelectionMode){let e=o.querySelectorAll(".pict-histogram-bar[data-histogram-index]");for(let o=0;o<e.length;o++)e[o].addEventListener("click",e=>{let o=parseInt(e.currentTarget.getAttribute("data-histogram-index"),10);isNaN(o)||t.handleBarClick(o)})}if("range"===t.options.SelectionMode){let e=o.querySelectorAll(".pict-histogram-bar[data-histogram-index]");for(let o=0;o<e.length;o++)e[o].addEventListener("click",e=>{let o=parseInt(e.currentTarget.getAttribute("data-histogram-index"),10);isNaN(o)||t.handleRangeBarClick(o)});let i=o.querySelectorAll(".pict-histogram-range-handle");for(let e=0;e<i.length;e++)n(t,i[e],o)}}}}},{}],18:[function(t,e,o){(function(t){(function(){const o={black:"[30m",red:"[31m",green:"[32m",yellow:"[33m",blue:"[34m",magenta:"[35m",cyan:"[36m",white:"[37m",reset:"[0m",bold:"[1m",dim:"[2m"};function i(t){if(!t)return o.blue;let e=t.toLowerCase();if(o[e])return o[e];if("#"===e.charAt(0)&&e.length>=7){let t=parseInt(e.substring(1,3),16),i=parseInt(e.substring(3,5),16),n=parseInt(e.substring(5,7),16);if(i>t&&i>n)return o.green;if(t>i&&t>n)return o.red;if(n>t&&n>i)return o.blue;if(t>200&&i>200)return o.yellow;if(t>200&&n>200)return o.magenta;if(i>200&&n>200)return o.cyan}return o.blue}function n(t){let e=t.getBins(),n=t.options,a=n.TextHeight||15,s=n.BarCharacter,c=n.BarPartialCharacters,d=i(n.BarColor),p=i(n.SelectedBarColor),h=i(n.SelectionRangeColor),u=o.reset;if(!e||0===e.length)return"(no data)\n";let f=0;for(let t=0;t<e.length;t++){let o=e[t][n.ValueProperty]||0;o>f&&(f=o)}0===f&&(f=1);let g=String(f).length+1,m=[];for(let i=a;i>=1;i--){let l="";i===a?l+=o.dim+r(String(f),g)+"|"+u:1===i?l+=o.dim+r("0",g)+"|"+u:i===Math.ceil(a/2)?l+=o.dim+r(String(Math.round(f/2)),g)+"|"+u:l+=o.dim+r("",g)+"|"+u;for(let o=0;o<e.length;o++){let r=(e[o][n.ValueProperty]||0)/f*a,g=Math.floor(r),m=r-g,w=t.isIndexSelected(o),v=!w&&t.isIndexInRange(o),b=w?p:v?h:d,y=" ";if(i<=g)y=s;else if(i===g+1&&m>0){y=c[Math.round(m*(c.length-1))]}l+=" "!==y?" "+b+y+y+y+u:" "}m.push(l)}let w=o.dim+r("",g)+"+";for(let t=0;t<e.length;t++)w+="----";if(w+=u,m.push(w),n.ShowLabels){let t=r("",g)+" ";for(let o=0;o<e.length;o++){t+=l(String(e[o][n.LabelProperty]||"").substring(0,4),4)}m.push(t)}if(n.Selectable&&"range"===n.SelectionMode){let i=t._selectionRangeStart,a=t._selectionRangeEnd,r=e[i]?e[i][n.LabelProperty]:i,s=e[a]?e[a][n.LabelProperty]:a;m.push(""),m.push(o.bold+" Selection: "+r+" - "+s+u)}return m.join("\n")+"\n"}function a(t){let e=t.getBins(),n=t.options,a=n.TextWidth||60,r=n.BarCharacter,l=i(n.BarColor),c=i(n.SelectedBarColor),d=i(n.SelectionRangeColor),p=o.reset;if(!e||0===e.length)return"(no data)\n";let h=0,u=0;for(let t=0;t<e.length;t++){let o=e[t][n.ValueProperty]||0;o>h&&(h=o);let i=String(e[t][n.LabelProperty]||"");i.length>u&&(u=i.length)}0===h&&(h=1);let f=Math.min(u,12),g=a-f-String(h).length-4;g<10&&(g=10);let m=[];for(let i=0;i<e.length;i++){let a=e[i][n.ValueProperty]||0,u=String(e[i][n.LabelProperty]||""),w=Math.round(a/h*g),v=t.isIndexSelected(i),b=!v&&t.isIndexInRange(i),y=v?c:b?d:l,F="";for(let t=0;t<w;t++)F+=r;let S=o.dim+s(u.substring(0,f),f)+" |"+p;S+=y+F+p,S+=" "+a,v?S+=o.bold+" *"+p:b&&(S+=o.dim+" ~"+p),m.push(S)}if(n.Selectable&&"range"===n.SelectionMode){let i=t._selectionRangeStart,a=t._selectionRangeEnd,r=e[i]?e[i][n.LabelProperty]:i,s=e[a]?e[a][n.LabelProperty]:a;m.push(""),m.push(o.bold+" Selection: "+r+" - "+s+p)}return m.join("\n")+"\n"}function r(t,e){let o=String(t);for(;o.length<e;)o=" "+o;return o}function s(t,e){let o=String(t);for(;o.length<e;)o+=" ";return o}function l(t,e){let o=String(t);for(;o.length<e;)o=o.length%2==0?o+" ":" "+o;return o}e.exports={render:function(e){let o;o="vertical"===e.options.Orientation?n(e):a(e),e.services&&e.services.ContentAssignment?e.services.ContentAssignment.assignContent(e.options.TargetElementAddress,o):void 0!==t&&t.stdout&&t.stdout.write(o)},wireEvents:function(){},renderVertical:n,renderHorizontal:a,colorToAnsi:i,ANSI_COLORS:o}}).call(this)}).call(this,t("_process"))},{_process:42}],19:[function(t,e,o){function i(t){let e=t.getBins(),o=t.options,i=o.TextHeight||15,n=o.BarCharacter,r=o.BarPartialCharacters,l=o.EmptyCharacter;if(!e||0===e.length)return"(no data)";let c=0;for(let t=0;t<e.length;t++){let i=e[t][o.ValueProperty]||0;i>c&&(c=i)}0===c&&(c=1);let d=String(c).length+1,p=[];for(let s=i;s>=1;s--){let h="";s===i?h+=a(String(c),d)+"|":1===s?h+=a("0",d)+"|":s===Math.ceil(i/2)?h+=a(String(Math.round(c/2)),d)+"|":h+=a("",d)+"|";for(let a=0;a<e.length;a++){let d=(e[a][o.ValueProperty]||0)/c*i,p=Math.floor(d),u=d-p,f=l;if(s<=p)f=n;else if(s===p+1&&u>0){f=r[Math.round(u*(r.length-1))]}let g=t.isIndexSelected(a),m=!g&&t.isIndexInRange(a);g&&f!==l?f="*":m&&f!==l&&(f="#"),h+=" "+f+f+f}p.push(h)}let h=a("",d)+"+";for(let t=0;t<e.length;t++)h+="----";if(p.push(h),o.ShowLabels){let t=a("",d)+" ";for(let i=0;i<e.length;i++){t+=s(String(e[i][o.LabelProperty]||"").substring(0,4),4)}p.push(t)}if(o.Selectable&&"range"===o.SelectionMode){let o=a("",d)+" ";for(let i=0;i<e.length;i++)i===t._selectionRangeStart?o+=" [ ":i===t._selectionRangeEnd?o+=" ] ":i>t._selectionRangeStart&&i<t._selectionRangeEnd?o+=" - ":o+=" ";p.push(o)}return p.join("\n")}function n(t){let e=t.getBins(),o=t.options,i=o.TextWidth||60,n=o.BarCharacter,a=o.BarPartialCharacters;if(!e||0===e.length)return"(no data)";let s=0,l=0;for(let t=0;t<e.length;t++){let i=e[t][o.ValueProperty]||0;i>s&&(s=i);let n=String(e[t][o.LabelProperty]||"");n.length>l&&(l=n.length)}0===s&&(s=1);let c=Math.min(l,12),d=i-c-2;d<10&&(d=10);let p=[];for(let i=0;i<e.length;i++){let l=e[i][o.ValueProperty]||0,h=String(e[i][o.LabelProperty]||""),u=l/s*d,f=Math.floor(u),g=u-f,m="";for(let t=0;t<f;t++)m+=n;if(g>0&&f<d){m+=a[Math.round(g*(a.length-1))]}let w=t.isIndexSelected(i),v=!w&&t.isIndexInRange(i),b=w?"*":v?"~":"",y=o.ShowValues?" "+l:"",F=r(h.substring(0,c),c)+" |"+m+y+b;p.push(F)}return o.Selectable&&"range"===o.SelectionMode&&(p.push(""),p.push(r("",c)+" Range: ["+t._selectionRangeStart+" - "+t._selectionRangeEnd+"]")),p.join("\n")}function a(t,e){let o=String(t);for(;o.length<e;)o=" "+o;return o}function r(t,e){let o=String(t);for(;o.length<e;)o+=" ";return o}function s(t,e){let o=String(t);for(;o.length<e;)o=o.length%2==0?o+" ":" "+o;return o}e.exports={render:function(t){let e;e="vertical"===t.options.Orientation?i(t):n(t),t.services.ContentAssignment.assignContent(t.options.TargetElementAddress,e)},wireEvents:function(){},renderVertical:i,renderHorizontal:n}},{}],20:[function(t,e,o){arguments[4][12][0].apply(o,arguments)},{"./providers/Pict-Provider-Content.js":21,"./views/Pict-View-Content.js":22,dup:12}],21:[function(t,e,o){arguments[4][13][0].apply(o,arguments)},{dup:13,"pict-provider":7,"pict-section-code":11}],22:[function(t,e,o){const i=t("pict-view"),n={ViewIdentifier:"Pict-Content",DefaultRenderable:"Pict-Content-Display",DefaultDestinationAddress:"#Pict-Content-Container",AutoRender:!1,CSS:"\n\t\t.pict-content {\n\t\t\tpadding: 2em 3em;\n\t\t\tmax-width: 900px;\n\t\t\tmargin: 0 auto;\n\t\t}\n\t\t.pict-content-loading {\n\t\t\tdisplay: flex;\n\t\t\talign-items: center;\n\t\t\tjustify-content: center;\n\t\t\tmin-height: 200px;\n\t\t\tcolor: #8A7F72;\n\t\t\tfont-size: 1em;\n\t\t}\n\t\t.pict-content h1 {\n\t\t\tfont-size: 2em;\n\t\t\tcolor: #3D3229;\n\t\t\tborder-bottom: 1px solid #DDD6CA;\n\t\t\tpadding-bottom: 0.3em;\n\t\t\tmargin-top: 0;\n\t\t}\n\t\t.pict-content h2 {\n\t\t\tfont-size: 1.5em;\n\t\t\tcolor: #3D3229;\n\t\t\tborder-bottom: 1px solid #EAE3D8;\n\t\t\tpadding-bottom: 0.25em;\n\t\t\tmargin-top: 1.5em;\n\t\t}\n\t\t.pict-content h3 {\n\t\t\tfont-size: 1.25em;\n\t\t\tcolor: #3D3229;\n\t\t\tmargin-top: 1.25em;\n\t\t}\n\t\t.pict-content h4, .pict-content h5, .pict-content h6 {\n\t\t\tcolor: #5E5549;\n\t\t\tmargin-top: 1em;\n\t\t}\n\t\t.pict-content p {\n\t\t\tline-height: 1.7;\n\t\t\tcolor: #423D37;\n\t\t\tmargin: 0.75em 0;\n\t\t}\n\t\t.pict-content a {\n\t\t\tcolor: #2E7D74;\n\t\t\ttext-decoration: none;\n\t\t}\n\t\t.pict-content a:hover {\n\t\t\ttext-decoration: underline;\n\t\t}\n\t\t.pict-content pre {\n\t\t\tbackground: #3D3229;\n\t\t\tcolor: #E8E0D4;\n\t\t\tpadding: 1.25em;\n\t\t\tborder-radius: 6px;\n\t\t\toverflow-x: auto;\n\t\t\tline-height: 1.5;\n\t\t\tfont-size: 0.9em;\n\t\t}\n\t\t.pict-content code {\n\t\t\tbackground: #F0ECE4;\n\t\t\tpadding: 0.15em 0.4em;\n\t\t\tborder-radius: 3px;\n\t\t\tfont-size: 0.9em;\n\t\t\tcolor: #9E6B47;\n\t\t}\n\t\t.pict-content-code-wrap {\n\t\t\tdisplay: flex;\n\t\t\tflex-direction: row;\n\t\t\tfont-family: 'SFMono-Regular', 'SF Mono', 'Menlo', 'Consolas', 'Liberation Mono', 'Courier New', monospace;\n\t\t\tfont-size: 14px;\n\t\t\tline-height: 1.5;\n\t\t\tborder-radius: 6px;\n\t\t\toverflow: auto;\n\t\t\tmargin: 1em 0;\n\t\t\tbackground: #3D3229;\n\t\t}\n\t\t.pict-content-code-wrap .pict-content-code-line-numbers {\n\t\t\tposition: sticky;\n\t\t\tleft: 0;\n\t\t\twidth: 40px;\n\t\t\tmin-width: 40px;\n\t\t\tpadding: 1.25em 0;\n\t\t\ttext-align: right;\n\t\t\tbackground: #342A22;\n\t\t\tborder-right: 1px solid #4A3F35;\n\t\t\tcolor: #8A7F72;\n\t\t\tfont-size: 13px;\n\t\t\tline-height: 1.5;\n\t\t\tuser-select: none;\n\t\t\tpointer-events: none;\n\t\t\tbox-sizing: border-box;\n\t\t\tz-index: 1;\n\t\t}\n\t\t.pict-content-code-wrap .pict-content-code-line-numbers span {\n\t\t\tdisplay: block;\n\t\t\tpadding: 0 8px 0 0;\n\t\t}\n\t\t.pict-content-code-wrap pre {\n\t\t\tmargin: 0;\n\t\t\tbackground: #3D3229;\n\t\t\tcolor: #E8E0D4;\n\t\t\tpadding: 1.25em 1.25em 1.25em 8px;\n\t\t\tborder-radius: 0 6px 6px 0;\n\t\t\toverflow-x: auto;\n\t\t\tline-height: 1.5;\n\t\t\tfont-size: inherit;\n\t\t\tflex: 1;\n\t\t\tmin-width: 0;\n\t\t}\n\t\t.pict-content-code-wrap pre code {\n\t\t\tbackground: none;\n\t\t\tpadding: 0;\n\t\t\tcolor: inherit;\n\t\t\tfont-size: inherit;\n\t\t\tfont-family: inherit;\n\t\t}\n\t\t.pict-content-code-wrap .keyword { color: #C678DD; }\n\t\t.pict-content-code-wrap .string { color: #98C379; }\n\t\t.pict-content-code-wrap .number { color: #D19A66; }\n\t\t.pict-content-code-wrap .comment { color: #7F848E; font-style: italic; }\n\t\t.pict-content-code-wrap .operator { color: #56B6C2; }\n\t\t.pict-content-code-wrap .punctuation { color: #E8E0D4; }\n\t\t.pict-content-code-wrap .function-name { color: #61AFEF; }\n\t\t.pict-content-code-wrap .property { color: #E06C75; }\n\t\t.pict-content-code-wrap .tag { color: #E06C75; }\n\t\t.pict-content-code-wrap .attr-name { color: #D19A66; }\n\t\t.pict-content-code-wrap .attr-value { color: #98C379; }\n\t\t.pict-content pre code {\n\t\t\tbackground: none;\n\t\t\tpadding: 0;\n\t\t\tcolor: inherit;\n\t\t\tfont-size: inherit;\n\t\t}\n\t\t.pict-content blockquote {\n\t\t\tborder-left: 4px solid #2E7D74;\n\t\t\tmargin: 1em 0;\n\t\t\tpadding: 0.5em 1em;\n\t\t\tbackground: #F7F5F0;\n\t\t\tcolor: #5E5549;\n\t\t}\n\t\t.pict-content blockquote p {\n\t\t\tmargin: 0.25em 0;\n\t\t}\n\t\t.pict-content ul, .pict-content ol {\n\t\t\tpadding-left: 2em;\n\t\t\tline-height: 1.8;\n\t\t}\n\t\t.pict-content li {\n\t\t\tmargin: 0.25em 0;\n\t\t\tcolor: #423D37;\n\t\t}\n\t\t.pict-content hr {\n\t\t\tborder: none;\n\t\t\tborder-top: 1px solid #DDD6CA;\n\t\t\tmargin: 2em 0;\n\t\t}\n\t\t.pict-content table {\n\t\t\twidth: 100%;\n\t\t\tborder-collapse: collapse;\n\t\t\tmargin: 1em 0;\n\t\t}\n\t\t.pict-content table th {\n\t\t\tbackground: #F5F0E8;\n\t\t\tborder: 1px solid #DDD6CA;\n\t\t\tpadding: 0.6em 0.8em;\n\t\t\ttext-align: left;\n\t\t\tfont-weight: 600;\n\t\t\tcolor: #3D3229;\n\t\t}\n\t\t.pict-content table td {\n\t\t\tborder: 1px solid #DDD6CA;\n\t\t\tpadding: 0.5em 0.8em;\n\t\t\tcolor: #423D37;\n\t\t}\n\t\t.pict-content table tr:nth-child(even) {\n\t\t\tbackground: #F7F5F0;\n\t\t}\n\t\t.pict-content img {\n\t\t\tmax-width: 100%;\n\t\t\theight: auto;\n\t\t}\n\t\t.pict-content pre.mermaid {\n\t\t\tbackground: #fff;\n\t\t\tcolor: #3D3229;\n\t\t\ttext-align: center;\n\t\t\tpadding: 1em;\n\t\t}\n\t\t.pict-content .pict-content-katex-display {\n\t\t\ttext-align: center;\n\t\t\tmargin: 1em 0;\n\t\t\tpadding: 0.5em;\n\t\t\toverflow-x: auto;\n\t\t}\n\t\t.pict-content .pict-content-katex-inline {\n\t\t\tdisplay: inline;\n\t\t}\n\t",Templates:[{Hash:"Pict-Content-Template",Template:'\n<div class="pict-content" id="Pict-Content-Body">\n\t<div class="pict-content-loading">Loading content...</div>\n</div>\n'}],Renderables:[{RenderableHash:"Pict-Content-Display",TemplateHash:"Pict-Content-Template",DestinationAddress:"#Pict-Content-Container",RenderMethod:"replace"}]};e.exports=class extends i{constructor(t,e,o){super(t,e,o)}displayContent(t,e){let o=e||"Pict-Content-Body";this.pict.ContentAssignment.assignContent("#"+o,t);let i=document.getElementById(o);i&&i.parentElement&&(i.parentElement.scrollTop=0),this.renderMermaidDiagrams(o),this.renderKaTeXEquations(o)}renderMermaidDiagrams(t){if("undefined"==typeof mermaid)return;let e=t||"Pict-Content-Body",o=document.getElementById(e);if(!o)return;let i=o.querySelectorAll("pre.mermaid");if(!(i.length<1))try{mermaid.run({nodes:i})}catch(t){this.log.error("Mermaid rendering error: "+t.message)}}renderKaTeXEquations(t){if("undefined"==typeof katex)return;let e=t||"Pict-Content-Body",o=document.getElementById(e);if(!o)return;let i=o.querySelectorAll(".pict-content-katex-inline");for(let t=0;t<i.length;t++)try{katex.render(i[t].textContent,i[t],{throwOnError:!1,displayMode:!1})}catch(t){this.log.warn("KaTeX inline error: "+t.message)}let n=o.querySelectorAll(".pict-content-katex-display");for(let t=0;t<n.length;t++)try{katex.render(n[t].textContent,n[t],{throwOnError:!1,displayMode:!0})}catch(t){this.log.warn("KaTeX display error: "+t.message)}}showLoading(t,e){let o=e||"Pict-Content-Body",i=t||"Loading content...";this.pict.ContentAssignment.assignContent("#"+o,'<div class="pict-content-loading">'+i+"</div>")}},e.exports.default_configuration=n},{"pict-view":41}],23:[function(t,e,o){e.exports.attach=function(t){t._createEditorInContainer=function(e,o,i){let n=t._codeMirrorModules,a=[];a.push(n.EditorView.domEventHandlers({keydown:(e,i)=>(e.ctrlKey||e.metaKey)&&"b"===e.key?(e.preventDefault(),t.applyFormatting(o,"bold"),!0):(e.ctrlKey||e.metaKey)&&"i"===e.key?(e.preventDefault(),t.applyFormatting(o,"italic"),!0):(e.ctrlKey||e.metaKey)&&"e"===e.key?(e.preventDefault(),t.applyFormatting(o,"code"),!0):void 0,paste:(e,i)=>{let n=e.clipboardData&&e.clipboardData.items;if(!n)return!1;for(let i=0;i<n.length;i++)if(n[i].type.startsWith("image/")){e.preventDefault();let a=n[i].getAsFile();return a&&t._processImageFile(a,o),!0}return!1},drop:(e,i)=>{if(t._dragSourceIndex>=0)return!1;if(!e.dataTransfer||!e.dataTransfer.files||e.dataTransfer.files.length<1)return!1;let n=e.dataTransfer.files[0];if(n.type&&n.type.startsWith("image/")){e.preventDefault(),e.stopPropagation(),t._processImageFile(n,o);let a=i.dom.closest(".pict-mde-segment-editor");return a&&a.classList.remove("pict-mde-image-dragover"),!0}return!1}})),n.extensions&&Array.isArray(n.extensions)&&(a=a.concat(n.extensions)),a.push(n.EditorView.updateListener.of(e=>{e.docChanged&&t._onSegmentContentChange(o,e.state.doc.toString()),e.focusChanged&&(e.view.hasFocus?(t._setActiveSegment(o),t._updateSidebarPosition(o)):setTimeout(()=>{if(t._activeSegmentIndex===o){let e=document.getElementById(`PictMDE-Segment-${o}`);e&&!e.contains(document.activeElement)&&(t._clearActiveSegment(o),t._resetSidebarPosition(o))}},100)),e.selectionSet&&e.view.hasFocus&&t._updateSidebarPosition(o)}));let r=t._buildDataURICollapseExtension();r&&a.push(r),t.options.ReadOnly&&(a.push(n.EditorState.readOnly.of(!0)),a.push(n.EditorView.editable.of(!1))),a=t.customConfigureExtensions(a,o);let s=n.EditorState.create({doc:i||"",extensions:a}),l=new n.EditorView({state:s,parent:e});t._segmentEditors[o]=l,l.contentDOM.addEventListener("keydown",function(e){if("ArrowDown"!==e.key&&"ArrowUp"!==e.key)return;if(e.shiftKey||e.ctrlKey||e.metaKey||e.altKey)return;let i=l.state,n=i.selection.main.head,a=i.doc.lineAt(n),r=n-a.from;if("ArrowDown"===e.key){if(a.to<i.doc.length)return;let n=t._getOrderedSegmentIndices(),s=t._getLogicalIndex(o);if(s<0||s>=n.length-1)return;let l=n[s+1],c=t._segmentEditors[l];if(!c)return;e.preventDefault(),e.stopPropagation();let d=c.state.doc.line(1),p=Math.min(r,d.to-d.from);c.focus(),c.dispatch({selection:{anchor:d.from+p}}),t._setActiveSegment(l)}else if("ArrowUp"===e.key){if(a.number>1)return;let i=t._getOrderedSegmentIndices(),n=t._getLogicalIndex(o);if(n<=0)return;let s=i[n-1],l=t._segmentEditors[s];if(!l)return;e.preventDefault(),e.stopPropagation();let c=l.state.doc.line(l.state.doc.lines),d=Math.min(r,c.to-c.from);l.focus(),l.dispatch({selection:{anchor:c.from+d}}),t._setActiveSegment(s)}},!0),l.contentDOM.addEventListener("drop",function(e){if(t._dragSourceIndex>=0)return;if(!e.dataTransfer||!e.dataTransfer.files||e.dataTransfer.files.length<1)return;let i=e.dataTransfer.files[0];if(i.type&&i.type.startsWith("image/")){e.preventDefault(),e.stopPropagation(),t._processImageFile(i,o);let n=document.getElementById(`PictMDE-SegmentEditor-${o}`);n&&n.classList.remove("pict-mde-image-dragover")}},!0)},t._buildDataURICollapseExtension=function(){let e=t._codeMirrorModules;if(!(e&&e.Decoration&&e.ViewPlugin&&e.WidgetType))return null;let o=e.Decoration,i=e.ViewPlugin,n=e.WidgetType;class a extends n{constructor(t){super(),this.label=t}toDOM(){let t=document.createElement("span");return t.className="pict-mde-data-uri-collapsed",t.textContent=this.label,t.title="Data URI (click to expand in image preview below)",t}eq(t){return this.label===t.label}}function r(t){let e=[],i=t.state.doc;for(let n of t.visibleRanges){let t,r=n.from,s=n.to,l=i.sliceString(r,s),c=/!\[[^\]]*\]\(data:([^;]+);base64,/g;for(;null!==(t=c.exec(l));){let n=r+t.index+t[0].length,s=-1,l=n,c=i.length,d=Math.min(c,l+5242880),p=4096;for(let t=l;t<d;t+=p){let e=Math.min(t+p,d),o=i.sliceString(t,e).indexOf(")");if(o>=0){s=t+o;break}}if(s<0)continue;let h=s-n;if(h<200)continue;let u,f=Math.round(.75*h);u=f>=1048576?(f/1048576).toFixed(1)+"MB":f>=1024?Math.round(f/1024)+"KB":f+"B";t[1];let g=`…${u})`,m=o.replace({widget:new a(g)});e.push(m.range(n,s+1))}}return o.set(e,!0)}return i.fromClass(class{constructor(t){this.decorations=r(t)}update(t){(t.docChanged||t.viewportChanged)&&(this.decorations=r(t.view))}},{decorations:t=>t.decorations})}}},{}],24:[function(t,e,o){e.exports.attach=function(t){t._wireSegmentDragEvents=function(e,o){let i=e.querySelector(".pict-mde-drag-handle");i&&(i.addEventListener("dragstart",i=>{t._dragSourceIndex=o,i.dataTransfer.effectAllowed="move",i.dataTransfer.setData("text/plain",String(o));let n=t._getContainerElement();n&&n.classList.add("pict-mde-dragging"),setTimeout(()=>{e.style.opacity="0.4"},0)}),i.addEventListener("dragend",()=>{e.style.opacity="",t._dragSourceIndex=-1,t._clearAllDropIndicators();let o=t._getContainerElement();o&&o.classList.remove("pict-mde-dragging")}),e.addEventListener("dragover",o=>{o.preventDefault(),o.dataTransfer.dropEffect="move",t._clearAllDropIndicators();let i=e.getBoundingClientRect(),n=i.top+i.height/2;o.clientY<n?e.classList.add("pict-mde-drag-over-top"):e.classList.add("pict-mde-drag-over-bottom")}),e.addEventListener("dragleave",t=>{e.contains(t.relatedTarget)||(e.classList.remove("pict-mde-drag-over-top"),e.classList.remove("pict-mde-drag-over-bottom"))}),e.addEventListener("drop",i=>{i.preventDefault();let n=e.classList.contains("pict-mde-drag-over-bottom");t._clearAllDropIndicators();let a=t._dragSourceIndex;a<0||a===o||t._reorderSegment(a,o,n)}))},t._clearAllDropIndicators=function(){let e=t._getContainerElement();if(!e)return;let o=e.querySelectorAll(".pict-mde-segment");for(let t=0;t<o.length;t++)o[t].classList.remove("pict-mde-drag-over-top"),o[t].classList.remove("pict-mde-drag-over-bottom")},t._reorderSegment=function(e,o,i){let n=t._getLogicalIndex(e),a=t._getLogicalIndex(o);if(n<0||a<0)return void t.log.warn(`PICT-MarkdownEditor _reorderSegment: could not resolve logical indices (from=${n}, to=${a}).`);if(n===a)return;t._marshalAllEditorsToData();let r=t._getSegmentsFromData();if(!r||r.length<2)return;let s=i?a+1:a;if(n<s&&s--,s===n)return;let l=r.splice(n,1)[0];r.splice(s,0,l),t._setSegmentsToData(r),t._reorderHiddenPreviewState(n,s),t._reorderSegmentTabStates(n,s),t._buildEditorUI()},t._reorderHiddenPreviewState=function(e,o){if(e===o)return;let i=Object.keys(t._hiddenPreviewSegments).map(t=>parseInt(t,10));if(0===i.length)return;let n=Math.max(...i,e,o),a=[];for(let e=0;e<=n;e++)a.push(!!t._hiddenPreviewSegments[e]);let r=a.splice(e,1)[0];a.splice(o,0,r),t._hiddenPreviewSegments={};for(let e=0;e<a.length;e++)a[e]&&(t._hiddenPreviewSegments[e]=!0)},t._swapHiddenPreviewState=function(e,o){let i=!!t._hiddenPreviewSegments[e];!!t._hiddenPreviewSegments[o]?t._hiddenPreviewSegments[e]=!0:delete t._hiddenPreviewSegments[e],i?t._hiddenPreviewSegments[o]=!0:delete t._hiddenPreviewSegments[o]},t._reorderSegmentTabStates=function(e,o){if(e===o)return;let i=Object.keys(t._segmentTabStates).map(t=>parseInt(t,10));if(0===i.length)return;let n=Math.max(...i,e,o),a=[];for(let e=0;e<=n;e++)a.push(t._segmentTabStates[e]||"editor");let r=a.splice(e,1)[0];a.splice(o,0,r),t._segmentTabStates={};for(let e=0;e<a.length;e++)"editor"!==a[e]&&(t._segmentTabStates[e]=a[e])},t._swapSegmentTabStates=function(e,o){let i=t._segmentTabStates[e]||"editor",n=t._segmentTabStates[o]||"editor";"editor"!==n?t._segmentTabStates[e]=n:delete t._segmentTabStates[e],"editor"!==i?t._segmentTabStates[o]=i:delete t._segmentTabStates[o]},t._setActiveSegment=function(e){if(t._activeSegmentIndex>=0&&t._activeSegmentIndex!==e){let e=document.getElementById(`PictMDE-Segment-${t._activeSegmentIndex}`);e&&e.classList.remove("pict-mde-active")}t._activeSegmentIndex=e;let o=document.getElementById(`PictMDE-Segment-${e}`);o&&o.classList.add("pict-mde-active")},t._clearActiveSegment=function(e){t._activeSegmentIndex===e&&(t._activeSegmentIndex=-1);let o=document.getElementById(`PictMDE-Segment-${e}`);o&&o.classList.remove("pict-mde-active"),t._resetSidebarPosition(e)},t._updateSidebarPosition=function(e){let o=document.getElementById(`PictMDE-Segment-${e}`);if(!o)return;let i=o.querySelector(".pict-mde-quadrant-tr");if(!i)return;let n=t._segmentEditors[e];if(!n)return;let a=n.state.selection.main.head,r=n.coordsAtPos(a);if(!r)return void t._resetSidebarPosition(e);let s=o.getBoundingClientRect(),l=r.top-s.top,c=i.offsetHeight||0,d=o.offsetHeight||0,p=Math.max(0,d-c);l=Math.max(0,Math.min(l,p)),i.classList.add("pict-mde-sidebar-at-cursor"),i.style.setProperty("--pict-mde-sidebar-top",`${l}px`)},t._resetSidebarPosition=function(t){let e=document.getElementById(`PictMDE-Segment-${t}`);if(!e)return;let o=e.querySelector(".pict-mde-quadrant-tr");o&&(o.classList.remove("pict-mde-sidebar-at-cursor"),o.style.removeProperty("--pict-mde-sidebar-top"))}}},{}],25:[function(t,e,o){const i={bold:{wrap:"**"},italic:{wrap:"*"},code:{wrap:"`"},heading:{prefix:"# "},link:{before:"[",after:"](url)"}};e.exports.attach=function(t){t.applyFormatting=function(e,o){let n=t._segmentEditors[e];if(!n)return void t.log.warn(`PICT-MarkdownEditor applyFormatting: no editor for segment ${e}.`);let a=i[o];if(!a)return void t.log.warn(`PICT-MarkdownEditor applyFormatting: unknown format type "${o}".`);let r,s,l=n.state,c=l.selection.main,d=c.from,p=c.to,h=d!==p,u=h?l.sliceDoc(d,p):"";if(a.wrap){let t=a.wrap;if(h){let e=l.sliceDoc(Math.max(0,d-t.length),d),o=l.sliceDoc(p,Math.min(l.doc.length,p+t.length));if(e===t&&o===t)return r=[{from:d-t.length,to:d,insert:""},{from:p,to:p+t.length,insert:""}],s=d-t.length,void n.dispatch({changes:r,selection:{anchor:s,head:s+u.length}});r={from:d,to:p,insert:t+u+t},s=d+t.length,n.dispatch({changes:r,selection:{anchor:s,head:s+u.length}})}else{r={from:d,insert:t+t},s=d+t.length,n.dispatch({changes:r,selection:{anchor:s}})}}else if(a.prefix){let t=l.doc.lineAt(d);r=t.text.startsWith(a.prefix)?{from:t.from,to:t.from+a.prefix.length,insert:""}:{from:t.from,insert:a.prefix},n.dispatch({changes:r})}else if(a.before&&a.after)if(h){r={from:d,to:p,insert:a.before+u+a.after},s=d+a.before.length+u.length+2,n.dispatch({changes:r,selection:{anchor:s,head:s+3}})}else{r={from:d,insert:a.before+a.after},s=d+a.before.length,n.dispatch({changes:r,selection:{anchor:s}})}n.focus()}}},{}],26:[function(t,e,o){e.exports.attach=function(t){t.openImagePicker=function(e){let o=document.getElementById(`PictMDE-ImageInput-${e}`);o?(o.onchange=()=>{o.files&&o.files.length>0&&t._processImageFile(o.files[0],e),o.value=""},o.click()):t.log.warn(`PICT-MarkdownEditor openImagePicker: file input not found for segment ${e}.`)},t._processImageFile=function(e,o){if(!e||!e.type||!e.type.startsWith("image/"))return void t.log.warn(`PICT-MarkdownEditor _processImageFile: not an image file (type: ${e?e.type:"null"}).`);let i=e.name?e.name.replace(/\.[^.]+$/,""):"image";if(t.onImageUpload(e,o,(e,n)=>{e?t.log.error(`PICT-MarkdownEditor image upload error: ${e}`):n&&t._insertImageMarkdown(o,n,i)}))return;if("undefined"==typeof FileReader)return void t.log.error("PICT-MarkdownEditor _processImageFile: FileReader not available in this environment.");let n=new FileReader;n.onload=()=>{t._insertImageMarkdown(o,n.result,i)},n.onerror=()=>{t.log.error("PICT-MarkdownEditor _processImageFile: FileReader error.")},n.readAsDataURL(e)},t._insertImageMarkdown=function(e,o,i){let n=t._segmentEditors[e];if(!n)return void t.log.warn(`PICT-MarkdownEditor _insertImageMarkdown: no editor for segment ${e}.`);let a=``,r=n.state.selection.main.head;n.dispatch({changes:{from:r,insert:a},selection:{anchor:r+a.length}}),n.focus(),t._updateImagePreviews(e)},t._updateImagePreviews=function(e){let o=document.getElementById(`PictMDE-ImagePreview-${e}`);if(!o)return;let i=t._segmentEditors[e];if(!i)return o.innerHTML="",void o.classList.remove("pict-mde-has-images");let n,a=i.state.doc.toString(),r=/!\[([^\]]*)\]\(([^)]+)\)/g,s=[];for(;null!==(n=r.exec(a));)s.push({alt:n[1]||"image",url:n[2]});if(0===s.length)return o.innerHTML="",void o.classList.remove("pict-mde-has-images");let l="";for(let e=0;e<s.length;e++){let o=s[e].alt.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""");l+=`<div class="pict-mde-image-preview-item"><img src="${t._resolveImageURL(s[e].url).replace(/&/g,"&").replace(/"/g,""")}" alt="${o}" /><span class="pict-mde-image-preview-label">${o}</span></div>`}o.innerHTML=l,o.classList.add("pict-mde-has-images")},t._wireImageDragEvents=function(e,o){e.addEventListener("dragover",o=>{t._dragSourceIndex>=0||!o.dataTransfer||!o.dataTransfer.types||o.dataTransfer.types.indexOf("Files")<0||(o.preventDefault(),o.dataTransfer.dropEffect="copy",e.classList.add("pict-mde-image-dragover"))}),e.addEventListener("dragleave",t=>{e.contains(t.relatedTarget)||e.classList.remove("pict-mde-image-dragover")}),e.addEventListener("drop",i=>{if(e.classList.remove("pict-mde-image-dragover"),t._dragSourceIndex>=0)return;if(!i.dataTransfer||!i.dataTransfer.files||i.dataTransfer.files.length<1)return;let n=i.dataTransfer.files[0];n.type&&n.type.startsWith("image/")&&(i.preventDefault(),i.stopPropagation(),t._processImageFile(n,o))})}}},{}],27:[function(t,e,o){const i=t("pict-section-content").PictContentProvider;e.exports.attach=function(t){t._getContentProvider=function(){return t._contentProvider||(t._contentProvider=new i(t.fable,{},"Pict-Content-Provider-MDE")),t._contentProvider},t._updateRichPreviews=function(e){if(!t.options.EnableRichPreview)return;let o=document.getElementById(`PictMDE-RichPreview-${e}`);if(!o)return;let i=t._segmentEditors[e];if(!i)return o.innerHTML="",void o.classList.remove("pict-mde-has-rich-preview");let n=i.state.doc.toString();if(!n||0===n.trim().length)return o.innerHTML="",void o.classList.remove("pict-mde-has-rich-preview");let a=t._getContentProvider().parseMarkdown(n);if(!a||0===a.trim().length)return o.innerHTML="",void o.classList.remove("pict-mde-has-rich-preview");let r=`PictMDE-RichPreviewBody-${e}`;if(o.innerHTML=`<div class="pict-content" id="${r}">${a}</div>`,o.classList.add("pict-mde-has-rich-preview"),t.options.ImageBaseURL){let e=o.querySelectorAll("img");for(let o=0;o<e.length;o++){let i=e[o].getAttribute("src");if(i){let n=t._resolveImageURL(i);n!==i&&e[o].setAttribute("src",n)}}}let s=(t._richPreviewGenerations[e]||0)+1;t._richPreviewGenerations[e]=s,t._postRenderMermaid(r,e,s),t._postRenderKaTeX(r)},t._postRenderMermaid=function(e,o,i){if("undefined"==typeof mermaid)return;let n=document.getElementById(e);if(!n)return;let a=n.querySelectorAll("pre.mermaid");if(!(a.length<1))try{let e=mermaid.run({nodes:a});e&&"function"==typeof e.catch&&e.catch(e=>{(-1===o?t._renderedViewGeneration:t._richPreviewGenerations[o])===i&&t.log.warn(`PICT-MarkdownEditor mermaid render error: ${e.message||e}`)})}catch(e){t.log.warn(`PICT-MarkdownEditor mermaid render error: ${e.message||e}`)}},t._postRenderKaTeX=function(e){if("undefined"==typeof katex)return;let o=document.getElementById(e);if(!o)return;let i=o.querySelectorAll(".pict-content-katex-inline");for(let e=0;e<i.length;e++)try{katex.render(i[e].textContent,i[e],{throwOnError:!1,displayMode:!1})}catch(e){t.log.warn(`PICT-MarkdownEditor KaTeX inline error: ${e.message||e}`)}let n=o.querySelectorAll(".pict-content-katex-display");for(let e=0;e<n.length;e++)try{katex.render(n[e].textContent,n[e],{throwOnError:!1,displayMode:!0})}catch(e){t.log.warn(`PICT-MarkdownEditor KaTeX display error: ${e.message||e}`)}},t._escapeHTMLForPreview=function(t){return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")},t.toggleRenderedView=function(e){t._renderedViewActive="boolean"==typeof e?e:!t._renderedViewActive,t._renderedViewActive?t._renderRenderedView():t._restoreEditingView()},t._renderRenderedView=function(){let e=t._getContainerElement();if(!e)return;t._marshalAllEditorsToData();let o=t._getSegmentsFromData(),i="";if(o&&o.length>0){let t=[];for(let e=0;e<o.length;e++)t.push(o[e].Content||"");i=t.join("\n\n")}for(let e in t._segmentEditors)t._segmentEditors[e]&&t._segmentEditors[e].destroy();t._segmentEditors={};let n=t._getContentProvider().parseMarkdown(i),a="PictMDE-RenderedView";if(e.innerHTML=`<div class="pict-mde-rendered-view" id="${a}"><div class="pict-content">${n||""}</div></div>`,e.classList.add("pict-mde-rendered-mode"),t.options.ImageBaseURL){let o=e.querySelectorAll(".pict-mde-rendered-view img");for(let e=0;e<o.length;e++){let i=o[e].getAttribute("src");if(i){let n=t._resolveImageURL(i);n!==i&&o[e].setAttribute("src",n)}}}t._renderedViewGeneration++;let r=t._renderedViewGeneration,s=e.querySelector(`#${a} .pict-content`);if(s){let e="PictMDE-RenderedViewContent";s.id=e,t._postRenderMermaid(e,-1,r),t._postRenderKaTeX(e)}},t._restoreEditingView=function(){let e=t._getContainerElement();e&&(e.classList.remove("pict-mde-rendered-mode"),t._buildEditorUI())}}},{"pict-section-content":20}],28:[function(t,e,o){e.exports={DefaultRenderable:"MarkdownEditor-Wrap",DefaultDestinationAddress:"#MarkdownEditor-Container-Div",Templates:[{Hash:"MarkdownEditor-Container",Template:'<div class="pict-mde" id="PictMDE-Container"></div>'},{Hash:"MarkdownEditor-Segment",Template:'<div class="pict-mde-segment" id="PictMDE-Segment-{~D:Record.SegmentIndex~}" data-segment-index="{~D:Record.SegmentIndex~}">\n\t<div class="pict-mde-left-controls">\n\t\t<div class="pict-mde-quadrant-tl"></div>\n\t\t<div class="pict-mde-quadrant-bl"></div>\n\t</div>\n\t<div class="pict-mde-drag-handle" draggable="true" title="Drag to reorder"></div>\n\t<div class="pict-mde-segment-body">\n\t\t<div class="pict-mde-tab-bar" id="PictMDE-TabBar-{~D:Record.SegmentIndex~}">\n\t\t\t<button type="button" class="pict-mde-tab pict-mde-tab-active" data-tab="editor" onclick="{~D:Record.ViewIdentifier~}.switchSegmentTab({~D:Record.SegmentIndex~}, \'editor\')">Edit</button>\n\t\t\t<button type="button" class="pict-mde-tab" data-tab="preview" onclick="{~D:Record.ViewIdentifier~}.switchSegmentTab({~D:Record.SegmentIndex~}, \'preview\')">Preview</button>\n\t\t</div>\n\t\t<div class="pict-mde-segment-editor" id="PictMDE-SegmentEditor-{~D:Record.SegmentIndex~}"></div>\n\t\t<div class="pict-mde-preview-pane" id="PictMDE-PreviewPane-{~D:Record.SegmentIndex~}">\n\t\t\t<div class="pict-mde-image-preview" id="PictMDE-ImagePreview-{~D:Record.SegmentIndex~}"></div>\n\t\t\t<div class="pict-mde-rich-preview" id="PictMDE-RichPreview-{~D:Record.SegmentIndex~}"></div>\n\t\t</div>\n\t</div>\n\t<div class="pict-mde-sidebar" id="PictMDE-Sidebar-{~D:Record.SegmentIndex~}">\n\t\t<div class="pict-mde-quadrant-tr"></div>\n\t\t<div class="pict-mde-quadrant-br"></div>\n\t\t<input type="file" accept="image/*" class="pict-mde-image-input" id="PictMDE-ImageInput-{~D:Record.SegmentIndex~}" style="display:none" />\n\t</div>\n</div>'},{Hash:"MarkdownEditor-AddSegment",Template:'<div class="pict-mde-add-segment">\n\t<button type="button" class="pict-mde-btn-add" onclick="{~D:Record.ViewIdentifier~}.addSegment()">+ Add Segment</button>\n</div>'}],Renderables:[{RenderableHash:"MarkdownEditor-Wrap",TemplateHash:"MarkdownEditor-Container",DestinationAddress:"#MarkdownEditor-Container-Div"}],TargetElementAddress:"#MarkdownEditor-Container-Div",ContentDataAddress:!1,ReadOnly:!1,EnableRichPreview:!0,DefaultPreviewMode:"off",ImageBaseURL:"",ButtonsTL:[{HTML:"×",Action:"removeSegment",Class:"pict-mde-btn-remove",Title:"Remove Segment"}],ButtonsBL:[{HTML:"↑",Action:"moveSegmentUp",Class:"pict-mde-btn-move",Title:"Move Up"},{HTML:"↓",Action:"moveSegmentDown",Class:"pict-mde-btn-move",Title:"Move Down"},{HTML:"⊞",Action:"toggleControls",Class:"pict-mde-btn-linenums",Title:"Toggle Controls"},{HTML:"◎",Action:"cyclePreviewMode",Class:"pict-mde-btn-preview",Title:"Cycle Preview Mode"}],ButtonsTR:[{HTML:"<b>B</b>",Action:"applyFormatting:bold",Class:"",Title:"Bold (Ctrl+B)"},{HTML:"<i>I</i>",Action:"applyFormatting:italic",Class:"",Title:"Italic (Ctrl+I)"},{HTML:"<code><></code>",Action:"applyFormatting:code",Class:"",Title:"Inline Code (Ctrl+E)"},{HTML:"#",Action:"applyFormatting:heading",Class:"",Title:"Heading"},{HTML:"[ ]",Action:"applyFormatting:link",Class:"",Title:"Link"},{HTML:"▣",Action:"openImagePicker",Class:"pict-mde-sidebar-btn-image",Title:"Insert Image"}],ButtonsBR:[],CSS:"\n/* ---- Container ---- */\n.pict-mde\n{\n\tfont-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;\n\tfont-size: 14px;\n}\n\n/* ---- Segment row: left-controls | drag-handle | editor body | sidebar ---- */\n.pict-mde-segment\n{\n\tposition: relative;\n\tdisplay: flex;\n\tflex-direction: row;\n\talign-items: stretch;\n\tmargin-bottom: 6px;\n\tmin-height: 48px;\n\ttransition: background-color 0.15s ease;\n}\n\n/* ---- Left controls column ---- */\n.pict-mde-left-controls\n{\n\tflex: 0 0 22px;\n\tdisplay: flex;\n\tflex-direction: column;\n\talign-items: center;\n\tjustify-content: space-between;\n\tpadding: 2px 0;\n}\n\n/* ---- Left-side quadrants ---- */\n.pict-mde-quadrant-tl\n{\n\tdisplay: flex;\n\tflex-direction: column;\n\talign-items: center;\n\tposition: sticky;\n\ttop: 2px;\n\tz-index: 2;\n}\n.pict-mde-quadrant-bl\n{\n\tdisplay: flex;\n\tflex-direction: column;\n\talign-items: center;\n\tgap: 1px;\n\tposition: sticky;\n\tbottom: 2px;\n\tz-index: 2;\n}\n\n/* ---- Left-side buttons (shared base) ---- */\n.pict-mde-left-btn\n{\n\tdisplay: flex;\n\talign-items: center;\n\tjustify-content: center;\n\twidth: 20px;\n\theight: 20px;\n\tborder: none;\n\tbackground: transparent;\n\tcursor: pointer;\n\tfont-size: 12px;\n\tpadding: 0;\n\tcolor: #888;\n\tline-height: 1;\n\tfont-family: inherit;\n\topacity: 0;\n\ttransition: opacity 0.15s ease;\n}\n.pict-mde-segment:hover .pict-mde-left-btn,\n.pict-mde-segment.pict-mde-active .pict-mde-left-btn\n{\n\topacity: 1;\n}\n.pict-mde-left-btn:hover\n{\n\tcolor: #222;\n}\n.pict-mde-btn-remove:hover\n{\n\tcolor: #CC3333;\n}\n.pict-mde-btn-linenums\n{\n\tfont-size: 11px;\n\tfont-weight: 600;\n\tfont-family: 'SFMono-Regular', 'SF Mono', 'Menlo', monospace;\n}\n/* Highlight when controls are active */\n.pict-mde.pict-mde-controls-on .pict-mde-btn-linenums\n{\n\tcolor: #4A90D9;\n}\n.pict-mde-btn-preview\n{\n\tfont-size: 11px;\n}\n/* Preview button: highlight when any preview mode is active */\n.pict-mde.pict-mde-preview-bottom .pict-mde-btn-preview,\n.pict-mde.pict-mde-preview-side .pict-mde-btn-preview,\n.pict-mde.pict-mde-preview-tabbed .pict-mde-btn-preview\n{\n\tcolor: #4A90D9;\n}\n/* Dim preview button when mode is off */\n.pict-mde.pict-mde-preview-off .pict-mde-btn-preview\n{\n\tcolor: #CCC;\n}\n\n/* ---- Drag handle (simple grey bar) ---- */\n.pict-mde-drag-handle\n{\n\tflex: 0 0 8px;\n\tcursor: grab;\n\tbackground: #EDEDED;\n\ttransition: background-color 0.15s ease;\n\tuser-select: none;\n}\n.pict-mde-drag-handle:active\n{\n\tcursor: grabbing;\n}\n.pict-mde-drag-handle:hover\n{\n\tbackground: #C8C8C8;\n}\n\n/* ---- Editor body (middle column) ---- */\n.pict-mde-segment-body\n{\n\tflex: 1 1 0%;\n\tmin-width: 0;\n\toverflow: hidden;\n\tbackground: #FFFFFF;\n\ttransition: background-color 0.15s ease;\n}\n.pict-mde-segment-editor\n{\n\tmin-height: 48px;\n}\n\n/* ---- Image preview area below the editor ---- */\n.pict-mde-image-preview\n{\n\tdisplay: none;\n}\n.pict-mde-image-preview.pict-mde-has-images\n{\n\tdisplay: flex;\n\tflex-wrap: wrap;\n\tgap: 8px;\n\tpadding: 8px 12px;\n\tborder-top: 1px solid #EDEDED;\n}\n.pict-mde-image-preview img\n{\n\tmax-width: 200px;\n\tmax-height: 150px;\n\tborder-radius: 3px;\n\tborder: 1px solid #E0E0E0;\n\tobject-fit: contain;\n\tbackground: #F8F8F8;\n}\n.pict-mde-image-preview-item\n{\n\tposition: relative;\n\tdisplay: inline-block;\n}\n.pict-mde-image-preview-label\n{\n\tdisplay: block;\n\tfont-size: 10px;\n\tcolor: #999;\n\tmargin-top: 2px;\n\tmax-width: 200px;\n\toverflow: hidden;\n\ttext-overflow: ellipsis;\n\twhite-space: nowrap;\n}\n\n/* ---- Rich content preview area (rendered via pict-section-content) ---- */\n.pict-mde-rich-preview\n{\n\tdisplay: none;\n}\n.pict-mde-rich-preview.pict-mde-has-rich-preview\n{\n\tdisplay: block;\n\tborder-top: 1px solid #EDEDED;\n\tbackground: #FCFCFC;\n\toverflow: hidden;\n}\n/* Constrain images in the rich preview even if pict-section-content CSS loads late */\n.pict-mde-rich-preview img\n{\n\tmax-width: 100%;\n\theight: auto;\n}\n/* ---- Preview layout modes ---- */\n\n/* Tab bar: hidden by default, shown only in tabbed mode */\n.pict-mde-tab-bar\n{\n\tdisplay: none;\n}\n.pict-mde.pict-mde-preview-tabbed .pict-mde-tab-bar\n{\n\tdisplay: flex;\n\tgap: 0;\n\tborder-bottom: 1px solid #EDEDED;\n\tbackground: #F8F8F8;\n}\n.pict-mde-tab\n{\n\tpadding: 4px 12px;\n\tborder: none;\n\tbackground: transparent;\n\tcursor: pointer;\n\tfont-size: 12px;\n\tcolor: #888;\n\tborder-bottom: 2px solid transparent;\n\tfont-family: inherit;\n}\n.pict-mde-tab:hover\n{\n\tcolor: #222;\n}\n.pict-mde-tab.pict-mde-tab-active\n{\n\tcolor: #4A90D9;\n\tborder-bottom-color: #4A90D9;\n}\n\n/* Off mode: hide all preview panes and tab bars */\n.pict-mde.pict-mde-preview-off .pict-mde-preview-pane\n{\n\tdisplay: none;\n}\n.pict-mde.pict-mde-preview-off .pict-mde-tab-bar\n{\n\tdisplay: none;\n}\n/* Legacy class alias for backward compatibility */\n.pict-mde.pict-mde-previews-hidden .pict-mde-preview-pane\n{\n\tdisplay: none;\n}\n\n/* Bottom mode: vertical stacking (default flex-column behavior) */\n.pict-mde.pict-mde-preview-bottom .pict-mde-segment-body\n{\n\tdisplay: flex;\n\tflex-direction: column;\n}\n\n/* Side-by-side mode: editor and preview side by side */\n.pict-mde.pict-mde-preview-side .pict-mde-segment-body\n{\n\tdisplay: flex;\n\tflex-direction: row;\n}\n.pict-mde.pict-mde-preview-side .pict-mde-segment-editor\n{\n\tflex: 1 1 50%;\n\tmin-width: 0;\n\toverflow: hidden;\n}\n.pict-mde.pict-mde-preview-side .pict-mde-preview-pane\n{\n\tflex: 1 1 50%;\n\tmin-width: 0;\n\toverflow: auto;\n\tborder-left: 1px solid #EDEDED;\n}\n/* Side-by-side: remove top borders since preview is beside, not below */\n.pict-mde.pict-mde-preview-side .pict-mde-rich-preview.pict-mde-has-rich-preview\n{\n\tborder-top: none;\n}\n.pict-mde.pict-mde-preview-side .pict-mde-image-preview.pict-mde-has-images\n{\n\tborder-top: none;\n}\n\n/* Tabbed mode: default hides preview, shows editor */\n.pict-mde.pict-mde-preview-tabbed .pict-mde-segment-body\n{\n\tdisplay: flex;\n\tflex-direction: column;\n}\n.pict-mde.pict-mde-preview-tabbed .pict-mde-preview-pane\n{\n\tdisplay: none;\n}\n/* Tabbed mode: when showing preview, hide editor and show preview */\n.pict-mde.pict-mde-preview-tabbed .pict-mde-segment.pict-mde-tab-showing-preview .pict-mde-segment-editor\n{\n\tdisplay: none;\n}\n.pict-mde.pict-mde-preview-tabbed .pict-mde-segment.pict-mde-tab-showing-preview .pict-mde-preview-pane\n{\n\tdisplay: block;\n}\n\n/* Per-segment preview hide: only applies in bottom and side modes */\n.pict-mde.pict-mde-preview-bottom .pict-mde-segment.pict-mde-preview-hidden .pict-mde-preview-pane,\n.pict-mde.pict-mde-preview-side .pict-mde-segment.pict-mde-preview-hidden .pict-mde-preview-pane\n{\n\tdisplay: none;\n}\n/* Constrain the pict-content inside the preview to fit the segment */\n.pict-mde-rich-preview .pict-content\n{\n\tpadding: 12px;\n\tmax-width: none;\n\tmargin: 0;\n\tfont-size: 13px;\n}\n/* Reduce heading sizes in the preview to be proportional */\n.pict-mde-rich-preview .pict-content h1\n{\n\tfont-size: 1.4em;\n\tmargin-top: 0;\n}\n.pict-mde-rich-preview .pict-content h2\n{\n\tfont-size: 1.2em;\n\tmargin-top: 0.75em;\n}\n.pict-mde-rich-preview .pict-content h3\n{\n\tfont-size: 1.1em;\n\tmargin-top: 0.6em;\n}\n\n/* ---- Rendered view (full document preview mode) ---- */\n.pict-mde-rendered-view\n{\n\tpadding: 16px 20px;\n\tbackground: #FFFFFF;\n\tmin-height: 120px;\n}\n.pict-mde-rendered-view .pict-content\n{\n\tmax-width: none;\n\tmargin: 0;\n}\n/* Hide the add-segment button in rendered mode */\n.pict-mde.pict-mde-rendered-mode .pict-mde-add-segment\n{\n\tdisplay: none;\n}\n\n/* Focused / active editor gets subtle warm background */\n.pict-mde-segment.pict-mde-active .pict-mde-segment-body\n{\n\tbackground: #FAFAF5;\n}\n.pict-mde-segment.pict-mde-active .pict-mde-drag-handle\n{\n\tbackground: #9CB4C8;\n}\n\n/* ---- Right sidebar column ---- */\n.pict-mde-sidebar\n{\n\tflex: 0 0 30px;\n\tdisplay: flex;\n\tflex-direction: column;\n\talign-items: flex-start;\n\tjustify-content: space-between;\n\tposition: relative;\n}\n\n/* ---- Right-side quadrants ---- */\n.pict-mde-quadrant-tr\n{\n\tdisplay: flex;\n\tflex-direction: column;\n\talign-items: center;\n\tgap: 1px;\n\tpadding: 4px 0;\n\twidth: 100%;\n\topacity: 0;\n\ttransition: opacity 0.15s ease, top 0.1s ease;\n\tposition: sticky;\n\ttop: 0;\n}\n.pict-mde-quadrant-br\n{\n\tdisplay: flex;\n\tflex-direction: column;\n\talign-items: center;\n\tgap: 1px;\n\tpadding: 4px 0;\n\twidth: 100%;\n\topacity: 0;\n\ttransition: opacity 0.15s ease;\n\tposition: sticky;\n\tbottom: 0;\n}\n\n/* Active segment always shows its right-side quadrants */\n.pict-mde-segment.pict-mde-active .pict-mde-quadrant-tr,\n.pict-mde-segment.pict-mde-active .pict-mde-quadrant-br\n{\n\topacity: 1;\n}\n/* When no segment is active, hovering shows both left + right controls */\n.pict-mde:not(:has(.pict-mde-active)) .pict-mde-segment:hover .pict-mde-quadrant-tr,\n.pict-mde:not(:has(.pict-mde-active)) .pict-mde-segment:hover .pict-mde-quadrant-br\n{\n\topacity: 1;\n}\n\n/* ---- Controls-hidden mode: right quadrants show faintly on hover ---- */\n.pict-mde.pict-mde-controls-hidden .pict-mde-quadrant-tr,\n.pict-mde.pict-mde-controls-hidden .pict-mde-quadrant-br\n{\n\topacity: 0;\n}\n.pict-mde.pict-mde-controls-hidden .pict-mde-segment:hover .pict-mde-quadrant-tr,\n.pict-mde.pict-mde-controls-hidden .pict-mde-segment:hover .pict-mde-quadrant-br\n{\n\topacity: 0.3;\n}\n.pict-mde.pict-mde-controls-hidden .pict-mde-segment.pict-mde-active .pict-mde-quadrant-tr,\n.pict-mde.pict-mde-controls-hidden .pict-mde-segment.pict-mde-active .pict-mde-quadrant-br\n{\n\topacity: 0.3;\n}\n\n/* When JS sets a cursor-relative offset, switch TR from sticky to absolute positioning */\n.pict-mde-quadrant-tr.pict-mde-sidebar-at-cursor\n{\n\tposition: absolute;\n\ttop: var(--pict-mde-sidebar-top, 0px);\n}\n\n/* ---- Right-side buttons (shared base) ---- */\n.pict-mde-sidebar-btn\n{\n\tdisplay: flex;\n\talign-items: center;\n\tjustify-content: center;\n\twidth: 24px;\n\theight: 22px;\n\tborder: none;\n\tbackground: transparent;\n\tcursor: pointer;\n\tfont-size: 12px;\n\tpadding: 0;\n\tborder-radius: 3px;\n\tcolor: #666;\n\tline-height: 1;\n\tfont-family: inherit;\n}\n.pict-mde-sidebar-btn:hover\n{\n\tcolor: #222;\n}\n.pict-mde-sidebar-btn b\n{\n\tfont-size: 13px;\n\tfont-weight: 700;\n}\n.pict-mde-sidebar-btn i\n{\n\tfont-size: 13px;\n\tfont-style: italic;\n}\n.pict-mde-sidebar-btn code\n{\n\tfont-size: 10px;\n\tfont-family: 'SFMono-Regular', 'SF Mono', 'Menlo', monospace;\n}\n\n/* ---- Add segment button ---- */\n.pict-mde-add-segment\n{\n\tmargin-top: 6px;\n\tpadding-left: 30px;\n}\n.pict-mde-btn-add\n{\n\tdisplay: block;\n\twidth: 100%;\n\tpadding: 7px;\n\tborder: 2px dashed #D0D0D0;\n\tborder-radius: 4px;\n\tbackground: transparent;\n\tcolor: #999;\n\tfont-size: 12px;\n\tfont-weight: 600;\n\tcursor: pointer;\n\ttransition: all 0.15s ease;\n}\n.pict-mde-btn-add:hover\n{\n\tborder-color: #4A90D9;\n\tcolor: #4A90D9;\n\tbackground: rgba(74, 144, 217, 0.04);\n}\n\n/* ---- Image drag-over indicator ---- */\n.pict-mde-segment-editor.pict-mde-image-dragover\n{\n\toutline: 2px dashed #4A90D9;\n\toutline-offset: -2px;\n}\n\n/* ---- Drag-in-progress: prevent CodeMirror from intercepting drop events ---- */\n.pict-mde.pict-mde-dragging .pict-mde-segment-editor\n{\n\tpointer-events: none;\n}\n\n/* ---- Drop target indicators for drag reorder ---- */\n.pict-mde-segment.pict-mde-drag-over-top\n{\n\tbox-shadow: 0 -2px 0 0 #4A90D9;\n}\n.pict-mde-segment.pict-mde-drag-over-bottom\n{\n\tbox-shadow: 0 2px 0 0 #4A90D9;\n}\n\n/* ---- CodeMirror overrides inside segments ---- */\n.pict-mde-segment-editor .cm-editor\n{\n\tborder: none;\n}\n.pict-mde-segment-editor .cm-editor .cm-scroller\n{\n\tfont-family: 'SFMono-Regular', 'SF Mono', 'Menlo', 'Consolas', 'Liberation Mono', 'Courier New', monospace;\n\tfont-size: 14px;\n\tline-height: 1.6;\n}\n.pict-mde-segment-editor .cm-editor.cm-focused\n{\n\toutline: none;\n}\n.pict-mde-segment-editor .cm-editor .cm-content\n{\n\tpadding: 8px 12px;\n\tmin-height: 36px;\n}\n.pict-mde-segment-editor .cm-editor .cm-gutters\n{\n\tbackground: #F8F8F8;\n\tborder-right: 1px solid #E8E8E8;\n\tcolor: #BBB;\n}\n\n/* ---- Collapsed data URI widget ---- */\n.pict-mde-data-uri-collapsed\n{\n\tdisplay: inline;\n\tbackground: #F0F0F0;\n\tcolor: #888;\n\tfont-size: 11px;\n\tpadding: 1px 4px;\n\tborder-radius: 3px;\n\tborder: 1px solid #E0E0E0;\n\tfont-family: 'SFMono-Regular', 'SF Mono', 'Menlo', monospace;\n\tcursor: default;\n\twhite-space: nowrap;\n}\n\n/* ---- Line number / controls toggle: gutters hidden by default ---- */\n.pict-mde .cm-editor .cm-gutters\n{\n\tdisplay: none;\n}\n.pict-mde.pict-mde-controls-on .cm-editor .cm-gutters\n{\n\tdisplay: flex;\n}\n\n/* ============================================\n RESPONSIVE: Tablet / Phone (max-width: 768px)\n ============================================ */\n@media (max-width: 768px)\n{\n\t/* Prevent any horizontal overflow in the editor */\n\t.pict-mde\n\t{\n\t\toverflow-x: hidden;\n\t\tmax-width: 100%;\n\t}\n\n\t/* Reduce the left controls column width */\n\t.pict-mde-left-controls\n\t{\n\t\tflex: 0 0 16px;\n\t}\n\t.pict-mde-left-btn\n\t{\n\t\twidth: 16px;\n\t\theight: 18px;\n\t\tfont-size: 10px;\n\t}\n\n\t/* Make left-side buttons always visible on touch (no hover) */\n\t.pict-mde-left-btn\n\t{\n\t\topacity: 0.6;\n\t}\n\n\t/* Narrow the drag handle */\n\t.pict-mde-drag-handle\n\t{\n\t\tflex: 0 0 5px;\n\t}\n\n\t/* Shrink the right sidebar column */\n\t.pict-mde-sidebar\n\t{\n\t\tflex: 0 0 24px;\n\t}\n\t.pict-mde-sidebar-btn\n\t{\n\t\twidth: 20px;\n\t\theight: 20px;\n\t\tfont-size: 11px;\n\t}\n\n\t/* Make right sidebar buttons always visible (touch devices) */\n\t.pict-mde-quadrant-tr,\n\t.pict-mde-quadrant-br\n\t{\n\t\topacity: 0.7;\n\t}\n\t.pict-mde-segment.pict-mde-active .pict-mde-quadrant-tr,\n\t.pict-mde-segment.pict-mde-active .pict-mde-quadrant-br\n\t{\n\t\topacity: 1;\n\t}\n\n\t/* Reduce CodeMirror content padding */\n\t.pict-mde-segment-editor .cm-editor .cm-content\n\t{\n\t\tpadding: 6px 6px;\n\t}\n\n\t/* Reduce font size slightly for more content on screen */\n\t.pict-mde-segment-editor .cm-editor .cm-scroller\n\t{\n\t\tfont-size: 13px;\n\t}\n\n\t/* Add segment button: reduce left margin */\n\t.pict-mde-add-segment\n\t{\n\t\tpadding-left: 21px;\n\t}\n\n\t/* Side-by-side: fall back to vertical stacking on narrow screens */\n\t.pict-mde.pict-mde-preview-side .pict-mde-segment-body\n\t{\n\t\tflex-direction: column;\n\t}\n\t.pict-mde.pict-mde-preview-side .pict-mde-preview-pane\n\t{\n\t\tborder-left: none;\n\t\tborder-top: 1px solid #EDEDED;\n\t}\n\n\t/* Tab bar: smaller on tablet */\n\t.pict-mde-tab\n\t{\n\t\tpadding: 3px 8px;\n\t\tfont-size: 11px;\n\t}\n\n\t/* Rich preview: less padding */\n\t.pict-mde-rich-preview .pict-content\n\t{\n\t\tpadding: 8px;\n\t\tfont-size: 12px;\n\t}\n\n\t/* Image previews: smaller max dimensions */\n\t.pict-mde-image-preview img\n\t{\n\t\tmax-width: 120px;\n\t\tmax-height: 100px;\n\t}\n\n\t/* Rendered view: less padding */\n\t.pict-mde-rendered-view\n\t{\n\t\tpadding: 10px 8px;\n\t}\n}\n\n/* ============================================\n RESPONSIVE: Small phone (max-width: 480px)\n ============================================ */\n@media (max-width: 480px)\n{\n\t/* Wrap segment so left controls flow to the top as a horizontal bar */\n\t.pict-mde-segment\n\t{\n\t\tflex-wrap: wrap;\n\t}\n\n\t/* Left controls become a horizontal toolbar at the top of the segment */\n\t.pict-mde-left-controls\n\t{\n\t\tflex: 0 0 100%;\n\t\tflex-direction: row;\n\t\tjustify-content: flex-start;\n\t\tgap: 2px;\n\t\tpadding: 3px 4px;\n\t\torder: -1;\n\t\tbackground: #F5F5F5;\n\t\tborder-bottom: 1px solid #EDEDED;\n\t}\n\t.pict-mde-left-btn\n\t{\n\t\twidth: 24px;\n\t\theight: 24px;\n\t\tfont-size: 12px;\n\t\topacity: 0.7;\n\t}\n\n\t/* Left quadrants flow horizontally */\n\t.pict-mde-quadrant-tl,\n\t.pict-mde-quadrant-bl\n\t{\n\t\tflex-direction: row;\n\t\tgap: 2px;\n\t\tposition: static;\n\t}\n\n\t/* Segment body: explicit basis so it fills the wrapped row */\n\t.pict-mde-segment-body\n\t{\n\t\tflex: 1 1 calc(100% - 20px);\n\t}\n\n\t/* Hide drag handle on very small screens */\n\t.pict-mde-drag-handle\n\t{\n\t\tdisplay: none;\n\t}\n\n\t/* Right sidebar: further shrink */\n\t.pict-mde-sidebar\n\t{\n\t\tflex: 0 0 20px;\n\t}\n\t.pict-mde-sidebar-btn\n\t{\n\t\twidth: 18px;\n\t\theight: 18px;\n\t\tfont-size: 10px;\n\t}\n\n\t/* Add segment: no left offset since controls are at top */\n\t.pict-mde-add-segment\n\t{\n\t\tpadding-left: 0;\n\t}\n\n\t/* Even tighter CodeMirror padding */\n\t.pict-mde-segment-editor .cm-editor .cm-content\n\t{\n\t\tpadding: 4px 4px;\n\t}\n}\n"}},{}],29:[function(t,e,o){const i=t("pict-view"),n=t("pict-section-content"),a=t("./Pict-Section-MarkdownEditor-DefaultConfiguration.js"),r=t("./Pict-MDE-Formatting.js"),s=t("./Pict-MDE-ImageHandling.js"),l=t("./Pict-MDE-DragAndReorder.js"),c=t("./Pict-MDE-RichPreview.js"),d=t("./Pict-MDE-CodeMirror.js");e.exports=class extends i{constructor(t,e,o){super(t,Object.assign({},a,e),o),this.initialRenderComplete=!1,this._codeMirrorModules=null,this._segmentEditors={},this._segmentCounter=0,this._viewCallIdentifier=!1,this._activeSegmentIndex=-1,this._dragSourceIndex=-1,this._controlsVisible=!0,this._previewMode=this.options.DefaultPreviewMode||"off",this._lastPreviewLayout="bottom",this._segmentTabStates={},this._hiddenPreviewSegments={},this._imagePreviewTimers={},this._richPreviewTimers={},this._richPreviewGenerations={},this._contentProvider=null,this._renderedViewActive=!1,this._renderedViewGeneration=0,r.attach(this),s.attach(this),l.attach(this),c.attach(this),d.attach(this)}onBeforeInitialize(){return super.onBeforeInitialize(),this.targetElement=!1,super.onBeforeInitialize()}connectCodeMirrorModules(t){if(!t||"object"!=typeof t||"function"!=typeof t.EditorView||"function"!=typeof t.EditorState)return"undefined"!=typeof window&&window.CodeMirrorModules&&"function"==typeof window.CodeMirrorModules.EditorView?(this.log.trace("PICT-MarkdownEditor Found CodeMirror modules on window.CodeMirrorModules."),void(this._codeMirrorModules=window.CodeMirrorModules)):(this.log.error("PICT-MarkdownEditor No CodeMirror modules found. Provide them via connectCodeMirrorModules() or set window.CodeMirrorModules."),!1);this._codeMirrorModules=t}onAfterRender(t){return this.initialRenderComplete||(this.onAfterInitialRender(),this.initialRenderComplete=!0),this.pict.CSSMap.injectCSS(),super.onAfterRender(t)}onAfterInitialRender(){if(this._codeMirrorModules||this.connectCodeMirrorModules(),!this._codeMirrorModules)return this.log.error("PICT-MarkdownEditor Cannot initialize; no CodeMirror modules available."),!1;if(this.options.EnableRichPreview){let t=n.default_configuration;t&&t.CSS&&this.pict.CSSMap.addCSS("Pict-Content-View",t.CSS)}let t=this.services.ContentAssignment.getElement(this.options.TargetElementAddress);if(!t||t.length<1)return this.log.error(`PICT-MarkdownEditor Could not find target element [${this.options.TargetElementAddress}]!`),this.targetElement=!1,!1;this.targetElement=t[0],this._viewCallIdentifier=this._resolveViewCallIdentifier(),this._buildEditorUI()}_resolveViewCallIdentifier(){let t=this.pict.views;for(let e in t)if(t[e]===this)return`_Pict.views.${e}`;return`_Pict.servicesMap.PictView['${this.Hash}']`}_getContainerElement(){if(this.targetElement){let t=this.targetElement.querySelector(".pict-mde");if(t)return t}return this.targetElement||null}_resolveImageURL(t){if(!t||!this.options.ImageBaseURL)return t;if(t.startsWith("/")||t.startsWith("http://")||t.startsWith("https://")||t.startsWith("data:"))return t;let e=this.options.ImageBaseURL;return e&&!e.endsWith("/")&&(e+="/"),e+t}_buildEditorUI(){let t=this._getContainerElement();t&&!t.classList.contains("pict-mde")&&t.classList.add("pict-mde");for(let t in this._segmentEditors)this._segmentEditors[t]&&this._segmentEditors[t].destroy();t.innerHTML="",t.classList.remove("pict-mde-preview-off","pict-mde-preview-bottom","pict-mde-preview-side","pict-mde-preview-tabbed","pict-mde-previews-hidden"),t.classList.add("pict-mde-preview-"+this._previewMode),this._controlsVisible?t.classList.add("pict-mde-controls-on"):t.classList.add("pict-mde-controls-hidden");let e=this._getSegmentsFromData();e&&0!==e.length||(e=[{Content:""}],this._setSegmentsToData(e)),this._segmentCounter=0,this._segmentEditors={};for(let o=0;o<e.length;o++)this._renderSegment(t,o,e[o].Content||"");this._renderAddButton(t)}_renderSegment(t,e,o){let i=this._segmentCounter++,n={SegmentIndex:i,SegmentDisplayIndex:e+1,ViewIdentifier:this._viewCallIdentifier},a=this.pict.parseTemplateByHash("MarkdownEditor-Segment",n),r=document.createElement("div");r.innerHTML=a;let s=r.firstElementChild;if(t.appendChild(s),this._buildQuadrantButtons(s,i),this._hiddenPreviewSegments[e]&&s.classList.add("pict-mde-preview-hidden"),"tabbed"===this._previewMode&&"preview"===this._segmentTabStates[e]){s.classList.add("pict-mde-tab-showing-preview");let t=s.querySelector(".pict-mde-tab-bar");if(t){let e=t.querySelector('[data-tab="editor"]'),o=t.querySelector('[data-tab="preview"]');e&&e.classList.remove("pict-mde-tab-active"),o&&o.classList.add("pict-mde-tab-active")}}this._wireSegmentDragEvents(s,i);let l=document.getElementById(`PictMDE-SegmentEditor-${i}`);l&&(this._createEditorInContainer(l,i,o),this._wireImageDragEvents(l,i),o&&(this._updateImagePreviews(i),this._updateRichPreviews(i)))}_buildQuadrantButtons(t,e){let o=[{key:"ButtonsTL",selector:".pict-mde-quadrant-tl",baseClass:"pict-mde-left-btn"},{key:"ButtonsBL",selector:".pict-mde-quadrant-bl",baseClass:"pict-mde-left-btn"},{key:"ButtonsTR",selector:".pict-mde-quadrant-tr",baseClass:"pict-mde-sidebar-btn"},{key:"ButtonsBR",selector:".pict-mde-quadrant-br",baseClass:"pict-mde-sidebar-btn"}],i=this;for(let n=0;n<o.length;n++){let a=o[n],r=t.querySelector(a.selector);if(!r)continue;let s=this.options[a.key];if(Array.isArray(s))for(let t=0;t<s.length;t++){let o=s[t],n=document.createElement("button");n.type="button",n.className=a.baseClass,o.Class&&(n.className+=" "+o.Class),n.innerHTML=o.HTML||"",n.title=o.Title||"";let l=o.Action||"",c=l,d=null,p=l.indexOf(":");p>=0&&(c=l.substring(0,p),d=l.substring(p+1)),function(t,e,o){n.addEventListener("click",()=>{"function"==typeof i[t]?null!==e?i[t](o,e):i[t](o):i.log.warn(`PICT-MarkdownEditor _buildQuadrantButtons: method "${t}" not found.`)})}(c,d,e),r.appendChild(n)}}}customConfigureExtensions(t,e){return t}_renderAddButton(t){let e={ViewIdentifier:this._viewCallIdentifier},o=this.pict.parseTemplateByHash("MarkdownEditor-AddSegment",e),i=document.createElement("div");i.innerHTML=o;let n=i.firstElementChild;t.appendChild(n)}onImageUpload(t,e,o){return!1}toggleControls(t,e){let o=e;"boolean"==typeof t&&(o=t),this._controlsVisible="boolean"==typeof o?o:!this._controlsVisible;let i=this._getContainerElement();i&&(this._controlsVisible?(i.classList.add("pict-mde-controls-on"),i.classList.remove("pict-mde-controls-hidden")):(i.classList.remove("pict-mde-controls-on"),i.classList.add("pict-mde-controls-hidden")))}toggleLineNumbers(t){this.toggleControls(t)}togglePreview(t){"boolean"==typeof t?t?this.setPreviewMode(this._lastPreviewLayout||"bottom"):this.setPreviewMode("off"):"off"===this._previewMode?this.setPreviewMode(this._lastPreviewLayout||"bottom"):this.setPreviewMode("off")}setPreviewMode(t){if(["off","bottom","side","tabbed"].indexOf(t)<0)return void this.log.warn(`PICT-MarkdownEditor setPreviewMode: unknown mode "${t}".`);"off"!==t&&(this._lastPreviewLayout=t),this._previewMode=t;let e=this._getContainerElement();if(e&&(e.classList.remove("pict-mde-preview-off","pict-mde-preview-bottom","pict-mde-preview-side","pict-mde-preview-tabbed","pict-mde-previews-hidden"),e.classList.add("pict-mde-preview-"+t)),"off"!==t){let t=this._getOrderedSegmentIndices();for(let e=0;e<t.length;e++)this._updateRichPreviews(t[e]),this._updateImagePreviews(t[e])}}cyclePreviewMode(t){let e=["off","bottom","side","tabbed"],o=(e.indexOf(this._previewMode)+1)%e.length;this.setPreviewMode(e[o])}switchSegmentTab(t,e){let o=this._getLogicalIndex(t);if(o<0)return;this._segmentTabStates[o]=e;let i=document.getElementById(`PictMDE-Segment-${t}`);if(!i)return;"preview"===e?(i.classList.add("pict-mde-tab-showing-preview"),this._updateRichPreviews(t),this._updateImagePreviews(t)):i.classList.remove("pict-mde-tab-showing-preview");let n=document.getElementById(`PictMDE-TabBar-${t}`);if(n){let t=n.querySelectorAll(".pict-mde-tab");for(let o=0;o<t.length;o++)t[o].getAttribute("data-tab")===e?t[o].classList.add("pict-mde-tab-active"):t[o].classList.remove("pict-mde-tab-active")}}toggleSegmentPreview(t,e){let o=this._getLogicalIndex(t);if(o<0)return;let i=!!this._hiddenPreviewSegments[o];i="boolean"==typeof e?!e:!i,i?this._hiddenPreviewSegments[o]=!0:delete this._hiddenPreviewSegments[o];let n=document.getElementById(`PictMDE-Segment-${t}`);n&&(i?n.classList.add("pict-mde-preview-hidden"):(n.classList.remove("pict-mde-preview-hidden"),this._updateRichPreviews(t),this._updateImagePreviews(t)))}_getSegmentsFromData(){if(!this.options.ContentDataAddress)return null;const t={Fable:this.fable,Pict:this.fable,AppData:this.AppData,Bundle:this.Bundle,Options:this.options};let e=this.fable.manifest.getValueByHash(t,this.options.ContentDataAddress);return Array.isArray(e)?e:null}_setSegmentsToData(t){if(!this.options.ContentDataAddress)return;const e={Fable:this.fable,Pict:this.fable,AppData:this.AppData,Bundle:this.Bundle,Options:this.options};this.fable.manifest.setValueByHash(e,this.options.ContentDataAddress,t)}_onSegmentContentChange(t,e){let o=this._getLogicalIndex(t);if(o<0)return;let i=this._getSegmentsFromData();if(!i)return;o<i.length&&(i[o].Content=e),this.onContentChange(o,e);let n=this;this._imagePreviewTimers[t]&&clearTimeout(this._imagePreviewTimers[t]),this._imagePreviewTimers[t]=setTimeout(()=>{n._updateImagePreviews(t),delete n._imagePreviewTimers[t]},500),this._richPreviewTimers[t]&&clearTimeout(this._richPreviewTimers[t]),this._richPreviewTimers[t]=setTimeout(()=>{n._updateRichPreviews(t),delete n._richPreviewTimers[t]},500)}onContentChange(t,e){}_getLogicalIndex(t){let e=this._getContainerElement();if(!e)return-1;let o=e.querySelectorAll(".pict-mde-segment");for(let e=0;e<o.length;e++){if(parseInt(o[e].getAttribute("data-segment-index"),10)===t)return e}return-1}_getOrderedSegmentIndices(){let t=this._getContainerElement();if(!t)return[];let e=t.querySelectorAll(".pict-mde-segment"),o=[];for(let t=0;t<e.length;t++)o.push(parseInt(e[t].getAttribute("data-segment-index"),10));return o}addSegment(t){let e="string"==typeof t?t:"",o=this._getSegmentsFromData();o||(o=[]),o.push({Content:e}),this._setSegmentsToData(o),this._buildEditorUI()}removeSegment(t){let e=this._getLogicalIndex(t);if(e<0)return void this.log.warn(`PICT-MarkdownEditor removeSegment: segment index ${t} not found.`);let o=this._getSegmentsFromData();if(!o||o.length<=1)return void this.log.warn("PICT-MarkdownEditor removeSegment: cannot remove the last segment.");this._segmentEditors[t]&&(this._segmentEditors[t].destroy(),delete this._segmentEditors[t]),o.splice(e,1),this._setSegmentsToData(o);let i={};for(let t in this._hiddenPreviewSegments){let o=parseInt(t,10);o<e?i[o]=!0:o>e&&(i[o-1]=!0)}this._hiddenPreviewSegments=i;let n={};for(let t in this._segmentTabStates){let o=parseInt(t,10);o<e?n[o]=this._segmentTabStates[t]:o>e&&(n[o-1]=this._segmentTabStates[t])}this._segmentTabStates=n,this._buildEditorUI()}moveSegmentUp(t){let e=this._getLogicalIndex(t);if(e<=0)return;this._marshalAllEditorsToData();let o=this._getSegmentsFromData();if(!o)return;let i=o[e];o[e]=o[e-1],o[e-1]=i,this._swapHiddenPreviewState(e,e-1),this._swapSegmentTabStates(e,e-1),this._buildEditorUI()}moveSegmentDown(t){let e=this._getLogicalIndex(t),o=this._getSegmentsFromData();if(!o||e<0||e>=o.length-1)return;this._marshalAllEditorsToData();let i=o[e];o[e]=o[e+1],o[e+1]=i,this._swapHiddenPreviewState(e,e+1),this._swapSegmentTabStates(e,e+1),this._buildEditorUI()}getSegmentContent(t){let e=this._getOrderedSegmentIndices();if(t<0||t>=e.length)return"";let o=e[t],i=this._segmentEditors[o];return i?i.state.doc.toString():""}setSegmentContent(t,e){let o=this._getOrderedSegmentIndices();if(t<0||t>=o.length)return void this.log.warn(`PICT-MarkdownEditor setSegmentContent: index ${t} out of range.`);let i=o[t],n=this._segmentEditors[i];n&&n.dispatch({changes:{from:0,to:n.state.doc.length,insert:e}})}getSegmentCount(){return this._getOrderedSegmentIndices().length}getAllContent(t){let e="string"==typeof t?t:"\n\n",o=this._getOrderedSegmentIndices(),i=[];for(let t=0;t<o.length;t++){let e=this._segmentEditors[o[t]];e&&i.push(e.state.doc.toString())}return i.join(e)}_marshalAllEditorsToData(){let t=this._getSegmentsFromData();if(!t)return;let e=this._getOrderedSegmentIndices();for(let o=0;o<e.length;o++){let i=this._segmentEditors[e[o]];i&&o<t.length&&(t[o].Content=i.state.doc.toString())}}setReadOnly(t){this.options.ReadOnly=t,this.initialRenderComplete&&(this._marshalAllEditorsToData(),this._buildEditorUI())}marshalToView(){super.marshalToView(),this.initialRenderComplete&&this.options.ContentDataAddress&&this._buildEditorUI()}marshalFromView(){super.marshalFromView(),this._marshalAllEditorsToData()}destroy(){for(let t in this._segmentEditors)this._segmentEditors[t]&&this._segmentEditors[t].destroy();this._segmentEditors={};for(let t in this._richPreviewTimers)clearTimeout(this._richPreviewTimers[t]);this._richPreviewTimers={},this._richPreviewGenerations={},this._segmentTabStates={}}},e.exports.default_configuration=a},{"./Pict-MDE-CodeMirror.js":23,"./Pict-MDE-DragAndReorder.js":24,"./Pict-MDE-Formatting.js":25,"./Pict-MDE-ImageHandling.js":26,"./Pict-MDE-RichPreview.js":27,"./Pict-Section-MarkdownEditor-DefaultConfiguration.js":28,"pict-section-content":20,"pict-view":41}],30:[function(t,e,o){e.exports={ViewIdentifier:"Pict-ObjectEditor",DefaultRenderable:"ObjectEditor-Container",DefaultDestinationAddress:"#ObjectEditor-Container",AutoRender:!1,ObjectDataAddress:!1,InitialExpandDepth:1,Editable:!0,ShowTypeIndicators:!0,IndentPixels:20,CSS:"\n.pict-objecteditor\n{\n\tfont-family: 'SF Mono', 'Fira Code', 'Cascadia Code', 'JetBrains Mono', Consolas, monospace;\n\tfont-size: 13px;\n\tline-height: 1.5;\n\tcolor: #3D3229;\n\tbackground: #FDFCFA;\n\tborder: 1px solid #E8E3DA;\n\tborder-radius: 6px;\n\tpadding: 8px 0;\n\toverflow: auto;\n}\n.pict-oe-row\n{\n\tdisplay: flex;\n\talign-items: center;\n\tpadding: 2px 12px 2px 0;\n\tmin-height: 26px;\n\tcursor: default;\n\tborder-radius: 3px;\n}\n.pict-oe-row:hover\n{\n\tbackground: #F5F0E8;\n}\n.pict-oe-toggle\n{\n\tdisplay: inline-flex;\n\talign-items: center;\n\tjustify-content: center;\n\twidth: 16px;\n\theight: 16px;\n\tcursor: pointer;\n\tcolor: #8A7F72;\n\tfont-size: 10px;\n\tflex-shrink: 0;\n\tuser-select: none;\n\tborder-radius: 3px;\n\ttransition: color 0.1s;\n}\n.pict-oe-toggle:hover\n{\n\tbackground: #E8E3DA;\n\tcolor: #3D3229;\n}\n.pict-oe-spacer\n{\n\tdisplay: inline-block;\n\twidth: 16px;\n\tflex-shrink: 0;\n}\n.pict-oe-key\n{\n\tcolor: #9E6B47;\n\tflex-shrink: 0;\n}\n.pict-oe-separator\n{\n\tcolor: #8A7F72;\n\tmargin: 0 8px;\n\tflex-shrink: 0;\n}\n.pict-oe-value\n{\n\tmin-width: 0;\n\toverflow: hidden;\n\ttext-overflow: ellipsis;\n\twhite-space: nowrap;\n}\n.pict-oe-value-string\n{\n\tcolor: #2E7D74;\n}\n.pict-oe-value-string::before\n{\n\tcontent: '\"';\n\tcolor: #A8CFC9;\n}\n.pict-oe-value-string::after\n{\n\tcontent: '\"';\n\tcolor: #A8CFC9;\n}\n.pict-oe-value-number\n{\n\tcolor: #3B6DAA;\n}\n.pict-oe-value-boolean\n{\n\tcolor: #8B5E3C;\n\tfont-weight: 600;\n}\n.pict-oe-value-null\n{\n\tcolor: #B0A89E;\n\tfont-style: italic;\n}\n.pict-oe-summary\n{\n\tcolor: #B0A89E;\n\tmargin-left: 6px;\n\tfont-size: 12px;\n}\n.pict-oe-type-badge\n{\n\tdisplay: inline-block;\n\tfont-size: 9px;\n\tpadding: 0 4px;\n\tborder-radius: 3px;\n\tbackground: #F0ECE4;\n\tcolor: #8A7F72;\n\tmargin-left: 6px;\n\tline-height: 16px;\n\tvertical-align: middle;\n}\n.pict-oe-value-input\n{\n\tbackground: #FFF;\n\tborder: 1px solid #2E7D74;\n\tborder-radius: 3px;\n\tpadding: 1px 4px;\n\tfont-family: inherit;\n\tfont-size: inherit;\n\tcolor: inherit;\n\toutline: none;\n\tmin-width: 80px;\n}\n.pict-oe-value-input:focus\n{\n\tborder-color: #3B6DAA;\n\tbox-shadow: 0 0 0 2px rgba(59, 109, 170, 0.15);\n}\n.pict-oe-array-index\n{\n\tcolor: #8A7F72;\n\tfont-size: 11px;\n}\n.pict-oe-empty\n{\n\tcolor: #B0A89E;\n\tfont-style: italic;\n\tpadding: 8px 12px;\n}\n.pict-oe-actions\n{\n\tmargin-left: auto;\n\tpadding-left: 12px;\n\tpadding-right: 4px;\n\topacity: 0.4;\n\ttransition: opacity 0.15s;\n\tflex-shrink: 0;\n\tdisplay: flex;\n\talign-items: center;\n\tgap: 5px;\n}\n.pict-oe-row:hover .pict-oe-actions\n{\n\topacity: 1;\n}\n.pict-oe-action-btn\n{\n\tdisplay: inline-flex;\n\talign-items: center;\n\tjustify-content: center;\n\tmin-width: 22px;\n\theight: 22px;\n\tpadding: 0 5px;\n\tborder-radius: 3px;\n\tborder: 1px solid #DDD8CF;\n\tbackground: #F5F0E8;\n\tcursor: pointer;\n\tfont-size: 12px;\n\tcolor: #8A7F72;\n\tuser-select: none;\n\tbox-sizing: border-box;\n}\n.pict-oe-action-btn:hover\n{\n\tbackground: #E8E3DA;\n\tborder-color: #C5BFAE;\n\tcolor: #3D3229;\n}\n.pict-oe-action-remove\n{\n\tborder-color: #E8C8C8;\n\tbackground: #FAF0F0;\n\tcolor: #A04040;\n}\n.pict-oe-action-remove:hover\n{\n\tbackground: #F0D6D6;\n\tborder-color: #D4A0A0;\n\tcolor: #A04040;\n}\n.pict-oe-action-move\n{\n\tfont-size: 9px;\n}\n.pict-oe-action-move:hover\n{\n\tbackground: #D6E4F0;\n\tborder-color: #A8C4DA;\n\tcolor: #3B6DAA;\n}\n.pict-oe-action-add\n{\n\tborder-color: #C8D8C8;\n\tbackground: #F0F5F0;\n\tcolor: #5A7A5A;\n}\n.pict-oe-action-add:hover\n{\n\tbackground: #D6E8D6;\n\tborder-color: #A0C0A0;\n\tcolor: #3D5C3D;\n}\n.pict-oe-key-input\n{\n\tbackground: #FFF;\n\tborder: 1px solid #9E6B47;\n\tborder-radius: 3px;\n\tpadding: 1px 4px;\n\tfont-family: inherit;\n\tfont-size: inherit;\n\tcolor: #9E6B47;\n\toutline: none;\n\tmin-width: 60px;\n\tmargin-left: 6px;\n}\n.pict-oe-key-input:focus\n{\n\tborder-color: #3B6DAA;\n\tbox-shadow: 0 0 0 2px rgba(59, 109, 170, 0.15);\n}\n.pict-oe-type-select\n{\n\tbackground: #FFF;\n\tborder: 1px solid #C5BFAE;\n\tborder-radius: 3px;\n\tpadding: 1px 4px;\n\tfont-family: inherit;\n\tfont-size: inherit;\n\tcolor: #3D3229;\n\toutline: none;\n\tmargin-left: 6px;\n\tcursor: pointer;\n}\n.pict-oe-type-select:focus\n{\n\tborder-color: #3B6DAA;\n\tbox-shadow: 0 0 0 2px rgba(59, 109, 170, 0.15);\n}\n.pict-oe-root-add\n{\n\tdisplay: flex;\n\talign-items: center;\n\tpadding: 4px 12px;\n\tmin-height: 26px;\n\tcursor: default;\n}\n.pict-oe-root-add .pict-oe-action-btn\n{\n\twidth: auto;\n\twhite-space: nowrap;\n\tpadding: 0 8px;\n}\n",MacroTemplates:{Node:{RowOpen:'<div class="pict-oe-row" style="padding-left:{~D:Record.PaddingLeft~}px" data-path="{~D:Record.EscapedPath~}">',RowClose:"</div>",Toggle:"<span class=\"pict-oe-toggle\" onclick=\"{~P~}.views['{~D:Context[0].Hash~}'].toggleNode('{~D:Record.EscapedPath~}')\">{~D:Record.ToggleArrow~}</span>",Spacer:'<span class="pict-oe-spacer"></span>',KeyName:'<span class="pict-oe-key">{~D:Record.EscapedKey~}</span>',KeyIndex:'<span class="pict-oe-key"><span class="pict-oe-array-index">{~D:Record.ArrayIndex~}</span></span>',Separator:'<span class="pict-oe-separator">:</span>',TypeBadge:'<span class="pict-oe-type-badge">{~D:Record.TypeLabel~}</span>',Summary:'<span class="pict-oe-summary">{~D:Record.SummaryText~}</span>',ValueStringEditable:"<span class=\"pict-oe-value pict-oe-value-string\" ondblclick=\"{~P~}.views['{~D:Context[0].Hash~}'].beginEdit('{~D:Record.EscapedPath~}', 'string')\" title=\"{~D:Record.EscapedTitle~}\">{~D:Record.EscapedValue~}</span>",ValueStringReadOnly:'<span class="pict-oe-value pict-oe-value-string" title="{~D:Record.EscapedTitle~}">{~D:Record.EscapedValue~}</span>',ValueNumberEditable:"<span class=\"pict-oe-value pict-oe-value-number\" ondblclick=\"{~P~}.views['{~D:Context[0].Hash~}'].beginEdit('{~D:Record.EscapedPath~}', 'number')\">{~D:Record.EscapedValue~}</span>",ValueNumberReadOnly:'<span class="pict-oe-value pict-oe-value-number">{~D:Record.EscapedValue~}</span>',ValueBooleanEditable:'<span class="pict-oe-value pict-oe-value-boolean" style="cursor:pointer" onclick="{~P~}.views[\'{~D:Context[0].Hash~}\'].toggleBoolean(\'{~D:Record.EscapedPath~}\')">{~D:Record.DisplayValue~}</span>',ValueBooleanReadOnly:'<span class="pict-oe-value pict-oe-value-boolean">{~D:Record.DisplayValue~}</span>',ValueNull:'<span class="pict-oe-value pict-oe-value-null">null</span>',ActionsOpen:'<span class="pict-oe-actions">',ActionsClose:"</span>",ButtonRemove:'<span class="pict-oe-action-btn pict-oe-action-remove" onclick="{~P~}.views[\'{~D:Context[0].Hash~}\'].removeNode(\'{~D:Record.EscapedPath~}\')" title="Remove">×</span>',ButtonAddObject:'<span class="pict-oe-action-btn pict-oe-action-add" onclick="{~P~}.views[\'{~D:Context[0].Hash~}\'].beginAddToObject(\'{~D:Record.EscapedPath~}\')" title="Add">+</span>',ButtonAddArray:'<span class="pict-oe-action-btn pict-oe-action-add" onclick="{~P~}.views[\'{~D:Context[0].Hash~}\'].beginAddToArray(\'{~D:Record.EscapedPath~}\')" title="Add">+</span>',ButtonMoveUp:'<span class="pict-oe-action-btn pict-oe-action-move" onclick="{~P~}.views[\'{~D:Context[0].Hash~}\'].moveArrayElementUp(\'{~D:Record.EscapedArrayPath~}\', {~D:Record.ArrayIndex~})" title="Move up">▲</span>',ButtonMoveDown:'<span class="pict-oe-action-btn pict-oe-action-move" onclick="{~P~}.views[\'{~D:Context[0].Hash~}\'].moveArrayElementDown(\'{~D:Record.EscapedArrayPath~}\', {~D:Record.ArrayIndex~})" title="Move down">▼</span>',RootAddObject:'<div class="pict-oe-root-add" data-path=""><span class="pict-oe-action-btn pict-oe-action-add" onclick="{~P~}.views[\'{~D:Context[0].Hash~}\'].beginAddToObject(\'\')" title="Add property">+ add property</span></div>',RootAddArray:'<div class="pict-oe-root-add" data-path=""><span class="pict-oe-action-btn pict-oe-action-add" onclick="{~P~}.views[\'{~D:Context[0].Hash~}\'].beginAddToArray(\'\')" title="Add element">+ add element</span></div>'}},Templates:[{Hash:"ObjectEditor-Container-Template",Template:'<div class="pict-objecteditor" id="ObjectEditor-Tree-{~D:Context[0].Hash~}"></div>'},{Hash:"ObjectEditor-Node-String",Template:"{~D:Record.Macro.RowOpen~}{~D:Record.Macro.Spacer~}{~D:Record.Macro.Key~}{~D:Record.Macro.Separator~}{~D:Record.Macro.Value~}{~D:Record.Macro.Actions~}{~D:Record.Macro.RowClose~}"},{Hash:"ObjectEditor-Node-Number",Template:"{~D:Record.Macro.RowOpen~}{~D:Record.Macro.Spacer~}{~D:Record.Macro.Key~}{~D:Record.Macro.Separator~}{~D:Record.Macro.Value~}{~D:Record.Macro.Actions~}{~D:Record.Macro.RowClose~}"},{Hash:"ObjectEditor-Node-Boolean",Template:"{~D:Record.Macro.RowOpen~}{~D:Record.Macro.Spacer~}{~D:Record.Macro.Key~}{~D:Record.Macro.Separator~}{~D:Record.Macro.Value~}{~D:Record.Macro.Actions~}{~D:Record.Macro.RowClose~}"},{Hash:"ObjectEditor-Node-Null",Template:"{~D:Record.Macro.RowOpen~}{~D:Record.Macro.Spacer~}{~D:Record.Macro.Key~}{~D:Record.Macro.Separator~}{~D:Record.Macro.Value~}{~D:Record.Macro.Actions~}{~D:Record.Macro.RowClose~}"},{Hash:"ObjectEditor-Node-Object",Template:"{~D:Record.Macro.RowOpen~}{~D:Record.Macro.Toggle~}{~D:Record.Macro.Key~}{~D:Record.Macro.TypeBadge~}{~D:Record.Macro.Summary~}{~D:Record.Macro.Actions~}{~D:Record.Macro.RowClose~}"},{Hash:"ObjectEditor-Node-Array",Template:"{~D:Record.Macro.RowOpen~}{~D:Record.Macro.Toggle~}{~D:Record.Macro.Key~}{~D:Record.Macro.TypeBadge~}{~D:Record.Macro.Summary~}{~D:Record.Macro.Actions~}{~D:Record.Macro.RowClose~}"}],Renderables:[{RenderableHash:"ObjectEditor-Container",TemplateHash:"ObjectEditor-Container-Template",DestinationAddress:"#ObjectEditor-Container",RenderMethod:"replace"}]}},{}],31:[function(t,e,o){e.exports=t("./views/PictView-ObjectEditor.js"),e.exports.PictViewObjectEditorNode=t("./views/PictView-ObjectEditor-Node.js"),e.exports.PictViewObjectEditorNodeString=t("./views/PictView-ObjectEditor-NodeString.js"),e.exports.PictViewObjectEditorNodeNumber=t("./views/PictView-ObjectEditor-NodeNumber.js"),e.exports.PictViewObjectEditorNodeBoolean=t("./views/PictView-ObjectEditor-NodeBoolean.js"),e.exports.PictViewObjectEditorNodeNull=t("./views/PictView-ObjectEditor-NodeNull.js"),e.exports.PictViewObjectEditorNodeObject=t("./views/PictView-ObjectEditor-NodeObject.js"),e.exports.PictViewObjectEditorNodeArray=t("./views/PictView-ObjectEditor-NodeArray.js"),e.exports.default_configuration=t("./Pict-Section-ObjectEditor-DefaultConfiguration.js")},{"./Pict-Section-ObjectEditor-DefaultConfiguration.js":30,"./views/PictView-ObjectEditor-Node.js":32,"./views/PictView-ObjectEditor-NodeArray.js":33,"./views/PictView-ObjectEditor-NodeBoolean.js":34,"./views/PictView-ObjectEditor-NodeNull.js":35,"./views/PictView-ObjectEditor-NodeNumber.js":36,"./views/PictView-ObjectEditor-NodeObject.js":37,"./views/PictView-ObjectEditor-NodeString.js":38,"./views/PictView-ObjectEditor.js":39}],32:[function(t,e,o){const i=t("pict-view");e.exports=class extends i{constructor(t,e,o){super(t,e,o),this.serviceType="PictViewObjectEditorNode",this._ObjectEditorView=null}renderNodeHTML(t,e,o){return""}compileMacros(t,e,o){t.PaddingLeft=t.Depth*o.IndentPixels+12,t.EscapedPath=this.escapeAttribute(t.Path),t.EscapedKey=this.escapeHTML(String(t.Key)),t.ToggleArrow=t.IsExpanded?"▼":"▶";let i=t.Path.match(/^(.*)\[(\d+)\]$/);t.EscapedArrayPath=i?this.escapeAttribute(i[1]):"";let n=this._ObjectEditorView.options.MacroTemplates.Node,a=Object.keys(n);t.Macro={};for(let e=0;e<a.length;e++){let o=a[e];t.Macro[o]=this.pict.parseTemplate(n[o],t,null,[this._ObjectEditorView])}t.IsArrayElement?t.Macro.Key=t.Macro.KeyIndex:t.Macro.Key=t.Macro.KeyName,o.ShowTypeIndicators||(t.Macro.TypeBadge="")}compileActions(t,e){if(!e.Editable)return"";let o=t.Macro.ActionsOpen;return t.IsArrayElement&&(o+=t.Macro.ButtonMoveUp+t.Macro.ButtonMoveDown),o+=t.Macro.ButtonRemove,o+=t.Macro.ActionsClose,o}compileContainerActions(t,e,o){if(!e.Editable)return"";let i=t.Macro.ActionsOpen;return i+="array"===o?t.Macro.ButtonAddArray:t.Macro.ButtonAddObject,t.IsArrayElement&&(i+=t.Macro.ButtonMoveUp+t.Macro.ButtonMoveDown),i+=t.Macro.ButtonRemove,i+=t.Macro.ActionsClose,i}escapeAttribute(t){return"string"!=typeof t?"":t.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")}escapeHTML(t){return"string"!=typeof t?"":t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}}},{"pict-view":41}],33:[function(t,e,o){const i=t("./PictView-ObjectEditor-Node.js");e.exports=class extends i{constructor(t,e,o){super(t,e,o),this.serviceType="PictViewObjectEditorNodeArray"}renderNodeHTML(t,e,o){let i=Array.isArray(e)?e.length:0;t.TypeLabel="Array";let n=1===i?"item":"items";return t.SummaryText="["+i+" "+n+"]",this.compileMacros(t,e,o),t.Macro.Actions=this.compileContainerActions(t,o,"array"),this.pict.parseTemplate(this.pict.TemplateProvider.getTemplate("ObjectEditor-Node-Array"),t,null,[this._ObjectEditorView])}}},{"./PictView-ObjectEditor-Node.js":32}],34:[function(t,e,o){const i=t("./PictView-ObjectEditor-Node.js");e.exports=class extends i{constructor(t,e,o){super(t,e,o),this.serviceType="PictViewObjectEditorNodeBoolean"}renderNodeHTML(t,e,o){return t.DisplayValue=e?"true":"false",this.compileMacros(t,e,o),t.Macro.Value=o.Editable?t.Macro.ValueBooleanEditable:t.Macro.ValueBooleanReadOnly,t.Macro.Actions=this.compileActions(t,o),this.pict.parseTemplate(this.pict.TemplateProvider.getTemplate("ObjectEditor-Node-Boolean"),t,null,[this._ObjectEditorView])}}},{"./PictView-ObjectEditor-Node.js":32}],35:[function(t,e,o){const i=t("./PictView-ObjectEditor-Node.js");e.exports=class extends i{constructor(t,e,o){super(t,e,o),this.serviceType="PictViewObjectEditorNodeNull"}renderNodeHTML(t,e,o){return this.compileMacros(t,e,o),t.Macro.Value=t.Macro.ValueNull,t.Macro.Actions=this.compileActions(t,o),this.pict.parseTemplate(this.pict.TemplateProvider.getTemplate("ObjectEditor-Node-Null"),t,null,[this._ObjectEditorView])}}},{"./PictView-ObjectEditor-Node.js":32}],36:[function(t,e,o){const i=t("./PictView-ObjectEditor-Node.js");e.exports=class extends i{constructor(t,e,o){super(t,e,o),this.serviceType="PictViewObjectEditorNodeNumber"}renderNodeHTML(t,e,o){return t.EscapedValue=this.escapeHTML(String(e)),this.compileMacros(t,e,o),t.Macro.Value=o.Editable?t.Macro.ValueNumberEditable:t.Macro.ValueNumberReadOnly,t.Macro.Actions=this.compileActions(t,o),this.pict.parseTemplate(this.pict.TemplateProvider.getTemplate("ObjectEditor-Node-Number"),t,null,[this._ObjectEditorView])}}},{"./PictView-ObjectEditor-Node.js":32}],37:[function(t,e,o){const i=t("./PictView-ObjectEditor-Node.js");e.exports=class extends i{constructor(t,e,o){super(t,e,o),this.serviceType="PictViewObjectEditorNodeObject"}renderNodeHTML(t,e,o){let i=0;e&&"object"==typeof e&&!Array.isArray(e)&&(i=Object.keys(e).length),t.TypeLabel="Object";let n=1===i?"key":"keys";return t.SummaryText="{"+i+" "+n+"}",this.compileMacros(t,e,o),t.Macro.Actions=this.compileContainerActions(t,o,"object"),this.pict.parseTemplate(this.pict.TemplateProvider.getTemplate("ObjectEditor-Node-Object"),t,null,[this._ObjectEditorView])}}},{"./PictView-ObjectEditor-Node.js":32}],38:[function(t,e,o){const i=t("./PictView-ObjectEditor-Node.js");e.exports=class extends i{constructor(t,e,o){super(t,e,o),this.serviceType="PictViewObjectEditorNodeString"}renderNodeHTML(t,e,o){let i="string"==typeof e?e:"",n=i.length>120?i.substring(0,120)+"…":i;return t.EscapedValue=this.escapeHTML(n),t.EscapedTitle=this.escapeAttribute(i),this.compileMacros(t,e,o),t.Macro.Value=o.Editable?t.Macro.ValueStringEditable:t.Macro.ValueStringReadOnly,t.Macro.Actions=this.compileActions(t,o),this.pict.parseTemplate(this.pict.TemplateProvider.getTemplate("ObjectEditor-Node-String"),t,null,[this._ObjectEditorView])}}},{"./PictView-ObjectEditor-Node.js":32}],39:[function(t,e,o){const i=t("pict-view"),n=t("./PictView-ObjectEditor-NodeString.js"),a=t("./PictView-ObjectEditor-NodeNumber.js"),r=t("./PictView-ObjectEditor-NodeBoolean.js"),s=t("./PictView-ObjectEditor-NodeNull.js"),l=t("./PictView-ObjectEditor-NodeObject.js"),c=t("./PictView-ObjectEditor-NodeArray.js"),d=t("../Pict-Section-ObjectEditor-DefaultConfiguration.js");e.exports=class extends i{constructor(t,e,o){super(t,Object.assign({},d,e),o),this.initialRenderComplete=!1,this._ExpandedPaths=new Set,this._NodeRenderers={}}onBeforeInitialize(){super.onBeforeInitialize();let t={PictViewObjectEditorNodeString:n,PictViewObjectEditorNodeNumber:a,PictViewObjectEditorNodeBoolean:r,PictViewObjectEditorNodeNull:s,PictViewObjectEditorNodeObject:l,PictViewObjectEditorNodeArray:c},e=Object.keys(t);for(let o=0;o<e.length;o++){let i=e[o];this.fable.servicesMap.hasOwnProperty(i)||this.fable.addServiceType(i,t[i])}this._NodeRenderers.string=this.fable.instantiateServiceProviderWithoutRegistration("PictViewObjectEditorNodeString"),this._NodeRenderers.number=this.fable.instantiateServiceProviderWithoutRegistration("PictViewObjectEditorNodeNumber"),this._NodeRenderers.boolean=this.fable.instantiateServiceProviderWithoutRegistration("PictViewObjectEditorNodeBoolean"),this._NodeRenderers.null=this.fable.instantiateServiceProviderWithoutRegistration("PictViewObjectEditorNodeNull"),this._NodeRenderers.object=this.fable.instantiateServiceProviderWithoutRegistration("PictViewObjectEditorNodeObject"),this._NodeRenderers.array=this.fable.instantiateServiceProviderWithoutRegistration("PictViewObjectEditorNodeArray");let o=Object.keys(this._NodeRenderers);for(let t=0;t<o.length;t++)this._NodeRenderers[o[t]]._ObjectEditorView=this;return super.onBeforeInitialize()}onAfterRender(){super.onAfterRender(),this.pict.CSSMap.injectCSS(),this.initialRenderComplete||(this.initialRenderComplete=!0,this.onAfterInitialRender()),this.renderTree()}onAfterInitialRender(){let t=this._resolveObjectData();null!==t&&"object"==typeof t&&this._expandToDepth(t,"",0,this.options.InitialExpandDepth)}toggleNode(t){this._ExpandedPaths.has(t)?this._ExpandedPaths.delete(t):this._ExpandedPaths.add(t),this.renderTree()}toggleBoolean(t){let e=this._resolveObjectData();if(null===e)return;let o=this._getValueAtPath(e,t);this._setValueAtPath(e,t,!o),this.renderTree()}beginEdit(t,e){let o=this._resolveObjectData();if(null===o)return;let i=this._getValueAtPath(o,t),n=this._getTreeElement().querySelector(`[data-path="${t}"]`);if(!n)return;let a=n.querySelector(".pict-oe-value");if(!a)return;let r="number"===e?"number":"text",s=null==i?"":String(i),l=(s.replace(/"/g,"""),document.createElement("input"));l.type=r,l.className="pict-oe-value-input",l.value=s;let c=this,d=function(){let i=l.value;"number"===e&&(i=Number(i),isNaN(i)&&(i=0)),c._setValueAtPath(o,t,i),c.renderTree()};l.addEventListener("blur",d),l.addEventListener("keydown",function(t){"Enter"===t.key?l.blur():"Escape"===t.key&&(l.removeEventListener("blur",d),c.renderTree())}),a.innerHTML="",a.appendChild(l),l.focus(),l.select()}setValueAtPath(t,e){let o=this._resolveObjectData();null!==o&&(this._setValueAtPath(o,t,e),this.renderTree())}expandToDepth(t){this._ExpandedPaths.clear();let e=this._resolveObjectData();null!==e&&"object"==typeof e&&this._expandToDepth(e,"",0,t),this.renderTree()}expandAll(){let t=this._resolveObjectData();null!==t&&"object"==typeof t&&this._expandToDepth(t,"",0,1/0),this.renderTree()}collapseAll(){this._ExpandedPaths.clear(),this.renderTree()}addObjectProperty(t,e,o){let i=this._resolveObjectData();if(null===i)return;let n=t?this._getValueAtPath(i,t):i;if(null==n||"object"!=typeof n||Array.isArray(n))return;let a=void 0!==o?o:"";n[e]=a,t&&this._ExpandedPaths.add(t),this.renderTree()}removeObjectProperty(t,e){let o=this._resolveObjectData();if(null===o)return;let i=t?this._getValueAtPath(o,t):o;if(null==i||"object"!=typeof i||Array.isArray(i))return;let n=t?t+"."+e:e;this._cleanupExpandedPaths(n),delete i[e],this.renderTree()}addArrayElement(t,e){let o=this._resolveObjectData();if(null===o)return;let i=t?this._getValueAtPath(o,t):o;if(!Array.isArray(i))return;let n=void 0!==e?e:"";i.push(n),t&&this._ExpandedPaths.add(t),this.renderTree()}removeArrayElement(t,e){let o=this._resolveObjectData();if(null===o)return;let i=t?this._getValueAtPath(o,t):o;if(!Array.isArray(i))return;let n=parseInt(e,10);if(isNaN(n)||n<0||n>=i.length)return;let a=t?t+"["+n+"]":"["+n+"]";this._cleanupExpandedPaths(a),this._shiftArrayExpandedPaths(t,n,i.length),i.splice(n,1),this.renderTree()}removeNode(t){if(!t)return;if(null===this._resolveObjectData())return;let e=t.match(/^(.*)\[(\d+)\]$/);if(e){let t=e[1],o=parseInt(e[2],10);this.removeArrayElement(t,o)}else{let e=t.lastIndexOf(".");if(-1===e){let e=t;this.removeObjectProperty("",e)}else{let o=t.substring(0,e),i=t.substring(e+1);this.removeObjectProperty(o,i)}}}moveArrayElementUp(t,e){let o=parseInt(e,10);isNaN(o)||o<=0||this.moveArrayElementToIndex(t,o,o-1)}moveArrayElementDown(t,e){let o=this._resolveObjectData();if(null===o)return;let i=t?this._getValueAtPath(o,t):o;if(!Array.isArray(i))return;let n=parseInt(e,10);isNaN(n)||n<0||n>=i.length-1||this.moveArrayElementToIndex(t,n,n+1)}moveArrayElementToIndex(t,e,o){let i=this._resolveObjectData();if(null===i)return;let n=t?this._getValueAtPath(i,t):i;if(!Array.isArray(n))return;let a=parseInt(e,10);if(isNaN(a)||a<0||a>=n.length)return;let r=parseInt(o,10);if(isNaN(r))return;if(r<0&&(r=0),r>=n.length&&(r=n.length-1),a===r)return;this._moveArrayExpandedPaths(t,a,r,n.length);let s=n.splice(a,1)[0];n.splice(r,0,s),this.renderTree()}beginAddToObject(t){if(null===this._resolveObjectData())return;let e=this._getTreeElement();if(!e)return;let o=e.querySelector(`[data-path="${t}"]`);if(!o)return;let i=document.createElement("input");i.type="text",i.className="pict-oe-key-input",i.placeholder="key";let n=this._createTypeSelect(),a=this,r=!1,s=function(){if(r)return;r=!0;let e=i.value.trim();if(e){let o=a._getDefaultValueForType(n.value);a.addObjectProperty(t,e,o)}else a.renderTree()};i.addEventListener("keydown",function(t){"Enter"===t.key?s():"Escape"===t.key&&(r=!0,a.renderTree())}),n.addEventListener("keydown",function(t){"Enter"===t.key?s():"Escape"===t.key&&(r=!0,a.renderTree())});let l=null,c=function(){clearTimeout(l),l=setTimeout(function(){document.activeElement!==i&&document.activeElement!==n&&s()},150)};i.addEventListener("blur",c),n.addEventListener("blur",c);let d=o.querySelector(".pict-oe-actions");d?(o.insertBefore(i,d),o.insertBefore(n,d)):(o.appendChild(i),o.appendChild(n)),i.focus()}beginAddToArray(t){if(null===this._resolveObjectData())return;let e=this._getTreeElement();if(!e)return;let o=e.querySelector(`[data-path="${t}"]`);if(!o)return;let i=this._createTypeSelect(),n=this,a=!1,r=function(){if(a)return;a=!0;let e=n._getDefaultValueForType(i.value);n.addArrayElement(t,e)};i.addEventListener("keydown",function(t){"Enter"===t.key?r():"Escape"===t.key&&(a=!0,n.renderTree())}),i.addEventListener("blur",function(){setTimeout(function(){r()},100)});let s=o.querySelector(".pict-oe-actions");s?o.insertBefore(i,s):o.appendChild(i),i.focus()}_createTypeSelect(){let t=document.createElement("select");t.className="pict-oe-type-select";let e=["String","Number","Boolean","Null","Object","Array"];for(let o=0;o<e.length;o++){let i=document.createElement("option");i.value=e[o],i.textContent=e[o],t.appendChild(i)}return t}_getDefaultValueForType(t){switch(t){case"Number":return 0;case"Boolean":return!1;case"Null":return null;case"Object":return{};case"Array":return[];default:return""}}marshalToView(){return this.renderTree(),super.marshalToView()}renderTree(){let t=this._resolveObjectData(),e=this._getTreeElement();if(!e)return;if(null==t)return void this.pict.ContentAssignment.assignContent(e,'<div class="pict-oe-empty">No data</div>');let o={Editable:this.options.Editable,ShowTypeIndicators:this.options.ShowTypeIndicators,IndentPixels:this.options.IndentPixels,ViewHash:this.Hash},i="";if("object"!=typeof t||Array.isArray(t))if(Array.isArray(t))i=this._walkArray(t,"",0,o,!0),o.Editable&&(i+=this.pict.parseTemplate(this.options.MacroTemplates.Node.RootAddArray,{},null,[this]));else{let e={Path:"",Key:"(root)",Depth:0,DataType:this._getJsonType(t),HasChildren:!1,ChildCount:0,IsExpanded:!1,IsArrayElement:!1,ArrayIndex:-1},n=this._NodeRenderers[e.DataType];n&&(i=n.renderNodeHTML(e,t,o))}else i=this._walkObject(t,"",0,o,!0),o.Editable&&(i+=this.pict.parseTemplate(this.options.MacroTemplates.Node.RootAddObject,{},null,[this]));i||(i='<div class="pict-oe-empty">Empty object</div>'),this.pict.ContentAssignment.assignContent(e,i)}_walkObject(t,e,o,i,n){let a="",r=Object.keys(t);for(let n=0;n<r.length;n++){let s=r[n],l=e?e+"."+s:s,c=t[s],d=this._getJsonType(c),p={Path:l,Key:s,Depth:o,DataType:d,HasChildren:!1,ChildCount:0,IsExpanded:!1,IsArrayElement:!1,ArrayIndex:-1};if("object"===d){let t=null!==c?Object.keys(c):[];p.HasChildren=t.length>0,p.ChildCount=t.length,p.IsExpanded=this._ExpandedPaths.has(l),a+=this._NodeRenderers.object.renderNodeHTML(p,c,i),p.IsExpanded&&(a+=this._walkObject(c,l,o+1,i,!1))}else if("array"===d){p.HasChildren=c.length>0,p.ChildCount=c.length,p.IsExpanded=this._ExpandedPaths.has(l),a+=this._NodeRenderers.array.renderNodeHTML(p,c,i),p.IsExpanded&&(a+=this._walkArray(c,l,o+1,i,!1))}else{let t=this._NodeRenderers[d];t&&(a+=t.renderNodeHTML(p,c,i))}}return a}_walkArray(t,e,o,i,n){let a="";for(let n=0;n<t.length;n++){let r=e?e+"["+n+"]":"["+n+"]",s=t[n],l=this._getJsonType(s),c={Path:r,Key:String(n),Depth:o,DataType:l,HasChildren:!1,ChildCount:0,IsExpanded:!1,IsArrayElement:!0,ArrayIndex:n};if("object"===l){let t=null!==s?Object.keys(s):[];c.HasChildren=t.length>0,c.ChildCount=t.length,c.IsExpanded=this._ExpandedPaths.has(r),a+=this._NodeRenderers.object.renderNodeHTML(c,s,i),c.IsExpanded&&(a+=this._walkObject(s,r,o+1,i,!1))}else if("array"===l){c.HasChildren=s.length>0,c.ChildCount=s.length,c.IsExpanded=this._ExpandedPaths.has(r),a+=this._NodeRenderers.array.renderNodeHTML(c,s,i),c.IsExpanded&&(a+=this._walkArray(s,r,o+1,i,!1))}else{let t=this._NodeRenderers[l];t&&(a+=t.renderNodeHTML(c,s,i))}}return a}_getJsonType(t){if(null==t)return"null";if(Array.isArray(t))return"array";let e=typeof t;return"object"===e?"object":"number"===e?"number":"boolean"===e?"boolean":"string"}_resolveObjectData(){if(!this.options.ObjectDataAddress)return null;let t=this.options.ObjectDataAddress.split("."),e=this.fable;for(let o=0;o<t.length;o++){if(null==e)return null;e=e[t[o]]}return e}_getTreeElement(){let t="ObjectEditor-Tree-"+this.Hash,e=this.pict.ContentAssignment.getElement("#"+t);return e&&e.length>0?e[0]:null}_getValueAtPath(t,e){if(!e)return t;let o=this._parsePath(e),i=t;for(let t=0;t<o.length;t++){if(null==i)return;i=i[o[t]]}return i}_setValueAtPath(t,e,o){if(!e)return;let i=this._parsePath(e),n=t;for(let t=0;t<i.length-1;t++){if(null==n)return;n=n[i[t]]}null!=n&&(n[i[i.length-1]]=o)}_parsePath(t){let e=[],o=t.split(".");for(let t=0;t<o.length;t++){let i=o[t],n=i.match(/^([^\[]*)\[(\d+)\]$/);n?(n[1]&&e.push(n[1]),e.push(parseInt(n[2],10))):i&&e.push(i)}return e}_cleanupExpandedPaths(t){let e=[];this._ExpandedPaths.forEach(function(o){o!==t&&0!==o.indexOf(t+".")&&0!==o.indexOf(t+"[")||e.push(o)});for(let t=0;t<e.length;t++)this._ExpandedPaths.delete(e[t])}_shiftArrayExpandedPaths(t,e,o){let i=t||"";for(let t=e+1;t<o;t++){let e=i+"["+t+"]",o=i+"["+(t-1)+"]",n=[];this._ExpandedPaths.forEach(function(t){t===e?n.push({old:t,replacement:o}):(0===t.indexOf(e+".")||0===t.indexOf(e+"["))&&n.push({old:t,replacement:o+t.substring(e.length)})});for(let t=0;t<n.length;t++)this._ExpandedPaths.delete(n[t].old),this._ExpandedPaths.add(n[t].replacement)}}_moveArrayExpandedPaths(t,e,o,i){let n=t||"",a=Math.min(e,o),r=Math.max(e,o),s={};for(let t=a;t<=r;t++)s[t]=[];let l=[];this._ExpandedPaths.forEach(function(t){for(let e=a;e<=r;e++){let o=n+"["+e+"]";t===o?(s[e].push(""),l.push(t)):(0===t.indexOf(o+".")||0===t.indexOf(o+"["))&&(s[e].push(t.substring(o.length)),l.push(t))}});for(let t=0;t<l.length;t++)this._ExpandedPaths.delete(l[t]);let c={};if(e<o){c[e]=o;for(let t=e+1;t<=o;t++)c[t]=t-1}else{c[e]=o;for(let t=o;t<e;t++)c[t]=t+1}let d=Object.keys(s);for(let t=0;t<d.length;t++){let e=parseInt(d[t],10),o=c[e],i=s[e];for(let t=0;t<i.length;t++)this._ExpandedPaths.add(n+"["+o+"]"+i[t])}}_expandToDepth(t,e,o,i){if(null!=t&&"object"==typeof t)if(Array.isArray(t))for(let n=0;n<t.length;n++){let a=e?e+"["+n+"]":"["+n+"]";"object"==typeof t[n]&&null!==t[n]&&(this._ExpandedPaths.add(a),o+1<i&&this._expandToDepth(t[n],a,o+1,i))}else{let n=Object.keys(t);for(let a=0;a<n.length;a++){let r=n[a],s=e?e+"."+r:r,l=t[r];"object"==typeof l&&null!==l&&(this._ExpandedPaths.add(s),o+1<i&&this._expandToDepth(l,s,o+1,i))}}}},e.exports.default_configuration=d},{"../Pict-Section-ObjectEditor-DefaultConfiguration.js":30,"./PictView-ObjectEditor-NodeArray.js":33,"./PictView-ObjectEditor-NodeBoolean.js":34,"./PictView-ObjectEditor-NodeNull.js":35,"./PictView-ObjectEditor-NodeNumber.js":36,"./PictView-ObjectEditor-NodeObject.js":37,"./PictView-ObjectEditor-NodeString.js":38,"pict-view":41}],40:[function(t,e,o){e.exports={name:"pict-view",version:"1.0.67",description:"Pict View Base Class",main:"source/Pict-View.js",scripts:{test:"npx quack test",tests:"npx quack test -g",start:"node source/Pict-View.js",coverage:"npx quack coverage",build:"npx quack build","docker-dev-build":"docker build ./ -f Dockerfile_LUXURYCode -t pict-view-image:local","docker-dev-run":'docker run -it -d --name pict-view-dev -p 30001:8080 -p 38086:8086 -v "$PWD/.config:/home/coder/.config" -v "$PWD:/home/coder/pict-view" -u "$(id -u):$(id -g)" -e "DOCKER_USER=$USER" pict-view-image:local',"docker-dev-shell":"docker exec -it pict-view-dev /bin/bash",types:"tsc -p .",lint:"eslint source/**"},types:"types/source/Pict-View.d.ts",repository:{type:"git",url:"git+https://github.com/stevenvelozo/pict-view.git"},author:"steven velozo <steven@velozo.com>",license:"MIT",bugs:{url:"https://github.com/stevenvelozo/pict-view/issues"},homepage:"https://github.com/stevenvelozo/pict-view#readme",devDependencies:{"@eslint/js":"^9.39.1","browser-env":"^3.3.0",eslint:"^9.39.1",pict:"^1.0.348",quackage:"^1.0.58",typescript:"^5.9.3"},mocha:{diff:!0,extension:["js"],package:"./package.json",reporter:"spec",slow:"75",timeout:"5000",ui:"tdd","watch-files":["source/**/*.js","test/**/*.js"],"watch-ignore":["lib/vendor"]},dependencies:{fable:"^3.1.63","fable-serviceproviderbase":"^3.0.19"}}},{}],41:[function(t,e,o){const i=t("fable-serviceproviderbase"),n=t("../package.json"),a={DefaultRenderable:!1,DefaultDestinationAddress:!1,DefaultTemplateRecordAddress:!1,ViewIdentifier:!1,AutoInitialize:!0,AutoInitializeOrdinal:0,AutoRender:!0,AutoRenderOrdinal:0,AutoSolveWithApp:!0,AutoSolveOrdinal:0,CSSHash:!1,CSS:!1,CSSProvider:!1,CSSPriority:500,Templates:[],DefaultTemplates:[],Renderables:[],Manifests:{}};e.exports=class extends i{constructor(t,e,o){super(t,Object.assign({},JSON.parse(JSON.stringify(a)),e),o),this.fable,this.options,this.UUID,this.Hash,this.log;const i=this.Hash===this.UUID;this.UUID=`V-${this.UUID}`,i&&(this.Hash=this.UUID),this.options.ViewIdentifier||(this.options.ViewIdentifier=`AutoViewID-${this.fable.getUUID()}`),this.serviceType="PictView",this._Package=n,this.pict=this.fable,this.AppData=this.pict.AppData,this.Bundle=this.pict.Bundle,this.initializeTimestamp=!1,this.lastSolvedTimestamp=!1,this.lastRenderedTimestamp=!1,this.lastMarshalFromViewTimestamp=!1,this.lastMarshalToViewTimestamp=!1,this.pict.instantiateServiceProviderIfNotExists("TransactionTracking");for(let t=0;t<this.options.Templates.length;t++){let e=this.options.Templates[t];"Hash"in e&&"Template"in e?(e.Source||(e.Source=`PictView [${this.UUID}]::[${this.Hash}] ${this.options.ViewIdentifier} options object.`),this.pict.TemplateProvider.addTemplate(e.Hash,e.Template,e.Source)):this.log.error(`PictView [${this.UUID}]::[${this.Hash}] ${this.options.ViewIdentifier} could not load Template ${t} in the options array.`,e)}for(let t=0;t<this.options.DefaultTemplates.length;t++){let e=this.options.DefaultTemplates[t];"Postfix"in e&&"Template"in e?(e.Source||(e.Source=`PictView [${this.UUID}]::[${this.Hash}] ${this.options.ViewIdentifier} options object.`),this.pict.TemplateProvider.addDefaultTemplate(e.Prefix,e.Postfix,e.Template,e.Source)):this.log.error(`PictView [${this.UUID}]::[${this.Hash}] ${this.options.ViewIdentifier} could not load Default Template ${t} in the options array.`,e)}if(this.options.CSS){let t=this.options.CSSHash?this.options.CSSHash:`View-${this.options.ViewIdentifier}`,e=this.options.CSSProvider?this.options.CSSProvider:t;this.pict.CSSMap.addCSS(t,this.options.CSS,e,this.options.CSSPriority)}this.renderables={};for(let t=0;t<this.options.Renderables.length;t++){let e=this.options.Renderables[t];this.addRenderable(e)}}addRenderable(t,e,o,i,n){let a;if("object"==typeof t)a=t;else{a={RenderableHash:t,TemplateHash:e,DefaultTemplateRecordAddress:o,ContentDestinationAddress:i,RenderMethod:"string"!=typeof n?n:"replace"}}"string"!=typeof a.RenderableHash||"string"!=typeof a.TemplateHash?this.log.error(`PictView [${this.UUID}]::[${this.Hash}] ${this.options.ViewIdentifier} could not load Renderable; RenderableHash or TemplateHash are invalid.`,a):(this.pict.LogNoisiness>0&&this.log.trace(`PictView [${this.UUID}]::[${this.Hash}] ${this.options.ViewIdentifier} adding renderable [${a.RenderableHash}] pointed to template ${a.TemplateHash}.`),this.renderables[a.RenderableHash]=a)}onBeforeInitialize(){return this.pict.LogNoisiness>3&&this.log.trace(`PictView [${this.UUID}]::[${this.Hash}] ${this.options.ViewIdentifier} onBeforeInitialize:`),!0}onBeforeInitializeAsync(t){return this.onBeforeInitialize(),t()}onInitialize(){return this.pict.LogNoisiness>3&&this.log.trace(`PictView [${this.UUID}]::[${this.Hash}] ${this.options.ViewIdentifier} onInitialize:`),!0}onInitializeAsync(t){return this.onInitialize(),t()}initialize(){return this.pict.LogControlFlow&&this.log.trace(`PICT-ControlFlow VIEW [${this.UUID}]::[${this.Hash}] ${this.options.ViewIdentifier} initialize:`),this.initializeTimestamp?(this.log.warn(`PictView [${this.UUID}]::[${this.Hash}] ${this.options.ViewIdentifier} initialize called but initialization is already completed. Aborting.`),!1):(this.onBeforeInitialize(),this.onInitialize(),this.onAfterInitialize(),this.initializeTimestamp=this.pict.log.getTimeStamp(),!0)}initializeAsync(t){if(this.pict.LogControlFlow&&this.log.trace(`PICT-ControlFlow VIEW [${this.UUID}]::[${this.Hash}] ${this.options.ViewIdentifier} initializeAsync:`),this.initializeTimestamp)return this.log.warn(`PictView [${this.UUID}]::[${this.Hash}] ${this.options.ViewIdentifier} async initialize called but initialization is already completed. Aborting.`),t();{let e=this.pict.instantiateServiceProviderWithoutRegistration("Anticipate");this.pict.LogNoisiness>0&&this.log.info(`PictView [${this.UUID}]::[${this.Hash}] ${this.options.ViewIdentifier} beginning initialization...`),e.anticipate(this.onBeforeInitializeAsync.bind(this)),e.anticipate(this.onInitializeAsync.bind(this)),e.anticipate(this.onAfterInitializeAsync.bind(this)),e.wait(e=>(e&&this.log.error(`PictView [${this.UUID}]::[${this.Hash}] ${this.options.ViewIdentifier} initialization failed: ${e.message||e}`,{stack:e.stack}),this.initializeTimestamp=this.pict.log.getTimeStamp(),this.pict.LogNoisiness>0&&this.log.info(`PictView [${this.UUID}]::[${this.Hash}] ${this.options.ViewIdentifier} initialization complete.`),t()))}}onAfterInitialize(){return this.pict.LogNoisiness>3&&this.log.trace(`PictView [${this.UUID}]::[${this.Hash}] ${this.options.ViewIdentifier} onAfterInitialize:`),!0}onAfterInitializeAsync(t){return this.onAfterInitialize(),t()}onBeforeRender(t){return this.pict.LogNoisiness>3&&this.log.trace(`PictView [${this.UUID}]::[${this.Hash}] ${this.options.ViewIdentifier} onBeforeRender:`),!0}onBeforeRenderAsync(t,e){return this.onBeforeRender(e),t()}onBeforeProject(t){return this.pict.LogNoisiness>3&&this.log.trace(`PictView [${this.UUID}]::[${this.Hash}] ${this.options.ViewIdentifier} onBeforeProject:`),!0}onBeforeProjectAsync(t,e){return this.onBeforeProject(e),t()}buildRenderOptions(t,e,o){let i={Valid:!0};return i.RenderableHash="string"==typeof t?t:"string"==typeof this.options.DefaultRenderable&&this.options.DefaultRenderable,i.RenderableHash||(this.log.error(`PictView [${this.UUID}]::[${this.Hash}] ${this.options.ViewIdentifier} could not find a suitable RenderableHash ${i.RenderableHash} (param ${t}because it is not a valid renderable.`),i.Valid=!1),i.Renderable=this.renderables[i.RenderableHash],i.Renderable||(this.log.error(`PictView [${this.UUID}]::[${this.Hash}] ${this.options.ViewIdentifier} could not render ${i.RenderableHash} (param ${t}) because it does not exist.`),i.Valid=!1),i.DestinationAddress="string"==typeof e?e:"string"==typeof i.Renderable.ContentDestinationAddress?i.Renderable.ContentDestinationAddress:"string"==typeof this.options.DefaultDestinationAddress&&this.options.DefaultDestinationAddress,i.DestinationAddress||(this.log.error(`PictView [${this.UUID}]::[${this.Hash}] ${this.options.ViewIdentifier} could not render ${i.RenderableHash} (param ${t}) because it does not have a valid destination address (param ${e}).`),i.Valid=!1),"object"==typeof o?(i.RecordAddress="Passed in as object",i.Record=o):(i.RecordAddress="string"==typeof o?o:"string"==typeof i.Renderable.DefaultTemplateRecordAddress?i.Renderable.DefaultTemplateRecordAddress:"string"==typeof this.options.DefaultTemplateRecordAddress&&this.options.DefaultTemplateRecordAddress,i.Record="string"==typeof i.RecordAddress?this.pict.DataProvider.getDataByAddress(i.RecordAddress):void 0),i}assignRenderContent(t,e,o){return this.pict.ContentAssignment.projectContent(t.RenderMethod,e,o,t.TestAddress)}render(t,e,o,i){return this.renderWithScope(this,t,e,o,i)}renderWithScope(t,e,o,i,n){let a,r,s,l="string"==typeof e?e:"string"==typeof this.options.DefaultRenderable&&this.options.DefaultRenderable;return l?("__Virtual"==l?a={RenderableHash:"__Virtual",TemplateHash:this.renderables[this.options.DefaultRenderable].TemplateHash,ContentDestinationAddress:"string"==typeof o?o:"string"==typeof a.ContentDestinationAddress?a.ContentDestinationAddress:"string"==typeof this.options.DefaultDestinationAddress?this.options.DefaultDestinationAddress:null,RenderMethod:"virtual-assignment",TransactionHash:n&&n.TransactionHash,RootRenderableViewHash:n&&n.RootRenderableViewHash}:(a=Object.assign({},this.renderables[l]),a.ContentDestinationAddress="string"==typeof o?o:"string"==typeof a.ContentDestinationAddress?a.ContentDestinationAddress:"string"==typeof this.options.DefaultDestinationAddress?this.options.DefaultDestinationAddress:null),a.TransactionHash||(a.TransactionHash=`ViewRender-V-${this.options.ViewIdentifier}-R-${l}-U-${this.pict.getUUID()}`,a.RootRenderableViewHash=this.Hash,this.pict.TransactionTracking.registerTransaction(a.TransactionHash)),a?a.ContentDestinationAddress?("object"==typeof i?(s=i,r="Passed in as object"):(r="string"==typeof i?i:"string"==typeof a.DefaultTemplateRecordAddress?a.DefaultTemplateRecordAddress:"string"==typeof this.options.DefaultTemplateRecordAddress&&this.options.DefaultTemplateRecordAddress,s="string"==typeof r?this.pict.DataProvider.getDataByAddress(r):void 0),this.onBeforeRender(a),this.pict.LogControlFlow&&this.log.trace(`PICT-ControlFlow VIEW [${this.UUID}]::[${this.Hash}] Renderable[${l}] Destination[${a.ContentDestinationAddress}] TemplateRecordAddress[${r}] render:`),this.pict.LogNoisiness>0&&this.log.trace(`PictView [${this.UUID}]::[${this.Hash}] ${this.options.ViewIdentifier} Beginning Render of Renderable[${l}] to Destination [${a.ContentDestinationAddress}]...`),a.Content=this.pict.parseTemplateByHash(a.TemplateHash,s,null,[this],t,{RootRenderable:"object"==typeof n?n:a}),this.pict.LogNoisiness>0&&this.log.trace(`PictView [${this.UUID}]::[${this.Hash}] ${this.options.ViewIdentifier} Assigning Renderable[${l}] content length ${a.Content.length} to Destination [${a.ContentDestinationAddress}] using render method [${a.RenderMethod}].`),this.onBeforeProject(a),this.onProject(a),"virtual-assignment"!==a.RenderMethod&&(this.onAfterProject(a),this.onAfterRender(a)),!0):(this.log.error(`PictView [${this.UUID}]::[${this.Hash}] ${this.options.ViewIdentifier} could not render ${l} (param ${e}) because it does not have a valid destination address.`),!1):(this.log.error(`PictView [${this.UUID}]::[${this.Hash}] ${this.options.ViewIdentifier} could not render ${l} (param ${e}) because it does not exist.`),!1)):(this.log.error(`PictView [${this.UUID}]::[${this.Hash}] ${this.options.ViewIdentifier} could not render ${l} (param ${e}) because it is not a valid renderable.`),!1)}renderAsync(t,e,o,i,n){return this.renderWithScopeAsync(this,t,e,o,i,n)}renderWithScopeAsync(t,e,o,i,n,a){let r,s,l,c="string"==typeof e?e:"string"==typeof this.options.DefaultRenderable&&this.options.DefaultRenderable,d="function"==typeof a?a:"function"==typeof i?i:"function"==typeof o?o:"function"==typeof e?e:"function"==typeof n?n:null;if(d||(this.log.warn(`PictView [${this.UUID}]::[${this.Hash}] ${this.options.Name} renderAsync was called without a valid callback. A callback will be generated but this could lead to race conditions.`),d=t=>{t&&this.log.error(`PictView [${this.UUID}]::[${this.Hash}] ${this.options.Name} renderAsync Auto Callback Error: ${t}`,t)}),!c)return this.log.error(`PictView [${this.UUID}]::[${this.Hash}] ${this.options.ViewIdentifier} could not asynchronously render ${c} (param ${e}because it is not a valid renderable.`),d(new Error(`PictView [${this.UUID}]::[${this.Hash}] ${this.options.ViewIdentifier} could not asynchronously render ${c} (param ${e}because it is not a valid renderable.`));if("__Virtual"==c?r={RenderableHash:"__Virtual",TemplateHash:this.renderables[this.options.DefaultRenderable].TemplateHash,ContentDestinationAddress:"string"==typeof o?o:"string"==typeof this.options.DefaultDestinationAddress?this.options.DefaultDestinationAddress:null,RenderMethod:"virtual-assignment",TransactionHash:n&&"function"!=typeof n&&n.TransactionHash,RootRenderableViewHash:n&&"function"!=typeof n&&n.RootRenderableViewHash}:(r=Object.assign({},this.renderables[c]),r.ContentDestinationAddress="string"==typeof o?o:"string"==typeof r.ContentDestinationAddress?r.ContentDestinationAddress:"string"==typeof this.options.DefaultDestinationAddress?this.options.DefaultDestinationAddress:null),r.TransactionHash||(r.TransactionHash=`ViewRender-V-${this.options.ViewIdentifier}-R-${c}-U-${this.pict.getUUID()}`,r.RootRenderableViewHash=this.Hash,this.pict.TransactionTracking.registerTransaction(r.TransactionHash)),!r)return this.log.error(`PictView [${this.UUID}]::[${this.Hash}] ${this.options.ViewIdentifier} could not render ${c} (param ${e}) because it does not exist.`),d(new Error(`PictView [${this.UUID}]::[${this.Hash}] ${this.options.ViewIdentifier} could not render ${c} (param ${e}) because it does not exist.`));if(!r.ContentDestinationAddress)return this.log.error(`PictView [${this.UUID}]::[${this.Hash}] ${this.options.ViewIdentifier} could not render ${c} (param ${e}) because it does not have a valid destination address.`),d(new Error(`Could not render ${c}`));"object"==typeof i?(l=i,s="Passed in as object"):(s="string"==typeof i?i:"string"==typeof r.DefaultTemplateRecordAddress?r.DefaultTemplateRecordAddress:"string"==typeof this.options.DefaultTemplateRecordAddress&&this.options.DefaultTemplateRecordAddress,l="string"==typeof s?this.pict.DataProvider.getDataByAddress(s):void 0),this.pict.LogControlFlow&&this.log.trace(`PICT-ControlFlow VIEW [${this.UUID}]::[${this.Hash}] Renderable[${c}] Destination[${r.ContentDestinationAddress}] TemplateRecordAddress[${s}] renderAsync:`),this.pict.LogNoisiness>2&&this.log.trace(`PictView [${this.UUID}]::[${this.Hash}] ${this.options.ViewIdentifier} Beginning Asynchronous Render (callback-style)...`);let p=this.fable.newAnticipate();p.anticipate(t=>{this.onBeforeRenderAsync(t,r)}),p.anticipate(o=>{this.pict.parseTemplateByHash(r.TemplateHash,l,(t,i)=>t?(this.log.error(`PictView [${this.UUID}]::[${this.Hash}] ${this.options.ViewIdentifier} could not render (asynchronously) ${c} (param ${e}) because it did not parse the template.`,t),o(t)):(r.Content=i,o()),[this],t,{RootRenderable:"object"==typeof n?n:r})}),p.anticipate(t=>{this.onBeforeProjectAsync(t,r)}),p.anticipate(t=>{this.onProjectAsync(t,r)}),"virtual-assignment"!==r.RenderMethod&&(p.anticipate(t=>{this.onAfterProjectAsync(t,r)}),p.anticipate(t=>{this.onAfterRenderAsync(t,r)})),p.wait(d)}renderDefaultAsync(t){this.renderAsync(t)}basicRender(t,e,o){return this.basicRenderWithScope(this,t,e,o)}basicRenderWithScope(t,e,o,i){let n=this.buildRenderOptions(e,o,i);return n.Valid?(this.assignRenderContent(n.Renderable,n.DestinationAddress,this.pict.parseTemplateByHash(n.Renderable.TemplateHash,n.Record,null,[this],t,{RootRenderable:n.Renderable})),!0):(this.log.error(`PictView [${this.UUID}]::[${this.Hash}] ${this.options.ViewIdentifier} could not perform a basic render of ${n.RenderableHash} because it is not valid.`),!1)}basicRenderAsync(t,e,o,i){return this.basicRenderWithScopeAsync(this,t,e,o,i)}basicRenderWithScopeAsync(t,e,o,i,n){let a="function"==typeof n?n:"function"==typeof i?i:"function"==typeof o?o:"function"==typeof e?e:null;a||(this.log.warn(`PictView [${this.UUID}]::[${this.Hash}] ${this.options.Name} basicRenderAsync was called without a valid callback. A callback will be generated but this could lead to race conditions.`),a=t=>{t&&this.log.error(`PictView [${this.UUID}]::[${this.Hash}] ${this.options.Name} basicRenderAsync Auto Callback Error: ${t}`,t)});const r=this.buildRenderOptions(e,o,i);if(!r.Valid){let t=`PictView [${this.UUID}]::[${this.Hash}] ${this.options.ViewIdentifier} could not perform a basic render of ${r.RenderableHash} because it is not valid.`;return this.log.error(t),a(new Error(t))}this.pict.parseTemplateByHash(r.Renderable.TemplateHash,r.Record,(t,e)=>t?(this.log.error(`PictView [${this.UUID}]::[${this.Hash}] ${this.options.ViewIdentifier} could not render (asynchronously) ${r.RenderableHash} because it did not parse the template.`,t),a(t)):(this.assignRenderContent(r.Renderable,r.DestinationAddress,e),a()),[this],t,{RootRenderable:r.Renderable})}onProject(t){this.pict.LogNoisiness>3&&this.log.trace(`PictView [${this.UUID}]::[${this.Hash}] ${this.options.ViewIdentifier} onProject:`),"virtual-assignment"===t.RenderMethod&&this.pict.TransactionTracking.pushToTransactionQueue(t.TransactionHash,{ViewHash:this.Hash,Renderable:t},"Deferred-Post-Content-Assignment"),this.pict.LogNoisiness>0&&this.log.trace(`PictView [${this.UUID}]::[${this.Hash}] ${this.options.ViewIdentifier} Assigning Renderable[${t.RenderableHash}] content length ${t.Content.length} to Destination [${t.ContentDestinationAddress}] using Async render method ${t.RenderMethod}.`),this.pict.ContentAssignment.projectContent(t.RenderMethod,t.ContentDestinationAddress,t.Content,t.TestAddress),this.lastRenderedTimestamp=this.pict.log.getTimeStamp()}onProjectAsync(t,e){return this.onProject(e),t()}onAfterRender(t){if(this.pict.LogNoisiness>3&&this.log.trace(`PictView [${this.UUID}]::[${this.Hash}] ${this.options.ViewIdentifier} onAfterRender:`),t&&t.RootRenderableViewHash===this.Hash){const e=this.pict.TransactionTracking.clearTransactionQueue(t.TransactionHash)||[];for(const o of e){const e=this.pict.views[o.Data.ViewHash];e?(e.onAfterProject(),e.onAfterRender(o.Data.Renderable)):this.log.error(`PictView [${this.UUID}]::[${this.Hash}] ${this.options.ViewIdentifier} onAfterRender: Could not find view for transaction hash ${t.TransactionHash} and ViewHash ${o.Data.ViewHash}.`)}}return!0}onAfterRenderAsync(t,e){this.onAfterRender(e);const o=this.fable.newAnticipate();if(e&&e.RootRenderableViewHash===this.Hash){const t=this.pict.TransactionTracking.clearTransactionQueue(e.TransactionHash)||[];for(const i of t){const t=this.pict.views[i.Data.ViewHash];t?(o.anticipate(t.onAfterProjectAsync.bind(t)),o.anticipate(e=>{t.onAfterRenderAsync(e,i.Data.Renderable)})):this.log.error(`PictView [${this.UUID}]::[${this.Hash}] ${this.options.ViewIdentifier} onAfterRenderAsync: Could not find view for transaction hash ${e.TransactionHash} and ViewHash ${i.Data.ViewHash}.`)}}return o.wait(t)}onAfterProject(t){return this.pict.LogNoisiness>3&&this.log.trace(`PictView [${this.UUID}]::[${this.Hash}] ${this.options.ViewIdentifier} onAfterProject:`),!0}onAfterProjectAsync(t,e){return t()}onBeforeSolve(){return this.pict.LogNoisiness>3&&this.log.trace(`PictView [${this.UUID}]::[${this.Hash}] ${this.options.ViewIdentifier} onBeforeSolve:`),!0}onBeforeSolveAsync(t){return this.onBeforeSolve(),t()}onSolve(){return this.pict.LogNoisiness>3&&this.log.trace(`PictView [${this.UUID}]::[${this.Hash}] ${this.options.ViewIdentifier} onSolve:`),!0}onSolveAsync(t){return this.onSolve(),t()}solve(){return this.pict.LogNoisiness>2&&this.log.trace(`PictView [${this.UUID}]::[${this.Hash}] ${this.options.ViewIdentifier} executing solve() function...`),this.onBeforeSolve(),this.onSolve(),this.onAfterSolve(),this.lastSolvedTimestamp=this.pict.log.getTimeStamp(),!0}solveAsync(t){let e=this.pict.instantiateServiceProviderWithoutRegistration("Anticipate"),o="function"==typeof t?t:null;o||(this.log.warn(`PictView [${this.UUID}]::[${this.Hash}] ${this.options.Name} solveAsync was called without a valid callback. A callback will be generated but this could lead to race conditions.`),o=t=>{t&&this.log.error(`PictView [${this.UUID}]::[${this.Hash}] ${this.options.Name} solveAsync Auto Callback Error: ${t}`,t)}),e.anticipate(this.onBeforeSolveAsync.bind(this)),e.anticipate(this.onSolveAsync.bind(this)),e.anticipate(this.onAfterSolveAsync.bind(this)),e.wait(t=>(this.pict.LogNoisiness>2&&this.log.trace(`PictView [${this.UUID}]::[${this.Hash}] ${this.options.ViewIdentifier} solveAsync() complete.`),this.lastSolvedTimestamp=this.pict.log.getTimeStamp(),o(t)))}onAfterSolve(){return this.pict.LogNoisiness>3&&this.log.trace(`PictView [${this.UUID}]::[${this.Hash}] ${this.options.ViewIdentifier} onAfterSolve:`),!0}onAfterSolveAsync(t){return this.onAfterSolve(),t()}onBeforeMarshalFromView(){return this.pict.LogNoisiness>3&&this.log.trace(`PictView [${this.UUID}]::[${this.Hash}] ${this.options.ViewIdentifier} onBeforeMarshalFromView:`),!0}onBeforeMarshalFromViewAsync(t){return this.onBeforeMarshalFromView(),t()}onMarshalFromView(){return this.pict.LogNoisiness>3&&this.log.trace(`PictView [${this.UUID}]::[${this.Hash}] ${this.options.ViewIdentifier} onMarshalFromView:`),!0}onMarshalFromViewAsync(t){return this.onMarshalFromView(),t()}marshalFromView(){return this.pict.LogNoisiness>2&&this.log.trace(`PictView [${this.UUID}]::[${this.Hash}] ${this.options.ViewIdentifier} executing solve() function...`),this.onBeforeMarshalFromView(),this.onMarshalFromView(),this.onAfterMarshalFromView(),this.lastMarshalFromViewTimestamp=this.pict.log.getTimeStamp(),!0}marshalFromViewAsync(t){let e=this.pict.instantiateServiceProviderWithoutRegistration("Anticipate"),o="function"==typeof t?t:null;o||(this.log.warn(`PictView [${this.UUID}]::[${this.Hash}] ${this.options.Name} marshalFromViewAsync was called without a valid callback. A callback will be generated but this could lead to race conditions.`),o=t=>{t&&this.log.error(`PictView [${this.UUID}]::[${this.Hash}] ${this.options.Name} marshalFromViewAsync Auto Callback Error: ${t}`,t)}),e.anticipate(this.onBeforeMarshalFromViewAsync.bind(this)),e.anticipate(this.onMarshalFromViewAsync.bind(this)),e.anticipate(this.onAfterMarshalFromViewAsync.bind(this)),e.wait(t=>(this.pict.LogNoisiness>2&&this.log.trace(`PictView [${this.UUID}]::[${this.Hash}] ${this.options.ViewIdentifier} marshalFromViewAsync() complete.`),this.lastMarshalFromViewTimestamp=this.pict.log.getTimeStamp(),o(t)))}onAfterMarshalFromView(){return this.pict.LogNoisiness>3&&this.log.trace(`PictView [${this.UUID}]::[${this.Hash}] ${this.options.ViewIdentifier} onAfterMarshalFromView:`),!0}onAfterMarshalFromViewAsync(t){return this.onAfterMarshalFromView(),t()}onBeforeMarshalToView(){return this.pict.LogNoisiness>3&&this.log.trace(`PictView [${this.UUID}]::[${this.Hash}] ${this.options.ViewIdentifier} onBeforeMarshalToView:`),!0}onBeforeMarshalToViewAsync(t){return this.onBeforeMarshalToView(),t()}onMarshalToView(){return this.pict.LogNoisiness>3&&this.log.trace(`PictView [${this.UUID}]::[${this.Hash}] ${this.options.ViewIdentifier} onMarshalToView:`),!0}onMarshalToViewAsync(t){return this.onMarshalToView(),t()}marshalToView(){return this.pict.LogNoisiness>2&&this.log.trace(`PictView [${this.UUID}]::[${this.Hash}] ${this.options.ViewIdentifier} executing solve() function...`),this.onBeforeMarshalToView(),this.onMarshalToView(),this.onAfterMarshalToView(),this.lastMarshalToViewTimestamp=this.pict.log.getTimeStamp(),!0}marshalToViewAsync(t){let e=this.pict.instantiateServiceProviderWithoutRegistration("Anticipate"),o="function"==typeof t?t:null;o||(this.log.warn(`PictView [${this.UUID}]::[${this.Hash}] ${this.options.Name} marshalToViewAsync was called without a valid callback. A callback will be generated but this could lead to race conditions.`),o=t=>{t&&this.log.error(`PictView [${this.UUID}]::[${this.Hash}] ${this.options.Name} marshalToViewAsync Auto Callback Error: ${t}`,t)}),e.anticipate(this.onBeforeMarshalToViewAsync.bind(this)),e.anticipate(this.onMarshalToViewAsync.bind(this)),e.anticipate(this.onAfterMarshalToViewAsync.bind(this)),e.wait(t=>(this.pict.LogNoisiness>2&&this.log.trace(`PictView [${this.UUID}]::[${this.Hash}] ${this.options.ViewIdentifier} marshalToViewAsync() complete.`),this.lastMarshalToViewTimestamp=this.pict.log.getTimeStamp(),o(t)))}onAfterMarshalToView(){return this.pict.LogNoisiness>3&&this.log.trace(`PictView [${this.UUID}]::[${this.Hash}] ${this.options.ViewIdentifier} onAfterMarshalToView:`),!0}onAfterMarshalToViewAsync(t){return this.onAfterMarshalToView(),t()}get isPictView(){return!0}}},{"../package.json":40,"fable-serviceproviderbase":2}],42:[function(t,e,o){var i,n,a=e.exports={};function r(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function l(t){if(i===setTimeout)return setTimeout(t,0);if((i===r||!i)&&setTimeout)return i=setTimeout,setTimeout(t,0);try{return i(t,0)}catch(e){try{return i.call(null,t,0)}catch(e){return i.call(this,t,0)}}}!function(){try{i="function"==typeof setTimeout?setTimeout:r}catch(t){i=r}try{n="function"==typeof clearTimeout?clearTimeout:s}catch(t){n=s}}();var c,d=[],p=!1,h=-1;function u(){p&&c&&(p=!1,c.length?d=c.concat(d):h=-1,d.length&&f())}function f(){if(!p){var t=l(u);p=!0;for(var e=d.length;e;){for(c=d,d=[];++h<e;)c&&c[h].run();h=-1,e=d.length}c=null,p=!1,function(t){if(n===clearTimeout)return clearTimeout(t);if((n===s||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(t);try{return n(t)}catch(e){try{return n.call(null,t)}catch(e){return n.call(this,t)}}}(t)}}function g(t,e){this.fun=t,this.array=e}function m(){}a.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var o=1;o<arguments.length;o++)e[o-1]=arguments[o];d.push(new g(t,e)),1!==d.length||p||l(f)},g.prototype.run=function(){this.fun.apply(null,this.array)},a.title="browser",a.browser=!0,a.env={},a.argv=[],a.version="",a.versions={},a.on=m,a.addListener=m,a.once=m,a.off=m,a.removeListener=m,a.removeAllListeners=m,a.emit=m,a.prependListener=m,a.prependOnceListener=m,a.listeners=function(t){return[]},a.binding=function(t){throw new Error("process.binding is not supported")},a.cwd=function(){return"/"},a.chdir=function(t){throw new Error("process.chdir is not supported")},a.umask=function(){return 0}},{}],43:[function(t,e,o){e.exports={Name:"Retold Facto",Hash:"Facto-Full",MainViewportViewIdentifier:"Facto-Full-Layout",MainViewportDestinationAddress:"#Facto-Full-Application-Container",MainViewportDefaultDataAddress:"AppData.Facto",AutoSolveAfterInitialize:!0,AutoRenderMainViewportViewAfterInitialize:!1,AutoRenderViewsAfterInitialize:!1,pict_configuration:{Product:"Retold-Facto-Full"}}},{}],44:[function(t,e,o){const i=t("pict-application"),n=t("pict-router"),a=t("pict-section-modal"),r=[{Key:"turquoise-deluxe",Label:"Turquoise Deluxe",Colors:["#f6f0e4","#18a5a0","#3a9468","#c44836","#12908c"]},{Key:"facto-dark",Label:"Facto Dark",Colors:["#12151e","#4a90d9","#28a745","#dc3545","#6366f1"]},{Key:"facto-light",Label:"Facto Light",Colors:["#f5f6f8","#3b82f6","#22c55e","#ef4444","#6366f1"]},{Key:"midnight-blue",Label:"Midnight Blue",Colors:["#0a0e1a","#3b82f6","#10b981","#f87171","#60a5fa"]},{Key:"slate",Label:"Slate",Colors:["#1e2228","#6b8aae","#5ea37a","#c85a5a","#82a0c4"]},{Key:"warm-earth",Label:"Warm Earth",Colors:["#1a1610","#c4956a","#8a9a5a","#b04050","#4a9090"]},{Key:"high-contrast",Label:"High Contrast",Colors:["#000000","#58a6ff","#3fb950","#f85149","#d29922"]}],s=t("../pict-app/providers/Pict-Provider-Facto.js"),l=t("../pict-app/providers/Pict-Provider-Facto-UI.js"),c=t("./views/PictView-Facto-Full-Layout.js"),d=t("./views/PictView-Facto-Full-TopBar.js"),p=t("./views/PictView-Facto-Full-BottomBar.js"),h=t("./views/PictView-Facto-Full-Dashboard.js"),u=t("./views/PictView-Facto-Full-SourceResearch.js"),f=t("./views/PictView-Facto-Full-IngestJobs.js"),g=t("./views/PictView-Facto-Full-Sources.js"),m=t("./views/PictView-Facto-Full-Datasets.js"),w=t("./views/PictView-Facto-Full-Records.js"),v=t("./views/PictView-Facto-Full-Projections.js"),b=t("./views/PictView-Facto-Full-SchemaEditor.js"),y=t("./views/PictView-Facto-Full-MappingEditor.js"),F=t("./views/PictView-Facto-Full-QueryPanel.js"),S=t("./views/PictView-Facto-Full-Dashboards.js"),P=t("./views/PictView-Facto-Full-RecordViewer.js"),_=t("./views/PictView-Facto-Full-SourceDetail.js"),x=t("./views/PictView-Facto-Full-SourceEditor.js"),D=t("./views/PictView-Facto-Full-Scanner.js"),C=t("./views/PictView-Facto-Full-Connections.js"),T=t("./views/PictView-Facto-Full-ProjectionDetail.js"),A=t("./views/PictView-Facto-Full-Throughput.js");e.exports=class extends i{constructor(e,o,i){super(e,o,i),this.pict.settings.RouterSkipRouteResolveOnAdd=!0,this.pict.addView("Pict-Section-Modal",a.default_configuration,a),this.pict.addProvider("Facto",s.default_configuration,s),this.pict.addProvider("FactoUI",l.default_configuration,l),this.pict.addProvider("PictRouter",t("./providers/PictRouter-Facto-Configuration.json"),n),this.pict.addView("Facto-Full-Layout",c.default_configuration,c),this.pict.addView("Facto-Full-TopBar",d.default_configuration,d),this.pict.addView("Facto-Full-BottomBar",p.default_configuration,p),this.pict.addView("Facto-Full-Dashboard",h.default_configuration,h),this.pict.addView("Facto-Full-SourceResearch",u.default_configuration,u),this.pict.addView("Facto-Full-IngestJobs",f.default_configuration,f),this.pict.addView("Facto-Full-Sources",g.default_configuration,g),this.pict.addView("Facto-Full-Datasets",m.default_configuration,m),this.pict.addView("Facto-Full-Records",w.default_configuration,w),this.pict.addView("Facto-Full-Projections",v.default_configuration,v),this.pict.addView("Facto-Full-SchemaEditor",b.default_configuration,b),this.pict.addView("Facto-Full-MappingEditor",y.default_configuration,y),this.pict.addView("Facto-Full-QueryPanel",F.default_configuration,F),this.pict.addView("Facto-Full-Dashboards",S.default_configuration,S),this.pict.addView("Facto-Full-RecordViewer",P.default_configuration,P),this.pict.addView("Facto-Full-SourceDetail",_.default_configuration,_),this.pict.addView("Facto-Full-SourceEditor",x.default_configuration,x),this.pict.addView("Facto-Full-Scanner",D.default_configuration,D),this.pict.addView("Facto-Full-Connections",C.default_configuration,C),this.pict.addView("Facto-Full-ProjectionDetail",T.default_configuration,T),this.pict.addView("Facto-Full-Throughput",A.default_configuration,A)}onAfterInitializeAsync(t){this.loadSavedTheme(),this.pict.AppData.Facto={CatalogEntries:[],Sources:[],Datasets:[],Records:[],IngestJobs:[],Projections:[],SelectedSource:null,SelectedDataset:null,RecordPage:0,RecordPageSize:50,RecordFilterSources:[],RecordFilterDateFrom:"",RecordFilterDateTo:"",CurrentRecordContent:{},CurrentDocumentSegments:[],StoreConnections:[],AvailableConnectionTypes:[],ProjectionMappings:[],DiscoveredFields:{},ScannerPaths:[],ScannerDatasets:[],CurrentTheme:"turquoise-deluxe",CurrentRoute:""},window.pict=this.pict;let e=this;return this.pict.providers.PictRouter.addRoute("/Record/:IDRecord",t=>{let o=t&&t.data?t.data.IDRecord:null;o&&e.showRecordView(o)}),this.pict.providers.PictRouter.addRoute("/Source/:IDSource",t=>{let o=t&&t.data?t.data.IDSource:null;o&&e.showSourceView(o)}),this.pict.providers.PictRouter.addRoute("/Projection/:IDDataset",t=>{let o=t&&t.data?t.data.IDDataset:null;o&&e.showProjectionView(o)}),this.pict.providers.PictRouter.addRoute("/Source/:IDSource/Doc/:IDDoc",t=>{let o=t&&t.data?t.data.IDSource:null,i=t&&t.data?t.data.IDDoc:null;o&&e.showSourceView(o,i)}),this.pict.views["Facto-Full-Layout"].render(),this.pict.providers.PictRouter.resolve(),super.onAfterInitializeAsync(t)}navigateTo(t){this.pict.providers.PictRouter.navigate(t)}showRecordView(t){let e=this.pict.views["Facto-Full-RecordViewer"];e&&e.loadRecord(t),this._setActiveNav("Records")}showSourceView(t,e){let o=this.pict.views["Facto-Full-SourceDetail"];o&&o.loadSource(t,e),this._setActiveNav("SourceResearch")}showProjectionView(t){let e=this.pict.views["Facto-Full-ProjectionDetail"];e&&e.loadProjection(t),this._setActiveNav("Projections")}showView(t){t in this.pict.views?this.pict.views[t].render():(this.pict.log.warn(`View [${t}] not found; falling back to dashboard.`),this.pict.views["Facto-Full-Dashboard"].render());let e=t.replace("Facto-Full-","");this._setActiveNav(e)}_setActiveNav(t){this.pict.AppData.Facto.CurrentRoute=t;let e=this.pict.views["Facto-Full-TopBar"];e&&"function"==typeof e.highlightRoute&&e.highlightRoute(t)}applyTheme(t){let e=t||"turquoise-deluxe";"turquoise-deluxe"===e?delete document.body.dataset.theme:document.body.dataset.theme=e,localStorage.setItem("facto-theme",e),this.pict.AppData.Facto&&(this.pict.AppData.Facto.CurrentTheme=e)}loadSavedTheme(){let t=localStorage.getItem("facto-theme")||"turquoise-deluxe";this.applyTheme(t)}getThemeList(){return r}},e.exports.default_configuration=t("./Pict-Application-Facto-Full-Configuration.json")},{"../pict-app/providers/Pict-Provider-Facto-UI.js":71,"../pict-app/providers/Pict-Provider-Facto.js":72,"./Pict-Application-Facto-Full-Configuration.json":43,"./providers/PictRouter-Facto-Configuration.json":45,"./views/PictView-Facto-Full-BottomBar.js":46,"./views/PictView-Facto-Full-Connections.js":47,"./views/PictView-Facto-Full-Dashboard.js":48,"./views/PictView-Facto-Full-Dashboards.js":49,"./views/PictView-Facto-Full-Datasets.js":50,"./views/PictView-Facto-Full-IngestJobs.js":51,"./views/PictView-Facto-Full-Layout.js":52,"./views/PictView-Facto-Full-MappingEditor.js":53,"./views/PictView-Facto-Full-ProjectionDetail.js":54,"./views/PictView-Facto-Full-Projections.js":55,"./views/PictView-Facto-Full-QueryPanel.js":56,"./views/PictView-Facto-Full-RecordViewer.js":57,"./views/PictView-Facto-Full-Records.js":58,"./views/PictView-Facto-Full-Scanner.js":59,"./views/PictView-Facto-Full-SchemaEditor.js":60,"./views/PictView-Facto-Full-SourceDetail.js":61,"./views/PictView-Facto-Full-SourceEditor.js":62,"./views/PictView-Facto-Full-SourceResearch.js":63,"./views/PictView-Facto-Full-Sources.js":64,"./views/PictView-Facto-Full-Throughput.js":65,"./views/PictView-Facto-Full-TopBar.js":66,"pict-application":5,"pict-router":8,"pict-section-modal":146}],45:[function(t,e,o){e.exports={ProviderIdentifier:"Pict-Router",AutoInitialize:!0,AutoInitializeOrdinal:0,Routes:[{path:"/Home",template:"{~LV:Pict.PictApplication.showView(`Facto-Full-Dashboard`)~}"},{path:"/Scanner",template:"{~LV:Pict.PictApplication.showView(`Facto-Full-Scanner`)~}"},{path:"/SourceResearch",template:"{~LV:Pict.PictApplication.showView(`Facto-Full-SourceResearch`)~}"},{path:"/IngestJobs",template:"{~LV:Pict.PictApplication.showView(`Facto-Full-IngestJobs`)~}"},{path:"/Sources",template:"{~LV:Pict.PictApplication.showView(`Facto-Full-Sources`)~}"},{path:"/Datasets",template:"{~LV:Pict.PictApplication.showView(`Facto-Full-Datasets`)~}"},{path:"/Records",template:"{~LV:Pict.PictApplication.showView(`Facto-Full-Records`)~}"},{path:"/Projections",template:"{~LV:Pict.PictApplication.showView(`Facto-Full-Projections`)~}"},{path:"/Connections",template:"{~LV:Pict.PictApplication.showView(`Facto-Full-Connections`)~}"},{path:"/Dashboards",template:"{~LV:Pict.PictApplication.showView(`Facto-Full-Dashboards`)~}"},{path:"/Throughput",template:"{~LV:Pict.PictApplication.showView(`Facto-Full-Throughput`)~}"}]}},{}],46:[function(t,e,o){const i=t("pict-view"),n={ViewIdentifier:"Facto-Full-BottomBar",DefaultRenderable:"Facto-Full-BottomBar-Content",DefaultDestinationAddress:"#Facto-Full-BottomBar-Container",AutoRender:!1,CSS:"\n\t\t.facto-bottombar {\n\t\t\tdisplay: flex;\n\t\t\talign-items: center;\n\t\t\tjustify-content: space-between;\n\t\t\tpadding: 0.6em 1.25em;\n\t\t\tbackground: var(--facto-topbar-bg);\n\t\t\tborder-top: 1px solid var(--facto-border-subtle);\n\t\t\tfont-size: 0.78em;\n\t\t\tcolor: var(--facto-text-tertiary);\n\t\t}\n\n\t\t.facto-bottombar a {\n\t\t\tcolor: var(--facto-text-tertiary);\n\t\t\ttext-decoration: none;\n\t\t}\n\n\t\t.facto-bottombar a:hover {\n\t\t\tcolor: var(--facto-text-secondary);\n\t\t}\n\t",Templates:[{Hash:"Facto-Full-BottomBar-Template",Template:'\n<div class="facto-bottombar">\n\t<span>Retold Facto Data Warehouse</span>\n\t<span>Retold</span>\n</div>\n'}],Renderables:[{RenderableHash:"Facto-Full-BottomBar-Content",TemplateHash:"Facto-Full-BottomBar-Template",DestinationAddress:"#Facto-Full-BottomBar-Container",RenderMethod:"replace"}]};e.exports=class extends i{constructor(t,e,o){super(t,e,o)}},e.exports.default_configuration=n},{"pict-view":41}],47:[function(t,e,o){const i=t("pict-view"),n={ViewIdentifier:"Facto-Full-Connections",DefaultRenderable:"Facto-Full-Connections-Content",DefaultDestinationAddress:"#Facto-Full-Content-Container",AutoRender:!1,CSS:"\n\t\t.facto-conn-form {\n\t\t\tdisplay: none;\n\t\t\tpadding: 1em;\n\t\t\tbackground: var(--facto-bg-surface, #fcf8f0);\n\t\t\tborder: 1px solid var(--facto-border, #d6c8ae);\n\t\t\tborder-radius: 8px;\n\t\t\tmargin-bottom: 1em;\n\t\t}\n\t\t.facto-conn-form.active {\n\t\t\tdisplay: block;\n\t\t}\n\t\t.facto-conn-form-grid {\n\t\t\tdisplay: grid;\n\t\t\tgrid-template-columns: 1fr 1fr;\n\t\t\tgap: 0.6em;\n\t\t}\n\t\t.facto-conn-form-grid label {\n\t\t\tfont-size: 0.78em;\n\t\t\tfont-weight: 600;\n\t\t\tcolor: var(--facto-text-secondary, #786848);\n\t\t\tdisplay: block;\n\t\t\tmargin-bottom: 0.2em;\n\t\t}\n\t\t.facto-conn-form-grid input,\n\t\t.facto-conn-form-grid select {\n\t\t\twidth: 100%;\n\t\t\tpadding: 0.4em 0.6em;\n\t\t\tfont-size: 0.85em;\n\t\t\tborder: 1px solid var(--facto-border, #d6c8ae);\n\t\t\tborder-radius: 4px;\n\t\t\tbackground: var(--facto-bg-base, #f6f0e4);\n\t\t\tcolor: var(--facto-text-primary, #3e2f1a);\n\t\t}\n\t\t.facto-conn-form-actions {\n\t\t\tgrid-column: span 2;\n\t\t\tdisplay: flex;\n\t\t\tgap: 0.5em;\n\t\t\tmargin-top: 0.5em;\n\t\t}\n\t",Templates:[{Hash:"Facto-Full-Connections-Template",Template:'\n<div class="facto-content">\n\t<div class="facto-content-header">\n\t\t<h1>Store Connections</h1>\n\t\t<p>Manage database and storage connections used by projections.</p>\n\t</div>\n\n\t<div class="facto-section">\n\t\t<div style="display:flex; align-items:center; justify-content:space-between; margin-bottom:1em;">\n\t\t\t<div class="facto-section-title" style="margin:0;">Connections</div>\n\t\t\t<button class="facto-btn facto-btn-primary facto-btn-small" onclick="{~P~}.views[\'Facto-Full-Connections\'].toggleConnectionForm()">+ Add Connection</button>\n\t\t</div>\n\n\t\t<div id="Facto-Conn-Form" class="facto-conn-form">\n\t\t\t<div class="facto-conn-form-grid">\n\t\t\t\t<div>\n\t\t\t\t\t<label>Connection Name</label>\n\t\t\t\t\t<input type="text" id="Facto-Conn-Name" placeholder="e.g. Production MySQL">\n\t\t\t\t</div>\n\t\t\t\t<div>\n\t\t\t\t\t<label>Type</label>\n\t\t\t\t\t<select id="Facto-Conn-Type" onchange="{~P~}.views[\'Facto-Full-Connections\'].updateConnectionFormFields()">\n\t\t\t\t\t\t<option value="MySQL">MySQL</option>\n\t\t\t\t\t\t<option value="PostgreSQL">PostgreSQL</option>\n\t\t\t\t\t\t<option value="MSSQL">MSSQL</option>\n\t\t\t\t\t\t<option value="SQLite">SQLite</option>\n\t\t\t\t\t\t<option value="Solr">Solr</option>\n\t\t\t\t\t\t<option value="RocksDB">RocksDB</option>\n\t\t\t\t\t</select>\n\t\t\t\t</div>\n\t\t\t\t<div id="Facto-Conn-FilePath-Wrap" style="display:none;">\n\t\t\t\t\t<label>File Path</label>\n\t\t\t\t\t<input type="text" id="Facto-Conn-FilePath" placeholder="/path/to/database.sqlite">\n\t\t\t\t</div>\n\t\t\t\t<div id="Facto-Conn-Host-Wrap">\n\t\t\t\t\t<label>Host</label>\n\t\t\t\t\t<input type="text" id="Facto-Conn-Host" placeholder="localhost">\n\t\t\t\t</div>\n\t\t\t\t<div id="Facto-Conn-Port-Wrap">\n\t\t\t\t\t<label>Port</label>\n\t\t\t\t\t<input type="number" id="Facto-Conn-Port" placeholder="3306">\n\t\t\t\t</div>\n\t\t\t\t<div id="Facto-Conn-User-Wrap">\n\t\t\t\t\t<label>User</label>\n\t\t\t\t\t<input type="text" id="Facto-Conn-User" placeholder="root">\n\t\t\t\t</div>\n\t\t\t\t<div id="Facto-Conn-Password-Wrap">\n\t\t\t\t\t<label>Password</label>\n\t\t\t\t\t<input type="password" id="Facto-Conn-Password" placeholder="password">\n\t\t\t\t</div>\n\t\t\t\t<div id="Facto-Conn-Database-Wrap">\n\t\t\t\t\t<label>Database</label>\n\t\t\t\t\t<input type="text" id="Facto-Conn-Database" placeholder="my_database">\n\t\t\t\t</div>\n\t\t\t\t<div class="facto-conn-form-actions">\n\t\t\t\t\t<button class="facto-btn facto-btn-primary facto-btn-small" onclick="{~P~}.views[\'Facto-Full-Connections\'].addConnection()">Save Connection</button>\n\t\t\t\t\t<button class="facto-btn facto-btn-secondary facto-btn-small" onclick="{~P~}.views[\'Facto-Full-Connections\'].toggleConnectionForm()">Cancel</button>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</div>\n\n\t\t<div id="Facto-Conn-List"></div>\n\t</div>\n</div>\n'}],Renderables:[{RenderableHash:"Facto-Full-Connections-Content",TemplateHash:"Facto-Full-Connections-Template",DestinationAddress:"#Facto-Full-Content-Container",RenderMethod:"replace"}]};e.exports=class extends i{constructor(t,e,o){super(t,e,o)}onAfterRender(){return this.pict.providers.Facto.loadStoreConnections().then(()=>{this.refreshConnectionList()}).catch(t=>{this.pict.views["Pict-Section-Modal"].toast("Error loading connections: "+t.message,{type:"error"})}),super.onAfterRender()}toggleConnectionForm(){let t=document.getElementById("Facto-Conn-Form");t&&(t.classList.toggle("active"),t.classList.contains("active")&&this.updateConnectionFormFields())}updateConnectionFormFields(){let t=this.pict.providers.FactoUI.getVal("Facto-Conn-Type"),e="SQLite"===t||"RocksDB"===t,o=document.getElementById("Facto-Conn-FilePath-Wrap"),i=document.getElementById("Facto-Conn-Host-Wrap"),n=document.getElementById("Facto-Conn-Port-Wrap"),a=document.getElementById("Facto-Conn-User-Wrap"),r=document.getElementById("Facto-Conn-Password-Wrap"),s=document.getElementById("Facto-Conn-Database-Wrap");o&&(o.style.display=e?"":"none"),i&&(i.style.display=e?"none":""),n&&(n.style.display=e?"none":""),a&&(a.style.display=e?"none":""),r&&(r.style.display=e?"none":""),s&&(s.style.display=e?"none":"")}refreshConnectionList(){let t=document.getElementById("Facto-Conn-List");if(!t)return;if(0===this.pict.AppData.Facto.StoreConnections.length)return void(t.innerHTML='<div class="facto-card" style="text-align:center; padding:2em; color:var(--facto-text-tertiary);">No connections configured. Add one to get started.</div>');let e='<table class="facto-table"><thead><tr>';e+="<th>Name</th><th>Type</th><th>Status</th><th>Actions</th>",e+="</tr></thead><tbody>";for(let t=0;t<this.pict.AppData.Facto.StoreConnections.length;t++){let o=this.pict.AppData.Facto.StoreConnections[t],i=(o.Status||"Untested").toLowerCase();e+="<tr>",e+="<td><strong>"+(o.Name||"—")+"</strong></td>",e+="<td>"+(o.Type||"—")+"</td>",e+='<td><span class="facto-status-badge '+i+'">'+(o.Status||"Untested")+"</span></td>",e+="<td>",e+='<button class="facto-btn facto-btn-primary facto-btn-small" onclick="pict.views[\'Facto-Full-Connections\'].testConnection('+o.IDStoreConnection+')">Test</button> ',e+='<button class="facto-btn facto-btn-secondary facto-btn-small" onclick="pict.views[\'Facto-Full-Connections\'].deleteConnection('+o.IDStoreConnection+')">Delete</button>',e+="</td>",e+="</tr>"}e+="</tbody></table>",t.innerHTML=e}addConnection(){let t=this.pict.providers.FactoUI.getVal("Facto-Conn-Name"),e=this.pict.providers.FactoUI.getVal("Facto-Conn-Type");if(!t)return void this.pict.views["Pict-Section-Modal"].toast("Connection name is required.",{type:"warning"});let o={};if("SQLite"===e||"RocksDB"===e){if(o.SQLiteFilePath=this.pict.providers.FactoUI.getVal("Facto-Conn-FilePath"),!o.SQLiteFilePath)return void this.pict.views["Pict-Section-Modal"].toast("File path is required for "+e+" connections.",{type:"warning"})}else o.host=this.pict.providers.FactoUI.getVal("Facto-Conn-Host"),o.server=o.host,o.port=parseInt(this.pict.providers.FactoUI.getVal("Facto-Conn-Port"))||0,o.user=this.pict.providers.FactoUI.getVal("Facto-Conn-User"),o.password=this.pict.providers.FactoUI.getVal("Facto-Conn-Password"),o.database=this.pict.providers.FactoUI.getVal("Facto-Conn-Database");this.pict.providers.Facto.createStoreConnection({Name:t,Type:e,Config:o}).then(t=>{t&&t.Error?this.pict.views["Pict-Section-Modal"].toast("Error: "+t.Error,{type:"error"}):this.pict.providers.Facto.loadStoreConnections().then(t=>{this.refreshConnectionList(),this.toggleConnectionForm();let e=["Name","Host","Port","User","Password","Database","FilePath"];for(let t=0;t<e.length;t++){let o=document.getElementById("Facto-Conn-"+e[t]);o&&(o.value="")}})})}testConnection(t){this.pict.providers.Facto.testStoreConnection(t).then(t=>{this.pict.providers.Facto.loadStoreConnections().then(e=>{this.refreshConnectionList(),t&&t.Success?this.pict.views["Pict-Section-Modal"].toast("Connection test succeeded!",{type:"success"}):this.pict.views["Pict-Section-Modal"].toast("Connection test failed: "+(t&&t.Error?t.Error:"Unknown error"),{type:"error"})})})}async deleteConnection(t){await this.pict.views["Pict-Section-Modal"].confirm("Delete this connection?",{title:"Delete Connection",confirmLabel:"Delete",dangerous:!0})&&this.pict.providers.Facto.deleteStoreConnection(t).then(()=>{this.pict.providers.Facto.loadStoreConnections().then(t=>{this.refreshConnectionList()})})}},e.exports.default_configuration=n},{"pict-view":41}],48:[function(t,e,o){const i=t("pict-view"),n={ViewIdentifier:"Facto-Full-Dashboard",DefaultRenderable:"Facto-Full-Dashboard-Content",DefaultDestinationAddress:"#Facto-Full-Content-Container",AutoRender:!1,CSS:"\n\t\t.facto-dashboard-stat {\n\t\t\ttext-align: center;\n\t\t}\n\n\t\t.facto-dashboard-stat-value {\n\t\t\tfont-size: 2em;\n\t\t\tfont-weight: 700;\n\t\t\tcolor: var(--facto-text-heading);\n\t\t\tline-height: 1.2;\n\t\t}\n\n\t\t.facto-dashboard-stat-label {\n\t\t\tfont-size: 0.85em;\n\t\t\tcolor: var(--facto-text-secondary);\n\t\t\tmargin-top: 0.3em;\n\t\t}\n\n\t\t.facto-dashboard-actions {\n\t\t\tdisplay: flex;\n\t\t\tgap: 0.75em;\n\t\t\tflex-wrap: wrap;\n\t\t}\n\t",Templates:[{Hash:"Facto-Full-Dashboard-Template",Template:'\n<div class="facto-content">\n\t<div class="facto-content-header">\n\t\t<h1>Dashboard</h1>\n\t\t<p>Retold Facto data warehouse overview.</p>\n\t</div>\n\n\t<div class="facto-card-grid" id="Facto-Full-Dashboard-Cards">\n\t\t<div class="facto-card facto-dashboard-stat">\n\t\t\t<div class="facto-dashboard-stat-value" id="Facto-Full-Dash-SourceCount">--</div>\n\t\t\t<div class="facto-dashboard-stat-label">Sources</div>\n\t\t</div>\n\t\t<div class="facto-card facto-dashboard-stat">\n\t\t\t<div class="facto-dashboard-stat-value" id="Facto-Full-Dash-DatasetCount">--</div>\n\t\t\t<div class="facto-dashboard-stat-label">Datasets</div>\n\t\t</div>\n\t\t<div class="facto-card facto-dashboard-stat">\n\t\t\t<div class="facto-dashboard-stat-value" id="Facto-Full-Dash-RecordCount">--</div>\n\t\t\t<div class="facto-dashboard-stat-label">Records</div>\n\t\t</div>\n\t\t<div class="facto-card facto-dashboard-stat">\n\t\t\t<div class="facto-dashboard-stat-value" id="Facto-Full-Dash-IngestCount">--</div>\n\t\t\t<div class="facto-dashboard-stat-label">Ingest Jobs</div>\n\t\t</div>\n\t\t<div class="facto-card facto-dashboard-stat">\n\t\t\t<div class="facto-dashboard-stat-value" id="Facto-Full-Dash-CatalogCount">--</div>\n\t\t\t<div class="facto-dashboard-stat-label">Catalog Entries</div>\n\t\t</div>\n\t</div>\n\n\t<div class="facto-section" style="margin-top:2em;">\n\t\t<div class="facto-section-title">Quick Actions</div>\n\t\t<div class="facto-dashboard-actions">\n\t\t\t<button class="facto-btn facto-btn-primary" onclick="{~P~}.PictApplication.navigateTo(\'/SourceResearch\')">Source Research</button>\n\t\t\t<button class="facto-btn facto-btn-primary" onclick="{~P~}.PictApplication.navigateTo(\'/Sources\')">Manage Sources</button>\n\t\t\t<button class="facto-btn facto-btn-primary" onclick="{~P~}.PictApplication.navigateTo(\'/Records\')">Browse Records</button>\n\t\t\t<button class="facto-btn facto-btn-secondary" onclick="window.location.href=\'/simple/\'">Simple View</button>\n\t\t</div>\n\t</div>\n</div>\n'}],Renderables:[{RenderableHash:"Facto-Full-Dashboard-Content",TemplateHash:"Facto-Full-Dashboard-Template",DestinationAddress:"#Facto-Full-Content-Container",RenderMethod:"replace"}]};e.exports=class extends i{constructor(t,e,o){super(t,e,o)}onAfterRender(t,e,o,i){let n=this.pict.providers.Facto;return n.loadSources().then(()=>{let t=document.getElementById("Facto-Full-Dash-SourceCount");t&&(t.textContent=(this.pict.AppData.Facto.Sources||[]).length)}),n.loadDatasets().then(()=>{let t=document.getElementById("Facto-Full-Dash-DatasetCount");t&&(t.textContent=(this.pict.AppData.Facto.Datasets||[]).length)}),n.loadRecords().then(()=>{let t=document.getElementById("Facto-Full-Dash-RecordCount");t&&(t.textContent=(this.pict.AppData.Facto.Records||[]).length)}),n.loadIngestJobs().then(()=>{let t=document.getElementById("Facto-Full-Dash-IngestCount");t&&(t.textContent=(this.pict.AppData.Facto.IngestJobs||[]).length)}),n.loadCatalogEntries().then(()=>{let t=document.getElementById("Facto-Full-Dash-CatalogCount");t&&(t.textContent=(this.pict.AppData.Facto.CatalogEntries||[]).length)}),super.onAfterRender(t,e,o,i)}},e.exports.default_configuration=n},{"pict-view":41}],49:[function(t,e,o){const i=t("pict-view"),n={ViewIdentifier:"Facto-Full-Dashboards",DefaultRenderable:"Facto-Full-Dashboards-Content",DefaultDestinationAddress:"#Facto-Full-Content-Container",AutoRender:!1,Templates:[{Hash:"Facto-Full-Dashboards-Template",Template:'\n<div class="facto-content">\n\t<div class="facto-content-header">\n\t\t<h1>Dashboards</h1>\n\t\t<p>Custom analytics dashboards and data visualizations.</p>\n\t</div>\n\n\t<div class="facto-empty" style="padding:4em 1em;">\n\t\t<h3 style="margin-bottom:0.5em; color:var(--facto-text-secondary);">Coming Soon</h3>\n\t\t<p style="color:var(--facto-text-tertiary); max-width:500px; margin:0 auto;">\n\t\t\tCustom dashboards with charts, data visualizations, and configurable widgets will be available in a future release.\n\t\t\tFor now, use the <a onclick="pict.PictApplication.navigateTo(\'/Projections\')" style="cursor:pointer;">Projections</a> view to query and aggregate data.\n\t\t</p>\n\t</div>\n</div>\n'}],Renderables:[{RenderableHash:"Facto-Full-Dashboards-Content",TemplateHash:"Facto-Full-Dashboards-Template",DestinationAddress:"#Facto-Full-Content-Container",RenderMethod:"replace"}]};e.exports=class extends i{constructor(t,e,o){super(t,e,o)}},e.exports.default_configuration=n},{"pict-view":41}],50:[function(t,e,o){const i=t("pict-view"),n={ViewIdentifier:"Facto-Full-Datasets",DefaultRenderable:"Facto-Full-Datasets-Content",DefaultDestinationAddress:"#Facto-Full-Content-Container",AutoRender:!1,Templates:[{Hash:"Facto-Full-Datasets-Template",Template:'\n<div class="facto-content">\n\t<div class="facto-content-header">\n\t\t<h1>Data Sets</h1>\n\t\t<p>Manage datasets and their configurations.</p>\n\t</div>\n\n\t<div id="Facto-Full-Datasets-List"></div>\n\t<div id="Facto-Full-Datasets-Stats" style="display:none; margin-top:1.25em; padding-top:1.25em; border-top:1px solid var(--facto-border-subtle);"></div>\n\n\t<div class="facto-section" style="margin-top:2em;">\n\t\t<div class="facto-section-title">Add Dataset</div>\n\t\t<div class="facto-inline-group">\n\t\t\t<div>\n\t\t\t\t<label>Name</label>\n\t\t\t\t<input type="text" id="Facto-Full-Dataset-Name" placeholder="Dataset name">\n\t\t\t</div>\n\t\t\t<div>\n\t\t\t\t<label>Type</label>\n\t\t\t\t<select id="Facto-Full-Dataset-Type">\n\t\t\t\t\t<option value="Raw">Raw</option>\n\t\t\t\t\t<option value="Compositional">Compositional</option>\n\t\t\t\t\t<option value="Projection">Projection</option>\n\t\t\t\t\t<option value="Derived">Derived</option>\n\t\t\t\t</select>\n\t\t\t</div>\n\t\t\t<div>\n\t\t\t\t<label>Description</label>\n\t\t\t\t<input type="text" id="Facto-Full-Dataset-Desc" placeholder="Description">\n\t\t\t</div>\n\t\t</div>\n\t\t<button class="facto-btn facto-btn-primary" onclick="{~P~}.views[\'Facto-Full-Datasets\'].addDataset()">Add Dataset</button>\n\t</div>\n\n</div>\n'}],Renderables:[{RenderableHash:"Facto-Full-Datasets-Content",TemplateHash:"Facto-Full-Datasets-Template",DestinationAddress:"#Facto-Full-Content-Container",RenderMethod:"replace"}]};e.exports=class extends i{constructor(t,e,o){super(t,e,o)}onAfterRender(t,e,o,i){return this.pict.providers.Facto.loadDatasets().then(()=>{this.refreshList()}).catch(t=>{this.pict.views["Pict-Section-Modal"].toast("Error loading datasets: "+t.message,{type:"error"})}),super.onAfterRender(t,e,o,i)}refreshList(){let t=document.getElementById("Facto-Full-Datasets-List");if(!t)return;let e=this.pict.AppData.Facto.Datasets;if(!e||0===e.length)return void(t.innerHTML='<div class="facto-empty">No datasets yet. Add one below or provision from Source Research.</div>');let o="<table><thead><tr><th>ID</th><th>Hash</th><th>Name</th><th>Type</th><th>Description</th><th>Version Policy</th><th>Actions</th></tr></thead><tbody>";for(let t=0;t<e.length;t++){let i=e[t],n="facto-badge-primary";"Projection"===i.Type?n="facto-badge-warning":"Derived"===i.Type&&(n="facto-badge-muted"),o+="<tr>",o+="<td>"+(i.IDDataset||"")+"</td>",o+="<td><code>"+(i.Hash||"-")+"</code></td>",o+="<td>"+(i.Name||"")+"</td>",o+='<td><span class="facto-badge '+n+'">'+(i.Type||"")+"</span></td>",o+="<td>"+(i.Description||"")+"</td>",o+="<td>"+(i.VersionPolicy||"Append")+"</td>",o+='<td><button class="facto-btn facto-btn-secondary facto-btn-small" onclick="pict.views[\'Facto-Full-Datasets\'].viewStats('+i.IDDataset+')">Stats</button></td>',o+="</tr>"}o+="</tbody></table>",t.innerHTML=o}viewStats(t){let e=document.getElementById("Facto-Full-Datasets-Stats");e&&(e.style.display="block",e.innerHTML='<p style="color:var(--facto-text-secondary);">Loading stats for Dataset #'+t+"...</p>",this.pict.providers.Facto.loadDatasetStats(t).then(o=>{if(o){let i="<h3>Dataset #"+t+" Statistics</h3>";i+='<div class="facto-card-grid" style="margin-top:0.75em;">',i+='<div class="facto-card facto-dashboard-stat"><div class="facto-dashboard-stat-value">'+(o.RecordCount||0)+'</div><div class="facto-dashboard-stat-label">Records</div></div>',i+='<div class="facto-card facto-dashboard-stat"><div class="facto-dashboard-stat-value">'+(o.SourceCount||0)+'</div><div class="facto-dashboard-stat-label">Sources</div></div>',i+='<div class="facto-card facto-dashboard-stat"><div class="facto-dashboard-stat-value">'+(o.CurrentVersion||0)+'</div><div class="facto-dashboard-stat-label">Current Version</div></div>',i+="</div>",i+='<div style="margin-top:0.75em;"><button class="facto-btn facto-btn-secondary" onclick="document.getElementById(\'Facto-Full-Datasets-Stats\').style.display=\'none\'">Close</button></div>',e.innerHTML=i}}))}addDataset(){let t=this.pict.providers.FactoUI.getVal("Facto-Full-Dataset-Name"),e=this.pict.providers.FactoUI.getVal("Facto-Full-Dataset-Type"),o=this.pict.providers.FactoUI.getVal("Facto-Full-Dataset-Desc");t?this.pict.providers.Facto.createDataset({Name:t,Type:e,Description:o}).then(e=>{if(e&&e.IDDataset)return this.pict.views["Pict-Section-Modal"].toast("Dataset created: "+t,{type:"success"}),document.getElementById("Facto-Full-Dataset-Name").value="",document.getElementById("Facto-Full-Dataset-Desc").value="",this.pict.providers.Facto.loadDatasets();this.pict.views["Pict-Section-Modal"].toast("Error creating dataset",{type:"error"})}).then(()=>{this.refreshList()}):this.pict.views["Pict-Section-Modal"].toast("Dataset name is required",{type:"warning"})}},e.exports.default_configuration=n},{"pict-view":41}],51:[function(t,e,o){const i=t("pict-view"),n={ViewIdentifier:"Facto-Full-IngestJobs",DefaultRenderable:"Facto-Full-IngestJobs-Content",DefaultDestinationAddress:"#Facto-Full-Content-Container",AutoRender:!1,Templates:[{Hash:"Facto-Full-IngestJobs-Template",Template:'\n<div class="facto-content">\n\t<div class="facto-content-header">\n\t\t<h1>Ingestion Jobs</h1>\n\t\t<p>Monitor and manage data ingestion jobs.</p>\n\t</div>\n\n\t<div id="Facto-Full-IngestJobs-List"></div>\n\t<div id="Facto-Full-IngestJobs-Status" class="facto-status" style="display:none;"></div>\n</div>\n'}],Renderables:[{RenderableHash:"Facto-Full-IngestJobs-Content",TemplateHash:"Facto-Full-IngestJobs-Template",DestinationAddress:"#Facto-Full-Content-Container",RenderMethod:"replace"}]};e.exports=class extends i{constructor(t,e,o){super(t,e,o)}onAfterRender(t,e,o,i){return this.pict.providers.Facto.loadIngestJobs().then(()=>{this.refreshList()}).catch(t=>{this.pict.views["Pict-Section-Modal"].toast("Error loading ingest jobs: "+t.message,{type:"error"})}),super.onAfterRender(t,e,o,i)}refreshList(){let t=document.getElementById("Facto-Full-IngestJobs-List");if(!t)return;let e=this.pict.AppData.Facto.IngestJobs;if(!e||0===e.length)return void(t.innerHTML='<div class="facto-empty">No ingestion jobs yet. Jobs are created automatically when data is ingested.</div>');let o="<table><thead><tr><th>ID</th><th>Source</th><th>Dataset</th><th>Status</th><th>Version</th><th>Records</th><th>Errors</th><th>Created</th></tr></thead><tbody>";for(let t=0;t<e.length;t++){let i=e[t],n="facto-badge-muted";"Complete"===i.Status?n="facto-badge-success":"Running"===i.Status?n="facto-badge-primary":"Error"===i.Status&&(n="facto-badge-error"),o+="<tr>",o+="<td>"+(i.IDIngestJob||"")+"</td>",o+="<td>"+(i.IDSource||"")+"</td>",o+="<td>"+(i.IDDataset||"")+"</td>",o+='<td><span class="facto-badge '+n+'">'+(i.Status||"Pending")+"</span></td>",o+="<td>"+(i.DatasetVersion||"")+"</td>",o+="<td>"+(i.RecordsIngested||0)+"</td>",o+="<td>"+(i.RecordsErrored||0)+"</td>",o+="<td>"+(i.CreatingIDUser?new Date(i.CreateDate).toLocaleString():i.CreateDate||"")+"</td>",o+="</tr>"}o+="</tbody></table>",t.innerHTML=o}},e.exports.default_configuration=n},{"pict-view":41}],52:[function(t,e,o){const i=t("pict-view"),n={ViewIdentifier:"Facto-Full-Layout",DefaultRenderable:"Facto-Full-Layout-Shell",DefaultDestinationAddress:"#Facto-Full-Application-Container",AutoRender:!1,Templates:[{Hash:"Facto-Full-Layout-Shell-Template",Template:'\n<div id="Facto-Full-TopBar-Container"></div>\n<div id="Facto-Full-Content-Container"></div>\n<div id="Facto-Full-BottomBar-Container"></div>\n'}],Renderables:[{RenderableHash:"Facto-Full-Layout-Shell",TemplateHash:"Facto-Full-Layout-Shell-Template",DestinationAddress:"#Facto-Full-Application-Container",RenderMethod:"replace"}]};e.exports=class extends i{constructor(t,e,o){super(t,e,o)}onAfterRender(t,e,o,i){return this.pict.views["Facto-Full-TopBar"].render(),this.pict.views["Facto-Full-BottomBar"].render(),this.pict.views["Facto-Full-Dashboard"].render(),this.pict.CSSMap.injectCSS(),super.onAfterRender(t,e,o,i)}},e.exports.default_configuration=n},{"pict-view":41}],53:[function(t,e,o){const i=t("meadow-integration").MeadowMappingEditorView,n={ViewIdentifier:"Facto-Full-MappingEditor",DefaultRenderable:"Facto-Full-MappingEditor-Content",DefaultDestinationAddress:"#Facto-Proj-Mapping-Editor-Container",AutoRender:!1,CSS:i.default_configuration.CSS,Templates:[{Hash:"Facto-Full-MappingEditor-Template",Template:'\n<div>\n\t<div id="MeadowMap-Editor" class="meadow-mapping-editor">\n\t\t<div class="meadow-mapping-header">\n\t\t\t<button class="meadow-mapping-btn meadow-mapping-btn-secondary meadow-mapping-btn-small" onclick="{~P~}.views[\'Facto-Full-MappingEditor\'].closeMappingEditor()">← Back</button>\n\t\t\t<h3 id="MeadowMap-Title">Mapping Editor</h3>\n\t\t\t<div class="meadow-schema-mode-tabs">\n\t\t\t\t<button class="meadow-schema-mode-tab active" id="MeadowMap-Mode-Flow" onclick="{~P~}.views[\'Facto-Full-MappingEditor\'].switchMapMode(\'flow\')">Visual Mapper</button>\n\t\t\t\t<button class="meadow-schema-mode-tab" id="MeadowMap-Mode-JSON" onclick="{~P~}.views[\'Facto-Full-MappingEditor\'].switchMapMode(\'json\')">JSON Config</button>\n\t\t\t</div>\n\t\t</div>\n\n\t\t<div id="MeadowMap-List-Wrap">\n\t\t\t<div style="display:flex; align-items:center; justify-content:space-between; margin-bottom:0.75em;">\n\t\t\t\t<div class="meadow-section-title" style="margin:0;">Existing Mappings</div>\n\t\t\t\t<button class="meadow-mapping-btn meadow-mapping-btn-primary meadow-mapping-btn-small" onclick="{~P~}.views[\'Facto-Full-MappingEditor\'].newMapping()">+ New Mapping</button>\n\t\t\t</div>\n\t\t\t<div id="MeadowMap-List"></div>\n\t\t</div>\n\n\t\t<div id="MeadowMap-Detail" style="display:none;">\n\t\t\t<div style="display:flex; gap:0.5em; align-items:center; margin-bottom:0.75em;">\n\t\t\t\t<label style="font-size:0.78em; font-weight:600;">Mapping Name</label>\n\t\t\t\t<input type="text" id="MeadowMap-Name" placeholder="Mapping name" style="flex:1; padding:0.3em 0.5em; font-size:0.85em; border:1px solid var(--facto-border); border-radius:4px; background:var(--facto-bg-input); color:var(--facto-text);">\n\t\t\t</div>\n\n\t\t\t<div style="display:flex; gap:0.5em; align-items:center; margin-bottom:0.75em;">\n\t\t\t\t<label style="font-size:0.78em; font-weight:600;">Source</label>\n\t\t\t\t<select id="MeadowMap-Source" style="flex:1; padding:0.3em 0.5em; font-size:0.85em; border:1px solid var(--facto-border); border-radius:4px;"></select>\n\t\t\t\t<button class="meadow-mapping-btn meadow-mapping-btn-secondary meadow-mapping-btn-small" onclick="{~P~}.views[\'Facto-Full-MappingEditor\'].discoverSourceFields()">Discover Fields</button>\n\t\t\t</div>\n\n\t\t\t<div id="MeadowMap-Flow-Wrap">\n\t\t\t\t<div id="MeadowMap-Flow-Container" class="meadow-flow-container"></div>\n\t\t\t</div>\n\n\t\t\t<div id="MeadowMap-JSON-Wrap" style="display:none;">\n\t\t\t\t<textarea class="meadow-mapping-json-editor" id="MeadowMap-JSON" placeholder=\'{"Entity":"MyTable","GUIDTemplate":"{~D:Record.IDRecord~}","Mappings":{},"Solvers":[],"ManyfestAddresses":false}\'></textarea>\n\t\t\t</div>\n\n\t\t\t<div style="margin-top:0.75em;">\n\t\t\t\t<div style="font-size:0.72em; font-weight:600; text-transform:uppercase; letter-spacing:0.5px; color:var(--facto-text-tertiary); margin-bottom:0.35em;">Target Stores</div>\n\t\t\t\t<div id="MeadowMap-Stores" class="meadow-mapping-store-checklist"></div>\n\t\t\t</div>\n\n\t\t\t<div style="margin-top:0.75em; display:flex; gap:0.5em; flex-wrap:wrap; align-items:center;">\n\t\t\t\t<button class="meadow-mapping-btn meadow-mapping-btn-primary" onclick="{~P~}.views[\'Facto-Full-MappingEditor\'].saveMapping()">Save Mapping</button>\n\t\t\t</div>\n\t\t</div>\n\t</div>\n</div>\n'}],Renderables:[{RenderableHash:"Facto-Full-MappingEditor-Content",TemplateHash:"Facto-Full-MappingEditor-Template",DestinationAddress:"#Facto-Proj-Mapping-Editor-Container",RenderMethod:"replace"}]};e.exports=class extends i{constructor(t,e,o){super(t,e,o)}_doLoadMappings(t){return this.pict.providers.Facto.loadProjectionMappings(t)}_doLoadSources(){return this.pict.providers.Facto.loadSources()}_doLoadStores(t){return this.pict.providers.Facto.loadProjectionStores(t)}_doLoadTargetSchema(t){return this.pict.providers.Facto.loadProjectionSchema(t)}_doLoadMapping(t){return this.pict.providers.Facto.loadProjectionMapping(t)}_doDeleteMapping(t){return this.pict.providers.Facto.deleteProjectionMapping(t)}_doDiscoverSourceFields(t,e,o){return this.pict.providers.Facto.discoverFields(t,e,o)}_doCreateMapping(t,e){return this.pict.providers.Facto.createProjectionMapping(t,e)}_doUpdateMapping(t,e){return this.pict.providers.Facto.updateProjectionMapping(t,e)}_onClose(){this.pict.views["Facto-Full-ProjectionDetail"].closeMappingEditor()}},e.exports.default_configuration=n},{"meadow-integration":129}],54:[function(t,e,o){const i=t("pict-view"),n=t("./projections/Facto-Projections-Constants.js"),a={ViewIdentifier:"Facto-Full-ProjectionDetail",DefaultRenderable:"Facto-Full-ProjectionDetail-Content",DefaultDestinationAddress:"#Facto-Full-Content-Container",AutoRender:!1,CSS:"\n\t\t.facto-proj-detail-back {\n\t\t\tdisplay: inline-flex;\n\t\t\talign-items: center;\n\t\t\tgap: 0.35em;\n\t\t\tcolor: var(--facto-text-secondary);\n\t\t\tcursor: pointer;\n\t\t\tfont-size: 0.85em;\n\t\t\tmargin-bottom: 0.75em;\n\t\t\ttransition: color 0.15s;\n\t\t}\n\t\t.facto-proj-detail-back:hover {\n\t\t\tcolor: var(--facto-brand);\n\t\t}\n\t\t.facto-proj-detail-title-row {\n\t\t\tdisplay: flex;\n\t\t\talign-items: center;\n\t\t\tjustify-content: space-between;\n\t\t\tmargin-bottom: 1.25em;\n\t\t}\n\t\t.facto-proj-detail-title-row h1 {\n\t\t\tmargin: 0;\n\t\t}\n\t\t.facto-proj-detail-actions {\n\t\t\tdisplay: flex;\n\t\t\tgap: 0.5em;\n\t\t}\n\t\t.facto-proj-meta-cards {\n\t\t\tdisplay: grid;\n\t\t\tgrid-template-columns: repeat(auto-fit, minmax(180px, 1fr));\n\t\t\tgap: 1em;\n\t\t\tmargin-bottom: 1.5em;\n\t\t}\n\t\t.facto-proj-meta-card {\n\t\t\tbackground: var(--facto-bg-card);\n\t\t\tborder: 1px solid var(--facto-border-subtle);\n\t\t\tborder-radius: 8px;\n\t\t\tpadding: 1em;\n\t\t}\n\t\t.facto-proj-meta-card-label {\n\t\t\tfont-size: 0.7em;\n\t\t\tfont-weight: 600;\n\t\t\ttext-transform: uppercase;\n\t\t\tletter-spacing: 0.5px;\n\t\t\tcolor: var(--facto-text-tertiary);\n\t\t\tmargin-bottom: 0.35em;\n\t\t}\n\t\t.facto-proj-meta-card-value {\n\t\t\tfont-size: 1.1em;\n\t\t\tfont-weight: 600;\n\t\t\tcolor: var(--facto-text-heading);\n\t\t}\n\t\t.facto-proj-section {\n\t\t\tmargin-bottom: 1.5em;\n\t\t}\n\t\t.facto-proj-section-header {\n\t\t\tdisplay: flex;\n\t\t\talign-items: center;\n\t\t\tjustify-content: space-between;\n\t\t\tmargin-bottom: 0.75em;\n\t\t}\n\t\t.facto-proj-section-header h2 {\n\t\t\tmargin: 0;\n\t\t\tfont-size: 1em;\n\t\t\ttext-transform: uppercase;\n\t\t\tletter-spacing: 0.05em;\n\t\t\tcolor: var(--facto-text-secondary);\n\t\t}\n\t\t.facto-proj-ddl-preview {\n\t\t\tbackground: var(--facto-bg-code, #f0e8d8);\n\t\t\tborder: 1px solid var(--facto-border-subtle);\n\t\t\tborder-radius: 6px;\n\t\t\tpadding: 0.75em;\n\t\t\tfont-family: 'SF Mono', Consolas, monospace;\n\t\t\tfont-size: 0.82em;\n\t\t\twhite-space: pre-wrap;\n\t\t\tmax-height: 150px;\n\t\t\toverflow: auto;\n\t\t\tcolor: var(--facto-text-secondary);\n\t\t\tmargin-bottom: 0.75em;\n\t\t}\n\t\t.facto-proj-detail-loading {\n\t\t\ttext-align: center;\n\t\t\tpadding: 3em;\n\t\t\tcolor: var(--facto-text-tertiary);\n\t\t}\n\t\t.facto-proj-deploy-form {\n\t\t\tdisplay: grid;\n\t\t\tgrid-template-columns: 1fr 1fr auto auto;\n\t\t\tgap: 0.75em;\n\t\t\talign-items: end;\n\t\t\tpadding: 1em;\n\t\t\tbackground: var(--facto-bg-surface, #fcf8f0);\n\t\t\tborder: 1px solid var(--facto-border, #d6c8ae);\n\t\t\tborder-radius: 8px;\n\t\t\tmargin-bottom: 0.75em;\n\t\t}\n\t\t.facto-proj-deploy-form label {\n\t\t\tdisplay: block;\n\t\t\tfont-size: 0.72em;\n\t\t\tfont-weight: 600;\n\t\t\ttext-transform: uppercase;\n\t\t\tletter-spacing: 0.5px;\n\t\t\tcolor: var(--facto-text-tertiary);\n\t\t\tmargin-bottom: 0.25em;\n\t\t}\n\t\t.facto-proj-deploy-log {\n\t\t\tfont-family: 'SF Mono', monospace;\n\t\t\tfont-size: 0.78em;\n\t\t\tpadding: 0.6em;\n\t\t\tbackground: var(--facto-bg-code, #f0e8d8);\n\t\t\tborder: 1px solid var(--facto-border-subtle, #e8ddc8);\n\t\t\tborder-radius: 6px;\n\t\t\twhite-space: pre-wrap;\n\t\t\tmax-height: 200px;\n\t\t\toverflow: auto;\n\t\t\tmargin-top: 0.5em;\n\t\t\tcolor: var(--facto-text-secondary);\n\t\t}\n\t\t.facto-proj-import-form {\n\t\t\tdisplay: grid;\n\t\t\tgrid-template-columns: 1fr 1fr auto auto;\n\t\t\tgap: 0.75em;\n\t\t\talign-items: end;\n\t\t\tpadding: 1em;\n\t\t\tbackground: var(--facto-bg-surface, #fcf8f0);\n\t\t\tborder: 1px solid var(--facto-border, #d6c8ae);\n\t\t\tborder-radius: 8px;\n\t\t\tmargin-bottom: 0.75em;\n\t\t}\n\t\t.facto-proj-import-form label {\n\t\t\tdisplay: block;\n\t\t\tfont-size: 0.72em;\n\t\t\tfont-weight: 600;\n\t\t\ttext-transform: uppercase;\n\t\t\tletter-spacing: 0.5px;\n\t\t\tcolor: var(--facto-text-tertiary);\n\t\t\tmargin-bottom: 0.25em;\n\t\t}\n\t\t.facto-proj-import-stage-row {\n\t\t\tdisplay: flex;\n\t\t\talign-items: center;\n\t\t\tgap: 0.5em;\n\t\t\tgrid-column: 1 / -1;\n\t\t}\n\t\t.facto-proj-import-stage-row label {\n\t\t\ttext-transform: none;\n\t\t\tfont-size: 0.82em;\n\t\t\tmargin-bottom: 0;\n\t\t\tcursor: pointer;\n\t\t}\n\t\t.facto-proj-import-staging-link {\n\t\t\tdisplay: inline-block;\n\t\t\tmargin-top: 0.5em;\n\t\t\tfont-size: 0.82em;\n\t\t\tcolor: var(--facto-brand);\n\t\t\tcursor: pointer;\n\t\t\ttext-decoration: underline;\n\t\t}\n\t",Templates:[{Hash:"Facto-Full-ProjectionDetail-Template",Template:'\n<div class="facto-content">\n\t<div class="facto-proj-detail-back" onclick="{~P~}.views[\'Facto-Full-ProjectionDetail\'].goBack()">\n\t\t← Back to Projections\n\t</div>\n\n\t<div id="Facto-ProjectionDetail-Loading" class="facto-proj-detail-loading">Loading projection...</div>\n\n\t<div id="Facto-ProjectionDetail-Container" style="display:none;">\n\t\t<div class="facto-proj-detail-title-row">\n\t\t\t<h1 id="Facto-ProjectionDetail-Title"></h1>\n\t\t\t<div class="facto-proj-detail-actions">\n\t\t\t\t<button class="facto-btn facto-btn-primary" onclick="{~P~}.views[\'Facto-Full-ProjectionDetail\'].editSchema()">Edit Schema</button>\n\t\t\t\t<button class="facto-btn facto-btn-secondary" onclick="{~P~}.views[\'Facto-Full-ProjectionDetail\'].editMappings()">Mappings</button>\n\t\t\t\t<button class="facto-btn facto-btn-secondary" onclick="{~P~}.views[\'Facto-Full-ProjectionDetail\'].showQuery()">Query</button>\n\t\t\t\t<button class="facto-btn facto-btn-danger" onclick="{~P~}.views[\'Facto-Full-ProjectionDetail\'].deleteProjection()">Delete</button>\n\t\t\t</div>\n\t\t</div>\n\n\t\t<div id="Facto-ProjectionDetail-Meta" class="facto-proj-meta-cards"></div>\n\n\t\t<div class="facto-proj-section">\n\t\t\t<div class="facto-proj-section-header">\n\t\t\t\t<h2>Schema</h2>\n\t\t\t\t<button class="facto-btn facto-btn-primary facto-btn-small" onclick="{~P~}.views[\'Facto-Full-ProjectionDetail\'].editSchema()">Edit Schema</button>\n\t\t\t</div>\n\t\t\t<div id="Facto-ProjectionDetail-Schema"></div>\n\t\t</div>\n\n\t\t<div class="facto-proj-section">\n\t\t\t<div class="facto-proj-section-header">\n\t\t\t\t<h2>Deployed Stores</h2>\n\t\t\t\t<button class="facto-btn facto-btn-primary facto-btn-small" onclick="{~P~}.views[\'Facto-Full-ProjectionDetail\'].showDeployForm()">+ Deploy to Store</button>\n\t\t\t</div>\n\t\t\t<div id="Facto-ProjectionDetail-Deploy" style="display:none;">\n\t\t\t\t<div class="facto-proj-deploy-form">\n\t\t\t\t\t<div>\n\t\t\t\t\t\t<label>Connection</label>\n\t\t\t\t\t\t<select id="Facto-ProjectionDetail-Deploy-Connection"></select>\n\t\t\t\t\t</div>\n\t\t\t\t\t<div>\n\t\t\t\t\t\t<label>Table Name</label>\n\t\t\t\t\t\t<input type="text" id="Facto-ProjectionDetail-Deploy-TableName" placeholder="e.g. Schools">\n\t\t\t\t\t</div>\n\t\t\t\t\t<div>\n\t\t\t\t\t\t<button class="facto-btn facto-btn-primary facto-btn-small" onclick="{~P~}.views[\'Facto-Full-ProjectionDetail\'].deployToStore()">Deploy</button>\n\t\t\t\t\t</div>\n\t\t\t\t\t<div>\n\t\t\t\t\t\t<button class="facto-btn facto-btn-secondary facto-btn-small" onclick="{~P~}.views[\'Facto-Full-ProjectionDetail\'].hideDeployForm()">Cancel</button>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t\t<div id="Facto-ProjectionDetail-Deploy-Log" class="facto-proj-deploy-log" style="display:none;"></div>\n\t\t\t</div>\n\t\t\t<div id="Facto-ProjectionDetail-Stores"></div>\n\t\t</div>\n\n\t\t<div class="facto-proj-section">\n\t\t\t<div class="facto-proj-section-header">\n\t\t\t\t<h2>Mappings</h2>\n\t\t\t\t<button class="facto-btn facto-btn-primary facto-btn-small" onclick="{~P~}.views[\'Facto-Full-ProjectionDetail\'].editMappings()">Manage Mappings</button>\n\t\t\t</div>\n\t\t\t<div id="Facto-ProjectionDetail-Mappings"></div>\n\t\t</div>\n\n\t\t<div class="facto-proj-section">\n\t\t\t<div class="facto-proj-section-header">\n\t\t\t\t<h2>Import Data</h2>\n\t\t\t</div>\n\t\t\t<div id="Facto-ProjectionDetail-Import"></div>\n\t\t</div>\n\t</div>\n\n\t<div id="Facto-Proj-Schema-Editor-Container" style="display:none;"></div>\n\t<div id="Facto-Proj-Mapping-Editor-Container" style="display:none;"></div>\n\t<div id="Facto-Proj-Query-Container" style="display:none;"></div>\n</div>\n'}],Renderables:[{RenderableHash:"Facto-Full-ProjectionDetail-Content",TemplateHash:"Facto-Full-ProjectionDetail-Template",DestinationAddress:"#Facto-Full-Content-Container",RenderMethod:"replace"}]};e.exports=class extends i{constructor(t,e,o){super(t,e,o),this._CurrentIDDataset=null,this._ProjectionData=null,this._Schema=null,this._Stores=[],this._Mappings=[],this._Sources=[],this._Connections=[],this._Stats=null}loadProjection(t){this._CurrentIDDataset=parseInt(t,10)||0,this._ProjectionData=null,this._Schema=null,this._Stores=[],this._Mappings=[],this._Sources=[],this._Connections=[],this._Stats=null,this.render()}onAfterRender(t,e,o,i){return this._CurrentIDDataset&&this._fetchAndDisplayProjection(),super.onAfterRender(t,e,o,i)}_fetchAndDisplayProjection(){let t=document.getElementById("Facto-ProjectionDetail-Loading"),e=document.getElementById("Facto-ProjectionDetail-Container");t&&(t.style.display="block"),e&&(e.style.display="none"),Promise.all([this.pict.providers.Facto.loadProjections(),this.pict.providers.Facto.loadProjectionSchema(this._CurrentIDDataset),this.pict.providers.Facto.loadProjectionStores(this._CurrentIDDataset),this.pict.providers.Facto.loadProjectionMappings(this._CurrentIDDataset),this.pict.providers.Facto.loadSources(),this.pict.providers.Facto.loadDatasetStats(this._CurrentIDDataset),this.pict.providers.Facto.loadStoreConnections()]).then(t=>{let e=t[0]&&t[0].Projections?t[0].Projections:[];this._ProjectionData=null;for(let t=0;t<e.length;t++)if(e[t].IDDataset==this._CurrentIDDataset){this._ProjectionData=e[t];break}this._Schema=t[1]||{},this._Stores=t[2]&&t[2].Stores?t[2].Stores:[],this._Mappings=t[3]&&t[3].Mappings?t[3].Mappings:[],this._Sources=Array.isArray(t[4])?t[4]:[],this._Stats=t[5]||{},this._Connections=t[6]&&t[6].Connections?t[6].Connections:[],this._renderProjectionDetail()})}_renderProjectionDetail(){let t=document.getElementById("Facto-ProjectionDetail-Loading"),e=document.getElementById("Facto-ProjectionDetail-Container");t&&(t.style.display="none"),e&&(e.style.display="block");let o=this._ProjectionData||{},i=document.getElementById("Facto-ProjectionDetail-Title");i&&(i.textContent=o.Name||"Projection #"+this._CurrentIDDataset),window.history.replaceState(null,"","#/Projection/"+this._CurrentIDDataset),this._renderMetaCards(),this._renderSchemaSection(),this._renderStoresSection(),this._renderMappingsSection(),this._renderImportSection()}_renderMetaCards(){let t=document.getElementById("Facto-ProjectionDetail-Meta");if(!t)return;let e=this._ProjectionData||{},o=this._Schema||{},i=this._Stats||{},a=0;if(o.SchemaDefinition){a=n.microDDLToColumns(o.SchemaDefinition).length}let r="";r+='<div class="facto-proj-meta-card"><div class="facto-proj-meta-card-label">Dataset ID</div><div class="facto-proj-meta-card-value">'+(e.IDDataset||this._CurrentIDDataset)+"</div></div>",r+='<div class="facto-proj-meta-card"><div class="facto-proj-meta-card-label">Schema Version</div><div class="facto-proj-meta-card-value">v'+(o.SchemaVersion||e.SchemaVersion||0)+"</div></div>",r+='<div class="facto-proj-meta-card"><div class="facto-proj-meta-card-label">Columns</div><div class="facto-proj-meta-card-value">'+a+"</div></div>",r+='<div class="facto-proj-meta-card"><div class="facto-proj-meta-card-label">Stores</div><div class="facto-proj-meta-card-value">'+this._Stores.length+"</div></div>",r+='<div class="facto-proj-meta-card"><div class="facto-proj-meta-card-label">Mappings</div><div class="facto-proj-meta-card-value">'+this._Mappings.length+"</div></div>",r+='<div class="facto-proj-meta-card"><div class="facto-proj-meta-card-label">Records</div><div class="facto-proj-meta-card-value">'+(i.RecordCount||0)+"</div></div>",t.innerHTML=r}_renderSchemaSection(){let t=document.getElementById("Facto-ProjectionDetail-Schema");if(!t)return;let e=(this._Schema||{}).SchemaDefinition||"";if(!e)return void(t.innerHTML='<div class="facto-card" style="text-align:center; padding:1.5em; color:var(--facto-text-tertiary);">No schema defined yet. Click "Edit Schema" to create one.</div>');let o="";o+='<div class="facto-proj-ddl-preview">'+this._escapeHtml(e)+"</div>",t.innerHTML=o}_renderStoresSection(){let t=document.getElementById("Facto-ProjectionDetail-Stores");if(!t)return;if(0===this._Stores.length)return void(t.innerHTML='<div class="facto-card" style="text-align:center; padding:1.5em; color:var(--facto-text-tertiary);">No stores deployed yet. Click "+ Deploy to Store" to create one.</div>');let e={};for(let t=0;t<this._Connections.length;t++)e[this._Connections[t].IDStoreConnection]=this._Connections[t];let o='<table class="facto-table"><thead><tr>';o+="<th>ID</th><th>Connection</th><th>Target Table</th><th>Status</th><th>Deployed At</th><th>Actions</th>",o+="</tr></thead><tbody>";for(let t=0;t<this._Stores.length;t++){let i=this._Stores[t],n=e[i.IDStoreConnection]||{},a=n.Name?n.Name+" ("+(n.Type||"")+")":"#"+(i.IDStoreConnection||"?"),r="Deployed"===i.Status?"deployed":"Failed"===i.Status?"failed":"pending",s=i.DeployedAt?new Date(i.DeployedAt).toLocaleString():"—";o+="<tr>",o+="<td>"+(i.IDProjectionStore||"")+"</td>",o+="<td>"+this._escapeHtml(a)+"</td>",o+="<td><strong>"+(i.TargetTableName||"—")+"</strong></td>",o+='<td><span class="facto-status-badge '+r+'">'+(i.Status||"Unknown")+"</span></td>",o+="<td>"+s+"</td>",o+="<td>",o+='<button class="facto-btn facto-btn-secondary facto-btn-small" onclick="pict.views[\'Facto-Full-ProjectionDetail\'].redeployStore('+i.IDProjectionStore+", "+i.IDStoreConnection+", '"+(i.TargetTableName||"").replace(/'/g,"\\'")+"')\">Redeploy</button>",o+="</td>",o+="</tr>"}o+="</tbody></table>",t.innerHTML=o}_renderMappingsSection(){let t=document.getElementById("Facto-ProjectionDetail-Mappings");if(!t)return;if(0===this._Mappings.length)return void(t.innerHTML='<div class="facto-card" style="text-align:center; padding:1.5em; color:var(--facto-text-tertiary);">No mappings yet. Create a mapping to link source data to this projection.</div>');let e={};for(let t=0;t<this._Sources.length;t++)e[this._Sources[t].IDSource]=this._Sources[t].Name||this._Sources[t].Hash||"#"+this._Sources[t].IDSource;let o={};for(let t=0;t<this._Stores.length;t++)o[this._Stores[t].IDProjectionStore]=this._Stores[t].TargetTableName||"Store "+this._Stores[t].IDProjectionStore;let i='<table class="facto-table"><thead><tr>';i+="<th>ID</th><th>Name</th><th>Source</th><th>Target Stores</th><th>Active</th>",i+="</tr></thead><tbody>";for(let t=0;t<this._Mappings.length;t++){let n=this._Mappings[t],a=e[n.IDSource]||"#"+(n.IDSource||"?"),r=n.Active?'<span class="facto-badge facto-badge-success">✔</span>':'<span class="facto-badge facto-badge-muted">✘</span>',s=[];try{let t=JSON.parse(n.MappingConfiguration||"{}");if(Array.isArray(t.TargetStores))for(let e=0;e<t.TargetStores.length;e++)s.push(o[t.TargetStores[e]]||"#"+t.TargetStores[e])}catch(t){}0===s.length&&n.IDProjectionStore&&s.push(o[n.IDProjectionStore]||"#"+n.IDProjectionStore);let l=s.length>0?s.join(", "):"—";i+="<tr>",i+="<td>"+(n.IDProjectionMapping||"")+"</td>",i+="<td><strong>"+(n.Name||"—")+"</strong></td>",i+="<td>"+this._escapeHtml(a)+"</td>",i+="<td>"+this._escapeHtml(l)+"</td>",i+="<td>"+r+"</td>",i+="</tr>"}i+="</tbody></table>",t.innerHTML=i}showDeployForm(){let t=document.getElementById("Facto-ProjectionDetail-Deploy");t&&(t.style.display="");let e=document.getElementById("Facto-ProjectionDetail-Deploy-Connection");if(e){let t='<option value="">Select a connection...</option>';for(let e=0;e<this._Connections.length;e++){let o=this._Connections[e];t+='<option value="'+o.IDStoreConnection+'">'+this._escapeHtml(o.Name||"Untitled")+" ("+(o.Type||"")+")</option>"}e.innerHTML=t}let o=document.getElementById("Facto-ProjectionDetail-Deploy-TableName");if(o&&!o.value){let t=this._ProjectionData?this._ProjectionData.Name:"Projection";o.value=(t||"Projection").replace(/[^a-zA-Z0-9_]/g,"_")}let i=document.getElementById("Facto-ProjectionDetail-Deploy-Log");i&&(i.style.display="none")}hideDeployForm(){let t=document.getElementById("Facto-ProjectionDetail-Deploy");t&&(t.style.display="none")}deployToStore(){let t=document.getElementById("Facto-ProjectionDetail-Deploy-Connection"),e=document.getElementById("Facto-ProjectionDetail-Deploy-TableName"),o=document.getElementById("Facto-ProjectionDetail-Deploy-Log"),i=t?parseInt(t.value,10):0,n=e?e.value.trim():"";i?n?(o&&(o.style.display="block",o.textContent="Deploying..."),this.pict.providers.Facto.deployProjection(this._CurrentIDDataset,i,n).then(t=>{if(o)if(t&&t.Log)o.textContent=t.Log;else{if(t&&t.Error)return o.textContent="ERROR: "+t.Error,void this.pict.views["Pict-Section-Modal"].toast("Deploy failed: "+t.Error,{type:"error"});o.textContent="Deployment complete."}this.pict.views["Pict-Section-Modal"].toast("Store deployed successfully.",{type:"success"}),this.pict.providers.Facto.loadProjectionStores(this._CurrentIDDataset).then(t=>{this._Stores=t&&t.Stores?t.Stores:[],this._renderStoresSection(),this._renderMetaCards()})})):this.pict.views["Pict-Section-Modal"].toast("Enter a table name.",{type:"warning"}):this.pict.views["Pict-Section-Modal"].toast("Select a connection first.",{type:"warning"})}async redeployStore(t,e,o){if(!await this.pict.views["Pict-Section-Modal"].confirm('Redeploy schema to "'+o+'"? This will update the table structure.',{title:"Redeploy Schema",confirmLabel:"Redeploy",dangerous:!0}))return;let i=document.getElementById("Facto-ProjectionDetail-Deploy-Log"),n=document.getElementById("Facto-ProjectionDetail-Deploy");n&&(n.style.display=""),i&&(i.style.display="block",i.textContent="Redeploying..."),this.pict.providers.Facto.deployProjection(this._CurrentIDDataset,e,o).then(t=>{if(i)if(t&&t.Log)i.textContent=t.Log;else{if(t&&t.Error)return i.textContent="ERROR: "+t.Error,void this.pict.views["Pict-Section-Modal"].toast("Redeploy failed: "+t.Error,{type:"error"});i.textContent="Redeployment complete."}this.pict.views["Pict-Section-Modal"].toast("Store redeployed successfully.",{type:"success"}),this.pict.providers.Facto.loadProjectionStores(this._CurrentIDDataset).then(t=>{this._Stores=t&&t.Stores?t.Stores:[],this._renderStoresSection(),this._renderMetaCards()})})}_renderImportSection(){let t=document.getElementById("Facto-ProjectionDetail-Import");if(!t)return;if(0===this._Mappings.length||0===this._Stores.length)return void(t.innerHTML='<div class="facto-card" style="text-align:center; padding:1.5em; color:var(--facto-text-tertiary);">Configure at least one mapping and deploy a store before importing data.</div>');let e='<div class="facto-proj-import-form">';e+="<div>",e+="<label>Mapping</label>",e+='<select id="Facto-ProjectionDetail-Import-Mapping" onchange="pict.views[\'Facto-Full-ProjectionDetail\']._onImportMappingChange()">';for(let t=0;t<this._Mappings.length;t++){let o=this._Mappings[t];e+='<option value="'+o.IDProjectionMapping+'">'+this._escapeHtml(o.Name||"Mapping #"+o.IDProjectionMapping)+"</option>"}e+="</select>",e+="</div>",e+="<div>",e+="<label>Target Store</label>",e+='<select id="Facto-ProjectionDetail-Import-Store">';for(let t=0;t<this._Stores.length;t++){let o=this._Stores[t];e+='<option value="'+o.IDProjectionStore+'">'+this._escapeHtml(o.TargetTableName||"Store #"+o.IDProjectionStore)+"</option>"}e+="</select>",e+="</div>",e+="<div>",e+='<button class="facto-btn facto-btn-primary facto-btn-small" onclick="pict.views[\'Facto-Full-ProjectionDetail\'].runImport()">Run Import</button>',e+="</div>",e+="<div></div>",e+='<div class="facto-proj-import-stage-row">',e+='<input type="checkbox" id="Facto-ProjectionDetail-Import-Stage">',e+='<label for="Facto-ProjectionDetail-Import-Stage">Stage comprehension for inspection</label>',e+="</div>",e+="</div>",e+='<div id="Facto-ProjectionDetail-Import-Log" class="facto-proj-deploy-log" style="display:none;"></div>',e+='<div id="Facto-ProjectionDetail-Import-Staging"></div>',t.innerHTML=e,this._Mappings.length>0&&this._onImportMappingChange()}_onImportMappingChange(){let t=document.getElementById("Facto-ProjectionDetail-Import-Mapping"),e=document.getElementById("Facto-ProjectionDetail-Import-Store");if(!t||!e)return;let o=parseInt(t.value,10),i=null;for(let t=0;t<this._Mappings.length;t++)if(this._Mappings[t].IDProjectionMapping==o){try{let e=JSON.parse(this._Mappings[t].MappingConfiguration||"{}");Array.isArray(e.TargetStores)&&e.TargetStores.length>0&&(i=e.TargetStores)}catch(t){}break}let n="";for(let t=0;t<this._Stores.length;t++){let e=this._Stores[t];i&&-1===i.indexOf(e.IDProjectionStore)||(n+='<option value="'+e.IDProjectionStore+'">'+this._escapeHtml(e.TargetTableName||"Store #"+e.IDProjectionStore)+"</option>")}e.innerHTML=n}runImport(){let t=document.getElementById("Facto-ProjectionDetail-Import-Mapping"),e=document.getElementById("Facto-ProjectionDetail-Import-Store"),o=document.getElementById("Facto-ProjectionDetail-Import-Stage"),i=document.getElementById("Facto-ProjectionDetail-Import-Log"),n=document.getElementById("Facto-ProjectionDetail-Import-Staging"),a=t?parseInt(t.value,10):0,r=e?parseInt(e.value,10):0,s=!!o&&o.checked;a?r?(i&&(i.style.display="block",i.textContent="Running import..."),n&&(n.innerHTML=""),this.pict.providers.Facto.executeImport(this._CurrentIDDataset,a,r,100,s).then(t=>{if(i)if(t&&t.Log)i.textContent=t.Log;else{if(t&&t.Error)return i.textContent="ERROR: "+t.Error,void this.pict.views["Pict-Section-Modal"].toast("Import failed: "+t.Error,{type:"error"});i.textContent="Import complete."}if(t&&t.Success?this.pict.views["Pict-Section-Modal"].toast("Import complete: "+(t.RecordsCreated||0)+" records created.",{type:"success"}):t&&t.RecordsErrored>0&&this.pict.views["Pict-Section-Modal"].toast("Import completed with "+t.RecordsErrored+" errors.",{type:"warning"}),t&&t.StagingFile&&n){let e="/facto/projection/"+this._CurrentIDDataset+"/comprehension/"+t.StagingFile;n.innerHTML='<a class="facto-proj-import-staging-link" href="'+e+'" target="_blank">Download staged comprehension: '+this._escapeHtml(t.StagingFile)+"</a>"}}).catch(t=>{i&&(i.style.display="block",i.textContent="ERROR: "+(t.message||t)),this.pict.views["Pict-Section-Modal"].toast("Import failed.",{type:"error"})})):this.pict.views["Pict-Section-Modal"].toast("Select a target store first.",{type:"warning"}):this.pict.views["Pict-Section-Modal"].toast("Select a mapping first.",{type:"warning"})}editSchema(){let t=document.getElementById("Facto-ProjectionDetail-Container"),e=document.querySelector(".facto-proj-detail-back"),o=document.getElementById("Facto-Proj-Schema-Editor-Container");t&&(t.style.display="none"),e&&(e.style.display="none"),o&&(o.style.display="");let i=this._ProjectionData?this._ProjectionData.Name:"";this.pict.views["Facto-Full-SchemaEditor"].editSchema(this._CurrentIDDataset,i)}closeSchemaEditor(){let t=document.getElementById("Facto-ProjectionDetail-Container"),e=document.querySelector(".facto-proj-detail-back"),o=document.getElementById("Facto-Proj-Schema-Editor-Container");t&&(t.style.display=""),e&&(e.style.display=""),o&&(o.style.display="none"),this.pict.providers.Facto.loadProjectionSchema(this._CurrentIDDataset).then(t=>{this._Schema=t||{},this._renderSchemaSection(),this._renderMetaCards()})}onSchemaUpdated(t){this._ProjectionData&&(this._ProjectionData.SchemaVersion=t)}editMappings(){let t=document.getElementById("Facto-ProjectionDetail-Container"),e=document.querySelector(".facto-proj-detail-back"),o=document.getElementById("Facto-Proj-Mapping-Editor-Container");t&&(t.style.display="none"),e&&(e.style.display="none"),o&&(o.style.display="");let i=this._ProjectionData?this._ProjectionData.Name:"";this.pict.views["Facto-Full-MappingEditor"].editMappings(this._CurrentIDDataset,i)}closeMappingEditor(){let t=document.getElementById("Facto-ProjectionDetail-Container"),e=document.querySelector(".facto-proj-detail-back"),o=document.getElementById("Facto-Proj-Mapping-Editor-Container");t&&(t.style.display=""),e&&(e.style.display=""),o&&(o.style.display="none"),Promise.all([this.pict.providers.Facto.loadProjectionMappings(this._CurrentIDDataset),this.pict.providers.Facto.loadProjectionStores(this._CurrentIDDataset)]).then(t=>{this._Mappings=t[0]&&t[0].Mappings?t[0].Mappings:[],this._Stores=t[1]&&t[1].Stores?t[1].Stores:[],this._renderMappingsSection(),this._renderStoresSection(),this._renderMetaCards()})}showQuery(){let t=document.getElementById("Facto-ProjectionDetail-Container"),e=document.querySelector(".facto-proj-detail-back"),o=document.getElementById("Facto-Proj-Query-Container");t&&(t.style.display="none"),e&&(e.style.display="none"),o&&(o.style.display="");let i=this.pict.views["Facto-Full-QueryPanel"];i&&i.render()}closeQuery(){let t=document.getElementById("Facto-ProjectionDetail-Container"),e=document.querySelector(".facto-proj-detail-back"),o=document.getElementById("Facto-Proj-Query-Container");t&&(t.style.display=""),e&&(e.style.display=""),o&&(o.style.display="none")}async deleteProjection(){let t=this._ProjectionData?this._ProjectionData.Name:this._CurrentIDDataset;await this.pict.views["Pict-Section-Modal"].confirm('Delete projection "'+t+'"? This will remove the dataset and all associated mappings and stores.',{title:"Delete Projection",confirmLabel:"Delete",dangerous:!0})&&this.pict.providers.Facto.deleteProjection(this._CurrentIDDataset).then(t=>{t&&t.Error?this.pict.views["Pict-Section-Modal"].toast("Error deleting projection: "+t.Error,{type:"error"}):(this.pict.views["Pict-Section-Modal"].toast("Projection deleted.",{type:"success"}),this.pict.PictApplication.navigateTo("/Projections"))})}refresh(){this._CurrentIDDataset&&this._fetchAndDisplayProjection()}goBack(){this.pict.PictApplication.navigateTo("/Projections")}_escapeHtml(t){let e=document.createElement("div");return e.textContent=t,e.innerHTML}},e.exports.default_configuration=a},{"./projections/Facto-Projections-Constants.js":67,"pict-view":41}],55:[function(t,e,o){const i=t("pict-view"),n={ViewIdentifier:"Facto-Full-Projections",DefaultRenderable:"Facto-Full-Projections-Content",DefaultDestinationAddress:"#Facto-Full-Content-Container",AutoRender:!1,CSS:"",Templates:[{Hash:"Facto-Full-Projections-Template",Template:'\n<div class="facto-content">\n\t<div class="facto-content-header">\n\t\t<h1>Projections</h1>\n\t\t<p>Define schemas and deploy projections to external stores.</p>\n\t</div>\n\n\t<div style="display:flex; align-items:center; justify-content:space-between; margin-bottom:1em;">\n\t\t<div class="facto-section-title" style="margin:0;">Projection Datasets</div>\n\t\t<button class="facto-btn facto-btn-primary" onclick="{~P~}.views[\'Facto-Full-Projections\'].createProjection()">+ New Projection</button>\n\t</div>\n\t<div id="Facto-Proj-List"></div>\n</div>\n'}],Renderables:[{RenderableHash:"Facto-Full-Projections-Content",TemplateHash:"Facto-Full-Projections-Template",DestinationAddress:"#Facto-Full-Content-Container",RenderMethod:"replace"}]};e.exports=class extends i{constructor(t,e,o){super(t,e,o),this.pict.AppData.Facto&&(this.pict.AppData.Facto.Projections=[])}onAfterRender(t,e,o,i){return this.pict.providers.Facto.loadProjections().then(()=>{this.refreshProjectionList()}).catch(t=>{this.pict.views["Pict-Section-Modal"].toast("Error loading projections: "+t.message,{type:"error"})}),super.onAfterRender(t,e,o,i)}refreshProjectionList(){let t=document.getElementById("Facto-Proj-List");if(!t)return;if(0===this.pict.AppData.Facto.Projections.length)return void(t.innerHTML='<div class="facto-card" style="text-align:center; padding:2em; color:var(--facto-text-tertiary);">No projection datasets yet. Create one to get started.</div>');let e='<table class="facto-table"><thead><tr>';e+="<th>ID</th><th>Name</th><th>Schema Ver.</th><th>Actions</th>",e+="</tr></thead><tbody>";for(let t=0;t<this.pict.AppData.Facto.Projections.length;t++){let o=this.pict.AppData.Facto.Projections[t];e+="<tr>",e+="<td>"+o.IDDataset+"</td>",e+="<td><strong>"+(o.Name||"—")+"</strong></td>",e+="<td>v"+(o.SchemaVersion||0)+"</td>",e+="<td>",e+='<button class="facto-btn facto-btn-primary facto-btn-small" onclick="pict.PictApplication.navigateTo(\'/Projection/'+o.IDDataset+"')\">View</button> ",e+='<button class="facto-btn facto-btn-danger facto-btn-small" onclick="pict.views[\'Facto-Full-Projections\'].deleteProjection('+o.IDDataset+", '"+(o.Name||"").replace(/'/g,"\\'")+"')\">Delete</button>",e+="</td>",e+="</tr>"}e+="</tbody></table>",t.innerHTML=e}createProjection(){let t=prompt("Projection name:");t&&this.pict.providers.Facto.createDataset({Name:t,Type:"Projection",Description:"Projection dataset"}).then(t=>{t&&t.Error?this.pict.views["Pict-Section-Modal"].toast("Error: "+t.Error,{type:"error"}):t&&t.IDDataset?this.pict.PictApplication.navigateTo("/Projection/"+t.IDDataset):this.pict.providers.Facto.loadProjections().then(t=>{this.pict.AppData.Facto.Projections=t&&t.Projections?t.Projections:[],this.refreshProjectionList()})})}async deleteProjection(t,e){await this.pict.views["Pict-Section-Modal"].confirm('Delete projection "'+(e||t)+'"? This will remove the dataset and all associated mappings and stores.',{title:"Delete Projection",confirmLabel:"Delete",dangerous:!0})&&this.pict.providers.Facto.deleteProjection(t).then(t=>{t&&t.Error?this.pict.views["Pict-Section-Modal"].toast("Error deleting projection: "+t.Error,{type:"error"}):(this.pict.views["Pict-Section-Modal"].toast("Projection deleted.",{type:"success"}),this.pict.providers.Facto.loadProjections().then(t=>{this.pict.AppData.Facto.Projections=t&&t.Projections?t.Projections:[],this.refreshProjectionList()}))})}},e.exports.default_configuration=n},{"pict-view":41}],56:[function(t,e,o){const i=t("pict-view"),n={ViewIdentifier:"Facto-Full-QueryPanel",DefaultRenderable:"Facto-Full-QueryPanel-Content",DefaultDestinationAddress:"#Facto-Proj-Query-Container",AutoRender:!1,CSS:"",Templates:[{Hash:"Facto-Full-QueryPanel-Template",Template:'\n<div>\n\t<div style="margin-bottom:1em;">\n\t\t<button class="facto-btn facto-btn-secondary facto-btn-small" onclick="{~P~}.views[\'Facto-Full-ProjectionDetail\'].closeQuery()">← Back to Projection</button>\n\t</div>\n\n\t<div class="facto-section">\n\t\t<div class="facto-section-title">Warehouse Summary</div>\n\t\t<div id="Facto-Full-Projections-Summary" class="facto-card-grid"></div>\n\t</div>\n\n\t<div class="facto-section" style="margin-top:1.5em;">\n\t\t<div class="facto-section-title">Query Records</div>\n\t\t<div class="facto-inline-group">\n\t\t\t<div>\n\t\t\t\t<label>Dataset ID</label>\n\t\t\t\t<input type="number" id="Facto-Full-Proj-DatasetID" placeholder="e.g. 1">\n\t\t\t</div>\n\t\t\t<div>\n\t\t\t\t<label>Type Filter</label>\n\t\t\t\t<select id="Facto-Full-Proj-Type">\n\t\t\t\t\t<option value="">All</option>\n\t\t\t\t\t<option value="Raw">Raw</option>\n\t\t\t\t\t<option value="Compositional">Compositional</option>\n\t\t\t\t\t<option value="Projection">Projection</option>\n\t\t\t\t</select>\n\t\t\t</div>\n\t\t</div>\n\t\t<button class="facto-btn facto-btn-primary" onclick="{~P~}.views[\'Facto-Full-QueryPanel\'].runQuery()">Run Query</button>\n\t\t<button class="facto-btn facto-btn-secondary" onclick="{~P~}.views[\'Facto-Full-QueryPanel\'].runAggregate()">Aggregate</button>\n\t</div>\n\t<div id="Facto-Full-Projections-Results" class="facto-projection-results" style="display:none;"></div>\n</div>\n'}],Renderables:[{RenderableHash:"Facto-Full-QueryPanel-Content",TemplateHash:"Facto-Full-QueryPanel-Template",DestinationAddress:"#Facto-Proj-Query-Container",RenderMethod:"replace"}]};e.exports=class extends i{constructor(t,e,o){super(t,e,o)}runQuery(){let t=parseInt(this.pict.providers.FactoUI.getVal("Facto-Full-Proj-DatasetID"))||0,e=this.pict.providers.FactoUI.getVal("Facto-Full-Proj-Type"),o={};t&&(o.IDDataset=t),e&&(o.Type=e),this.pict.providers.Facto.queryRecords(o).then(t=>{this._showResults("Query Results",t)})}runAggregate(){let t=parseInt(this.pict.providers.FactoUI.getVal("Facto-Full-Proj-DatasetID"))||0,e={};t&&(e.IDDataset=t),this.pict.providers.Facto.aggregateRecords(e).then(t=>{this._showResults("Aggregate Results",t)})}_showResults(t,e){let o=document.getElementById("Facto-Full-Projections-Results");if(!o)return;o.style.display="block";let i="<h3>"+t+" ("+(e&&e.Records?e.Records.length:e&&e.Aggregations?e.Aggregations.length:0)+")</h3>";i+="<pre>"+JSON.stringify(e,null,2)+"</pre>",i+='<button class="facto-btn facto-btn-secondary" style="margin-top:0.5em;" onclick="document.getElementById(\'Facto-Full-Projections-Results\').style.display=\'none\'">Close</button>',o.innerHTML=i}},e.exports.default_configuration=n},{"pict-view":41}],57:[function(t,e,o){const i=t("pict-view"),n=t("pict-section-objecteditor"),a={ViewIdentifier:"Facto-Full-RecordViewer",DefaultRenderable:"Facto-Full-RecordViewer-Content",DefaultDestinationAddress:"#Facto-Full-Content-Container",AutoRender:!1,CSS:"\n\t\t.facto-record-viewer-back {\n\t\t\tdisplay: inline-flex;\n\t\t\talign-items: center;\n\t\t\tgap: 0.35em;\n\t\t\tcolor: var(--facto-text-secondary);\n\t\t\tcursor: pointer;\n\t\t\tfont-size: 0.85em;\n\t\t\tmargin-bottom: 0.75em;\n\t\t\ttransition: color 0.15s;\n\t\t}\n\t\t.facto-record-viewer-back:hover {\n\t\t\tcolor: var(--facto-brand);\n\t\t}\n\t\t.facto-record-meta {\n\t\t\tdisplay: grid;\n\t\t\tgrid-template-columns: repeat(auto-fill, minmax(260px, 1fr));\n\t\t\tgap: 1em;\n\t\t\tmargin-bottom: 1.5em;\n\t\t}\n\t\t.facto-record-meta-card {\n\t\t\tbackground: var(--facto-bg-elevated, #1a1e2a);\n\t\t\tborder: 1px solid var(--facto-border-subtle, #2a2e3a);\n\t\t\tborder-radius: 8px;\n\t\t\tpadding: 1em;\n\t\t}\n\t\t.facto-record-meta-card h3 {\n\t\t\tmargin: 0 0 0.5em;\n\t\t\tfont-size: 0.75em;\n\t\t\ttext-transform: uppercase;\n\t\t\tletter-spacing: 0.05em;\n\t\t\tcolor: var(--facto-text-tertiary, #888);\n\t\t}\n\t\t.facto-record-meta-row {\n\t\t\tdisplay: flex;\n\t\t\tjustify-content: space-between;\n\t\t\talign-items: baseline;\n\t\t\tpadding: 0.2em 0;\n\t\t\tfont-size: 0.85em;\n\t\t}\n\t\t.facto-record-meta-label {\n\t\t\tcolor: var(--facto-text-secondary, #aaa);\n\t\t\tflex-shrink: 0;\n\t\t\tmargin-right: 0.75em;\n\t\t}\n\t\t.facto-record-meta-value {\n\t\t\tcolor: var(--facto-text-heading, #eee);\n\t\t\ttext-align: right;\n\t\t\toverflow: hidden;\n\t\t\ttext-overflow: ellipsis;\n\t\t\twhite-space: nowrap;\n\t\t\tfont-family: 'SF Mono', Consolas, monospace;\n\t\t\tfont-size: 0.9em;\n\t\t}\n\t\t.facto-record-meta-value.facto-hash-value {\n\t\t\tcolor: var(--facto-brand, #4a90d9);\n\t\t}\n\t\t.facto-record-certainty-bar {\n\t\t\theight: 6px;\n\t\t\tbackground: var(--facto-border-subtle, #2a2e3a);\n\t\t\tborder-radius: 3px;\n\t\t\tmargin-top: 0.35em;\n\t\t\toverflow: hidden;\n\t\t}\n\t\t.facto-record-certainty-fill {\n\t\t\theight: 100%;\n\t\t\tborder-radius: 3px;\n\t\t\ttransition: width 0.3s;\n\t\t}\n\t\t.facto-record-content-section {\n\t\t\tmargin-top: 1.5em;\n\t\t}\n\t\t.facto-record-content-section h2 {\n\t\t\tfont-size: 1em;\n\t\t\tmargin: 0 0 0.75em;\n\t\t\tcolor: var(--facto-text-secondary, #aaa);\n\t\t\ttext-transform: uppercase;\n\t\t\tletter-spacing: 0.05em;\n\t\t}\n\t\t/* Override ObjectEditor styles for dark theme compatibility */\n\t\t.facto-record-content-section .pict-objecteditor {\n\t\t\tbackground: var(--facto-bg-elevated, #1a1e2a);\n\t\t\tborder-color: var(--facto-border-subtle, #2a2e3a);\n\t\t\tcolor: var(--facto-text-heading, #eee);\n\t\t}\n\t\t.facto-record-content-section .pict-oe-row:hover {\n\t\t\tbackground: var(--facto-table-row-hover, #222738);\n\t\t}\n\t\t.facto-record-content-section .pict-oe-key {\n\t\t\tcolor: var(--facto-brand, #4a90d9);\n\t\t}\n\t\t.facto-record-content-section .pict-oe-separator {\n\t\t\tcolor: var(--facto-text-tertiary, #888);\n\t\t}\n\t\t.facto-record-content-section .pict-oe-value-string {\n\t\t\tcolor: #055d40;\n\t\t}\n\t\t.facto-record-content-section .pict-oe-value-string::before,\n\t\t.facto-record-content-section .pict-oe-value-string::after {\n\t\t\tcolor: #1a8a66;\n\t\t}\n\t\t.facto-record-content-section .pict-oe-value-number {\n\t\t\tcolor: #d4a0ff;\n\t\t}\n\t\t.facto-record-content-section .pict-oe-value-boolean {\n\t\t\tcolor: #ffb347;\n\t\t}\n\t\t.facto-record-content-section .pict-oe-value-null {\n\t\t\tcolor: var(--facto-text-tertiary, #666);\n\t\t}\n\t\t.facto-record-content-section .pict-oe-summary {\n\t\t\tcolor: var(--facto-text-tertiary, #666);\n\t\t}\n\t\t.facto-record-content-section .pict-oe-toggle {\n\t\t\tcolor: var(--facto-text-secondary, #aaa);\n\t\t}\n\t\t.facto-record-content-section .pict-oe-toggle:hover {\n\t\t\tcolor: var(--facto-brand, #4a90d9);\n\t\t\tbackground: var(--facto-table-row-hover, #222738);\n\t\t}\n\t\t.facto-record-content-section .pict-oe-type-badge {\n\t\t\tbackground: var(--facto-table-row-hover, #222738);\n\t\t\tcolor: var(--facto-text-tertiary, #888);\n\t\t}\n\t\t.facto-record-content-section .pict-oe-empty {\n\t\t\tcolor: var(--facto-text-tertiary, #666);\n\t\t}\n\t",Templates:[{Hash:"Facto-Full-RecordViewer-Template",Template:'\n<div class="facto-content">\n\t<div class="facto-record-viewer-back" onclick="{~P~}.views[\'Facto-Full-RecordViewer\'].goBack()">\n\t\t← Back to Records\n\t</div>\n\n\t<div class="facto-content-header">\n\t\t<h1 id="Facto-RecordViewer-Title">Record</h1>\n\t</div>\n\n\t<div id="Facto-RecordViewer-Loading" style="color:var(--facto-text-secondary);">Loading record...</div>\n\t<div id="Facto-RecordViewer-Error" class="facto-status facto-status-error" style="display:none;"></div>\n\n\t<div id="Facto-RecordViewer-MetaContainer" style="display:none;">\n\t\t<div class="facto-record-meta" id="Facto-RecordViewer-Meta"></div>\n\n\t\t<div class="facto-record-content-section">\n\t\t\t<h2>Record Content</h2>\n\t\t\t<div id="Facto-RecordViewer-ObjectEditor-Container"></div>\n\t\t</div>\n\t</div>\n</div>\n'}],Renderables:[{RenderableHash:"Facto-Full-RecordViewer-Content",TemplateHash:"Facto-Full-RecordViewer-Template",DestinationAddress:"#Facto-Full-Content-Container",RenderMethod:"replace"}]};e.exports=class extends i{constructor(t,e,o){super(t,e,o),this._CurrentIDRecord=null,this._ObjectEditorView=null}onBeforeInitialize(){return super.onBeforeInitialize(),this.fable.servicesMap.hasOwnProperty("PictViewObjectEditor")||this.fable.addServiceType("PictViewObjectEditor",n),!0}loadRecord(t){this._CurrentIDRecord=t,this.render()}onAfterRender(){if(super.onAfterRender(),!this._CurrentIDRecord){let t=document.getElementById("Facto-RecordViewer-Loading");return void(t&&(t.textContent="No record selected."))}this._fetchAndDisplayRecord(this._CurrentIDRecord)}_fetchAndDisplayRecord(t){let e=this.pict.providers.Facto,o=document.getElementById("Facto-RecordViewer-Loading"),i=document.getElementById("Facto-RecordViewer-Error"),n=(document.getElementById("Facto-RecordViewer-MetaContainer"),null),a=null,r=null,s=null,l=null,c=e.api("GET","/1.0/Record/"+t),d=e.api("GET","/facto/record/"+t+"/certainty");c.then(t=>{if(t&&t.Error)return o&&(o.style.display="none"),void(i&&(i.textContent="Error loading record: "+t.Error,i.style.display="block"));n=t;let c=[];return n.IDSource&&c.push(e.api("GET","/1.0/Source/"+n.IDSource).then(t=>{a=t})),n.IDDataset&&c.push(e.api("GET","/1.0/Dataset/"+n.IDDataset).then(t=>{r=t})),n.IDIngestJob&&c.push(e.api("GET","/facto/ingest/job/"+n.IDIngestJob).then(t=>{l=t})),Promise.all(c).then(()=>d).then(t=>{s=t,this._renderRecordDetail(n,a,r,s,l)})}).catch(t=>{o&&(o.style.display="none"),i&&(i.textContent="Error loading record: "+(t.message||t),i.style.display="block")})}_renderRecordDetail(t,e,o,i,n){let a=document.getElementById("Facto-RecordViewer-Loading"),r=document.getElementById("Facto-RecordViewer-MetaContainer"),s=document.getElementById("Facto-RecordViewer-Title");if(a&&(a.style.display="none"),r&&(r.style.display="block"),s){let e="Record #"+t.IDRecord;o&&o.Hash&&(e+=" — "+o.Hash),s.textContent=e}let l=document.getElementById("Facto-RecordViewer-Meta");l&&(l.innerHTML=this._buildMetaCards(t,e,o,i,n));let c={};if(t.Content)try{c=JSON.parse(t.Content)}catch(e){c={_raw:t.Content}}this.pict.AppData.Facto.CurrentRecordContent=c,this._renderObjectEditor()}_renderObjectEditor(){let t="Facto-RecordViewer-ObjectEditor-Container",e="Facto-RecordViewer-ObjectEditor";if(this.pict.views[e])return void this.pict.views[e].render();let o={ViewIdentifier:e,DefaultDestinationAddress:"#"+t,ObjectDataAddress:"AppData.Facto.CurrentRecordContent",InitialExpandDepth:2,Editable:!1,ShowTypeIndicators:!0,IndentPixels:20,Renderables:[{RenderableHash:"ObjectEditor-Container",TemplateHash:"ObjectEditor-Container-Template",DestinationAddress:"#"+t,RenderMethod:"replace"}]};this.pict.addView(e,o,n);let i=this.pict.views[e];i.onBeforeInitialize(),i.render()}_buildMetaCards(t,e,o,i,n){let a="";if(a+='<div class="facto-record-meta-card">',a+="<h3>Record Identity</h3>",a+=this._metaRow("ID",t.IDRecord),a+=this._metaRow("GUID",t.GUIDRecord,!0),a+=this._metaRow("Type",t.Type||"—"),a+=this._metaRow("Version",t.Version||1),a+="</div>",a+='<div class="facto-record-meta-card">',a+="<h3>Source</h3>",e&&!e.Error?(a+=this._metaRow("Name",e.Name||"—"),a+=this._metaRow("Hash",e.Hash||"—",!1,!0),a+=this._metaRow("Type",e.Type||"—"),e.URL&&(a+=this._metaRow("URL",e.URL))):a+=this._metaRow("ID",t.IDSource||0),a+="</div>",a+='<div class="facto-record-meta-card">',a+="<h3>Dataset</h3>",o&&!o.Error?(a+=this._metaRow("Name",o.Name||"—"),a+=this._metaRow("Hash",o.Hash||"—",!1,!0),a+=this._metaRow("Type",o.Type||"—"),a+=this._metaRow("Version Policy",o.VersionPolicy||"—")):a+=this._metaRow("ID",t.IDDataset||0),a+="</div>",a+='<div class="facto-record-meta-card">',a+="<h3>Ingest Metadata</h3>",a+=this._metaRow("Ingest Date",this._formatDate(t.IngestDate)),a+=this._metaRow("Ingest Job",t.IDIngestJob||"—"),n&&n.Job&&(a+=this._metaRow("Job Status",n.Job.Status||"—")),a+=this._metaRow("Created",this._formatDate(t.CreateDate)),t.OriginCreateDate&&(a+=this._metaRow("Origin Date",this._formatDate(t.OriginCreateDate))),a+="</div>",a+='<div class="facto-record-meta-card">',a+="<h3>Schema</h3>",a+=this._metaRow("Schema Hash",t.SchemaHash||"—"),a+=this._metaRow("Schema Version",t.SchemaVersion||0),a+="</div>",a+='<div class="facto-record-meta-card">',a+="<h3>Certainty</h3>",i&&i.CertaintyIndices&&i.CertaintyIndices.length>0)for(let t=0;t<i.CertaintyIndices.length;t++){let e=i.CertaintyIndices[t],o=Math.round(100*(e.CertaintyValue||0)),n=o>=70?"#28a745":o>=40?"#ffc107":"#dc3545";a+=this._metaRow(e.Dimension||"overall",o+"%"),a+='<div class="facto-record-certainty-bar"><div class="facto-record-certainty-fill" style="width:'+o+"%; background:"+n+';"></div></div>',e.Justification&&(a+='<div style="font-size:0.75em; color:var(--facto-text-tertiary); margin-top:0.15em;">'+this._escapeHtml(e.Justification)+"</div>")}else a+='<div style="color:var(--facto-text-tertiary); font-size:0.85em;">No certainty data</div>';return a+="</div>",a}_metaRow(t,e,o,i){let n=this._escapeHtml(String(e||""));o&&n.length>16&&(n='<span title="'+n+'">'+n.substring(0,8)+"…"+n.substring(n.length-4)+"</span>");let a="facto-record-meta-value";return i&&(a+=" facto-hash-value"),'<div class="facto-record-meta-row"><span class="facto-record-meta-label">'+this._escapeHtml(t)+'</span><span class="'+a+'">'+n+"</span></div>"}_formatDate(t){if(!t)return"—";try{let e=t;return"string"!=typeof e||e.endsWith("Z")||e.match(/[+-]\d{2}:\d{2}$/)||(e=e.replace(" ","T")+"Z"),new Date(e).toLocaleString()}catch(e){return t}}_escapeHtml(t){return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}goBack(){this.pict.PictApplication.navigateTo("/Records")}},e.exports.default_configuration=a},{"pict-section-objecteditor":31,"pict-view":41}],58:[function(t,e,o){const i=t("pict-view"),n={ViewIdentifier:"Facto-Full-Records",DefaultRenderable:"Facto-Full-Records-Content",DefaultDestinationAddress:"#Facto-Full-Content-Container",AutoRender:!1,CSS:'\n\t\t.facto-records-pager {\n\t\t\tdisplay: flex;\n\t\t\talign-items: center;\n\t\t\tgap: 0.75em;\n\t\t\tmargin-bottom: 1em;\n\t\t}\n\t\t.facto-records-pager span {\n\t\t\tfont-size: 0.85em;\n\t\t\tcolor: var(--facto-text-secondary);\n\t\t}\n\t\t.facto-record-data {\n\t\t\tmax-width: 400px;\n\t\t\toverflow: hidden;\n\t\t\ttext-overflow: ellipsis;\n\t\t\twhite-space: nowrap;\n\t\t\tfont-family: \'SF Mono\', Consolas, monospace;\n\t\t\tfont-size: 0.8em;\n\t\t\tcolor: var(--facto-text-secondary);\n\t\t}\n\t\t.facto-filter-bar {\n\t\t\tborder: 1px solid var(--facto-border, #333);\n\t\t\tborder-radius: 6px;\n\t\t\tpadding: 1em;\n\t\t\tmargin-bottom: 1em;\n\t\t\tbackground: var(--facto-bg-surface);\n\t\t}\n\t\t.facto-filter-bar h3 {\n\t\t\tmargin: 0 0 0.75em 0;\n\t\t\tfont-size: 0.9em;\n\t\t\tcolor: var(--facto-text-secondary);\n\t\t\ttext-transform: uppercase;\n\t\t\tletter-spacing: 0.05em;\n\t\t}\n\t\t.facto-filter-section {\n\t\t\tmargin-bottom: 1em;\n\t\t}\n\t\t.facto-filter-section:last-child {\n\t\t\tmargin-bottom: 0;\n\t\t}\n\t\t.facto-filter-label {\n\t\t\tdisplay: block;\n\t\t\tfont-size: 0.8em;\n\t\t\tcolor: var(--facto-text-secondary);\n\t\t\tmargin-bottom: 0.4em;\n\t\t\tfont-weight: 600;\n\t\t}\n\t\t.facto-source-checkboxes {\n\t\t\tdisplay: flex;\n\t\t\tflex-wrap: wrap;\n\t\t\tgap: 0.5em 1em;\n\t\t\tmax-height: 120px;\n\t\t\toverflow-y: auto;\n\t\t\tpadding: 0.25em 0;\n\t\t}\n\t\t.facto-source-checkboxes label {\n\t\t\tdisplay: flex;\n\t\t\talign-items: center;\n\t\t\tgap: 0.35em;\n\t\t\tfont-size: 0.85em;\n\t\t\tcursor: pointer;\n\t\t\twhite-space: nowrap;\n\t\t}\n\t\t.facto-source-checkboxes input[type="checkbox"] {\n\t\t\tcursor: pointer;\n\t\t}\n\t\t.facto-source-toggle {\n\t\t\tfont-size: 0.75em;\n\t\t\tcolor: var(--facto-link);\n\t\t\tcursor: pointer;\n\t\t\tmargin-left: 0.5em;\n\t\t\ttext-decoration: underline;\n\t\t}\n\t\t.facto-date-filters {\n\t\t\tdisplay: flex;\n\t\t\talign-items: center;\n\t\t\tgap: 0.75em;\n\t\t\tflex-wrap: wrap;\n\t\t}\n\t\t.facto-date-filters input[type="text"] {\n\t\t\tpadding: 0.35em 0.5em;\n\t\t\tfont-size: 0.85em;\n\t\t\tborder: 1px solid var(--facto-border);\n\t\t\tborder-radius: 4px;\n\t\t\tbackground: var(--facto-bg-input);\n\t\t\tcolor: var(--facto-text);\n\t\t\twidth: 160px;\n\t\t\tmargin-bottom: 0;\n\t\t}\n\t\t.facto-date-filters span {\n\t\t\tfont-size: 0.8em;\n\t\t\tcolor: var(--facto-text-secondary);\n\t\t}\n\t\t.facto-filter-actions {\n\t\t\tdisplay: flex;\n\t\t\tgap: 0.5em;\n\t\t\tmargin-top: 0.75em;\n\t\t}\n\t',Templates:[{Hash:"Facto-Full-Records-Template",Template:'\n<div class="facto-content">\n\t<div class="facto-content-header">\n\t\t<h1>Records</h1>\n\t\t<p>Browse ingested records across all datasets.</p>\n\t</div>\n\n\t<div class="facto-filter-bar">\n\t\t<h3>Filters</h3>\n\n\t\t<div class="facto-filter-section">\n\t\t\t<span class="facto-filter-label">\n\t\t\t\tData Sources\n\t\t\t\t<span class="facto-source-toggle" onclick="{~P~}.views[\'Facto-Full-Records\'].toggleAllSources(true)">All</span>\n\t\t\t\t<span class="facto-source-toggle" onclick="{~P~}.views[\'Facto-Full-Records\'].toggleAllSources(false)">None</span>\n\t\t\t</span>\n\t\t\t<div id="Facto-Full-Records-SourceCheckboxes" class="facto-source-checkboxes">\n\t\t\t\t<span style="font-size:0.85em; color:var(--facto-text-secondary);">Loading sources...</span>\n\t\t\t</div>\n\t\t</div>\n\n\t\t<div class="facto-filter-section">\n\t\t\t<span class="facto-filter-label">Date Range (Ingest Date)</span>\n\t\t\t<div class="facto-date-filters">\n\t\t\t\t<span>From</span>\n\t\t\t\t<input type="text" id="Facto-Full-Records-DateFrom" placeholder="YYYY, YYYY-MM, or YYYY-MM-DD" />\n\t\t\t\t<span>To</span>\n\t\t\t\t<input type="text" id="Facto-Full-Records-DateTo" placeholder="YYYY, YYYY-MM, or YYYY-MM-DD" />\n\t\t\t</div>\n\t\t</div>\n\n\t\t<div class="facto-filter-actions">\n\t\t\t<button class="facto-btn facto-btn-primary facto-btn-small" onclick="{~P~}.views[\'Facto-Full-Records\'].applyFilters()">Apply Filters</button>\n\t\t\t<button class="facto-btn facto-btn-secondary facto-btn-small" onclick="{~P~}.views[\'Facto-Full-Records\'].clearFilters()">Clear</button>\n\t\t</div>\n\t</div>\n\n\t<div class="facto-records-pager">\n\t\t<button class="facto-btn facto-btn-secondary facto-btn-small" onclick="{~P~}.views[\'Facto-Full-Records\'].prevPage()">Previous</button>\n\t\t<span id="Facto-Full-Records-PageInfo">Page 1</span>\n\t\t<button class="facto-btn facto-btn-secondary facto-btn-small" onclick="{~P~}.views[\'Facto-Full-Records\'].nextPage()">Next</button>\n\t</div>\n\n\t<div id="Facto-Full-Records-List"></div>\n</div>\n'}],Renderables:[{RenderableHash:"Facto-Full-Records-Content",TemplateHash:"Facto-Full-Records-Template",DestinationAddress:"#Facto-Full-Content-Container",RenderMethod:"replace"}]};e.exports=class extends i{constructor(t,e,o){super(t,e,o)}onAfterRender(t,e,o,i){return this.pict.providers.Facto.loadSources().then(()=>{this.renderSourceCheckboxes(),this.loadCurrentPage()}),super.onAfterRender(t,e,o,i)}renderSourceCheckboxes(){let t=document.getElementById("Facto-Full-Records-SourceCheckboxes");if(!t)return;let e=this.pict.AppData.Facto.Sources;if(!e||0===e.length)return void(t.innerHTML='<span style="font-size:0.85em; color:var(--facto-text-secondary);">No sources available.</span>');let o=this.pict.AppData.Facto.RecordFilterSources,i="";for(let t=0;t<e.length;t++){let n=e[t],a=(0===o.length||o.indexOf(n.IDSource),""),r=n.Name||"Source #"+n.IDSource;i+="<label>",i+='<input type="checkbox" class="facto-source-cb" value="'+n.IDSource+'"'+a+" />",i+=" "+r,i+="</label>"}t.innerHTML=i}toggleAllSources(t){let e=document.querySelectorAll(".facto-source-cb");for(let o=0;o<e.length;o++)e[o].checked=t}readFiltersFromDOM(){let t=[],e=document.querySelectorAll(".facto-source-cb:checked");for(let o=0;o<e.length;o++)t.push(parseInt(e[o].value,10));let o="",i="",n=document.getElementById("Facto-Full-Records-DateFrom"),a=document.getElementById("Facto-Full-Records-DateTo");n&&(o=n.value),a&&(i=a.value),this.pict.AppData.Facto.RecordFilterSources=t,this.pict.AppData.Facto.RecordFilterDateFrom=o,this.pict.AppData.Facto.RecordFilterDateTo=i}hasActiveFilters(){let t=this.pict.AppData.Facto;return t.RecordFilterSources.length>0||t.RecordFilterDateFrom||t.RecordFilterDateTo}loadCurrentPage(){let t=this.pict.AppData.Facto;this.hasActiveFilters()?this.pict.providers.Facto.loadFilteredRecords(t.RecordPage,t.RecordFilterSources,t.RecordFilterDateFrom,t.RecordFilterDateTo).then(()=>{this.refreshList()}):this.pict.providers.Facto.loadRecords(t.RecordPage).then(()=>{this.refreshList()})}applyFilters(){this.readFiltersFromDOM(),this.pict.AppData.Facto.RecordPage=0,this.loadCurrentPage()}clearFilters(){this.pict.AppData.Facto.RecordFilterSources=[],this.pict.AppData.Facto.RecordFilterDateFrom="",this.pict.AppData.Facto.RecordFilterDateTo="",this.pict.AppData.Facto.RecordPage=0;let t=document.getElementById("Facto-Full-Records-DateFrom"),e=document.getElementById("Facto-Full-Records-DateTo");t&&(t.value=""),e&&(e.value="");let o=document.querySelectorAll(".facto-source-cb");for(let t=0;t<o.length;t++)o[t].checked=!1;this.loadCurrentPage()}refreshList(){let t=document.getElementById("Facto-Full-Records-List");if(!t)return;let e=this.pict.AppData.Facto.Records,o=document.getElementById("Facto-Full-Records-PageInfo");if(o&&(o.textContent="Page "+((this.pict.AppData.Facto.RecordPage||0)+1)),!e||0===e.length)return void(t.innerHTML='<div class="facto-empty">No records found. Ingest data via Source Research or the Ingest API.</div>');let i="<table><thead><tr><th>ID</th><th>Dataset</th><th>Source</th><th>GUID</th><th>Data</th><th></th></tr></thead><tbody>";for(let t=0;t<e.length;t++){let o=e[t],n="";try{n=JSON.stringify(JSON.parse(o.Content||"{}"))}catch(t){n=o.Content||""}i+="<tr>",i+="<td>"+(o.IDRecord||"")+"</td>",i+="<td>"+(o.IDDataset||"")+"</td>",i+="<td>"+(o.IDSource||"")+"</td>",i+='<td style="font-size:0.8em; color:var(--facto-text-tertiary);">'+(o.GUIDRecord||"").substring(0,8)+"...</td>",i+='<td class="facto-record-data">'+n+"</td>",i+='<td><button class="facto-btn facto-btn-secondary facto-btn-small" onclick="pict.PictApplication.navigateTo(\'/Record/'+o.IDRecord+"')\">View</button></td>",i+="</tr>"}i+="</tbody></table>",t.innerHTML=i}prevPage(){this.pict.AppData.Facto.RecordPage>0&&(this.pict.AppData.Facto.RecordPage--,this.loadCurrentPage())}nextPage(){this.pict.AppData.Facto.RecordPage++,this.loadCurrentPage()}},e.exports.default_configuration=n},{"pict-view":41}],59:[function(t,e,o){const i=t("pict-view"),n={ViewIdentifier:"Facto-Full-Scanner",DefaultRenderable:"Facto-Full-Scanner-Content",DefaultDestinationAddress:"#Facto-Full-Content-Container",AutoRender:!1,CSS:"\n\t\t.facto-scanner-summary {\n\t\t\tdisplay: flex;\n\t\t\tgap: 1.5em;\n\t\t\tpadding: 0.75em 1em;\n\t\t\tbackground: var(--facto-bg-elevated);\n\t\t\tborder-radius: 6px;\n\t\t\tmargin-bottom: 1.25em;\n\t\t\tfont-size: 0.9em;\n\t\t}\n\t\t.facto-scanner-summary-stat {\n\t\t\tdisplay: flex;\n\t\t\tgap: 0.4em;\n\t\t\talign-items: baseline;\n\t\t}\n\t\t.facto-scanner-summary-stat strong {\n\t\t\tfont-size: 1.2em;\n\t\t\tcolor: var(--facto-text-heading);\n\t\t}\n\t\t.facto-scanner-add-path {\n\t\t\tdisplay: flex;\n\t\t\tgap: 0.75em;\n\t\t\tmargin-bottom: 1.25em;\n\t\t}\n\t\t.facto-scanner-add-path input {\n\t\t\tflex: 1;\n\t\t\tmargin-bottom: 0;\n\t\t}\n\t\t.facto-scanner-filters {\n\t\t\tdisplay: flex;\n\t\t\tgap: 0.75em;\n\t\t\tmargin-bottom: 0.75em;\n\t\t\talign-items: flex-end;\n\t\t}\n\t\t.facto-scanner-filters input {\n\t\t\tflex: 3;\n\t\t\tmargin-bottom: 0;\n\t\t}\n\t\t.facto-scanner-filters select {\n\t\t\tflex: 1;\n\t\t\tmargin-bottom: 0;\n\t\t}\n\t\t.facto-scanner-detail-panel {\n\t\t\tmargin-top: 1.25em;\n\t\t\tpadding: 1.25em;\n\t\t\tbackground: var(--facto-bg-elevated);\n\t\t\tborder: 1px solid var(--facto-border-subtle);\n\t\t\tborder-radius: 8px;\n\t\t}\n\t\t.facto-scanner-detail-grid {\n\t\t\tdisplay: grid;\n\t\t\tgrid-template-columns: 1fr 1fr;\n\t\t\tgap: 0.5em 1.5em;\n\t\t\tfont-size: 0.9em;\n\t\t\tmargin-bottom: 1em;\n\t\t}\n\t\t.facto-scanner-description {\n\t\t\tcolor: var(--facto-text-secondary);\n\t\t\tfont-size: 0.9em;\n\t\t\tmargin-top: 0.35em;\n\t\t\tmax-height: 100px;\n\t\t\toverflow-y: auto;\n\t\t\twhite-space: pre-wrap;\n\t\t}\n\t",Templates:[{Hash:"Facto-Full-Scanner-Template",Template:'\n<div class="facto-content">\n\t<div class="facto-content-header">\n\t\t<h1>Source Folder Scanner</h1>\n\t\t<p>Point the scanner at folder trees containing dataset research (README.md + data/). Discovered datasets can be provisioned into the database individually or in bulk.</p>\n\t</div>\n\n\t\x3c!-- Summary bar --\x3e\n\t<div class="facto-scanner-summary" id="Facto-Full-Scanner-Summary">\n\t\t<span style="color:var(--facto-text-secondary);">No datasets loaded</span>\n\t</div>\n\n\t\x3c!-- Add scan path --\x3e\n\t<div class="facto-scanner-add-path">\n\t\t<input type="text" id="Facto-Full-Scanner-PathInput" placeholder="/path/to/dataset/folder/tree">\n\t\t<button class="facto-btn facto-btn-primary" onclick="{~P~}.views[\'Facto-Full-Scanner\'].addPath()">Add & Scan</button>\n\t\t<button class="facto-btn facto-btn-secondary" onclick="{~P~}.views[\'Facto-Full-Scanner\'].rescanAll()">Re-scan All</button>\n\t</div>\n\n\t\x3c!-- Scan paths list --\x3e\n\t<div id="Facto-Full-Scanner-PathsList" style="margin-bottom:1.5em;"></div>\n\n\t\x3c!-- Filter bar --\x3e\n\t<div class="facto-scanner-filters">\n\t\t<input type="text" id="Facto-Full-Scanner-Search" placeholder="Search by name, title, or provider..." oninput="{~P~}.views[\'Facto-Full-Scanner\'].filterDatasets()">\n\t\t<select id="Facto-Full-Scanner-StatusFilter" onchange="{~P~}.views[\'Facto-Full-Scanner\'].filterDatasets()">\n\t\t\t<option value="">All Statuses</option>\n\t\t\t<option value="Discovered">Discovered</option>\n\t\t\t<option value="Provisioned">Provisioned</option>\n\t\t\t<option value="Ingested">Ingested</option>\n\t\t\t<option value="Error">Error</option>\n\t\t</select>\n\t\t<button class="facto-btn facto-btn-success" onclick="{~P~}.views[\'Facto-Full-Scanner\'].provisionSelected()">Provision Selected</button>\n\t\t<button class="facto-btn facto-btn-success" onclick="{~P~}.views[\'Facto-Full-Scanner\'].provisionAll()">Provision All</button>\n\t</div>\n\n\t\x3c!-- Datasets table --\x3e\n\t<div id="Facto-Full-Scanner-DatasetsList"></div>\n</div>\n'}],Renderables:[{RenderableHash:"Facto-Full-Scanner-Content",TemplateHash:"Facto-Full-Scanner-Template",DestinationAddress:"#Facto-Full-Content-Container",RenderMethod:"replace"}]};e.exports=class extends i{constructor(t,e,o){super(t,e,o)}onAfterRender(t,e,o,i){return this.loadScannerState(),super.onAfterRender(t,e,o,i)}loadScannerState(){Promise.all([this.pict.providers.Facto.loadScannerPaths(),this.pict.providers.Facto.loadScannerDatasets()]).then(()=>{this.refreshPathsList(),this.refreshDatasetsList()}).catch(t=>{this.pict.views["Pict-Section-Modal"].toast("Error loading scanner state: "+t.message,{type:"error"})})}refreshPathsList(){let t=document.getElementById("Facto-Full-Scanner-PathsList");if(!t)return;let e=this.pict.AppData.Facto.ScannerPaths||[];if(0===e.length)return void(t.innerHTML='<div class="facto-empty">No scan paths configured. Add a folder path to discover datasets.</div>');let o="<table><thead><tr><th>Path</th><th>Datasets</th><th>Last Scanned</th><th>Actions</th></tr></thead><tbody>";for(let t=0;t<e.length;t++){let i=e[t],n=i.LastScannedAt?new Date(i.LastScannedAt).toLocaleString():"Never";o+="<tr>",o+="<td style=\"font-family:'SF Mono', Consolas, monospace; font-size:0.85em;\">"+this.escapeHtml(i.Path)+"</td>",o+="<td>"+(i.DatasetCount||0)+"</td>",o+="<td>"+n+"</td>",o+="<td><button class=\"facto-btn facto-btn-danger facto-btn-small\" onclick=\"pict.views['Facto-Full-Scanner'].removePath('"+this.escapeAttr(i.Path)+"')\">Remove</button></td>",o+="</tr>"}o+="</tbody></table>",t.innerHTML=o}refreshDatasetsList(){let t=document.getElementById("Facto-Full-Scanner-DatasetsList");if(!t)return;let e=this.pict.AppData.Facto.ScannerDatasets||[];if(0===e.length)return t.innerHTML='<div class="facto-empty">No datasets discovered yet. Add a scan path containing dataset folders with README.md files.</div>',void this.updateSummary(0,0,0,0);let o=0,i=0,n=0;for(let t=0;t<e.length;t++)"Discovered"===e[t].Status&&o++,"Provisioned"===e[t].Status&&i++,"Ingested"===e[t].Status&&0,e[t].HasData&&n++;this.updateSummary(e.length,o,i,n);let a=document.getElementById("Facto-Full-Scanner-Search"),r=a?a.value.toLowerCase():"",s=document.getElementById("Facto-Full-Scanner-StatusFilter"),l=s?s.value:"",c=e;r&&(c=c.filter(t=>((t.FolderName||"")+" "+(t.Title||"")+" "+(t.Provider||"")).toLowerCase().indexOf(r)>-1)),l&&(c=c.filter(t=>t.Status===l));let d="<table><thead><tr>";d+='<th><input type="checkbox" id="Facto-Full-Scanner-SelectAll" onclick="pict.views[\'Facto-Full-Scanner\'].toggleSelectAll(this.checked)"></th>',d+="<th>Name</th><th>Title</th><th>Provider</th><th>Format</th><th>Data</th><th>Status</th><th>Actions</th>",d+="</tr></thead><tbody>";for(let t=0;t<c.length;t++){let e=c[t],o=this.getStatusBadge(e.Status),i=e.HasData?e.DataFileCount+" file"+(1!==e.DataFileCount?"s":"")+" ("+(e.TotalDataSizeFormatted||"0 B")+")":'<span style="color:var(--facto-text-danger, #dc3545);">No data</span>',n=e.DataFormat&&e.DataFormat.Format||"unknown",a=this.escapeAttr(e.FolderName);d+='<tr id="facto-scanner-row-'+a+'">',d+='<td><input type="checkbox" class="facto-scanner-checkbox" data-folder="'+a+'"></td>',d+="<td style=\"font-family:'SF Mono', Consolas, monospace; font-size:0.85em;\">"+this.escapeHtml(e.FolderName)+"</td>",d+="<td>"+this.escapeHtml((e.Title||"").substring(0,50))+"</td>",d+="<td>"+this.escapeHtml((e.Provider||"").substring(0,30))+"</td>",d+='<td><span class="facto-badge facto-badge-primary">'+n+"</span></td>",d+="<td>"+i+"</td>",d+="<td>"+o+"</td>",d+="<td>",d+='<div class="facto-row-actions" id="facto-row-actions-'+a+'">',d+="<button class=\"facto-row-actions-trigger\" onclick=\"pict.views['Facto-Full-Scanner'].toggleRowMenu(event, '"+a+'\')" title="Actions">⋮</button>',d+='<div class="facto-row-actions-menu">',d+="<button onclick=\"pict.views['Facto-Full-Scanner'].viewDetail('"+a+"'); pict.views['Facto-Full-Scanner'].closeRowMenus();\">Detail</button>","Provisioned"!==e.Status&&"Discovered"!==e.Status||!e.HasData||(d+="<button class=\"facto-action-primary\" onclick=\"pict.views['Facto-Full-Scanner'].ingestOne('"+a+"'); pict.views['Facto-Full-Scanner'].closeRowMenus();\">Ingest</button>"),"Discovered"===e.Status&&(d+="<button class=\"facto-action-success\" onclick=\"pict.views['Facto-Full-Scanner'].provisionOne('"+a+"'); pict.views['Facto-Full-Scanner'].closeRowMenus();\">Provision</button>"),d+="</div>",d+="</div>",d+="</td>",d+="</tr>"}d+="</tbody></table>",d+='<div style="color:var(--facto-text-secondary); font-size:0.85em; margin-top:0.5em;">Showing '+c.length+" of "+e.length+" dataset(s)</div>",t.innerHTML=d}updateSummary(t,e,o,i){let n=document.getElementById("Facto-Full-Scanner-Summary");n&&(n.innerHTML='<div class="facto-scanner-summary-stat"><strong>'+t+'</strong> discovered</div><div class="facto-scanner-summary-stat"><strong>'+o+'</strong> provisioned</div><div class="facto-scanner-summary-stat"><strong>'+i+"</strong> with data</div>")}getStatusBadge(t){return"Discovered"===t?'<span class="facto-badge facto-badge-info">Discovered</span>':"Provisioned"===t?'<span class="facto-badge facto-badge-success">Provisioned</span>':"Ingested"===t?'<span class="facto-badge facto-badge-warning">Ingested</span>':"Error"===t?'<span class="facto-badge facto-badge-danger">Error</span>':'<span class="facto-badge facto-badge-muted">'+(t||"")+"</span>"}escapeHtml(t){return t?t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,"""):""}escapeAttr(t){return t?t.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/"/g,"""):""}formatSize(t){if(0===t)return"0 B";let e=["B","KB","MB","GB"],o=Math.floor(Math.log(t)/Math.log(1024));return o>=e.length&&(o=e.length-1),(t/Math.pow(1024,o)).toFixed(o>0?1:0)+" "+e[o]}addPath(){let t=document.getElementById("Facto-Full-Scanner-PathInput"),e=t?t.value.trim():"";e?(this.pict.views["Pict-Section-Modal"].toast("Scanning "+e+"...",{type:"info"}),this.pict.providers.Facto.addScannerPath(e).then(e=>{if(e&&e.Error)return void this.pict.views["Pict-Section-Modal"].toast("Error: "+e.Error,{type:"error"});let o=e.ScanResult||{};this.pict.views["Pict-Section-Modal"].toast("Scanned! Found "+(o.DatasetsFound||0)+" dataset(s) in "+(o.FoldersScanned||0)+" folder(s)",{type:"success"}),t&&(t.value=""),this.loadScannerState()}).catch(t=>{this.pict.views["Pict-Section-Modal"].toast("Error: "+t.message,{type:"error"})})):this.pict.views["Pict-Section-Modal"].toast("Enter a folder path to scan",{type:"warning"})}async removePath(t){await this.pict.views["Pict-Section-Modal"].confirm("Remove scan path and its discovered datasets?\n\n"+t,{title:"Remove Path",confirmLabel:"Remove",dangerous:!0})&&this.pict.providers.Facto.removeScannerPath(t).then(t=>{t&&t.Error?this.pict.views["Pict-Section-Modal"].toast("Error: "+t.Error,{type:"error"}):(this.pict.views["Pict-Section-Modal"].toast("Path removed",{type:"success"}),this.loadScannerState())}).catch(t=>{this.pict.views["Pict-Section-Modal"].toast("Error: "+t.message,{type:"error"})})}rescanAll(){this.pict.views["Pict-Section-Modal"].toast("Re-scanning all paths...",{type:"info"}),this.pict.providers.Facto.rescanPaths().then(t=>{t&&t.Error?this.pict.views["Pict-Section-Modal"].toast("Error: "+t.Error,{type:"error"}):(this.pict.views["Pict-Section-Modal"].toast("Re-scan complete",{type:"success"}),this.loadScannerState())}).catch(t=>{this.pict.views["Pict-Section-Modal"].toast("Error: "+t.message,{type:"error"})})}filterDatasets(){this.refreshDatasetsList()}toggleSelectAll(t){let e=document.querySelectorAll(".facto-scanner-checkbox");for(let o=0;o<e.length;o++)e[o].checked=t}getSelectedFolderNames(){let t=document.querySelectorAll(".facto-scanner-checkbox:checked"),e=[];for(let o=0;o<t.length;o++)e.push(t[o].getAttribute("data-folder"));return e}provisionOne(t){this.pict.views["Pict-Section-Modal"].toast("Provisioning "+t+"...",{type:"info"}),this.pict.providers.Facto.provisionScannerDataset(t).then(e=>{e&&e.Error?this.pict.views["Pict-Section-Modal"].toast("Error: "+e.Error,{type:"error"}):(this.pict.views["Pict-Section-Modal"].toast("Provisioned "+t+" (Source #"+(e.Source?e.Source.IDSource:"?")+", Dataset #"+(e.Dataset?e.Dataset.IDDataset:"?")+")",{type:"success"}),this.loadScannerState())}).catch(t=>{this.pict.views["Pict-Section-Modal"].toast("Error: "+t.message,{type:"error"})})}ingestOne(t){this.pict.views["Pict-Section-Modal"].toast("Ingesting "+t+"...",{type:"info"}),this.pict.providers.Facto.ingestScannerDataset(t).then(e=>{if(e&&e.Error)return void this.pict.views["Pict-Section-Modal"].toast("Ingest error: "+e.Error,{type:"error"});let o="Ingested "+t;void 0!==e.RecordsIngested&&(o+=" — "+e.RecordsIngested+" records"),e.File&&(o+=" from "+e.File),this.pict.views["Pict-Section-Modal"].toast(o,{type:"success"}),this.loadScannerState()}).catch(t=>{this.pict.views["Pict-Section-Modal"].toast("Ingest error: "+t.message,{type:"error"})})}async provisionSelected(){let t=this.getSelectedFolderNames();0!==t.length?await this.pict.views["Pict-Section-Modal"].confirm("Provision "+t.length+" selected dataset(s)?",{title:"Provision Selected",confirmLabel:"Provision"})&&this.provisionBatch(t,0,0,0):this.pict.views["Pict-Section-Modal"].toast("Select datasets to provision using the checkboxes",{type:"warning"})}async provisionAll(){await this.pict.views["Pict-Section-Modal"].confirm("Provision ALL discovered datasets?",{title:"Provision All",confirmLabel:"Provision All",dangerous:!0})&&(this.pict.views["Pict-Section-Modal"].toast("Provisioning all datasets...",{type:"info"}),this.pict.providers.Facto.provisionAllScannerDatasets().then(t=>{t&&t.Error?this.pict.views["Pict-Section-Modal"].toast("Error: "+t.Error,{type:"error"}):(this.pict.views["Pict-Section-Modal"].toast("Provisioned "+t.Provisioned+" of "+t.Total+" ("+t.Errors+" error(s))",{type:"success"}),this.loadScannerState())}).catch(t=>{this.pict.views["Pict-Section-Modal"].toast("Error: "+t.message,{type:"error"})}))}provisionBatch(t,e,o,i){if(e>=t.length)return this.pict.views["Pict-Section-Modal"].toast("Provisioned "+o+" of "+t.length+" ("+i+" error(s))",{type:"success"}),void this.loadScannerState();let n=t[e];this.pict.views["Pict-Section-Modal"].toast("Provisioning "+(e+1)+"/"+t.length+": "+n+"...",{type:"info"}),this.pict.providers.Facto.provisionScannerDataset(n).then(n=>{n&&n.Error?this.provisionBatch(t,e+1,o,i+1):this.provisionBatch(t,e+1,o+1,i)}).catch(()=>{this.provisionBatch(t,e+1,o,i+1)})}loadIngestionPlan(t){let e=document.getElementById("facto-scanner-plan-"+t);e&&(e.innerHTML='<span style="color:var(--facto-text-secondary);">Loading ingestion plan...</span>',this.pict.providers.Facto.loadIngestionPlan(t).then(o=>{o&&o.Error?e.innerHTML='<div class="facto-status facto-status-error" style="margin:0;">'+o.Error+"</div>":this.renderIngestionPlan(t,o)}).catch(t=>{e.innerHTML='<div class="facto-status facto-status-error" style="margin:0;">Error: '+t.message+"</div>"}))}renderIngestionPlan(t,e){let o=document.getElementById("facto-scanner-plan-"+t);if(!o)return;let i=e.files||[],n=this.escapeAttr(t),a="";if(a+='<div style="font-size:0.85em; color:var(--facto-text-secondary); margin-bottom:0.75em;">',e.autoGenerated?a+="Auto-generated "+new Date(e.generatedAt).toLocaleString():a+="Modified "+new Date(e.modifiedAt).toLocaleString(),a+=" — "+i.filter(t=>t.include).length+" of "+i.length+" file(s) included",a+="</div>",0===i.length)return a+='<div class="facto-empty">No data files found for plan generation.</div>',void(o.innerHTML=a);a+='<table style="font-size:0.9em;"><thead><tr>',a+="<th>Include</th><th>File</th><th>Record Type</th><th>Format</th><th>Order</th><th>Primary Key</th><th>Notes</th>",a+="</tr></thead><tbody>";for(let t=0;t<i.length;t++){let e=i[t];a+="<tr"+(e.include?"":' style="opacity:0.5;"')+">",a+='<td><input type="checkbox" class="facto-plan-include" data-index="'+t+'"'+(e.include?" checked":"")+"></td>",a+="<td style=\"font-family:'SF Mono', Consolas, monospace; font-size:0.85em;\">"+this.escapeHtml(e.fileName)+"</td>",a+='<td><input type="text" class="facto-plan-recordtype" data-index="'+t+'" value="'+this.escapeHtml(e.recordType||"")+'" style="width:120px; font-size:0.9em; padding:2px 4px; margin:0;"></td>',a+='<td><span class="facto-badge facto-badge-primary">'+(e.format||"")+"</span></td>",a+='<td><input type="number" class="facto-plan-order" data-index="'+t+'" value="'+(e.order||t+1)+'" style="width:50px; font-size:0.9em; padding:2px 4px; margin:0;" min="1"></td>',a+='<td style="font-size:0.85em; color:var(--facto-text-secondary);">'+this.escapeHtml(e.primaryKey||"")+"</td>",a+='<td><input type="text" class="facto-plan-notes" data-index="'+t+'" value="'+this.escapeHtml(e.notes||"")+'" style="width:150px; font-size:0.85em; padding:2px 4px; margin:0;" placeholder="optional"></td>',a+="</tr>"}a+="</tbody></table>",a+='<div style="margin-top:0.75em;">',a+="<button class=\"facto-btn facto-btn-success facto-btn-small\" onclick=\"pict.views['Facto-Full-Scanner'].saveIngestionPlan('"+n+"')\">Save Plan</button> ",a+="<button class=\"facto-btn facto-btn-primary facto-btn-small\" onclick=\"pict.views['Facto-Full-Scanner'].ingestFromPlan('"+n+"')\">Ingest from Plan</button>",a+="</div>",o.innerHTML=a,this._currentPlan=e,this._currentPlanFolder=t}collectPlanFromDOM(t){if(!this._currentPlan||this._currentPlanFolder!==t)return null;let e=JSON.parse(JSON.stringify(this._currentPlan));for(let t=0;t<e.files.length;t++){let o=document.querySelector('.facto-plan-include[data-index="'+t+'"]'),i=document.querySelector('.facto-plan-recordtype[data-index="'+t+'"]'),n=document.querySelector('.facto-plan-order[data-index="'+t+'"]'),a=document.querySelector('.facto-plan-notes[data-index="'+t+'"]');o&&(e.files[t].include=o.checked),i&&(e.files[t].recordType=i.value),n&&(e.files[t].order=parseInt(n.value,10)||t+1),a&&(e.files[t].notes=a.value)}return e}saveIngestionPlan(t){let e=this.collectPlanFromDOM(t);e?(this.pict.views["Pict-Section-Modal"].toast("Saving ingestion plan...",{type:"info"}),this.pict.providers.Facto.saveIngestionPlan(t,e).then(e=>{e&&e.Error?this.pict.views["Pict-Section-Modal"].toast("Save error: "+e.Error,{type:"error"}):(this.pict.views["Pict-Section-Modal"].toast("Ingestion plan saved for "+t,{type:"success"}),e.Plan&&(this._currentPlan=e.Plan,this.renderIngestionPlan(t,e.Plan)))}).catch(t=>{this.pict.views["Pict-Section-Modal"].toast("Save error: "+t.message,{type:"error"})})):this.pict.views["Pict-Section-Modal"].toast("No plan loaded to save",{type:"warning"})}async ingestFromPlan(t){let e=this.collectPlanFromDOM(t);if(e){let o=e.files.filter(t=>t.include);if(!await this.pict.views["Pict-Section-Modal"].confirm("Ingest "+o.length+" file(s) from the ingestion plan for "+t+"?",{title:"Ingest from Plan",confirmLabel:"Ingest"}))return;this.pict.views["Pict-Section-Modal"].toast("Saving plan and starting ingestion...",{type:"info"}),this.pict.providers.Facto.saveIngestionPlan(t,e).then(()=>this.pict.providers.Facto.ingestScannerDataset(t,{useIngestionPlan:!0})).then(t=>{if(t&&t.Error)return void this.pict.views["Pict-Section-Modal"].toast("Ingest error: "+t.Error,{type:"error"});let e="Ingested "+(t.FilesIngested||0)+" file(s), "+(t.TotalRecords||0)+" records";t.FilesErrored>0&&(e+=" ("+t.FilesErrored+" error(s))"),this.pict.views["Pict-Section-Modal"].toast(e,{type:"success"}),this.loadScannerState()}).catch(t=>{this.pict.views["Pict-Section-Modal"].toast("Ingest error: "+t.message,{type:"error"})})}else{if(!await this.pict.views["Pict-Section-Modal"].confirm("Ingest "+t+" using its ingestion plan?",{title:"Ingest from Plan",confirmLabel:"Ingest"}))return;this.pict.views["Pict-Section-Modal"].toast("Ingesting from plan...",{type:"info"}),this.pict.providers.Facto.ingestScannerDataset(t,{useIngestionPlan:!0}).then(t=>{if(t&&t.Error)return void this.pict.views["Pict-Section-Modal"].toast("Ingest error: "+t.Error,{type:"error"});let e="Ingested "+(t.FilesIngested||0)+" file(s), "+(t.TotalRecords||0)+" records";t.FilesErrored>0&&(e+=" ("+t.FilesErrored+" error(s))"),this.pict.views["Pict-Section-Modal"].toast(e,{type:"success"}),this.loadScannerState()}).catch(t=>{this.pict.views["Pict-Section-Modal"].toast("Ingest error: "+t.message,{type:"error"})})}}toggleRowMenu(t,e){t.stopPropagation();let o=document.getElementById("facto-row-actions-"+e);if(!o)return;let i=o.classList.contains("open");if(this.closeRowMenus(),!i){o.classList.add("open");let t=e=>{o.contains(e.target)||(o.classList.remove("open"),document.removeEventListener("click",t))};setTimeout(()=>{document.addEventListener("click",t)},0)}}closeRowMenus(){let t=document.querySelectorAll(".facto-row-actions.open");for(let e=0;e<t.length;e++)t[e].classList.remove("open")}viewDetail(t){let e="facto-scanner-detail-"+t,o=document.getElementById(e);if(o)return void o.remove();let i=document.querySelectorAll(".facto-scanner-detail-row");for(let t=0;t<i.length;t++)i[t].remove();let n=document.getElementById("facto-scanner-row-"+this.escapeAttr(t));if(!n)return;let a=n.children.length,r=document.createElement("tr");r.id=e,r.className="facto-scanner-detail-row",r.innerHTML='<td colspan="'+a+'"><div class="facto-scanner-detail-panel" style="margin:0;"><span style="color:var(--facto-text-secondary);">Loading details for '+this.escapeHtml(t)+"...</span></div></td>",n.after(r),this.pict.providers.Facto.loadScannerDatasetDetail(t).then(o=>{let i=document.getElementById(e);if(!i)return;if(o&&o.Error)return void(i.innerHTML='<td colspan="'+a+'"><div class="facto-status facto-status-error" style="margin:0;">'+o.Error+"</div></td>");let n='<td colspan="'+a+'"><div class="facto-scanner-detail-panel" style="margin:0;">';if(n+='<div style="display:flex; justify-content:space-between; align-items:center; margin-bottom:1em;">',n+='<h3 style="margin:0;">'+this.escapeHtml(o.Title||o.FolderName)+"</h3>",n+="<button class=\"facto-btn facto-btn-secondary\" onclick=\"pict.views['Facto-Full-Scanner'].viewDetail('"+this.escapeAttr(t)+"')\">Close</button>",n+="</div>",n+='<div class="facto-scanner-detail-grid">',n+="<div><strong>Folder:</strong> <span style=\"font-family:'SF Mono', Consolas, monospace;\">"+this.escapeHtml(o.FolderName)+"</span></div>",n+="<div><strong>Status:</strong> "+this.getStatusBadge(o.Status)+"</div>",n+="<div><strong>Provider:</strong> "+this.escapeHtml(o.Provider||"Unknown")+"</div>",n+="<div><strong>License:</strong> "+this.escapeHtml(o.License||"Unknown")+"</div>",o.SourceURL&&(n+='<div><strong>Source:</strong> <a href="'+this.escapeHtml(o.SourceURL)+'" target="_blank" style="color:var(--facto-brand);">'+this.escapeHtml(o.SourceURL.substring(0,60))+"</a></div>"),o.UpdateFrequency&&(n+="<div><strong>Update Frequency:</strong> "+this.escapeHtml(o.UpdateFrequency.substring(0,100))+"</div>"),o.RecordCount&&(n+="<div><strong>Record Count:</strong> "+this.escapeHtml(o.RecordCount.substring(0,100))+"</div>"),o.IDSource&&(n+='<div><strong>Source ID:</strong> <a href="#/Source/'+o.IDSource+'" style="color:var(--facto-brand);">#'+o.IDSource+"</a></div>"),o.IDDataset&&(n+="<div><strong>Dataset ID:</strong> #"+o.IDDataset+"</div>"),n+="</div>",o.Description&&(n+='<div style="margin-bottom:1em;"><strong>Description:</strong>',n+='<div class="facto-scanner-description">'+this.escapeHtml(o.Description.substring(0,500))+"</div>",n+="</div>"),o.DataFiles&&o.DataFiles.length>0){n+='<div style="margin-bottom:1em;"><strong>Data Files ('+o.DataFiles.length+"):</strong>",n+='<table style="margin-top:0.35em;"><thead><tr><th>File</th><th>Format</th><th>Size</th><th>Compressed</th></tr></thead><tbody>';for(let t=0;t<o.DataFiles.length&&t<20;t++){let e=o.DataFiles[t],i=this.formatSize(e.Size||0);n+="<tr>",n+="<td style=\"font-family:'SF Mono', Consolas, monospace; font-size:0.85em;\">"+this.escapeHtml(e.FileName)+"</td>",n+='<td><span class="facto-badge facto-badge-primary">'+(e.Format||"")+"</span></td>",n+="<td>"+i+"</td>",n+="<td>"+(e.Compressed?"Yes":"No")+"</td>",n+="</tr>"}n+="</tbody></table>",n+="</div>"}if(o.HasData&&o.DataFiles&&o.DataFiles.length>0&&(n+='<div style="margin-bottom:1em; padding-top:1em; border-top:1px solid var(--facto-border-subtle, #eee);">',n+='<div style="display:flex; justify-content:space-between; align-items:center; margin-bottom:0.5em;">',n+="<strong>Ingestion Plan</strong>",n+="<button class=\"facto-btn facto-btn-secondary facto-btn-small\" onclick=\"pict.views['Facto-Full-Scanner'].loadIngestionPlan('"+this.escapeAttr(t)+"')\">View / Generate Plan</button>",n+="</div>",n+='<div id="facto-scanner-plan-'+this.escapeAttr(t)+'"></div>',n+="</div>"),o.Errors&&o.Errors.length>0){n+='<div style="margin-bottom:1em;"><strong>Errors:</strong>',n+='<ul style="margin-top:0.35em; padding-left:1.5em; color:var(--facto-text-danger, #dc3545);">';for(let t=0;t<o.Errors.length;t++)n+="<li>"+this.escapeHtml(o.Errors[t])+"</li>";n+="</ul></div>"}n+='<div style="margin-top:1em; padding-top:1em; border-top:1px solid var(--facto-border-subtle, #eee);">',"Discovered"===o.Status&&(n+="<button class=\"facto-btn facto-btn-success\" onclick=\"pict.views['Facto-Full-Scanner'].provisionOne('"+this.escapeAttr(t)+"')\">Provision</button> "),o.HasData&&(n+="<button class=\"facto-btn facto-btn-primary\" onclick=\"pict.views['Facto-Full-Scanner'].ingestOne('"+this.escapeAttr(t)+"')\">Ingest Single</button> ",n+="<button class=\"facto-btn facto-btn-primary\" onclick=\"pict.views['Facto-Full-Scanner'].ingestFromPlan('"+this.escapeAttr(t)+"')\">Ingest from Plan</button> "),o.IDSource&&(n+='<button class="facto-btn facto-btn-secondary" onclick="pict.PictApplication.navigateTo(\'/Source/'+o.IDSource+"')\">View Source →</button> "),n+="</div>",n+="</div></td>",i.innerHTML=n,i.scrollIntoView({behavior:"smooth",block:"nearest"})}).catch(t=>{let o=document.getElementById(e);o&&(o.innerHTML='<td colspan="'+a+'"><div class="facto-status facto-status-error" style="margin:0;">Error: '+t.message+"</div></td>")})}},e.exports.default_configuration=n},{"pict-view":41}],60:[function(t,e,o){const i=t("pict-view"),n=t("./projections/Facto-Projections-Constants.js"),a=n.MICRODDL_TYPE_MAP,r=n.DATATYPE_TO_SYMBOL,s={ViewIdentifier:"Facto-Full-SchemaEditor",DefaultRenderable:"Facto-Full-SchemaEditor-Content",DefaultDestinationAddress:"#Facto-Proj-Schema-Editor-Container",AutoRender:!1,CSS:"\n\t\t/* Schema editor */\n\t\t.facto-schema-editor {\n\t\t\tdisplay: none;\n\t\t}\n\t\t.facto-schema-editor.active {\n\t\t\tdisplay: block;\n\t\t}\n\t\t.facto-schema-header {\n\t\t\tdisplay: flex;\n\t\t\talign-items: center;\n\t\t\tgap: 1em;\n\t\t\tmargin-bottom: 1em;\n\t\t}\n\t\t.facto-schema-header h3 {\n\t\t\tmargin: 0;\n\t\t\tflex: 1;\n\t\t}\n\t\t.facto-schema-mode-tabs {\n\t\t\tdisplay: flex;\n\t\t\tgap: 0;\n\t\t\tborder: 1px solid var(--facto-border, #d6c8ae);\n\t\t\tborder-radius: 6px;\n\t\t\toverflow: hidden;\n\t\t}\n\t\t.facto-schema-mode-tab {\n\t\t\tpadding: 0.35em 0.8em;\n\t\t\tfont-size: 0.78em;\n\t\t\tcursor: pointer;\n\t\t\tborder: none;\n\t\t\tbackground: transparent;\n\t\t\tcolor: var(--facto-text-secondary, #786848);\n\t\t\ttransition: background 0.15s, color 0.15s;\n\t\t}\n\t\t.facto-schema-mode-tab:not(:last-child) {\n\t\t\tborder-right: 1px solid var(--facto-border, #d6c8ae);\n\t\t}\n\t\t.facto-schema-mode-tab.active {\n\t\t\tbackground: var(--facto-brand-a12, rgba(24,165,160,0.12));\n\t\t\tcolor: var(--facto-brand, #18a5a0);\n\t\t}\n\n\t\t/* Column builder table */\n\t\t.facto-col-builder {\n\t\t\twidth: 100%;\n\t\t\tborder-collapse: collapse;\n\t\t\tmargin-bottom: 0.75em;\n\t\t}\n\t\t.facto-col-builder th {\n\t\t\ttext-align: left;\n\t\t\tfont-size: 0.72em;\n\t\t\tfont-weight: 600;\n\t\t\ttext-transform: uppercase;\n\t\t\tletter-spacing: 0.5px;\n\t\t\tcolor: var(--facto-text-tertiary, #a09070);\n\t\t\tpadding: 0.5em 0.4em;\n\t\t\tborder-bottom: 1px solid var(--facto-border, #d6c8ae);\n\t\t}\n\t\t.facto-col-builder td {\n\t\t\tpadding: 0.35em 0.4em;\n\t\t\tborder-bottom: 1px solid var(--facto-border-subtle, #e8ddc8);\n\t\t\tvertical-align: middle;\n\t\t}\n\t\t.facto-col-builder input,\n\t\t.facto-col-builder select {\n\t\t\twidth: 100%;\n\t\t\tpadding: 0.3em 0.5em;\n\t\t\tfont-size: 0.85em;\n\t\t\tborder: 1px solid var(--facto-border, #d6c8ae);\n\t\t\tborder-radius: 4px;\n\t\t\tbackground: var(--facto-bg-input, #fcf8f0);\n\t\t\tcolor: var(--facto-text, #3a3020);\n\t\t}\n\t\t.facto-col-builder .facto-col-size {\n\t\t\twidth: 80px;\n\t\t}\n\t\t.facto-col-remove-btn {\n\t\t\tbackground: transparent;\n\t\t\tborder: none;\n\t\t\tcolor: var(--facto-error, #c44836);\n\t\t\tcursor: pointer;\n\t\t\tfont-size: 1.1em;\n\t\t\tpadding: 0.2em 0.4em;\n\t\t\tborder-radius: 4px;\n\t\t}\n\t\t.facto-col-remove-btn:hover {\n\t\t\tbackground: rgba(196, 72, 54, 0.1);\n\t\t}\n\n\t\t/* DDL editor */\n\t\t.facto-ddl-editor {\n\t\t\twidth: 100%;\n\t\t\tmin-height: 160px;\n\t\t\tfont-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;\n\t\t\tfont-size: 0.85em;\n\t\t\tpadding: 0.75em;\n\t\t\tborder: 1px solid var(--facto-border, #d6c8ae);\n\t\t\tborder-radius: 6px;\n\t\t\tbackground: var(--facto-bg-input, #fcf8f0);\n\t\t\tcolor: var(--facto-text, #3a3020);\n\t\t\tresize: vertical;\n\t\t\ttab-size: 4;\n\t\t}\n\n\t\t/* Schema preview */\n\t\t.facto-schema-preview {\n\t\t\tpadding: 0.6em 0.8em;\n\t\t\tfont-family: 'SF Mono', 'Fira Code', monospace;\n\t\t\tfont-size: 0.78em;\n\t\t\tbackground: var(--facto-bg-code, #f0e8d8);\n\t\t\tborder: 1px solid var(--facto-border-subtle, #e8ddc8);\n\t\t\tborder-radius: 6px;\n\t\t\twhite-space: pre-wrap;\n\t\t\tmax-height: 200px;\n\t\t\toverflow: auto;\n\t\t\tcolor: var(--facto-text-secondary, #786848);\n\t\t\tmargin-top: 0.5em;\n\t\t}\n\n\t",Templates:[{Hash:"Facto-Full-SchemaEditor-Template",Template:'\n<div>\n\t<div id="Facto-Proj-Schema-Editor" class="facto-schema-editor">\n\t\t<div class="facto-schema-header">\n\t\t\t<button class="facto-btn facto-btn-secondary facto-btn-small" onclick="{~P~}.views[\'Facto-Full-ProjectionDetail\'].closeSchemaEditor()">← Back</button>\n\t\t\t<h3 id="Facto-Proj-Schema-Title">Schema Editor</h3>\n\t\t\t<div class="facto-schema-mode-tabs">\n\t\t\t\t<button class="facto-schema-mode-tab active" id="Facto-Proj-ModeTab-Visual" onclick="{~P~}.views[\'Facto-Full-SchemaEditor\'].switchEditorMode(\'visual\')">Visual Builder</button>\n\t\t\t\t<button class="facto-schema-mode-tab" id="Facto-Proj-ModeTab-DDL" onclick="{~P~}.views[\'Facto-Full-SchemaEditor\'].switchEditorMode(\'ddl\')">MicroDDL</button>\n\t\t\t</div>\n\t\t</div>\n\n\t\t\x3c!-- Visual Builder --\x3e\n\t\t<div id="Facto-Proj-Visual-Wrap">\n\t\t\t<table class="facto-col-builder">\n\t\t\t\t<thead>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<th style="width:35%;">Column Name</th>\n\t\t\t\t\t\t<th style="width:25%;">Data Type</th>\n\t\t\t\t\t\t<th style="width:15%;">Size</th>\n\t\t\t\t\t\t<th style="width:15%;"></th>\n\t\t\t\t\t</tr>\n\t\t\t\t</thead>\n\t\t\t\t<tbody id="Facto-Proj-ColBuilder-Body"></tbody>\n\t\t\t</table>\n\t\t\t<button class="facto-btn facto-btn-secondary facto-btn-small" onclick="{~P~}.views[\'Facto-Full-SchemaEditor\'].addColumn()">+ Add Column</button>\n\t\t\t<div class="facto-section-title" style="margin-top:1em; font-size:0.72em;">Generated MicroDDL</div>\n\t\t\t<div class="facto-schema-preview" id="Facto-Proj-DDL-Preview"></div>\n\t\t</div>\n\n\t\t\x3c!-- DDL Editor --\x3e\n\t\t<div id="Facto-Proj-DDL-Wrap" style="display:none;">\n\t\t\t<textarea class="facto-ddl-editor" id="Facto-Proj-DDL-Textarea" placeholder="!MyTable @IDMyTable $Name 200 #Count &CreatedDate"></textarea>\n\t\t\t<div style="margin-top:0.5em;">\n\t\t\t\t<button class="facto-btn facto-btn-secondary facto-btn-small" onclick="{~P~}.views[\'Facto-Full-SchemaEditor\'].compileDDL()">Compile & Preview</button>\n\t\t\t</div>\n\t\t\t<div class="facto-schema-preview" id="Facto-Proj-Schema-Preview" style="display:none;"></div>\n\t\t</div>\n\n\t\t<div style="margin-top:1em;">\n\t\t\t<button class="facto-btn facto-btn-primary" onclick="{~P~}.views[\'Facto-Full-SchemaEditor\'].saveSchema()">Save Schema</button>\n\t\t</div>\n\t</div>\n</div>\n'}],Renderables:[{RenderableHash:"Facto-Full-SchemaEditor-Content",TemplateHash:"Facto-Full-SchemaEditor-Template",DestinationAddress:"#Facto-Proj-Schema-Editor-Container",RenderMethod:"replace"}]};e.exports=class extends i{constructor(t,e,o){super(t,e,o),this._EditingIDDataset=0,this._EditingName="",this._Columns=[],this._EditorMode="visual"}editSchema(t,e){this._EditingIDDataset=t,this._EditingName=e||"",this.render();let o=document.getElementById("Facto-Proj-Schema-Editor"),i=document.getElementById("Facto-Proj-Schema-Title");o&&o.classList.add("active"),i&&(i.textContent="Schema: "+(e||"Untitled")),this.pict.providers.Facto.loadProjectionSchema(t).then(t=>{let o=t&&t.SchemaDefinition?t.SchemaDefinition:"",i=(e||"Record").replace(/[^a-zA-Z0-9]/g,""),a="ID"+i,r="GUID"+i;this._Columns=o?n.microDDLToColumns(o):[{Name:a,DataType:"AutoIdentity",Size:""},{Name:r,DataType:"GUID",Size:""}];let s=this._Columns.some(t=>t.Name===a),l=this._Columns.some(t=>t.Name===r);if(s||this._Columns.unshift({Name:a,DataType:"AutoIdentity",Size:""}),!l){let t=this._Columns.findIndex(t=>t.Name===a);this._Columns.splice(t+1,0,{Name:r,DataType:"GUID",Size:""})}this.refreshColumnBuilder(),this.updateDDLPreview();let c=document.getElementById("Facto-Proj-DDL-Textarea");c&&(c.value=o||n.columnsToMicroDDL(this._Columns,this._EditingName))})}switchEditorMode(t){this._EditorMode=t;let e=document.getElementById("Facto-Proj-Visual-Wrap"),o=document.getElementById("Facto-Proj-DDL-Wrap"),i=document.getElementById("Facto-Proj-ModeTab-Visual"),a=document.getElementById("Facto-Proj-ModeTab-DDL");if("visual"===t){e&&(e.style.display=""),o&&(o.style.display="none"),i&&i.classList.add("active"),a&&a.classList.remove("active");let t=document.getElementById("Facto-Proj-DDL-Textarea");t&&t.value.trim()&&(this._Columns=n.microDDLToColumns(t.value),this.refreshColumnBuilder(),this.updateDDLPreview())}else{e&&(e.style.display="none"),o&&(o.style.display=""),i&&i.classList.remove("active"),a&&a.classList.add("active"),this._marshalColumnsFromUI();let t=document.getElementById("Facto-Proj-DDL-Textarea");t&&(t.value=n.columnsToMicroDDL(this._Columns,this._EditingName))}}addColumn(){this._marshalColumnsFromUI(),this._Columns.push({Name:"",DataType:"String",Size:"200"}),this.refreshColumnBuilder(),this.updateDDLPreview()}removeColumn(t){this._marshalColumnsFromUI(),this._Columns.splice(t,1),this.refreshColumnBuilder(),this.updateDDLPreview()}refreshColumnBuilder(){let t=document.getElementById("Facto-Proj-ColBuilder-Body");if(!t)return;let e="";for(let t=0;t<this._Columns.length;t++){let o=this._Columns[t],i=!a[r[o.DataType]||"$"].HasSize;e+="<tr>",e+='<td><input type="text" value="'+(o.Name||"").replace(/"/g,""")+'" data-col-index="'+t+'" data-col-field="Name"></td>',e+='<td><select data-col-index="'+t+'" data-col-field="DataType" onchange="pict.views[\'Facto-Full-SchemaEditor\']._onColumnTypeChange('+t+', this.value)">';for(let t in a){let i=a[t],n=i.DataType===o.DataType?" selected":"";e+='<option value="'+i.DataType+'"'+n+">"+i.Label+"</option>"}e+="</select></td>",e+='<td><input type="text" class="facto-col-size" value="'+(o.Size||"").replace(/"/g,""")+'" data-col-index="'+t+'" data-col-field="Size"'+(i?" disabled":"")+"></td>",e+='<td><button class="facto-col-remove-btn" onclick="pict.views[\'Facto-Full-SchemaEditor\'].removeColumn('+t+')" title="Remove column">×</button></td>',e+="</tr>"}t.innerHTML=e}_onColumnTypeChange(t,e){this._marshalColumnsFromUI();let o=r[e]||"$";a[o].HasSize?this._Columns[t].Size||(this._Columns[t].Size="String"===e?"200":"8,2"):this._Columns[t].Size="",this._Columns[t].DataType=e,this.refreshColumnBuilder(),this.updateDDLPreview()}_marshalColumnsFromUI(){let t=document.querySelectorAll('#Facto-Proj-ColBuilder-Body input[data-col-field="Name"], #Facto-Proj-ColBuilder-Body input[data-col-field="Size"], #Facto-Proj-ColBuilder-Body select[data-col-field="DataType"]');for(let e=0;e<t.length;e++){let o=t[e],i=parseInt(o.getAttribute("data-col-index"),10),n=o.getAttribute("data-col-field");i>=0&&i<this._Columns.length&&n&&(this._Columns[i][n]=o.value)}}updateDDLPreview(){let t=document.getElementById("Facto-Proj-DDL-Preview");t&&(t.textContent=n.columnsToMicroDDL(this._Columns,this._EditingName))}compileDDL(){let t=document.getElementById("Facto-Proj-DDL-Textarea");if(!t)return;let e=t.value.trim();e?this.pict.providers.Facto.compileMicroDDL(e).then(t=>{let e=document.getElementById("Facto-Proj-Schema-Preview");if(e&&(e.style.display="block",t&&t.Schema?e.textContent=JSON.stringify(t.Schema,null,2):e.textContent="Error: "+(t&&t.Error?t.Error:"Unknown error")),t&&t.Schema&&t.Schema.Tables){let e=Object.keys(t.Schema.Tables);if(e.length>0){let o=t.Schema.Tables[e[0]];this._Columns=[];for(let t=0;t<o.Columns.length;t++){let e=o.Columns[t];this._Columns.push({Name:e.Column,DataType:e.DataType||"String",Size:e.Size||""})}}}}):this.pict.views["Pict-Section-Modal"].toast("Enter MicroDDL text first.",{type:"warning"})}saveSchema(){if(!this._EditingIDDataset)return void this.pict.views["Pict-Section-Modal"].toast("No projection selected.",{type:"warning"});let t;if("visual"===this._EditorMode&&this._marshalColumnsFromUI(),"ddl"===this._EditorMode){let e=document.getElementById("Facto-Proj-DDL-Textarea");t=e?e.value:""}else t=n.columnsToMicroDDL(this._Columns,this._EditingName);this.pict.providers.Facto.saveProjectionSchema(this._EditingIDDataset,t).then(t=>{if(t&&t.Error)return void this.pict.views["Pict-Section-Modal"].toast("Error saving schema: "+t.Error,{type:"error"});this.pict.views["Pict-Section-Modal"].toast("Schema saved (v"+(t.SchemaVersion||0)+")",{type:"success"});let e=this.pict.views["Facto-Full-ProjectionDetail"];e&&"function"==typeof e.onSchemaUpdated&&e.onSchemaUpdated(t.SchemaVersion)})}},e.exports.default_configuration=s},{"./projections/Facto-Projections-Constants.js":67,"pict-view":41}],61:[function(t,e,o){const i=t("pict-view"),n=t("pict-section-content"),a={ViewIdentifier:"Facto-Full-SourceDetail",DefaultRenderable:"Facto-Full-SourceDetail-Content",DefaultDestinationAddress:"#Facto-Full-Content-Container",AutoRender:!1,CSS:"\n\t\t.facto-source-detail-back {\n\t\t\tdisplay: inline-flex;\n\t\t\talign-items: center;\n\t\t\tgap: 0.35em;\n\t\t\tcolor: var(--facto-text-secondary);\n\t\t\tcursor: pointer;\n\t\t\tfont-size: 0.85em;\n\t\t\tmargin-bottom: 0.75em;\n\t\t\ttransition: color 0.15s;\n\t\t}\n\t\t.facto-source-detail-back:hover {\n\t\t\tcolor: var(--facto-brand);\n\t\t}\n\n\t\t/* Research context section */\n\t\t.facto-research-context {\n\t\t\tbackground: var(--facto-bg-elevated, #1a1e2a);\n\t\t\tborder: 1px solid var(--facto-border-subtle, #2a2e3a);\n\t\t\tborder-radius: 8px;\n\t\t\tpadding: 1em;\n\t\t\tmargin-bottom: 1.5em;\n\t\t}\n\t\t.facto-research-context h3 {\n\t\t\tmargin: 0 0 0.5em;\n\t\t\tfont-size: 0.75em;\n\t\t\ttext-transform: uppercase;\n\t\t\tletter-spacing: 0.05em;\n\t\t\tcolor: var(--facto-text-tertiary, #888);\n\t\t}\n\t\t.facto-research-context-detail {\n\t\t\tfont-size: 0.85em;\n\t\t\tcolor: var(--facto-text-secondary, #aaa);\n\t\t\tline-height: 1.6;\n\t\t}\n\t\t.facto-research-context-detail strong {\n\t\t\tcolor: var(--facto-text-heading, #eee);\n\t\t}\n\t\t.facto-research-context-note {\n\t\t\tmargin-top: 0.5em;\n\t\t\tpadding: 0.5em 0.75em;\n\t\t\tbackground: var(--facto-brand-a08);\n\t\t\tborder-left: 3px solid var(--facto-brand, #4a90d9);\n\t\t\tborder-radius: 0 4px 4px 0;\n\t\t\tfont-size: 0.85em;\n\t\t\tcolor: var(--facto-text-secondary, #aaa);\n\t\t}\n\n\t\t/* Dataset definitions table */\n\t\t.facto-dataset-defs {\n\t\t\tmargin-bottom: 1.5em;\n\t\t}\n\t\t.facto-dataset-defs h2 {\n\t\t\tfont-size: 1em;\n\t\t\tmargin: 0 0 0.75em;\n\t\t\tcolor: var(--facto-text-secondary, #aaa);\n\t\t\ttext-transform: uppercase;\n\t\t\tletter-spacing: 0.05em;\n\t\t}\n\n\t\t/* Documentation section */\n\t\t.facto-doc-section {\n\t\t\tmargin-top: 1.5em;\n\t\t}\n\t\t.facto-doc-section-header {\n\t\t\tdisplay: flex;\n\t\t\talign-items: center;\n\t\t\tgap: 0.75em;\n\t\t\tmargin-bottom: 0.75em;\n\t\t}\n\t\t.facto-doc-section-header h2 {\n\t\t\tfont-size: 1em;\n\t\t\tmargin: 0;\n\t\t\tcolor: var(--facto-text-secondary, #aaa);\n\t\t\ttext-transform: uppercase;\n\t\t\tletter-spacing: 0.05em;\n\t\t}\n\t\t.facto-edit-toggle {\n\t\t\tdisplay: inline-flex;\n\t\t\talign-items: center;\n\t\t\tgap: 0.35em;\n\t\t\tpadding: 0.25em 0.6em;\n\t\t\tfont-size: 0.75em;\n\t\t\tborder-radius: 4px;\n\t\t\tcursor: pointer;\n\t\t\ttransition: background 0.15s, color 0.15s;\n\t\t\tborder: 1px solid var(--facto-border-subtle, #2a2e3a);\n\t\t\tbackground: transparent;\n\t\t\tcolor: var(--facto-text-tertiary, #888);\n\t\t}\n\t\t.facto-edit-toggle:hover {\n\t\t\tborder-color: var(--facto-brand, #4a90d9);\n\t\t\tcolor: var(--facto-brand, #4a90d9);\n\t\t}\n\t\t.facto-edit-toggle.active {\n\t\t\tbackground: var(--facto-brand-a15);\n\t\t\tborder-color: var(--facto-brand, #4a90d9);\n\t\t\tcolor: var(--facto-brand, #4a90d9);\n\t\t}\n\n\t\t/* Read-only rendered content */\n\t\t.facto-doc-content-wrap {\n\t\t\tbackground: var(--facto-bg-elevated, #1a1e2a);\n\t\t\tborder: 1px solid var(--facto-border-subtle, #2a2e3a);\n\t\t\tborder-radius: 8px;\n\t\t\tpadding: 1.5em 2em;\n\t\t\tmin-height: 100px;\n\t\t}\n\t\t.facto-doc-content-wrap h1 {\n\t\t\tfont-size: 1.75em;\n\t\t\tcolor: var(--facto-text-heading, #eee);\n\t\t\tborder-bottom: 1px solid var(--facto-border-subtle, #2a2e3a);\n\t\t\tpadding-bottom: 0.3em;\n\t\t\tmargin-top: 0;\n\t\t}\n\t\t.facto-doc-content-wrap h2 {\n\t\t\tfont-size: 1.4em;\n\t\t\tcolor: var(--facto-text-heading, #eee);\n\t\t\tborder-bottom: 1px solid var(--facto-border-subtle, #2a2e3a);\n\t\t\tpadding-bottom: 0.25em;\n\t\t\tmargin-top: 1.5em;\n\t\t}\n\t\t.facto-doc-content-wrap h3 {\n\t\t\tfont-size: 1.15em;\n\t\t\tcolor: var(--facto-text-heading, #eee);\n\t\t\tmargin-top: 1.25em;\n\t\t}\n\t\t.facto-doc-content-wrap h4,\n\t\t.facto-doc-content-wrap h5,\n\t\t.facto-doc-content-wrap h6 {\n\t\t\tcolor: var(--facto-text-secondary, #ccc);\n\t\t\tmargin-top: 1em;\n\t\t}\n\t\t.facto-doc-content-wrap p {\n\t\t\tline-height: 1.7;\n\t\t\tcolor: var(--facto-text-secondary, #bbb);\n\t\t\tmargin: 0.75em 0;\n\t\t}\n\t\t.facto-doc-content-wrap a {\n\t\t\tcolor: var(--facto-brand, #4a90d9);\n\t\t}\n\t\t.facto-doc-content-wrap code {\n\t\t\tbackground: var(--facto-brand-a10);\n\t\t\tcolor: var(--facto-brand, #4a90d9);\n\t\t\tpadding: 0.15em 0.35em;\n\t\t\tborder-radius: 3px;\n\t\t\tfont-size: 0.9em;\n\t\t}\n\t\t.facto-doc-content-wrap pre {\n\t\t\tbackground: var(--facto-bg-input, #0d1117);\n\t\t\tborder: 1px solid var(--facto-border-subtle, #2a2e3a);\n\t\t\tborder-radius: 6px;\n\t\t\tpadding: 1em;\n\t\t\toverflow-x: auto;\n\t\t\tcolor: var(--facto-text-heading, #eee);\n\t\t}\n\t\t.facto-doc-content-wrap pre code {\n\t\t\tbackground: transparent;\n\t\t\tpadding: 0;\n\t\t\tcolor: inherit;\n\t\t}\n\t\t.facto-doc-content-wrap blockquote {\n\t\t\tborder-left: 3px solid var(--facto-brand, #4a90d9);\n\t\t\tpadding: 0.5em 1em;\n\t\t\tmargin: 1em 0;\n\t\t\tcolor: var(--facto-text-tertiary, #888);\n\t\t\tbackground: var(--facto-brand-a05);\n\t\t\tborder-radius: 0 4px 4px 0;\n\t\t}\n\t\t.facto-doc-content-wrap table {\n\t\t\twidth: 100%;\n\t\t\tborder-collapse: collapse;\n\t\t\tmargin: 1em 0;\n\t\t}\n\t\t.facto-doc-content-wrap table th,\n\t\t.facto-doc-content-wrap table td {\n\t\t\tborder: 1px solid var(--facto-border-subtle, #2a2e3a);\n\t\t\tpadding: 0.5em 0.75em;\n\t\t}\n\t\t.facto-doc-content-wrap table th {\n\t\t\tbackground: rgba(255, 255, 255, 0.03);\n\t\t\tcolor: var(--facto-text-heading, #eee);\n\t\t}\n\t\t.facto-doc-content-wrap img {\n\t\t\tmax-width: 100%;\n\t\t\theight: auto;\n\t\t\tborder-radius: 4px;\n\t\t\tmargin: 0.5em 0;\n\t\t}\n\t\t.facto-doc-content-wrap hr {\n\t\t\tborder: none;\n\t\t\tborder-top: 1px solid var(--facto-border-subtle, #2a2e3a);\n\t\t\tmargin: 1.5em 0;\n\t\t}\n\t\t.facto-doc-content-wrap ul,\n\t\t.facto-doc-content-wrap ol {\n\t\t\tcolor: var(--facto-text-secondary, #bbb);\n\t\t\tpadding-left: 1.5em;\n\t\t\tline-height: 1.7;\n\t\t}\n\t\t.facto-doc-list {\n\t\t\tdisplay: flex;\n\t\t\tflex-wrap: wrap;\n\t\t\tgap: 0.5em;\n\t\t\tmargin-bottom: 1em;\n\t\t}\n\t\t.facto-doc-item {\n\t\t\tpadding: 0.4em 0.75em;\n\t\t\tbackground: var(--facto-bg-elevated, #1a1e2a);\n\t\t\tborder: 1px solid var(--facto-border-subtle, #2a2e3a);\n\t\t\tborder-radius: 6px;\n\t\t\tfont-size: 0.85em;\n\t\t\tcursor: pointer;\n\t\t\tcolor: var(--facto-text-secondary, #aaa);\n\t\t\ttransition: border-color 0.15s, color 0.15s;\n\t\t}\n\t\t.facto-doc-item:hover {\n\t\t\tborder-color: var(--facto-brand, #4a90d9);\n\t\t\tcolor: var(--facto-text-heading, #eee);\n\t\t}\n\t\t.facto-doc-item.active {\n\t\t\tborder-color: var(--facto-brand, #4a90d9);\n\t\t\tcolor: var(--facto-brand, #4a90d9);\n\t\t\tbackground: var(--facto-brand-a10);\n\t\t}\n\t\t.facto-doc-new-input {\n\t\t\tdisplay: flex;\n\t\t\tgap: 0.5em;\n\t\t\talign-items: center;\n\t\t}\n\t\t.facto-doc-new-input input {\n\t\t\twidth: 240px;\n\t\t\tmargin-bottom: 0;\n\t\t}\n\t",Templates:[{Hash:"Facto-Full-SourceDetail-Template",Template:'\n<div class="facto-content">\n\t<div class="facto-source-detail-back" onclick="{~P~}.views[\'Facto-Full-SourceDetail\'].goBack()">\n\t\t← Back to Source Research\n\t</div>\n\n\t<div class="facto-content-header">\n\t\t<h1 id="Facto-SourceDetail-Title">Source</h1>\n\t</div>\n\n\t<div id="Facto-SourceDetail-Loading" style="color:var(--facto-text-secondary);">Loading source...</div>\n\t<div id="Facto-SourceDetail-Error" class="facto-status facto-status-error" style="display:none;"></div>\n\n\t<div id="Facto-SourceDetail-Container" style="display:none;">\n\t\t<div class="facto-record-meta" id="Facto-SourceDetail-Meta"></div>\n\n\t\t<div id="Facto-SourceDetail-ResearchContext"></div>\n\n\t\t<div class="facto-dataset-defs" id="Facto-SourceDetail-DatasetDefs"></div>\n\n\t\t<div class="facto-doc-section">\n\t\t\t<div class="facto-doc-section-header">\n\t\t\t\t<h2>Documentation</h2>\n\t\t\t\t<button class="facto-edit-toggle" id="Facto-SourceDetail-EditToggle" onclick="{~P~}.views[\'Facto-Full-SourceDetail\'].toggleEditMode()">\n\t\t\t\t\t✎ Edit\n\t\t\t\t</button>\n\t\t\t</div>\n\t\t\t<div id="Facto-SourceDetail-DocListWrap"></div>\n\t\t\t<div id="Facto-SourceDetail-ContentWrap" style="display:none;">\n\t\t\t\t<div class="facto-doc-content-wrap" id="Facto-SourceDetail-ContentDisplay"></div>\n\t\t\t</div>\n\t\t\t<div id="Facto-SourceDetail-EditorWrap" style="display:none;">\n\t\t\t\t<div id="Facto-SourceDetail-EditorContainer"></div>\n\t\t\t</div>\n\t\t</div>\n\t</div>\n</div>\n'}],Renderables:[{RenderableHash:"Facto-Full-SourceDetail-Content",TemplateHash:"Facto-Full-SourceDetail-Template",DestinationAddress:"#Facto-Full-Content-Container",RenderMethod:"replace"}]};e.exports=class extends i{constructor(t,e,o){super(t,e,o),this._CurrentIDSource=null,this._CurrentIDDoc=null,this._CurrentDocName="",this._CurrentDocContent="",this._Documentation=[],this._EditMode=!1}onBeforeInitialize(){return super.onBeforeInitialize(),this.pict.providers.PictContent||this.pict.addProvider("PictContent",{ProviderIdentifier:"PictContent"},n.PictContentProvider),!0}loadSource(t,e){this._CurrentIDSource=t,this._CurrentIDDoc=e||null,this.render()}onAfterRender(){if(super.onAfterRender(),!this._CurrentIDSource){let t=document.getElementById("Facto-SourceDetail-Loading");return void(t&&(t.textContent="No source selected."))}this._fetchAndDisplaySource()}_fetchAndDisplaySource(){let t=this.pict.providers.Facto,e=document.getElementById("Facto-SourceDetail-Loading"),o=document.getElementById("Facto-SourceDetail-Error"),i=null,n=null,a=null,r=t.loadSourceSummary(this._CurrentIDSource),s=t.loadSourceCatalogContext(this._CurrentIDSource),l=t.loadSourceDocumentation(this._CurrentIDSource);r.then(t=>{if(t&&t.Error)return e&&(e.style.display="none"),void(o&&(o.textContent="Error loading source: "+t.Error,o.style.display="block"));i=t}),s.then(t=>{n=t||{CatalogEntries:[],DatasetDefinitions:[]}}),l.then(t=>{a=t&&t.Documentation?t.Documentation:[]}),Promise.all([r,s,l]).then(()=>{if(!i||!i.Source)return e&&(e.style.display="none"),void(o&&(o.textContent="Source not found",o.style.display="block"));this._renderSourceDetail(i,n,a)}).catch(t=>{e&&(e.style.display="none"),o&&(o.textContent="Error loading source: "+(t.message||t),o.style.display="block")})}_renderSourceDetail(t,e,o){let i=document.getElementById("Facto-SourceDetail-Loading"),n=document.getElementById("Facto-SourceDetail-Container"),a=document.getElementById("Facto-SourceDetail-Title");i&&(i.style.display="none"),n&&(n.style.display="block");let r=t.Source;a&&(a.textContent=r.Hash||r.Name||"Source #"+r.IDSource);let s=document.getElementById("Facto-SourceDetail-Meta");s&&(s.innerHTML=this._buildMetaCards(r,t)),this._renderResearchContext(e),this._renderDatasetDefs(e),this._Documentation=o,this._renderDocList(),this._CurrentIDDoc&&this.selectDocument(this._CurrentIDDoc)}_buildMetaCards(t,e){let o=(t.GUIDSource||"").substring(0,8)+"…"+(t.GUIDSource||"").substring((t.GUIDSource||"").length-4),i=t.Active?'<span class="facto-badge facto-badge-success">Active</span>':'<span class="facto-badge facto-badge-muted">Inactive</span>',n="";return n+='<div class="facto-record-meta-card">',n+="<h3>Source Identity</h3>",n+='<div class="facto-record-meta-row"><span class="facto-record-meta-label">ID</span><span class="facto-record-meta-value">'+t.IDSource+"</span></div>",n+='<div class="facto-record-meta-row"><span class="facto-record-meta-label">GUID</span><span class="facto-record-meta-value">'+o+"</span></div>",n+='<div class="facto-record-meta-row"><span class="facto-record-meta-label">Hash</span><span class="facto-record-meta-value facto-hash-value">'+(t.Hash||"—")+"</span></div>",n+='<div class="facto-record-meta-row"><span class="facto-record-meta-label">Status</span><span class="facto-record-meta-value">'+i+"</span></div>",n+="</div>",n+='<div class="facto-record-meta-card">',n+="<h3>Connection</h3>",n+='<div class="facto-record-meta-row"><span class="facto-record-meta-label">Name</span><span class="facto-record-meta-value">'+(t.Name||"—")+"</span></div>",n+='<div class="facto-record-meta-row"><span class="facto-record-meta-label">Type</span><span class="facto-record-meta-value">'+(t.Type||"—")+"</span></div>",n+='<div class="facto-record-meta-row"><span class="facto-record-meta-label">URL</span><span class="facto-record-meta-value" title="'+(t.URL||"")+'">'+(t.URL||"—")+"</span></div>",n+="</div>",n+='<div class="facto-record-meta-card">',n+="<h3>Statistics</h3>",n+='<div class="facto-record-meta-row"><span class="facto-record-meta-label">Records</span><span class="facto-record-meta-value">'+(e.RecordCount||0).toLocaleString()+"</span></div>",n+='<div class="facto-record-meta-row"><span class="facto-record-meta-label">Datasets</span><span class="facto-record-meta-value">'+(e.DatasetCount||0)+"</span></div>",n+='<div class="facto-record-meta-row"><span class="facto-record-meta-label">Documents</span><span class="facto-record-meta-value">'+(e.DocumentationCount||0)+"</span></div>",n+="</div>",n}_renderResearchContext(t){let e=document.getElementById("Facto-SourceDetail-ResearchContext");if(!e)return;if(!t||!t.CatalogEntries||0===t.CatalogEntries.length)return void(e.innerHTML="");let o="";for(let e=0;e<t.CatalogEntries.length;e++){let i=t.CatalogEntries[e];o+='<div class="facto-research-context">',o+="<h3>Research Context"+(t.CatalogEntries.length>1?" ("+(e+1)+")":"")+"</h3>",o+='<div class="facto-research-context-detail">',o+="<strong>Agency:</strong> "+(i.Agency||"—"),o+=" · <strong>Category:</strong> "+(i.Category||"—"),o+=" · <strong>Region:</strong> "+(i.Region||"—"),o+=" · <strong>Update Frequency:</strong> "+(i.UpdateFrequency||"—"),o+=" · <strong>Verified:</strong> "+(i.Verified?"Yes":"No"),o+="</div>",i.Description&&(o+='<div class="facto-research-context-detail" style="margin-top:0.5em;">'+i.Description+"</div>"),i.Notes&&(o+='<div class="facto-research-context-note">'+i.Notes+"</div>"),o+="</div>"}e.innerHTML=o}_renderDatasetDefs(t){let e=document.getElementById("Facto-SourceDetail-DatasetDefs");if(!e)return;if(!t||!t.DatasetDefinitions||0===t.DatasetDefinitions.length)return void(e.innerHTML="");let o=t.DatasetDefinitions,i="<h2>Dataset Definitions</h2>";i+="<table><thead><tr><th>Name</th><th>Format</th><th>Endpoint</th><th>Policy</th><th>Status</th></tr></thead><tbody>";for(let t=0;t<o.length;t++){let e=o[t],n=e.Provisioned?'<span class="facto-badge facto-badge-success">Provisioned</span>':'<span class="facto-badge facto-badge-muted">Not provisioned</span>';i+="<tr>",i+="<td>"+(e.Name||"")+"</td>",i+='<td><span class="facto-badge facto-badge-primary">'+(e.Format||"")+"</span></td>",i+='<td style="max-width:250px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap;">'+(e.EndpointURL||"")+"</td>",i+="<td>"+(e.VersionPolicy||"Append")+"</td>",i+="<td>"+n+"</td>",i+="</tr>"}i+="</tbody></table>",e.innerHTML=i}_renderDocList(){let t=document.getElementById("Facto-SourceDetail-DocListWrap");if(!t)return;let e='<div class="facto-doc-list">';if(e+='<div class="facto-doc-new-input" id="Facto-SourceDetail-NewDocWrap">',e+='<input type="text" id="Facto-SourceDetail-NewDocName" placeholder="Document name...">',e+='<button class="facto-btn facto-btn-success facto-btn-small" onclick="pict.views[\'Facto-Full-SourceDetail\'].createDocument()">New Document</button>',e+="</div>",e+="</div>",this._Documentation&&this._Documentation.length>0){e+='<div class="facto-doc-list">';for(let t=0;t<this._Documentation.length;t++){let o=this._Documentation[t];e+='<div class="facto-doc-item'+(this._CurrentIDDoc&&parseInt(this._CurrentIDDoc,10)===o.IDSourceDocumentation?" active":"")+"\" onclick=\"pict.views['Facto-Full-SourceDetail'].selectDocument("+o.IDSourceDocumentation+')">',e+=o.Name||"Untitled",e+="</div>"}e+="</div>"}t.innerHTML=e}selectDocument(t){let e=this.pict.providers.Facto;this._CurrentIDDoc=t,window.history&&window.history.replaceState&&window.history.replaceState(null,"","#/Source/"+this._CurrentIDSource+"/Doc/"+t),this._renderDocList(),e.loadSourceDocument(this._CurrentIDSource,t).then(t=>{if(t&&t.Error)return void this.pict.log.error("Error loading document: "+t.Error);let e=t.Documentation;this._CurrentDocName=e.Name||"Untitled",this._CurrentDocContent=e.Content||"",this._showDocument()})}_showDocument(){let t=document.getElementById("Facto-SourceDetail-ContentWrap"),e=document.getElementById("Facto-SourceDetail-EditorWrap");if(this._EditMode){t&&(t.style.display="none"),e&&(e.style.display="block");let o=this.pict.views["Facto-Full-SourceEditor"];o&&o.openEditor(this._CurrentIDSource,this._CurrentIDDoc,this._CurrentDocName,this._CurrentDocContent)}else e&&(e.style.display="none"),t&&(t.style.display="block"),this._renderReadOnlyContent()}_renderReadOnlyContent(){let t=document.getElementById("Facto-SourceDetail-ContentDisplay");if(!t)return;if(!this._CurrentDocContent)return void(t.innerHTML='<p style="color:var(--facto-text-tertiary);">Empty document.</p>');let e=this.pict.providers.PictContent.parseMarkdown(this._CurrentDocContent);t.innerHTML=e}toggleEditMode(){let t=document.getElementById("Facto-SourceDetail-EditToggle");if(this._EditMode){let e=this.pict.views["Facto-Full-SourceEditor"];if(e){let t=e.closeEditor();this._CurrentDocContent=t.Content,this._CurrentDocName=t.Name}this._EditMode=!1,t&&(t.innerHTML="✎ Edit",t.classList.remove("active"))}else this._EditMode=!0,t&&(t.innerHTML="✓ Done",t.classList.add("active"));this._CurrentIDDoc&&this._showDocument()}createDocument(){let t=document.getElementById("Facto-SourceDetail-NewDocName"),e=t?t.value.trim():"";if(!e){let t=0;if(this._Documentation)for(let e=0;e<this._Documentation.length;e++){let o=this._Documentation[e].Name||"";("Untitled"===o||o.match(/^Untitled \d+$/))&&t++}e="Untitled "+(t+1)}let o=this.pict.providers.Facto;o.createSourceDocument(this._CurrentIDSource,{Name:e,DocumentType:"markdown",Content:"# "+e+"\n\n"}).then(e=>{if(e&&e.Success&&e.Documentation){t&&(t.value="");let i=e.Documentation.IDSourceDocumentation;return o.loadSourceDocumentation(this._CurrentIDSource).then(t=>{this._Documentation=t&&t.Documentation?t.Documentation:[],this._renderDocList(),this.selectDocument(i)})}})}closeDocument(){let t=document.getElementById("Facto-SourceDetail-EditorWrap"),e=document.getElementById("Facto-SourceDetail-ContentWrap");t&&(t.style.display="none"),e&&(e.style.display="none"),this._CurrentIDDoc=null,this._CurrentDocContent="",window.history&&window.history.replaceState&&window.history.replaceState(null,"","#/Source/"+this._CurrentIDSource),this._renderDocList()}onDocumentNameChanged(t,e){for(let o=0;o<this._Documentation.length;o++)if(this._Documentation[o].IDSourceDocumentation===parseInt(t,10)){this._Documentation[o].Name=e;break}this._CurrentDocName=e,this._renderDocList()}goBack(){this.pict.PictApplication.navigateTo("/SourceResearch")}},e.exports.default_configuration=a},{"pict-section-content":12,"pict-view":41}],62:[function(t,e,o){const i=t("pict-view"),n=t("pict-section-markdowneditor"),a=t("pict-section-content"),r={ViewIdentifier:"Facto-Full-SourceEditor",DefaultRenderable:"Facto-Full-SourceEditor-Content",DefaultDestinationAddress:"#Facto-SourceDetail-EditorContainer",AutoRender:!1,CSS:"\n\t\t.facto-doc-editor-wrap {\n\t\t\tbackground: var(--facto-bg-elevated, #1a1e2a);\n\t\t\tborder: 1px solid var(--facto-border-subtle, #2a2e3a);\n\t\t\tborder-radius: 8px;\n\t\t\tpadding: 1em;\n\t\t\tmin-height: 200px;\n\t\t}\n\t\t.facto-doc-toolbar {\n\t\t\tdisplay: flex;\n\t\t\talign-items: center;\n\t\t\tgap: 0.75em;\n\t\t\tmargin-bottom: 0.75em;\n\t\t}\n\t\t.facto-doc-name {\n\t\t\tfont-size: 0.9em;\n\t\t\tfont-weight: 600;\n\t\t\tcolor: var(--facto-text-heading, #eee);\n\t\t}\n\t\t.facto-doc-name-input {\n\t\t\tfont-size: 0.9em;\n\t\t\tfont-weight: 600;\n\t\t\tcolor: var(--facto-text-heading, #eee);\n\t\t\tbackground: var(--facto-bg-input, #0d1117);\n\t\t\tborder: 1px solid var(--facto-border, #3a3e4a);\n\t\t\tborder-radius: 4px;\n\t\t\tpadding: 0.2em 0.5em;\n\t\t\twidth: 250px;\n\t\t}\n\t\t.facto-doc-name-input:focus {\n\t\t\tborder-color: var(--facto-brand, #4a90d9);\n\t\t\toutline: none;\n\t\t}\n\n\t\t/* Editor toolbar controls */\n\t\t.facto-editor-controls {\n\t\t\tdisplay: flex;\n\t\t\talign-items: center;\n\t\t\tgap: 0.25em;\n\t\t\tmargin-left: auto;\n\t\t}\n\t\t.facto-editor-ctrl-btn {\n\t\t\tdisplay: inline-flex;\n\t\t\talign-items: center;\n\t\t\tgap: 0.3em;\n\t\t\tpadding: 0.2em 0.55em;\n\t\t\tfont-size: 0.72em;\n\t\t\tborder-radius: 4px;\n\t\t\tcursor: pointer;\n\t\t\tborder: 1px solid var(--facto-border-subtle, #2a2e3a);\n\t\t\tbackground: transparent;\n\t\t\tcolor: var(--facto-text-tertiary, #888);\n\t\t\ttransition: background 0.15s, color 0.15s, border-color 0.15s;\n\t\t\twhite-space: nowrap;\n\t\t}\n\t\t.facto-editor-ctrl-btn:hover {\n\t\t\tborder-color: var(--facto-border, #3a3e4a);\n\t\t\tcolor: var(--facto-text-secondary, #aaa);\n\t\t}\n\t\t.facto-editor-ctrl-btn.active {\n\t\t\tbackground: var(--facto-brand-a12);\n\t\t\tborder-color: var(--facto-brand, #4a90d9);\n\t\t\tcolor: var(--facto-brand, #4a90d9);\n\t\t}\n\t\t.facto-editor-ctrl-sep {\n\t\t\twidth: 1px;\n\t\t\theight: 16px;\n\t\t\tbackground: var(--facto-border-subtle, #2a2e3a);\n\t\t\tmargin: 0 0.25em;\n\t\t}\n\n\t\t/* Settings gear & flyout */\n\t\t.facto-settings-wrap {\n\t\t\tposition: relative;\n\t\t\tdisplay: flex;\n\t\t\talign-items: center;\n\t\t}\n\t\t.facto-settings-gear {\n\t\t\tbackground: transparent;\n\t\t\tborder: none;\n\t\t\tcursor: pointer;\n\t\t\tpadding: 4px;\n\t\t\tdisplay: flex;\n\t\t\talign-items: center;\n\t\t\tjustify-content: center;\n\t\t\tborder-radius: 4px;\n\t\t\tcolor: var(--facto-text-tertiary, #888);\n\t\t\ttransition: color 0.15s;\n\t\t}\n\t\t.facto-settings-gear:hover,\n\t\t.facto-settings-gear.active {\n\t\t\tcolor: var(--facto-brand, #4a90d9);\n\t\t}\n\t\t.facto-settings-gear svg {\n\t\t\twidth: 18px;\n\t\t\theight: 18px;\n\t\t\tfill: currentColor;\n\t\t}\n\t\t.facto-settings-overlay {\n\t\t\tdisplay: none;\n\t\t\tposition: fixed;\n\t\t\ttop: 0;\n\t\t\tleft: 0;\n\t\t\tright: 0;\n\t\t\tbottom: 0;\n\t\t\tz-index: 999;\n\t\t}\n\t\t.facto-settings-overlay.open {\n\t\t\tdisplay: block;\n\t\t}\n\t\t.facto-settings-flyout {\n\t\t\tposition: absolute;\n\t\t\ttop: 36px;\n\t\t\tright: 0;\n\t\t\twidth: 260px;\n\t\t\tbackground: var(--facto-bg-elevated, #1a1e2a);\n\t\t\tborder: 1px solid var(--facto-border, #3a3e4a);\n\t\t\tborder-radius: 8px;\n\t\t\tbox-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);\n\t\t\tz-index: 1000;\n\t\t\topacity: 0;\n\t\t\ttransform: translateY(-4px);\n\t\t\tpointer-events: none;\n\t\t\ttransition: opacity 0.15s ease, transform 0.15s ease;\n\t\t}\n\t\t.facto-settings-flyout.open {\n\t\t\topacity: 1;\n\t\t\ttransform: translateY(0);\n\t\t\tpointer-events: auto;\n\t\t}\n\t\t.facto-settings-flyout::before {\n\t\t\tcontent: '';\n\t\t\tposition: absolute;\n\t\t\ttop: -6px;\n\t\t\tright: 10px;\n\t\t\twidth: 10px;\n\t\t\theight: 10px;\n\t\t\tbackground: var(--facto-bg-elevated, #1a1e2a);\n\t\t\tborder-left: 1px solid var(--facto-border, #3a3e4a);\n\t\t\tborder-top: 1px solid var(--facto-border, #3a3e4a);\n\t\t\ttransform: rotate(45deg);\n\t\t}\n\t\t.facto-settings-section {\n\t\t\tpadding: 8px 12px;\n\t\t}\n\t\t.facto-settings-label {\n\t\t\tfont-size: 0.68rem;\n\t\t\tfont-weight: 600;\n\t\t\ttext-transform: uppercase;\n\t\t\tletter-spacing: 0.5px;\n\t\t\tcolor: var(--facto-text-tertiary, #888);\n\t\t\tmargin-bottom: 6px;\n\t\t}\n\t\t.facto-settings-divider {\n\t\t\theight: 1px;\n\t\t\tbackground: var(--facto-border-subtle, #2a2e3a);\n\t\t\tmargin: 2px 8px;\n\t\t}\n\t\t.facto-settings-row {\n\t\t\tdisplay: flex;\n\t\t\talign-items: center;\n\t\t\tjustify-content: space-between;\n\t\t\tgap: 8px;\n\t\t\tmargin-bottom: 5px;\n\t\t}\n\t\t.facto-settings-row:last-child {\n\t\t\tmargin-bottom: 0;\n\t\t}\n\t\t.facto-settings-checkbox {\n\t\t\twidth: 15px;\n\t\t\theight: 15px;\n\t\t\taccent-color: var(--facto-brand, #4a90d9);\n\t\t\tcursor: pointer;\n\t\t\tflex-shrink: 0;\n\t\t}\n\t\t.facto-settings-checkbox-label {\n\t\t\tfont-size: 0.82rem;\n\t\t\tcolor: var(--facto-text-secondary, #aaa);\n\t\t\tcursor: pointer;\n\t\t\tuser-select: none;\n\t\t}\n\t\t.facto-settings-select {\n\t\t\twidth: 130px;\n\t\t\tpadding: 4px 6px;\n\t\t\tborder: 1px solid var(--facto-border, #3a3e4a);\n\t\t\tborder-radius: 4px;\n\t\t\tbackground: var(--facto-bg-input, #0d1117);\n\t\t\tfont-size: 0.78rem;\n\t\t\tcolor: var(--facto-text-secondary, #aaa);\n\t\t\tcursor: pointer;\n\t\t}\n\t\t.facto-settings-select:disabled {\n\t\t\topacity: 0.35;\n\t\t\tcursor: not-allowed;\n\t\t}\n\t\t.facto-settings-select-label {\n\t\t\tfont-size: 0.78rem;\n\t\t\tcolor: var(--facto-text-tertiary, #888);\n\t\t\twhite-space: nowrap;\n\t\t}\n\n\t\t/* Override MarkdownEditor default light theme for dark theme.\n\t\t Selectors must match or exceed library specificity. */\n\t\t.facto-doc-editor-wrap .pict-mde {\n\t\t\tbackground: transparent;\n\t\t}\n\t\t.facto-doc-editor-wrap .pict-mde-segment {\n\t\t\tborder-color: var(--facto-border-subtle, #2a2e3a);\n\t\t}\n\t\t.facto-doc-editor-wrap .pict-mde-segment-body {\n\t\t\tbackground: var(--facto-bg-input, #0d1117);\n\t\t}\n\t\t.facto-doc-editor-wrap .pict-mde-segment.pict-mde-active .pict-mde-segment-body {\n\t\t\tbackground: var(--facto-bg-input, #0d1117);\n\t\t}\n\n\t\t/* Drag handle */\n\t\t.facto-doc-editor-wrap .pict-mde-drag-handle {\n\t\t\tbackground: var(--facto-border-subtle, #2a2e3a);\n\t\t}\n\t\t.facto-doc-editor-wrap .pict-mde-drag-handle:hover {\n\t\t\tbackground: var(--facto-border, #3a3e4a);\n\t\t}\n\t\t.facto-doc-editor-wrap .pict-mde-segment.pict-mde-active .pict-mde-drag-handle {\n\t\t\tbackground: var(--facto-brand-a25);\n\t\t}\n\n\t\t/* Left control buttons */\n\t\t.facto-doc-editor-wrap .pict-mde-left-btn {\n\t\t\tcolor: var(--facto-text-tertiary, #666);\n\t\t}\n\t\t.facto-doc-editor-wrap .pict-mde-left-btn:hover {\n\t\t\tcolor: var(--facto-text-heading, #eee);\n\t\t}\n\t\t.facto-doc-editor-wrap .pict-mde-btn-remove:hover {\n\t\t\tcolor: var(--facto-error, #dc3545);\n\t\t}\n\n\t\t/* CodeMirror editor — selectors must include .cm-editor to beat\n\t\t library's .pict-mde-segment-editor .cm-editor .cm-* specificity */\n\t\t.facto-doc-editor-wrap .pict-mde-segment-editor .cm-editor {\n\t\t\tbackground: var(--facto-bg-input, #0d1117);\n\t\t\tcolor: var(--facto-text-heading, #eee);\n\t\t}\n\t\t.facto-doc-editor-wrap .pict-mde-segment-editor .cm-editor .cm-gutters {\n\t\t\tbackground: var(--facto-bg-elevated, #1a1e2a);\n\t\t\tborder-color: var(--facto-border-subtle, #2a2e3a);\n\t\t\tcolor: var(--facto-text-tertiary, #666);\n\t\t}\n\t\t.facto-doc-editor-wrap .pict-mde-segment-editor .cm-editor .cm-activeLine {\n\t\t\tbackground: var(--facto-brand-a05);\n\t\t}\n\t\t.facto-doc-editor-wrap .pict-mde-segment-editor .cm-editor .cm-activeLineGutter {\n\t\t\tbackground: var(--facto-brand-a10);\n\t\t}\n\t\t.facto-doc-editor-wrap .pict-mde-segment-editor .cm-editor .cm-cursor {\n\t\t\tborder-left-color: var(--facto-text-heading, #eee);\n\t\t}\n\t\t.facto-doc-editor-wrap .pict-mde-segment-editor .cm-editor .cm-selectionBackground {\n\t\t\tbackground: var(--facto-brand-a20) !important;\n\t\t}\n\t\t.facto-doc-editor-wrap .pict-mde-segment-editor .cm-editor .cm-content {\n\t\t\tcolor: var(--facto-text-heading, #eee);\n\t\t}\n\t\t.facto-doc-editor-wrap .pict-mde-segment-editor .cm-editor .cm-lineNumbers .cm-gutterElement {\n\t\t\tcolor: var(--facto-text-tertiary, #555);\n\t\t}\n\n\t\t/* Rich preview — must match library's two-class specificity */\n\t\t.facto-doc-editor-wrap .pict-mde-rich-preview.pict-mde-has-rich-preview {\n\t\t\tbackground: var(--facto-bg-surface, #161a24);\n\t\t\tborder-color: var(--facto-border-subtle, #2a2e3a);\n\t\t\tcolor: var(--facto-text-secondary, #aaa);\n\t\t}\n\t\t.facto-doc-editor-wrap .pict-mde-rich-preview h1,\n\t\t.facto-doc-editor-wrap .pict-mde-rich-preview h2,\n\t\t.facto-doc-editor-wrap .pict-mde-rich-preview h3,\n\t\t.facto-doc-editor-wrap .pict-mde-rich-preview h4 {\n\t\t\tcolor: var(--facto-text-heading, #eee);\n\t\t}\n\t\t.facto-doc-editor-wrap .pict-mde-rich-preview code {\n\t\t\tbackground: var(--facto-brand-a10);\n\t\t\tcolor: var(--facto-brand, #4a90d9);\n\t\t}\n\t\t.facto-doc-editor-wrap .pict-mde-rich-preview pre {\n\t\t\tbackground: var(--facto-bg-input, #0d1117);\n\t\t\tborder: 1px solid var(--facto-border-subtle, #2a2e3a);\n\t\t\tcolor: var(--facto-text-heading, #eee);\n\t\t}\n\t\t.facto-doc-editor-wrap .pict-mde-rich-preview a {\n\t\t\tcolor: var(--facto-brand, #4a90d9);\n\t\t}\n\t\t.facto-doc-editor-wrap .pict-mde-rich-preview blockquote {\n\t\t\tborder-left-color: var(--facto-brand, #4a90d9);\n\t\t\tcolor: var(--facto-text-tertiary, #888);\n\t\t}\n\t\t.facto-doc-editor-wrap .pict-mde-rich-preview table th,\n\t\t.facto-doc-editor-wrap .pict-mde-rich-preview table td {\n\t\t\tborder-color: var(--facto-border-subtle, #2a2e3a);\n\t\t}\n\t\t.facto-doc-editor-wrap .pict-mde-rich-preview hr {\n\t\t\tborder-color: var(--facto-border-subtle, #2a2e3a);\n\t\t}\n\n\t\t/* Image preview */\n\t\t.facto-doc-editor-wrap .pict-mde-image-preview.pict-mde-has-images {\n\t\t\tborder-color: var(--facto-border-subtle, #2a2e3a);\n\t\t}\n\t\t.facto-doc-editor-wrap .pict-mde-image-preview-label {\n\t\t\tcolor: var(--facto-text-tertiary, #666);\n\t\t\tbackground: var(--facto-bg-surface, #161a24);\n\t\t}\n\n\t\t/* Add-segment button */\n\t\t.facto-doc-editor-wrap .pict-mde-btn-add {\n\t\t\tbackground: var(--facto-bg-surface, #161a24);\n\t\t\tborder-color: var(--facto-border-subtle, #2a2e3a);\n\t\t\tcolor: var(--facto-text-tertiary, #666);\n\t\t}\n\t\t.facto-doc-editor-wrap .pict-mde-btn-add:hover {\n\t\t\tborder-color: var(--facto-brand, #4a90d9);\n\t\t\tcolor: var(--facto-brand, #4a90d9);\n\t\t\tbackground: var(--facto-brand-a05);\n\t\t}\n\n\t\t/* Sidebar buttons */\n\t\t.facto-doc-editor-wrap .pict-mde-sidebar-btn {\n\t\t\tbackground: var(--facto-bg-surface, #161a24);\n\t\t\tborder-color: var(--facto-border-subtle, #2a2e3a);\n\t\t\tcolor: var(--facto-text-tertiary, #666);\n\t\t}\n\t\t.facto-doc-editor-wrap .pict-mde-sidebar-btn:hover {\n\t\t\tborder-color: var(--facto-brand, #4a90d9);\n\t\t\tcolor: var(--facto-brand, #4a90d9);\n\t\t}\n\n\t\t/* Drag-over indicators */\n\t\t.facto-doc-editor-wrap .pict-mde-segment.pict-mde-drag-over-top {\n\t\t\tborder-top-color: var(--facto-brand, #4a90d9);\n\t\t}\n\t\t.facto-doc-editor-wrap .pict-mde-segment.pict-mde-drag-over-bottom {\n\t\t\tborder-bottom-color: var(--facto-brand, #4a90d9);\n\t\t}\n\n\t\t/* Rendered view (full-document preview mode) */\n\t\t.facto-doc-editor-wrap .pict-mde-rendered-view {\n\t\t\tbackground: var(--facto-bg-surface, #161a24);\n\t\t\tborder-color: var(--facto-border-subtle, #2a2e3a);\n\t\t\tcolor: var(--facto-text-secondary, #aaa);\n\t\t}\n\t\t.facto-doc-editor-wrap .pict-mde-rendered-view h1,\n\t\t.facto-doc-editor-wrap .pict-mde-rendered-view h2,\n\t\t.facto-doc-editor-wrap .pict-mde-rendered-view h3,\n\t\t.facto-doc-editor-wrap .pict-mde-rendered-view h4 {\n\t\t\tcolor: var(--facto-text-heading, #eee);\n\t\t}\n\t\t.facto-doc-editor-wrap .pict-mde-rendered-view p {\n\t\t\tcolor: var(--facto-text-secondary, #bbb);\n\t\t}\n\t\t.facto-doc-editor-wrap .pict-mde-rendered-view a {\n\t\t\tcolor: var(--facto-brand, #4a90d9);\n\t\t}\n\t\t.facto-doc-editor-wrap .pict-mde-rendered-view code {\n\t\t\tbackground: var(--facto-brand-a10);\n\t\t\tcolor: var(--facto-brand, #4a90d9);\n\t\t}\n\t\t.facto-doc-editor-wrap .pict-mde-rendered-view pre {\n\t\t\tbackground: var(--facto-bg-input, #0d1117);\n\t\t\tborder: 1px solid var(--facto-border-subtle, #2a2e3a);\n\t\t\tcolor: var(--facto-text-heading, #eee);\n\t\t}\n\t\t.facto-doc-editor-wrap .pict-mde-rendered-view pre code {\n\t\t\tbackground: transparent;\n\t\t\tcolor: inherit;\n\t\t}\n\t\t.facto-doc-editor-wrap .pict-mde-rendered-view blockquote {\n\t\t\tborder-left-color: var(--facto-brand, #4a90d9);\n\t\t\tcolor: var(--facto-text-tertiary, #888);\n\t\t}\n\t\t.facto-doc-editor-wrap .pict-mde-rendered-view table th,\n\t\t.facto-doc-editor-wrap .pict-mde-rendered-view table td {\n\t\t\tborder-color: var(--facto-border-subtle, #2a2e3a);\n\t\t}\n\t\t.facto-doc-editor-wrap .pict-mde-rendered-view img {\n\t\t\tmax-width: 100%;\n\t\t\theight: auto;\n\t\t\tborder-radius: 4px;\n\t\t}\n\t",Templates:[{Hash:"Facto-Full-SourceEditor-Template",Template:'\n<div class="facto-doc-editor-wrap">\n\t<div class="facto-doc-toolbar">\n\t\t<span class="facto-doc-name" id="Facto-SourceDetail-DocName"></span>\n\t\t<div class="facto-editor-controls" id="Facto-SourceDetail-EditorControls">\n\t\t\t<button class="facto-editor-ctrl-btn active" id="Facto-EditorCtrl-Preview" title="Toggle rich previews below each segment" onclick="{~P~}.views[\'Facto-Full-SourceEditor\'].toggleEditorPreview()">◎ Preview</button>\n\t\t\t<button class="facto-editor-ctrl-btn active" id="Facto-EditorCtrl-LineNums" title="Toggle line numbers and sidebar controls" onclick="{~P~}.views[\'Facto-Full-SourceEditor\'].toggleEditorControls()">⊞ Controls</button>\n\t\t\t<div class="facto-editor-ctrl-sep"></div>\n\t\t\t<button class="facto-editor-ctrl-btn" id="Facto-EditorCtrl-Rendered" title="Preview the full document as rendered markdown" onclick="{~P~}.views[\'Facto-Full-SourceEditor\'].toggleEditorRenderedView()">▣ Full Preview</button>\n\t\t\t<div class="facto-editor-ctrl-sep"></div>\n\t\t\t<div class="facto-settings-wrap">\n\t\t\t\t<button class="facto-settings-gear" id="Facto-EditorSettings-Gear" title="Editor settings"\n\t\t\t\t\tonclick="{~P~}.views[\'Facto-Full-SourceEditor\'].toggleSettingsPanel()">\n\t\t\t\t\t<svg viewBox="0 0 24 24"><path d="M19.14 12.94c.04-.3.06-.61.06-.94 0-.32-.02-.64-.07-.94l2.03-1.58a.49.49 0 0 0 .12-.61l-1.92-3.32a.49.49 0 0 0-.59-.22l-2.39.96c-.5-.38-1.03-.7-1.62-.94l-.36-2.54a.48.48 0 0 0-.48-.41h-3.84a.48.48 0 0 0-.48.41l-.36 2.54c-.59.24-1.13.57-1.62.94l-2.39-.96a.49.49 0 0 0-.59.22L2.74 8.87a.48.48 0 0 0 .12.61l2.03 1.58c-.05.3-.07.62-.07.94s.02.64.07.94l-2.03 1.58a.49.49 0 0 0-.12.61l1.92 3.32c.12.22.37.29.59.22l2.39-.96c.5.38 1.03.7 1.62.94l.36 2.54c.05.24.26.41.48.41h3.84c.24 0 .44-.17.48-.41l.36-2.54c.59-.24 1.13-.56 1.62-.94l2.39.96c.22.08.47 0 .59-.22l1.92-3.32c.12-.22.07-.47-.12-.61l-2.01-1.58zM12 15.6A3.6 3.6 0 1 1 12 8.4a3.6 3.6 0 0 1 0 7.2z"/></svg>\n\t\t\t\t</button>\n\t\t\t\t<div class="facto-settings-overlay" id="Facto-EditorSettings-Overlay"\n\t\t\t\t\tonclick="{~P~}.views[\'Facto-Full-SourceEditor\'].closeSettingsPanel()"></div>\n\t\t\t\t<div class="facto-settings-flyout" id="Facto-EditorSettings-Flyout">\n\t\t\t\t\t<div class="facto-settings-section">\n\t\t\t\t\t\t<div class="facto-settings-label">Segmentation</div>\n\t\t\t\t\t\t<div class="facto-settings-row">\n\t\t\t\t\t\t\t<label class="facto-settings-checkbox-label"\n\t\t\t\t\t\t\t\tfor="Facto-Setting-AutoSegment">Auto Segment Markdown</label>\n\t\t\t\t\t\t\t<input type="checkbox" class="facto-settings-checkbox"\n\t\t\t\t\t\t\t\tid="Facto-Setting-AutoSegment"\n\t\t\t\t\t\t\t\tonchange="{~P~}.views[\'Facto-Full-SourceEditor\'].onAutoSegmentChanged(this.checked)">\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<div class="facto-settings-row">\n\t\t\t\t\t\t\t<span class="facto-settings-select-label">Segment Depth</span>\n\t\t\t\t\t\t\t<select class="facto-settings-select"\n\t\t\t\t\t\t\t\tid="Facto-Setting-SegmentDepth"\n\t\t\t\t\t\t\t\tdisabled\n\t\t\t\t\t\t\t\tonchange="{~P~}.views[\'Facto-Full-SourceEditor\'].onSegmentDepthChanged(this.value)">\n\t\t\t\t\t\t\t\t<option value="1">Depth 1: Blocks</option>\n\t\t\t\t\t\t\t\t<option value="2" selected>Depth 2: ##</option>\n\t\t\t\t\t\t\t\t<option value="3">Depth 3: ###</option>\n\t\t\t\t\t\t\t\t<option value="4">Depth 4: ####</option>\n\t\t\t\t\t\t\t\t<option value="5">Depth 5: #####</option>\n\t\t\t\t\t\t\t\t<option value="6">Depth 6: ######</option>\n\t\t\t\t\t\t\t</select>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t\t<div class="facto-settings-divider"></div>\n\t\t\t\t\t<div class="facto-settings-section">\n\t\t\t\t\t\t<div class="facto-settings-label">Word Wrap</div>\n\t\t\t\t\t\t<div class="facto-settings-row">\n\t\t\t\t\t\t\t<label class="facto-settings-checkbox-label"\n\t\t\t\t\t\t\t\tfor="Facto-Setting-WordWrap">Markdown Word Wrap</label>\n\t\t\t\t\t\t\t<input type="checkbox" class="facto-settings-checkbox"\n\t\t\t\t\t\t\t\tid="Facto-Setting-WordWrap"\n\t\t\t\t\t\t\t\tonchange="{~P~}.views[\'Facto-Full-SourceEditor\'].onWordWrapChanged(this.checked)">\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</div>\n\t\t<button class="facto-btn facto-btn-primary facto-btn-small" onclick="{~P~}.views[\'Facto-Full-SourceEditor\'].saveDocument()">Save</button>\n\t</div>\n\t<div id="Facto-SourceDetail-MarkdownEditor-Container"></div>\n</div>\n'}],Renderables:[{RenderableHash:"Facto-Full-SourceEditor-Content",TemplateHash:"Facto-Full-SourceEditor-Template",DestinationAddress:"#Facto-SourceDetail-EditorContainer",RenderMethod:"replace"}]};e.exports=class extends i{constructor(t,e,o){super(t,e,o),this._CurrentIDSource=null,this._CurrentIDDoc=null,this._CurrentDocName="",this._CurrentDocContent="",this._SettingsOpen=!1,this._AutoSegment=!1,this._AutoSegmentDepth=2,this._WordWrap=!1}onBeforeInitialize(){return super.onBeforeInitialize(),this.fable.servicesMap.hasOwnProperty("PictViewMarkdownEditor")||this.fable.addServiceType("PictViewMarkdownEditor",n),this.pict.providers.PictContent||this.pict.addProvider("PictContent",{ProviderIdentifier:"PictContent"},a.PictContentProvider),!0}openEditor(t,e,o,i){this._CurrentIDSource=t,this._CurrentIDDoc=e,this._CurrentDocName=o||"",this._CurrentDocContent=i||"",this.pict.AppData.Facto.CurrentDocumentSegments=this._segmentMarkdownContent(this._CurrentDocContent),this.render();let n=document.getElementById("Facto-SourceDetail-DocName");n&&(n.innerHTML='<input type="text" class="facto-doc-name-input" id="Facto-SourceDetail-DocNameInput" value="'+(this._CurrentDocName||"").replace(/"/g,""")+'">'),this._renderMarkdownEditor(),this._syncEditorToolbarState()}closeEditor(){let t=this.pict.views["Facto-SourceDetail-MarkdownEditor"];t&&t._renderedViewActive&&t.toggleRenderedView(!1),this._marshalEditorContent();let e=document.getElementById("Facto-SourceDetail-DocNameInput");if(e){let t=e.value.trim();t&&t!==this._CurrentDocName&&(this._CurrentDocName=t)}return{Content:this._CurrentDocContent,Name:this._CurrentDocName}}_syncEditorToolbarState(){let t=this.pict.views["Facto-SourceDetail-MarkdownEditor"];if(!t)return;let e=document.getElementById("Facto-EditorCtrl-Preview");e&&e.classList.toggle("active",t._previewsVisible);let o=document.getElementById("Facto-EditorCtrl-LineNums");o&&o.classList.toggle("active",t._controlsVisible);let i=document.getElementById("Facto-EditorCtrl-Rendered");i&&i.classList.toggle("active",t._renderedViewActive)}toggleEditorPreview(){let t=this.pict.views["Facto-SourceDetail-MarkdownEditor"];if(!t)return;t.togglePreview();let e=document.getElementById("Facto-EditorCtrl-Preview");e&&e.classList.toggle("active",t._previewsVisible)}toggleEditorControls(){let t=this.pict.views["Facto-SourceDetail-MarkdownEditor"];if(!t)return;t.toggleControls();let e=document.getElementById("Facto-EditorCtrl-LineNums");e&&e.classList.toggle("active",t._controlsVisible)}toggleEditorRenderedView(){let t=this.pict.views["Facto-SourceDetail-MarkdownEditor"];if(!t)return;t.toggleRenderedView();let e=document.getElementById("Facto-EditorCtrl-Rendered");e&&e.classList.toggle("active",t._renderedViewActive)}toggleSettingsPanel(){this._SettingsOpen?this.closeSettingsPanel():this.openSettingsPanel()}openSettingsPanel(){this._SettingsOpen=!0;let t=document.getElementById("Facto-EditorSettings-Flyout"),e=document.getElementById("Facto-EditorSettings-Overlay"),o=document.getElementById("Facto-EditorSettings-Gear");t&&t.classList.add("open"),e&&e.classList.add("open"),o&&o.classList.add("active");let i=document.getElementById("Facto-Setting-AutoSegment");i&&(i.checked=this._AutoSegment);let n=document.getElementById("Facto-Setting-SegmentDepth");n&&(n.value=String(this._AutoSegmentDepth),n.disabled=!this._AutoSegment);let a=document.getElementById("Facto-Setting-WordWrap");a&&(a.checked=this._WordWrap)}closeSettingsPanel(){this._SettingsOpen=!1;let t=document.getElementById("Facto-EditorSettings-Flyout"),e=document.getElementById("Facto-EditorSettings-Overlay"),o=document.getElementById("Facto-EditorSettings-Gear");t&&t.classList.remove("open"),e&&e.classList.remove("open"),o&&o.classList.remove("active")}onAutoSegmentChanged(t){this._AutoSegment=t;let e=document.getElementById("Facto-Setting-SegmentDepth");e&&(e.disabled=!t),t&&this._CurrentDocContent&&this._resegmentAndRebuildEditor()}onSegmentDepthChanged(t){this._AutoSegmentDepth=parseInt(t,10)||2,this._AutoSegment&&this._CurrentDocContent&&this._resegmentAndRebuildEditor()}onWordWrapChanged(t){this._WordWrap=t;let e=this.pict.views["Facto-SourceDetail-MarkdownEditor"];if(e&&e._segmentEditors)for(let o in e._segmentEditors){let i=e._segmentEditors[o];i&&i.contentDOM&&(t?i.contentDOM.classList.add("cm-lineWrapping"):i.contentDOM.classList.remove("cm-lineWrapping"))}}_resegmentAndRebuildEditor(){this._marshalEditorContent();let t=this._segmentMarkdownContent(this._CurrentDocContent);this.pict.AppData.Facto.CurrentDocumentSegments=t;let e=this.pict.views["Facto-SourceDetail-MarkdownEditor"];e&&e.marshalToView()}_segmentMarkdownContent(t){if(!this._AutoSegment||!t)return[{Content:t||""}];let e=this._AutoSegmentDepth;if(1===e){let e=t.split("\n"),o=[],i=[],n=!1;for(let t=0;t<e.length;t++){let a=e[t];/^(`{3,}|~{3,})/.test(a.trim())?(n=!n,i.push(a)):n||""!==a.trim()?i.push(a):i.length>0&&(o.push({Content:i.join("\n")}),i=[])}return i.length>0&&o.push({Content:i.join("\n")}),o.length>0?o:[{Content:""}]}let o=new RegExp("^(#{1,"+e+"})\\s"),i=t.split("\n"),n=[],a=[];for(let t=0;t<i.length;t++){let e=i[t];o.test(e.trim())&&a.length>0&&(n.push({Content:a.join("\n")}),a=[]),a.push(e)}return a.length>0&&n.push({Content:a.join("\n")}),n.length>0?n:[{Content:""}]}_marshalEditorContent(){let t=this.pict.views["Facto-SourceDetail-MarkdownEditor"];if(!t)return;t.marshalFromView();let e=this.pict.AppData.Facto.CurrentDocumentSegments||[],o=[];for(let t=0;t<e.length;t++)e[t]&&e[t].Content&&o.push(e[t].Content);this._CurrentDocContent=o.join("\n\n")}_renderMarkdownEditor(){let t="Facto-SourceDetail-MarkdownEditor",e="Facto-SourceDetail-MarkdownEditor-Container";if(this.pict.views[t])return void this.pict.views[t].marshalToView();let o={ViewIdentifier:t,DefaultDestinationAddress:"#"+e,TargetElementAddress:"#"+e,ContentDataAddress:"AppData.Facto.CurrentDocumentSegments",ReadOnly:!1,EnableRichPreview:!0,ImageBaseURL:"",Renderables:[{RenderableHash:t+"-Renderable",TemplateHash:"MarkdownEditor-Container",DestinationAddress:"#"+e,RenderMethod:"replace"}]};this.pict.addView(t,o,n);let i=this.pict.views[t],a=this;i.onImageUpload=function(t,e,o){let i=new FileReader;return i.onload=function(){let e=i.result.split(",")[1];a.pict.providers.Facto.uploadSourceFile(a._CurrentIDSource,t.name,t.type,e).then(function(t){t&&t.Success&&t.URL?o(null,t.URL):o(t&&t.Error||"Upload failed")})},i.onerror=function(){o("Failed to read file")},i.readAsDataURL(t),!0},i.onBeforeInitialize(),i.render()}saveDocument(){if(!this._CurrentIDDoc||!this._CurrentIDSource)return;this._marshalEditorContent();let t={Content:this._CurrentDocContent},e=document.getElementById("Facto-SourceDetail-DocNameInput");if(e){let o=e.value.trim();o&&o!==this._CurrentDocName&&(t.Name=o,this._CurrentDocName=o)}this.pict.providers.Facto.updateSourceDocument(this._CurrentIDSource,this._CurrentIDDoc,t).then(e=>{if(e&&e.Success){if(this._setEditorStatus("Saved","ok"),t.Name){let e=this.pict.views["Facto-Full-SourceDetail"];e&&e.onDocumentNameChanged(this._CurrentIDDoc,t.Name)}}else this._setEditorStatus("Error saving: "+(e&&e.Error||"Unknown"),"error")})}_setEditorStatus(t,e){let o=document.getElementById("Facto-SourceDetail-DocName");if(o){let e=this._CurrentDocName;o.textContent=e+" — "+t,setTimeout(()=>{o&&(o.textContent=e)},2e3)}}},e.exports.default_configuration=r},{"pict-section-content":12,"pict-section-markdowneditor":29,"pict-view":41}],63:[function(t,e,o){const i=t("pict-view"),n={ViewIdentifier:"Facto-Full-SourceResearch",DefaultRenderable:"Facto-Full-SourceResearch-Content",DefaultDestinationAddress:"#Facto-Full-Content-Container",AutoRender:!1,CSS:"\n\t\t.facto-research-search {\n\t\t\tdisplay: flex;\n\t\t\tgap: 0.75em;\n\t\t\tmargin-bottom: 1.25em;\n\t\t}\n\t\t.facto-research-search input {\n\t\t\tflex: 1;\n\t\t\tmargin-bottom: 0;\n\t\t}\n\t\t.facto-research-detail {\n\t\t\tmargin-top: 1.25em;\n\t\t\tpadding-top: 1.25em;\n\t\t\tborder-top: 1px solid var(--facto-border-subtle);\n\t\t}\n\t\t.facto-research-import textarea {\n\t\t\twidth: 100%;\n\t\t\tfont-family: 'SF Mono', Consolas, monospace;\n\t\t\tfont-size: 0.85em;\n\t\t\tpadding: 0.75em;\n\t\t\tbackground: var(--facto-bg-input);\n\t\t\tcolor: var(--facto-text);\n\t\t\tborder: 1px solid var(--facto-border);\n\t\t\tborder-radius: 6px;\n\t\t\tmargin-bottom: 0.5em;\n\t\t}\n\t\t.facto-research-add-form {\n\t\t\tbackground: var(--facto-bg-card);\n\t\t\tborder: 1px solid var(--facto-border);\n\t\t\tborder-radius: 8px;\n\t\t\tpadding: 1.25em;\n\t\t\tmargin-bottom: 1.25em;\n\t\t}\n\t\t.facto-research-add-form .facto-form-grid {\n\t\t\tdisplay: grid;\n\t\t\tgrid-template-columns: 1fr 1fr;\n\t\t\tgap: 0.75em;\n\t\t}\n\t\t.facto-research-add-form .facto-form-grid .facto-form-full {\n\t\t\tgrid-column: 1 / -1;\n\t\t}\n\t\t.facto-research-add-form label {\n\t\t\tdisplay: block;\n\t\t\tfont-size: 0.8em;\n\t\t\tfont-weight: 600;\n\t\t\tmargin-bottom: 0.25em;\n\t\t\tcolor: var(--facto-text-muted);\n\t\t}\n\t\t.facto-research-add-form input,\n\t\t.facto-research-add-form textarea,\n\t\t.facto-research-add-form select {\n\t\t\twidth: 100%;\n\t\t\tmargin-bottom: 0;\n\t\t}\n\t\t.facto-research-add-form textarea {\n\t\t\tfont-size: 0.9em;\n\t\t}\n\t\t.facto-research-add-form .facto-form-actions {\n\t\t\tmargin-top: 1em;\n\t\t\tdisplay: flex;\n\t\t\tgap: 0.5em;\n\t\t}\n\t\t.facto-research-header-row {\n\t\t\tdisplay: flex;\n\t\t\tjustify-content: space-between;\n\t\t\talign-items: flex-start;\n\t\t\tmargin-bottom: 0;\n\t\t}\n\t",Templates:[{Hash:"Facto-Full-SourceResearch-Template",Template:'\n<div class="facto-content">\n\t<div class="facto-content-header facto-research-header-row">\n\t\t<div>\n\t\t\t<h1>Source Research</h1>\n\t\t\t<p>Research and catalog potential data sources before provisioning them as runtime Sources and Datasets.</p>\n\t\t</div>\n\t\t<button class="facto-btn facto-btn-success" onclick="{~P~}.views[\'Facto-Full-SourceResearch\'].toggleAddForm()">+ Add Entry</button>\n\t</div>\n\n\t<div id="Facto-Full-Research-AddForm" style="display:none;">\n\t\t<div class="facto-research-add-form">\n\t\t\t<div class="facto-form-grid">\n\t\t\t\t<div>\n\t\t\t\t\t<label>Name</label>\n\t\t\t\t\t<input type="text" id="Facto-Research-Add-Name" placeholder="Source name">\n\t\t\t\t</div>\n\t\t\t\t<div>\n\t\t\t\t\t<label>Agency</label>\n\t\t\t\t\t<input type="text" id="Facto-Research-Add-Agency" placeholder="Agency or organization">\n\t\t\t\t</div>\n\t\t\t\t<div>\n\t\t\t\t\t<label>Type</label>\n\t\t\t\t\t<input type="text" id="Facto-Research-Add-Type" placeholder="e.g. API, CSV, Database">\n\t\t\t\t</div>\n\t\t\t\t<div>\n\t\t\t\t\t<label>Category</label>\n\t\t\t\t\t<input type="text" id="Facto-Research-Add-Category" placeholder="e.g. Census, Financial, Health">\n\t\t\t\t</div>\n\t\t\t\t<div>\n\t\t\t\t\t<label>URL</label>\n\t\t\t\t\t<input type="text" id="Facto-Research-Add-URL" placeholder="https://...">\n\t\t\t\t</div>\n\t\t\t\t<div>\n\t\t\t\t\t<label>Protocol</label>\n\t\t\t\t\t<input type="text" id="Facto-Research-Add-Protocol" placeholder="e.g. REST, FTP, SFTP">\n\t\t\t\t</div>\n\t\t\t\t<div>\n\t\t\t\t\t<label>Region</label>\n\t\t\t\t\t<input type="text" id="Facto-Research-Add-Region" placeholder="e.g. US, EU, Global">\n\t\t\t\t</div>\n\t\t\t\t<div>\n\t\t\t\t\t<label>Update Frequency</label>\n\t\t\t\t\t<input type="text" id="Facto-Research-Add-UpdateFrequency" placeholder="e.g. Daily, Weekly, Annual">\n\t\t\t\t</div>\n\t\t\t\t<div class="facto-form-full">\n\t\t\t\t\t<label>Description</label>\n\t\t\t\t\t<textarea id="Facto-Research-Add-Description" rows="2" placeholder="Brief description of this source"></textarea>\n\t\t\t\t</div>\n\t\t\t\t<div class="facto-form-full">\n\t\t\t\t\t<label>Notes</label>\n\t\t\t\t\t<textarea id="Facto-Research-Add-Notes" rows="2" placeholder="Additional notes"></textarea>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t\t<div class="facto-form-actions">\n\t\t\t\t<button class="facto-btn facto-btn-primary" onclick="{~P~}.views[\'Facto-Full-SourceResearch\'].createEntry()">Save Entry</button>\n\t\t\t\t<button class="facto-btn facto-btn-secondary" onclick="{~P~}.views[\'Facto-Full-SourceResearch\'].toggleAddForm()">Cancel</button>\n\t\t\t</div>\n\t\t</div>\n\t</div>\n\n\t<div class="facto-research-search">\n\t\t<input type="text" id="Facto-Full-Research-Search" placeholder="Search catalog by name, agency, category, or description...">\n\t\t<button class="facto-btn facto-btn-primary" onclick="{~P~}.views[\'Facto-Full-SourceResearch\'].searchCatalog()">Search</button>\n\t</div>\n\n\t<div id="Facto-Full-Research-List"></div>\n\t<div id="Facto-Full-Research-Detail" class="facto-research-detail" style="display:none;"></div>\n\n\t<div class="facto-section" style="margin-top:2em;">\n\t\t<div class="facto-section-title">Import / Export</div>\n\t\t<div class="facto-research-import">\n\t\t\t<textarea id="Facto-Full-Research-ImportJSON" rows="4" placeholder="Paste JSON array of catalog entries here..."></textarea>\n\t\t\t<button class="facto-btn facto-btn-primary" onclick="{~P~}.views[\'Facto-Full-SourceResearch\'].importCatalog()">Import JSON</button>\n\t\t\t<button class="facto-btn facto-btn-secondary" onclick="{~P~}.views[\'Facto-Full-SourceResearch\'].exportCatalog()">Export Catalog</button>\n\t\t</div>\n\t</div>\n</div>\n'}],Renderables:[{RenderableHash:"Facto-Full-SourceResearch-Content",TemplateHash:"Facto-Full-SourceResearch-Template",DestinationAddress:"#Facto-Full-Content-Container",RenderMethod:"replace"}]};e.exports=class extends i{constructor(t,e,o){super(t,e,o)}onAfterRender(t,e,o,i){return this._SourceLinks={},Promise.all([this.pict.providers.Facto.loadCatalogEntries(),this.pict.providers.Facto.loadCatalogSourceLinks()]).then(t=>{let e=t[1];e&&e.Links&&(this._SourceLinks=e.Links),this.refreshList()}).catch(t=>{this.pict.views["Pict-Section-Modal"].toast("Error loading catalog: "+t.message,{type:"error"})}),super.onAfterRender(t,e,o,i)}refreshList(){let t=document.getElementById("Facto-Full-Research-List");if(!t)return;let e=this.pict.AppData.Facto.CatalogEntries;if(!e||0===e.length)return void(t.innerHTML='<div class="facto-empty">No catalog entries yet. Import a catalog or add sources manually.</div>');let o="<table><thead><tr><th>ID</th><th>Agency</th><th>Name</th><th>Type</th><th>Category</th><th>Region</th><th>Verified</th><th>Actions</th></tr></thead><tbody>";for(let t=0;t<e.length;t++){let i=e[t],n=i.Verified?'<span class="facto-badge facto-badge-success">Yes</span>':'<span class="facto-badge facto-badge-muted">No</span>';o+="<tr>",o+="<td>"+(i.IDSourceCatalogEntry||"")+"</td>",o+="<td>"+(i.Agency||"")+"</td>",o+="<td>"+(i.Name||"")+"</td>",o+='<td><span class="facto-badge facto-badge-primary">'+(i.Type||"")+"</span></td>",o+="<td>"+(i.Category||"")+"</td>",o+="<td>"+(i.Region||"")+"</td>",o+="<td>"+n+"</td>",o+="<td>";let a=this._SourceLinks&&this._SourceLinks[i.IDSourceCatalogEntry];a&&(o+='<button class="facto-btn facto-btn-secondary facto-btn-small" onclick="pict.PictApplication.navigateTo(\'/Source/'+a+"')\">View Source →</button> "),o+='<button class="facto-btn facto-btn-primary facto-btn-small" onclick="pict.views[\'Facto-Full-SourceResearch\'].viewEntry('+i.IDSourceCatalogEntry+')">Datasets</button> ',o+='<button class="facto-btn facto-btn-danger facto-btn-small" onclick="pict.views[\'Facto-Full-SourceResearch\'].deleteEntry('+i.IDSourceCatalogEntry+')">Delete</button>',o+="</td>",o+="</tr>"}o+="</tbody></table>",t.innerHTML=o}toggleAddForm(){let t=document.getElementById("Facto-Full-Research-AddForm");t&&(t.style.display="none"===t.style.display?"block":"none")}createEntry(){let t={Name:this.pict.providers.FactoUI.getVal("Facto-Research-Add-Name"),Agency:this.pict.providers.FactoUI.getVal("Facto-Research-Add-Agency"),Type:this.pict.providers.FactoUI.getVal("Facto-Research-Add-Type"),Category:this.pict.providers.FactoUI.getVal("Facto-Research-Add-Category"),URL:this.pict.providers.FactoUI.getVal("Facto-Research-Add-URL"),Protocol:this.pict.providers.FactoUI.getVal("Facto-Research-Add-Protocol"),Region:this.pict.providers.FactoUI.getVal("Facto-Research-Add-Region"),UpdateFrequency:this.pict.providers.FactoUI.getVal("Facto-Research-Add-UpdateFrequency"),Description:this.pict.providers.FactoUI.getVal("Facto-Research-Add-Description"),Notes:this.pict.providers.FactoUI.getVal("Facto-Research-Add-Notes")};t.Name?this.pict.providers.Facto.createCatalogEntry(t).then(t=>{if(t&&t.Error)return void this.pict.views["Pict-Section-Modal"].toast("Error: "+t.Error,{type:"error"});this.pict.views["Pict-Section-Modal"].toast("Catalog entry created",{type:"success"});let e=["Name","Agency","Type","Category","URL","Protocol","Region","UpdateFrequency","Description","Notes"];for(let t=0;t<e.length;t++){let o=document.getElementById("Facto-Research-Add-"+e[t]);o&&(o.value="")}let o=document.getElementById("Facto-Full-Research-AddForm");return o&&(o.style.display="none"),this.pict.providers.Facto.loadCatalogEntries()}).then(()=>{this.refreshList()}):this.pict.views["Pict-Section-Modal"].toast("Name is required",{type:"error"})}searchCatalog(){let t=this.pict.providers.FactoUI.getVal("Facto-Full-Research-Search");t?this.pict.providers.Facto.searchCatalog(t).then(t=>{this.pict.AppData.Facto.CatalogEntries=t&&t.Entries?t.Entries:[],this.refreshList()}):this.pict.providers.Facto.loadCatalogEntries().then(()=>{this.refreshList()})}async deleteEntry(t){await this.pict.views["Pict-Section-Modal"].confirm("Remove this catalog entry?",{title:"Remove Entry",confirmLabel:"Remove",dangerous:!0})&&this.pict.providers.Facto.deleteCatalogEntry(t).then(()=>this.pict.providers.Facto.loadCatalogEntries()).then(()=>{this.refreshList(),this.pict.views["Pict-Section-Modal"].toast("Entry removed",{type:"success"})})}viewEntry(t){let e=document.getElementById("Facto-Full-Research-Detail");e&&(e.style.display="block",this.pict.providers.Facto.loadCatalogEntryDatasets(t).then(o=>{let i=o&&o.Datasets?o.Datasets:[],n="<h3>Dataset Definitions for Entry #"+t+"</h3>";if(0===i.length)n+='<div class="facto-empty">No dataset definitions yet.</div>';else{n+="<table><thead><tr><th>ID</th><th>Name</th><th>Format</th><th>Endpoint URL</th><th>Policy</th><th>Status</th><th>Actions</th></tr></thead><tbody>";for(let e=0;e<i.length;e++){let o=i[e],a=o.Provisioned?'<span class="facto-badge facto-badge-success">Provisioned</span>':'<span class="facto-badge facto-badge-muted">Not provisioned</span>',r="";o.Provisioned?(r='<button class="facto-btn facto-btn-primary facto-btn-small" onclick="pict.views[\'Facto-Full-SourceResearch\'].fetchDataset('+o.IDCatalogDatasetDefinition+", "+t+')">Fetch</button>',o.IDSource&&(r+=' <button class="facto-btn facto-btn-secondary facto-btn-small" onclick="pict.PictApplication.navigateTo(\'/Source/'+o.IDSource+"')\">View Source →</button>")):r='<button class="facto-btn facto-btn-success facto-btn-small" onclick="pict.views[\'Facto-Full-SourceResearch\'].provisionDataset('+o.IDCatalogDatasetDefinition+", "+t+')">Provision</button>',n+="<tr>",n+="<td>"+(o.IDCatalogDatasetDefinition||"")+"</td>",n+="<td>"+(o.Name||"")+"</td>",n+='<td><span class="facto-badge facto-badge-primary">'+(o.Format||"")+"</span></td>",n+='<td style="max-width:250px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap;">'+(o.EndpointURL||"")+"</td>",n+="<td>"+(o.VersionPolicy||"Append")+"</td>",n+="<td>"+a+"</td>",n+="<td>"+r+"</td>",n+="</tr>"}n+="</tbody></table>"}n+='<div style="margin-top:1em;"><button class="facto-btn facto-btn-secondary" onclick="document.getElementById(\'Facto-Full-Research-Detail\').style.display=\'none\'">Close</button></div>',e.innerHTML=n}))}provisionDataset(t,e){this.pict.views["Pict-Section-Modal"].toast("Provisioning...",{type:"info"}),this.pict.providers.Facto.provisionCatalogDataset(t).then(t=>{if(t&&t.Success){let o=document.getElementById("Facto-Full-Research-Status");o&&(o.className="facto-status facto-status-ok",o.innerHTML="Provisioned! Source: "+(t.Source.Hash||t.Source.Name)+" (#"+t.Source.IDSource+"), Dataset: "+(t.Dataset.Hash||t.Dataset.Name)+" (#"+t.Dataset.IDDataset+') — <a href="#/Source/'+t.Source.IDSource+'" style="color:var(--facto-brand);text-decoration:underline;cursor:pointer;">View Source →</a>',o.style.display="block"),this.viewEntry(e)}else this.pict.views["Pict-Section-Modal"].toast("Error: "+(t&&t.Error||"Unknown"),{type:"error"})})}fetchDataset(t,e){this.pict.views["Pict-Section-Modal"].toast("Fetching data from endpoint...",{type:"info"}),this.pict.providers.Facto.fetchCatalogDataset(t).then(t=>{if(t&&t.Success){let o="Fetched! "+t.Ingested+" records ingested (v"+t.DatasetVersion+", "+t.Format+")";t.IsDuplicate&&(o+=" [duplicate content]"),this.pict.views["Pict-Section-Modal"].toast(o,{type:"success"}),this.viewEntry(e)}else this.pict.views["Pict-Section-Modal"].toast("Fetch error: "+(t&&t.Error||"Unknown"),{type:"error"})})}importCatalog(){let t,e=document.getElementById("Facto-Full-Research-ImportJSON");if(e&&e.value){try{t=JSON.parse(e.value)}catch(t){return void this.pict.views["Pict-Section-Modal"].toast("Invalid JSON: "+t.message,{type:"error"})}this.pict.providers.Facto.importCatalog(t).then(t=>{if(t&&t.Success)return this.pict.views["Pict-Section-Modal"].toast("Imported "+t.EntriesCreated+" entries with "+t.DatasetsCreated+" datasets",{type:"success"}),e.value="",this.pict.providers.Facto.loadCatalogEntries();this.pict.views["Pict-Section-Modal"].toast("Import error: "+(t&&t.Error||"Unknown"),{type:"error"})}).then(()=>{this.refreshList()})}else this.pict.views["Pict-Section-Modal"].toast("Paste JSON to import",{type:"warning"})}exportCatalog(){this.pict.providers.Facto.exportCatalog().then(t=>{let e=document.getElementById("Facto-Full-Research-ImportJSON");e&&(e.value=JSON.stringify(t&&t.Entries?t.Entries:t,null,2)),this.pict.views["Pict-Section-Modal"].toast("Catalog exported to JSON text area",{type:"success"})})}},e.exports.default_configuration=n},{"pict-view":41}],64:[function(t,e,o){const i=t("pict-view"),n={ViewIdentifier:"Facto-Full-Sources",DefaultRenderable:"Facto-Full-Sources-Content",DefaultDestinationAddress:"#Facto-Full-Content-Container",AutoRender:!1,Templates:[{Hash:"Facto-Full-Sources-Template",Template:'\n<div class="facto-content">\n\t<div class="facto-content-header">\n\t\t<h1>Sources</h1>\n\t\t<p>Manage data sources that feed into the warehouse.</p>\n\t</div>\n\n\t<div id="Facto-Full-Sources-List"></div>\n\n\t<div class="facto-section" style="margin-top:2em;">\n\t\t<div class="facto-section-title">Add Source</div>\n\t\t<div class="facto-inline-group">\n\t\t\t<div>\n\t\t\t\t<label>Name</label>\n\t\t\t\t<input type="text" id="Facto-Full-Source-Name" placeholder="Source name">\n\t\t\t</div>\n\t\t\t<div>\n\t\t\t\t<label>Type</label>\n\t\t\t\t<select id="Facto-Full-Source-Type">\n\t\t\t\t\t<option value="API">API</option>\n\t\t\t\t\t<option value="File">File</option>\n\t\t\t\t\t<option value="Database">Database</option>\n\t\t\t\t\t<option value="Manual">Manual</option>\n\t\t\t\t</select>\n\t\t\t</div>\n\t\t\t<div>\n\t\t\t\t<label>URL</label>\n\t\t\t\t<input type="text" id="Facto-Full-Source-URL" placeholder="https://...">\n\t\t\t</div>\n\t\t</div>\n\t\t<button class="facto-btn facto-btn-primary" onclick="{~P~}.views[\'Facto-Full-Sources\'].addSource()">Add Source</button>\n\t</div>\n\n</div>\n'}],Renderables:[{RenderableHash:"Facto-Full-Sources-Content",TemplateHash:"Facto-Full-Sources-Template",DestinationAddress:"#Facto-Full-Content-Container",RenderMethod:"replace"}]};e.exports=class extends i{constructor(t,e,o){super(t,e,o)}onAfterRender(t,e,o,i){return this.pict.providers.Facto.loadSources().then(()=>{this.refreshList()}).catch(t=>{this.pict.views["Pict-Section-Modal"].toast("Error loading sources: "+t.message,{type:"error"})}),super.onAfterRender(t,e,o,i)}refreshList(){let t=document.getElementById("Facto-Full-Sources-List");if(!t)return;let e=this.pict.AppData.Facto.Sources;if(!e||0===e.length)return void(t.innerHTML='<div class="facto-empty">No sources yet. Add one below or provision from Source Research.</div>');let o="<table><thead><tr><th>ID</th><th>Hash</th><th>Name</th><th>Type</th><th>URL</th><th>Active</th><th>Actions</th></tr></thead><tbody>";for(let t=0;t<e.length;t++){let i=e[t],n=i.Active?'<span class="facto-badge facto-badge-success">Active</span>':'<span class="facto-badge facto-badge-muted">Inactive</span>',a=i.Active?'<button class="facto-btn facto-btn-secondary facto-btn-small" onclick="pict.views[\'Facto-Full-Sources\'].toggleActive('+i.IDSource+', false)">Deactivate</button>':'<button class="facto-btn facto-btn-success facto-btn-small" onclick="pict.views[\'Facto-Full-Sources\'].toggleActive('+i.IDSource+', true)">Activate</button>';o+="<tr>",o+="<td>"+(i.IDSource||"")+"</td>",o+="<td><code>"+(i.Hash||"-")+"</code></td>",o+="<td>"+(i.Name||"")+"</td>",o+='<td><span class="facto-badge facto-badge-primary">'+(i.Type||"")+"</span></td>",o+='<td style="max-width:250px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap;">'+(i.URL||"")+"</td>",o+="<td>"+n+"</td>",o+="<td>"+('<button class="facto-btn facto-btn-primary facto-btn-small" onclick="pict.PictApplication.navigateTo(\'/Source/'+i.IDSource+"')\">View</button>")+" "+a+"</td>",o+="</tr>"}o+="</tbody></table>",t.innerHTML=o}toggleActive(t,e){(e?this.pict.providers.Facto.activateSource(t):this.pict.providers.Facto.deactivateSource(t)).then(()=>this.pict.providers.Facto.loadSources()).then(()=>{this.refreshList(),this.pict.views["Pict-Section-Modal"].toast(e?"Source activated":"Source deactivated",{type:"success"})})}addSource(){let t=this.pict.providers.FactoUI.getVal("Facto-Full-Source-Name"),e=this.pict.providers.FactoUI.getVal("Facto-Full-Source-Type"),o=this.pict.providers.FactoUI.getVal("Facto-Full-Source-URL");t?this.pict.providers.Facto.createSource({Name:t,Type:e,URL:o,Active:1}).then(e=>{if(e&&e.IDSource)return this.pict.views["Pict-Section-Modal"].toast("Source created: "+t,{type:"success"}),document.getElementById("Facto-Full-Source-Name").value="",document.getElementById("Facto-Full-Source-URL").value="",this.pict.providers.Facto.loadSources();this.pict.views["Pict-Section-Modal"].toast("Error creating source",{type:"error"})}).then(()=>{this.refreshList()}):this.pict.views["Pict-Section-Modal"].toast("Source name is required",{type:"warning"})}},e.exports.default_configuration=n},{"pict-view":41}],65:[function(t,e,o){const i=t("pict-view"),n=t("pict-section-histogram"),a=[{id:"Facto-Full-Histogram-Extracted",stage:"extracted",color:"#4a90d9",label:"Extracted"},{id:"Facto-Full-Histogram-Transformed",stage:"transformed",color:"#d09818",label:"Transformed"},{id:"Facto-Full-Histogram-Written",stage:"written",color:"#3a9468",label:"Written"},{id:"Facto-Full-Histogram-Total",stage:"total",color:"#6366f1",label:"Total"}];function r(t){return String(t.getHours()).padStart(2,"0")+":"+String(t.getMinutes()).padStart(2,"0")+":"+String(t.getSeconds()).padStart(2,"0")}function s(t){return t?t.charAt(0).toUpperCase()+t.slice(1):""}e.exports=class extends i{constructor(t,e,o){super(t,e,o),this._pollTimer=null,this._isPolling=!1,this._activeHistoricalRun=null,this._activeDatasetFilter=null,this._histogramsReady=!1}onAfterRender(){this._ensureHistogramViews(),this._renderHistograms({buckets:[],interval:1e3}),this.loadRunHistory()}_ensureHistogramViews(){if(!this._histogramsReady){for(let t=0;t<a.length;t++){let e=a[t],o="Facto-Full-Histogram-"+s(e.stage)+"-Container";this.pict.views[e.id]||this.pict.addView(e.id,{ViewIdentifier:e.id,AutoRender:!1,RenderMode:"browser",Orientation:"vertical",TargetElementAddress:"#"+o,DefaultDestinationAddress:"#"+o,MaxBarSize:100,BarThickness:16,BarGap:2,ShowValues:!1,ShowLabels:!1,BarColor:e.color,Bins:[]},n)}this._histogramsReady=!0}}_bucketsToHistogramBins(t,e){return t&&0!==t.length?t.map(t=>({Label:"",Value:t[e]||0})):[]}_renderTimeAxis(t,e){let o=document.getElementById(t);if(!o)return;if(!e||e.length<2)return void(o.innerHTML="");let i=18*e.length;o.style.width=i+"px";let n=e[0].time,a=e[Math.floor((e.length-1)/2)].time,s=e[e.length-1].time;o.innerHTML="<span>"+r(new Date(n))+'</span><span style="text-align:center;">'+r(new Date(a))+'</span><span style="text-align:right;">'+r(new Date(s))+"</span>"}startMonitoring(){if(this._isPolling)return;this._isPolling=!0;let t=document.getElementById("facto-tp-toggle");t&&(t.textContent="Stop Monitoring",t.className="facto-btn facto-btn-danger"),this._poll()}stopMonitoring(){this._isPolling=!1,this._pollTimer&&(clearTimeout(this._pollTimer),this._pollTimer=null);let t=document.getElementById("facto-tp-toggle");t&&(t.textContent="Start Live Monitoring",t.className="facto-btn facto-btn-primary")}toggleMonitoring(){this._isPolling?this.stopMonitoring():this.startMonitoring()}_poll(){this._isPolling&&fetch("/facto/throughput?duration=30").then(t=>t.json()).then(t=>{this._renderHistograms(t),this._pollTimer=setTimeout(()=>this._poll(),500)}).catch(()=>{this._pollTimer=setTimeout(()=>this._poll(),2e3)})}loadRunHistory(){fetch("/facto/throughput/runs?limit=10").then(t=>t.json()).then(t=>{this._renderRunHistory(t)}).catch(()=>{})}loadHistoricalRun(t){this._activeHistoricalRun=t,this._activeDatasetFilter=null,fetch("/facto/throughput/run/"+encodeURIComponent(t)).then(t=>t.json()).then(e=>{e.historicalRun=t,this._renderHistograms(e),this._loadDatasetBreakdown(t)}).catch(()=>{})}filterByDataset(t){if(!this._activeHistoricalRun)return;this._activeDatasetFilter=t;let e="/facto/throughput/run/"+encodeURIComponent(this._activeHistoricalRun);t&&(e+="?dataset="+encodeURIComponent(t)),fetch(e).then(t=>t.json()).then(e=>{e.historicalRun=this._activeHistoricalRun,e.datasetFilter=t,this._renderHistograms(e)}).catch(()=>{})}_loadDatasetBreakdown(t){fetch("/facto/throughput/run/"+encodeURIComponent(t)+"/datasets").then(t=>t.json()).then(t=>{this._renderDatasetBreakdown(t)}).catch(()=>{})}_renderHistograms(t){let e=t.buckets||[],o=(t.interval,{extracted:0,transformed:0,written:0});for(let t=0;t<e.length;t++)o.extracted+=e[t].extracted||0,o.transformed+=e[t].transformed||0,o.written+=e[t].written||0;let i=document.getElementById("facto-tp-header");if(i){let e='<div style="display:flex; gap:20px; flex-wrap:wrap; align-items:center;">';if(e+=this._badge("Extracted",o.extracted,"#4a90d9"),e+=this._badge("Transformed",o.transformed,"#d09818"),e+=this._badge("Written",o.written,"#3a9468"),t.activeRun){let o=((Date.now()-t.activeRun.startTime)/1e3).toFixed(1);e+='<span style="font-size:0.85em; color:var(--facto-text-secondary); display:flex; align-items:center; gap:6px;"><span style="width:8px; height:8px; border-radius:50%; background:var(--facto-success); animation:pulse 1s infinite;"></span>'+t.activeRun.label+" ("+o+"s)</span>"}t.historicalRun&&(e+='<span style="font-size:0.85em; color:var(--facto-text-secondary);">Viewing: '+t.historicalRun+(t.datasetFilter?" → "+t.datasetFilter:"")+"</span>"),e+="</div>",i.innerHTML=e}this._ensureHistogramViews();for(let t=0;t<a.length;t++){let o=a[t],i=this.pict.views[o.id];if(!i)continue;let n=this._bucketsToHistogramBins(e,o.stage);i.setBins(n),i.renderHistogram(),this._renderTimeAxis("Facto-Full-Histogram-"+s(o.stage)+"-Axis",e)}}_badge(t,e,o){return'<div style="display:flex; align-items:center; gap:6px;"><div style="width:10px; height:10px; border-radius:2px; background:'+o+';"></div><span style="font-weight:600; font-size:0.88em;">'+t+':</span><span style="font-size:0.88em; color:var(--facto-text-secondary);">'+e.toLocaleString()+"</span></div>"}_renderRunHistory(t){let e=document.getElementById("facto-tp-history");if(!e)return;if(!t||0===t.length)return void(e.innerHTML='<p style="color:var(--facto-text-tertiary); font-size:0.85em; font-style:italic;">No historical runs yet. Run a pipeline ingest first.</p>');let o='<div style="font-size:0.85em; font-weight:600; color:var(--facto-text-heading); margin-bottom:8px;">Run History</div><div style="display:flex; flex-wrap:wrap; gap:8px;">';for(let e=0;e<t.length;e++){let i=t[e],n=new Date(i.startTime).toLocaleString();o+='<button class="facto-btn facto-btn-secondary" style="font-size:0.8em;" onclick="pict.views[\'Facto-Full-Throughput\'].loadHistoricalRun(\''+i.label.replace(/'/g,"\\'")+'\')" title="'+n+" — "+i.eventCount+' events">'+i.label.substring(0,35)+(i.label.length>35?"...":"")+"</button>"}o+="</div>",e.innerHTML=o}_renderDatasetBreakdown(t){let e=document.getElementById("facto-tp-datasets");if(!e)return;if(!t||0===t.length)return void(e.innerHTML="");let o=1;for(let e=0;e<t.length;e++)t[e].total>o&&(o=t[e].total);let i='<div style="font-size:0.85em; font-weight:600; color:var(--facto-text-heading); margin-bottom:8px; margin-top:16px;">Per-Dataset Breakdown</div>';i+='<div style="font-size:0.8em; margin-bottom:6px; color:var(--facto-text-tertiary);">Click a dataset to filter the histogram:</div>';for(let e=0;e<t.length;e++){let n=t[e],a=this._activeDatasetFilter===n.dataset,r=n.dataset.replace(/'/g,"\\'");i+='<div style="display:flex; align-items:center; gap:8px; margin-bottom:4px; cursor:pointer; padding:3px 8px; border-radius:4px; '+(a?"background:var(--facto-brand-a15);":"")+"\" onclick=\"pict.views['Facto-Full-Throughput'].filterByDataset("+(a?"null":"'"+r+"'")+')">',i+='<span style="min-width:220px; font-family:monospace; font-size:0.9em; color:var(--facto-text);">'+n.dataset+"</span>",i+='<div style="flex:1; height:16px; display:flex; border-radius:3px; overflow:hidden; background:var(--facto-bg-elevated);">',n.extracted>0&&(i+='<div style="width:'+n.extracted/o*100+'%; background:#4a90d9;" title="Extracted: '+n.extracted+'"></div>'),n.transformed>0&&(i+='<div style="width:'+n.transformed/o*100+'%; background:#d09818;" title="Transformed: '+n.transformed+'"></div>'),n.written>0&&(i+='<div style="width:'+n.written/o*100+'%; background:#3a9468;" title="Written: '+n.written+'"></div>'),i+="</div>",i+='<span style="min-width:60px; text-align:right; font-size:0.85em; color:var(--facto-text-secondary);">'+n.total.toLocaleString()+"</span></div>"}e.innerHTML=i}},e.exports.default_configuration={ViewIdentifier:"Facto-Full-Throughput",DefaultRenderable:"Facto-Full-Throughput-Content",DefaultDestinationAddress:"#Facto-Full-Content-Container",AutoRender:!1,Templates:[{Hash:"Facto-Full-Throughput-Template",Template:'\n<div style="max-width:1200px; margin:0 auto;">\n\t<h2 style="margin-bottom:4px;">Pipeline Throughput</h2>\n\t<p style="color:var(--facto-text-secondary); margin-bottom:12px; font-size:0.9em;">\n\t\tTemporal histograms showing record flow through extraction, transformation, and storage stages.\n\t</p>\n\n\t<div style="display:flex; gap:8px; margin-bottom:12px; flex-wrap:wrap;">\n\t\t<button id="facto-tp-toggle" class="facto-btn facto-btn-primary" onclick="pict.views[\'Facto-Full-Throughput\'].toggleMonitoring()">Start Live Monitoring</button>\n\t\t<button class="facto-btn facto-btn-secondary" onclick="pict.views[\'Facto-Full-Throughput\'].loadRunHistory()">Refresh History</button>\n\t</div>\n\n\t<div id="facto-tp-header" style="margin-bottom:12px;"></div>\n\n\t<div id="facto-tp-history" style="margin-bottom:16px;"></div>\n\n\t<div id="facto-tp-charts">\n\t\t<div style="display:grid; grid-template-columns:1fr 1fr; gap:16px;">\n\n\t\t\t<div style="background:rgba(74,144,217,0.1); border-radius:8px; padding:12px;">\n\t\t\t\t<div style="font-size:0.85em; font-weight:600; color:#4a90d9; margin-bottom:6px;">Extracted</div>\n\t\t\t\t<div style="overflow-x:auto;">\n\t\t\t\t\t<div id="Facto-Full-Histogram-Extracted-Container"></div>\n\t\t\t\t\t<div id="Facto-Full-Histogram-Extracted-Axis"\n\t\t\t\t\t\tstyle="display:flex; justify-content:space-between; font-size:0.72em; font-family:monospace;\n\t\t\t\t\t\t color:var(--facto-text-tertiary); margin-top:3px; padding-top:3px;\n\t\t\t\t\t\t border-top:1px solid rgba(74,144,217,0.3);"></div>\n\t\t\t\t</div>\n\t\t\t</div>\n\n\t\t\t<div style="background:rgba(208,152,24,0.1); border-radius:8px; padding:12px;">\n\t\t\t\t<div style="font-size:0.85em; font-weight:600; color:#d09818; margin-bottom:6px;">Transformed</div>\n\t\t\t\t<div style="overflow-x:auto;">\n\t\t\t\t\t<div id="Facto-Full-Histogram-Transformed-Container"></div>\n\t\t\t\t\t<div id="Facto-Full-Histogram-Transformed-Axis"\n\t\t\t\t\t\tstyle="display:flex; justify-content:space-between; font-size:0.72em; font-family:monospace;\n\t\t\t\t\t\t color:var(--facto-text-tertiary); margin-top:3px; padding-top:3px;\n\t\t\t\t\t\t border-top:1px solid rgba(208,152,24,0.3);"></div>\n\t\t\t\t</div>\n\t\t\t</div>\n\n\t\t\t<div style="background:rgba(58,148,104,0.1); border-radius:8px; padding:12px;">\n\t\t\t\t<div style="font-size:0.85em; font-weight:600; color:#3a9468; margin-bottom:6px;">Written</div>\n\t\t\t\t<div style="overflow-x:auto;">\n\t\t\t\t\t<div id="Facto-Full-Histogram-Written-Container"></div>\n\t\t\t\t\t<div id="Facto-Full-Histogram-Written-Axis"\n\t\t\t\t\t\tstyle="display:flex; justify-content:space-between; font-size:0.72em; font-family:monospace;\n\t\t\t\t\t\t color:var(--facto-text-tertiary); margin-top:3px; padding-top:3px;\n\t\t\t\t\t\t border-top:1px solid rgba(58,148,104,0.3);"></div>\n\t\t\t\t</div>\n\t\t\t</div>\n\n\t\t\t<div style="background:var(--facto-bg-elevated); border:1px solid var(--facto-border-subtle); border-radius:8px; padding:12px;">\n\t\t\t\t<div style="font-size:0.85em; font-weight:600; color:#6366f1; margin-bottom:6px;">Total</div>\n\t\t\t\t<div style="overflow-x:auto;">\n\t\t\t\t\t<div id="Facto-Full-Histogram-Total-Container"></div>\n\t\t\t\t\t<div id="Facto-Full-Histogram-Total-Axis"\n\t\t\t\t\t\tstyle="display:flex; justify-content:space-between; font-size:0.72em; font-family:monospace;\n\t\t\t\t\t\t color:var(--facto-text-tertiary); margin-top:3px; padding-top:3px;\n\t\t\t\t\t\t border-top:1px solid rgba(99,102,241,0.3);"></div>\n\t\t\t\t</div>\n\t\t\t</div>\n\n\t\t</div>\n\t</div>\n\n\t<div id="facto-tp-datasets"></div>\n\n\t<style>\n\t\t@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }\n\t</style>\n</div>\n'}],Renderables:[{RenderableHash:"Facto-Full-Throughput-Content",TemplateHash:"Facto-Full-Throughput-Template",DestinationAddress:"#Facto-Full-Content-Container"}]}},{"pict-section-histogram":16,"pict-view":41}],66:[function(t,e,o){const i=t("pict-view"),n={ViewIdentifier:"Facto-Full-TopBar",DefaultRenderable:"Facto-Full-TopBar-Content",DefaultDestinationAddress:"#Facto-Full-TopBar-Container",AutoRender:!1,CSS:"\n\t\t.facto-topbar {\n\t\t\tdisplay: flex;\n\t\t\talign-items: center;\n\t\t\theight: 48px;\n\t\t\tbackground: var(--facto-topbar-bg);\n\t\t\tpadding: 0 1.25em;\n\t\t\tborder-bottom: 1px solid var(--facto-border-subtle);\n\t\t\tposition: sticky;\n\t\t\ttop: 0;\n\t\t\tz-index: 100;\n\t\t}\n\n\t\t.facto-topbar-brand {\n\t\t\tfont-size: 1.05em;\n\t\t\tfont-weight: 700;\n\t\t\tcolor: var(--facto-topbar-hover);\n\t\t\tcursor: pointer;\n\t\t\tmargin-right: 2em;\n\t\t\twhite-space: nowrap;\n\t\t\ttext-decoration: none;\n\t\t}\n\n\t\t.facto-topbar-brand:hover {\n\t\t\tcolor: var(--facto-topbar-active);\n\t\t}\n\n\t\t.facto-topbar-nav {\n\t\t\tdisplay: flex;\n\t\t\talign-items: center;\n\t\t\tgap: 0.15em;\n\t\t\tflex: 1;\n\t\t\toverflow-x: auto;\n\t\t}\n\n\t\t.facto-topbar-nav a {\n\t\t\tpadding: 0.35em 0.7em;\n\t\t\tfont-size: 0.85em;\n\t\t\tfont-weight: 500;\n\t\t\tcolor: var(--facto-topbar-text);\n\t\t\ttext-decoration: none;\n\t\t\tborder-radius: 5px;\n\t\t\twhite-space: nowrap;\n\t\t\tcursor: pointer;\n\t\t\ttransition: color 0.12s, background 0.12s;\n\t\t}\n\n\t\t.facto-topbar-nav a:hover {\n\t\t\tcolor: var(--facto-topbar-hover);\n\t\t\tbackground: rgba(255,255,255,0.06);\n\t\t}\n\n\t\t.facto-topbar-nav a.active {\n\t\t\tcolor: var(--facto-topbar-active);\n\t\t\tbackground: rgba(255,255,255,0.08);\n\t\t}\n\n\t\t.facto-topbar-right {\n\t\t\tdisplay: flex;\n\t\t\talign-items: center;\n\t\t\tgap: 0.75em;\n\t\t\tmargin-left: auto;\n\t\t}\n\n\t\t.facto-topbar-simple-link {\n\t\t\tfont-size: 0.75em;\n\t\t\tcolor: var(--facto-topbar-text);\n\t\t\ttext-decoration: none;\n\t\t\topacity: 0.6;\n\t\t}\n\n\t\t.facto-topbar-simple-link:hover {\n\t\t\topacity: 1;\n\t\t}\n\n\t\t/* Settings gear */\n\t\t.facto-settings-wrap {\n\t\t\tposition: relative;\n\t\t}\n\n\t\t.facto-settings-gear {\n\t\t\tbackground: none;\n\t\t\tborder: none;\n\t\t\tpadding: 0.3em;\n\t\t\tcursor: pointer;\n\t\t\tcolor: var(--facto-topbar-text);\n\t\t\tdisplay: flex;\n\t\t\talign-items: center;\n\t\t\tborder-radius: 4px;\n\t\t\ttransition: color 0.12s;\n\t\t}\n\n\t\t.facto-settings-gear:hover {\n\t\t\tcolor: var(--facto-topbar-hover);\n\t\t}\n\n\t\t.facto-settings-gear svg {\n\t\t\twidth: 20px;\n\t\t\theight: 20px;\n\t\t\tfill: currentColor;\n\t\t}\n\n\t\t/* Settings panel */\n\t\t.facto-settings-panel {\n\t\t\tposition: absolute;\n\t\t\ttop: 100%;\n\t\t\tright: 0;\n\t\t\tmargin-top: 0.5em;\n\t\t\tbackground: var(--facto-bg-surface);\n\t\t\tborder: 1px solid var(--facto-border);\n\t\t\tborder-radius: 8px;\n\t\t\tpadding: 1em;\n\t\t\tmin-width: 220px;\n\t\t\tbox-shadow: var(--facto-shadow-heavy);\n\t\t\tz-index: 200;\n\t\t}\n\n\t\t.facto-settings-panel-title {\n\t\t\tfont-size: 0.8em;\n\t\t\tfont-weight: 600;\n\t\t\tcolor: var(--facto-text-secondary);\n\t\t\ttext-transform: uppercase;\n\t\t\tletter-spacing: 0.05em;\n\t\t\tmargin-bottom: 0.75em;\n\t\t}\n\n\t\t.facto-theme-grid {\n\t\t\tdisplay: flex;\n\t\t\tflex-direction: column;\n\t\t\tgap: 0.4em;\n\t\t}\n\n\t\t.facto-theme-swatch {\n\t\t\tdisplay: flex;\n\t\t\talign-items: center;\n\t\t\tgap: 0.6em;\n\t\t\tpadding: 0.4em 0.5em;\n\t\t\tborder-radius: 5px;\n\t\t\tcursor: pointer;\n\t\t\ttransition: background 0.12s;\n\t\t}\n\n\t\t.facto-theme-swatch:hover {\n\t\t\tbackground: var(--facto-bg-elevated);\n\t\t}\n\n\t\t.facto-theme-swatch.active {\n\t\t\tbackground: var(--facto-bg-elevated);\n\t\t\toutline: 2px solid var(--facto-brand);\n\t\t\toutline-offset: -2px;\n\t\t}\n\n\t\t.facto-theme-swatch-colors {\n\t\t\tdisplay: flex;\n\t\t\tgap: 3px;\n\t\t}\n\n\t\t.facto-theme-swatch-dot {\n\t\t\twidth: 14px;\n\t\t\theight: 14px;\n\t\t\tborder-radius: 50%;\n\t\t\tborder: 1px solid rgba(255,255,255,0.1);\n\t\t}\n\n\t\t.facto-theme-swatch-label {\n\t\t\tfont-size: 0.82em;\n\t\t\tcolor: var(--facto-text);\n\t\t}\n\n\t\t@media (max-width: 900px) {\n\t\t\t.facto-topbar-nav {\n\t\t\t\tdisplay: none;\n\t\t\t}\n\t\t}\n\t",Templates:[{Hash:"Facto-Full-TopBar-Template",Template:'\n<div class="facto-topbar">\n\t<a class="facto-topbar-brand" onclick="{~P~}.PictApplication.navigateTo(\'/Home\')">Retold Facto</a>\n\n\t<div class="facto-topbar-nav" id="Facto-Full-TopBar-Nav">\n\t\t<a data-route="Scanner" onclick="{~P~}.PictApplication.navigateTo(\'/Scanner\')">Scanner</a>\n\t\t<a data-route="SourceResearch" onclick="{~P~}.PictApplication.navigateTo(\'/SourceResearch\')">Source Research</a>\n\t\t<a data-route="IngestJobs" onclick="{~P~}.PictApplication.navigateTo(\'/IngestJobs\')">Ingestion Jobs</a>\n\t\t<a data-route="Sources" onclick="{~P~}.PictApplication.navigateTo(\'/Sources\')">Sources</a>\n\t\t<a data-route="Datasets" onclick="{~P~}.PictApplication.navigateTo(\'/Datasets\')">Data Sets</a>\n\t\t<a data-route="Records" onclick="{~P~}.PictApplication.navigateTo(\'/Records\')">Records</a>\n\t\t<a data-route="Projections" onclick="{~P~}.PictApplication.navigateTo(\'/Projections\')">Projections</a>\n\t\t<a data-route="Connections" onclick="{~P~}.PictApplication.navigateTo(\'/Connections\')">Connections</a>\n\t\t<a data-route="Dashboards" onclick="{~P~}.PictApplication.navigateTo(\'/Dashboards\')">Dashboards</a>\n\t\t<a data-route="Throughput" onclick="{~P~}.PictApplication.navigateTo(\'/Throughput\')">Throughput</a>\n\t</div>\n\n\t<div class="facto-topbar-right">\n\t\t<a class="facto-topbar-simple-link" href="/simple/">Simple View</a>\n\n\t\t<div class="facto-settings-wrap">\n\t\t\t<button class="facto-settings-gear" onclick="{~P~}.views[\'Facto-Full-TopBar\'].toggleThemePanel()">\n\t\t\t\t<svg viewBox="0 0 24 24"><path d="M19.14 12.94c.04-.3.06-.61.06-.94 0-.32-.02-.64-.07-.94l2.03-1.58a.49.49 0 00.12-.61l-1.92-3.32a.49.49 0 00-.59-.22l-2.39.96c-.5-.38-1.03-.7-1.62-.94l-.36-2.54a.48.48 0 00-.48-.41h-3.84c-.24 0-.43.17-.47.41l-.36 2.54c-.59.24-1.13.57-1.62.94l-2.39-.96a.49.49 0 00-.59.22L2.74 8.87c-.12.21-.08.47.12.61l2.03 1.58c-.05.3-.07.62-.07.94s.02.64.07.94l-2.03 1.58a.49.49 0 00-.12.61l1.92 3.32c.12.22.37.29.59.22l2.39-.96c.5.38 1.03.7 1.62.94l.36 2.54c.05.24.24.41.48.41h3.84c.24 0 .44-.17.47-.41l.36-2.54c.59-.24 1.13-.56 1.62-.94l2.39.96c.22.08.47 0 .59-.22l1.92-3.32c.12-.22.07-.47-.12-.61l-2.01-1.58zM12 15.6A3.6 3.6 0 1112 8.4a3.6 3.6 0 010 7.2z"/></svg>\n\t\t\t</button>\n\n\t\t\t<div class="facto-settings-panel" id="Facto-Full-Settings-Panel" style="display:none;">\n\t\t\t\t<div class="facto-settings-panel-title">Theme</div>\n\t\t\t\t<div class="facto-theme-grid" id="Facto-Full-Settings-ThemeGrid"></div>\n\t\t\t</div>\n\t\t</div>\n\t</div>\n</div>\n'}],Renderables:[{RenderableHash:"Facto-Full-TopBar-Content",TemplateHash:"Facto-Full-TopBar-Template",DestinationAddress:"#Facto-Full-TopBar-Container",RenderMethod:"replace"}]};e.exports=class extends i{constructor(t,e,o){super(t,e,o),this._themePanelOpen=!1}onAfterRender(t,e,o,i){return this._renderThemeGrid(),document.addEventListener("click",t=>{if(!this._themePanelOpen)return;if(!t.target.closest(".facto-settings-wrap")){this._themePanelOpen=!1;let t=document.getElementById("Facto-Full-Settings-Panel");t&&(t.style.display="none")}}),super.onAfterRender(t,e,o,i)}toggleThemePanel(){let t=document.getElementById("Facto-Full-Settings-Panel");t&&(this._themePanelOpen=!this._themePanelOpen,t.style.display=this._themePanelOpen?"block":"none")}selectTheme(t){this.pict.PictApplication.applyTheme(t),this._renderThemeGrid(),this._themePanelOpen=!1;let e=document.getElementById("Facto-Full-Settings-Panel");e&&(e.style.display="none")}highlightRoute(t){let e=document.getElementById("Facto-Full-TopBar-Nav");if(!e)return;let o=e.querySelectorAll("a[data-route]");for(let e=0;e<o.length;e++)o[e].getAttribute("data-route")===t?o[e].classList.add("active"):o[e].classList.remove("active")}_renderThemeGrid(){let t=document.getElementById("Facto-Full-Settings-ThemeGrid");if(!t)return;let e=this.pict.PictApplication.getThemeList(),o=this.pict.AppData.Facto.CurrentTheme||"facto-dark",i="";for(let t=0;t<e.length;t++){let n=e[t];i+='<div class="facto-theme-swatch'+(n.Key===o?" active":"")+"\" onclick=\"pict.views['Facto-Full-TopBar'].selectTheme('"+n.Key+"')\">",i+='<div class="facto-theme-swatch-colors">';for(let t=0;t<n.Colors.length;t++)i+='<div class="facto-theme-swatch-dot" style="background:'+n.Colors[t]+';"></div>';i+="</div>",i+='<div class="facto-theme-swatch-label">'+n.Label+"</div>",i+="</div>"}t.innerHTML=i}},e.exports.default_configuration=n},{"pict-view":41}],67:[function(t,e,o){const i={"@":{DataType:"AutoIdentity",Label:"Auto ID",HasSize:!1},"%":{DataType:"GUID",Label:"GUID",HasSize:!1},$:{DataType:"String",Label:"String",HasSize:!0},"*":{DataType:"Text",Label:"Text",HasSize:!1},"#":{DataType:"Numeric",Label:"Numeric",HasSize:!1},".":{DataType:"Decimal",Label:"Decimal",HasSize:!0},"&":{DataType:"DateTime",Label:"Date/Time",HasSize:!1},"^":{DataType:"Boolean",Label:"Boolean",HasSize:!1}},n={};for(let t in i)n[i[t].DataType]=t;e.exports={MICRODDL_TYPE_MAP:i,DATATYPE_TO_SYMBOL:n,columnsToMicroDDL:function(t,e){let o=["!"+(e||"Untitled").replace(/[^a-zA-Z0-9_]/g,"")];for(let e=0;e<t.length;e++){let a=t[e],r=n[a.DataType]||"$",s=r+(a.Name||"Column"+e);i[r].HasSize&&a.Size&&(s+=" "+a.Size),o.push(s)}return o.join("\n")},microDDLToColumns:function(t){let e=t.split("\n"),o=[];for(let t=0;t<e.length;t++){let n=e[t].trim();if(!n||n.startsWith("!")||n.startsWith("//")||n.startsWith("--")||n.startsWith("->"))continue;let a=n.charAt(0);if(i.hasOwnProperty(a)){let t=n.substring(1).trim().split(/\s+/);o.push({Name:t[0]||"",DataType:i[a].DataType,Size:t[1]||""})}}return o}}},{}],68:[function(t,e,o){e.exports={Name:"Retold Facto",Hash:"Facto",MainViewportViewIdentifier:"Facto-Layout",MainViewportDestinationAddress:"#Facto-Application-Container",MainViewportDefaultDataAddress:"AppData.Facto",pict_configuration:{Product:"Facto"},AutoRenderMainViewportViewAfterInitialize:!1}},{}],69:[function(t,e,o){const i=t("pict-application"),n=t("pict-section-modal"),a=t("./providers/Pict-Provider-Facto.js"),r=t("./views/PictView-Facto-Layout.js"),s=t("./views/PictView-Facto-Sources.js"),l=t("./views/PictView-Facto-Records.js"),c=t("./views/PictView-Facto-Datasets.js"),d=t("./views/PictView-Facto-Ingest.js"),p=t("./views/PictView-Facto-Projections.js"),h=t("./views/PictView-Facto-Catalog.js"),u=t("./views/PictView-Facto-Scanner.js"),f=t("./views/PictView-Facto-Throughput.js");e.exports=class extends i{constructor(t,e,o){super(t,e,o),this.pict.addView("Pict-Section-Modal",n.default_configuration,n),this.pict.addProvider("Facto",a.default_configuration,a),this.pict.addView("Facto-Layout",r.default_configuration,r),this.pict.addView("Facto-Sources",s.default_configuration,s),this.pict.addView("Facto-Records",l.default_configuration,l),this.pict.addView("Facto-Datasets",c.default_configuration,c),this.pict.addView("Facto-Ingest",d.default_configuration,d),this.pict.addView("Facto-Projections",p.default_configuration,p),this.pict.addView("Facto-Catalog",h.default_configuration,h),this.pict.addView("Facto-Scanner",u.default_configuration,u),this.pict.addView("Facto-Throughput",f.default_configuration,f)}onAfterInitializeAsync(t){return this.pict.AppData.Facto={CatalogEntries:[],Sources:[],Datasets:[],Records:[],IngestJobs:[],SelectedSource:null,SelectedDataset:null,RecordPage:0,RecordPageSize:50,ScannerPaths:[],ScannerDatasets:[]},window.pict=this.pict,this.pict.views["Facto-Layout"].render(),t()}},e.exports.default_configuration=t("./Pict-Application-Facto-Configuration.json")},{"./Pict-Application-Facto-Configuration.json":68,"./providers/Pict-Provider-Facto.js":72,"./views/PictView-Facto-Catalog.js":79,"./views/PictView-Facto-Datasets.js":80,"./views/PictView-Facto-Ingest.js":81,"./views/PictView-Facto-Layout.js":82,"./views/PictView-Facto-Projections.js":83,"./views/PictView-Facto-Records.js":84,"./views/PictView-Facto-Scanner.js":85,"./views/PictView-Facto-Sources.js":86,"./views/PictView-Facto-Throughput.js":87,"pict-application":5,"pict-section-modal":146}],70:[function(t,e,o){e.exports={FactoApplication:t("./Pict-Application-Facto.js"),FactoFullApplication:t("../pict-app-full/Pict-Application-Facto-Full.js")},"undefined"!=typeof window&&(window.FactoApplication=e.exports.FactoApplication,window.FactoFullApplication=e.exports.FactoFullApplication)},{"../pict-app-full/Pict-Application-Facto-Full.js":44,"./Pict-Application-Facto.js":69}],71:[function(t,e,o){const i=t("pict-provider");e.exports=class extends i{constructor(t,e,o){super(t,e,o)}getVal(t){return this.pict.ContentAssignment.readContent("#"+t)||""}refreshDataViews(t){let e=t||["sources","datasets"];if(e.indexOf("sources")>-1){let t=this.pict.views["Facto-Sources"]||this.pict.views["Facto-Full-Sources"];t&&this.pict.providers.Facto.loadSources().then(()=>{t.refreshList()})}if(e.indexOf("datasets")>-1){let t=this.pict.views["Facto-Datasets"]||this.pict.views["Facto-Full-Datasets"];t&&this.pict.providers.Facto.loadDatasets().then(()=>{t.refreshList()})}if(e.indexOf("records")>-1){let t=this.pict.views["Facto-Records"]||this.pict.views["Facto-Full-Records"];t&&this.pict.providers.Facto.loadRecords().then(()=>{t.refreshList()})}}},e.exports.default_configuration={ProviderIdentifier:"FactoUI",AutoInitialize:!0,AutoInitializeOrdinal:0}},{"pict-provider":7}],72:[function(t,e,o){const i=t("pict-provider");class n extends i{constructor(t,e,o){super(t,e,o)}api(t,e,o){let i={method:t,headers:{}};return o&&(i.headers["Content-Type"]="application/json",i.body=JSON.stringify(o)),fetch(e,i).then(function(t){return t.text().then(function(e){let o;try{o=JSON.parse(e)}catch(o){return{Error:"HTTP "+t.status+" (non-JSON): "+e.substring(0,200)}}return!t.ok&&o&&o.code&&!o.Error&&(o.Error=o.code+": "+(o.message||"HTTP "+t.status)),o})}).catch(function(t){return{Error:t.message||"Network error"}})}}Object.assign(n.prototype,t("./facto-api/Facto-API-Catalog.js")),Object.assign(n.prototype,t("./facto-api/Facto-API-Sources.js")),Object.assign(n.prototype,t("./facto-api/Facto-API-Datasets.js")),Object.assign(n.prototype,t("./facto-api/Facto-API-Projections.js")),Object.assign(n.prototype,t("./facto-api/Facto-API-Scanner.js")),Object.assign(n.prototype,t("./facto-api/Facto-API-Connections.js")),e.exports=n,e.exports.default_configuration={ProviderIdentifier:"Facto",AutoInitialize:!0}},{"./facto-api/Facto-API-Catalog.js":73,"./facto-api/Facto-API-Connections.js":74,"./facto-api/Facto-API-Datasets.js":75,"./facto-api/Facto-API-Projections.js":76,"./facto-api/Facto-API-Scanner.js":77,"./facto-api/Facto-API-Sources.js":78,"pict-provider":7}],73:[function(t,e,o){e.exports={loadCatalogEntries:function(){return this.api("GET","/facto/catalog/entries").then(t=>{this.pict.AppData.Facto.CatalogEntries=t&&t.Entries?t.Entries:[]})},searchCatalog:function(t){return this.api("GET","/facto/catalog/search?q="+encodeURIComponent(t)).then(t=>(this.pict.AppData.Facto.CatalogEntries=t&&t.Entries?t.Entries:[],t))},createCatalogEntry:function(t){return this.api("POST","/facto/catalog/entry",t).then(t=>t)},deleteCatalogEntry:function(t){return this.api("DELETE","/facto/catalog/entry/"+t).then(t=>t)},loadCatalogEntryDatasets:function(t){return this.api("GET","/facto/catalog/entry/"+t+"/datasets").then(t=>t)},addCatalogDataset:function(t,e){return this.api("POST","/facto/catalog/entry/"+t+"/dataset",e).then(t=>t)},provisionCatalogDataset:function(t){return this.api("POST","/facto/catalog/dataset/"+t+"/provision").then(t=>t)},fetchCatalogDataset:function(t){return this.api("POST","/facto/catalog/dataset/"+t+"/fetch").then(t=>t)},importCatalog:function(t){return this.api("POST","/facto/catalog/import",t).then(t=>t)},exportCatalog:function(){return this.api("GET","/facto/catalog/export").then(t=>t)}}},{}],74:[function(t,e,o){e.exports={loadStoreConnections:function(){return this.api("GET","/facto/connections").then(t=>(this.pict.AppData.Facto.StoreConnections=t&&t.Connections?t.Connections:[],t))},createStoreConnection:function(t){return this.api("POST","/facto/connection",t)},updateStoreConnection:function(t,e){return this.api("PUT",`/facto/connection/${t}`,e)},deleteStoreConnection:function(t){return this.api("DELETE",`/facto/connection/${t}`)},testStoreConnection:function(t){return this.api("POST",`/facto/connection/${t}/test`)},testAdHocConnection:function(t,e){return this.api("POST","/facto/connection/test",{Type:t,Config:e})},loadAvailableConnectionTypes:function(){return this.api("GET","/facto/connection/available-types")}}},{}],75:[function(t,e,o){e.exports={loadDatasets:function(){return this.api("GET","/1.0/Datasets/0/100").then(t=>{this.pict.AppData.Facto.Datasets=Array.isArray(t)?t:[]})},createDataset:function(t){return this.api("POST","/1.0/Dataset",t).then(t=>t)},loadDatasetStats:function(t){return this.api("GET",`/facto/dataset/${t}/stats`).then(t=>t)},loadDatasetSources:function(t){return this.api("GET",`/facto/dataset/${t}/sources`).then(t=>t)},linkDatasetSource:function(t,e,o){return this.api("POST",`/facto/dataset/${t}/source`,{IDSource:e,ReliabilityWeight:o||1}).then(t=>t)},loadDatasetRecords:function(t,e,o){return this.api("GET",`/facto/dataset/${t}/records/${e||0}/${o||50}`).then(t=>t)},loadRecords:function(t){let e=this.pict.AppData.Facto.RecordPageSize,o=(t||0)*e;return this.api("GET",`/1.0/Records/${o}/${e}`).then(t=>{this.pict.AppData.Facto.Records=Array.isArray(t)?t:[]})},expandDateFilter:function(t,e){if(!t||"string"!=typeof t)return null;let o=t.trim();if(!o)return null;let i=o.match(/^(\d{4})$/);if(i)return e?i[1]+"-12-31":i[1]+"-01-01";let n=o.match(/^(\d{4})-(\d{1,2})$/);if(n){let t=parseInt(n[1],10),o=parseInt(n[2],10);if(o<1||o>12)return null;let i=String(o).padStart(2,"0");if(e){let e=new Date(t,o,0).getDate();return t+"-"+i+"-"+String(e).padStart(2,"0")}return t+"-"+i+"-01"}let a=o.match(/^(\d{4})-(\d{1,2})-(\d{1,2})$/);if(a){let t=parseInt(a[2],10),e=parseInt(a[3],10);return t<1||t>12||e<1||e>31?null:a[1]+"-"+String(t).padStart(2,"0")+"-"+String(e).padStart(2,"0")}return null},loadFilteredRecords:function(t,e,o,i){let n=this.pict.AppData.Facto.RecordPageSize,a=(t||0)*n,r=[];Array.isArray(e)&&e.length>0&&r.push("FBV~IDSource~INN~"+e.join(","));let s,l=this.expandDateFilter(o,!1),c=this.expandDateFilter(i,!0);return l&&r.push("FBV~IngestDate~GE~"+encodeURIComponent(l)),c&&r.push("FBV~IngestDate~LE~"+encodeURIComponent(c)),s=r.length>0?"/1.0/Records/FilteredTo/"+r.join("~")+"/"+a+"/"+n:"/1.0/Records/"+a+"/"+n,this.api("GET",s).then(t=>{this.pict.AppData.Facto.Records=Array.isArray(t)?t:[]})},ingestRecords:function(t,e,o){return this.api("POST","/facto/record/ingest",{Records:t,IDDataset:e,IDSource:o}).then(t=>t)},loadRecordCertainty:function(t){return this.api("GET",`/facto/record/${t}/certainty`).then(t=>t)},addRecordCertainty:function(t,e,o,i){return this.api("POST",`/facto/record/${t}/certainty`,{CertaintyValue:e,Dimension:o||"overall",Justification:i||""}).then(t=>t)},loadRecordVersions:function(t){return this.api("GET",`/facto/record/${t}/versions`).then(t=>t)},loadIngestJobs:function(){return this.api("GET","/facto/ingest/jobs").then(t=>{this.pict.AppData.Facto.IngestJobs=t&&t.Jobs?t.Jobs:[]})},createIngestJob:function(t,e,o){return this.api("POST","/facto/ingest/job",{IDSource:t,IDDataset:e,Configuration:o||{}}).then(t=>t)},startIngestJob:function(t){return this.api("PUT",`/facto/ingest/job/${t}/start`).then(t=>t)},completeIngestJob:function(t,e,o){let i=Object.assign({},e||{});return o&&(i.Status=o),this.api("PUT",`/facto/ingest/job/${t}/complete`,i).then(t=>t)},loadIngestJobDetails:function(t){return this.api("GET",`/facto/ingest/job/${t}`).then(t=>t)}}},{}],76:[function(t,e,o){e.exports={loadProjections:function(){return this.api("GET","/facto/projections").then(t=>(this.pict.AppData.Facto.Projections=t&&t.Projections?t.Projections:[],t))},deleteProjection:function(t){return this.api("DELETE",`/1.0/Dataset/${t}`)},loadDatasetsByType:function(t){return this.api("GET",`/facto/datasets/by-type/${t}`).then(t=>t)},queryRecords:function(t){return this.api("POST","/facto/projections/query",t).then(t=>t)},aggregateRecords:function(t){return this.api("POST","/facto/projections/aggregate",t).then(t=>t)},queryCertainty:function(t){return this.api("POST","/facto/projections/certainty",t).then(t=>t)},compareDatasets:function(t){return this.api("POST","/facto/projections/compare",{DatasetIDs:t}).then(t=>t)},loadProjectionSummary:function(){return this.api("GET","/facto/projections/summary").then(t=>t)},uploadSourceFile:function(t,e,o,i){return this.api("POST",`/facto/source/${t}/documentation/upload`,{Filename:e,ContentType:o,Data:i})},ingestFileContent:function(t,e,o,i,n){return this.api("POST","/facto/ingest/file",{IDDataset:t||0,IDSource:e||0,Content:o,Format:i||"Auto",Type:n||"data"}).then(t=>t)},compileMicroDDL:function(t){return this.api("POST","/facto/projection/compile",{DDL:t})},loadProjectionSchema:function(t){return this.api("GET",`/facto/projection/${t}/schema`)},saveProjectionSchema:function(t,e){return this.api("POST",`/facto/projection/${t}/save-schema`,{SchemaDefinition:e})},loadProjectionStores:function(t){return this.api("GET",`/facto/projection/${t}/stores`)},deployProjection:function(t,e,o){return this.api("POST",`/facto/projection/${t}/deploy`,{IDStoreConnection:e,TargetTableName:o})},loadProjectionMappings:function(t){return this.api("GET",`/facto/projection/${t}/mappings`)},loadProjectionMapping:function(t){return this.api("GET",`/facto/projection/mapping/${t}`)},createProjectionMapping:function(t,e){return this.api("POST",`/facto/projection/${t}/mapping`,e)},updateProjectionMapping:function(t,e){return this.api("POST",`/facto/projection/mapping/${t}/update`,e)},deleteProjectionMapping:function(t){return this.api("DELETE",`/facto/projection/mapping/${t}`)},discoverFields:function(t,e,o){return this.api("POST",`/facto/projection/${t}/discover-fields`,{IDSource:e,SampleSize:o||50})},executeImport:function(t,e,o,i,n){return this.api("POST",`/facto/projection/${t}/import`,{IDProjectionMapping:e,IDProjectionStore:o,BatchSize:i||100,StageComprehension:!!n})}}},{}],77:[function(t,e,o){e.exports={loadScannerPaths:function(){return this.api("GET","/facto/scanner/paths").then(t=>{this.pict.AppData.Facto.ScannerPaths=t&&t.Paths?t.Paths:[]})},loadScannerDatasets:function(t){let e="/facto/scanner/datasets",o=[];return t&&(t.status&&o.push("status="+encodeURIComponent(t.status)),t.search&&o.push("search="+encodeURIComponent(t.search))),o.length>0&&(e+="?"+o.join("&")),this.api("GET",e).then(t=>{this.pict.AppData.Facto.ScannerDatasets=t&&t.Datasets?t.Datasets:[]})},loadScannerDatasetDetail:function(t){return this.api("GET","/facto/scanner/dataset/"+encodeURIComponent(t))},addScannerPath:function(t){return this.api("POST","/facto/scanner/path",{Path:t})},removeScannerPath:function(t){return this.api("DELETE","/facto/scanner/path",{Path:t})},rescanPaths:function(t){let e=t?{Path:t}:{};return this.api("POST","/facto/scanner/rescan",e)},provisionScannerDataset:function(t){return this.api("POST","/facto/scanner/dataset/"+encodeURIComponent(t)+"/provision")},ingestScannerDataset:function(t,e){return this.api("POST","/facto/scanner/dataset/"+encodeURIComponent(t)+"/ingest",e||{})},downloadScannerDataset:function(t){return this.api("POST","/facto/scanner/dataset/"+encodeURIComponent(t)+"/download")},provisionAllScannerDatasets:function(){return this.api("POST","/facto/scanner/provision-all")},loadIngestionPlan:function(t){return this.api("GET","/facto/scanner/dataset/"+encodeURIComponent(t)+"/ingestion-plan")},saveIngestionPlan:function(t,e){return this.api("PUT","/facto/scanner/dataset/"+encodeURIComponent(t)+"/ingestion-plan",e)}}},{}],78:[function(t,e,o){e.exports={loadSources:function(){return this.api("GET","/1.0/Sources/0/100").then(t=>(this.pict.AppData.Facto.Sources=Array.isArray(t)?t:[],this.pict.AppData.Facto.Sources))},loadActiveSources:function(){return this.api("GET","/facto/sources/active").then(t=>t)},createSource:function(t){return this.api("POST","/1.0/Source",t).then(t=>t)},activateSource:function(t){return this.api("PUT",`/facto/source/${t}/activate`).then(t=>t)},deactivateSource:function(t){return this.api("PUT",`/facto/source/${t}/deactivate`).then(t=>t)},loadSourceSummary:function(t){return this.api("GET",`/facto/source/${t}/summary`).then(t=>t)},loadSourceDocumentation:function(t){return this.api("GET",`/facto/source/${t}/documentation`)},loadSourceDocument:function(t,e){return this.api("GET",`/facto/source/${t}/documentation/${e}`)},createSourceDocument:function(t,e){return this.api("POST",`/facto/source/${t}/documentation`,e)},updateSourceDocument:function(t,e,o){return this.api("PUT",`/facto/source/${t}/documentation/${e}`,o)},deleteSourceDocument:function(t,e){return this.api("DELETE",`/facto/source/${t}/documentation/${e}`)},loadSourceCatalogContext:function(t){return this.api("GET",`/facto/source/${t}/catalog-context`)},loadCatalogSourceLinks:function(){return this.api("GET","/facto/catalog/source-links")}}},{}],79:[function(t,e,o){const i=t("pict-view");e.exports=class extends i{constructor(t,e,o){super(t,e,o)}onAfterRender(){this.pict.providers.Facto.loadCatalogEntries().then(()=>{this.refreshList()}).catch(t=>{this.pict.views["Pict-Section-Modal"].toast("Error loading catalog: "+t.message,{type:"error"})})}refreshList(){let t=document.getElementById("facto-catalog-list");if(!t)return;let e=this.pict.AppData.Facto.CatalogEntries;if(!e||0===e.length)return void(t.innerHTML='<p style="color:#888; font-style:italic;">No catalog entries yet. Add sources to your research catalog.</p>');let o="<table><thead><tr><th>ID</th><th>Agency</th><th>Name</th><th>Type</th><th>Category</th><th>Region</th><th>Verified</th><th>Actions</th></tr></thead><tbody>";for(let t=0;t<e.length;t++){let i=e[t],n=i.Verified?'<span style="color:#28a745;">✓</span>':'<span style="color:#ccc;">✗</span>';o+="<tr>",o+="<td>"+(i.IDSourceCatalogEntry||"")+"</td>",o+="<td>"+(i.Agency||"")+"</td>",o+="<td>"+(i.Name||"")+"</td>",o+="<td>"+(i.Type||"")+"</td>",o+="<td>"+(i.Category||"")+"</td>",o+="<td>"+(i.Region||"")+"</td>",o+='<td style="text-align:center;">'+n+"</td>",o+="<td>",o+='<button class="primary" style="padding:4px 8px; font-size:0.8em;" onclick="pict.views[\'Facto-Catalog\'].viewEntry('+i.IDSourceCatalogEntry+')">Datasets</button> ',o+='<button class="danger" style="padding:4px 8px; font-size:0.8em;" onclick="pict.views[\'Facto-Catalog\'].deleteEntry('+i.IDSourceCatalogEntry+')">Delete</button>',o+="</td>",o+="</tr>"}o+="</tbody></table>",t.innerHTML=o}searchCatalog(){let t=this.pict.providers.FactoUI.getVal("facto-catalog-search");t?this.pict.providers.Facto.searchCatalog(t).then(()=>{this.refreshList()}).catch(t=>{this.pict.views["Pict-Section-Modal"].toast("Search error: "+t.message,{type:"error"})}):this.pict.providers.Facto.loadCatalogEntries().then(()=>{this.refreshList()})}addEntry(){let t=this.pict.providers.FactoUI.getVal("facto-catalog-agency"),e=this.pict.providers.FactoUI.getVal("facto-catalog-name"),o=this.pict.providers.FactoUI.getVal("facto-catalog-type"),i=this.pict.providers.FactoUI.getVal("facto-catalog-url"),n=this.pict.providers.FactoUI.getVal("facto-catalog-protocol"),a=this.pict.providers.FactoUI.getVal("facto-catalog-category"),r=this.pict.providers.FactoUI.getVal("facto-catalog-region"),s=this.pict.providers.FactoUI.getVal("facto-catalog-frequency"),l=this.pict.providers.FactoUI.getVal("facto-catalog-description");t||e?this.pict.providers.Facto.createCatalogEntry({Agency:t,Name:e,Type:o,URL:i,Protocol:n,Category:a,Region:r,UpdateFrequency:s,Description:l}).then(o=>{if(o&&o.Success){this.pict.views["Pict-Section-Modal"].toast("Catalog entry created: "+(t||e),{type:"success"});let o=["agency","name","url","description"];for(let t=0;t<o.length;t++){let e=document.getElementById("facto-catalog-"+o[t]);e&&(e.value="")}return this.pict.providers.Facto.loadCatalogEntries()}this.pict.views["Pict-Section-Modal"].toast("Error: "+(o&&o.Error||"Unknown error"),{type:"error"})}).then(()=>{this.refreshList()}).catch(t=>{this.pict.views["Pict-Section-Modal"].toast("Error: "+t.message,{type:"error"})}):this.pict.views["Pict-Section-Modal"].toast("Agency or Name is required",{type:"warning"})}async deleteEntry(t){await this.pict.views["Pict-Section-Modal"].confirm("Remove this catalog entry?",{title:"Remove Entry",confirmLabel:"Remove",dangerous:!0})&&this.pict.providers.Facto.deleteCatalogEntry(t).then(()=>this.pict.providers.Facto.loadCatalogEntries()).then(()=>{this.refreshList(),this.pict.views["Pict-Section-Modal"].toast("Entry removed",{type:"success"})}).catch(t=>{this.pict.views["Pict-Section-Modal"].toast("Error: "+t.message,{type:"error"})})}viewEntry(t){let e=document.getElementById("facto-catalog-detail");e&&this.pict.providers.Facto.loadCatalogEntryDatasets(t).then(o=>{let i=o&&o.Datasets?o.Datasets:[],n='<h3 style="margin-bottom:8px; font-size:1em; color:#444;">Dataset Definitions for Entry #'+t+"</h3>";if(0===i.length)n+='<p style="color:#888; font-style:italic; margin-bottom:8px;">No dataset definitions yet.</p>';else{n+="<table><thead><tr><th>ID</th><th>Name</th><th>Format</th><th>Endpoint URL</th><th>Version Policy</th><th>Status</th><th>Actions</th></tr></thead><tbody>";for(let e=0;e<i.length;e++){let o=i[e],a=o.Provisioned?'<span style="color:#28a745;">Provisioned (Source #'+o.IDSource+", Dataset #"+o.IDDataset+")</span>":'<span style="color:#888;">Not provisioned</span>',r="";r=o.Provisioned?'<button class="primary" style="padding:4px 8px; font-size:0.8em;" onclick="pict.views[\'Facto-Catalog\'].fetchDataset('+o.IDCatalogDatasetDefinition+", "+t+')">Fetch</button>':'<button class="success" style="padding:4px 8px; font-size:0.8em;" onclick="pict.views[\'Facto-Catalog\'].provisionDataset('+o.IDCatalogDatasetDefinition+", "+t+')">Provision</button>',n+="<tr>",n+="<td>"+(o.IDCatalogDatasetDefinition||"")+"</td>",n+="<td>"+(o.Name||"")+"</td>",n+="<td>"+(o.Format||"")+"</td>",n+='<td style="max-width:200px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap;">'+(o.EndpointURL||"")+"</td>",n+="<td>"+(o.VersionPolicy||"Append")+"</td>",n+="<td>"+a+"</td>",n+="<td>"+r+"</td>",n+="</tr>"}n+="</tbody></table>"}n+='<h4 style="margin-top:12px; margin-bottom:8px; font-size:0.95em; color:#555;">Add Dataset Definition</h4>',n+='<div class="inline-group">',n+='<div><label for="facto-catds-name">Name</label><input type="text" id="facto-catds-name" placeholder="e.g. Monthly Earthquake Feed"></div>',n+='<div><label for="facto-catds-format">Format</label>',n+='<select id="facto-catds-format"><option value="csv">CSV</option><option value="json">JSON</option><option value="xml">XML</option><option value="geojson">GeoJSON</option><option value="other">Other</option></select></div>',n+="</div>",n+='<div class="inline-group">',n+='<div><label for="facto-catds-endpoint">Endpoint URL</label><input type="text" id="facto-catds-endpoint" placeholder="https://api.example.gov/data.csv"></div>',n+='<div><label for="facto-catds-versionpolicy">Version Policy</label>',n+='<select id="facto-catds-versionpolicy"><option value="Append">Append</option><option value="Replace">Replace</option></select></div>',n+="</div>",n+='<div><label for="facto-catds-description">Description</label><input type="text" id="facto-catds-description" placeholder="Description of the dataset"></div>',n+='<button class="primary" onclick="pict.views[\'Facto-Catalog\'].addDatasetDefinition('+t+')">Add Dataset Definition</button>',n+="<button class=\"secondary\" onclick=\"document.getElementById('facto-catalog-detail').innerHTML='';\">Close</button>",e.innerHTML=n}).catch(t=>{e.innerHTML='<p style="color:#dc3545;">Error loading datasets: '+t.message+"</p>"})}addDatasetDefinition(t){let e=this.pict.providers.FactoUI.getVal("facto-catds-name"),o=this.pict.providers.FactoUI.getVal("facto-catds-format"),i=this.pict.providers.FactoUI.getVal("facto-catds-endpoint"),n=this.pict.providers.FactoUI.getVal("facto-catds-versionpolicy")||"Append",a=this.pict.providers.FactoUI.getVal("facto-catds-description");e?this.pict.providers.Facto.addCatalogDataset(t,{Name:e,Format:o,EndpointURL:i,VersionPolicy:n,Description:a}).then(o=>{o&&o.Success?(this.pict.views["Pict-Section-Modal"].toast("Dataset definition added: "+e,{type:"success"}),this.viewEntry(t)):this.pict.views["Pict-Section-Modal"].toast("Error: "+(o&&o.Error||"Unknown error"),{type:"error"})}).catch(t=>{this.pict.views["Pict-Section-Modal"].toast("Error: "+t.message,{type:"error"})}):this.pict.views["Pict-Section-Modal"].toast("Dataset name is required",{type:"warning"})}provisionDataset(t,e){this.pict.views["Pict-Section-Modal"].toast("Provisioning...",{type:"info"}),this.pict.providers.Facto.provisionCatalogDataset(t).then(t=>{if(t&&t.Success){let o="Provisioned! Source #"+t.Source.IDSource+", Dataset #"+t.Dataset.IDDataset;this.pict.views["Pict-Section-Modal"].toast(o,{type:"success"}),this.viewEntry(e),this.pict.providers.FactoUI.refreshDataViews(["sources","datasets"])}else this.pict.views["Pict-Section-Modal"].toast("Error: "+(t&&t.Error||"Unknown error"),{type:"error"})}).catch(t=>{this.pict.views["Pict-Section-Modal"].toast("Error: "+t.message,{type:"error"})})}fetchDataset(t,e){this.pict.views["Pict-Section-Modal"].toast("Fetching data from endpoint...",{type:"info"}),this.pict.providers.Facto.fetchCatalogDataset(t).then(t=>{if(t&&t.Success){let o="Fetched! "+t.Ingested+" records ingested (v"+t.DatasetVersion+", "+t.Format+")";t.IsDuplicate&&(o+=" [duplicate content detected]"),this.pict.views["Pict-Section-Modal"].toast(o,{type:"success"}),this.viewEntry(e),this.pict.providers.FactoUI.refreshDataViews(["records"])}else this.pict.views["Pict-Section-Modal"].toast("Fetch error: "+(t&&t.Error||"Unknown error"),{type:"error"})}).catch(t=>{this.pict.views["Pict-Section-Modal"].toast("Fetch error: "+t.message,{type:"error"})})}importCatalog(){let t,e=document.getElementById("facto-catalog-import-json");if(e&&e.value){try{t=JSON.parse(e.value)}catch(t){return void this.pict.views["Pict-Section-Modal"].toast("Invalid JSON: "+t.message,{type:"error"})}this.pict.providers.Facto.importCatalog(t).then(t=>{if(t&&t.Success)return this.pict.views["Pict-Section-Modal"].toast("Imported "+t.EntriesCreated+" entries with "+t.DatasetsCreated+" datasets",{type:"success"}),e.value="",this.pict.providers.Facto.loadCatalogEntries();{let e=t&&t.Error||"Unknown";if("Unknown"===e)try{e="Unexpected response: "+JSON.stringify(t).substring(0,300)}catch(t){}this.pict.views["Pict-Section-Modal"].toast("Import error: "+e,{type:"error"})}}).then(()=>{this.refreshList()}).catch(t=>{this.pict.views["Pict-Section-Modal"].toast("Error: "+t.message,{type:"error"})})}else this.pict.views["Pict-Section-Modal"].toast("Paste JSON to import",{type:"warning"})}exportCatalog(){this.pict.providers.Facto.exportCatalog().then(t=>{let e=document.getElementById("facto-catalog-import-json");e&&(e.value=JSON.stringify(t&&t.Entries?t.Entries:t,null,2)),this.pict.views["Pict-Section-Modal"].toast("Catalog exported to JSON text area",{type:"success"})}).catch(t=>{this.pict.views["Pict-Section-Modal"].toast("Error: "+t.message,{type:"error"})})}},e.exports.default_configuration={ViewIdentifier:"Facto-Catalog",DefaultRenderable:"Facto-Catalog",DefaultDestinationAddress:"#Facto-Section-Catalog",Templates:[{Hash:"Facto-Catalog",Template:'\n<div class="accordion-row">\n\t<div class="accordion-number">0</div>\n\t<div class="accordion-card" id="facto-card-catalog">\n\t\t<div class="accordion-header" onclick="pict.views[\'Facto-Layout\'].toggleSection(\'facto-card-catalog\')">\n\t\t\t<span class="accordion-title">Source Catalog</span>\n\t\t\t<span class="accordion-preview">Research and catalog data sources</span>\n\t\t\t<span class="accordion-toggle">▼</span>\n\t\t</div>\n\t\t<div class="accordion-body">\n\t\t\t<p style="margin-bottom:12px; color:#666; font-size:0.9em;">Research and catalog potential data sources before provisioning them as runtime Sources and Datasets.</p>\n\n\t\t\t\x3c!-- Search --\x3e\n\t\t\t<div class="inline-group" style="margin-bottom:12px;">\n\t\t\t\t<div style="flex:3;">\n\t\t\t\t\t<input type="text" id="facto-catalog-search" placeholder="Search catalog by name, agency, category, or description..." style="margin-bottom:0;">\n\t\t\t\t</div>\n\t\t\t\t<div style="flex:0 0 auto; display:flex; align-items:flex-end;">\n\t\t\t\t\t<button class="primary" style="margin-bottom:0;" onclick="pict.views[\'Facto-Catalog\'].searchCatalog()">Search</button>\n\t\t\t\t</div>\n\t\t\t</div>\n\n\t\t\t\x3c!-- Entries list --\x3e\n\t\t\t<div id="facto-catalog-list"></div>\n\n\t\t\t\x3c!-- Dataset definitions detail (appears when clicking "Datasets" on an entry) --\x3e\n\t\t\t<div id="facto-catalog-detail" style="margin-top:12px;"></div>\n\n\t\t\t\x3c!-- Add entry form --\x3e\n\t\t\t<h3 style="margin-top:16px; margin-bottom:8px; font-size:1em; color:#444;">Add Catalog Entry</h3>\n\t\t\t<div class="inline-group">\n\t\t\t\t<div>\n\t\t\t\t\t<label for="facto-catalog-agency">Agency / Organization</label>\n\t\t\t\t\t<input type="text" id="facto-catalog-agency" placeholder="e.g. US Geological Survey (USGS)">\n\t\t\t\t</div>\n\t\t\t\t<div>\n\t\t\t\t\t<label for="facto-catalog-name">Portal Name</label>\n\t\t\t\t\t<input type="text" id="facto-catalog-name" placeholder="e.g. USGS Water Services">\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t\t<div class="inline-group">\n\t\t\t\t<div>\n\t\t\t\t\t<label for="facto-catalog-type">Type</label>\n\t\t\t\t\t<select id="facto-catalog-type">\n\t\t\t\t\t\t<option value="API">API</option>\n\t\t\t\t\t\t<option value="File">File</option>\n\t\t\t\t\t\t<option value="FTP">FTP</option>\n\t\t\t\t\t\t<option value="Web">Web</option>\n\t\t\t\t\t\t<option value="Database">Database</option>\n\t\t\t\t\t\t<option value="Other">Other</option>\n\t\t\t\t\t</select>\n\t\t\t\t</div>\n\t\t\t\t<div>\n\t\t\t\t\t<label for="facto-catalog-protocol">Protocol</label>\n\t\t\t\t\t<select id="facto-catalog-protocol">\n\t\t\t\t\t\t<option value="HTTPS">HTTPS</option>\n\t\t\t\t\t\t<option value="HTTP">HTTP</option>\n\t\t\t\t\t\t<option value="FTP">FTP</option>\n\t\t\t\t\t\t<option value="SFTP">SFTP</option>\n\t\t\t\t\t\t<option value="Local">Local</option>\n\t\t\t\t\t</select>\n\t\t\t\t</div>\n\t\t\t\t<div>\n\t\t\t\t\t<label for="facto-catalog-category">Category</label>\n\t\t\t\t\t<input type="text" id="facto-catalog-category" placeholder="e.g. Science, Finance">\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t\t<div class="inline-group">\n\t\t\t\t<div>\n\t\t\t\t\t<label for="facto-catalog-url">Base URL</label>\n\t\t\t\t\t<input type="text" id="facto-catalog-url" placeholder="https://api.example.gov">\n\t\t\t\t</div>\n\t\t\t\t<div>\n\t\t\t\t\t<label for="facto-catalog-region">Region</label>\n\t\t\t\t\t<input type="text" id="facto-catalog-region" placeholder="e.g. US, Global">\n\t\t\t\t</div>\n\t\t\t\t<div>\n\t\t\t\t\t<label for="facto-catalog-frequency">Update Frequency</label>\n\t\t\t\t\t<select id="facto-catalog-frequency">\n\t\t\t\t\t\t<option value="Continuous">Continuous</option>\n\t\t\t\t\t\t<option value="Daily">Daily</option>\n\t\t\t\t\t\t<option value="Weekly">Weekly</option>\n\t\t\t\t\t\t<option value="Monthly">Monthly</option>\n\t\t\t\t\t\t<option value="Quarterly">Quarterly</option>\n\t\t\t\t\t\t<option value="Yearly">Yearly</option>\n\t\t\t\t\t\t<option value="Unknown">Unknown</option>\n\t\t\t\t\t</select>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t\t<div>\n\t\t\t\t<label for="facto-catalog-description">Description</label>\n\t\t\t\t<input type="text" id="facto-catalog-description" placeholder="Brief description of this data source">\n\t\t\t</div>\n\t\t\t<button class="primary" onclick="pict.views[\'Facto-Catalog\'].addEntry()">Add Catalog Entry</button>\n\n\t\t\t\x3c!-- Import / Export --\x3e\n\t\t\t<h3 style="margin-top:16px; margin-bottom:8px; font-size:1em; color:#444;">Import / Export</h3>\n\t\t\t<textarea id="facto-catalog-import-json" rows="4" style="width:100%; font-family:monospace; font-size:0.85em; padding:8px; border:1px solid #ccc; border-radius:4px; margin-bottom:8px;" placeholder="Paste JSON array of catalog entries here..."></textarea>\n\t\t\t<button class="primary" onclick="pict.views[\'Facto-Catalog\'].importCatalog()">Import JSON</button>\n\t\t\t<button class="secondary" onclick="pict.views[\'Facto-Catalog\'].exportCatalog()">Export Catalog</button>\n\n\t\t</div>\n\t</div>\n</div>\n'}],Renderables:[{RenderableHash:"Facto-Catalog",TemplateHash:"Facto-Catalog",DestinationAddress:"#Facto-Section-Catalog"}]}},{"pict-view":41}],80:[function(t,e,o){const i=t("pict-view");e.exports=class extends i{constructor(t,e,o){super(t,e,o)}onAfterRender(){this.pict.providers.Facto.loadDatasets().then(()=>{this.refreshList()}).catch(t=>{this.pict.views["Pict-Section-Modal"].toast("Error loading datasets: "+t.message,{type:"error"})})}refreshList(){let t=document.getElementById("facto-datasets-list");if(!t)return;let e=this.pict.AppData.Facto.Datasets;if(!e||0===e.length)return void(t.innerHTML='<p style="color:#888; font-style:italic;">No datasets created yet.</p>');let o={Raw:"badge-raw",Compositional:"badge-compositional",Projection:"badge-projection",Derived:"badge-derived"},i="<table><thead><tr><th>ID</th><th>Name</th><th>Type</th><th>Description</th><th>Actions</th></tr></thead><tbody>";for(let t=0;t<e.length;t++){let n=e[t],a=o[n.Type]||"badge-raw";i+="<tr>",i+="<td>"+(n.IDDataset||"")+"</td>",i+="<td>"+(n.Name||"")+"</td>",i+='<td><span class="badge '+a+'">'+(n.Type||"")+"</span></td>",i+='<td style="max-width:300px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap;">'+(n.Description||"")+"</td>",i+='<td><button class="secondary" style="padding:4px 8px; font-size:0.8em;" onclick="pict.views[\'Facto-Datasets\'].viewStats('+n.IDDataset+')">Stats</button></td>',i+="</tr>"}i+="</tbody></table>",t.innerHTML=i}viewStats(t){this.pict.providers.Facto.loadDatasetStats(t).then(e=>{let o="Dataset: "+(e.Dataset?e.Dataset.Name:"#"+t);o+=" | Records: "+(e.RecordCount||0),o+=" | Linked Sources: "+(e.SourceCount||0),this.pict.views["Pict-Section-Modal"].toast(o,{type:"info"})}).catch(t=>{this.pict.views["Pict-Section-Modal"].toast("Error: "+t.message,{type:"error"})})}addDataset(){let t=this.pict.providers.FactoUI.getVal("facto-dataset-name"),e=this.pict.providers.FactoUI.getVal("facto-dataset-type")||"Raw",o=this.pict.providers.FactoUI.getVal("facto-dataset-desc");t?this.pict.providers.Facto.createDataset({Name:t,Type:e,Description:o}).then(t=>{if(t&&t.IDDataset)return this.pict.views["Pict-Section-Modal"].toast("Dataset created: "+t.Name,{type:"success"}),document.getElementById("facto-dataset-name")&&(document.getElementById("facto-dataset-name").value=""),document.getElementById("facto-dataset-desc")&&(document.getElementById("facto-dataset-desc").value=""),this.pict.providers.Facto.loadDatasets();this.pict.views["Pict-Section-Modal"].toast("Error creating dataset",{type:"error"})}).then(()=>{this.refreshList()}).catch(t=>{this.pict.views["Pict-Section-Modal"].toast("Error: "+t.message,{type:"error"})}):this.pict.views["Pict-Section-Modal"].toast("Name is required",{type:"warning"})}},e.exports.default_configuration={ViewIdentifier:"Facto-Datasets",DefaultRenderable:"Facto-Datasets",DefaultDestinationAddress:"#Facto-Section-Datasets",Templates:[{Hash:"Facto-Datasets",Template:'\n<div class="accordion-row">\n\t<div class="accordion-number">2</div>\n\t<div class="accordion-card open" id="facto-card-datasets">\n\t\t<div class="accordion-header" onclick="pict.views[\'Facto-Layout\'].toggleSection(\'facto-card-datasets\')">\n\t\t\t<span class="accordion-title">Datasets</span>\n\t\t\t<span class="accordion-preview">Raw, Compositional, Projection, Derived</span>\n\t\t\t<span class="accordion-toggle">▼</span>\n\t\t</div>\n\t\t<div class="accordion-body">\n\t\t\t<p style="margin-bottom:12px; color:#666; font-size:0.9em;">Datasets are named collections of records. Types: Raw (ingested), Compositional (merged), Projection (flattened), Derived (computed).</p>\n\t\t\t<div id="facto-datasets-list"></div>\n\n\t\t\t<h3 style="margin-top:16px; margin-bottom:8px; font-size:1em; color:#444;">Create Dataset</h3>\n\t\t\t<div class="inline-group">\n\t\t\t\t<div>\n\t\t\t\t\t<label for="facto-dataset-name">Name</label>\n\t\t\t\t\t<input type="text" id="facto-dataset-name" placeholder="e.g. Census Population 2020">\n\t\t\t\t</div>\n\t\t\t\t<div>\n\t\t\t\t\t<label for="facto-dataset-type">Type</label>\n\t\t\t\t\t<select id="facto-dataset-type">\n\t\t\t\t\t\t<option value="Raw">Raw</option>\n\t\t\t\t\t\t<option value="Compositional">Compositional</option>\n\t\t\t\t\t\t<option value="Projection">Projection</option>\n\t\t\t\t\t\t<option value="Derived">Derived</option>\n\t\t\t\t\t</select>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t\t<div>\n\t\t\t\t<label for="facto-dataset-desc">Description</label>\n\t\t\t\t<input type="text" id="facto-dataset-desc" placeholder="Brief description of the dataset">\n\t\t\t</div>\n\t\t\t<button class="primary" onclick="pict.views[\'Facto-Datasets\'].addDataset()">Create Dataset</button>\n\n\t\t</div>\n\t</div>\n</div>\n'}],Renderables:[{RenderableHash:"Facto-Datasets",TemplateHash:"Facto-Datasets",DestinationAddress:"#Facto-Section-Datasets"}]}},{"pict-view":41}],81:[function(t,e,o){const i=t("pict-view");e.exports=class extends i{constructor(t,e,o){super(t,e,o)}onAfterRender(){this.pict.providers.Facto.loadIngestJobs().then(()=>{this.refreshList()}).catch(t=>{this.pict.views["Pict-Section-Modal"].toast("Error loading jobs: "+t.message,{type:"error"})})}refreshList(){let t=document.getElementById("facto-ingest-list");if(!t)return;let e=this.pict.AppData.Facto.IngestJobs;if(!e||0===e.length)return void(t.innerHTML='<p style="color:#888; font-style:italic;">No ingest jobs yet.</p>');let o={Pending:"#ffc107",Running:"#17a2b8",Completed:"#28a745",Failed:"#dc3545",Cancelled:"#6c757d"},i="<table><thead><tr><th>ID</th><th>Status</th><th>Source</th><th>Dataset</th><th>Processed</th><th>Created</th><th>Errors</th><th>Start</th><th>Actions</th></tr></thead><tbody>";for(let t=0;t<e.length;t++){let n=e[t],a=o[n.Status]||"#888";i+="<tr>",i+="<td>"+(n.IDIngestJob||"")+"</td>",i+='<td><span style="color:'+a+'; font-weight:600;">'+(n.Status||"")+"</span></td>",i+="<td>"+(n.IDSource||"")+"</td>",i+="<td>"+(n.IDDataset||"")+"</td>",i+="<td>"+(n.RecordsProcessed||0)+"</td>",i+="<td>"+(n.RecordsCreated||0)+"</td>",i+="<td>"+(n.RecordsErrored||0)+"</td>",i+="<td>"+(n.StartDate||"-")+"</td>",i+="<td>","Pending"===n.Status&&(i+='<button class="success" style="padding:4px 8px; font-size:0.8em;" onclick="pict.views[\'Facto-Ingest\'].startJob('+n.IDIngestJob+')">Start</button>'),i+='<button class="secondary" style="padding:4px 8px; font-size:0.8em;" onclick="pict.views[\'Facto-Ingest\'].viewLog('+n.IDIngestJob+')">Log</button>',i+="</td>",i+="</tr>"}i+="</tbody></table>",t.innerHTML=i}startJob(t){this.pict.providers.Facto.startIngestJob(t).then(()=>(this.pict.views["Pict-Section-Modal"].toast("Job #"+t+" started",{type:"success"}),this.pict.providers.Facto.loadIngestJobs())).then(()=>{this.refreshList()}).catch(t=>{this.pict.views["Pict-Section-Modal"].toast("Error: "+t.message,{type:"error"})})}viewLog(t){this.pict.providers.Facto.loadIngestJobDetails(t).then(e=>{if(e&&e.Job){let o=e.Job.Log||"(empty)",i=document.getElementById("facto-ingest-log");i&&(i.textContent="Job #"+t+" Log:\n"+o,i.style.display="block")}}).catch(t=>{this.pict.views["Pict-Section-Modal"].toast("Error: "+t.message,{type:"error"})})}ingestPastedContent(){let t=parseInt(this.pict.providers.FactoUI.getVal("facto-ingest-paste-dataset"),10)||0,e=parseInt(this.pict.providers.FactoUI.getVal("facto-ingest-paste-source"),10)||0,o=this.pict.providers.FactoUI.getVal("facto-ingest-paste-format")||"Auto",i=this.pict.providers.FactoUI.getVal("facto-ingest-paste-type")||"data",n=this.pict.providers.FactoUI.getVal("facto-ingest-paste-content");n.trim()?(this.pict.views["Pict-Section-Modal"].toast("Ingesting...",{type:"info"}),this.pict.providers.Facto.ingestFileContent(t,e,n,o,i).then(t=>{t&&t.Success?(this.pict.views["Pict-Section-Modal"].toast("Ingested "+(t.RecordsCreated||0)+" records",{type:"success"}),document.getElementById("facto-ingest-paste-content")&&(document.getElementById("facto-ingest-paste-content").value="")):this.pict.views["Pict-Section-Modal"].toast("Ingest error: "+(t&&t.Error||"Unknown"),{type:"error"})}).catch(t=>{this.pict.views["Pict-Section-Modal"].toast("Error: "+t.message,{type:"error"})})):this.pict.views["Pict-Section-Modal"].toast("Content is required",{type:"warning"})}createJob(){let t=parseInt(this.pict.providers.FactoUI.getVal("facto-ingest-source"),10)||0,e=parseInt(this.pict.providers.FactoUI.getVal("facto-ingest-dataset"),10)||0;t&&e?this.pict.providers.Facto.createIngestJob(t,e).then(t=>{if(t&&t.Success)return this.pict.views["Pict-Section-Modal"].toast("Ingest job created: #"+t.Job.IDIngestJob,{type:"success"}),document.getElementById("facto-ingest-source")&&(document.getElementById("facto-ingest-source").value=""),document.getElementById("facto-ingest-dataset")&&(document.getElementById("facto-ingest-dataset").value=""),this.pict.providers.Facto.loadIngestJobs();this.pict.views["Pict-Section-Modal"].toast("Error creating job",{type:"error"})}).then(()=>{this.refreshList()}).catch(t=>{this.pict.views["Pict-Section-Modal"].toast("Error: "+t.message,{type:"error"})}):this.pict.views["Pict-Section-Modal"].toast("Source ID and Dataset ID are required",{type:"warning"})}},e.exports.default_configuration={ViewIdentifier:"Facto-Ingest",DefaultRenderable:"Facto-Ingest",DefaultDestinationAddress:"#Facto-Section-Ingest",Templates:[{Hash:"Facto-Ingest",Template:'\n<div class="accordion-row">\n\t<div class="accordion-number">4</div>\n\t<div class="accordion-card" id="facto-card-ingest">\n\t\t<div class="accordion-header" onclick="pict.views[\'Facto-Layout\'].toggleSection(\'facto-card-ingest\')">\n\t\t\t<span class="accordion-title">Ingest Jobs</span>\n\t\t\t<span class="accordion-preview">Download, parse, and store datasets</span>\n\t\t\t<span class="accordion-toggle">▼</span>\n\t\t</div>\n\t\t<div class="accordion-body">\n\t\t\t<p style="margin-bottom:12px; color:#666; font-size:0.9em;">Track data ingest operations from configured sources into datasets.</p>\n\t\t\t<div id="facto-ingest-list"></div>\n\n\t\t\t<h3 style="margin-top:16px; margin-bottom:8px; font-size:1em; color:#444;">Create Ingest Job</h3>\n\t\t\t<div class="inline-group">\n\t\t\t\t<div>\n\t\t\t\t\t<label for="facto-ingest-source">Source ID</label>\n\t\t\t\t\t<input type="number" id="facto-ingest-source" placeholder="1">\n\t\t\t\t</div>\n\t\t\t\t<div>\n\t\t\t\t\t<label for="facto-ingest-dataset">Dataset ID</label>\n\t\t\t\t\t<input type="number" id="facto-ingest-dataset" placeholder="1">\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t\t<button class="primary" onclick="pict.views[\'Facto-Ingest\'].createJob()">Create Job</button>\n\n\t\t\t<pre id="facto-ingest-log" style="display:none; margin-top:12px; padding:12px; background:#f8f9fa; border:1px solid #e9ecef; border-radius:4px; font-size:0.85em; max-height:200px; overflow:auto; white-space:pre-wrap;"></pre>\n\n\t\t\t<h3 style="margin-top:20px; margin-bottom:8px; font-size:1em; color:#444;">Paste & Ingest</h3>\n\t\t\t<p style="margin-bottom:8px; color:#666; font-size:0.85em;">Paste CSV or JSON content directly to ingest records.</p>\n\t\t\t<div class="inline-group">\n\t\t\t\t<div>\n\t\t\t\t\t<label for="facto-ingest-paste-dataset">Dataset ID</label>\n\t\t\t\t\t<input type="number" id="facto-ingest-paste-dataset" placeholder="1">\n\t\t\t\t</div>\n\t\t\t\t<div>\n\t\t\t\t\t<label for="facto-ingest-paste-source">Source ID</label>\n\t\t\t\t\t<input type="number" id="facto-ingest-paste-source" placeholder="1">\n\t\t\t\t</div>\n\t\t\t\t<div>\n\t\t\t\t\t<label for="facto-ingest-paste-format">Format</label>\n\t\t\t\t\t<select id="facto-ingest-paste-format">\n\t\t\t\t\t\t<option value="Auto">Auto-Detect</option>\n\t\t\t\t\t\t<option value="CSV">CSV</option>\n\t\t\t\t\t\t<option value="JSON">JSON</option>\n\t\t\t\t\t</select>\n\t\t\t\t</div>\n\t\t\t\t<div>\n\t\t\t\t\t<label for="facto-ingest-paste-type">Record Type</label>\n\t\t\t\t\t<input type="text" id="facto-ingest-paste-type" placeholder="data">\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t\t<textarea id="facto-ingest-paste-content" rows="6" style="width:100%; padding:8px 12px; border:1px solid #ccc; border-radius:4px; font-size:0.9em; font-family:monospace; margin-bottom:10px;" placeholder="Paste CSV or JSON data here..."></textarea>\n\t\t\t<button class="primary" onclick="pict.views[\'Facto-Ingest\'].ingestPastedContent()">Ingest</button>\n\n\t\t</div>\n\t</div>\n</div>\n'}],Renderables:[{RenderableHash:"Facto-Ingest",TemplateHash:"Facto-Ingest",DestinationAddress:"#Facto-Section-Ingest"}]}},{"pict-view":41}],82:[function(t,e,o){const i=t("pict-view");e.exports=class extends i{constructor(t,e,o){super(t,e,o)}onAfterRender(){this.pict.views["Facto-Throughput"]&&this.pict.views["Facto-Throughput"].render(),this.pict.views["Facto-Scanner"].render(),this.pict.views["Facto-Catalog"].render(),this.pict.views["Facto-Sources"].render(),this.pict.views["Facto-Datasets"].render(),this.pict.views["Facto-Records"].render(),this.pict.views["Facto-Ingest"].render(),this.pict.views["Facto-Projections"].render(),this.pict.CSSMap.injectCSS()}toggleSection(t){let e=document.getElementById(t);e&&e.classList.toggle("open")}expandAllSections(){let t=document.querySelectorAll(".accordion-card");for(let e=0;e<t.length;e++)t[e].classList.add("open")}collapseAllSections(){let t=document.querySelectorAll(".accordion-card");for(let e=0;e<t.length;e++)t[e].classList.remove("open")}},e.exports.default_configuration={ViewIdentifier:"Facto-Layout",DefaultRenderable:"Facto-Layout",DefaultDestinationAddress:"#Facto-Application-Container",CSS:'\n* { box-sizing: border-box; margin: 0; padding: 0; }\nbody { font-family: -apple-system, BlinkMacSystemFont, \'Segoe UI\', Roboto, sans-serif; background: #f5f5f5; color: #333; padding: 20px; }\nh1 { margin-bottom: 20px; color: #1a1a1a; }\nh2 { margin-bottom: 12px; color: #444; font-size: 1.2em; border-bottom: 2px solid #ddd; padding-bottom: 6px; }\n\n.section { background: #fff; border-radius: 8px; padding: 20px; margin-bottom: 16px; box-shadow: 0 1px 3px rgba(0,0,0,0.1); }\n\n/* Accordion layout */\n.accordion-row { display: flex; gap: 0; margin-bottom: 16px; align-items: stretch; }\n.accordion-number {\n\tflex: 0 0 48px; display: flex; align-items: flex-start; justify-content: center;\n\tpadding-top: 16px; font-size: 1.6em; font-weight: 700; color: #4a90d9;\n\tuser-select: none;\n}\n.accordion-card {\n\tflex: 1; background: #fff; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,0.1);\n\toverflow: hidden; min-width: 0;\n}\n.accordion-header {\n\tdisplay: flex; align-items: center; padding: 14px 20px; cursor: pointer;\n\tuser-select: none; gap: 12px; transition: background 0.15s; line-height: 1.4;\n}\n.accordion-header:hover { background: #fafafa; }\n.accordion-title { font-weight: 600; color: #333; font-size: 1.05em; white-space: nowrap; }\n.accordion-preview { flex: 1; font-style: italic; color: #888; font-size: 0.9em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }\n.accordion-toggle {\n\tflex: 0 0 20px; display: flex; align-items: center; justify-content: center;\n\tborder-radius: 4px; transition: background 0.15s, transform 0.25s; font-size: 0.7em; color: #888;\n}\n.accordion-header:hover .accordion-toggle { background: #eee; color: #555; }\n.accordion-card.open .accordion-toggle { transform: rotate(180deg); }\n.accordion-body { padding: 0 20px 20px; display: none; }\n.accordion-card.open .accordion-body { display: block; }\n.accordion-card.open .accordion-header { border-bottom: 1px solid #eee; }\n.accordion-card.open .accordion-preview { display: none; }\n\n.accordion-controls {\n\tdisplay: flex; gap: 8px; margin-bottom: 12px; justify-content: flex-end;\n}\n.accordion-controls button {\n\tpadding: 4px 10px; font-size: 0.82em; font-weight: 500; background: none;\n\tborder: 1px solid #ccc; border-radius: 4px; color: #666; cursor: pointer; margin: 0;\n}\n.accordion-controls button:hover { background: #f0f0f0; border-color: #aaa; color: #333; }\n\nlabel { display: block; font-weight: 600; margin-bottom: 4px; font-size: 0.9em; }\ninput[type="text"], input[type="password"], input[type="number"] {\n\twidth: 100%; padding: 8px 12px; border: 1px solid #ccc; border-radius: 4px;\n\tfont-size: 0.95em; margin-bottom: 10px;\n}\ninput[type="text"]:focus, input[type="password"]:focus, input[type="number"]:focus {\n\toutline: none; border-color: #4a90d9;\n}\n\nbutton {\n\tpadding: 8px 16px; border: none; border-radius: 4px; cursor: pointer;\n\tfont-size: 0.9em; font-weight: 600; margin-right: 8px; margin-bottom: 8px;\n}\nbutton.primary { background: #4a90d9; color: #fff; }\nbutton.primary:hover { background: #357abd; }\nbutton.secondary { background: #6c757d; color: #fff; }\nbutton.secondary:hover { background: #5a6268; }\nbutton.danger { background: #dc3545; color: #fff; }\nbutton.danger:hover { background: #c82333; }\nbutton.success { background: #28a745; color: #fff; }\nbutton.success:hover { background: #218838; }\nbutton:disabled { opacity: 0.5; cursor: not-allowed; }\n\n.status { padding: 8px 12px; border-radius: 4px; margin-top: 10px; font-size: 0.9em; }\n.status.ok { background: #d4edda; color: #155724; }\n.status.error { background: #f8d7da; color: #721c24; }\n.status.info { background: #d1ecf1; color: #0c5460; }\n.status.warn { background: #fff3cd; color: #856404; }\n\n.inline-group { display: flex; gap: 8px; align-items: flex-end; margin-bottom: 10px; }\n.inline-group > div { flex: 1; }\n\na { color: #4a90d9; }\n\nselect { background: #fff; width: 100%; padding: 8px 12px; border: 1px solid #ccc; border-radius: 4px; font-size: 0.95em; margin-bottom: 10px; }\n\ntable { width: 100%; border-collapse: collapse; font-size: 0.9em; }\nth { text-align: left; font-weight: 600; padding: 8px; border-bottom: 2px solid #ddd; color: #555; }\ntd { padding: 8px; border-bottom: 1px solid #eee; }\ntr:hover { background: #fafafa; }\n\n.badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 0.8em; font-weight: 600; }\n.badge-raw { background: #d1ecf1; color: #0c5460; }\n.badge-compositional { background: #d4edda; color: #155724; }\n.badge-projection { background: #fff3cd; color: #856404; }\n.badge-derived { background: #e2d5f1; color: #4a2d73; }\n\n.certainty-bar { display: inline-block; width: 60px; height: 8px; background: #e9ecef; border-radius: 4px; overflow: hidden; vertical-align: middle; }\n.certainty-fill { height: 100%; border-radius: 4px; }\n.certainty-low { background: #dc3545; }\n.certainty-mid { background: #ffc107; }\n.certainty-high { background: #28a745; }\n',Templates:[{Hash:"Facto-Layout",Template:'\n<h1>Retold Facto</h1>\n<p style="color:#666; margin-bottom:20px; font-size:0.95em;">Data Warehouse & Knowledge Graph Storage</p>\n\n\x3c!-- Expand / Collapse All --\x3e\n<div class="accordion-controls">\n\t<button onclick="pict.views[\'Facto-Layout\'].expandAllSections()">Expand All</button>\n\t<button onclick="pict.views[\'Facto-Layout\'].collapseAllSections()">Collapse All</button>\n</div>\n\n\x3c!-- Section containers --\x3e\n<div id="Facto-Section-Throughput"></div>\n<div id="Facto-Section-Scanner"></div>\n<div id="Facto-Section-Catalog"></div>\n<div id="Facto-Section-Sources"></div>\n<div id="Facto-Section-Datasets"></div>\n<div id="Facto-Section-Records"></div>\n<div id="Facto-Section-Ingest"></div>\n<div id="Facto-Section-Projections"></div>\n'}],Renderables:[{RenderableHash:"Facto-Layout",TemplateHash:"Facto-Layout",DestinationAddress:"#Facto-Application-Container"}]}},{"pict-view":41}],83:[function(t,e,o){const i=t("pict-view");e.exports=class extends i{constructor(t,e,o){super(t,e,o)}onAfterRender(){this.loadSummary()}loadSummary(){this.pict.providers.Facto.loadProjectionSummary().then(t=>{let e=document.getElementById("facto-projections-summary");if(!e||!t)return;let o="<table><tbody>";o+='<tr><td style="font-weight:600;">Sources</td><td>'+(t.Sources||0)+"</td>",o+='<td style="font-weight:600;">Datasets</td><td>'+(t.Datasets||0)+"</td></tr>",o+='<tr><td style="font-weight:600;">Records</td><td>'+(t.Records||0)+"</td>",o+='<td style="font-weight:600;">Certainty Indices</td><td>'+(t.CertaintyIndices||0)+"</td></tr>",o+='<tr><td style="font-weight:600;">Ingest Jobs</td><td>'+(t.IngestJobs||0)+"</td>",o+="<td></td><td></td></tr>",t.DatasetsByType&&(o+='<tr><td colspan="4" style="padding-top:12px; font-weight:600; border-bottom:2px solid #ddd;">Datasets by Type</td></tr>',o+="<tr>",o+='<td><span class="badge badge-raw">Raw</span></td><td>'+(t.DatasetsByType.Raw||0)+"</td>",o+='<td><span class="badge badge-compositional">Compositional</span></td><td>'+(t.DatasetsByType.Compositional||0)+"</td>",o+="</tr><tr>",o+='<td><span class="badge badge-projection">Projection</span></td><td>'+(t.DatasetsByType.Projection||0)+"</td>",o+='<td><span class="badge badge-derived">Derived</span></td><td>'+(t.DatasetsByType.Derived||0)+"</td>",o+="</tr>"),o+="</tbody></table>",e.innerHTML=o}).catch(t=>{this.pict.views["Pict-Section-Modal"].toast("Error loading summary: "+t.message,{type:"error"})})}runQuery(){let t=this.pict.providers.FactoUI.getVal("facto-proj-dataset-ids"),e=this.pict.providers.FactoUI.getVal("facto-proj-type"),o=parseFloat(this.pict.providers.FactoUI.getVal("facto-proj-certainty"))||0,i=this.pict.providers.FactoUI.getVal("facto-proj-time-start"),n=this.pict.providers.FactoUI.getVal("facto-proj-time-stop"),a=t.split(",").map(function(t){return parseInt(t.trim(),10)}).filter(function(t){return!isNaN(t)&&t>0});if(0===a.length)return void this.pict.views["Pict-Section-Modal"].toast("Enter at least one Dataset ID",{type:"warning"});let r={DatasetIDs:a,Begin:0,Cap:100};e&&(r.Type=e),o>0&&(r.CertaintyThreshold=o),i&&(r.TimeRangeStart=parseInt(i,10)||0),n&&(r.TimeRangeStop=parseInt(n,10)||0),this.pict.views["Pict-Section-Modal"].toast("Querying...",{type:"info"}),this.pict.providers.Facto.queryRecords(r).then(t=>{this.refreshResults(t)}).catch(t=>{this.pict.views["Pict-Section-Modal"].toast("Query error: "+t.message,{type:"error"})})}runCompare(){let t=this.pict.providers.FactoUI.getVal("facto-proj-dataset-ids").split(",").map(function(t){return parseInt(t.trim(),10)}).filter(function(t){return!isNaN(t)&&t>0});0!==t.length?(this.pict.views["Pict-Section-Modal"].toast("Comparing...",{type:"info"}),this.pict.providers.Facto.compareDatasets(t).then(t=>{let e=document.getElementById("facto-projections-results");if(!e||!t||!t.Datasets)return;let o='<h4 style="margin:12px 0 8px; font-size:0.95em;">Dataset Comparison</h4>';o+="<table><thead><tr><th>ID</th><th>Name</th><th>Type</th><th>Records</th><th>Sources</th></tr></thead><tbody>";for(let e=0;e<t.Datasets.length;e++){let i=t.Datasets[e],n=(i.Type||"").toLowerCase();o+="<tr>",o+="<td>"+(i.IDDataset||"")+"</td>",o+="<td>"+(i.Name||"")+"</td>",o+='<td><span class="badge badge-'+n+'">'+(i.Type||"")+"</span></td>",o+="<td>"+(i.RecordCount||0)+"</td>",o+="<td>"+(i.SourceCount||0)+"</td>",o+="</tr>"}o+="</tbody></table>",e.innerHTML=o}).catch(t=>{this.pict.views["Pict-Section-Modal"].toast("Compare error: "+t.message,{type:"error"})})):this.pict.views["Pict-Section-Modal"].toast("Enter at least one Dataset ID",{type:"warning"})}refreshResults(t){let e=document.getElementById("facto-projections-results");if(!e)return;if(!t||!t.Records||0===t.Records.length)return void(e.innerHTML='<p style="color:#888; font-style:italic;">No records match the query.</p>');let o='<h4 style="margin:12px 0 8px; font-size:0.95em;">Query Results ('+(t.Count||t.Records.length)+" records)</h4>";o+="<table><thead><tr><th>ID</th><th>Dataset</th><th>Source</th><th>Type</th><th>Version</th><th>Ingest Date</th><th>Content</th></tr></thead><tbody>";for(let e=0;e<t.Records.length;e++){let i=t.Records[e],n=i.Content||"";n.length>80&&(n=n.substring(0,80)+"..."),o+="<tr>",o+="<td>"+(i.IDRecord||"")+"</td>",o+="<td>"+(i.IDDataset||"")+"</td>",o+="<td>"+(i.IDSource||"")+"</td>",o+="<td>"+(i.Type||"")+"</td>",o+="<td>"+(i.Version||1)+"</td>",o+="<td>"+(i.IngestDate||"-")+"</td>",o+='<td style="max-width:200px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap;">'+n+"</td>",o+="</tr>"}o+="</tbody></table>",e.innerHTML=o}},e.exports.default_configuration={ViewIdentifier:"Facto-Projections",DefaultRenderable:"Facto-Projections",DefaultDestinationAddress:"#Facto-Section-Projections",Templates:[{Hash:"Facto-Projections",Template:'\n<div class="accordion-row">\n\t<div class="accordion-number">5</div>\n\t<div class="accordion-card" id="facto-card-projections">\n\t\t<div class="accordion-header" onclick="pict.views[\'Facto-Layout\'].toggleSection(\'facto-card-projections\')">\n\t\t\t<span class="accordion-title">Projections</span>\n\t\t\t<span class="accordion-preview">Cross-dataset queries and warehouse statistics</span>\n\t\t\t<span class="accordion-toggle">▼</span>\n\t\t</div>\n\t\t<div class="accordion-body">\n\t\t\t<p style="margin-bottom:12px; color:#666; font-size:0.9em;">Query across datasets, compare data, and view warehouse-wide statistics.</p>\n\n\t\t\t<h3 style="margin-bottom:8px; font-size:1em; color:#444;">Warehouse Summary</h3>\n\t\t\t<div id="facto-projections-summary" style="margin-bottom:16px;"><p style="color:#888; font-style:italic;">Loading...</p></div>\n\n\t\t\t<h3 style="margin-top:16px; margin-bottom:8px; font-size:1em; color:#444;">Cross-Dataset Query</h3>\n\t\t\t<div class="inline-group">\n\t\t\t\t<div>\n\t\t\t\t\t<label for="facto-proj-dataset-ids">Dataset IDs (comma-separated)</label>\n\t\t\t\t\t<input type="text" id="facto-proj-dataset-ids" placeholder="1,2,3">\n\t\t\t\t</div>\n\t\t\t\t<div>\n\t\t\t\t\t<label for="facto-proj-type">Record Type (optional)</label>\n\t\t\t\t\t<input type="text" id="facto-proj-type" placeholder="e.g. enrollment">\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t\t<div class="inline-group">\n\t\t\t\t<div>\n\t\t\t\t\t<label for="facto-proj-certainty">Min Certainty (0-1)</label>\n\t\t\t\t\t<input type="text" id="facto-proj-certainty" placeholder="0.0">\n\t\t\t\t</div>\n\t\t\t\t<div>\n\t\t\t\t\t<label for="facto-proj-time-start">Time Range Start</label>\n\t\t\t\t\t<input type="text" id="facto-proj-time-start" placeholder="timestamp">\n\t\t\t\t</div>\n\t\t\t\t<div>\n\t\t\t\t\t<label for="facto-proj-time-stop">Time Range Stop</label>\n\t\t\t\t\t<input type="text" id="facto-proj-time-stop" placeholder="timestamp">\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t\t<button class="primary" onclick="pict.views[\'Facto-Projections\'].runQuery()">Query</button>\n\t\t\t<button class="secondary" onclick="pict.views[\'Facto-Projections\'].runCompare()">Compare Datasets</button>\n\t\t\t<button class="secondary" onclick="pict.views[\'Facto-Projections\'].loadSummary()">Refresh Summary</button>\n\n\t\t\t<div id="facto-projections-results" style="margin-top:16px;"></div>\n\t\t</div>\n\t</div>\n</div>\n'}],Renderables:[{RenderableHash:"Facto-Projections",TemplateHash:"Facto-Projections",DestinationAddress:"#Facto-Section-Projections"}]}},{"pict-view":41}],84:[function(t,e,o){const i=t("pict-view");e.exports=class extends i{constructor(t,e,o){super(t,e,o)}onAfterRender(){this.pict.providers.Facto.loadRecords(0).then(()=>{this.refreshList()}).catch(t=>{this.pict.views["Pict-Section-Modal"].toast("Error loading records: "+t.message,{type:"error"})})}refreshList(){let t=document.getElementById("facto-records-list");if(!t)return;let e=this.pict.AppData.Facto.Records;if(!e||0===e.length)return void(t.innerHTML='<p style="color:#888; font-style:italic;">No records ingested yet.</p>');let o="<table><thead><tr><th>ID</th><th>Type</th><th>Dataset</th><th>Source</th><th>Version</th><th>Ingest Date</th><th>Content Preview</th><th>Actions</th></tr></thead><tbody>";for(let t=0;t<e.length;t++){let i=e[t],n=(i.Content||"").substring(0,60);(i.Content||"").length>60&&(n+="..."),o+="<tr>",o+="<td>"+(i.IDRecord||"")+"</td>",o+="<td>"+(i.Type||"")+"</td>",o+="<td>"+(i.IDDataset||"")+"</td>",o+="<td>"+(i.IDSource||"")+"</td>",o+="<td>"+(i.Version||"1")+"</td>",o+="<td>"+(i.IngestDate||"")+"</td>",o+='<td style="max-width:250px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-family:monospace; font-size:0.85em;">'+n+"</td>",o+='<td><button class="secondary" style="padding:4px 8px; font-size:0.8em;" onclick="pict.views[\'Facto-Records\'].viewCertainty('+i.IDRecord+')">Certainty</button></td>',o+="</tr>"}o+="</tbody></table>";let i=this.pict.AppData.Facto.RecordPage||0;o+='<div style="margin-top:12px; display:flex; gap:8px; align-items:center;">',i>0&&(o+='<button class="secondary" style="padding:4px 12px; font-size:0.85em;" onclick="pict.views[\'Facto-Records\'].changePage('+(i-1)+')">◀ Previous</button>'),o+='<span style="color:#888; font-size:0.85em;">Page '+(i+1)+"</span>",e.length>=this.pict.AppData.Facto.RecordPageSize&&(o+='<button class="secondary" style="padding:4px 12px; font-size:0.85em;" onclick="pict.views[\'Facto-Records\'].changePage('+(i+1)+')">Next ▶</button>'),o+="</div>",t.innerHTML=o}changePage(t){this.pict.AppData.Facto.RecordPage=t,this.pict.providers.Facto.loadRecords(t).then(()=>{this.refreshList()}).catch(t=>{this.pict.views["Pict-Section-Modal"].toast("Error: "+t.message,{type:"error"})})}viewCertainty(t){this.pict.providers.Facto.loadRecordCertainty(t).then(e=>{let o=document.getElementById("facto-certainty-panel");if(!e||!e.CertaintyIndices||0===e.CertaintyIndices.length)return void(o?o.innerHTML=this._renderCertaintyEmpty(t):this.pict.views["Pict-Section-Modal"].toast("No certainty data for record #"+t,{type:"info"}));let i=this._renderCertaintyPanel(t,e.CertaintyIndices);if(o)o.innerHTML=i,o.style.display="block";else{let t=document.getElementById("facto-records-list");if(t){let e=document.createElement("div");e.id="facto-certainty-panel",e.innerHTML=i,t.parentNode.insertBefore(e,t.nextSibling)}}}).catch(t=>{this.pict.views["Pict-Section-Modal"].toast("Error: "+t.message,{type:"error"})})}closeCertaintyPanel(){let t=document.getElementById("facto-certainty-panel");t&&(t.style.display="none")}_renderCertaintyEmpty(t){return`\n\t\t\t<div style="border:1px solid var(--facto-border); border-radius:6px; padding:16px; margin-top:16px; background:var(--facto-bg-surface);">\n\t\t\t\t<div style="display:flex; justify-content:space-between; align-items:center; margin-bottom:8px;">\n\t\t\t\t\t<h4 style="margin:0; color:var(--facto-text-heading);">Certainty — Record #${t}</h4>\n\t\t\t\t\t<button class="secondary" style="padding:2px 10px; font-size:0.8em;" onclick="pict.views['Facto-Records'].closeCertaintyPanel()">Close</button>\n\t\t\t\t</div>\n\t\t\t\t<p style="color:var(--facto-text-secondary); font-style:italic; margin:0;">No certainty indices recorded for this record. Run a multi-set projection merge to generate field-level certainty scores.</p>\n\t\t\t</div>`}_renderCertaintyPanel(t,e){let o={};for(let t=0;t<e.length;t++){let i=e[t],n=(i.Dimension||"").match(/^field:(.+):(presence|ratio|composite)$/);if(n){let t=n[1],e=n[2];if(o[t]||(o[t]={presence:0,ratio:0,composite:0,justification:null}),o[t][e]=i.CertaintyValue,i.Justification&&!o[t].justification)try{o[t].justification=JSON.parse(i.Justification)}catch(t){}}}let i=Object.keys(o);if(0===i.length)return this._renderCertaintyRaw(t,e);let n=0;for(let t=0;t<i.length;t++)n+=o[i[t]].composite;let a=i.length>0?n/i.length:.5,r=`\n\t\t\t<div style="border:1px solid var(--facto-border); border-radius:6px; padding:16px; margin-top:16px; background:var(--facto-bg-surface);">\n\t\t\t\t<div style="display:flex; justify-content:space-between; align-items:center; margin-bottom:12px;">\n\t\t\t\t\t<h4 style="margin:0; color:var(--facto-text-heading);">Certainty — Record #${t}</h4>\n\t\t\t\t\t<button class="secondary" style="padding:2px 10px; font-size:0.8em;" onclick="pict.views['Facto-Records'].closeCertaintyPanel()">Close</button>\n\t\t\t\t</div>\n\t\t\t\t<div style="display:flex; align-items:center; gap:12px; margin-bottom:16px; padding:10px; background:var(--facto-bg-elevated); border-radius:4px;">\n\t\t\t\t\t<span style="font-weight:600; color:var(--facto-text-heading);">Record Composite</span>\n\t\t\t\t\t${this._renderBar(a,200)}\n\t\t\t\t\t<span style="font-weight:600; font-size:1.1em; color:${this._certaintyColor(a)};">${(100*a).toFixed(1)}%</span>\n\t\t\t\t</div>\n\t\t\t\t<table style="width:100%; border-collapse:collapse;">\n\t\t\t\t\t<thead>\n\t\t\t\t\t\t<tr style="border-bottom:2px solid var(--facto-border);">\n\t\t\t\t\t\t\t<th style="text-align:left; padding:6px 8px; color:var(--facto-text-heading);">Field</th>\n\t\t\t\t\t\t\t<th style="text-align:left; padding:6px 8px; color:var(--facto-text-heading);">Presence</th>\n\t\t\t\t\t\t\t<th style="text-align:left; padding:6px 8px; color:var(--facto-text-heading);">Ratio</th>\n\t\t\t\t\t\t\t<th style="text-align:left; padding:6px 8px; color:var(--facto-text-heading);">Composite</th>\n\t\t\t\t\t\t\t<th style="text-align:center; padding:6px 8px; color:var(--facto-text-heading);">Sources</th>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</thead>\n\t\t\t\t\t<tbody>`;for(let t=0;t<i.length;t++){let e=i[t],n=o[e],a=n.justification||{},s=(a.agreeing||0)+"✓";a.conflicting>0&&(s+=" "+a.conflicting+"✗"),r+=`\n\t\t\t\t\t\t<tr style="border-bottom:1px solid var(--facto-border-subtle);">\n\t\t\t\t\t\t\t<td style="padding:6px 8px; font-family:monospace; font-size:0.9em; color:var(--facto-text);">${e}</td>\n\t\t\t\t\t\t\t<td style="padding:6px 8px;">${this._renderBar(n.presence,100)} <span style="font-size:0.85em; color:var(--facto-text-secondary);">${(100*n.presence).toFixed(0)}%</span></td>\n\t\t\t\t\t\t\t<td style="padding:6px 8px;">${this._renderBar(n.ratio,100)} <span style="font-size:0.85em; color:var(--facto-text-secondary);">${(100*n.ratio).toFixed(0)}%</span></td>\n\t\t\t\t\t\t\t<td style="padding:6px 8px;">${this._renderBar(n.composite,100)} <span style="font-weight:600; font-size:0.85em; color:${this._certaintyColor(n.composite)};">${(100*n.composite).toFixed(0)}%</span></td>\n\t\t\t\t\t\t\t<td style="padding:6px 8px; text-align:center; font-size:0.85em; color:var(--facto-text-secondary);">${s}</td>\n\t\t\t\t\t\t</tr>`}return r+=`\n\t\t\t\t\t</tbody>\n\t\t\t\t</table>\n\t\t\t\t<div style="margin-top:10px; font-size:0.8em; color:var(--facto-text-tertiary);">\n\t\t\t\t\t<strong>Presence</strong> = cross-dataset corroboration | \n\t\t\t\t\t<strong>Ratio</strong> = within-dataset frequency | \n\t\t\t\t\t<strong>Composite</strong> = weighted (${o[i[0]]&&o[i[0]].justification&&o[i[0]].justification.weights?(100*o[i[0]].justification.weights.presence).toFixed(0)+"/"+(100*o[i[0]].justification.weights.ratio).toFixed(0):"70/30"}) | \n\t\t\t\t\t✓ = agreeing sources ✗ = conflicting sources\n\t\t\t\t</div>\n\t\t\t</div>`,r}_renderCertaintyRaw(t,e){let o=`\n\t\t\t<div style="border:1px solid var(--facto-border); border-radius:6px; padding:16px; margin-top:16px; background:var(--facto-bg-surface);">\n\t\t\t\t<div style="display:flex; justify-content:space-between; align-items:center; margin-bottom:12px;">\n\t\t\t\t\t<h4 style="margin:0; color:var(--facto-text-heading);">Certainty — Record #${t}</h4>\n\t\t\t\t\t<button class="secondary" style="padding:2px 10px; font-size:0.8em;" onclick="pict.views['Facto-Records'].closeCertaintyPanel()">Close</button>\n\t\t\t\t</div>`;for(let t=0;t<e.length;t++){let i=e[t];o+=`\n\t\t\t\t<div style="display:flex; align-items:center; gap:8px; margin-bottom:6px;">\n\t\t\t\t\t<span style="font-family:monospace; font-size:0.85em; min-width:180px; color:var(--facto-text);">${i.Dimension}</span>\n\t\t\t\t\t${this._renderBar(i.CertaintyValue,150)}\n\t\t\t\t\t<span style="font-size:0.85em; font-weight:600; color:${this._certaintyColor(i.CertaintyValue)};">${(100*i.CertaintyValue).toFixed(1)}%</span>\n\t\t\t\t</div>`}return o+="</div>",o}_renderBar(t,e){return'<div style="display:inline-block; width:'+e+'px; height:14px; background:var(--facto-bg-elevated); border-radius:3px; overflow:hidden; vertical-align:middle;"><div style="width:'+100*Math.max(0,Math.min(1,t))+"%; height:100%; background:"+this._certaintyColor(t)+'; border-radius:3px; transition:width 0.3s;"></div></div>'}_certaintyColor(t){return t>=.7?"var(--facto-success)":t>=.4?"var(--facto-warning)":"var(--facto-error)"}},e.exports.default_configuration={ViewIdentifier:"Facto-Records",DefaultRenderable:"Facto-Records",DefaultDestinationAddress:"#Facto-Section-Records",Templates:[{Hash:"Facto-Records",Template:'\n<div class="accordion-row">\n\t<div class="accordion-number">3</div>\n\t<div class="accordion-card" id="facto-card-records">\n\t\t<div class="accordion-header" onclick="pict.views[\'Facto-Layout\'].toggleSection(\'facto-card-records\')">\n\t\t\t<span class="accordion-title">Records</span>\n\t\t\t<span class="accordion-preview">Browse ingested records</span>\n\t\t\t<span class="accordion-toggle">▼</span>\n\t\t</div>\n\t\t<div class="accordion-body">\n\t\t\t<p style="margin-bottom:12px; color:#666; font-size:0.9em;">Individual data records with versioning, certainty indices, and temporal metadata.</p>\n\t\t\t<div id="facto-records-list"></div>\n\t\t</div>\n\t</div>\n</div>\n'}],Renderables:[{RenderableHash:"Facto-Records",TemplateHash:"Facto-Records",DestinationAddress:"#Facto-Section-Records"}]}},{"pict-view":41}],85:[function(t,e,o){const i=t("pict-view");e.exports=class extends i{constructor(t,e,o){super(t,e,o)}onAfterRender(){this.loadScannerState()}loadScannerState(){Promise.all([this.pict.providers.Facto.loadScannerPaths(),this.pict.providers.Facto.loadScannerDatasets()]).then(()=>{this.refreshPathsList(),this.refreshDatasetsList()}).catch(t=>{this.pict.views["Pict-Section-Modal"].toast("Error loading scanner state: "+t.message,{type:"error"})})}refreshPathsList(){let t=document.getElementById("facto-scanner-paths-list");if(!t)return;let e=this.pict.AppData.Facto.ScannerPaths||[];if(0===e.length)return void(t.innerHTML='<p style="color:#888; font-style:italic;">No scan paths configured. Add a folder path to discover datasets.</p>');let o="<table><thead><tr><th>Path</th><th>Datasets</th><th>Last Scanned</th><th>Actions</th></tr></thead><tbody>";for(let t=0;t<e.length;t++){let i=e[t],n=i.LastScannedAt?new Date(i.LastScannedAt).toLocaleString():"Never";o+="<tr>",o+='<td style="font-family:monospace; font-size:0.85em;">'+this.escapeHtml(i.Path)+"</td>",o+="<td>"+(i.DatasetCount||0)+"</td>",o+="<td>"+n+"</td>",o+="<td>",o+='<button class="danger" style="padding:4px 8px; font-size:0.8em;" onclick="pict.views[\'Facto-Scanner\'].removePath(\''+this.escapeAttr(i.Path)+"')\">Remove</button>",o+="</td>",o+="</tr>"}o+="</tbody></table>",t.innerHTML=o}refreshDatasetsList(){let t=document.getElementById("facto-scanner-datasets-list");if(!t)return;let e=this.pict.AppData.Facto.ScannerDatasets||[];if(0===e.length)return t.innerHTML='<p style="color:#888; font-style:italic;">No datasets discovered yet. Add a scan path containing dataset folders with README.md files.</p>',void this.updateSummary(0,0,0,0);let o=0,i=0,n=0;for(let t=0;t<e.length;t++)"Discovered"===e[t].Status&&o++,"Provisioned"===e[t].Status&&i++,"Ingested"===e[t].Status&&0,e[t].HasData&&n++;this.updateSummary(e.length,o,i,n);let a=document.getElementById("facto-scanner-search"),r=a?a.value.toLowerCase():"",s=document.getElementById("facto-scanner-status-filter"),l=s?s.value:"",c=e;r&&(c=c.filter(t=>((t.FolderName||"")+" "+(t.Title||"")+" "+(t.Provider||"")).toLowerCase().indexOf(r)>-1)),l&&(c=c.filter(t=>t.Status===l));let d="<table><thead><tr>";d+='<th><input type="checkbox" id="facto-scanner-select-all" onclick="pict.views[\'Facto-Scanner\'].toggleSelectAll(this.checked)"></th>',d+="<th>Name</th><th>Title</th><th>Provider</th><th>Format</th><th>Data</th><th>Status</th><th>Actions</th>",d+="</tr></thead><tbody>";for(let t=0;t<c.length;t++){let e=c[t],o=this.getStatusBadgeClass(e.Status),i=e.HasData?e.DataFileCount+" file"+(1!==e.DataFileCount?"s":"")+" ("+(e.TotalDataSizeFormatted||"0 B")+")":'<span style="color:#dc3545;">No data</span>',n=e.DataFormat&&e.DataFormat.Format||"unknown";d+="<tr>",d+='<td><input type="checkbox" class="facto-scanner-checkbox" data-folder="'+this.escapeAttr(e.FolderName)+'"></td>',d+='<td style="font-family:monospace; font-size:0.85em;">'+this.escapeHtml(e.FolderName)+"</td>",d+="<td>"+this.escapeHtml((e.Title||"").substring(0,50))+"</td>",d+="<td>"+this.escapeHtml((e.Provider||"").substring(0,30))+"</td>",d+="<td>"+n+"</td>",d+="<td>"+i+"</td>",d+='<td><span class="badge '+o+'">'+e.Status+"</span></td>",d+="<td>";let a=this.escapeAttr(e.FolderName);d+='<div class="facto-row-actions" id="facto-row-actions-'+a+'">',d+="<button class=\"facto-row-actions-trigger\" onclick=\"pict.views['Facto-Scanner'].toggleRowMenu(event, '"+a+'\')" title="Actions">⋮</button>',d+='<div class="facto-row-actions-menu">',d+="<button onclick=\"pict.views['Facto-Scanner'].viewDetail('"+a+"'); pict.views['Facto-Scanner'].closeRowMenus();\">Detail</button>","Discovered"===e.Status&&(d+="<button class=\"facto-action-success\" onclick=\"pict.views['Facto-Scanner'].provisionOne('"+a+"'); pict.views['Facto-Scanner'].closeRowMenus();\">Provision</button>"),d+="</div>",d+="</div>",d+="</td>",d+="</tr>"}d+="</tbody></table>",d+='<p style="color:#888; font-size:0.85em; margin-top:8px;">Showing '+c.length+" of "+e.length+" dataset(s)</p>",t.innerHTML=d}updateSummary(t,e,o,i){let n=document.getElementById("facto-scanner-summary");n&&(n.innerHTML="<strong>"+t+"</strong> discovered | <strong>"+o+"</strong> provisioned | <strong>"+i+"</strong> with data")}getStatusBadgeClass(t){return"Discovered"===t?"badge-raw":"Provisioned"===t?"badge-compositional":"Ingested"===t?"badge-projection":"Error"===t?"badge-derived":""}escapeHtml(t){return t?t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,"""):""}escapeAttr(t){return t?t.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/"/g,"""):""}addPath(){let t=document.getElementById("facto-scanner-path-input"),e=t?t.value.trim():"";e?(this.pict.views["Pict-Section-Modal"].toast("Scanning "+e+"...",{type:"info"}),this.pict.providers.Facto.addScannerPath(e).then(e=>{if(e&&e.Error)return void this.pict.views["Pict-Section-Modal"].toast("Error: "+e.Error,{type:"error"});let o=e.ScanResult||{};this.pict.views["Pict-Section-Modal"].toast("Scanned! Found "+(o.DatasetsFound||0)+" dataset(s) in "+(o.FoldersScanned||0)+" folder(s)",{type:"success"}),t&&(t.value=""),this.loadScannerState()}).catch(t=>{this.pict.views["Pict-Section-Modal"].toast("Error: "+t.message,{type:"error"})})):this.pict.views["Pict-Section-Modal"].toast("Enter a folder path to scan",{type:"warning"})}async removePath(t){await this.pict.views["Pict-Section-Modal"].confirm("Remove scan path and its discovered datasets?\n\n"+t,{title:"Remove Path",confirmLabel:"Remove",dangerous:!0})&&this.pict.providers.Facto.removeScannerPath(t).then(t=>{t&&t.Error?this.pict.views["Pict-Section-Modal"].toast("Error: "+t.Error,{type:"error"}):(this.pict.views["Pict-Section-Modal"].toast("Path removed",{type:"success"}),this.loadScannerState())}).catch(t=>{this.pict.views["Pict-Section-Modal"].toast("Error: "+t.message,{type:"error"})})}rescanAll(){this.pict.views["Pict-Section-Modal"].toast("Re-scanning all paths...",{type:"info"}),this.pict.providers.Facto.rescanPaths().then(t=>{t&&t.Error?this.pict.views["Pict-Section-Modal"].toast("Error: "+t.Error,{type:"error"}):(this.pict.views["Pict-Section-Modal"].toast("Re-scan complete",{type:"success"}),this.loadScannerState())}).catch(t=>{this.pict.views["Pict-Section-Modal"].toast("Error: "+t.message,{type:"error"})})}filterDatasets(){this.refreshDatasetsList()}toggleSelectAll(t){let e=document.querySelectorAll(".facto-scanner-checkbox");for(let o=0;o<e.length;o++)e[o].checked=t}getSelectedFolderNames(){let t=document.querySelectorAll(".facto-scanner-checkbox:checked"),e=[];for(let o=0;o<t.length;o++)e.push(t[o].getAttribute("data-folder"));return e}provisionOne(t){this.pict.views["Pict-Section-Modal"].toast("Provisioning "+t+"...",{type:"info"}),this.pict.providers.Facto.provisionScannerDataset(t).then(e=>{e&&e.Error?this.pict.views["Pict-Section-Modal"].toast("Error: "+e.Error,{type:"error"}):(this.pict.views["Pict-Section-Modal"].toast("Provisioned "+t+" (Source #"+(e.Source?e.Source.IDSource:"?")+", Dataset #"+(e.Dataset?e.Dataset.IDDataset:"?")+")",{type:"success"}),this.loadScannerState(),this.pict.providers.FactoUI.refreshDataViews(["sources","datasets"]))}).catch(t=>{this.pict.views["Pict-Section-Modal"].toast("Error: "+t.message,{type:"error"})})}async provisionSelected(){let t=this.getSelectedFolderNames();0!==t.length?await this.pict.views["Pict-Section-Modal"].confirm("Provision "+t.length+" selected dataset(s)?",{title:"Provision Selected",confirmLabel:"Provision"})&&this.provisionBatch(t,0,0,0):this.pict.views["Pict-Section-Modal"].toast("Select datasets to provision using the checkboxes",{type:"warning"})}async provisionAll(){await this.pict.views["Pict-Section-Modal"].confirm("Provision ALL discovered datasets?",{title:"Provision All",confirmLabel:"Provision All",dangerous:!0})&&(this.pict.views["Pict-Section-Modal"].toast("Provisioning all datasets...",{type:"info"}),this.pict.providers.Facto.provisionAllScannerDatasets().then(t=>{t&&t.Error?this.pict.views["Pict-Section-Modal"].toast("Error: "+t.Error,{type:"error"}):(this.pict.views["Pict-Section-Modal"].toast("Provisioned "+t.Provisioned+" of "+t.Total+" ("+t.Errors+" error(s))",{type:"success"}),this.loadScannerState(),this.pict.providers.FactoUI.refreshDataViews(["sources","datasets"]))}).catch(t=>{this.pict.views["Pict-Section-Modal"].toast("Error: "+t.message,{type:"error"})}))}provisionBatch(t,e,o,i){if(e>=t.length)return this.pict.views["Pict-Section-Modal"].toast("Provisioned "+o+" of "+t.length+" ("+i+" error(s))",{type:"success"}),this.loadScannerState(),void this.pict.providers.FactoUI.refreshDataViews(["sources","datasets"]);let n=t[e];this.pict.views["Pict-Section-Modal"].toast("Provisioning "+(e+1)+"/"+t.length+": "+n+"...",{type:"info"}),this.pict.providers.Facto.provisionScannerDataset(n).then(n=>{n&&n.Error?this.provisionBatch(t,e+1,o,i+1):this.provisionBatch(t,e+1,o+1,i)}).catch(()=>{this.provisionBatch(t,e+1,o,i+1)})}toggleRowMenu(t,e){t.stopPropagation();let o=document.getElementById("facto-row-actions-"+e);if(!o)return;let i=o.classList.contains("open");if(this.closeRowMenus(),!i){o.classList.add("open");let t=e=>{o.contains(e.target)||(o.classList.remove("open"),document.removeEventListener("click",t))};setTimeout(()=>{document.addEventListener("click",t)},0)}}closeRowMenus(){let t=document.querySelectorAll(".facto-row-actions.open");for(let e=0;e<t.length;e++)t[e].classList.remove("open")}viewDetail(t){let e=document.getElementById("facto-scanner-detail");e&&(e.innerHTML='<p style="color:#888;">Loading details for '+this.escapeHtml(t)+"...</p>",this.pict.providers.Facto.loadScannerDatasetDetail(t).then(t=>{if(t&&t.Error)return void(e.innerHTML='<p style="color:#dc3545;">'+t.Error+"</p>");let o='<div style="border:1px solid #ddd; border-radius:6px; padding:16px; background:#fafafa;">';if(o+='<div style="display:flex; justify-content:space-between; align-items:center; margin-bottom:12px;">',o+='<h3 style="margin:0; font-size:1.1em; color:#333;">'+this.escapeHtml(t.Title||t.FolderName)+"</h3>",o+='<button class="secondary" style="padding:4px 10px; font-size:0.82em;" onclick="document.getElementById(\'facto-scanner-detail\').innerHTML=\'\';">Close</button>',o+="</div>",o+='<div style="display:grid; grid-template-columns:1fr 1fr; gap:8px 20px; font-size:0.9em; margin-bottom:12px;">',o+='<div><strong>Folder:</strong> <span style="font-family:monospace;">'+this.escapeHtml(t.FolderName)+"</span></div>",o+='<div><strong>Status:</strong> <span class="badge '+this.getStatusBadgeClass(t.Status)+'">'+(t.Status||"")+"</span></div>",o+="<div><strong>Provider:</strong> "+this.escapeHtml(t.Provider||"Unknown")+"</div>",o+="<div><strong>License:</strong> "+this.escapeHtml(t.License||"Unknown")+"</div>",t.SourceURL&&(o+='<div><strong>Source:</strong> <a href="'+this.escapeHtml(t.SourceURL)+'" target="_blank">'+this.escapeHtml(t.SourceURL.substring(0,60))+"</a></div>"),t.UpdateFrequency&&(o+="<div><strong>Update Frequency:</strong> "+this.escapeHtml(t.UpdateFrequency.substring(0,100))+"</div>"),t.RecordCount&&(o+="<div><strong>Record Count:</strong> "+this.escapeHtml(t.RecordCount.substring(0,100))+"</div>"),t.IDSource&&(o+="<div><strong>Source ID:</strong> #"+t.IDSource+"</div>"),t.IDDataset&&(o+="<div><strong>Dataset ID:</strong> #"+t.IDDataset+"</div>"),o+="</div>",t.Description&&(o+='<div style="margin-bottom:12px;"><strong>Description:</strong><div style="color:#555; font-size:0.9em; margin-top:4px; max-height:100px; overflow-y:auto; white-space:pre-wrap;">'+this.escapeHtml(t.Description.substring(0,500))+"</div></div>"),t.DataFiles&&t.DataFiles.length>0){o+='<div style="margin-bottom:12px;"><strong>Data Files ('+t.DataFiles.length+"):</strong>",o+='<table style="margin-top:4px; font-size:0.85em;"><thead><tr><th>File</th><th>Format</th><th>Size</th><th>Compressed</th></tr></thead><tbody>';for(let e=0;e<t.DataFiles.length&&e<20;e++){let i=t.DataFiles[e],n=this.formatSize(i.Size||0);o+="<tr>",o+='<td style="font-family:monospace; font-size:0.9em;">'+this.escapeHtml(i.FileName)+"</td>",o+="<td>"+(i.Format||"unknown")+"</td>",o+="<td>"+n+"</td>",o+="<td>"+(i.Compressed?"Yes":"No")+"</td>",o+="</tr>"}t.DataFiles.length>20&&(o+='<tr><td colspan="4" style="color:#888;">...and '+(t.DataFiles.length-20)+" more file(s)</td></tr>"),o+="</tbody></table></div>"}else o+='<p style="color:#dc3545; font-size:0.9em; margin-bottom:12px;"><strong>No data files.</strong> Download needed.</p>';if(t.Errors&&t.Errors.length>0){o+='<div style="margin-bottom:12px; padding:8px; background:#f8d7da; border-radius:4px; font-size:0.85em; color:#721c24;"><strong>Errors:</strong><ul style="margin:4px 0 0 16px;">';for(let e=0;e<t.Errors.length;e++)o+="<li>"+this.escapeHtml(t.Errors[e])+"</li>";o+="</ul></div>"}o+="<div>","Discovered"===t.Status&&(o+="<button class=\"success\" onclick=\"pict.views['Facto-Scanner'].provisionOne('"+this.escapeAttr(t.FolderName)+"')\">Provision</button>"),o+="</div>",o+="</div>",e.innerHTML=o}).catch(t=>{e.innerHTML='<p style="color:#dc3545;">Error: '+t.message+"</p>"}))}formatSize(t){if(0===t)return"0 B";let e=Math.floor(Math.log(t)/Math.log(1024));return(t/Math.pow(1024,e)).toFixed(1)+" "+["B","KB","MB","GB","TB"][e]}},e.exports.default_configuration={ViewIdentifier:"Facto-Scanner",DefaultRenderable:"Facto-Scanner",DefaultDestinationAddress:"#Facto-Section-Scanner",Templates:[{Hash:"Facto-Scanner",Template:'\n<div class="accordion-row">\n\t<div class="accordion-number">☰</div>\n\t<div class="accordion-card open" id="facto-card-scanner">\n\t\t<div class="accordion-header" onclick="pict.views[\'Facto-Layout\'].toggleSection(\'facto-card-scanner\')">\n\t\t\t<span class="accordion-title">Source Folder Scanner</span>\n\t\t\t<span class="accordion-preview">Discover and provision datasets from folder trees</span>\n\t\t\t<span class="accordion-toggle">▼</span>\n\t\t</div>\n\t\t<div class="accordion-body">\n\t\t\t<p style="margin-bottom:12px; color:#666; font-size:0.9em;">Point the scanner at folder trees containing dataset research (README.md + data/). Discovered datasets can be provisioned into the database individually or in bulk.</p>\n\n\t\t\t\x3c!-- Summary --\x3e\n\t\t\t<div id="facto-scanner-summary" style="margin-bottom:12px; padding:8px 12px; background:#e9ecef; border-radius:4px; font-size:0.9em; color:#555;">\n\t\t\t\tNo datasets loaded\n\t\t\t</div>\n\n\t\t\t\x3c!-- Add scan path --\x3e\n\t\t\t<div class="inline-group" style="margin-bottom:12px;">\n\t\t\t\t<div style="flex:3;">\n\t\t\t\t\t<input type="text" id="facto-scanner-path-input" placeholder="/path/to/dataset/folder/tree" style="margin-bottom:0;">\n\t\t\t\t</div>\n\t\t\t\t<div style="flex:0 0 auto; display:flex; align-items:flex-end; gap:4px;">\n\t\t\t\t\t<button class="primary" style="margin-bottom:0;" onclick="pict.views[\'Facto-Scanner\'].addPath()">Add & Scan</button>\n\t\t\t\t\t<button class="secondary" style="margin-bottom:0;" onclick="pict.views[\'Facto-Scanner\'].rescanAll()">Re-scan All</button>\n\t\t\t\t</div>\n\t\t\t</div>\n\n\t\t\t\x3c!-- Scan paths list --\x3e\n\t\t\t<div id="facto-scanner-paths-list" style="margin-bottom:16px;"></div>\n\n\t\t\t\x3c!-- Filter bar --\x3e\n\t\t\t<div class="inline-group" style="margin-bottom:8px;">\n\t\t\t\t<div style="flex:3;">\n\t\t\t\t\t<input type="text" id="facto-scanner-search" placeholder="Search by name, title, or provider..." style="margin-bottom:0;" oninput="pict.views[\'Facto-Scanner\'].filterDatasets()">\n\t\t\t\t</div>\n\t\t\t\t<div style="flex:1;">\n\t\t\t\t\t<select id="facto-scanner-status-filter" style="margin-bottom:0;" onchange="pict.views[\'Facto-Scanner\'].filterDatasets()">\n\t\t\t\t\t\t<option value="">All Statuses</option>\n\t\t\t\t\t\t<option value="Discovered">Discovered</option>\n\t\t\t\t\t\t<option value="Provisioned">Provisioned</option>\n\t\t\t\t\t\t<option value="Ingested">Ingested</option>\n\t\t\t\t\t\t<option value="Error">Error</option>\n\t\t\t\t\t</select>\n\t\t\t\t</div>\n\t\t\t\t<div style="flex:0 0 auto; display:flex; align-items:flex-end; gap:4px;">\n\t\t\t\t\t<button class="success" style="margin-bottom:0;" onclick="pict.views[\'Facto-Scanner\'].provisionSelected()">Provision Selected</button>\n\t\t\t\t\t<button class="success" style="margin-bottom:0;" onclick="pict.views[\'Facto-Scanner\'].provisionAll()">Provision All</button>\n\t\t\t\t</div>\n\t\t\t</div>\n\n\t\t\t\x3c!-- Datasets table --\x3e\n\t\t\t<div id="facto-scanner-datasets-list"></div>\n\n\t\t\t\x3c!-- Detail panel --\x3e\n\t\t\t<div id="facto-scanner-detail" style="margin-top:12px;"></div>\n\t\t</div>\n\t</div>\n</div>\n'}],Renderables:[{RenderableHash:"Facto-Scanner",TemplateHash:"Facto-Scanner",DestinationAddress:"#Facto-Section-Scanner"}]}},{"pict-view":41}],86:[function(t,e,o){const i=t("pict-view");e.exports=class extends i{constructor(t,e,o){super(t,e,o)}onAfterRender(){this.pict.providers.Facto.loadSources().then(()=>{this.refreshList()}).catch(t=>{this.pict.views["Pict-Section-Modal"].toast("Error loading sources: "+t.message,{type:"error"})})}refreshList(){let t=document.getElementById("facto-sources-list");if(!t)return;let e=this.pict.AppData.Facto.Sources;if(!e||0===e.length)return void(t.innerHTML='<p style="color:#888; font-style:italic;">No sources registered yet.</p>');let o="<table><thead><tr><th>ID</th><th>Name</th><th>Type</th><th>URL</th><th>Active</th><th>Actions</th></tr></thead><tbody>";for(let t=0;t<e.length;t++){let i=e[t],n=i.Active?'<span style="color:#28a745;">Active</span>':'<span style="color:#888;">Inactive</span>',a=i.Active?'<button class="secondary" style="padding:4px 8px; font-size:0.8em;" onclick="pict.views[\'Facto-Sources\'].toggleActive('+i.IDSource+', false)">Deactivate</button>':'<button class="success" style="padding:4px 8px; font-size:0.8em;" onclick="pict.views[\'Facto-Sources\'].toggleActive('+i.IDSource+', true)">Activate</button>';o+="<tr>",o+="<td>"+(i.IDSource||"")+"</td>",o+="<td>"+(i.Name||"")+"</td>",o+="<td>"+(i.Type||"")+"</td>",o+='<td style="max-width:200px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap;">'+(i.URL||"")+"</td>",o+="<td>"+n+"</td>",o+="<td>"+a+"</td>",o+="</tr>"}o+="</tbody></table>",t.innerHTML=o}toggleActive(t,e){(e?this.pict.providers.Facto.activateSource(t):this.pict.providers.Facto.deactivateSource(t)).then(()=>this.pict.providers.Facto.loadSources()).then(()=>{this.refreshList()}).catch(t=>{this.pict.views["Pict-Section-Modal"].toast("Error: "+t.message,{type:"error"})})}addSource(){let t=this.pict.providers.FactoUI.getVal("facto-source-name"),e=this.pict.providers.FactoUI.getVal("facto-source-type"),o=this.pict.providers.FactoUI.getVal("facto-source-url"),i=this.pict.providers.FactoUI.getVal("facto-source-protocol");t?this.pict.providers.Facto.createSource({Name:t,Type:e,URL:o,Protocol:i,Active:1}).then(t=>{if(t&&t.IDSource)return this.pict.views["Pict-Section-Modal"].toast("Source created: "+t.Name,{type:"success"}),document.getElementById("facto-source-name")&&(document.getElementById("facto-source-name").value=""),document.getElementById("facto-source-url")&&(document.getElementById("facto-source-url").value=""),this.pict.providers.Facto.loadSources();this.pict.views["Pict-Section-Modal"].toast("Error creating source",{type:"error"})}).then(()=>{this.refreshList()}).catch(t=>{this.pict.views["Pict-Section-Modal"].toast("Error: "+t.message,{type:"error"})}):this.pict.views["Pict-Section-Modal"].toast("Name is required",{type:"warning"})}},e.exports.default_configuration={ViewIdentifier:"Facto-Sources",DefaultRenderable:"Facto-Sources",DefaultDestinationAddress:"#Facto-Section-Sources",Templates:[{Hash:"Facto-Sources",Template:'\n<div class="accordion-row">\n\t<div class="accordion-number">1</div>\n\t<div class="accordion-card open" id="facto-card-sources">\n\t\t<div class="accordion-header" onclick="pict.views[\'Facto-Layout\'].toggleSection(\'facto-card-sources\')">\n\t\t\t<span class="accordion-title">Sources</span>\n\t\t\t<span class="accordion-preview">Manage data sources</span>\n\t\t\t<span class="accordion-toggle">▼</span>\n\t\t</div>\n\t\t<div class="accordion-body">\n\t\t\t<p style="margin-bottom:12px; color:#666; font-size:0.9em;">Data sources describe where ingested data originates -- websites, APIs, FTP servers, OCR results, ML outputs, etc.</p>\n\t\t\t<div id="facto-sources-list"></div>\n\n\t\t\t<h3 style="margin-top:16px; margin-bottom:8px; font-size:1em; color:#444;">Add Source</h3>\n\t\t\t<div class="inline-group">\n\t\t\t\t<div>\n\t\t\t\t\t<label for="facto-source-name">Name</label>\n\t\t\t\t\t<input type="text" id="facto-source-name" placeholder="e.g. US Census Bureau API">\n\t\t\t\t</div>\n\t\t\t\t<div>\n\t\t\t\t\t<label for="facto-source-type">Type</label>\n\t\t\t\t\t<select id="facto-source-type">\n\t\t\t\t\t\t<option value="API">API</option>\n\t\t\t\t\t\t<option value="File">File</option>\n\t\t\t\t\t\t<option value="FTP">FTP</option>\n\t\t\t\t\t\t<option value="Web">Web</option>\n\t\t\t\t\t\t<option value="OCR">OCR</option>\n\t\t\t\t\t\t<option value="ML">ML</option>\n\t\t\t\t\t\t<option value="Manual">Manual</option>\n\t\t\t\t\t</select>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t\t<div class="inline-group">\n\t\t\t\t<div>\n\t\t\t\t\t<label for="facto-source-url">URL</label>\n\t\t\t\t\t<input type="text" id="facto-source-url" placeholder="https://api.example.gov/data">\n\t\t\t\t</div>\n\t\t\t\t<div>\n\t\t\t\t\t<label for="facto-source-protocol">Protocol</label>\n\t\t\t\t\t<select id="facto-source-protocol">\n\t\t\t\t\t\t<option value="HTTPS">HTTPS</option>\n\t\t\t\t\t\t<option value="HTTP">HTTP</option>\n\t\t\t\t\t\t<option value="FTP">FTP</option>\n\t\t\t\t\t\t<option value="SFTP">SFTP</option>\n\t\t\t\t\t\t<option value="Local">Local</option>\n\t\t\t\t\t</select>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t\t<button class="primary" onclick="pict.views[\'Facto-Sources\'].addSource()">Add Source</button>\n\n\t\t</div>\n\t</div>\n</div>\n'}],Renderables:[{RenderableHash:"Facto-Sources",TemplateHash:"Facto-Sources",DestinationAddress:"#Facto-Section-Sources"}]}},{"pict-view":41}],87:[function(t,e,o){const i=t("pict-view"),n={extracted:{bar:"#4a90d9",bg:"rgba(74,144,217,0.15)",label:"Extracted"},transformed:{bar:"#d09818",bg:"rgba(208,152,24,0.15)",label:"Transformed"},written:{bar:"#3a9468",bg:"rgba(58,148,104,0.15)",label:"Written"}};e.exports=class extends i{constructor(t,e,o){super(t,e,o),this._pollTimer=null,this._isPolling=!1}onAfterRender(){}startMonitoring(){if(this._isPolling)return;this._isPolling=!0;let t=document.getElementById("facto-throughput-toggle");t&&(t.textContent="Stop Monitoring",t.className="danger"),this._poll()}stopMonitoring(){this._isPolling=!1,this._pollTimer&&(clearTimeout(this._pollTimer),this._pollTimer=null);let t=document.getElementById("facto-throughput-toggle");t&&(t.textContent="Start Monitoring",t.className="primary")}toggleMonitoring(){this._isPolling?this.stopMonitoring():this.startMonitoring()}_poll(){this._isPolling&&fetch("/facto/throughput?duration=30").then(t=>t.json()).then(t=>{this._renderHistograms(t),this._pollTimer=setTimeout(()=>this._poll(),500)}).catch(t=>{this._pollTimer=setTimeout(()=>this._poll(),2e3)})}_renderHistograms(t){let e=t.buckets||[],o=t.maxValue||1,i={extracted:0,transformed:0,written:0};for(let t=0;t<e.length;t++)i.extracted+=e[t].extracted,i.transformed+=e[t].transformed,i.written+=e[t].written;let a=1;for(let t=0;t<e.length;t++){let o=e[t].extracted+e[t].transformed+e[t].written;o>a&&(a=o)}let r=document.getElementById("facto-throughput-charts");if(!r)return;let s="";if(s+='<div style="display:flex; gap:24px; margin-bottom:12px; flex-wrap:wrap;">',s+=this._renderTotalBadge("Extracted",i.extracted,n.extracted.bar),s+=this._renderTotalBadge("Transformed",i.transformed,n.transformed.bar),s+=this._renderTotalBadge("Written",i.written,n.written.bar),t.activeRun){let e=((Date.now()-t.activeRun.startTime)/1e3).toFixed(1);s+='<div style="font-size:0.85em; color:var(--facto-text-secondary); display:flex; align-items:center; gap:6px;">',s+='<span style="display:inline-block; width:8px; height:8px; border-radius:50%; background:#3a9468; animation:pulse 1s infinite;"></span>',s+=t.activeRun.label+" ("+e+"s)",s+="</div>"}s+="</div>",s+='<div style="display:grid; grid-template-columns:1fr 1fr; gap:12px; margin-bottom:12px;">',s+=this._renderSingleHistogram("Extracted","extracted",e,o),s+=this._renderSingleHistogram("Transformed","transformed",e,o),s+=this._renderSingleHistogram("Written","written",e,o),s+=this._renderStackedHistogram("Combined",e,a),s+="</div>",r.innerHTML=s}_renderTotalBadge(t,e,o){return'<div style="display:flex; align-items:center; gap:6px;"><div style="width:12px; height:12px; border-radius:2px; background:'+o+';"></div><span style="font-weight:600; font-size:0.9em;">'+t+':</span><span style="font-size:0.9em; color:var(--facto-text-secondary);">'+e.toLocaleString()+"</span></div>"}_renderSingleHistogram(t,e,o,i){let a=n[e],r="",s=Math.max(i,1);for(let t=0;t<o.length;t++){let i=o[t][e];r+='<div style="display:inline-block;width:6px;height:80px;margin-right:2px;position:relative;vertical-align:bottom;"><div style="position:absolute; bottom:0; left:0; right:0;height:'+i/s*100+"%;background:"+(i>0?a.bar:"transparent")+';border-radius:1px 1px 0 0;transition:height 0.3s;" title="'+i+' records"></div></div>'}return'<div style="background:'+a.bg+'; border-radius:6px; padding:10px;"><div style="font-size:0.8em; font-weight:600; color:'+a.bar+'; margin-bottom:6px;">'+t+'</div><div style="overflow-x:auto; white-space:nowrap; display:flex; align-items:flex-end; height:80px; border-bottom:1px solid rgba(0,0,0,0.1);">'+r+"</div></div>"}loadRunHistory(){fetch("/facto/throughput/runs?limit=10").then(t=>t.json()).then(t=>{this._renderRunHistory(t)}).catch(()=>{})}loadHistoricalRun(t){this._activeHistoricalRun=t,this._activeDatasetFilter=null,fetch("/facto/throughput/run/"+encodeURIComponent(t)).then(t=>t.json()).then(e=>{e.historicalRun=t,this._renderHistograms(e),this._loadDatasetBreakdown(t)}).catch(()=>{})}filterByDataset(t){if(!this._activeHistoricalRun)return;this._activeDatasetFilter=t;let e="/facto/throughput/run/"+encodeURIComponent(this._activeHistoricalRun);t&&(e+="?dataset="+encodeURIComponent(t)),fetch(e).then(t=>t.json()).then(e=>{e.historicalRun=this._activeHistoricalRun,e.datasetFilter=t,this._renderHistograms(e)}).catch(()=>{})}_loadDatasetBreakdown(t){fetch("/facto/throughput/run/"+encodeURIComponent(t)+"/datasets").then(t=>t.json()).then(t=>{this._renderDatasetBreakdown(t)}).catch(()=>{})}_renderRunHistory(t){let e=document.getElementById("facto-throughput-history");if(!e)return;if(!t||0===t.length)return void(e.innerHTML='<p style="color:#aaa; font-size:0.85em; font-style:italic;">No historical runs found.</p>');let o='<div style="font-size:0.85em; font-weight:600; color:var(--facto-text-heading); margin-bottom:6px;">Run History</div>';o+='<div style="display:flex; flex-wrap:wrap; gap:6px;">';for(let e=0;e<t.length;e++){let i=t[e],n=new Date(i.startTime).toLocaleString(),a=i.datasets.length;o+='<button class="secondary" style="padding:4px 10px; font-size:0.8em;" onclick="pict.views[\'Facto-Throughput\'].loadHistoricalRun(\''+i.label.replace(/'/g,"\\'")+'\')" title="'+n+" — "+i.eventCount+" events, "+a+' datasets">'+i.label.substring(0,30)+(i.label.length>30?"...":"")+"</button>"}o+="</div>",e.innerHTML=o}_renderDatasetBreakdown(t){let e=document.getElementById("facto-throughput-datasets");if(!e)return;if(!t||0===t.length)return void(e.innerHTML="");let o=1;for(let e=0;e<t.length;e++)t[e].total>o&&(o=t[e].total);let i='<div style="font-size:0.85em; font-weight:600; color:var(--facto-text-heading); margin-bottom:8px;">Per-Dataset Breakdown</div>';i+='<div style="font-size:0.8em; margin-bottom:4px; color:var(--facto-text-tertiary);">Click a dataset to filter the histogram:</div>';for(let e=0;e<t.length;e++){let a=t[e],r=(a.total,this._activeDatasetFilter===a.dataset);i+='<div style="display:flex; align-items:center; gap:8px; margin-bottom:4px; cursor:pointer; '+(r?"background:var(--facto-brand-a15); border-radius:4px; padding:2px 6px;":"padding:2px 6px;")+"\" onclick=\"pict.views['Facto-Throughput'].filterByDataset("+(r?"null":"'"+a.dataset.replace(/'/g,"\\'")+"'")+')">',i+='<span style="min-width:200px; font-family:monospace; font-size:0.9em; color:var(--facto-text);">'+a.dataset+"</span>";let s=a.extracted/o*100,l=a.transformed/o*100,c=a.written/o*100;i+='<div style="flex:1; height:16px; display:flex; border-radius:3px; overflow:hidden; background:var(--facto-bg-elevated);">',a.extracted>0&&(i+='<div style="width:'+s+"%; background:"+n.extracted.bar+';" title="Extracted: '+a.extracted+'"></div>'),a.transformed>0&&(i+='<div style="width:'+l+"%; background:"+n.transformed.bar+';" title="Transformed: '+a.transformed+'"></div>'),a.written>0&&(i+='<div style="width:'+c+"%; background:"+n.written.bar+';" title="Written: '+a.written+'"></div>'),i+="</div>",i+='<span style="min-width:60px; text-align:right; font-size:0.85em; color:var(--facto-text-secondary);">'+a.total.toLocaleString()+"</span>",i+="</div>"}e.innerHTML=i}_renderStackedHistogram(t,e,o){let i="",a=Math.max(o,1);for(let t=0;t<e.length;t++){let o=e[t].extracted,r=e[t].transformed,s=e[t].written,l=o/a*100,c=r/a*100;i+='<div style="display:inline-flex; flex-direction:column-reverse;width:6px;height:80px;margin-right:2px;vertical-align:bottom;align-items:stretch;">',s>0&&(i+='<div style="height:'+s/a*100+"%; background:"+n.written.bar+'; transition:height 0.3s;" title="Written: '+s+'"></div>'),r>0&&(i+='<div style="height:'+c+"%; background:"+n.transformed.bar+'; transition:height 0.3s;" title="Transformed: '+r+'"></div>'),o>0&&(i+='<div style="height:'+l+"%; background:"+n.extracted.bar+'; transition:height 0.3s;" title="Extracted: '+o+'"></div>'),i+="</div>"}return'<div style="background:rgba(0,0,0,0.03); border:1px solid var(--facto-border-subtle); border-radius:6px; padding:10px;"><div style="font-size:0.8em; font-weight:600; color:var(--facto-text-heading); margin-bottom:6px;">'+t+' (stacked)</div><div style="overflow-x:auto; white-space:nowrap; display:flex; align-items:flex-end; height:80px; border-bottom:1px solid rgba(0,0,0,0.1);">'+i+"</div></div>"}},e.exports.default_configuration={ViewIdentifier:"Facto-Throughput",DefaultRenderable:"Facto-Throughput",DefaultDestinationAddress:"#Facto-Section-Throughput",Templates:[{Hash:"Facto-Throughput",Template:'\n<div class="accordion-row">\n\t<div class="accordion-number" style="color:var(--facto-brand);">⚡</div>\n\t<div class="accordion-card open">\n\t\t<div class="accordion-header" onclick="pict.views[\'Facto-Layout\'].toggleSection(\'facto-card-throughput\')" id="facto-card-throughput-header">\n\t\t\t<span class="accordion-title">Pipeline Throughput</span>\n\t\t\t<span class="accordion-preview">Live pipeline throughput monitoring</span>\n\t\t\t<span class="accordion-toggle">▼</span>\n\t\t</div>\n\t\t<div class="accordion-body" id="facto-card-throughput">\n\t\t\t<p style="margin-bottom:12px; color:#666; font-size:0.9em;">\n\t\t\t\tTemporal histograms showing record flow through extraction, transformation, and storage stages.\n\t\t\t</p>\n\t\t\t<div style="display:flex; gap:8px; margin-bottom:12px; flex-wrap:wrap;">\n\t\t\t\t<button id="facto-throughput-toggle" class="primary" onclick="pict.views[\'Facto-Throughput\'].toggleMonitoring()">Start Live Monitoring</button>\n\t\t\t\t<button class="secondary" onclick="pict.views[\'Facto-Throughput\'].loadRunHistory()">Browse Run History</button>\n\t\t\t</div>\n\t\t\t<div id="facto-throughput-history" style="margin-bottom:12px;"></div>\n\t\t\t<div id="facto-throughput-charts">\n\t\t\t\t<p style="color:#aaa; font-style:italic;">Click "Start Live Monitoring" for real-time view, or "Browse Run History" to inspect past runs.</p>\n\t\t\t</div>\n\t\t\t<div id="facto-throughput-datasets" style="margin-top:12px;"></div>\n\t\t\t<style>\n\t\t\t\t@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }\n\t\t\t</style>\n\t\t</div>\n\t</div>\n</div>\n'}],Renderables:[{RenderableHash:"Facto-Throughput",TemplateHash:"Facto-Throughput",DestinationAddress:"#Facto-Section-Throughput"}]}},{"pict-view":41}],88:[function(t,e,o){arguments[4][1][0].apply(o,arguments)},{dup:1}],89:[function(t,e,o){arguments[4][2][0].apply(o,arguments)},{"../package.json":88,dup:2}],90:[function(t,e,o){arguments[4][6][0].apply(o,arguments)},{dup:6}],91:[function(t,e,o){arguments[4][7][0].apply(o,arguments)},{"../package.json":90,dup:7,"fable-serviceproviderbase":89}],92:[function(t,e,o){e.exports=t("./views/PictView-Flow.js"),e.exports.PictViewFlowNode=t("./views/PictView-Flow-Node.js"),e.exports.PictViewFlowToolbar=t("./views/PictView-Flow-Toolbar.js"),e.exports.PictViewFlowFloatingToolbar=t("./views/PictView-Flow-FloatingToolbar.js"),e.exports.PictServiceFlowInteractionManager=t("./services/PictService-Flow-InteractionManager.js"),e.exports.PictServiceFlowConnectionRenderer=t("./services/PictService-Flow-ConnectionRenderer.js"),e.exports.PictServiceFlowTether=t("./services/PictService-Flow-Tether.js"),e.exports.PictServiceFlowLayout=t("./services/PictService-Flow-Layout.js"),e.exports.PictServiceFlowPathGenerator=t("./services/PictService-Flow-PathGenerator.js"),e.exports.PictServiceFlowViewportManager=t("./services/PictService-Flow-ViewportManager.js"),e.exports.PictServiceFlowSelectionManager=t("./services/PictService-Flow-SelectionManager.js"),e.exports.PictServiceFlowPanelManager=t("./services/PictService-Flow-PanelManager.js"),e.exports.PictServiceFlowDataManager=t("./services/PictService-Flow-DataManager.js"),e.exports.PictServiceFlowConnectionHandleManager=t("./services/PictService-Flow-ConnectionHandleManager.js"),e.exports.PictServiceFlowRenderManager=t("./services/PictService-Flow-RenderManager.js"),e.exports.PictServiceFlowPortRenderer=t("./services/PictService-Flow-PortRenderer.js"),e.exports.PictProviderFlowNodeTypes=t("./providers/PictProvider-Flow-NodeTypes.js"),e.exports.PictProviderFlowEventHandler=t("./providers/PictProvider-Flow-EventHandler.js"),e.exports.PictProviderFlowLayouts=t("./providers/PictProvider-Flow-Layouts.js"),e.exports.PictProviderFlowSVGHelpers=t("./providers/PictProvider-Flow-SVGHelpers.js"),e.exports.PictProviderFlowGeometry=t("./providers/PictProvider-Flow-Geometry.js"),e.exports.PictProviderFlowPanelChrome=t("./providers/PictProvider-Flow-PanelChrome.js"),e.exports.PictProviderFlowCSS=t("./providers/PictProvider-Flow-CSS.js"),e.exports.PictProviderFlowIcons=t("./providers/PictProvider-Flow-Icons.js"),e.exports.PictProviderFlowConnectorShapes=t("./providers/PictProvider-Flow-ConnectorShapes.js"),e.exports.PictFlowCard=t("./PictFlowCard.js"),e.exports.PictFlowCardPropertiesPanel=t("./PictFlowCardPropertiesPanel.js"),e.exports.FlowCardPropertiesPanelTemplate=t("./panels/FlowCardPropertiesPanel-Template.js"),e.exports.FlowCardPropertiesPanelMarkdown=t("./panels/FlowCardPropertiesPanel-Markdown.js"),e.exports.FlowCardPropertiesPanelForm=t("./panels/FlowCardPropertiesPanel-Form.js"),e.exports.FlowCardPropertiesPanelView=t("./panels/FlowCardPropertiesPanel-View.js"),e.exports.PictViewFlowPropertiesPanel=t("./views/PictView-Flow-PropertiesPanel.js")},{"./PictFlowCard.js":93,"./PictFlowCardPropertiesPanel.js":94,"./panels/FlowCardPropertiesPanel-Form.js":95,"./panels/FlowCardPropertiesPanel-Markdown.js":96,"./panels/FlowCardPropertiesPanel-Template.js":97,"./panels/FlowCardPropertiesPanel-View.js":98,"./providers/PictProvider-Flow-CSS.js":99,"./providers/PictProvider-Flow-ConnectorShapes.js":100,"./providers/PictProvider-Flow-EventHandler.js":101,"./providers/PictProvider-Flow-Geometry.js":102,"./providers/PictProvider-Flow-Icons.js":103,"./providers/PictProvider-Flow-Layouts.js":104,"./providers/PictProvider-Flow-NodeTypes.js":105,"./providers/PictProvider-Flow-PanelChrome.js":107,"./providers/PictProvider-Flow-SVGHelpers.js":108,"./services/PictService-Flow-ConnectionHandleManager.js":110,"./services/PictService-Flow-ConnectionRenderer.js":111,"./services/PictService-Flow-DataManager.js":112,"./services/PictService-Flow-InteractionManager.js":113,"./services/PictService-Flow-Layout.js":114,"./services/PictService-Flow-PanelManager.js":115,"./services/PictService-Flow-PathGenerator.js":116,"./services/PictService-Flow-PortRenderer.js":117,"./services/PictService-Flow-RenderManager.js":118,"./services/PictService-Flow-SelectionManager.js":119,"./services/PictService-Flow-Tether.js":120,"./services/PictService-Flow-ViewportManager.js":121,"./views/PictView-Flow-FloatingToolbar.js":122,"./views/PictView-Flow-Node.js":123,"./views/PictView-Flow-PropertiesPanel.js":124,"./views/PictView-Flow-Toolbar.js":125,"./views/PictView-Flow.js":126}],93:[function(t,e,o){const i=t("fable-serviceproviderbase");class n extends i{constructor(t,e,o){let i=Object.assign({},n.default_configuration,e);super(t,i,o),this.serviceType="PictFlowCard",this.cardTitle=i.Title?i.Title:"Card",this.cardName=!!i.Name&&i.Name,this.cardCode=i.Code?i.Code:"",this.cardDescription=!!i.Description&&i.Description,this.cardIcon=!!i.Icon&&i.Icon,this.cardPreviewImage=!!i.PreviewImage&&i.PreviewImage,this.cardDocumentation=!!i.Documentation&&i.Documentation,this.cardTooltip=!!i.Tooltip&&i.Tooltip,this.cardHelp=!!i.Help&&i.Help,this.cardEnabled="boolean"!=typeof i.Enabled||i.Enabled,this.cardTitleBarColor=i.TitleBarColor?i.TitleBarColor:"#2c3e50",this.cardBodyStyle=i.BodyStyle?i.BodyStyle:{},this.cardWidth="number"==typeof i.Width?i.Width:180,this.cardHeight="number"==typeof i.Height?i.Height:80,this.cardCategory=i.Category?i.Category:"General",this.cardInputs=Array.isArray(i.Inputs)?i.Inputs:[],this.cardOutputs=Array.isArray(i.Outputs)?i.Outputs:[],this.cardPropertiesPanel=i.PropertiesPanel&&"object"==typeof i.PropertiesPanel?i.PropertiesPanel:null,this.cardBodyContent=i.BodyContent&&"object"==typeof i.BodyContent?i.BodyContent:null,this.cardShowTypeLabel="boolean"!=typeof i.ShowTypeLabel||i.ShowTypeLabel,this.cardPortLabelsOnHover="boolean"==typeof i.PortLabelsOnHover&&i.PortLabelsOnHover,this.cardPortLabelsVertical="boolean"==typeof i.PortLabelsVertical&&i.PortLabelsVertical,this.cardPortLabelPadding="boolean"==typeof i.PortLabelPadding&&i.PortLabelPadding,this.cardPortLabelsOutside="boolean"==typeof i.PortLabelsOutside&&i.PortLabelsOutside,this.cardLabelsInFront="boolean"!=typeof i.LabelsInFront||i.LabelsInFront}getNodeTypeConfiguration(){let t=[];for(let e=0;e<this.cardInputs.length;e++){let o=this.cardInputs[e],i={Hash:null,Direction:"input",Side:o.Side||"left",Label:o.Name||`In ${e+1}`,MinimumInputCount:"number"==typeof o.MinimumInputCount?o.MinimumInputCount:0,MaximumInputCount:"number"==typeof o.MaximumInputCount?o.MaximumInputCount:-1};o.PortType&&(i.PortType=o.PortType),o.DataType&&(i.DataType=o.DataType),t.push(i)}for(let e=0;e<this.cardOutputs.length;e++){let o=this.cardOutputs[e],i={Hash:null,Direction:"output",Side:o.Side||"right",Label:o.Name||`Out ${e+1}`};o.PortType&&(i.PortType=o.PortType),o.DataType&&(i.DataType=o.DataType),t.push(i)}0===t.length&&(t.push({Hash:null,Direction:"input",Side:"left",Label:"In"}),t.push({Hash:null,Direction:"output",Side:"right",Label:"Out"}));let e={Hash:this.cardCode,Label:this.cardTitle,DefaultWidth:this.cardWidth,DefaultHeight:this.cardHeight,DefaultPorts:t,TitleBarColor:this.cardTitleBarColor,BodyStyle:JSON.parse(JSON.stringify(this.cardBodyStyle)),CardMetadata:{Name:this.cardName,Code:this.cardCode,Description:this.cardDescription,Icon:this.cardIcon,PreviewImage:this.cardPreviewImage,Documentation:this.cardDocumentation,Tooltip:this.cardTooltip,Enabled:this.cardEnabled,Category:this.cardCategory,Help:this.cardHelp}};return e.ShowTypeLabel=this.cardShowTypeLabel,e.PortLabelsOnHover=this.cardPortLabelsOnHover,e.PortLabelsVertical=this.cardPortLabelsVertical,e.PortLabelPadding=this.cardPortLabelPadding,e.PortLabelsOutside=this.cardPortLabelsOutside,e.LabelsInFront=this.cardLabelsInFront,this.cardPropertiesPanel&&(e.PropertiesPanel=JSON.parse(JSON.stringify(this.cardPropertiesPanel))),this.cardBodyContent&&(e.BodyContent=JSON.parse(JSON.stringify(this.cardBodyContent)),"function"==typeof this.options.BodyContent.RenderCallback&&(e.BodyContent.RenderCallback=this.options.BodyContent.RenderCallback)),e}registerWithFlowView(t){if(!t||!t._NodeTypeProvider)return this.log.warn("PictFlowCard registerWithFlowView: no valid FlowView or NodeTypeProvider"),!1;let e=this.getNodeTypeConfiguration();return t._NodeTypeProvider.registerNodeType(e)}}e.exports=n,e.exports.default_configuration={Title:"Card",Name:!1,Code:"",Description:!1,Icon:!1,PreviewImage:!1,Documentation:!1,Tooltip:!1,Inputs:[],Outputs:[],Enabled:!0,TitleBarColor:"#2c3e50",BodyStyle:{},Width:180,Height:80,Category:"General",PropertiesPanel:null,BodyContent:null,ShowTypeLabel:!0,PortLabelsOnHover:!1,PortLabelsVertical:!1,PortLabelPadding:!1,PortLabelsOutside:!1,LabelsInFront:!0}},{"fable-serviceproviderbase":89}],94:[function(t,e,o){const i=t("fable-serviceproviderbase");class n extends i{constructor(t,e,o){let i=Object.assign({},n.default_configuration,e);super(t,i,o),this.serviceType="PictFlowCardPropertiesPanel",this.panelType=i.PanelType||"Base",this.panelTitle=i.Title||"Properties",this.panelWidth="number"==typeof i.Width?i.Width:300,this.panelHeight="number"==typeof i.Height?i.Height:200,this._FlowView=null,this._NodeData=null,this._ContentContainer=null,this._Configuration=i.Configuration||{}}render(t,e){this._ContentContainer=t,this._NodeData=e}marshalToPanel(t){this._NodeData=t}marshalFromPanel(t){}destroy(){this._ContentContainer=null,this._NodeData=null}}e.exports=n,e.exports.default_configuration={PanelType:"Base",Title:"Properties",Width:300,Height:200,Configuration:{}}},{"fable-serviceproviderbase":89}],95:[function(t,e,o){const i=t("../PictFlowCardPropertiesPanel.js");e.exports=class extends i{constructor(t,e,o){super(t,e,o),this.serviceType="PictFlowCardPropertiesPanel-Form",this._Metacontroller=null,this._InjectedSectionHash=null}render(t,e){if(super.render(t,e),!this._Configuration||!this._Configuration.Manifest)return void(t.innerHTML="<em>No form manifest configured</em>");let o=`pict-flow-panel-form-${e.Hash}`;t.innerHTML=`<div id="${o}"></div>`,this.fable.AppData.Record=e;try{if(!this._Metacontroller){let t=null;this.fable.servicesMap.hasOwnProperty("PictFormMetacontroller")?t="PictFormMetacontroller":this.fable.servicesMap.hasOwnProperty("PictViewFormMetacontroller")&&(t="PictViewFormMetacontroller"),t&&(this._Metacontroller=this.fable.instantiateServiceProviderWithoutRegistration(t,{ViewIdentifier:`FlowPanelForm-${e.Hash}`,DefaultDestinationAddress:`#${o}`,AutoRender:!1,AutoPopulateAfterRender:!0,AutoSolveBeforeRender:!1}))}if(this._Metacontroller&&"function"==typeof this._Metacontroller.injectManifestAndRender){let e=`Pict-${this._Metacontroller.UUID}-FormContainer`,i=t.querySelector(`#${o}`);i&&(i.innerHTML=`<div id="${e}" class="pict-form"></div>`);let n=JSON.parse(JSON.stringify(this._Configuration.Manifest));this._InjectedSectionHash=n.Hash||null,this._Metacontroller.injectManifestAndRender(n)}else if(this._Metacontroller&&"function"==typeof this._Metacontroller.injectManifest){let e=JSON.parse(JSON.stringify(this._Configuration.Manifest)),i=this._Metacontroller.injectManifest(e);this._InjectedSectionHash=e.Hash||null;let n=t.querySelector(`#${o}`);if(n&&i.length>0){let t="";for(let e=0;e<i.length;e++){let o=i[e].options.DefaultDestinationAddress;o&&"#"===o.charAt(0)&&(o=o.substring(1)),t+=`<div id="${o}" class="pict-form-view"></div>`}n.innerHTML=t;for(let t=0;t<i.length;t++)i[t].render()}}else t.innerHTML="<em>pict-section-form is not available. Install it in your application to use Form panels.</em>"}catch(e){this.log.warn(`FlowCardPropertiesPanel-Form render error: ${e.message}`),t.innerHTML=`<em>Form render error: ${e.message}</em>`}}marshalFromPanel(t){this._Metacontroller&&"function"==typeof this._Metacontroller.marshalFromView&&this._Metacontroller.marshalFromView()}destroy(){this._Metacontroller=null,this._InjectedSectionHash=null,super.destroy()}},e.exports.default_configuration=Object.assign({},i.default_configuration,{PanelType:"Form",Configuration:{Manifest:null}})},{"../PictFlowCardPropertiesPanel.js":94}],96:[function(t,e,o){const i=t("../PictFlowCardPropertiesPanel.js");e.exports=class extends i{constructor(t,e,o){super(t,e,o),this.serviceType="PictFlowCardPropertiesPanel-Markdown",this._ContentProvider=null}render(t,e){super.render(t,e),this._renderMarkdown()}marshalToPanel(t){super.marshalToPanel(t),this._renderMarkdown()}_renderMarkdown(){if(!this._ContentContainer||!this._Configuration)return;let t="";if(this._Configuration.MarkdownAddress&&this._NodeData?t=this.fable.manifest.getValueByHash(this._NodeData,this._Configuration.MarkdownAddress)||"":this._Configuration.Markdown&&(t=this._Configuration.Markdown),t)try{if(this._ContentProvider||this.fable.servicesMap.hasOwnProperty("PictContentProvider")&&(this._ContentProvider=this.fable.instantiateServiceProviderWithoutRegistration("PictContentProvider",{})),this._ContentProvider&&"function"==typeof this._ContentProvider.parseMarkdown){let e=this._ContentProvider.parseMarkdown(t);this._ContentContainer.innerHTML=e,"function"==typeof this._ContentProvider.renderKaTeXEquations&&this._ContentProvider.renderKaTeXEquations(this._ContentContainer),"function"==typeof this._ContentProvider.renderMermaidDiagrams&&this._ContentProvider.renderMermaidDiagrams(this._ContentContainer)}else this._ContentContainer.innerHTML=`<pre style="white-space: pre-wrap; font-family: inherit;">${this._escapeHTML(t)}</pre>`}catch(e){this.log.warn(`FlowCardPropertiesPanel-Markdown render error: ${e.message}`),this._ContentContainer.innerHTML=`<pre style="white-space: pre-wrap; font-family: inherit;">${this._escapeHTML(t)}</pre>`}else this._ContentContainer.innerHTML="<em>No content</em>"}_escapeHTML(t){let e=document.createElement("div");return e.textContent=t,e.innerHTML}destroy(){this._ContentProvider=null,super.destroy()}},e.exports.default_configuration=Object.assign({},i.default_configuration,{PanelType:"Markdown",Configuration:{Markdown:"",MarkdownAddress:""}})},{"../PictFlowCardPropertiesPanel.js":94}],97:[function(t,e,o){const i=t("../PictFlowCardPropertiesPanel.js");e.exports=class extends i{constructor(t,e,o){super(t,e,o),this.serviceType="PictFlowCardPropertiesPanel-Template",this._TemplatesRegistered=!1}render(t,e){if(super.render(t,e),this._Configuration&&this._Configuration.Templates){if(!this._TemplatesRegistered){let t=this._Configuration.Templates;for(let e=0;e<t.length;e++)t[e].Hash&&t[e].Template&&this.fable.TemplateProvider.addTemplate(t[e].Hash,t[e].Template);this._TemplatesRegistered=!0}this._renderTemplate()}}marshalToPanel(t){super.marshalToPanel(t),this._renderTemplate()}_renderTemplate(){if(!this._ContentContainer||!this._NodeData)return;let t=this._Configuration.TemplateHash;if(!t)return;let e=this._NodeData,o=this.fable.parseTemplateByHash(t,e,null,[e]);this._ContentContainer.innerHTML=o}},e.exports.default_configuration=Object.assign({},i.default_configuration,{PanelType:"Template",Configuration:{Templates:[],TemplateHash:""}})},{"../PictFlowCardPropertiesPanel.js":94}],98:[function(t,e,o){const i=t("../PictFlowCardPropertiesPanel.js");e.exports=class extends i{constructor(t,e,o){super(t,e,o),this.serviceType="PictFlowCardPropertiesPanel-View",this._OriginalDestination=null,this._ViewInstance=null}render(t,e){if(super.render(t,e),!this._Configuration||!this._Configuration.ViewHash)return void(t.innerHTML="<em>No ViewHash configured</em>");let o=this._Configuration.ViewHash,i=`pict-flow-panel-view-${e.Hash}`;t.innerHTML=`<div id="${i}"></div>`;try{let e=this.pict||this.fable;e.views&&e.views[o]?(this._ViewInstance=e.views[o],this._OriginalDestination=this._ViewInstance.options.DefaultDestinationAddress,this._ViewInstance.options.DefaultDestinationAddress=`#${i}`,"function"==typeof this._ViewInstance.render&&this._ViewInstance.render()):t.innerHTML=`<em>View "${o}" not found</em>`}catch(e){this.log.warn(`FlowCardPropertiesPanel-View render error: ${e.message}`),t.innerHTML=`<em>View render error: ${e.message}</em>`}}marshalFromPanel(t){this._ViewInstance&&"function"==typeof this._ViewInstance.marshalFromView&&this._ViewInstance.marshalFromView()}destroy(){this._ViewInstance&&this._OriginalDestination&&(this._ViewInstance.options.DefaultDestinationAddress=this._OriginalDestination),this._ViewInstance=null,this._OriginalDestination=null,super.destroy()}},e.exports.default_configuration=Object.assign({},i.default_configuration,{PanelType:"View",Configuration:{ViewHash:""}})},{"../PictFlowCardPropertiesPanel.js":94}],99:[function(t,e,o){const i=t("fable-serviceproviderbase"),n={ProviderIdentifier:"PictProviderFlowCSS"};e.exports=class extends i{constructor(t,e,o){super(t,Object.assign({},n,e),o),this.serviceType="PictProviderFlowCSS",this._FlowView=e&&e.FlowView?e.FlowView:null}getContainerCSS(){return"\n\t\t.pict-flow-container {\n\t\t\t/* ── Design Tokens ─────────────────────────────────────\n\t\t\t Override these custom properties to theme the flow diagram.\n\t\t\t Node-type classes (.pict-flow-node-{type}) can scope-override\n\t\t\t any variable for per-type variation. */\n\n\t\t\t/* Text */\n\t\t\t--pf-text-primary: #2c3e50;\n\t\t\t--pf-text-heading: #1a252f;\n\t\t\t--pf-text-secondary: #7f8c8d;\n\t\t\t--pf-text-tertiary: #8e99a4;\n\t\t\t--pf-text-placeholder: #95a5a6;\n\n\t\t\t/* Node */\n\t\t\t--pf-node-body-fill: #ffffff;\n\t\t\t--pf-node-body-stroke: #d0d4d8;\n\t\t\t--pf-node-body-stroke-hover: #b0b8c0;\n\t\t\t--pf-node-body-stroke-width: 1;\n\t\t\t--pf-node-body-radius: 8px;\n\t\t\t--pf-node-shadow: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.10));\n\t\t\t--pf-node-shadow-hover: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.15));\n\t\t\t--pf-node-shadow-selected: drop-shadow(0 2px 8px rgba(52, 152, 219, 0.25));\n\t\t\t--pf-node-shadow-dragging: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.20));\n\t\t\t--pf-node-title-fill: #ffffff;\n\t\t\t--pf-node-title-size: 11.5px;\n\t\t\t--pf-node-title-weight: 600;\n\t\t\t--pf-node-title-bar-color: #2c3e50;\n\t\t\t--pf-node-type-label-fill: #a0a8b0;\n\t\t\t--pf-node-selected-stroke: #3498db;\n\n\t\t\t/* Node Variants */\n\t\t\t--pf-node-start-fill: #eafaf1;\n\t\t\t--pf-node-start-stroke: #27ae60;\n\t\t\t--pf-node-end-fill: #e8f8f5;\n\t\t\t--pf-node-end-stroke: #1abc9c;\n\t\t\t--pf-node-halt-fill: #fdedec;\n\t\t\t--pf-node-halt-stroke: #e74c3c;\n\t\t\t--pf-node-decision-fill: #fff9e6;\n\t\t\t--pf-node-decision-stroke: #f39c12;\n\n\t\t\t/* Ports */\n\t\t\t--pf-port-input-fill: #3498db;\n\t\t\t--pf-port-output-fill: #2ecc71;\n\t\t\t--pf-port-stroke: #ffffff;\n\t\t\t--pf-port-stroke-width: 2;\n\t\t\t--pf-port-label-bg: rgba(255, 253, 240, 0.5);\n\t\t\t--pf-port-label-text: #2c3e50;\n\n\t\t\t/* Port Type Colors */\n\t\t\t--pf-port-event-in-fill: #3498db;\n\t\t\t--pf-port-event-out-fill: #2ecc71;\n\t\t\t--pf-port-setting-fill: #e67e22;\n\t\t\t--pf-port-value-fill: #f1c40f;\n\t\t\t--pf-port-error-fill: #e74c3c;\n\n\t\t\t/* Connection Type Colors (match source port) */\n\t\t\t--pf-connection-event-in-stroke: #3498db;\n\t\t\t--pf-connection-event-out-stroke: #2ecc71;\n\t\t\t--pf-connection-setting-stroke: #e67e22;\n\t\t\t--pf-connection-value-stroke: #f1c40f;\n\t\t\t--pf-connection-error-stroke: #e74c3c;\n\n\t\t\t/* Connections */\n\t\t\t--pf-connection-stroke: #95a5a6;\n\t\t\t--pf-connection-stroke-hover: #7f8c8d;\n\t\t\t--pf-connection-selected-stroke: #3498db;\n\n\t\t\t/* Panels */\n\t\t\t--pf-panel-bg: #ffffff;\n\t\t\t--pf-panel-border: #d0d4d8;\n\t\t\t--pf-panel-radius: 8px;\n\t\t\t--pf-panel-shadow: 0 4px 12px rgba(0,0,0,0.10), 0 1px 3px rgba(0,0,0,0.06);\n\t\t\t--pf-panel-titlebar-bg: #f7f8fa;\n\t\t\t--pf-panel-titlebar-border: #e8eaed;\n\t\t\t--pf-panel-title-color: #2c3e50;\n\n\t\t\t/* Tabs */\n\t\t\t--pf-tab-text: #8e99a4;\n\t\t\t--pf-tab-text-hover: #5a6a7a;\n\t\t\t--pf-tab-active-border: var(--pf-node-selected-stroke);\n\t\t\t--pf-resize-handle-hover: #e0e3e6;\n\n\t\t\t/* Forms & Inputs */\n\t\t\t--pf-input-border: #d5d8dc;\n\t\t\t--pf-input-border-focus: #3498db;\n\t\t\t--pf-divider-light: #ecf0f1;\n\t\t\t--pf-divider-medium: #e8eaed;\n\n\t\t\t/* Buttons */\n\t\t\t--pf-button-border: #bdc3c7;\n\t\t\t--pf-button-hover-border: #95a5a6;\n\t\t\t--pf-button-hover-bg: #ecf0f1;\n\t\t\t--pf-button-active-bg: #d5dbdb;\n\t\t\t--pf-button-danger-text: #e74c3c;\n\t\t\t--pf-button-danger-hover-bg: #fdedec;\n\t\t\t--pf-button-close-color: #b0b8c0;\n\n\t\t\t/* Badges */\n\t\t\t--pf-badge-category-bg: #f0f2f4;\n\t\t\t--pf-badge-category-text: #6b7b8d;\n\t\t\t--pf-badge-code-bg: #eaf2f8;\n\t\t\t--pf-badge-code-text: #2980b9;\n\n\t\t\t/* Info Panel */\n\t\t\t--pf-port-item-bg: #f8f9fa;\n\n\t\t\t/* Toolbar */\n\t\t\t--pf-toolbar-bg: #ffffff;\n\t\t\t--pf-toolbar-border: #e0e0e0;\n\n\t\t\t/* Palette Cards */\n\t\t\t--pf-card-border: #d5d8dc;\n\t\t\t--pf-card-hover-bg: #eaf2f8;\n\t\t\t--pf-card-hover-shadow: 0 1px 3px rgba(52, 152, 219, 0.15);\n\n\t\t\t/* Canvas */\n\t\t\t--pf-canvas-bg: #fafafa;\n\t\t\t--pf-grid-stroke: #e8e8e8;\n\n\t\t\tposition: relative;\n\t\t\twidth: 100%;\n\t\t\theight: 100%;\n\t\t\tmin-height: 400px;\n\t\t\toverflow: hidden;\n\t\t\tbackground-color: var(--pf-canvas-bg);\n\t\t\tborder: 1px solid var(--pf-toolbar-border);\n\t\t\tborder-radius: 4px;\n\t\t\tdisplay: flex;\n\t\t\tflex-direction: column;\n\t\t}\n\t\t.pict-flow-svg-container {\n\t\t\tflex: 1;\n\t\t\tmin-height: 0;\n\t\t\tposition: relative;\n\t\t}\n\t\t.pict-flow-svg {\n\t\t\twidth: 100%;\n\t\t\theight: 100%;\n\t\t\tcursor: grab;\n\t\t\tuser-select: none;\n\t\t\t-webkit-user-select: none;\n\t\t}\n\t\t.pict-flow-svg.panning {\n\t\t\tcursor: grabbing;\n\t\t}\n\t\t.pict-flow-svg.connecting {\n\t\t\tcursor: crosshair;\n\t\t}\n\t\t.pict-flow-grid-pattern line {\n\t\t\tstroke: var(--pf-grid-stroke);\n\t\t\tstroke-width: 0.5;\n\t\t}\n\t\t"}getNodeCSS(){return'\n\t\t.pict-flow-node {\n\t\t\tcursor: pointer;\n\t\t\tfilter: var(--pf-node-shadow);\n\t\t\ttransition: filter 0.2s;\n\t\t}\n\t\t.pict-flow-node:hover {\n\t\t\tfilter: var(--pf-node-shadow-hover);\n\t\t}\n\t\t.pict-flow-node:hover .pict-flow-node-body {\n\t\t\tstroke: var(--pf-node-body-stroke-hover);\n\t\t\tstroke-width: 1.5;\n\t\t}\n\t\t.pict-flow-node.selected {\n\t\t\tfilter: var(--pf-node-shadow-selected);\n\t\t}\n\t\t.pict-flow-node.selected .pict-flow-node-body {\n\t\t\tstroke: var(--pf-node-selected-stroke);\n\t\t\tstroke-width: 2;\n\t\t}\n\t\t.pict-flow-node.dragging {\n\t\t\topacity: 0.9;\n\t\t\tcursor: grabbing;\n\t\t\tfilter: var(--pf-node-shadow-dragging);\n\t\t}\n\t\t.pict-flow-node-body {\n\t\t\tfill: var(--pf-node-body-fill);\n\t\t\tstroke: var(--pf-node-body-stroke);\n\t\t\tstroke-width: var(--pf-node-body-stroke-width);\n\t\t\trx: var(--pf-node-body-radius);\n\t\t\try: var(--pf-node-body-radius);\n\t\t\ttransition: stroke 0.2s, stroke-width 0.2s;\n\t\t}\n\t\t.pict-flow-node-title-bar {\n\t\t\tfill: var(--pf-node-title-bar-color);\n\t\t\trx: var(--pf-node-body-radius);\n\t\t\try: var(--pf-node-body-radius);\n\t\t}\n\t\t.pict-flow-node-title-bar-bottom {\n\t\t\tfill: var(--pf-node-title-bar-color);\n\t\t}\n\t\t.pict-flow-node-title {\n\t\t\tfill: var(--pf-node-title-fill);\n\t\t\tfont-size: var(--pf-node-title-size);\n\t\t\tfont-weight: var(--pf-node-title-weight);\n\t\t\tfont-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;\n\t\t\tletter-spacing: 0.2px;\n\t\t\tpointer-events: none;\n\t\t}\n\t\t.pict-flow-node-type-label {\n\t\t\tfill: var(--pf-node-type-label-fill);\n\t\t\tfont-size: 9.5px;\n\t\t\tfont-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;\n\t\t\ttext-transform: uppercase;\n\t\t\tletter-spacing: 0.3px;\n\t\t\tpointer-events: none;\n\t\t\topacity: 0;\n\t\t\ttransition: opacity 0.2s;\n\t\t}\n\t\t.pict-flow-node:hover .pict-flow-node-type-label {\n\t\t\topacity: 1;\n\t\t}\n\t\t.pict-flow-node-card-code {\n\t\t\topacity: 0;\n\t\t\ttransition: opacity 0.2s;\n\t\t}\n\t\t.pict-flow-node:hover .pict-flow-node-card-code {\n\t\t\topacity: 1;\n\t\t}\n\t\t/* Title-bar icon: invert SVG paths to white for dark title bars */\n\t\t.pict-flow-node-title-icon {\n\t\t\tfilter: brightness(0) invert(1);\n\t\t}\n\t\t'}getBodyContentCSS(){return'\n\t\t.pict-flow-node-body-content {\n\t\t\tpointer-events: none;\n\t\t}\n\t\t.pict-flow-node-body-content-fo {\n\t\t\toverflow: hidden;\n\t\t}\n\t\t.pict-flow-node-body-content-html {\n\t\t\toverflow: hidden;\n\t\t\twidth: 100%;\n\t\t\theight: 100%;\n\t\t\tbox-sizing: border-box;\n\t\t\tfont-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;\n\t\t\tfont-size: 11px;\n\t\t\tcolor: var(--pf-text-primary);\n\t\t\tpointer-events: auto;\n\t\t}\n\t\t.pict-flow-node-body-content-canvas {\n\t\t\tdisplay: block;\n\t\t\tpointer-events: auto;\n\t\t}\n\t\t'}getNodeVariantCSS(){return"\n\t\t.pict-flow-node-decision .pict-flow-node-body {\n\t\t\tfill: var(--pf-node-decision-fill);\n\t\t\tstroke: var(--pf-node-decision-stroke);\n\t\t\tstroke-width: 1.5;\n\t\t}\n\t\t.pict-flow-node-start .pict-flow-node-body {\n\t\t\tfill: var(--pf-node-start-fill);\n\t\t\tstroke: var(--pf-node-start-stroke);\n\t\t\tstroke-width: 1.5;\n\t\t}\n\t\t.pict-flow-node-end .pict-flow-node-body {\n\t\t\tfill: var(--pf-node-end-fill);\n\t\t\tstroke: var(--pf-node-end-stroke);\n\t\t\tstroke-width: 1.5;\n\t\t}\n\t\t.pict-flow-node-halt .pict-flow-node-body {\n\t\t\tfill: var(--pf-node-halt-fill);\n\t\t\tstroke: var(--pf-node-halt-stroke);\n\t\t\tstroke-width: 1.5;\n\t\t}\n\t\t"}getPortCSS(){return'\n\t\t.pict-flow-port {\n\t\t\tcursor: crosshair;\n\t\t\ttransition: r 0.15s, filter 0.15s;\n\t\t\tfilter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.12));\n\t\t}\n\t\t.pict-flow-port.input {\n\t\t\tfill: var(--pf-port-input-fill);\n\t\t\tstroke: var(--pf-port-stroke);\n\t\t\tstroke-width: var(--pf-port-stroke-width);\n\t\t}\n\t\t.pict-flow-port.output {\n\t\t\tfill: var(--pf-port-output-fill);\n\t\t\tstroke: var(--pf-port-stroke);\n\t\t\tstroke-width: var(--pf-port-stroke-width);\n\t\t}\n\t\t.pict-flow-port:hover {\n\t\t\tr: 7;\n\t\t\tfilter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.20));\n\t\t}\n\t\t/* Port type color overrides */\n\t\t.pict-flow-port.port-type-event-in {\n\t\t\tfill: var(--pf-port-event-in-fill);\n\t\t}\n\t\t.pict-flow-port.port-type-event-out {\n\t\t\tfill: var(--pf-port-event-out-fill);\n\t\t}\n\t\t.pict-flow-port.port-type-setting {\n\t\t\tfill: var(--pf-port-setting-fill);\n\t\t}\n\t\t.pict-flow-port.port-type-value {\n\t\t\tfill: var(--pf-port-value-fill);\n\t\t}\n\t\t.pict-flow-port.port-type-error {\n\t\t\tfill: var(--pf-port-error-fill);\n\t\t}\n\t\t.pict-flow-port-label {\n\t\t\tfont-size: 8px;\n\t\t\tfont-weight: 600;\n\t\t\tfont-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;\n\t\t\tpointer-events: none;\n\t\t}\n\t\t/* Port label badge background */\n\t\t.pict-flow-port-label-bg {\n\t\t\tpointer-events: none;\n\t\t}\n\t\t/* Port labels on hover: hidden by default, revealed on node hover */\n\t\t.pict-flow-node-port-labels-hover .pict-flow-port-label,\n\t\t.pict-flow-node-port-labels-hover .pict-flow-port-label-bg {\n\t\t\topacity: 0;\n\t\t\ttransition: opacity 0.2s;\n\t\t}\n\t\t.pict-flow-node-port-labels-hover:hover .pict-flow-port-label,\n\t\t.pict-flow-node-port-labels-hover:hover .pict-flow-port-label-bg {\n\t\t\topacity: 1;\n\t\t}\n\t\t'}getConnectionCSS(){return"\n\t\t.pict-flow-connection {\n\t\t\tfill: none;\n\t\t\tstroke: var(--pf-connection-stroke);\n\t\t\tstroke-width: 2;\n\t\t\tcursor: pointer;\n\t\t\ttransition: stroke 0.15s;\n\t\t}\n\t\t.pict-flow-connection:hover {\n\t\t\tstroke: var(--pf-connection-stroke-hover);\n\t\t\tstroke-width: 3;\n\t\t}\n\t\t.pict-flow-connection.selected {\n\t\t\tstroke: var(--pf-connection-selected-stroke);\n\t\t\tstroke-width: 3;\n\t\t}\n\t\t/* Connection type color overrides (based on source port type) */\n\t\t.pict-flow-connection.conn-type-event-in {\n\t\t\tstroke: var(--pf-connection-event-in-stroke);\n\t\t}\n\t\t.pict-flow-connection.conn-type-event-out {\n\t\t\tstroke: var(--pf-connection-event-out-stroke);\n\t\t}\n\t\t.pict-flow-connection.conn-type-setting {\n\t\t\tstroke: var(--pf-connection-setting-stroke);\n\t\t}\n\t\t.pict-flow-connection.conn-type-value {\n\t\t\tstroke: var(--pf-connection-value-stroke);\n\t\t}\n\t\t.pict-flow-connection.conn-type-error {\n\t\t\tstroke: var(--pf-connection-error-stroke);\n\t\t}\n\t\t.pict-flow-connection-hitarea {\n\t\t\tfill: none;\n\t\t\tstroke: transparent;\n\t\t\tstroke-width: 12;\n\t\t\tcursor: pointer;\n\t\t}\n\t\t.pict-flow-drag-connection {\n\t\t\tfill: none;\n\t\t\tstroke: var(--pf-node-selected-stroke);\n\t\t\tstroke-width: 2;\n\t\t\tstroke-dasharray: 6 3;\n\t\t\tpointer-events: none;\n\t\t}\n\t\t"}getHandleCSS(){return"\n\t\t.pict-flow-connection-handle {\n\t\t\tfill: var(--pf-panel-bg);\n\t\t\tstroke: var(--pf-node-selected-stroke);\n\t\t\tstroke-width: 2;\n\t\t\tcursor: grab;\n\t\t\ttransition: r 0.15s;\n\t\t\tfilter: drop-shadow(0 1px 2px rgba(0,0,0,0.2));\n\t\t}\n\t\t.pict-flow-connection-handle:hover {\n\t\t\tr: 8;\n\t\t\tstroke-width: 2.5;\n\t\t}\n\t\t.pict-flow-connection-handle-midpoint {\n\t\t\tfill: var(--pf-panel-bg);\n\t\t\tstroke: var(--pf-port-setting-fill);\n\t\t\tstroke-width: 2;\n\t\t\tcursor: grab;\n\t\t\ttransition: r 0.15s;\n\t\t\tfilter: drop-shadow(0 1px 2px rgba(0,0,0,0.2));\n\t\t}\n\t\t.pict-flow-connection-handle-midpoint:hover {\n\t\t\tr: 8;\n\t\t\tstroke-width: 2.5;\n\t\t}\n\t\t"}getTetherCSS(){return"\n\t\t.pict-flow-tether-line {\n\t\t\tfill: none;\n\t\t\tstroke: var(--pf-connection-stroke);\n\t\t\tstroke-width: 1.5;\n\t\t\tstroke-dasharray: 6 4;\n\t\t\tpointer-events: visibleStroke;\n\t\t\tcursor: pointer;\n\t\t}\n\t\t.pict-flow-tether-line.selected {\n\t\t\tstroke: var(--pf-node-selected-stroke);\n\t\t\tstroke-width: 2;\n\t\t}\n\t\t.pict-flow-tether-hitarea {\n\t\t\tfill: none;\n\t\t\tstroke: transparent;\n\t\t\tstroke-width: 10;\n\t\t\tcursor: pointer;\n\t\t}\n\t\t.pict-flow-tether-handle {\n\t\t\tfill: var(--pf-panel-bg);\n\t\t\tstroke: var(--pf-node-selected-stroke);\n\t\t\tstroke-width: 2;\n\t\t\tcursor: grab;\n\t\t\ttransition: r 0.15s;\n\t\t\tfilter: drop-shadow(0 1px 2px rgba(0,0,0,0.2));\n\t\t}\n\t\t.pict-flow-tether-handle:hover {\n\t\t\tr: 8;\n\t\t\tstroke-width: 2.5;\n\t\t}\n\t\t.pict-flow-tether-handle-midpoint {\n\t\t\tfill: var(--pf-panel-bg);\n\t\t\tstroke: var(--pf-port-setting-fill);\n\t\t\tstroke-width: 2;\n\t\t\tcursor: grab;\n\t\t\ttransition: r 0.15s;\n\t\t\tfilter: drop-shadow(0 1px 2px rgba(0,0,0,0.2));\n\t\t}\n\t\t.pict-flow-tether-handle-midpoint:hover {\n\t\t\tr: 8;\n\t\t\tstroke-width: 2.5;\n\t\t}\n\t\t"}getPanelCSS(){return'\n\t\t.pict-flow-node-panel-indicator {\n\t\t\tfill: var(--pf-node-selected-stroke);\n\t\t\tstroke: none;\n\t\t\topacity: 0.6;\n\t\t\tcursor: pointer;\n\t\t\ttransition: opacity 0.15s;\n\t\t}\n\t\t.pict-flow-node-panel-indicator:hover {\n\t\t\topacity: 1.0;\n\t\t}\n\t\t.pict-flow-panel-foreign-object {\n\t\t\toverflow: visible;\n\t\t}\n\t\t.pict-flow-panel {\n\t\t\tbackground: var(--pf-panel-bg);\n\t\t\tborder: 1px solid var(--pf-panel-border);\n\t\t\tborder-radius: var(--pf-panel-radius);\n\t\t\tbox-shadow: var(--pf-panel-shadow);\n\t\t\tdisplay: flex;\n\t\t\tflex-direction: column;\n\t\t\tfont-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;\n\t\t\tfont-size: 13px;\n\t\t\toverflow: hidden;\n\t\t\twidth: 100%;\n\t\t\theight: 100%;\n\t\t\tbox-sizing: border-box;\n\t\t}\n\t\t.pict-flow-panel-titlebar {\n\t\t\tdisplay: flex;\n\t\t\talign-items: center;\n\t\t\tjustify-content: space-between;\n\t\t\tpadding: 8px 12px;\n\t\t\tbackground: var(--pf-panel-titlebar-bg);\n\t\t\tborder-bottom: 1px solid var(--pf-panel-titlebar-border);\n\t\t\tcursor: grab;\n\t\t\tuser-select: none;\n\t\t\t-webkit-user-select: none;\n\t\t\tflex-shrink: 0;\n\t\t}\n\t\t.pict-flow-panel-titlebar.dragging {\n\t\t\tcursor: grabbing;\n\t\t}\n\t\t.pict-flow-panel-title-text {\n\t\t\tfont-weight: 600;\n\t\t\tfont-size: 12px;\n\t\t\tcolor: var(--pf-panel-title-color);\n\t\t\twhite-space: nowrap;\n\t\t\toverflow: hidden;\n\t\t\ttext-overflow: ellipsis;\n\t\t\tletter-spacing: 0.1px;\n\t\t}\n\t\t.pict-flow-panel-close-btn {\n\t\t\tcursor: pointer;\n\t\t\tcolor: var(--pf-button-close-color);\n\t\t\tfont-size: 14px;\n\t\t\tline-height: 1;\n\t\t\tpadding: 4px;\n\t\t\tborder: none;\n\t\t\tbackground: none;\n\t\t\tborder-radius: 4px;\n\t\t\ttransition: background-color 0.15s, color 0.15s;\n\t\t}\n\t\t.pict-flow-panel-close-btn:hover {\n\t\t\tcolor: var(--pf-button-danger-text);\n\t\t\tbackground-color: rgba(231, 76, 60, 0.08);\n\t\t}\n\t\t.pict-flow-panel-content {\n\t\t\tflex: 1;\n\t\t\toverflow-y: auto;\n\t\t\tmin-height: 0;\n\t\t\tpadding: 0;\n\t\t}\n\t\t.pict-flow-panel-tab-pane {\n\t\t\tpadding: 10px 12px;\n\t\t\tbox-sizing: border-box;\n\t\t}\n\t\t'}getInfoPanelCSS(){return'\n\t\t.pict-flow-info-panel {\n\t\t\tpadding: 2px 0;\n\t\t\tfont-size: 12px;\n\t\t\tline-height: 1.5;\n\t\t\tcolor: var(--pf-text-primary);\n\t\t}\n\t\t.pict-flow-info-panel-header {\n\t\t\tfont-size: 13px;\n\t\t\tfont-weight: 600;\n\t\t\tmargin-bottom: 6px;\n\t\t\tcolor: var(--pf-text-heading);\n\t\t}\n\t\t.pict-flow-info-panel-header.with-icon {\n\t\t\tfont-size: 14px;\n\t\t\tdisplay: flex;\n\t\t\talign-items: center;\n\t\t\tgap: 6px;\n\t\t}\n\t\t.pict-flow-info-panel-description {\n\t\t\tfont-size: 11px;\n\t\t\tcolor: var(--pf-text-secondary);\n\t\t\tmargin-bottom: 10px;\n\t\t\tline-height: 1.45;\n\t\t}\n\t\t.pict-flow-info-panel-badges {\n\t\t\tmargin-bottom: 10px;\n\t\t\tdisplay: flex;\n\t\t\tflex-wrap: wrap;\n\t\t\tgap: 4px;\n\t\t}\n\t\t.pict-flow-info-panel-badge {\n\t\t\tdisplay: inline-block;\n\t\t\tpadding: 2px 8px;\n\t\t\tborder-radius: 4px;\n\t\t\tfont-size: 10px;\n\t\t}\n\t\t.pict-flow-info-panel-badge.category {\n\t\t\tbackground: var(--pf-badge-category-bg);\n\t\t\tcolor: var(--pf-badge-category-text);\n\t\t}\n\t\t.pict-flow-info-panel-badge.code {\n\t\t\tbackground: var(--pf-badge-code-bg);\n\t\t\tcolor: var(--pf-badge-code-text);\n\t\t\tfont-family: "SF Mono", "Fira Code", monospace;\n\t\t}\n\t\t.pict-flow-info-panel-section {\n\t\t\tmargin-bottom: 8px;\n\t\t}\n\t\t.pict-flow-info-panel-section-title {\n\t\t\tfont-size: 10px;\n\t\t\tfont-weight: 600;\n\t\t\ttext-transform: uppercase;\n\t\t\tletter-spacing: 0.5px;\n\t\t\tcolor: var(--pf-text-tertiary);\n\t\t\tmargin-bottom: 4px;\n\t\t\tpadding-bottom: 2px;\n\t\t\tborder-bottom: 1px solid var(--pf-divider-light);\n\t\t}\n\t\t.pict-flow-info-panel-port {\n\t\t\tpadding: 3px 8px;\n\t\t\tbackground: var(--pf-port-item-bg);\n\t\t\tmargin-bottom: 3px;\n\t\t\tfont-size: 11px;\n\t\t\tborder-radius: 3px;\n\t\t}\n\t\t.pict-flow-info-panel-port.input {\n\t\t\tborder-left: 3px solid var(--pf-port-input-fill);\n\t\t}\n\t\t.pict-flow-info-panel-port.output {\n\t\t\tborder-left: 3px solid var(--pf-port-output-fill);\n\t\t}\n\t\t/* Info panel port type color overrides */\n\t\t.pict-flow-info-panel-port.port-type-event-in {\n\t\t\tborder-left-color: var(--pf-port-event-in-fill);\n\t\t}\n\t\t.pict-flow-info-panel-port.port-type-event-out {\n\t\t\tborder-left-color: var(--pf-port-event-out-fill);\n\t\t}\n\t\t.pict-flow-info-panel-port.port-type-setting {\n\t\t\tborder-left-color: var(--pf-port-setting-fill);\n\t\t}\n\t\t.pict-flow-info-panel-port.port-type-value {\n\t\t\tborder-left-color: var(--pf-port-value-fill);\n\t\t}\n\t\t.pict-flow-info-panel-port.port-type-error {\n\t\t\tborder-left-color: var(--pf-port-error-fill);\n\t\t}\n\t\t.pict-flow-info-panel-port-constraint {\n\t\t\tcolor: var(--pf-text-tertiary);\n\t\t\tfont-size: 10px;\n\t\t}\n\t\t/* Port summary section appended below form panels */\n\t\t.pict-flow-port-summary {\n\t\t\tmargin-top: 12px;\n\t\t\tpadding-top: 8px;\n\t\t\tborder-top: 1px solid var(--pf-divider-medium);\n\t\t}\n\t\t.pict-flow-info-panel-port.event {\n\t\t\tborder-left: 3px solid var(--pf-port-event-in-fill);\n\t\t}\n\t\t.pict-flow-info-panel-port.value {\n\t\t\tborder-left: 3px solid var(--pf-port-value-fill);\n\t\t}\n\t\t'}getNodePropsEditorCSS(){return"\n\t\t.pict-flow-node-props-fields {\n\t\t\tdisplay: flex;\n\t\t\tflex-direction: column;\n\t\t\tgap: 6px;\n\t\t}\n\t\t.pict-flow-node-props-field {\n\t\t\tdisplay: flex;\n\t\t\talign-items: center;\n\t\t\tgap: 8px;\n\t\t}\n\t\t.pict-flow-node-props-label {\n\t\t\tfont-size: 11px;\n\t\t\tcolor: var(--pf-text-secondary);\n\t\t\tmin-width: 72px;\n\t\t\tflex-shrink: 0;\n\t\t}\n\t\t.pict-flow-node-props-input {\n\t\t\tflex: 1;\n\t\t\tpadding: 3px 6px;\n\t\t\tborder: 1px solid var(--pf-input-border);\n\t\t\tborder-radius: 3px;\n\t\t\tfont-size: 11px;\n\t\t\toutline: none;\n\t\t\tbox-sizing: border-box;\n\t\t\tmin-width: 0;\n\t\t}\n\t\t.pict-flow-node-props-input:focus {\n\t\t\tborder-color: var(--pf-input-border-focus);\n\t\t}\n\t\t.pict-flow-node-props-color {\n\t\t\twidth: 28px;\n\t\t\theight: 24px;\n\t\t\tpadding: 1px;\n\t\t\tcursor: pointer;\n\t\t\tflex: 0 0 28px;\n\t\t}\n\t\t"}getPanelTabsCSS(){return"\n\t\t.pict-flow-panel-resize-handle {\n\t\t\theight: 6px;\n\t\t\tcursor: ns-resize;\n\t\t\tbackground: transparent;\n\t\t\tflex-shrink: 0;\n\t\t\ttransition: background-color 0.15s;\n\t\t\tborder-top: 1px solid var(--pf-panel-titlebar-border);\n\t\t\tdisplay: flex;\n\t\t\talign-items: center;\n\t\t\tjustify-content: center;\n\t\t}\n\t\t.pict-flow-panel-resize-handle::after {\n\t\t\tcontent: '';\n\t\t\twidth: 24px;\n\t\t\theight: 2px;\n\t\t\tborder-radius: 1px;\n\t\t\tbackground: var(--pf-resize-handle-hover);\n\t\t\ttransition: background-color 0.15s, width 0.15s;\n\t\t}\n\t\t.pict-flow-panel-resize-handle:hover::after {\n\t\t\tbackground: var(--pf-button-hover-border);\n\t\t\twidth: 32px;\n\t\t}\n\t\t.pict-flow-panel-tabbar {\n\t\t\tdisplay: flex;\n\t\t\tflex-shrink: 0;\n\t\t\tborder-top: 1px solid var(--pf-panel-titlebar-border);\n\t\t\tbackground: var(--pf-panel-titlebar-bg);\n\t\t}\n\t\t.pict-flow-panel-tab {\n\t\t\tflex: 1;\n\t\t\tpadding: 5px 8px;\n\t\t\tfont-size: 11px;\n\t\t\ttext-align: center;\n\t\t\tcursor: pointer;\n\t\t\tcolor: var(--pf-tab-text);\n\t\t\tborder-top: 2px solid transparent;\n\t\t\ttransition: color 0.15s, border-top-color 0.15s;\n\t\t\tuser-select: none;\n\t\t\t-webkit-user-select: none;\n\t\t}\n\t\t.pict-flow-panel-tab:hover {\n\t\t\tcolor: var(--pf-tab-text-hover);\n\t\t}\n\t\t.pict-flow-panel-tab.active {\n\t\t\tborder-top-color: var(--pf-node-selected-stroke);\n\t\t\tcolor: var(--pf-panel-title-color);\n\t\t\tfont-weight: 600;\n\t\t}\n\t\t.pict-flow-panel-help-content {\n\t\t\tfont-size: 12px;\n\t\t\tline-height: 1.5;\n\t\t\tcolor: var(--pf-text-primary);\n\t\t}\n\t\t.pict-flow-panel-help-content p {\n\t\t\tmargin: 0 0 8px 0;\n\t\t}\n\t\t"}getFullscreenCSS(){return"\n\t\t.pict-flow-fullscreen {\n\t\t\tposition: fixed;\n\t\t\ttop: 0;\n\t\t\tleft: 0;\n\t\t\twidth: 100vw;\n\t\t\theight: 100vh;\n\t\t\tz-index: 9999;\n\t\t\tborder-radius: 0;\n\t\t\tborder: none;\n\t\t\tmin-height: 100vh;\n\t\t}\n\t\t.pict-flow-fullscreen .pict-flow-svg {\n\t\t\tmin-height: calc(100vh - 50px);\n\t\t}\n\t\t"}getToolbarCSS(){return"\n\t\t.pict-flow-toolbar {\n\t\t\tdisplay: flex;\n\t\t\talign-items: center;\n\t\t\tgap: 0.5em;\n\t\t\tpadding: 0.5em 0.75em;\n\t\t\tbackground-color: var(--pf-toolbar-bg);\n\t\t\tborder-bottom: 1px solid var(--pf-toolbar-border);\n\t\t\tflex-wrap: wrap;\n\t\t}\n\t\t.pict-flow-toolbar-group {\n\t\t\tdisplay: flex;\n\t\t\talign-items: center;\n\t\t\tgap: 0.25em;\n\t\t\tpadding-right: 0.75em;\n\t\t\tborder-right: 1px solid var(--pf-toolbar-border);\n\t\t}\n\t\t.pict-flow-toolbar-group:last-child {\n\t\t\tborder-right: none;\n\t\t\tpadding-right: 0;\n\t\t}\n\t\t.pict-flow-toolbar-btn {\n\t\t\tdisplay: inline-flex;\n\t\t\talign-items: center;\n\t\t\tjustify-content: center;\n\t\t\tgap: 0.35em;\n\t\t\tpadding: 0.35em 0.65em;\n\t\t\tborder: 1px solid var(--pf-button-border);\n\t\t\tborder-radius: 4px;\n\t\t\tbackground-color: var(--pf-toolbar-bg);\n\t\t\tcolor: var(--pf-text-primary);\n\t\t\tfont-size: 0.85em;\n\t\t\tcursor: pointer;\n\t\t\ttransition: background-color 0.15s, border-color 0.15s;\n\t\t\tuser-select: none;\n\t\t\t-webkit-user-select: none;\n\t\t}\n\t\t.pict-flow-toolbar-btn:focus {\n\t\t\toutline: none;\n\t\t}\n\t\t.pict-flow-toolbar-btn:hover {\n\t\t\tbackground-color: var(--pf-button-hover-bg);\n\t\t\tborder-color: var(--pf-button-hover-border);\n\t\t}\n\t\t.pict-flow-toolbar-btn:active {\n\t\t\tbackground-color: var(--pf-button-active-bg);\n\t\t}\n\t\t.pict-flow-toolbar-btn-icon {\n\t\t\tdisplay: inline-flex;\n\t\t\talign-items: center;\n\t\t\tjustify-content: center;\n\t\t\tline-height: 1;\n\t\t}\n\t\t.pict-flow-toolbar-btn-icon svg {\n\t\t\tdisplay: block;\n\t\t}\n\t\t.pict-flow-toolbar-btn-text {\n\t\t\twhite-space: nowrap;\n\t\t}\n\t\t.pict-flow-toolbar-btn-chevron {\n\t\t\tdisplay: inline-flex;\n\t\t\talign-items: center;\n\t\t\tmargin-left: 0.15em;\n\t\t}\n\t\t.pict-flow-toolbar-right {\n\t\t\tmargin-left: auto;\n\t\t\tborder-right: none;\n\t\t\tpadding-right: 0;\n\t\t}\n\t\t.pict-flow-toolbar-label {\n\t\t\tfont-size: 0.8em;\n\t\t\tcolor: var(--pf-text-secondary);\n\t\t\tmargin-right: 0.25em;\n\t\t}\n\t\t.pict-flow-toolbar-select {\n\t\t\tpadding: 0.3em 0.5em;\n\t\t\tborder: 1px solid var(--pf-button-border);\n\t\t\tborder-radius: 4px;\n\t\t\tfont-size: 0.85em;\n\t\t\tbackground-color: var(--pf-toolbar-bg);\n\t\t\tcolor: var(--pf-text-primary);\n\t\t}\n\t\t"}getPaletteCSS(){return"\n\t\t.pict-flow-palette-category {\n\t\t\tmargin-bottom: 0.5em;\n\t\t}\n\t\t.pict-flow-palette-category:last-child {\n\t\t\tmargin-bottom: 0;\n\t\t}\n\t\t.pict-flow-palette-category-label {\n\t\t\tfont-size: 0.7em;\n\t\t\tfont-weight: 700;\n\t\t\ttext-transform: uppercase;\n\t\t\tletter-spacing: 0.05em;\n\t\t\tcolor: var(--pf-text-placeholder);\n\t\t\tmargin-bottom: 0.35em;\n\t\t\tpadding-bottom: 0.2em;\n\t\t\tborder-bottom: 1px solid var(--pf-divider-light);\n\t\t}\n\t\t.pict-flow-palette-cards {\n\t\t\tdisplay: flex;\n\t\t\tflex-wrap: wrap;\n\t\t\tgap: 0.35em;\n\t\t}\n\t\t.pict-flow-palette-card {\n\t\t\tdisplay: inline-flex;\n\t\t\talign-items: center;\n\t\t\tgap: 0.35em;\n\t\t\tpadding: 0.35em 0.6em;\n\t\t\tborder: 1px solid var(--pf-card-border);\n\t\t\tborder-radius: 4px;\n\t\t\tbackground-color: var(--pf-panel-bg);\n\t\t\tfont-size: 0.8em;\n\t\t\tcursor: pointer;\n\t\t\ttransition: background-color 0.15s, border-color 0.15s, box-shadow 0.15s;\n\t\t\tuser-select: none;\n\t\t\t-webkit-user-select: none;\n\t\t\tposition: relative;\n\t\t}\n\t\t.pict-flow-palette-card:hover {\n\t\t\tbackground-color: var(--pf-card-hover-bg);\n\t\t\tborder-color: var(--pf-node-selected-stroke);\n\t\t\tbox-shadow: var(--pf-card-hover-shadow);\n\t\t}\n\t\t.pict-flow-palette-card.disabled {\n\t\t\topacity: 0.45;\n\t\t\tpointer-events: none;\n\t\t\tcursor: default;\n\t\t}\n\t\t.pict-flow-palette-card-icon {\n\t\t\tfont-size: 1.1em;\n\t\t\tline-height: 1;\n\t\t}\n\t\t.pict-flow-palette-card-swatch {\n\t\t\twidth: 10px;\n\t\t\theight: 10px;\n\t\t\tborder-radius: 2px;\n\t\t\tflex-shrink: 0;\n\t\t}\n\t\t.pict-flow-palette-card-title {\n\t\t\tfont-weight: 500;\n\t\t\tcolor: var(--pf-text-primary);\n\t\t\twhite-space: nowrap;\n\t\t}\n\t\t.pict-flow-palette-card-code {\n\t\t\tfont-size: 0.8em;\n\t\t\tcolor: var(--pf-text-placeholder);\n\t\t\tfont-family: monospace;\n\t\t}\n\t\t.pict-flow-toolbar-select.layout-select {\n\t\t\tmin-width: 120px;\n\t\t\tmax-width: 200px;\n\t\t}\n\t\t"}getPopupCSS(){return'\n\t\t.pict-flow-toolbar-popup-anchor {\n\t\t\tposition: relative;\n\t\t}\n\t\t.pict-flow-toolbar-popup {\n\t\t\tposition: absolute;\n\t\t\tz-index: 1000;\n\t\t\tbackground: var(--pf-panel-bg);\n\t\t\tborder: 1px solid var(--pf-card-border);\n\t\t\tborder-radius: 6px;\n\t\t\tbox-shadow: 0 4px 16px rgba(0,0,0,0.12);\n\t\t\tmin-width: 240px;\n\t\t\tmax-height: 340px;\n\t\t\toverflow-y: auto;\n\t\t\tpadding: 0.35em 0;\n\t\t\tfont-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;\n\t\t\tfont-size: 13px;\n\t\t}\n\t\t.pict-flow-popup-search-wrapper {\n\t\t\tposition: relative;\n\t\t\tpadding: 0.4em 0.5em;\n\t\t\tborder-bottom: 1px solid var(--pf-divider-light);\n\t\t}\n\t\t.pict-flow-popup-search-icon {\n\t\t\tposition: absolute;\n\t\t\tleft: 0.85em;\n\t\t\ttop: 50%;\n\t\t\ttransform: translateY(-50%);\n\t\t\tpointer-events: none;\n\t\t\tline-height: 1;\n\t\t\tdisplay: flex;\n\t\t\talign-items: center;\n\t\t}\n\t\t.pict-flow-popup-search {\n\t\t\twidth: 100%;\n\t\t\tpadding: 0.4em 0.5em 0.4em 2em;\n\t\t\tborder: 1px solid var(--pf-input-border);\n\t\t\tborder-radius: 4px;\n\t\t\tfont-size: 0.9em;\n\t\t\toutline: none;\n\t\t\tbox-sizing: border-box;\n\t\t}\n\t\t.pict-flow-popup-search:focus {\n\t\t\tborder-color: var(--pf-input-border-focus);\n\t\t}\n\t\t.pict-flow-popup-list-item {\n\t\t\tdisplay: flex;\n\t\t\talign-items: center;\n\t\t\tgap: 0.5em;\n\t\t\tpadding: 0.45em 0.75em;\n\t\t\tcursor: pointer;\n\t\t\ttransition: background-color 0.1s;\n\t\t}\n\t\t.pict-flow-popup-list-item:hover {\n\t\t\tbackground-color: var(--pf-card-hover-bg);\n\t\t}\n\t\t.pict-flow-popup-list-item-icon {\n\t\t\tdisplay: inline-flex;\n\t\t\talign-items: center;\n\t\t\tflex-shrink: 0;\n\t\t\tline-height: 1;\n\t\t}\n\t\t.pict-flow-popup-list-item-label {\n\t\t\tflex: 1;\n\t\t\tcolor: var(--pf-text-primary);\n\t\t\tfont-weight: 500;\n\t\t}\n\t\t.pict-flow-popup-list-item-code {\n\t\t\tfont-size: 0.8em;\n\t\t\tcolor: var(--pf-text-placeholder);\n\t\t\tfont-family: monospace;\n\t\t\tbackground: var(--pf-badge-category-bg);\n\t\t\tpadding: 0.1em 0.4em;\n\t\t\tborder-radius: 3px;\n\t\t}\n\t\t.pict-flow-popup-divider {\n\t\t\theight: 1px;\n\t\t\tbackground: var(--pf-divider-light);\n\t\t\tmargin: 0.25em 0;\n\t\t}\n\t\t.pict-flow-popup-list-empty {\n\t\t\ttext-align: center;\n\t\t\tcolor: var(--pf-text-placeholder);\n\t\t\tpadding: 1.5em 0.75em;\n\t\t\tfont-size: 0.9em;\n\t\t}\n\t\t.pict-flow-popup-layout-save {\n\t\t\tdisplay: flex;\n\t\t\talign-items: center;\n\t\t\tgap: 0.5em;\n\t\t\tpadding: 0.45em 0.75em;\n\t\t\tcursor: pointer;\n\t\t\ttransition: background-color 0.1s;\n\t\t\tcolor: var(--pf-text-primary);\n\t\t\tfont-weight: 500;\n\t\t}\n\t\t.pict-flow-popup-layout-save:hover {\n\t\t\tbackground-color: var(--pf-card-hover-bg);\n\t\t}\n\t\t.pict-flow-popup-layout-save-icon {\n\t\t\tdisplay: inline-flex;\n\t\t\talign-items: center;\n\t\t\tflex-shrink: 0;\n\t\t\tline-height: 1;\n\t\t}\n\t\t.pict-flow-popup-layout-save-input-row {\n\t\t\tdisplay: flex;\n\t\t\talign-items: center;\n\t\t\tgap: 0.35em;\n\t\t\tpadding: 0.35em 0.5em;\n\t\t}\n\t\t.pict-flow-popup-layout-save-input {\n\t\t\tflex: 1;\n\t\t\tpadding: 0.35em 0.5em;\n\t\t\tborder: 1px solid var(--pf-input-border);\n\t\t\tborder-radius: 4px;\n\t\t\tfont-size: 0.9em;\n\t\t\toutline: none;\n\t\t\tbox-sizing: border-box;\n\t\t}\n\t\t.pict-flow-popup-layout-save-input:focus {\n\t\t\tborder-color: var(--pf-input-border-focus);\n\t\t}\n\t\t.pict-flow-popup-layout-save-confirm {\n\t\t\tdisplay: inline-flex;\n\t\t\talign-items: center;\n\t\t\tjustify-content: center;\n\t\t\twidth: 28px;\n\t\t\theight: 28px;\n\t\t\tborder: 1px solid var(--pf-input-border);\n\t\t\tborder-radius: 4px;\n\t\t\tbackground: var(--pf-panel-bg);\n\t\t\tcursor: pointer;\n\t\t\tflex-shrink: 0;\n\t\t\ttransition: background-color 0.15s, border-color 0.15s;\n\t\t\tline-height: 1;\n\t\t}\n\t\t.pict-flow-popup-layout-save-confirm:hover {\n\t\t\tbackground-color: var(--pf-card-hover-bg);\n\t\t\tborder-color: var(--pf-input-border-focus);\n\t\t}\n\t\t.pict-flow-popup-layout-row {\n\t\t\tdisplay: flex;\n\t\t\talign-items: center;\n\t\t\tpadding: 0.45em 0.75em;\n\t\t\tcursor: pointer;\n\t\t\ttransition: background-color 0.1s;\n\t\t}\n\t\t.pict-flow-popup-layout-row:hover {\n\t\t\tbackground-color: var(--pf-card-hover-bg);\n\t\t}\n\t\t.pict-flow-popup-layout-name {\n\t\t\tflex: 1;\n\t\t\tcolor: var(--pf-text-primary);\n\t\t}\n\t\t.pict-flow-popup-layout-delete {\n\t\t\tdisplay: none;\n\t\t\talign-items: center;\n\t\t\tjustify-content: center;\n\t\t\tborder: none;\n\t\t\tbackground: none;\n\t\t\tcolor: var(--pf-button-danger-text);\n\t\t\tcursor: pointer;\n\t\t\tpadding: 2px 4px;\n\t\t\tborder-radius: 3px;\n\t\t\tline-height: 1;\n\t\t}\n\t\t.pict-flow-popup-layout-row:hover .pict-flow-popup-layout-delete {\n\t\t\tdisplay: inline-flex;\n\t\t}\n\t\t.pict-flow-popup-layout-delete:hover {\n\t\t\tbackground-color: var(--pf-button-danger-hover-bg);\n\t\t}\n\t\t.pict-flow-popup-settings-section {\n\t\t\tpadding: 0.5em 0.75em;\n\t\t}\n\t\t.pict-flow-popup-settings-label {\n\t\t\tdisplay: block;\n\t\t\tfont-size: 0.8em;\n\t\t\tfont-weight: 600;\n\t\t\tcolor: var(--pf-text-secondary);\n\t\t\ttext-transform: uppercase;\n\t\t\tletter-spacing: 0.05em;\n\t\t\tmargin-bottom: 0.35em;\n\t\t}\n\t\t.pict-flow-popup-settings-select {\n\t\t\twidth: 100%;\n\t\t\tpadding: 0.4em 0.5em;\n\t\t\tborder: 1px solid var(--pf-input-border);\n\t\t\tborder-radius: 4px;\n\t\t\tfont-size: 0.9em;\n\t\t\tbackground: var(--pf-panel-bg);\n\t\t\tcolor: var(--pf-text-primary);\n\t\t\tcursor: pointer;\n\t\t\toutline: none;\n\t\t\tbox-sizing: border-box;\n\t\t}\n\t\t.pict-flow-popup-settings-select:focus {\n\t\t\tborder-color: var(--pf-input-border-focus);\n\t\t}\n\t\t.pict-flow-popup-settings-slider-row {\n\t\t\tdisplay: flex;\n\t\t\talign-items: center;\n\t\t\tgap: 0.5em;\n\t\t}\n\t\t.pict-flow-popup-settings-slider {\n\t\t\tflex: 1;\n\t\t\t-webkit-appearance: none;\n\t\t\tappearance: none;\n\t\t\theight: 4px;\n\t\t\tbackground: var(--pf-input-border);\n\t\t\tborder-radius: 2px;\n\t\t\toutline: none;\n\t\t\tcursor: pointer;\n\t\t}\n\t\t.pict-flow-popup-settings-slider::-webkit-slider-thumb {\n\t\t\t-webkit-appearance: none;\n\t\t\tappearance: none;\n\t\t\twidth: 14px;\n\t\t\theight: 14px;\n\t\t\tbackground: var(--pf-node-selected-stroke);\n\t\t\tborder-radius: 50%;\n\t\t\tcursor: pointer;\n\t\t}\n\t\t.pict-flow-popup-settings-slider::-moz-range-thumb {\n\t\t\twidth: 14px;\n\t\t\theight: 14px;\n\t\t\tbackground: var(--pf-node-selected-stroke);\n\t\t\tborder-radius: 50%;\n\t\t\tcursor: pointer;\n\t\t\tborder: none;\n\t\t}\n\t\t.pict-flow-popup-settings-slider-value {\n\t\t\tfont-size: 0.85em;\n\t\t\tcolor: var(--pf-text-secondary);\n\t\t\tmin-width: 2.5em;\n\t\t\ttext-align: right;\n\t\t}\n\t\t'}getCollapsedToolbarCSS(){return"\n\t\t.pict-flow-toolbar-collapsed {\n\t\t\tposition: absolute;\n\t\t\ttop: 8px;\n\t\t\tright: 8px;\n\t\t\tz-index: 100;\n\t\t\tdisplay: none;\n\t\t}\n\t\t.pict-flow-toolbar-collapsed.visible {\n\t\t\tdisplay: block;\n\t\t}\n\t\t.pict-flow-toolbar-expand-btn {\n\t\t\twidth: 36px;\n\t\t\theight: 36px;\n\t\t\tborder-radius: 6px;\n\t\t\tborder: 1px solid var(--pf-card-border);\n\t\t\tbackground-color: var(--pf-toolbar-bg);\n\t\t\tbox-shadow: 0 2px 6px rgba(0,0,0,0.1);\n\t\t\tcursor: pointer;\n\t\t\tdisplay: flex;\n\t\t\talign-items: center;\n\t\t\tjustify-content: center;\n\t\t\ttransition: background-color 0.15s, box-shadow 0.15s;\n\t\t}\n\t\t.pict-flow-toolbar-expand-btn:hover {\n\t\t\tbackground-color: var(--pf-button-hover-bg);\n\t\t\tbox-shadow: 0 2px 8px rgba(0,0,0,0.15);\n\t\t}\n\t\t"}getFloatingToolbarCSS(){return"\n\t\t.pict-flow-floating-toolbar {\n\t\t\tposition: absolute;\n\t\t\tz-index: 100;\n\t\t\tdisplay: flex;\n\t\t\tflex-direction: column;\n\t\t\tgap: 2px;\n\t\t\tpadding: 4px;\n\t\t\tborder-radius: 8px;\n\t\t\tborder: 1px solid var(--pf-card-border);\n\t\t\tbackground-color: var(--pf-toolbar-bg);\n\t\t\tbox-shadow: 0 4px 16px rgba(0,0,0,0.12);\n\t\t\tpointer-events: auto;\n\t\t}\n\t\t.pict-flow-floating-grip {\n\t\t\tcursor: grab;\n\t\t\tpadding: 4px;\n\t\t\tborder-radius: 4px;\n\t\t\tdisplay: flex;\n\t\t\talign-items: center;\n\t\t\tjustify-content: center;\n\t\t\ttransition: background-color 0.15s;\n\t\t}\n\t\t.pict-flow-floating-grip:hover {\n\t\t\tbackground-color: var(--pf-button-hover-bg);\n\t\t}\n\t\t.pict-flow-floating-grip:active {\n\t\t\tcursor: grabbing;\n\t\t}\n\t\t.pict-flow-floating-btn {\n\t\t\twidth: 32px;\n\t\t\theight: 32px;\n\t\t\tborder: none;\n\t\t\tborder-radius: 4px;\n\t\t\tbackground-color: transparent;\n\t\t\tcursor: pointer;\n\t\t\tdisplay: flex;\n\t\t\talign-items: center;\n\t\t\tjustify-content: center;\n\t\t\ttransition: background-color 0.15s;\n\t\t}\n\t\t.pict-flow-floating-btn:focus {\n\t\t\toutline: none;\n\t\t}\n\t\t.pict-flow-floating-btn:hover {\n\t\t\tbackground-color: var(--pf-button-hover-bg);\n\t\t}\n\t\t.pict-flow-floating-separator {\n\t\t\theight: 1px;\n\t\t\tbackground-color: var(--pf-divider-light);\n\t\t\tmargin: 2px 4px;\n\t\t}\n\t\t/* Collapsed floating toolbar — grip-only draggable square */\n\t\t.pict-flow-floating-toolbar.collapsed .pict-flow-floating-btn,\n\t\t.pict-flow-floating-toolbar.collapsed .pict-flow-floating-separator {\n\t\t\tdisplay: none;\n\t\t}\n\t\t.pict-flow-floating-toolbar.collapsed {\n\t\t\tpadding: 0;\n\t\t\tborder-radius: 6px;\n\t\t}\n\t\t.pict-flow-floating-toolbar.collapsed .pict-flow-floating-grip {\n\t\t\twidth: 32px;\n\t\t\theight: 32px;\n\t\t\tpadding: 0;\n\t\t\tdisplay: flex;\n\t\t\talign-items: center;\n\t\t\tjustify-content: center;\n\t\t}\n\t\t.pict-flow-floating-toolbar.collapsed .pict-flow-floating-grip span {\n\t\t\tdisplay: flex;\n\t\t\talign-items: center;\n\t\t\tjustify-content: center;\n\t\t\tline-height: 1;\n\t\t}\n\t\t"}getIconCSS(){return"\n\t\t.pict-flow-icon-svg {\n\t\t\tpointer-events: none;\n\t\t}\n\t\t.pict-flow-palette-card-icon svg {\n\t\t\tdisplay: inline-block;\n\t\t\tvertical-align: middle;\n\t\t}\n\t\t.pict-flow-toolbar-btn-icon {\n\t\t\tdisplay: inline-flex;\n\t\t\talign-items: center;\n\t\t\tjustify-content: center;\n\t\t\tline-height: 1;\n\t\t}\n\t\t.pict-flow-toolbar-btn-icon svg {\n\t\t\tdisplay: block;\n\t\t\tvertical-align: middle;\n\t\t}\n\t\t.pict-flow-info-panel-header.with-icon svg {\n\t\t\tdisplay: inline-block;\n\t\t\tvertical-align: middle;\n\t\t\tmargin-right: 4px;\n\t\t}\n\t\t.pict-flow-panel-close-icon {\n\t\t\tdisplay: inline-flex;\n\t\t\talign-items: center;\n\t\t\tjustify-content: center;\n\t\t\tline-height: 1;\n\t\t}\n\t\t.pict-flow-panel-close-icon svg {\n\t\t\tdisplay: block;\n\t\t}\n\t\t.pict-flow-palette-toggle-arrow svg {\n\t\t\tdisplay: block;\n\t\t}\n\t\t"}getBracketNodeCSS(){return"\n\t\t/* Bracket outline path */\n\t\t.pict-flow-node-bracket {\n\t\t\tfill: none;\n\t\t\tstroke: var(--pf-node-body-stroke);\n\t\t\tstroke-width: 2;\n\t\t\tstroke-linecap: round;\n\t\t\tstroke-linejoin: round;\n\t\t}\n\t\t.pict-flow-node.selected .pict-flow-node-bracket {\n\t\t\tstroke: var(--pf-node-selected-stroke);\n\t\t\tstroke-width: 2;\n\t\t}\n\t\t.pict-flow-node:hover .pict-flow-node-bracket {\n\t\t\tstroke: var(--pf-node-body-stroke-hover);\n\t\t\tstroke-width: 1.5;\n\t\t}\n\n\t\t/* Bracket fill rects: no stroke, no rounded corners.\n\t\t Uses parent-qualified selectors to beat variant rules\n\t\t (e.g. .pict-flow-node-start .pict-flow-node-body). */\n\t\t.pict-flow-node .pict-flow-node-bracket-fill,\n\t\t.pict-flow-node .pict-flow-node-bracket-title-fill {\n\t\t\tstroke: none;\n\t\t\tstroke-width: 0;\n\t\t\trx: 0;\n\t\t\try: 0;\n\t\t}\n\t\t/* Beat hover rule: .pict-flow-node:hover .pict-flow-node-body */\n\t\t.pict-flow-node:hover .pict-flow-node-bracket-fill,\n\t\t.pict-flow-node:hover .pict-flow-node-bracket-title-fill {\n\t\t\tstroke: none;\n\t\t\tstroke-width: 0;\n\t\t}\n\t\t/* Beat selected rule: .pict-flow-node.selected .pict-flow-node-body */\n\t\t.pict-flow-node.selected .pict-flow-node-bracket-fill,\n\t\t.pict-flow-node.selected .pict-flow-node-bracket-title-fill {\n\t\t\tstroke: none;\n\t\t\tstroke-width: 0;\n\t\t}\n\t\t"}generateCSS(){let t=this.getContainerCSS()+this.getNodeCSS()+this.getBodyContentCSS()+this.getNodeVariantCSS()+this.getPortCSS()+this.getConnectionCSS()+this.getHandleCSS()+this.getTetherCSS()+this.getPanelCSS()+this.getInfoPanelCSS()+this.getNodePropsEditorCSS()+this.getPanelTabsCSS()+this.getBracketNodeCSS()+this.getFullscreenCSS()+this.getToolbarCSS()+this.getPaletteCSS()+this.getPopupCSS()+this.getCollapsedToolbarCSS()+this.getFloatingToolbarCSS()+this.getIconCSS();if(this._FlowView&&this._FlowView._ThemeProvider){let e=this._FlowView._ThemeProvider.getActiveTheme();if(e&&e.CSSVariables&&Object.keys(e.CSSVariables).length>0){let o=".pict-flow-container {\n";for(let t in e.CSSVariables)o+="\t"+t+": "+e.CSSVariables[t]+";\n";o+="}\n",t+=o}e&&e.AdditionalCSS&&(t+=e.AdditionalCSS)}return t}registerCSS(){this.fable&&this.fable.CSSMap?(this.fable.CSSMap.removeCSS("PictSectionFlow-CSS"),this.fable.CSSMap.addCSS("PictSectionFlow-CSS",this.generateCSS(),500,"PictProviderFlowCSS"),this.fable.CSSMap.injectCSS()):this.log.warn("PictProviderFlowCSS: CSSMap not available; CSS not registered.")}},e.exports.default_configuration=n},{"fable-serviceproviderbase":89}],100:[function(t,e,o){const i=t("fable-serviceproviderbase");e.exports=class extends i{constructor(t,e,o){super(t,e,o),this.serviceType="PictProviderFlowConnectorShapes",this._FlowView=e&&e.FlowView?e.FlowView:null,this._DefaultShapes={port:{ElementType:"circle",Attributes:{r:"5"},ClassName:"pict-flow-port"},"panel-indicator":{ElementType:"rect",Attributes:{rx:"2",ry:"2"},ClassName:"pict-flow-node-panel-indicator"},"connection-path":{ElementType:"path",Attributes:{},ClassName:"pict-flow-connection"},"connection-hitarea":{ElementType:"path",Attributes:{},ClassName:"pict-flow-connection-hitarea"},"connection-handle":{ElementType:"circle",Attributes:{r:"6"},ClassName:"pict-flow-connection-handle"},"connection-handle-midpoint":{ElementType:"circle",Attributes:{r:"6"},ClassName:"pict-flow-connection-handle-midpoint"},"drag-connection":{ElementType:"path",Attributes:{},ClassName:"pict-flow-drag-connection"},"tether-path":{ElementType:"path",Attributes:{},ClassName:"pict-flow-tether-line"},"tether-hitarea":{ElementType:"path",Attributes:{},ClassName:"pict-flow-tether-hitarea"},"tether-handle":{ElementType:"circle",Attributes:{r:"6"},ClassName:"pict-flow-tether-handle"},"tether-handle-midpoint":{ElementType:"circle",Attributes:{r:"6"},ClassName:"pict-flow-tether-handle-midpoint"},"arrowhead-connection":{MarkerWidth:"5",MarkerHeight:"7",RefX:"7.5",RefY:"3.5",Points:"0 0, 5 3.5, 0 7",Fill:"#95a5a6"},"arrowhead-connection-selected":{MarkerWidth:"5",MarkerHeight:"7",RefX:"7.5",RefY:"3.5",Points:"0 0, 5 3.5, 0 7",Fill:"#3498db"},"arrowhead-tether":{MarkerWidth:"4",MarkerHeight:"6",RefX:"6",RefY:"3",Points:"0 0, 4 3, 0 6",Fill:"#95a5a6"}},this._OriginalShapes=JSON.parse(JSON.stringify(this._DefaultShapes))}applyThemeOverrides(t){if(t&&"object"==typeof t)for(let e in t)this._DefaultShapes.hasOwnProperty(e)?Object.assign(this._DefaultShapes[e],t[e]):this._DefaultShapes[e]=t[e]}resetToDefaults(){this._DefaultShapes=JSON.parse(JSON.stringify(this._OriginalShapes))}getShapeConfig(t){return this._DefaultShapes.hasOwnProperty(t)?this._DefaultShapes[t]:null}setShapeConfig(t,e){this._DefaultShapes[t]=e}getShapeKeys(){return Object.keys(this._DefaultShapes)}createPortElement(t,e,o){let i=this._DefaultShapes.port,n=this._FlowView._SVGHelperProvider.createSVGElement(i.ElementType),a=i.ClassName+" "+t.Direction;t.PortType&&(a+=" port-type-"+t.PortType),n.setAttribute("class",a),n.setAttribute("cx",String(e.x)),n.setAttribute("cy",String(e.y));for(let t in i.Attributes)n.setAttribute(t,i.Attributes[t]);return n.setAttribute("data-port-hash",t.Hash),n.setAttribute("data-node-hash",o),n.setAttribute("data-port-direction",t.Direction),t.PortType&&n.setAttribute("data-port-type",t.PortType),n.setAttribute("data-element-type","port"),n}createPanelIndicatorElement(t,e,o,i,n){let a=this._DefaultShapes["panel-indicator"],r=this._FlowView._SVGHelperProvider.createSVGElement(a.ElementType);r.setAttribute("class",a.ClassName),r.setAttribute("x",String(e)),r.setAttribute("y",String(o)),r.setAttribute("width",String(i)),r.setAttribute("height",String(n));for(let t in a.Attributes)r.setAttribute(t,a.Attributes[t]);return r.setAttribute("data-node-hash",t),r.setAttribute("data-element-type","panel-indicator"),r}createConnectionPathElement(t,e,o,i){let n=this._DefaultShapes["connection-path"],a=this._FlowView._SVGHelperProvider.createSVGElement(n.ElementType);a.setAttribute("class",n.ClassName+(o?" selected":"")),a.setAttribute("d",t),a.setAttribute("data-connection-hash",e),a.setAttribute("data-element-type","connection");o?this._DefaultShapes["arrowhead-connection-selected"]:this._DefaultShapes["arrowhead-connection"];let r=o?"flow-arrowhead-selected-"+i:"flow-arrowhead-"+i;return a.setAttribute("marker-end","url(#"+r+")"),a}createConnectionHitAreaElement(t,e){let o=this._DefaultShapes["connection-hitarea"],i=this._FlowView._SVGHelperProvider.createSVGElement(o.ElementType);return i.setAttribute("class",o.ClassName),i.setAttribute("d",t),i.setAttribute("data-connection-hash",e),i.setAttribute("data-element-type","connection-hitarea"),i}createHandleElement(t,e,o,i,n){let a=this._DefaultShapes[n]||this._DefaultShapes["connection-handle"],r=this._FlowView._SVGHelperProvider.createSVGElement(a.ElementType);r.setAttribute("class",a.ClassName),r.setAttribute("cx",String(o)),r.setAttribute("cy",String(i));for(let t in a.Attributes)r.setAttribute(t,a.Attributes[t]);return r.setAttribute("data-handle-type",e),r}createFullHandle(t,e,o,i,n,a,r,s){let l=this.createHandleElement(e,o,i,n,a);return l.setAttribute("data-element-type",r),l.setAttribute(s,e),t.appendChild(l),l}createDragConnectionElement(t){let e=this._DefaultShapes["drag-connection"],o=this._FlowView._SVGHelperProvider.createSVGElement(e.ElementType);return o.setAttribute("class",e.ClassName),o.setAttribute("d",t),o}createTetherPathElement(t,e,o,i){let n=this._DefaultShapes["tether-path"],a=this._FlowView._SVGHelperProvider.createSVGElement(n.ElementType);return a.setAttribute("class",n.ClassName+(o?" selected":"")),a.setAttribute("d",t),a.setAttribute("marker-end","url(#flow-tether-arrowhead-"+i+")"),a.setAttribute("data-element-type","tether"),a.setAttribute("data-panel-hash",e),a}createTetherHitAreaElement(t,e){let o=this._DefaultShapes["tether-hitarea"],i=this._FlowView._SVGHelperProvider.createSVGElement(o.ElementType);return i.setAttribute("class",o.ClassName),i.setAttribute("d",t),i.setAttribute("data-element-type","tether-hitarea"),i.setAttribute("data-panel-hash",e),i}generateMarkerDefs(t){let e=this._DefaultShapes["arrowhead-connection"],o=this._DefaultShapes["arrowhead-connection-selected"],i=this._DefaultShapes["arrowhead-tether"],n="";n+='<marker id="flow-arrowhead-'+t+'" markerWidth="'+e.MarkerWidth+'" markerHeight="'+e.MarkerHeight+'" refX="'+e.RefX+'" refY="'+e.RefY+'" orient="auto" markerUnits="strokeWidth"><polygon points="'+e.Points+'" fill="'+e.Fill+'" /></marker>';let a={"event-in":"#3498db","event-out":"#2ecc71",setting:"#e67e22",value:"#f1c40f",error:"#e74c3c"};for(let o in a)n+='<marker id="flow-arrowhead-'+o+"-"+t+'" markerWidth="'+e.MarkerWidth+'" markerHeight="'+e.MarkerHeight+'" refX="'+e.RefX+'" refY="'+e.RefY+'" orient="auto" markerUnits="strokeWidth"><polygon points="'+e.Points+'" fill="'+a[o]+'" /></marker>';return n+='<marker id="flow-arrowhead-selected-'+t+'" markerWidth="'+o.MarkerWidth+'" markerHeight="'+o.MarkerHeight+'" refX="'+o.RefX+'" refY="'+o.RefY+'" orient="auto" markerUnits="strokeWidth"><polygon points="'+o.Points+'" fill="'+o.Fill+'" /></marker>',n+='<marker id="flow-tether-arrowhead-'+t+'" markerWidth="'+i.MarkerWidth+'" markerHeight="'+i.MarkerHeight+'" refX="'+i.RefX+'" refY="'+i.RefY+'" orient="auto" markerUnits="strokeWidth"><polygon points="'+i.Points+'" fill="'+i.Fill+'" /></marker>',n}}},{"fable-serviceproviderbase":89}],101:[function(t,e,o){const i=t("pict-provider"),n={ProviderIdentifier:"PictProviderFlowEventHandler"};e.exports=class extends i{constructor(t,e,o){super(t,Object.assign({},n,e),o),this.serviceType="PictProviderFlowEventHandler",this._FlowView=e&&e.FlowView?e.FlowView:null,this._Handlers={}}registerHandler(t,e,o){if("function"!=typeof e)return this.log.warn(`PictProviderFlowEventHandler registerHandler: handler for '${t}' is not a function`),null;this._Handlers[t]||(this._Handlers[t]=[]);let i=o||`handler-${this.fable.getUUID()}`;return this._Handlers[t].push({Hash:i,Handler:e}),this.log.trace(`PictProviderFlowEventHandler registered handler '${i}' for event '${t}'`),i}removeHandler(t,e){if(!this._Handlers[t])return!1;let o=this._Handlers[t].findIndex(t=>t.Hash===e);return o>=0&&(this._Handlers[t].splice(o,1),!0)}removeAllHandlers(t){t?this._Handlers[t]=[]:this._Handlers={}}fireEvent(t,e){if(this.log.trace(`PictProviderFlowEventHandler firing event '${t}'`),this._Handlers[t]&&0!==this._Handlers[t].length)for(let o=0;o<this._Handlers[t].length;o++){let i=this._Handlers[t][o];try{i.Handler(e,this._FlowView)}catch(e){this.log.error(`PictProviderFlowEventHandler error in handler '${i.Hash}' for event '${t}': ${e.message}`)}}}hasHandlers(t){return!!(this._Handlers[t]&&this._Handlers[t].length>0)}getHandlerCount(t){return this._Handlers[t]?this._Handlers[t].length:0}},e.exports.default_configuration=n},{"pict-provider":91}],102:[function(t,e,o){const i=t("fable-serviceproviderbase");e.exports=class extends i{constructor(t,e,o){super(t,e,o),this.serviceType="PictProviderFlowGeometry"}getEdgeFromSide(t){switch(t){case"left-top":case"left":case"left-bottom":return"left";case"right-top":case"right":case"right-bottom":default:return"right";case"top-left":case"top":case"top-right":return"top";case"bottom-left":case"bottom":case"bottom-right":return"bottom"}}sideDirection(t){switch(this.getEdgeFromSide(t)){case"left":return{dx:-1,dy:0};case"right":default:return{dx:1,dy:0};case"top":return{dx:0,dy:-1};case"bottom":return{dx:0,dy:1}}}getEdgeCenter(t,e){switch(e){case"left":return{x:t.X,y:t.Y+t.Height/2};case"right":default:return{x:t.X+t.Width,y:t.Y+t.Height/2};case"top":return{x:t.X+t.Width/2,y:t.Y};case"bottom":return{x:t.X+t.Width/2,y:t.Y+t.Height}}}getPortLocalPosition(t,e,o,i,n,a,r){let s=this.getEdgeFromSide(t),l=r?this._computeAdaptiveZone(t,r):this._getZoneFromSide(t),c=this._getZoneFromSide(t),d="start";if(c.start>=.5?d="end":c.start>=.17&&(d="center"),"left"===s||"right"===s){let t="left"===s?0:i,r=n-a-16,c=a+r*l.start,p=16,h=r*(l.end-l.start)-p*(o+1);h<0&&(h=0);let u=0;return"end"===d?u=h:"center"===d&&(u=h/2),{x:t,y:c+u+p*(e+1)}}let p="top"===s?0:n,h=i*l.start,u=i*(l.end-l.start)-16*(o+1);u<0&&(u=0);let f=0;return"end"===d?f=u:"center"===d&&(f=u/2),{x:h+f+16*(e+1),y:p}}_getZoneFromSide(t){switch(t){case"left-top":case"right-top":case"top-left":case"bottom-left":return{start:0,end:.333};case"left":case"right":case"top":case"bottom":return{start:.333,end:.667};case"left-bottom":case"right-bottom":case"top-right":case"bottom-right":return{start:.667,end:1};default:return{start:0,end:1}}}_getZoneKeysForEdge(t){switch(t){case"left":return["left-top","left","left-bottom"];case"right":default:return["right-top","right","right-bottom"];case"top":return["top-left","top","top-right"];case"bottom":return["bottom-left","bottom","bottom-right"]}}_computeAdaptiveZone(t,e){let o=this.getEdgeFromSide(t),i=this._getZoneKeysForEdge(o),n=0,a={};for(let t=0;t<i.length;t++){let o=i[t],r=e[o]||0,s=r>0?16*(r+1):0;a[o]=s,n+=s}if(0===n)return this._getZoneFromSide(t);let r=0;for(let e=0;e<i.length;e++){let o=i[e],s=a[o]/n;if(o===t)return{start:r,end:r+s};r+=s}return this._getZoneFromSide(t)}buildPortCountsBySide(t){let e={};if(!t||!Array.isArray(t))return e;for(let o=0;o<t.length;o++){let i=t[o].Side||("input"===t[o].Direction?"left":"right");e[i]||(e[i]=0),e[i]++}return e}computeMinimumNodeHeight(t,e){if(!t||!Array.isArray(t)||0===t.length)return 0;let o=this.buildPortCountsBySide(t),i={};for(let t in o){let e=this.getEdgeFromSide(t);if("left"!==e&&"right"!==e)continue;let n=16*(o[t]+1);i[e]||(i[e]=0),i[e]+=n}let n=0;for(let t in i){let o=e+16+i[t];o>n&&(n=o)}return Math.ceil(n)}}},{"fable-serviceproviderbase":89}],103:[function(t,e,o){const i=t("fable-serviceproviderbase"),n={ProviderIdentifier:"PictProviderFlowIcons"},a={ITE:'<svg xmlns="http://www.w3.org/2000/svg" width="{FlowIconSize}" height="{FlowIconSize}" viewBox="0 0 24 24" fill="none" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="6" r="3" fill="#d5e8f7" stroke="#2c3e50" stroke-width="2"/><circle cx="6" cy="18" r="2.5" fill="#d5e8f7" stroke="#2c3e50" stroke-width="2"/><circle cx="18" cy="18" r="2.5" fill="#d5e8f7" stroke="#2c3e50" stroke-width="2"/><path d="M12 9v2M9.5 12.5L6 15.5M14.5 12.5L18 15.5" stroke="#2c3e50" stroke-width="2"/></svg>',SW:'<svg xmlns="http://www.w3.org/2000/svg" width="{FlowIconSize}" height="{FlowIconSize}" viewBox="0 0 24 24" fill="none" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="4" fill="#d5e8f7" stroke="#2c3e50" stroke-width="2"/><path d="M3 12h5M16 12h5M14.8 9.2l3.7-5.2M14.8 14.8l3.7 5.2" stroke="#2c3e50" stroke-width="2"/></svg>',EACH:'<svg xmlns="http://www.w3.org/2000/svg" width="{FlowIconSize}" height="{FlowIconSize}" viewBox="0 0 24 24" fill="none" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="3" width="7" height="7" rx="1.5" fill="#d5e8f7" stroke="#2c3e50" stroke-width="2"/><rect x="14" y="3" width="7" height="7" rx="1.5" fill="#d5e8f7" stroke="#2c3e50" stroke-width="2"/><rect x="3" y="14" width="7" height="7" rx="1.5" fill="#d5e8f7" stroke="#2c3e50" stroke-width="2"/><rect x="14" y="14" width="7" height="7" rx="1.5" fill="#d5e8f7" stroke="#2c3e50" stroke-width="2"/></svg>',FREAD:'<svg xmlns="http://www.w3.org/2000/svg" width="{FlowIconSize}" height="{FlowIconSize}" viewBox="0 0 24 24" fill="none" stroke-linecap="round" stroke-linejoin="round"><path d="M13 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V9l-7-7z" fill="#d5e8f7" stroke="#2c3e50" stroke-width="2"/><path d="M13 2v7h7" stroke="#2c3e50" stroke-width="2"/><path d="M9 13h6M9 17h4" stroke="#2c3e50" stroke-width="2"/></svg>',FWRITE:'<svg xmlns="http://www.w3.org/2000/svg" width="{FlowIconSize}" height="{FlowIconSize}" viewBox="0 0 24 24" fill="none" stroke-linecap="round" stroke-linejoin="round"><path d="M13 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V9l-7-7z" fill="#d5e8f7" stroke="#2c3e50" stroke-width="2"/><path d="M13 2v7h7" stroke="#2c3e50" stroke-width="2"/><path d="M12 13v5M9.5 15.5L12 13l2.5 2.5" stroke="#2c3e50" stroke-width="2"/></svg>',LOG:'<svg xmlns="http://www.w3.org/2000/svg" width="{FlowIconSize}" height="{FlowIconSize}" viewBox="0 0 24 24" fill="none" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="3" width="18" height="18" rx="3" fill="#d5e8f7" stroke="#2c3e50" stroke-width="2"/><circle cx="7.5" cy="8" r="1" fill="#2c3e50"/><circle cx="7.5" cy="12" r="1" fill="#2c3e50"/><circle cx="7.5" cy="16" r="1" fill="#2c3e50"/><path d="M11 8h5.5M11 12h5.5M11 16h3.5" stroke="#2c3e50" stroke-width="2"/></svg>',GET:'<svg xmlns="http://www.w3.org/2000/svg" width="{FlowIconSize}" height="{FlowIconSize}" viewBox="0 0 24 24" fill="none" stroke-linecap="round" stroke-linejoin="round"><circle cx="10.5" cy="10.5" r="6.5" fill="#d5e8f7" stroke="#2c3e50" stroke-width="2"/><path d="M21 21l-5.15-5.15" stroke="#2c3e50" stroke-width="2"/></svg>',SET:'<svg xmlns="http://www.w3.org/2000/svg" width="{FlowIconSize}" height="{FlowIconSize}" viewBox="0 0 24 24" fill="none" stroke-linecap="round" stroke-linejoin="round"><path d="M16.5 3.5a2.12 2.12 0 0 1 3 3L7 19l-4.5 1.5L4 16Z" fill="#d5e8f7" stroke="#2c3e50" stroke-width="2"/><path d="M14 6l3 3" stroke="#2c3e50" stroke-width="2"/></svg>',fullscreen:'<svg xmlns="http://www.w3.org/2000/svg" width="{FlowIconSize}" height="{FlowIconSize}" viewBox="0 0 24 24" fill="none" stroke="#2c3e50" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M15 3h6v6"/><path d="M9 21H3v-6"/><path d="M21 3l-7 7"/><path d="M3 21l7-7"/></svg>',"exit-fullscreen":'<svg xmlns="http://www.w3.org/2000/svg" width="{FlowIconSize}" height="{FlowIconSize}" viewBox="0 0 24 24" fill="none" stroke="#2c3e50" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M4 14h6v6"/><path d="M20 10h-6V4"/><path d="M14 10l7-7"/><path d="M3 21l7-7"/></svg>',close:'<svg xmlns="http://www.w3.org/2000/svg" width="{FlowIconSize}" height="{FlowIconSize}" viewBox="0 0 24 24" fill="none" stroke="#2c3e50" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="18" y1="6" x2="6" y2="18"/><line x1="6" y1="6" x2="18" y2="18"/></svg>',"chevron-down":'<svg xmlns="http://www.w3.org/2000/svg" width="{FlowIconSize}" height="{FlowIconSize}" viewBox="0 0 24 24" fill="none" stroke="#2c3e50" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="6 9 12 15 18 9"/></svg>',search:'<svg xmlns="http://www.w3.org/2000/svg" width="{FlowIconSize}" height="{FlowIconSize}" viewBox="0 0 24 24" fill="none" stroke-linecap="round" stroke-linejoin="round"><circle cx="11" cy="11" r="7" fill="#d5e8f7" stroke="#2c3e50" stroke-width="2"/><path d="M21 21l-4.35-4.35" stroke="#2c3e50" stroke-width="2"/></svg>',cards:'<svg xmlns="http://www.w3.org/2000/svg" width="{FlowIconSize}" height="{FlowIconSize}" viewBox="0 0 24 24" fill="none" stroke-linecap="round" stroke-linejoin="round"><rect x="2" y="7" width="16" height="12" rx="2" fill="#d5e8f7" stroke="#2c3e50" stroke-width="2"/><path d="M6 7V5a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2h-2" stroke="#2c3e50" stroke-width="2"/></svg>',layout:'<svg xmlns="http://www.w3.org/2000/svg" width="{FlowIconSize}" height="{FlowIconSize}" viewBox="0 0 24 24" fill="none" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="3" width="8" height="10" rx="1.5" fill="#d5e8f7" stroke="#2c3e50" stroke-width="2"/><rect x="13" y="3" width="8" height="6" rx="1.5" fill="#d5e8f7" stroke="#2c3e50" stroke-width="2"/><rect x="3" y="15" width="8" height="6" rx="1.5" fill="#d5e8f7" stroke="#2c3e50" stroke-width="2"/><rect x="13" y="11" width="8" height="10" rx="1.5" fill="#d5e8f7" stroke="#2c3e50" stroke-width="2"/></svg>',collapse:'<svg xmlns="http://www.w3.org/2000/svg" width="{FlowIconSize}" height="{FlowIconSize}" viewBox="0 0 24 24" fill="none" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="3" width="18" height="18" rx="3" fill="#d5e8f7" stroke="#2c3e50" stroke-width="2"/><path d="M8 12h8" stroke="#2c3e50" stroke-width="2"/></svg>',expand:'<svg xmlns="http://www.w3.org/2000/svg" width="{FlowIconSize}" height="{FlowIconSize}" viewBox="0 0 24 24" fill="none" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="3" width="18" height="18" rx="3" fill="#d5e8f7" stroke="#2c3e50" stroke-width="2"/><path d="M12 8v8M8 12h8" stroke="#2c3e50" stroke-width="2"/></svg>',grip:'<svg xmlns="http://www.w3.org/2000/svg" width="{FlowIconSize}" height="{FlowIconSize}" viewBox="0 0 24 24" fill="#2c3e50"><circle cx="9" cy="5" r="1.5"/><circle cx="15" cy="5" r="1.5"/><circle cx="9" cy="12" r="1.5"/><circle cx="15" cy="12" r="1.5"/><circle cx="9" cy="19" r="1.5"/><circle cx="15" cy="19" r="1.5"/></svg>',settings:'<svg xmlns="http://www.w3.org/2000/svg" width="{FlowIconSize}" height="{FlowIconSize}" viewBox="0 0 24 24" fill="none" stroke="#2c3e50" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="3" fill="#d5e8f7"/><path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 1 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 1 1-2.83-2.83l.06-.06A1.65 1.65 0 0 0 4.68 15a1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 1 1 2.83-2.83l.06.06A1.65 1.65 0 0 0 9 4.68a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 1 1 2.83 2.83l-.06.06A1.65 1.65 0 0 0 19.4 9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z"/></svg>',plus:'<svg xmlns="http://www.w3.org/2000/svg" width="{FlowIconSize}" height="{FlowIconSize}" viewBox="0 0 24 24" fill="none" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="9" fill="#d5e8f7" stroke="#2c3e50" stroke-width="2"/><path d="M12 8v8M8 12h8" stroke="#2c3e50" stroke-width="2"/></svg>',trash:'<svg xmlns="http://www.w3.org/2000/svg" width="{FlowIconSize}" height="{FlowIconSize}" viewBox="0 0 24 24" fill="none" stroke-linecap="round" stroke-linejoin="round"><path d="M3 6h18" stroke="#2c3e50" stroke-width="2"/><path d="M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2" stroke="#2c3e50" stroke-width="2"/><rect x="5" y="6" width="14" height="14" rx="2" fill="#d5e8f7" stroke="#2c3e50" stroke-width="2"/><path d="M10 11v6M14 11v6" stroke="#2c3e50" stroke-width="2"/></svg>',save:'<svg xmlns="http://www.w3.org/2000/svg" width="{FlowIconSize}" height="{FlowIconSize}" viewBox="0 0 24 24" fill="none" stroke-linecap="round" stroke-linejoin="round"><path d="M19 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11l5 5v11a2 2 0 0 1-2 2z" fill="#d5e8f7" stroke="#2c3e50" stroke-width="2"/><path d="M17 21v-8H7v8" stroke="#2c3e50" stroke-width="2"/><path d="M7 3v5h8" stroke="#2c3e50" stroke-width="2"/></svg>',"auto-layout":'<svg xmlns="http://www.w3.org/2000/svg" width="{FlowIconSize}" height="{FlowIconSize}" viewBox="0 0 24 24" fill="none" stroke-linecap="round" stroke-linejoin="round"><rect x="8" y="2" width="8" height="6" rx="1.5" fill="#d5e8f7" stroke="#2c3e50" stroke-width="2"/><rect x="2" y="16" width="8" height="6" rx="1.5" fill="#d5e8f7" stroke="#2c3e50" stroke-width="2"/><rect x="14" y="16" width="8" height="6" rx="1.5" fill="#d5e8f7" stroke="#2c3e50" stroke-width="2"/><path d="M12 8v4M6 16v-4h12v4" stroke="#2c3e50" stroke-width="2"/></svg>',"zoom-in":'<svg xmlns="http://www.w3.org/2000/svg" width="{FlowIconSize}" height="{FlowIconSize}" viewBox="0 0 24 24" fill="none" stroke-linecap="round" stroke-linejoin="round"><circle cx="11" cy="11" r="7" fill="#d5e8f7" stroke="#2c3e50" stroke-width="2"/><path d="M21 21l-4.35-4.35" stroke="#2c3e50" stroke-width="2"/><path d="M11 8v6M8 11h6" stroke="#2c3e50" stroke-width="2"/></svg>',"zoom-out":'<svg xmlns="http://www.w3.org/2000/svg" width="{FlowIconSize}" height="{FlowIconSize}" viewBox="0 0 24 24" fill="none" stroke-linecap="round" stroke-linejoin="round"><circle cx="11" cy="11" r="7" fill="#d5e8f7" stroke="#2c3e50" stroke-width="2"/><path d="M21 21l-4.35-4.35" stroke="#2c3e50" stroke-width="2"/><path d="M8 11h6" stroke="#2c3e50" stroke-width="2"/></svg>',"zoom-fit":'<svg xmlns="http://www.w3.org/2000/svg" width="{FlowIconSize}" height="{FlowIconSize}" viewBox="0 0 24 24" fill="none" stroke="#2c3e50" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M3 7V3h4"/><path d="M17 3h4v4"/><path d="M21 17v4h-4"/><path d="M7 21H3v-4"/><rect x="7" y="7" width="10" height="10" rx="1.5" fill="#d5e8f7"/></svg>',dock:'<svg xmlns="http://www.w3.org/2000/svg" width="{FlowIconSize}" height="{FlowIconSize}" viewBox="0 0 24 24" fill="none" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="3" width="18" height="4" rx="1.5" fill="#d5e8f7" stroke="#2c3e50" stroke-width="2"/><path d="M12 20V11M8 14l4-4 4 4" stroke="#2c3e50" stroke-width="2"/></svg>',restore:'<svg xmlns="http://www.w3.org/2000/svg" width="{FlowIconSize}" height="{FlowIconSize}" viewBox="0 0 24 24" fill="none" stroke="#2c3e50" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M3 12a9 9 0 1 0 3-6.7L3 8"/><path d="M3 3v5h5"/></svg>',"delete-node":'<svg xmlns="http://www.w3.org/2000/svg" width="{FlowIconSize}" height="{FlowIconSize}" viewBox="0 0 24 24" fill="none" stroke-linecap="round" stroke-linejoin="round"><path d="M3 6h18" stroke="#2c3e50" stroke-width="2"/><path d="M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2" stroke="#2c3e50" stroke-width="2"/><rect x="5" y="6" width="14" height="14" rx="2" fill="#d5e8f7" stroke="#2c3e50" stroke-width="2"/><path d="M10 11v6M14 11v6" stroke="#2c3e50" stroke-width="2"/></svg>',default:'<svg xmlns="http://www.w3.org/2000/svg" width="{FlowIconSize}" height="{FlowIconSize}" viewBox="0 0 24 24" fill="none" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="3" width="18" height="18" rx="4" fill="#d5e8f7" stroke="#2c3e50" stroke-width="2"/><circle cx="12" cy="12" r="2.5" fill="#2c3e50"/></svg>'};e.exports=class extends i{constructor(t,e,o){if(super(t,Object.assign({},n,e),o),this.serviceType="PictProviderFlowIcons",this._FlowView=e&&e.FlowView?e.FlowView:null,this._Icons=JSON.parse(JSON.stringify(a)),e&&e.AdditionalIcons&&"object"==typeof e.AdditionalIcons){let t=Object.keys(e.AdditionalIcons);for(let o=0;o<t.length;o++)this._Icons[t[o]]=e.AdditionalIcons[t[o]]}}registerIconTemplates(){if(!this.fable||!this.fable.TemplateProvider)return void this.log.warn("PictProviderFlowIcons: TemplateProvider not available; icon templates not registered.");let t=Object.keys(this._Icons);for(let e=0;e<t.length;e++){let o="Flow-Icon-"+t[e];this.fable.TemplateProvider.getTemplate(o)||this.fable.TemplateProvider.addTemplate(o,this._Icons[t[e]])}}isEmojiIcon(t){if(!t||"string"!=typeof t)return!1;for(let e=0;e<t.length;e++)if(t.charCodeAt(e)>255)return!0;return!1}resolveIconKey(t){return t?t.Icon&&this._Icons.hasOwnProperty(t.Icon)||t.Icon&&!this.isEmojiIcon(t.Icon)?t.Icon:t.Code&&this._Icons.hasOwnProperty(t.Code)?t.Code:"default":"default"}getIconSVGMarkup(t,e){let o=e||16,i=t||"default";return(this._Icons[i]||this._Icons.default).replace(/\{FlowIconSize\}/g,String(o))}renderIconIntoSVGGroup(t,e,o,i,n){if(!e)return null;let a=(n||16)/24,r=t||"default",s=this._Icons[r]||this._Icons.default;s=s.replace(/\{FlowIconSize\}/g,"24");try{let t=document.createElementNS("http://www.w3.org/2000/svg","svg");t.innerHTML=s;let n=t.querySelector("svg");if(!n)return null;let r=document.createElementNS("http://www.w3.org/2000/svg","g");for(r.setAttribute("transform","translate("+o+","+i+") scale("+a+")"),r.setAttribute("pointer-events","none"),r.setAttribute("class","pict-flow-icon-svg");n.childNodes.length>0;)r.appendChild(n.childNodes[0]);return e.appendChild(r),r}catch(t){return this.log.warn("PictProviderFlowIcons renderIconIntoSVGGroup error: "+t.message),null}}getIconKeys(){return Object.keys(this._Icons)}hasIcon(t){return this._Icons.hasOwnProperty(t)}registerIcon(t,e){return!(!t||!e)&&(this._Icons[t]=e,this.fable&&this.fable.TemplateProvider&&this.fable.TemplateProvider.addTemplate("Flow-Icon-"+t,e),!0)}},e.exports.default_configuration=n,e.exports.DefaultIcons=a},{"fable-serviceproviderbase":89}],104:[function(t,e,o){const i=t("pict-provider"),n={ProviderIdentifier:"PictProviderFlowLayouts"};e.exports=class extends i{constructor(t,e,o){super(t,Object.assign({},n,e),o),this.serviceType="PictProviderFlowLayouts",this._FlowView=e&&e.FlowView?e.FlowView:null,e&&void 0!==e.StorageKey?this._StorageKey=e.StorageKey:this._FlowView&&this._FlowView.options&&this._FlowView.options.ViewIdentifier?this._StorageKey=`pict-flow-layouts-${this._FlowView.options.ViewIdentifier}`:this._StorageKey="pict-flow-layouts"}storageWrite(t,e){if(!1===this._StorageKey)return e(null);try{return"undefined"!=typeof localStorage&&localStorage.setItem(this._StorageKey,JSON.stringify(t)),e(null)}catch(t){return this.log.warn(`PictProviderFlowLayouts storageWrite error: ${t.message}`),e(t)}}storageRead(t){if(!1===this._StorageKey)return t(null,[]);try{if("undefined"!=typeof localStorage){let e=localStorage.getItem(this._StorageKey);if(e){let o=JSON.parse(e);if(Array.isArray(o))return t(null,o)}}return t(null,[])}catch(e){return this.log.warn(`PictProviderFlowLayouts storageRead error: ${e.message}`),t(e,[])}}storageDelete(t){if(!1===this._StorageKey)return t(null);try{return"undefined"!=typeof localStorage&&localStorage.removeItem(this._StorageKey),t(null)}catch(e){return this.log.warn(`PictProviderFlowLayouts storageDelete error: ${e.message}`),t(e)}}loadPersistedLayouts(){this.storageRead((t,e)=>{if(t||!Array.isArray(e)||0===e.length)return;if(!this._FlowView||!this._FlowView._FlowData)return;let o=this._FlowView._FlowData.SavedLayouts,i={};for(let t=0;t<o.length;t++)i[o[t].Hash]=!0;let n=0;for(let t=0;t<e.length;t++)i[e[t].Hash]||(o.push(e[t]),n++);n>0&&this.log.trace(`PictProviderFlowLayouts loaded ${n} persisted layout(s)`)})}saveLayout(t){if(!this._FlowView)return this.log.warn("PictProviderFlowLayouts saveLayout: no FlowView reference"),null;let e=this._FlowView._FlowData,o=`layout-${this.fable.getUUID()}`,i={},n={};for(let t=0;t<e.Nodes.length;t++){let o=e.Nodes[t];i[o.Hash]={X:o.X,Y:o.Y,Width:o.Width,Height:o.Height,Title:o.Title},o.Style&&Object.keys(o.Style).length>0&&(i[o.Hash].Style=JSON.parse(JSON.stringify(o.Style)))}for(let t=0;t<e.OpenPanels.length;t++){let o=e.OpenPanels[t];n[o.NodeHash]={X:o.X,Y:o.Y,Width:o.Width,Height:o.Height}}let a={Hash:o,Name:t||"Untitled Layout",CreatedAt:(new Date).toISOString(),NodePositions:i,PanelPositions:n,ViewState:{PanX:e.ViewState.PanX,PanY:e.ViewState.PanY,Zoom:e.ViewState.Zoom}};return e.SavedLayouts.push(a),this._FlowView.marshalFromView(),this.storageWrite(e.SavedLayouts,t=>{t&&this.log.warn(`PictProviderFlowLayouts: failed to persist after save: ${t.message}`)}),this._FlowView._EventHandlerProvider&&(this._FlowView._EventHandlerProvider.fireEvent("onLayoutSaved",a),this._FlowView._EventHandlerProvider.fireEvent("onFlowChanged",e)),this.log.trace(`PictProviderFlowLayouts saved layout '${a.Name}' (${a.Hash})`),a}restoreLayout(t){if(!this._FlowView)return this.log.warn("PictProviderFlowLayouts restoreLayout: no FlowView reference"),!1;let e=this._FlowView._FlowData,o=e.SavedLayouts.find(e=>e.Hash===t);if(!o)return this.log.warn(`PictProviderFlowLayouts restoreLayout: layout '${t}' not found`),!1;let i=[],n=[];for(let t=0;t<e.Nodes.length;t++){let a=e.Nodes[t],r=o.NodePositions[a.Hash];r?(a.X=r.X,a.Y=r.Y,"number"==typeof r.Width&&(a.Width=r.Width),"number"==typeof r.Height&&(a.Height=r.Height),"string"==typeof r.Title&&(a.Title=r.Title),r.Style&&"object"==typeof r.Style&&(a.Style=JSON.parse(JSON.stringify(r.Style))),i.push(a)):n.push(a)}if(o.PanelPositions)for(let t=0;t<e.OpenPanels.length;t++){let i=e.OpenPanels[t],n=o.PanelPositions[i.NodeHash];n&&(i.X=n.X,i.Y=n.Y,"number"==typeof n.Width&&(i.Width=n.Width),"number"==typeof n.Height&&(i.Height=n.Height))}return n.length>0&&this._FlowView._LayoutService&&this._FlowView._LayoutService.autoLayoutSubset(n,i,e.Connections),o.ViewState&&("number"==typeof o.ViewState.PanX&&(e.ViewState.PanX=o.ViewState.PanX),"number"==typeof o.ViewState.PanY&&(e.ViewState.PanY=o.ViewState.PanY),"number"==typeof o.ViewState.Zoom&&(e.ViewState.Zoom=o.ViewState.Zoom)),this._FlowView.renderFlow(),this._FlowView.marshalFromView(),this._FlowView._EventHandlerProvider&&(this._FlowView._EventHandlerProvider.fireEvent("onLayoutRestored",o),this._FlowView._EventHandlerProvider.fireEvent("onFlowChanged",e)),this.log.trace(`PictProviderFlowLayouts restored layout '${o.Name}' (${o.Hash})`),!0}deleteLayout(t){if(!this._FlowView)return this.log.warn("PictProviderFlowLayouts deleteLayout: no FlowView reference"),!1;let e=this._FlowView._FlowData,o=e.SavedLayouts.findIndex(e=>e.Hash===t);if(o<0)return this.log.warn(`PictProviderFlowLayouts deleteLayout: layout '${t}' not found`),!1;let i=e.SavedLayouts.splice(o,1)[0];return this._FlowView.marshalFromView(),this.storageWrite(e.SavedLayouts,t=>{t&&this.log.warn(`PictProviderFlowLayouts: failed to persist after delete: ${t.message}`)}),this._FlowView._EventHandlerProvider&&(this._FlowView._EventHandlerProvider.fireEvent("onLayoutDeleted",i),this._FlowView._EventHandlerProvider.fireEvent("onFlowChanged",e)),this.log.trace(`PictProviderFlowLayouts deleted layout '${i.Name}' (${i.Hash})`),!0}getLayouts(){return this._FlowView?this._FlowView._FlowData.SavedLayouts:[]}getLayout(t){return this._FlowView&&this._FlowView._FlowData.SavedLayouts.find(e=>e.Hash===t)||null}},e.exports.default_configuration=n},{"pict-provider":91}],105:[function(t,e,o){const i=t("pict-provider"),n={default:{Hash:"default",Label:"Default",DefaultWidth:180,DefaultHeight:80,DefaultPorts:[{Hash:null,Direction:"input",Side:"left",Label:"In"},{Hash:null,Direction:"output",Side:"right",Label:"Out"}],TitleBarColor:"#2c3e50",BodyStyle:{}},start:{Hash:"start",Label:"Start",DefaultWidth:140,DefaultHeight:80,DefaultPorts:[{Hash:null,Direction:"output",Side:"right",Label:"Out"}],TitleBarColor:"#27ae60",BodyStyle:{fill:"#eafaf1",stroke:"#27ae60"}},end:{Hash:"end",Label:"End",DefaultWidth:140,DefaultHeight:80,DefaultPorts:[{Hash:null,Direction:"input",Side:"left",Label:"In"}],TitleBarColor:"#1abc9c",BodyStyle:{fill:"#e8f8f5",stroke:"#1abc9c"}},halt:{Hash:"halt",Label:"Halt",DefaultWidth:140,DefaultHeight:80,DefaultPorts:[{Hash:null,Direction:"input",Side:"left",Label:"In"}],TitleBarColor:"#e74c3c",BodyStyle:{fill:"#fdedec",stroke:"#e74c3c"}},decision:{Hash:"decision",Label:"Decision",DefaultWidth:200,DefaultHeight:100,DefaultPorts:[{Hash:null,Direction:"input",Side:"left",Label:"In"},{Hash:null,Direction:"output",Side:"right",Label:"Yes"},{Hash:null,Direction:"output",Side:"bottom",Label:"No"}],TitleBarColor:"#f39c12",BodyStyle:{fill:"#fff9e6",stroke:"#f39c12"}}},a={ProviderIdentifier:"PictProviderFlowNodeTypes"};e.exports=class extends i{constructor(t,e,o){if(super(t,Object.assign({},a,e),o),this.serviceType="PictProviderFlowNodeTypes",this._FlowView=e&&e.FlowView?e.FlowView:null,e&&!1===e.IncludeDefaultNodeTypes?this._NodeTypes={}:this._NodeTypes=JSON.parse(JSON.stringify(n)),e&&e.AdditionalNodeTypes&&"object"==typeof e.AdditionalNodeTypes){let t=Object.keys(e.AdditionalNodeTypes);for(let o=0;o<t.length;o++){let i=e.AdditionalNodeTypes[t[o]];this._NodeTypes[t[o]]=Object.assign({},this._NodeTypes[t[o]]||{},JSON.parse(JSON.stringify(i))),i.BodyContent&&"function"==typeof i.BodyContent.RenderCallback&&(this._NodeTypes[t[o]].BodyContent||(this._NodeTypes[t[o]].BodyContent={}),this._NodeTypes[t[o]].BodyContent.RenderCallback=i.BodyContent.RenderCallback)}}}getNodeType(t){return this._NodeTypes[t]||this._NodeTypes.default}registerNodeType(t){return t&&t.Hash?(this._NodeTypes[t.Hash]=Object.assign({},this._NodeTypes[t.Hash]||{},t),!0):(this.log.warn("PictProviderFlowNodeTypes registerNodeType: invalid config (missing Hash)"),!1)}removeNodeType(t){return"default"===t?(this.log.warn("PictProviderFlowNodeTypes: cannot remove the default node type"),!1):!!this._NodeTypes[t]&&(delete this._NodeTypes[t],!0)}getNodeTypes(){return JSON.parse(JSON.stringify(this._NodeTypes))}getNodeTypeList(){return Object.keys(this._NodeTypes)}getEnabledCards(){let t=[],e=Object.keys(this._NodeTypes);for(let o=0;o<e.length;o++){let i=this._NodeTypes[e[o]];i.CardMetadata&&!1!==i.CardMetadata.Enabled&&t.push(JSON.parse(JSON.stringify(i)))}return t}getCardsByCategory(){let t=this.getEnabledCards(),e={};for(let o=0;o<t.length;o++){let i=t[o].CardMetadata&&t[o].CardMetadata.Category?t[o].CardMetadata.Category:"General";e[i]||(e[i]=[]),e[i].push(t[o])}return e}isFlowCard(t){let e=this._NodeTypes[t];return!(!e||!e.CardMetadata)}},e.exports.default_configuration=a,e.exports.DefaultNodeTypes=n},{"pict-provider":91}],106:[function(t,e,o){const i=t("fable-serviceproviderbase"),n={ProviderIdentifier:"PictProviderFlowNoise"};e.exports=class extends i{constructor(t,e,o){super(t,Object.assign({},n,e),o),this.serviceType="PictProviderFlowNoise"}hashString(t){let e=5381;for(let o=0;o<t.length;o++)e=(e<<5)+e+t.charCodeAt(o),e&=e;return e>>>0}seededRandom(t){let e=0|t;return function(){e=e+1831565813|0;let t=Math.imul(e^e>>>15,1|e);return t=t+Math.imul(t^t>>>7,61|t)^t,((t^t>>>14)>>>0)/4294967296}}jitterPoint(t,e,o,i){return o<=0?{x:t,y:e}:{x:t+o*(i()-.5)*2,y:e+o*(i()-.5)*2}}generateBracketPath(t,e,o,i,n,a){let r=this.seededRandom(this.hashString(a||"default")),s=o||18,l=t,c=e,d=(t,e)=>this.jitterPoint(t,e,n,r),p=d(s,0),h=d(0,0),u=d(0,c),f=d(s,c),g=d(l-s,0),m=d(l,0),w=d(l,c),v=d(l-s,c),b="";return b+=`M ${p.x.toFixed(1)} ${p.y.toFixed(1)}`,b+=` L ${h.x.toFixed(1)} ${h.y.toFixed(1)}`,b+=` L ${u.x.toFixed(1)} ${u.y.toFixed(1)}`,b+=` L ${f.x.toFixed(1)} ${f.y.toFixed(1)}`,b+=` M ${g.x.toFixed(1)} ${g.y.toFixed(1)}`,b+=` L ${m.x.toFixed(1)} ${m.y.toFixed(1)}`,b+=` L ${w.x.toFixed(1)} ${w.y.toFixed(1)}`,b+=` L ${v.x.toFixed(1)} ${v.y.toFixed(1)}`,b}jitterPath(t,e,o){if(e<=0||!t)return t;let i=this.seededRandom(this.hashString(o||"path")),n=t.match(/[MLCQZmlcqz]|[-+]?[0-9]*\.?[0-9]+/g);if(!n)return t;let a=[];for(let t=0;t<n.length;t++)/^[-+]?[0-9]*\.?[0-9]+$/.test(n[t])&&a.push(t);for(let t=0;t<a.length-1;t+=2){let o=a[t],r=a[t+1],s=e;0===t||t>=a.length-2?s=.15*e:(2===t||t>=a.length-4)&&(s=.5*e);let l=parseFloat(n[o]),c=parseFloat(n[r]),d=this.jitterPoint(l,c,s,i);n[o]=d.x.toFixed(1),n[r]=d.y.toFixed(1)}let r="";for(let t=0;t<n.length;t++)t>0&&/^[MLCQZmlcqz]$/.test(n[t])?r+=" "+n[t]:r+=t>0?" "+n[t]:n[t];return r}},e.exports.default_configuration=n},{"fable-serviceproviderbase":89}],107:[function(t,e,o){const i=t("fable-serviceproviderbase");e.exports=class extends i{constructor(t,e,o){super(t,e,o),this.serviceType="PictProviderFlowPanelChrome",this._FlowView=e&&e.FlowView?e.FlowView:null}createPanelForeignObject(t,e){let o=this._FlowView._SVGHelperProvider.createSVGElement("foreignObject");o.setAttribute("class","pict-flow-panel-foreign-object"),o.setAttribute("data-panel-hash",t.Hash),o.setAttribute("data-node-hash",t.NodeHash),o.setAttribute("x",String(t.X)),o.setAttribute("y",String(t.Y)),o.setAttribute("width",String(t.Width)),o.setAttribute("height",String(t.Height));let i=this._FlowView.pict||this._FlowView.fable,n=t.Title||"Properties",a=i.parseTemplateByHash("Flow-PanelChrome-Template",{Hash:t.Hash,Title:n});o.innerHTML=a;let r=o.querySelector(".pict-flow-panel-close-icon");r&&this._FlowView&&this._FlowView._IconProvider?r.innerHTML=this._FlowView._IconProvider.getIconSVGMarkup("close",12):r&&(r.textContent="✕");let s=o.querySelector(".pict-flow-panel-content");s&&(s.addEventListener("pointerdown",t=>{t.stopPropagation()}),s.addEventListener("wheel",t=>{t.stopPropagation()}));let l=o.querySelector(".pict-flow-panel-tabbar");return l&&(l.addEventListener("pointerdown",t=>{t.stopPropagation()}),l.addEventListener("wheel",t=>{t.stopPropagation()})),e.appendChild(o),o.querySelector('.pict-flow-panel-tab-pane[data-tab="properties"]')}}},{"fable-serviceproviderbase":89}],108:[function(t,e,o){const i=t("fable-serviceproviderbase");e.exports=class extends i{constructor(t,e,o){super(t,e,o),this.serviceType="PictProviderFlowSVGHelpers"}createSVGElement(t){return document.createElementNS("http://www.w3.org/2000/svg",t)}}},{"fable-serviceproviderbase":89}],109:[function(t,e,o){const i=t("fable-serviceproviderbase"),n={ProviderIdentifier:"PictProviderFlowTheme"};e.exports=class extends i{constructor(t,e,o){super(t,Object.assign({},n,e),o),this.serviceType="PictProviderFlowTheme",this._FlowView=e&&e.FlowView?e.FlowView:null,this._ActiveThemeKey="default",this._NoiseLevel=0,this._Themes={},this._registerBuiltInThemes()}_registerBuiltInThemes(){this._Themes.default={Key:"default",Label:"Modern",CSSVariables:{},AdditionalCSS:"",NodeBodyMode:"rect",BracketConfig:null,ConnectionConfig:{StrokeDashArray:null,StrokeWidth:2,ArrowheadStyle:"triangle"},NoiseConfig:{Enabled:!1,DefaultLevel:0,MaxJitterPx:0,AffectsNodes:!1,AffectsConnections:!1},ShapeOverrides:{}},this._Themes.sketch={Key:"sketch",Label:"Sketch",CSSVariables:{"--pf-node-body-fill":"#fffef5","--pf-node-body-stroke":"#444444","--pf-node-body-stroke-width":"1.5","--pf-node-body-radius":"0px","--pf-node-shadow":"none","--pf-node-shadow-hover":"none","--pf-node-shadow-selected":"none","--pf-node-shadow-dragging":"none","--pf-node-title-fill":"#333333","--pf-node-title-size":"12px","--pf-node-title-weight":"400","--pf-node-title-bar-color":"#f0ece0","--pf-node-type-label-fill":"#888888","--pf-node-selected-stroke":"#2255aa","--pf-port-input-fill":"#5577bb","--pf-port-output-fill":"#55aa77","--pf-port-stroke":"#fffef5","--pf-connection-stroke":"#555555","--pf-connection-selected-stroke":"#2255aa","--pf-canvas-bg":"#fffef5","--pf-grid-stroke":"#e8e4d8","--pf-panel-bg":"#fffef5","--pf-panel-border":"#ccccaa","--pf-panel-radius":"0px","--pf-panel-shadow":"2px 2px 0px rgba(0,0,0,0.08)","--pf-panel-titlebar-bg":"#f0ece0","--pf-panel-titlebar-border":"#ccccaa","--pf-panel-title-color":"#333333"},AdditionalCSS:'\n\t\t\t\t.pict-flow-node-title,\n\t\t\t\t.pict-flow-node-type-label,\n\t\t\t\t.pict-flow-port-label,\n\t\t\t\t.pict-flow-node-card-code {\n\t\t\t\t\tfont-family: "Courier New", "Courier", monospace !important;\n\t\t\t\t}\n\t\t\t\t.pict-flow-panel-title-text,\n\t\t\t\t.pict-flow-panel-node-props-title,\n\t\t\t\t.pict-flow-info-panel {\n\t\t\t\t\tfont-family: "Courier New", "Courier", monospace !important;\n\t\t\t\t}\n\t\t\t\t.pict-flow-node-title-icon {\n\t\t\t\t\tfilter: brightness(0) !important;\n\t\t\t\t}\n\t\t\t',NodeBodyMode:"bracket",BracketConfig:{SerifLength:20,TitleSeparator:!0},ConnectionConfig:{StrokeDashArray:null,StrokeWidth:1.5,ArrowheadStyle:"triangle"},NoiseConfig:{Enabled:!0,DefaultLevel:.4,MaxJitterPx:4,AffectsNodes:!0,AffectsConnections:!0},ShapeOverrides:{"arrowhead-connection":{Fill:"#555555"},"arrowhead-connection-selected":{Fill:"#2255aa"}}},this._Themes.blueprint={Key:"blueprint",Label:"Blueprint",CSSVariables:{"--pf-node-body-fill":"rgba(255,255,255,0.05)","--pf-node-body-stroke":"#ffffff","--pf-node-body-stroke-width":"1","--pf-node-body-radius":"0px","--pf-node-shadow":"none","--pf-node-shadow-hover":"none","--pf-node-shadow-selected":"none","--pf-node-shadow-dragging":"none","--pf-node-title-fill":"#ffffff","--pf-node-title-size":"11px","--pf-node-title-weight":"400","--pf-node-title-bar-color":"rgba(255,255,255,0.1)","--pf-node-type-label-fill":"rgba(255,255,255,0.5)","--pf-node-selected-stroke":"#ffdd44","--pf-port-input-fill":"#88bbff","--pf-port-output-fill":"#88ffbb","--pf-port-stroke":"#1a3a6a","--pf-connection-stroke":"rgba(255,255,255,0.6)","--pf-connection-selected-stroke":"#ffdd44","--pf-canvas-bg":"#1a3a6a","--pf-grid-stroke":"rgba(255,255,255,0.08)","--pf-panel-bg":"#1a3a6a","--pf-panel-border":"rgba(255,255,255,0.3)","--pf-panel-radius":"0px","--pf-panel-shadow":"none","--pf-panel-titlebar-bg":"rgba(255,255,255,0.05)","--pf-panel-titlebar-border":"rgba(255,255,255,0.15)","--pf-panel-title-color":"#ffffff"},AdditionalCSS:'\n\t\t\t\t.pict-flow-node-title,\n\t\t\t\t.pict-flow-node-type-label,\n\t\t\t\t.pict-flow-port-label,\n\t\t\t\t.pict-flow-node-card-code {\n\t\t\t\t\tfont-family: "Courier New", monospace !important;\n\t\t\t\t\ttext-transform: uppercase;\n\t\t\t\t\tletter-spacing: 1px;\n\t\t\t\t}\n\t\t\t\t.pict-flow-container {\n\t\t\t\t\tborder-color: #0d2244;\n\t\t\t\t}\n\t\t\t\t.pict-flow-node-title-icon {\n\t\t\t\t\tfilter: brightness(0) invert(1) !important;\n\t\t\t\t}\n\t\t\t\t.pict-flow-toolbar {\n\t\t\t\t\tbackground-color: #142e54;\n\t\t\t\t\tborder-bottom-color: rgba(255,255,255,0.15);\n\t\t\t\t}\n\t\t\t\t.pict-flow-toolbar-btn {\n\t\t\t\t\tbackground-color: rgba(255,255,255,0.05);\n\t\t\t\t\tborder-color: rgba(255,255,255,0.2);\n\t\t\t\t\tcolor: #ffffff;\n\t\t\t\t}\n\t\t\t\t.pict-flow-toolbar-btn:hover {\n\t\t\t\t\tbackground-color: rgba(255,255,255,0.1);\n\t\t\t\t}\n\t\t\t',NodeBodyMode:"bracket",BracketConfig:{SerifLength:18,TitleSeparator:!0},ConnectionConfig:{StrokeDashArray:"8 4",StrokeWidth:1,ArrowheadStyle:"triangle"},NoiseConfig:{Enabled:!1,DefaultLevel:0,MaxJitterPx:0,AffectsNodes:!1,AffectsConnections:!1},ShapeOverrides:{"arrowhead-connection":{Fill:"rgba(255,255,255,0.6)"},"arrowhead-connection-selected":{Fill:"#ffdd44"}}},this._Themes.mono={Key:"mono",Label:"Monochrome",CSSVariables:{"--pf-node-body-fill":"#ffffff","--pf-node-body-stroke":"#000000","--pf-node-body-stroke-width":"1","--pf-node-body-radius":"0px","--pf-node-shadow":"none","--pf-node-shadow-hover":"none","--pf-node-shadow-selected":"none","--pf-node-shadow-dragging":"none","--pf-node-title-fill":"#ffffff","--pf-node-title-size":"11px","--pf-node-title-weight":"600","--pf-node-title-bar-color":"#000000","--pf-node-type-label-fill":"#888888","--pf-node-selected-stroke":"#444444","--pf-port-input-fill":"#000000","--pf-port-output-fill":"#666666","--pf-port-stroke":"#ffffff","--pf-connection-stroke":"#000000","--pf-connection-selected-stroke":"#444444","--pf-canvas-bg":"#ffffff","--pf-grid-stroke":"#eeeeee","--pf-panel-bg":"#ffffff","--pf-panel-border":"#000000","--pf-panel-radius":"0px","--pf-panel-shadow":"none","--pf-panel-titlebar-bg":"#f0f0f0","--pf-panel-titlebar-border":"#000000","--pf-panel-title-color":"#000000"},AdditionalCSS:'\n\t\t\t\t.pict-flow-node-title {\n\t\t\t\t\tfont-family: "Helvetica Neue", Helvetica, Arial, sans-serif !important;\n\t\t\t\t}\n\t\t\t\t.pict-flow-node-title-icon {\n\t\t\t\t\tfilter: brightness(0) invert(1) !important;\n\t\t\t\t}\n\t\t\t',NodeBodyMode:"rect",BracketConfig:null,ConnectionConfig:{StrokeDashArray:null,StrokeWidth:1,ArrowheadStyle:"triangle"},NoiseConfig:{Enabled:!1,DefaultLevel:0,MaxJitterPx:0,AffectsNodes:!1,AffectsConnections:!1},ShapeOverrides:{"arrowhead-connection":{Fill:"#000000"},"arrowhead-connection-selected":{Fill:"#444444"}}},this._Themes["retro-80s"]={Key:"retro-80s",Label:"80s Retro",CSSVariables:{"--pf-node-body-fill":"#1a0a2e","--pf-node-body-stroke":"#ff00ff","--pf-node-body-stroke-width":"2","--pf-node-body-radius":"0px","--pf-node-shadow":"drop-shadow(0 0 8px rgba(255,0,255,0.4))","--pf-node-shadow-hover":"drop-shadow(0 0 12px rgba(255,0,255,0.6))","--pf-node-shadow-selected":"drop-shadow(0 0 16px rgba(0,255,255,0.5))","--pf-node-shadow-dragging":"drop-shadow(0 0 20px rgba(255,0,255,0.7))","--pf-node-title-fill":"#00ffff","--pf-node-title-size":"11px","--pf-node-title-weight":"700","--pf-node-title-bar-color":"#2a0a4e","--pf-node-type-label-fill":"#ff66ff","--pf-node-selected-stroke":"#00ffff","--pf-port-input-fill":"#ff00ff","--pf-port-output-fill":"#00ff66","--pf-port-stroke":"#1a0a2e","--pf-connection-stroke":"#ff00ff","--pf-connection-selected-stroke":"#00ffff","--pf-canvas-bg":"#0a0015","--pf-grid-stroke":"#1a0a2e","--pf-panel-bg":"#1a0a2e","--pf-panel-border":"#ff00ff","--pf-panel-radius":"0px","--pf-panel-shadow":"0 0 20px rgba(255,0,255,0.3)","--pf-panel-titlebar-bg":"#2a0a4e","--pf-panel-titlebar-border":"#ff00ff","--pf-panel-title-color":"#00ffff"},AdditionalCSS:'\n\t\t\t\t.pict-flow-node-title,\n\t\t\t\t.pict-flow-node-type-label,\n\t\t\t\t.pict-flow-port-label,\n\t\t\t\t.pict-flow-node-card-code {\n\t\t\t\t\tfont-family: "Courier New", monospace !important;\n\t\t\t\t\ttext-transform: uppercase;\n\t\t\t\t\tletter-spacing: 0.5px;\n\t\t\t\t}\n\t\t\t\t.pict-flow-connection {\n\t\t\t\t\tfilter: drop-shadow(0 0 3px rgba(255,0,255,0.4));\n\t\t\t\t}\n\t\t\t\t.pict-flow-node-title-icon {\n\t\t\t\t\tfilter: brightness(0) invert(1) hue-rotate(180deg) !important;\n\t\t\t\t}\n\t\t\t\t.pict-flow-toolbar {\n\t\t\t\t\tbackground-color: #1a0a2e;\n\t\t\t\t\tborder-bottom-color: #ff00ff;\n\t\t\t\t}\n\t\t\t\t.pict-flow-toolbar-btn {\n\t\t\t\t\tbackground-color: #1a0a2e;\n\t\t\t\t\tborder-color: #ff00ff;\n\t\t\t\t\tcolor: #00ffff;\n\t\t\t\t}\n\t\t\t\t.pict-flow-toolbar-btn:hover {\n\t\t\t\t\tbackground-color: #2a0a4e;\n\t\t\t\t}\n\t\t\t\t.pict-flow-container {\n\t\t\t\t\tborder-color: #ff00ff;\n\t\t\t\t}\n\t\t\t',NodeBodyMode:"rect",BracketConfig:null,ConnectionConfig:{StrokeDashArray:null,StrokeWidth:2,ArrowheadStyle:"triangle"},NoiseConfig:{Enabled:!1,DefaultLevel:0,MaxJitterPx:0,AffectsNodes:!1,AffectsConnections:!1},ShapeOverrides:{"arrowhead-connection":{Fill:"#ff00ff"},"arrowhead-connection-selected":{Fill:"#00ffff"}}},this._Themes["retro-90s"]={Key:"retro-90s",Label:"90s Retro",CSSVariables:{"--pf-node-body-fill":"#c0c0c0","--pf-node-body-stroke":"#808080","--pf-node-body-stroke-width":"1","--pf-node-body-radius":"0px","--pf-node-shadow":"drop-shadow(2px 2px 0px #404040)","--pf-node-shadow-hover":"drop-shadow(3px 3px 0px #404040)","--pf-node-shadow-selected":"drop-shadow(2px 2px 0px #008080)","--pf-node-shadow-dragging":"drop-shadow(4px 4px 0px #404040)","--pf-node-title-fill":"#ffffff","--pf-node-title-size":"11px","--pf-node-title-weight":"700","--pf-node-title-bar-color":"#000080","--pf-node-type-label-fill":"#606060","--pf-node-selected-stroke":"#008080","--pf-port-input-fill":"#000080","--pf-port-output-fill":"#008000","--pf-port-stroke":"#c0c0c0","--pf-connection-stroke":"#808080","--pf-connection-selected-stroke":"#008080","--pf-canvas-bg":"#008080","--pf-grid-stroke":"rgba(0,0,0,0.06)","--pf-panel-bg":"#c0c0c0","--pf-panel-border":"#808080","--pf-panel-radius":"0px","--pf-panel-shadow":"2px 2px 0px #404040","--pf-panel-titlebar-bg":"#000080","--pf-panel-titlebar-border":"#c0c0c0","--pf-panel-title-color":"#ffffff"},AdditionalCSS:'\n\t\t\t\t.pict-flow-node-title,\n\t\t\t\t.pict-flow-node-type-label,\n\t\t\t\t.pict-flow-port-label,\n\t\t\t\t.pict-flow-node-card-code {\n\t\t\t\t\tfont-family: "MS Sans Serif", "Arial", sans-serif !important;\n\t\t\t\t}\n\t\t\t\t.pict-flow-node-title-icon {\n\t\t\t\t\tfilter: brightness(0) invert(1) !important;\n\t\t\t\t}\n\t\t\t\t.pict-flow-toolbar {\n\t\t\t\t\tbackground-color: #c0c0c0;\n\t\t\t\t\tborder-bottom: 2px solid #808080;\n\t\t\t\t\tborder-top: 1px solid #ffffff;\n\t\t\t\t}\n\t\t\t\t.pict-flow-toolbar-btn {\n\t\t\t\t\tbackground-color: #c0c0c0;\n\t\t\t\t\tborder: 2px outset #c0c0c0;\n\t\t\t\t\tborder-radius: 0;\n\t\t\t\t\tcolor: #000000;\n\t\t\t\t}\n\t\t\t\t.pict-flow-toolbar-btn:hover {\n\t\t\t\t\tbackground-color: #d0d0d0;\n\t\t\t\t}\n\t\t\t\t.pict-flow-toolbar-btn:active {\n\t\t\t\t\tborder-style: inset;\n\t\t\t\t}\n\t\t\t\t.pict-flow-container {\n\t\t\t\t\tborder: 2px outset #c0c0c0;\n\t\t\t\t\tborder-radius: 0;\n\t\t\t\t}\n\t\t\t',NodeBodyMode:"rect",BracketConfig:null,ConnectionConfig:{StrokeDashArray:null,StrokeWidth:2,ArrowheadStyle:"triangle"},NoiseConfig:{Enabled:!1,DefaultLevel:0,MaxJitterPx:0,AffectsNodes:!1,AffectsConnections:!1},ShapeOverrides:{"arrowhead-connection":{Fill:"#808080"},"arrowhead-connection-selected":{Fill:"#008080"}}},this._Themes.whiteboard={Key:"whiteboard",Label:"Whiteboard",CSSVariables:{"--pf-node-body-fill":"transparent","--pf-node-body-stroke":"#555555","--pf-node-body-stroke-width":"2","--pf-node-body-radius":"0px","--pf-node-shadow":"none","--pf-node-shadow-hover":"none","--pf-node-shadow-selected":"none","--pf-node-shadow-dragging":"none","--pf-node-title-fill":"#333333","--pf-node-title-size":"12px","--pf-node-title-weight":"600","--pf-node-title-bar-color":"transparent","--pf-node-type-label-fill":"#999999","--pf-node-selected-stroke":"#2255aa","--pf-port-input-fill":"#5577bb","--pf-port-output-fill":"#55aa77","--pf-port-stroke":"#ffffff","--pf-connection-stroke":"#888888","--pf-connection-selected-stroke":"#2255aa","--pf-canvas-bg":"#ffffff","--pf-grid-stroke":"#f0f0f0","--pf-panel-bg":"#ffffff","--pf-panel-border":"#cccccc","--pf-panel-radius":"0px","--pf-panel-shadow":"2px 2px 0px rgba(0,0,0,0.06)","--pf-panel-titlebar-bg":"#f8f8f8","--pf-panel-titlebar-border":"#e0e0e0","--pf-panel-title-color":"#333333"},AdditionalCSS:'\n\t\t\t\t.pict-flow-node-title,\n\t\t\t\t.pict-flow-node-type-label,\n\t\t\t\t.pict-flow-port-label,\n\t\t\t\t.pict-flow-node-card-code {\n\t\t\t\t\tfont-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;\n\t\t\t\t}\n\t\t\t\t/* Node-type bracket colors — each type gets its own bracket color */\n\t\t\t\t.pict-flow-node-start .pict-flow-node-bracket { stroke: #27ae60; }\n\t\t\t\t.pict-flow-node-end .pict-flow-node-bracket { stroke: #1abc9c; }\n\t\t\t\t.pict-flow-node-halt .pict-flow-node-bracket { stroke: #e74c3c; }\n\t\t\t\t.pict-flow-node-decision .pict-flow-node-bracket { stroke: #f39c12; }\n\t\t\t\t.pict-flow-node-default .pict-flow-node-bracket { stroke: #3498db; }\n\t\t\t\t.pict-flow-node-action .pict-flow-node-bracket { stroke: #2c3e50; }\n\t\t\t\t/* Override variant rules: no fills/strokes on body rects in whiteboard */\n\t\t\t\t.pict-flow-node-decision .pict-flow-node-body,\n\t\t\t\t.pict-flow-node-start .pict-flow-node-body,\n\t\t\t\t.pict-flow-node-end .pict-flow-node-body,\n\t\t\t\t.pict-flow-node-halt .pict-flow-node-body {\n\t\t\t\t\tfill: transparent;\n\t\t\t\t\tstroke: transparent;\n\t\t\t\t\tstroke-width: 0;\n\t\t\t\t}\n\t\t\t\t/* Title bar fills transparent too */\n\t\t\t\t.pict-flow-node .pict-flow-node-bracket-title-fill {\n\t\t\t\t\tfill: transparent !important;\n\t\t\t\t}\n\t\t\t\t.pict-flow-node-title-icon {\n\t\t\t\t\tfilter: none !important;\n\t\t\t\t}\n\t\t\t',NodeBodyMode:"bracket",BracketConfig:{SerifLength:22,TitleSeparator:!1},ConnectionConfig:{StrokeDashArray:null,StrokeWidth:1.5,ArrowheadStyle:"triangle"},NoiseConfig:{Enabled:!0,DefaultLevel:.3,MaxJitterPx:3,AffectsNodes:!0,AffectsConnections:!0},ShapeOverrides:{"arrowhead-connection":{Fill:"#888888"},"arrowhead-connection-selected":{Fill:"#2255aa"}}}}getActiveTheme(){return this._Themes[this._ActiveThemeKey]||this._Themes.default}getActiveThemeKey(){return this._ActiveThemeKey}setTheme(t){if(!this._Themes[t])return this.log.warn(`PictProviderFlowTheme: theme '${t}' not found`),!1;this._ActiveThemeKey=t;let e=this._Themes[t];return e.NoiseConfig&&"number"==typeof e.NoiseConfig.DefaultLevel?this._NoiseLevel=e.NoiseConfig.DefaultLevel:this._NoiseLevel=0,this._FlowView&&this._FlowView._ConnectorShapesProvider&&(this._FlowView._ConnectorShapesProvider.resetToDefaults(),e.ShapeOverrides&&Object.keys(e.ShapeOverrides).length>0&&this._FlowView._ConnectorShapesProvider.applyThemeOverrides(e.ShapeOverrides)),this.log.trace(`PictProviderFlowTheme: switched to '${t}'`),!0}getNoiseLevel(){return this._NoiseLevel}setNoiseLevel(t){this._NoiseLevel=Math.max(0,Math.min(1,t||0))}registerTheme(t,e){t&&e?(e.Key=t,this._Themes[t]=e):this.log.warn("PictProviderFlowTheme: registerTheme requires key and definition")}getThemeKeys(){return Object.keys(this._Themes)}processPathString(t,e){let o=this.getActiveTheme();if(!(o&&o.NoiseConfig&&o.NoiseConfig.Enabled&&o.NoiseConfig.AffectsConnections))return t;let i=this._NoiseLevel*(o.NoiseConfig.MaxJitterPx||3);return i<=0?t:this._FlowView&&this._FlowView._NoiseProvider?this._FlowView._NoiseProvider.jitterPath(t,i,e):t}getNodeNoiseAmplitude(){let t=this.getActiveTheme();return t&&t.NoiseConfig&&t.NoiseConfig.Enabled&&t.NoiseConfig.AffectsNodes?this._NoiseLevel*(t.NoiseConfig.MaxJitterPx||3):0}},e.exports.default_configuration=n},{"fable-serviceproviderbase":89}],110:[function(t,e,o){const i=t("fable-serviceproviderbase");e.exports=class extends i{constructor(t,e,o){super(t,e,o),this.serviceType="PictServiceFlowConnectionHandleManager",this._FlowView=e&&e.FlowView?e.FlowView:null}updateConnectionHandle(t,e,o,i){if(!this._FlowView)return;let n=this._FlowView.getConnection(t);if(n){if(n.Data||(n.Data={}),n.Data.HandleCustomized=!0,e&&e.startsWith("bezier-handle-")){let a=parseInt(e.replace("bezier-handle-",""),10);return!isNaN(a)&&Array.isArray(n.Data.BezierHandles)&&a<n.Data.BezierHandles.length&&(n.Data.BezierHandles[a].x=o,n.Data.BezierHandles[a].y=i),void this._FlowView._renderSingleConnection(t)}switch(e){case"bezier-midpoint":Array.isArray(n.Data.BezierHandles)&&0!==n.Data.BezierHandles.length?(n.Data.BezierHandles[0].x=o,n.Data.BezierHandles[0].y=i):n.Data.BezierHandles=[{x:o,y:i}],n.Data.BezierHandleX=o,n.Data.BezierHandleY=i;break;case"ortho-corner1":n.Data.OrthoCorner1X=o,n.Data.OrthoCorner1Y=i;break;case"ortho-corner2":n.Data.OrthoCorner2X=o,n.Data.OrthoCorner2Y=i;break;case"ortho-midpoint":{let t=this._FlowView.getPortPosition(n.SourceNodeHash,n.SourcePortHash),e=this._FlowView.getPortPosition(n.TargetNodeHash,n.TargetPortHash);if(t&&e){let a=this._FlowView._ConnectionRenderer._computeDirectionalGeometry(t,e),r=a.startDir;if(Math.abs(r.dx)>Math.abs(r.dy)){let t=(a.departX+a.approachX)/2;n.Data.OrthoMidOffset=o-t}else{let t=(a.departY+a.approachY)/2;n.Data.OrthoMidOffset=i-t}}break}}this._FlowView._renderSingleConnection(t)}}addConnectionHandle(t,e,o){if(!this._FlowView)return;let i=this._FlowView.getConnection(t);if(!i)return;i.Data||(i.Data={}),Array.isArray(i.Data.BezierHandles)||(i.Data.BezierHandles=[],null!=i.Data.BezierHandleX&&null!=i.Data.BezierHandleY&&i.Data.BezierHandles.push({x:i.Data.BezierHandleX,y:i.Data.BezierHandleY})),i.Data.LineMode="bezier";let n=this._FlowView.getPortPosition(i.SourceNodeHash,i.SourcePortHash),a=this._FlowView.getPortPosition(i.TargetNodeHash,i.TargetPortHash),r=0;n&&a&&this._FlowView._ConnectionRenderer&&(r=this._FlowView._ConnectionRenderer.computeInsertionIndex(i.Data.BezierHandles,{x:e,y:o},n,a)),i.Data.BezierHandles.splice(r,0,{x:e,y:o}),i.Data.HandleCustomized=!0,this._FlowView.renderFlow(),this._FlowView.marshalFromView(),this._FlowView._EventHandlerProvider&&this._FlowView._EventHandlerProvider.fireEvent("onFlowChanged",this._FlowView._FlowData)}removeConnectionHandle(t,e){if(!this._FlowView)return;let o=this._FlowView.getConnection(t);o&&o.Data&&Array.isArray(o.Data.BezierHandles)&&(e<0||e>=o.Data.BezierHandles.length||(o.Data.BezierHandles.splice(e,1),0===o.Data.BezierHandles.length&&(o.Data.HandleCustomized=!1,o.Data.BezierHandleX=null,o.Data.BezierHandleY=null),this._FlowView.renderFlow(),this._FlowView.marshalFromView(),this._FlowView._EventHandlerProvider&&this._FlowView._EventHandlerProvider.fireEvent("onFlowChanged",this._FlowView._FlowData)))}resetHandlesForNode(t){if(this._FlowView){for(let e=0;e<this._FlowView._FlowData.Connections.length;e++){let o=this._FlowView._FlowData.Connections[e];o.SourceNodeHash!==t&&o.TargetNodeHash!==t||o.Data&&o.Data.HandleCustomized&&(o.Data.HandleCustomized=!1,o.Data.BezierHandles=[],o.Data.BezierHandleX=null,o.Data.BezierHandleY=null,o.Data.OrthoCorner1X=null,o.Data.OrthoCorner1Y=null,o.Data.OrthoCorner2X=null,o.Data.OrthoCorner2Y=null,o.Data.OrthoMidOffset=0)}this._FlowView._TetherService&&this._FlowView._TetherService.resetHandlesForNode(this._FlowView._FlowData.OpenPanels,t)}}resetHandlesForPanel(t){if(!this._FlowView)return;let e=this._FlowView._FlowData.OpenPanels.find(e=>e.Hash===t);e&&this._FlowView._TetherService&&this._FlowView._TetherService.resetHandlePositions(e)}}},{"fable-serviceproviderbase":89}],111:[function(t,e,o){const i=t("fable-serviceproviderbase");e.exports=class extends i{constructor(t,e,o){super(t,e,o),this.serviceType="PictServiceFlowConnectionRenderer",this._FlowView=e&&e.FlowView?e.FlowView:null}renderConnection(t,e,o){if(!this._FlowView)return;let i=this._FlowView.getPortPosition(t.SourceNodeHash,t.SourcePortHash),n=this._FlowView.getPortPosition(t.TargetNodeHash,t.TargetPortHash),a=null,r=this._FlowView.getNode(t.SourceNodeHash);if(r&&r.Ports)for(let e=0;e<r.Ports.length;e++)if(r.Ports[e].Hash===t.SourcePortHash){a=r.Ports[e].PortType||null;break}if(!i||!n)return;let s,l=t.Data||{};if("orthogonal"===(l.LineMode||"bezier")){let t=null;l.HandleCustomized&&null!=l.OrthoCorner1X&&(t={corner1:{x:l.OrthoCorner1X,y:l.OrthoCorner1Y},corner2:{x:l.OrthoCorner2X,y:l.OrthoCorner2Y}}),s=this._generateOrthogonalPath(i,n,t,l.OrthoMidOffset||0)}else{let t=this._getBezierHandles(l);s=t.length>0?this._generateMultiHandleBezierPath(i,n,t):this._generateDirectionalPath(i,n)}this._FlowView._ThemeProvider&&(s=this._FlowView._ThemeProvider.processPathString(s,t.Hash));let c=null;if(this._FlowView._ThemeProvider){let t=this._FlowView._ThemeProvider.getActiveTheme();t&&t.ConnectionConfig&&t.ConnectionConfig.StrokeDashArray&&(c=t.ConnectionConfig.StrokeDashArray)}let d,p=this._FlowView.options.ViewIdentifier,h=a?" conn-type-"+a:"";d=o?"flow-arrowhead-selected-"+p:a?"flow-arrowhead-"+a+"-"+p:"flow-arrowhead-"+p;let u=this._FlowView._ConnectorShapesProvider;if(u){let i=u.createConnectionHitAreaElement(s,t.Hash);e.appendChild(i);let n=u.createConnectionPathElement(s,t.Hash,o,p);h&&n.setAttribute("class",(n.getAttribute("class")||"")+h),n.setAttribute("marker-end","url(#"+d+")"),c&&n.setAttribute("stroke-dasharray",c),e.appendChild(n)}else{let i=this._FlowView._SVGHelperProvider.createSVGElement("path");i.setAttribute("class","pict-flow-connection-hitarea"),i.setAttribute("d",s),i.setAttribute("data-connection-hash",t.Hash),i.setAttribute("data-element-type","connection-hitarea"),e.appendChild(i);let n=this._FlowView._SVGHelperProvider.createSVGElement("path");n.setAttribute("class",`pict-flow-connection${h} ${o?"selected":""}`),n.setAttribute("d",s),n.setAttribute("data-connection-hash",t.Hash),n.setAttribute("data-element-type","connection"),n.setAttribute("marker-end","url(#"+d+")"),c&&n.setAttribute("stroke-dasharray",c),e.appendChild(n)}o&&this._renderHandles(t,e,i,n)}_computeDirectionalGeometry(t,e){return this._FlowView._PathGenerator.computeDirectionalGeometry(t,e)}_generateDirectionalPath(t,e){let o=this._computeDirectionalGeometry(t,e);return this._FlowView._PathGenerator.buildBezierPathString({x:t.x,y:t.y},{x:o.departX,y:o.departY},{x:o.cp1X,y:o.cp1Y},{x:o.cp2X,y:o.cp2Y},{x:o.approachX,y:o.approachY},{x:e.x,y:e.y})}_getBezierHandles(t){return t&&t.HandleCustomized?Array.isArray(t.BezierHandles)&&t.BezierHandles.length>0?t.BezierHandles:null!=t.BezierHandleX&&null!=t.BezierHandleY?[{x:t.BezierHandleX,y:t.BezierHandleY}]:[]:[]}_generateMultiHandleBezierPath(t,e,o){let i=this._computeDirectionalGeometry(t,e);return this._FlowView._PathGenerator.buildMultiBezierPathString({x:t.x,y:t.y},{x:i.departX,y:i.departY},o,{x:i.approachX,y:i.approachY},{x:e.x,y:e.y},i.startDir,i.endDir)}computeInsertionIndex(t,e,o,i){let n=this._computeDirectionalGeometry(o,i),a=[{x:n.departX,y:n.departY}];for(let e=0;e<t.length;e++)a.push(t[e]);a.push({x:n.approachX,y:n.approachY});let r=1/0,s=0;for(let t=0;t<a.length-1;t++){let o=this._distanceToSegment(e.x,e.y,a[t].x,a[t].y,a[t+1].x,a[t+1].y);o<r&&(r=o,s=t)}return s}_distanceToSegment(t,e,o,i,n,a){return this._FlowView._PathGenerator.distanceToSegment(t,e,o,i,n,a)}getAutoMidpoint(t,e){return this._FlowView._PathGenerator.getAutoMidpoint(t,e)}_generateOrthogonalPath(t,e,o,i){let n,a,r=this._FlowView._PathGenerator.computeDepartApproach(t,e,20);if(o&&o.corner1&&o.corner2)n=o.corner1,a=o.corner2;else{let t=this._FlowView._PathGenerator.computeAutoOrthogonalCorners(r.departX,r.departY,r.approachX,r.approachY,r.fromDir,r.toDir,i||0);n=t.corner1,a=t.corner2}return this._FlowView._PathGenerator.buildOrthogonalPathString({x:t.x,y:t.y},{x:r.departX,y:r.departY},n,a,{x:r.approachX,y:r.approachY},{x:e.x,y:e.y})}getOrthogonalGeometry(t,e,o){let i=this._FlowView._PathGenerator.computeDepartApproach(t,e,20);if(o&&o.HandleCustomized&&null!=o.OrthoCorner1X){let t={x:o.OrthoCorner1X,y:o.OrthoCorner1Y},e={x:o.OrthoCorner2X,y:o.OrthoCorner2Y};return{corner1:t,corner2:e,midpoint:{x:(t.x+e.x)/2,y:(t.y+e.y)/2}}}return this._FlowView._PathGenerator.computeAutoOrthogonalCorners(i.departX,i.departY,i.approachX,i.approachY,i.fromDir,i.toDir,o&&o.OrthoMidOffset||0)}_renderHandles(t,e,o,i){let n=t.Data||{};if("orthogonal"===(n.LineMode||"bezier")){let a=this.getOrthogonalGeometry(o,i,n);this._createHandle(e,t.Hash,"ortho-corner1",a.corner1.x,a.corner1.y,"pict-flow-connection-handle"),this._createHandle(e,t.Hash,"ortho-midpoint",a.midpoint.x,a.midpoint.y,"pict-flow-connection-handle-midpoint"),this._createHandle(e,t.Hash,"ortho-corner2",a.corner2.x,a.corner2.y,"pict-flow-connection-handle")}else{let a=this._getBezierHandles(n);if(a.length>0)for(let o=0;o<a.length;o++)this._createHandle(e,t.Hash,"bezier-handle-"+o,a[o].x,a[o].y,"pict-flow-connection-handle");else{let n=this.getAutoMidpoint(o,i);this._createHandle(e,t.Hash,"bezier-midpoint",n.x,n.y,"pict-flow-connection-handle")}}}_createHandle(t,e,o,i,n,a){if(!this._FlowView._ConnectorShapesProvider)return;let r="pict-flow-connection-handle-midpoint"===a?"connection-handle-midpoint":"connection-handle";this._FlowView._ConnectorShapesProvider.createFullHandle(t,e,o,i,n,r,"connection-handle","data-connection-hash")}_generateBezierPath(t,e){let o={x:t.x,y:t.y,side:t.side||"right"},i={x:e.x,y:e.y,side:e.side||"left"};return this._generateDirectionalPath(o,i)}renderDragConnection(t,e,o,i,n,a){let r,s=this._generateDirectionalPath({x:t,y:e,side:a||"right"},{x:o,y:i,side:"left"}),l=this._FlowView._ConnectorShapesProvider;return l?r=l.createDragConnectionElement(s):(r=this._FlowView._SVGHelperProvider.createSVGElement("path"),r.setAttribute("class","pict-flow-drag-connection"),r.setAttribute("d",s)),n.appendChild(r),r}updateDragConnection(t,e,o,i,n,a){if(!t)return;let r=this._generateDirectionalPath({x:e,y:o,side:a||"right"},{x:i,y:n,side:"left"});t.setAttribute("d",r)}}},{"fable-serviceproviderbase":89}],112:[function(t,e,o){const i=t("fable-serviceproviderbase");e.exports=class extends i{constructor(t,e,o){super(t,e,o),this.serviceType="PictServiceFlowDataManager",this._FlowView=e&&e.FlowView?e.FlowView:null}marshalToView(){if(this._FlowView&&this._FlowView.options.FlowDataAddress){const t={Fable:this._FlowView.fable,Pict:this._FlowView.pict||this._FlowView.fable,AppData:this._FlowView.pict?this._FlowView.pict.AppData:this._FlowView.fable.AppData,Bundle:this._FlowView.Bundle,Options:this._FlowView.options};let e=this._FlowView.fable.manifest.getValueByHash(t,this._FlowView.options.FlowDataAddress);"object"==typeof e&&null!==e&&this.setFlowData(e)}}marshalFromView(){if(this._FlowView&&this._FlowView.options.FlowDataAddress){const t={Fable:this._FlowView.fable,Pict:this._FlowView.pict||this._FlowView.fable,AppData:this._FlowView.pict?this._FlowView.pict.AppData:this._FlowView.fable.AppData,Bundle:this._FlowView.Bundle,Options:this._FlowView.options};this._FlowView.fable.manifest.setValueByHash(t,this._FlowView.options.FlowDataAddress,JSON.parse(JSON.stringify(this._FlowView._FlowData)))}}getFlowData(){return this._FlowView?JSON.parse(JSON.stringify(this._FlowView._FlowData)):{}}setFlowData(t){this._FlowView&&("object"==typeof t&&null!==t?(this._FlowView._FlowData={Nodes:Array.isArray(t.Nodes)?t.Nodes:[],Connections:Array.isArray(t.Connections)?t.Connections:[],OpenPanels:Array.isArray(t.OpenPanels)?t.OpenPanels:[],SavedLayouts:Array.isArray(t.SavedLayouts)?t.SavedLayouts:[],ViewState:Object.assign({PanX:0,PanY:0,Zoom:1,SelectedNodeHash:null,SelectedConnectionHash:null,SelectedTetherHash:null},t.ViewState||{})},this._FlowView._LayoutProvider&&this._FlowView._LayoutProvider.loadPersistedLayouts(),this._FlowView.initialRenderComplete&&this._FlowView.renderFlow()):this._FlowView.log.warn("PictSectionFlow setFlowData received invalid data"))}addNode(t,e,o,i,n){if(!this._FlowView)return null;let a=t||this._FlowView.options.DefaultNodeType,r=this._FlowView._NodeTypeProvider.getNodeType(a),s={Hash:`node-${this._FlowView.fable.getUUID()}`,Type:a,X:e||100,Y:o||100,Width:r&&r.DefaultWidth||this._FlowView.options.DefaultNodeWidth,Height:r&&r.DefaultHeight||this._FlowView.options.DefaultNodeHeight,Title:i||r&&r.Label||"New Node",Ports:r&&r.DefaultPorts?JSON.parse(JSON.stringify(r.DefaultPorts)):[{Hash:`port-in-${this._FlowView.fable.getUUID()}`,Direction:"input",Side:"left",Label:"In"},{Hash:`port-out-${this._FlowView.fable.getUUID()}`,Direction:"output",Side:"right",Label:"Out"}],Data:n||{}};for(let t=0;t<s.Ports.length;t++)s.Ports[t].Hash||(s.Ports[t].Hash=`port-${s.Ports[t].Direction}-${this._FlowView.fable.getUUID()}`);return this._FlowView._FlowData.Nodes.push(s),this._FlowView.renderFlow(),this.marshalFromView(),this._FlowView._EventHandlerProvider&&(this._FlowView._EventHandlerProvider.fireEvent("onNodeAdded",s),this._FlowView._EventHandlerProvider.fireEvent("onFlowChanged",this._FlowView._FlowData)),s}removeNode(t){if(!this._FlowView)return!1;let e=this._FlowView._FlowData.Nodes.findIndex(e=>e.Hash===t);if(e<0)return this._FlowView.log.warn(`PictSectionFlow removeNode: node ${t} not found`),!1;let o=this._FlowView._FlowData.Nodes.splice(e,1)[0];return this._FlowView._FlowData.Connections=this._FlowView._FlowData.Connections.filter(e=>e.SourceNodeHash!==t&&e.TargetNodeHash!==t),this._FlowView.closePanelForNode(t),this._FlowView._FlowData.ViewState.SelectedNodeHash===t&&(this._FlowView._FlowData.ViewState.SelectedNodeHash=null),this._FlowView.renderFlow(),this.marshalFromView(),this._FlowView._EventHandlerProvider&&(this._FlowView._EventHandlerProvider.fireEvent("onNodeRemoved",o),this._FlowView._EventHandlerProvider.fireEvent("onFlowChanged",this._FlowView._FlowData)),!0}addConnection(t,e,o,i,n){if(!this._FlowView)return!1;let a=this._FlowView._FlowData.Nodes.find(e=>e.Hash===t),r=this._FlowView._FlowData.Nodes.find(t=>t.Hash===o);if(!a||!r)return this._FlowView.log.warn("PictSectionFlow addConnection: source or target node not found"),!1;let s=a.Ports.find(t=>t.Hash===e),l=r.Ports.find(t=>t.Hash===i);if(!s||!l)return this._FlowView.log.warn("PictSectionFlow addConnection: source or target port not found"),!1;if(t===o)return this._FlowView.log.warn("PictSectionFlow addConnection: cannot connect a node to itself"),!1;if(this._FlowView._FlowData.Connections.find(n=>n.SourceNodeHash===t&&n.SourcePortHash===e&&n.TargetNodeHash===o&&n.TargetPortHash===i))return this._FlowView.log.warn("PictSectionFlow addConnection: duplicate connection"),!1;let c={Hash:`conn-${this._FlowView.fable.getUUID()}`,SourceNodeHash:t,SourcePortHash:e,TargetNodeHash:o,TargetPortHash:i,Data:n||{}};return this._FlowView._FlowData.Connections.push(c),this._FlowView.renderFlow(),this.marshalFromView(),this._FlowView._EventHandlerProvider&&(this._FlowView._EventHandlerProvider.fireEvent("onConnectionCreated",c),this._FlowView._EventHandlerProvider.fireEvent("onFlowChanged",this._FlowView._FlowData)),c}removeConnection(t){if(!this._FlowView)return!1;let e=this._FlowView._FlowData.Connections.findIndex(e=>e.Hash===t);if(e<0)return this._FlowView.log.warn(`PictSectionFlow removeConnection: connection ${t} not found`),!1;let o=this._FlowView._FlowData.Connections.splice(e,1)[0];return this._FlowView._FlowData.ViewState.SelectedConnectionHash===t&&(this._FlowView._FlowData.ViewState.SelectedConnectionHash=null),this._FlowView.renderFlow(),this.marshalFromView(),this._FlowView._EventHandlerProvider&&(this._FlowView._EventHandlerProvider.fireEvent("onConnectionRemoved",o),this._FlowView._EventHandlerProvider.fireEvent("onFlowChanged",this._FlowView._FlowData)),!0}}},{"fable-serviceproviderbase":89}],113:[function(t,e,o){const i=t("fable-serviceproviderbase"),n={IDLE:"idle",DRAGGING_NODE:"dragging-node",DRAGGING_PANEL:"dragging-panel",DRAGGING_HANDLE:"dragging-handle",CONNECTING:"connecting",PANNING:"panning",RESIZING_PANEL:"resizing-panel"};e.exports=class extends i{constructor(t,e,o){super(t,e,o),this.serviceType="PictServiceFlowInteractionManager",this._FlowView=e&&e.FlowView?e.FlowView:null,this._SVGElement=null,this._ViewportElement=null,this._State=n.IDLE,this._DragNodeHash=null,this._DragStartX=0,this._DragStartY=0,this._DragNodeStartX=0,this._DragNodeStartY=0,this._DragPanelHash=null,this._DragPanelStartX=0,this._DragPanelStartY=0,this._DragPanelDataStartX=0,this._DragPanelDataStartY=0,this._DragHandleConnectionHash=null,this._DragHandlePanelHash=null,this._DragHandleType=null,this._DragHandleIsTether=!1,this._PanStartX=0,this._PanStartY=0,this._PanStartPanX=0,this._PanStartPanY=0,this._ConnectSourceNodeHash=null,this._ConnectSourcePortHash=null,this._ConnectDragLine=null,this._LastClickTime=0,this._LastClickNodeHash=null,this._DoubleClickThreshold=400,this._ResizePanelHash=null,this._ResizeStartY=0,this._ResizePanelStartHeight=0,this._LastConnectionClickTime=0,this._LastConnectionClickHash=null,this._LastTetherClickTime=0,this._LastTetherClickHash=null,this._LastHandleClickTime=0,this._LastHandleClickHash=null,this._LastHandleClickType=null,this._boundOnPointerDown=this._onPointerDown.bind(this),this._boundOnPointerMove=this._onPointerMove.bind(this),this._boundOnPointerUp=this._onPointerUp.bind(this),this._boundOnWheel=this._onWheel.bind(this),this._boundOnKeyDown=this._onKeyDown.bind(this)}initialize(t,e){this._SVGElement=t,this._ViewportElement=e,this._SVGElement&&(this._SVGElement.addEventListener("pointerdown",this._boundOnPointerDown),this._SVGElement.addEventListener("pointermove",this._boundOnPointerMove),this._SVGElement.addEventListener("pointerup",this._boundOnPointerUp),this._SVGElement.addEventListener("pointerleave",this._boundOnPointerUp),this._SVGElement.addEventListener("wheel",this._boundOnWheel,{passive:!1}),document.addEventListener("keydown",this._boundOnKeyDown),this._SVGElement.addEventListener("contextmenu",t=>{t.preventDefault();let e=t.target;switch(this._getElementType(e)){case"connection":case"connection-hitarea":this._addBezierHandle(e,t);break;case"connection-handle":this._removeBezierHandle(e);break;case"tether":case"tether-hitarea":this._addTetherBezierHandle(e,t);break;case"tether-handle":this._removeTetherBezierHandle(e)}}))}destroy(){this._SVGElement&&(this._SVGElement.removeEventListener("pointerdown",this._boundOnPointerDown),this._SVGElement.removeEventListener("pointermove",this._boundOnPointerMove),this._SVGElement.removeEventListener("pointerup",this._boundOnPointerUp),this._SVGElement.removeEventListener("pointerleave",this._boundOnPointerUp),this._SVGElement.removeEventListener("wheel",this._boundOnWheel)),document.removeEventListener("keydown",this._boundOnKeyDown)}_onPointerDown(t){if(!this._FlowView)return;let e=t.target,o=this._getElementType(e);if(!e.closest||!e.closest(".pict-flow-panel-content"))switch(0===t.button&&this._SVGElement.setPointerCapture(t.pointerId),o){case"port":this._startConnection(t,e);break;case"node":case"node-body":case"panel-indicator":{let o=this._getNodeHash(e),i=Date.now();o&&o===this._LastClickNodeHash&&i-this._LastClickTime<this._DoubleClickThreshold?(this._LastClickTime=0,this._LastClickNodeHash=null,this._FlowView.togglePanel(o)):(this._LastClickTime=i,this._LastClickNodeHash=o,this._startNodeDrag(t,e));break}case"panel-titlebar":this._startPanelDrag(t,e);break;case"panel-resize":this._startPanelResize(t,e);break;case"panel-close":{let t=this._getPanelHash(e);t&&this._FlowView.closePanel(t);break}case"connection-handle":{let o=this._getConnectionHash(e),i=e.getAttribute("data-handle-type"),n=Date.now();o===this._LastHandleClickHash&&i===this._LastHandleClickType&&n-this._LastHandleClickTime<this._DoubleClickThreshold?(this._toggleConnectionLineMode(o),this._LastHandleClickTime=0,this._LastHandleClickHash=null,this._LastHandleClickType=null):(this._LastHandleClickTime=n,this._LastHandleClickHash=o,this._LastHandleClickType=i,this._startHandleDrag(t,o,null,i,!1)),t.stopPropagation();break}case"tether":case"tether-hitarea":{let o=this._getPanelHash(e),i=Date.now();o&&o===this._LastTetherClickHash&&i-this._LastTetherClickTime<this._DoubleClickThreshold?(this._LastTetherClickTime=0,this._LastTetherClickHash=null,this._addTetherBezierHandle(e,t)):(this._LastTetherClickTime=i,this._LastTetherClickHash=o,this._selectTether(e));break}case"tether-handle":{let o=this._getPanelHash(e),i=e.getAttribute("data-handle-type"),n=Date.now();o===this._LastHandleClickHash&&i===this._LastHandleClickType&&n-this._LastHandleClickTime<this._DoubleClickThreshold?(this._toggleTetherLineMode(o),this._LastHandleClickTime=0,this._LastHandleClickHash=null,this._LastHandleClickType=null):(this._LastHandleClickTime=n,this._LastHandleClickHash=o,this._LastHandleClickType=i,this._startHandleDrag(t,null,o,i,!0)),t.stopPropagation();break}case"connection":case"connection-hitarea":{let o=this._getConnectionHash(e),i=Date.now();o&&o===this._LastConnectionClickHash&&i-this._LastConnectionClickTime<this._DoubleClickThreshold?(this._LastConnectionClickTime=0,this._LastConnectionClickHash=null,this._addBezierHandle(e,t)):(this._LastConnectionClickTime=i,this._LastConnectionClickHash=o,this._selectConnection(e));break}default:0===t.button&&this._FlowView.options.EnablePanning&&this._startPanning(t)}}_onPointerMove(t){if(this._FlowView)switch(this._State){case n.DRAGGING_NODE:this._onNodeDrag(t);break;case n.DRAGGING_PANEL:this._onPanelDrag(t);break;case n.DRAGGING_HANDLE:this._onHandleDrag(t);break;case n.CONNECTING:this._onConnectionDrag(t);break;case n.RESIZING_PANEL:this._onPanelResize(t);break;case n.PANNING:this._onPan(t)}}_onPointerUp(t){if(this._FlowView)switch(this._SVGElement.hasPointerCapture&&this._SVGElement.hasPointerCapture(t.pointerId)&&this._SVGElement.releasePointerCapture(t.pointerId),this._State){case n.DRAGGING_NODE:this._endNodeDrag(t);break;case n.DRAGGING_PANEL:this._endPanelDrag(t);break;case n.DRAGGING_HANDLE:this._endHandleDrag(t);break;case n.RESIZING_PANEL:this._endPanelResize(t);break;case n.CONNECTING:this._endConnection(t);break;case n.PANNING:this._endPanning(t)}}_onWheel(t){if(!this._FlowView||!this._FlowView.options.EnableZooming)return;t.preventDefault();let e=t.deltaY>0?-this._FlowView.options.ZoomStep:this._FlowView.options.ZoomStep,o=this._FlowView.viewState.Zoom+e,i=this._SVGElement.getBoundingClientRect(),n=t.clientX-i.left,a=t.clientY-i.top;this._FlowView.setZoom(o,n,a)}_onKeyDown(t){if(this._FlowView)if("Delete"===t.key||"Backspace"===t.key){if(t.target&&("INPUT"===t.target.tagName||"TEXTAREA"===t.target.tagName||"SELECT"===t.target.tagName))return;if(t.target&&t.target.closest&&t.target.closest(".pict-flow-panel"))return;this._FlowView.deleteSelected(),t.preventDefault()}else if("Escape"===t.key){if(this._State===n.CONNECTING&&this._cancelConnection(),this._FlowView._IsFullscreen){if(this._FlowView.exitFullscreen(),this._FlowView._ToolbarView){let t=this._FlowView.options.ViewIdentifier,e=this._FlowView.pict.ContentAssignment.getElement(`#Flow-Toolbar-Fullscreen-${t}`);e.length>0&&(e[0].innerHTML="⛶ Fullscreen")}return void t.preventDefault()}this._FlowView.deselectAll()}}_startNodeDrag(t,e){if(!this._FlowView.options.EnableNodeDragging)return;let o=this._getNodeHash(e);if(!o)return;this._FlowView.selectNode(o);let i=this._FlowView.getNode(o);if(!i)return;this._State=n.DRAGGING_NODE,this._DragNodeHash=o,this._DragStartX=t.clientX,this._DragStartY=t.clientY,this._DragNodeStartX=i.X,this._DragNodeStartY=i.Y,this._SVGElement.classList.add("panning");let a=this._FlowView._NodesLayer.querySelector(`[data-node-hash="${o}"]`);a&&a.classList.add("dragging")}_onNodeDrag(t){if(!this._DragNodeHash)return;let e=this._FlowView.viewState,o=(t.clientX-this._DragStartX)/e.Zoom,i=(t.clientY-this._DragStartY)/e.Zoom,n=this._DragNodeStartX+o,a=this._DragNodeStartY+i;this._FlowView.updateNodePosition(this._DragNodeHash,n,a)}_endNodeDrag(t){this._SVGElement.classList.remove("panning");let e=this._FlowView._NodesLayer.querySelector(`[data-node-hash="${this._DragNodeHash}"]`);e&&e.classList.remove("dragging"),this._FlowView.renderFlow(),this._FlowView.marshalFromView();let o=this._FlowView.getNode(this._DragNodeHash);o&&this._FlowView._EventHandlerProvider&&(this._FlowView._EventHandlerProvider.fireEvent("onNodeMoved",o),this._FlowView._EventHandlerProvider.fireEvent("onFlowChanged",this._FlowView.flowData)),this._State=n.IDLE,this._DragNodeHash=null}_startPanelDrag(t,e){let o=this._getPanelHash(e);if(!o)return;let i=this._FlowView._FlowData.OpenPanels.find(t=>t.Hash===o);i&&(this._State=n.DRAGGING_PANEL,this._DragPanelHash=o,this._DragPanelStartX=t.clientX,this._DragPanelStartY=t.clientY,this._DragPanelDataStartX=i.X,this._DragPanelDataStartY=i.Y,this._SVGElement.classList.add("panning"))}_onPanelDrag(t){if(!this._DragPanelHash)return;let e=this._FlowView.viewState,o=(t.clientX-this._DragPanelStartX)/e.Zoom,i=(t.clientY-this._DragPanelStartY)/e.Zoom,n=this._DragPanelDataStartX+o,a=this._DragPanelDataStartY+i;this._FlowView.updatePanelPosition(this._DragPanelHash,n,a)}_endPanelDrag(t){this._SVGElement.classList.remove("panning"),this._FlowView.marshalFromView();let e=this._FlowView._FlowData.OpenPanels.find(t=>t.Hash===this._DragPanelHash);e&&this._FlowView._EventHandlerProvider&&(this._FlowView._EventHandlerProvider.fireEvent("onPanelMoved",e),this._FlowView._EventHandlerProvider.fireEvent("onFlowChanged",this._FlowView.flowData)),this._State=n.IDLE,this._DragPanelHash=null}_startPanelResize(t,e){let o=this._getPanelHash(e);if(!o)return;let i=this._FlowView._FlowData.OpenPanels.find(t=>t.Hash===o);i&&(this._State=n.RESIZING_PANEL,this._ResizePanelHash=o,this._ResizeStartY=t.clientY,this._ResizePanelStartHeight=i.Height,this._SVGElement.classList.add("panning"))}_onPanelResize(t){if(!this._ResizePanelHash)return;let e=this._FlowView.viewState,o=(t.clientY-this._ResizeStartY)/e.Zoom,i=Math.max(120,this._ResizePanelStartHeight+o),n=this._FlowView._FlowData.OpenPanels.find(t=>t.Hash===this._ResizePanelHash);if(n&&(n.Height=i),this._FlowView._PanelsLayer){let t=this._FlowView._PanelsLayer.querySelector('[data-panel-hash="'+this._ResizePanelHash+'"]');t&&t.setAttribute("height",String(i))}}_endPanelResize(t){this._SVGElement.classList.remove("panning"),this._FlowView.renderFlow(),this._FlowView.marshalFromView(),this._FlowView._EventHandlerProvider&&this._FlowView._EventHandlerProvider.fireEvent("onFlowChanged",this._FlowView.flowData),this._State=n.IDLE,this._ResizePanelHash=null}_startHandleDrag(t,e,o,i,a){this._State=n.DRAGGING_HANDLE,this._DragHandleConnectionHash=e,this._DragHandlePanelHash=o,this._DragHandleType=i,this._DragHandleIsTether=a,this._DragStartX=t.clientX,this._DragStartY=t.clientY,this._SVGElement.classList.add("panning")}_onHandleDrag(t){let e=this._FlowView.screenToSVGCoords(t.clientX,t.clientY);this._DragHandleIsTether?this._FlowView.updateTetherHandle(this._DragHandlePanelHash,this._DragHandleType,e.x,e.y):this._FlowView.updateConnectionHandle(this._DragHandleConnectionHash,this._DragHandleType,e.x,e.y)}_endHandleDrag(t){if(this._SVGElement.classList.remove("panning"),this._FlowView.renderFlow(),this._FlowView.marshalFromView(),this._FlowView._EventHandlerProvider)if(this._FlowView._EventHandlerProvider.fireEvent("onFlowChanged",this._FlowView.flowData),this._DragHandleIsTether){let t=this._FlowView._FlowData.OpenPanels.find(t=>t.Hash===this._DragHandlePanelHash);t&&this._FlowView._EventHandlerProvider.fireEvent("onTetherHandleMoved",t)}else{let t=this._FlowView.getConnection(this._DragHandleConnectionHash);t&&this._FlowView._EventHandlerProvider.fireEvent("onConnectionHandleMoved",t)}this._State=n.IDLE,this._DragHandleConnectionHash=null,this._DragHandlePanelHash=null,this._DragHandleType=null,this._DragHandleIsTether=!1}_addBezierHandle(t,e){let o=this._getConnectionHash(t);if(!o)return;this._FlowView.selectConnection(o);let i=this._FlowView.screenToSVGCoords(e.clientX,e.clientY);this._FlowView.addConnectionHandle(o,i.x,i.y)}_removeBezierHandle(t){let e=this._getConnectionHash(t);if(!e)return;let o=t.getAttribute("data-handle-type");if(!o||!o.startsWith("bezier-handle-"))return;let i=parseInt(o.replace("bezier-handle-",""),10);isNaN(i)||this._FlowView.removeConnectionHandle(e,i)}_addTetherBezierHandle(t,e){let o=this._getPanelHash(t);if(!o)return;this._FlowView.selectTether(o);let i=this._FlowView.screenToSVGCoords(e.clientX,e.clientY);this._FlowView.addTetherHandle(o,i.x,i.y)}_removeTetherBezierHandle(t){let e=this._getPanelHash(t);if(!e)return;let o=t.getAttribute("data-handle-type");if(!o||!o.startsWith("bezier-handle-"))return;let i=parseInt(o.replace("bezier-handle-",""),10);isNaN(i)||this._FlowView.removeTetherHandle(e,i)}_toggleConnectionLineMode(t){let e=this._FlowView.getConnection(t);if(!e)return;e.Data||(e.Data={});let o=e.Data.LineMode||"bezier";e.Data.LineMode="bezier"===o?"orthogonal":"bezier",e.Data.HandleCustomized=!1,e.Data.BezierHandles=[],e.Data.BezierHandleX=null,e.Data.BezierHandleY=null,e.Data.OrthoCorner1X=null,e.Data.OrthoCorner1Y=null,e.Data.OrthoCorner2X=null,e.Data.OrthoCorner2Y=null,e.Data.OrthoMidOffset=0,this._FlowView.renderFlow(),this._FlowView.marshalFromView(),this._FlowView._EventHandlerProvider&&(this._FlowView._EventHandlerProvider.fireEvent("onConnectionModeChanged",e),this._FlowView._EventHandlerProvider.fireEvent("onFlowChanged",this._FlowView.flowData))}_toggleTetherLineMode(t){let e=this._FlowView._FlowData.OpenPanels.find(e=>e.Hash===t);e&&(this._FlowView._TetherService&&this._FlowView._TetherService.toggleLineMode(e),this._FlowView.renderFlow(),this._FlowView.marshalFromView(),this._FlowView._EventHandlerProvider&&(this._FlowView._EventHandlerProvider.fireEvent("onTetherModeChanged",e),this._FlowView._EventHandlerProvider.fireEvent("onFlowChanged",this._FlowView.flowData)))}_selectTether(t){let e=this._getPanelHash(t);e&&this._FlowView.selectTether(e)}_startConnection(t,e){if(!this._FlowView.options.EnableConnectionCreation)return;let o=e.getAttribute("data-node-hash"),i=e.getAttribute("data-port-hash"),a=e.getAttribute("data-port-direction");if(!o||!i)return;if("output"!==a)return;this._State=n.CONNECTING,this._ConnectSourceNodeHash=o,this._ConnectSourcePortHash=i,this._SVGElement.classList.add("connecting");let r=this._FlowView.getPortPosition(o,i);r&&(this._ConnectDragLine=document.createElementNS("http://www.w3.org/2000/svg","path"),this._ConnectDragLine.setAttribute("class","pict-flow-drag-connection"),this._ConnectDragLine.setAttribute("d",`M ${r.x} ${r.y} L ${r.x} ${r.y}`),this._FlowView._ViewportElement.appendChild(this._ConnectDragLine)),t.stopPropagation()}_onConnectionDrag(t){if(!this._ConnectDragLine)return;let e=this._FlowView.getPortPosition(this._ConnectSourceNodeHash,this._ConnectSourcePortHash);if(!e)return;let o=this._FlowView.screenToSVGCoords(t.clientX,t.clientY),i=.5*Math.abs(o.x-e.x),n=`M ${e.x} ${e.y} C ${e.x+i} ${e.y}, ${o.x-i} ${o.y}, ${o.x} ${o.y}`;this._ConnectDragLine.setAttribute("d",n)}_endConnection(t){this._ConnectDragLine&&this._ConnectDragLine.parentNode&&this._ConnectDragLine.parentNode.removeChild(this._ConnectDragLine),this._ConnectDragLine=null,this._SVGElement.classList.remove("connecting");let e=document.elementFromPoint(t.clientX,t.clientY);if(e){let t=e.getAttribute("data-port-hash"),o=e.getAttribute("data-node-hash"),i=e.getAttribute("data-port-direction");t&&o&&"input"===i&&this._FlowView.addConnection(this._ConnectSourceNodeHash,this._ConnectSourcePortHash,o,t)}this._State=n.IDLE,this._ConnectSourceNodeHash=null,this._ConnectSourcePortHash=null}_cancelConnection(){this._ConnectDragLine&&this._ConnectDragLine.parentNode&&this._ConnectDragLine.parentNode.removeChild(this._ConnectDragLine),this._ConnectDragLine=null,this._SVGElement.classList.remove("connecting"),this._State=n.IDLE,this._ConnectSourceNodeHash=null,this._ConnectSourcePortHash=null}_startPanning(t){this._FlowView.deselectAll(),this._State=n.PANNING,this._PanStartX=t.clientX,this._PanStartY=t.clientY,this._PanStartPanX=this._FlowView.viewState.PanX,this._PanStartPanY=this._FlowView.viewState.PanY,this._SVGElement.classList.add("panning")}_onPan(t){let e=t.clientX-this._PanStartX,o=t.clientY-this._PanStartY;this._FlowView.viewState.PanX=this._PanStartPanX+e,this._FlowView.viewState.PanY=this._PanStartPanY+o,this._FlowView.updateViewportTransform()}_endPanning(t){this._SVGElement.classList.remove("panning"),this._State=n.IDLE}_selectConnection(t){let e=this._getConnectionHash(t);e&&this._FlowView.selectConnection(e)}_getElementType(t){if(!t)return"background";let e=t.getAttribute?t.getAttribute("data-element-type"):null;if(e)return e;let o=t.parentElement,i=0;for(;o&&i<5;){if(e=o.getAttribute?o.getAttribute("data-element-type"):null,e)return e;o=o.parentElement,i++}return"background"}_getNodeHash(t){if(!t)return null;let e=t.getAttribute?t.getAttribute("data-node-hash"):null;if(e)return e;let o=t.parentElement,i=0;for(;o&&i<5;){if(e=o.getAttribute?o.getAttribute("data-node-hash"):null,e)return e;o=o.parentElement,i++}return null}_getPanelHash(t){if(!t)return null;let e=t.getAttribute?t.getAttribute("data-panel-hash"):null;if(e)return e;let o=t.parentElement,i=0;for(;o&&i<5;){if(e=o.getAttribute?o.getAttribute("data-panel-hash"):null,e)return e;o=o.parentElement,i++}return null}_getConnectionHash(t){if(!t)return null;let e=t.getAttribute?t.getAttribute("data-connection-hash"):null;if(e)return e;let o=t.parentElement,i=0;for(;o&&i<5;){if(e=o.getAttribute?o.getAttribute("data-connection-hash"):null,e)return e;o=o.parentElement,i++}return null}},e.exports.INTERACTION_STATES=n},{"fable-serviceproviderbase":89}],114:[function(t,e,o){const i=t("fable-serviceproviderbase");e.exports=class extends i{constructor(t,e,o){super(t,e,o),this.serviceType="PictServiceFlowLayout",this._FlowView=e&&e.FlowView?e.FlowView:null,this._HorizontalSpacing=250,this._VerticalSpacing=120,this._StartX=100,this._StartY=100}snapToGrid(t,e){return!e||e<=0?t:Math.round(t/e)*e}autoLayout(t,e){if(!t||0===t.length)return;let o={},i={},n={};for(let e=0;e<t.length;e++){let a=t[e];o[a.Hash]=a,i[a.Hash]=0,n[a.Hash]=[]}for(let t=0;t<e.length;t++){let o=e[t];i.hasOwnProperty(o.TargetNodeHash)&&i[o.TargetNodeHash]++,n.hasOwnProperty(o.SourceNodeHash)&&n[o.SourceNodeHash].push(o.TargetNodeHash)}let a=[],r=[],s={};for(let t in i)0===i[t]&&r.push(t);for(;r.length>0;){let t=[],e=[];for(let o=0;o<r.length;o++){let a=r[o];if(s[a])continue;s[a]=!0,t.push(a);let l=n[a]||[];for(let t=0;t<l.length;t++){let o=l[t];i[o]--,i[o]<=0&&!s[o]&&e.push(o)}}t.length>0&&a.push(t),r=e}let l=[];for(let e=0;e<t.length;e++)s[t[e].Hash]||l.push(t[e].Hash);l.length>0&&a.push(l);let c=this._StartX;for(let t=0;t<a.length;t++){let e=a[t],i=0,n=0;for(let t=0;t<e.length;t++){let i=o[e[t]];i&&(n+=i.Height||80,t<e.length-1&&(n+=this._VerticalSpacing))}let r=this._StartY;for(let t=0;t<e.length;t++){let n=o[e[t]];if(!n)continue;n.X=c,n.Y=r;let a=n.Width||180,s=n.Height||80;i=Math.max(i,a),r+=s+this._VerticalSpacing}c+=i+this._HorizontalSpacing}}autoLayoutSubset(t,e,o){if(!t||0===t.length)return;let i=this._StartX,n=this._StartY;if(e&&e.length>0){let t=-1/0;for(let o=0;o<e.length;o++){let i=e[o].X+(e[o].Width||180);i>t&&(t=i)}i=t+this._HorizontalSpacing}let a={};for(let e=0;e<t.length;e++)a[t[e].Hash]=!0;let r={},s={},l={};for(let e=0;e<t.length;e++){let o=t[e];r[o.Hash]=o,s[o.Hash]=0,l[o.Hash]=[]}for(let t=0;t<o.length;t++){let e=o[t],i=a[e.SourceNodeHash],n=a[e.TargetNodeHash];i&&n&&(s[e.TargetNodeHash]++,l[e.SourceNodeHash].push(e.TargetNodeHash))}let c=[],d=[],p={};for(let t in s)0===s[t]&&d.push(t);for(;d.length>0;){let t=[],e=[];for(let o=0;o<d.length;o++){let i=d[o];if(p[i])continue;p[i]=!0,t.push(i);let n=l[i]||[];for(let t=0;t<n.length;t++){let o=n[t];s[o]--,s[o]<=0&&!p[o]&&e.push(o)}}t.length>0&&c.push(t),d=e}let h=[];for(let e=0;e<t.length;e++)p[t[e].Hash]||h.push(t[e].Hash);h.length>0&&c.push(h);let u=i;for(let t=0;t<c.length;t++){let e=c[t],o=0,i=n;for(let t=0;t<e.length;t++){let n=r[e[t]];if(!n)continue;n.X=u,n.Y=i;let a=n.Width||180,s=n.Height||80;o=Math.max(o,a),i+=s+this._VerticalSpacing}u+=o+this._HorizontalSpacing}}centerNodes(t,e,o){if(!t||0===t.length)return;let i=1/0,n=1/0,a=-1/0,r=-1/0;for(let e=0;e<t.length;e++)i=Math.min(i,t[e].X),n=Math.min(n,t[e].Y),a=Math.max(a,t[e].X+(t[e].Width||180)),r=Math.max(r,t[e].Y+(t[e].Height||80));let s=e-(i+a)/2,l=o-(n+r)/2;for(let e=0;e<t.length;e++)t[e].X+=s,t[e].Y+=l}}},{"fable-serviceproviderbase":89}],115:[function(t,e,o){const i=t("fable-serviceproviderbase");e.exports=class extends i{constructor(t,e,o){super(t,e,o),this.serviceType="PictServiceFlowPanelManager",this._FlowView=e&&e.FlowView?e.FlowView:null}openPanel(t){let e=this._FlowView.getNode(t);if(!e)return!1;let o=this._FlowView._NodeTypeProvider.getNodeType(e.Type);if(!o)return!1;let i=this._FlowView._FlowData.OpenPanels.find(e=>e.NodeHash===t);if(i)return i;let n,a,r,s,l=o.PropertiesPanel,c=`panel-${this.fable.getUUID()}`;l?(n=l.DefaultWidth||300,a=l.DefaultHeight||200,r=l.PanelType||"Base",s=l.Title||o.Label||"Properties"):(n=240,a=180,r="Info",s=o.Label||e.Title||"Node Info");let d={Hash:c,NodeHash:t,PanelType:r,Title:s,X:e.X+e.Width+30,Y:e.Y,Width:n,Height:a};return this._FlowView._FlowData.OpenPanels.push(d),this._FlowView.renderFlow(),this._FlowView.marshalFromView(),this._FlowView._EventHandlerProvider&&(this._FlowView._EventHandlerProvider.fireEvent("onPanelOpened",d),this._FlowView._EventHandlerProvider.fireEvent("onFlowChanged",this._FlowView._FlowData)),d}closePanel(t){let e=this._FlowView._FlowData.OpenPanels.findIndex(e=>e.Hash===t);if(e<0)return!1;let o=this._FlowView._FlowData.OpenPanels.splice(e,1)[0];return this._FlowView._PropertiesPanelView&&this._FlowView._PropertiesPanelView.destroyPanel(t),this._FlowView.renderFlow(),this._FlowView.marshalFromView(),this._FlowView._EventHandlerProvider&&(this._FlowView._EventHandlerProvider.fireEvent("onPanelClosed",o),this._FlowView._EventHandlerProvider.fireEvent("onFlowChanged",this._FlowView._FlowData)),!0}closePanelForNode(t){let e=this._FlowView._FlowData.OpenPanels.filter(e=>e.NodeHash===t);if(0===e.length)return!1;for(let t=0;t<e.length;t++){let o=this._FlowView._FlowData.OpenPanels.indexOf(e[t]);o>=0&&this._FlowView._FlowData.OpenPanels.splice(o,1),this._FlowView._PropertiesPanelView&&this._FlowView._PropertiesPanelView.destroyPanel(e[t].Hash)}return!0}togglePanel(t){let e=this._FlowView._FlowData.OpenPanels.find(e=>e.NodeHash===t);return e?(this.closePanel(e.Hash),!1):this.openPanel(t)}updatePanelPosition(t,e,o){let i=this._FlowView._FlowData.OpenPanels.find(e=>e.Hash===t);if(i){if(i.X=e,i.Y=o,this._FlowView._resetHandlesForPanel(t),this._FlowView._PanelsLayer){let i=this._FlowView._PanelsLayer.querySelector(`[data-panel-hash="${t}"]`);i&&(i.setAttribute("x",String(e)),i.setAttribute("y",String(o)))}this._FlowView._renderTethersForNode(i.NodeHash)}}}},{"fable-serviceproviderbase":89}],116:[function(t,e,o){const i=t("fable-serviceproviderbase");e.exports=class extends i{constructor(t,e,o){super(t,e,o),this.serviceType="PictServiceFlowPathGenerator",this._FlowView=e&&e.FlowView?e.FlowView:null}computeDepartApproach(t,e,o){let i=this._FlowView._GeometryProvider,n=i.sideDirection(t.side||"right"),a=i.sideDirection(e.side||"left");return{departX:t.x+n.dx*o,departY:t.y+n.dy*o,approachX:e.x+a.dx*o,approachY:e.y+a.dy*o,fromDir:n,toDir:a}}computeAutoOrthogonalCorners(t,e,o,i,n,a,r){let s,l,c,d=r||0,p=Math.abs(n.dx)>0,h=Math.abs(a.dx)>0;if(p&&h){let n=(t+o)/2+d;s={x:n,y:e},l={x:n,y:i},c={x:n,y:(e+i)/2}}else if(p||h)p&&!h?(s={x:o+d,y:e},l={x:o+d,y:i},c={x:o+d,y:(e+i)/2}):(s={x:t,y:i+d},l={x:o,y:i+d},c={x:(t+o)/2,y:i+d});else{let n=(e+i)/2+d;s={x:t,y:n},l={x:o,y:n},c={x:(t+o)/2,y:n}}return{corner1:s,corner2:l,midpoint:c}}evaluateCubicBezier(t,e,o,i,n){let a=1-n,r=a*a,s=r*a,l=n*n,c=l*n;return{x:s*t.x+3*r*n*e.x+3*a*l*o.x+c*i.x,y:s*t.y+3*r*n*e.y+3*a*l*o.y+c*i.y}}buildBezierPathString(t,e,o,i,n,a){return`M ${t.x} ${t.y} L ${e.x} ${e.y} C ${o.x} ${o.y}, ${i.x} ${i.y}, ${n.x} ${n.y} L ${a.x} ${a.y}`}buildSplitBezierPathString(t,e,o,i,n,a,r,s,l){return`M ${t.x} ${t.y} L ${e.x} ${e.y} C ${o.x} ${o.y}, ${i.x} ${i.y}, ${n.x} ${n.y} C ${a.x} ${a.y}, ${r.x} ${r.y}, ${s.x} ${s.y} L ${l.x} ${l.y}`}buildMultiBezierPathString(t,e,o,i,n,a,r){let s=[e];for(let t=0;t<o.length;t++)s.push(o[t]);s.push(i);let l=`M ${t.x} ${t.y} L ${e.x} ${e.y}`;for(let t=0;t<s.length-1;t++){let e=s[t],o=s[t+1],i=o.x-e.x,n=o.y-e.y,c=Math.sqrt(i*i+n*n);c<1&&(c=1);let d,p,h,u,f=.35*c;if(0===t)d=a.dx,p=a.dy;else{let e=s[t-1],o=s[t+1];d=o.x-e.x,p=o.y-e.y;let i=Math.sqrt(d*d+p*p);i<1&&(i=1),d/=i,p/=i}if(t===s.length-2)h=-r.dx,u=-r.dy;else{let e=s[t],o=s[t+2];h=o.x-e.x,u=o.y-e.y;let i=Math.sqrt(h*h+u*u);i<1&&(i=1),h/=i,u/=i}l+=` C ${e.x+d*f} ${e.y+p*f}, ${o.x-h*f} ${o.y-u*f}, ${o.x} ${o.y}`}return l+=` L ${n.x} ${n.y}`,l}buildOrthogonalPathString(t,e,o,i,n,a){return`M ${t.x} ${t.y} L ${e.x} ${e.y} L ${o.x} ${o.y} L ${i.x} ${i.y} L ${n.x} ${n.y} L ${a.x} ${a.y}`}computeDirectionalGeometry(t,e){let o,i=this._FlowView._GeometryProvider.sideDirection(t.side||"right"),n=this._FlowView._GeometryProvider.sideDirection(e.side||"left"),a=t.x+20*i.dx,r=t.y+20*i.dy,s=e.x+20*n.dx,l=e.y+20*n.dy,c=Math.abs(s-a),d=Math.abs(l-r),p=Math.sqrt(c*c+d*d),h=Math.max(Math.min(.4*p,180),30),u=0!==i.dx&&0!==n.dx||0!==i.dy&&0!==n.dy,f=!1;if(u&&(1===i.dx&&-1===n.dx&&e.x>=t.x||-1===i.dx&&1===n.dx&&e.x<=t.x||1===i.dy&&-1===n.dy&&e.y>=t.y||-1===i.dy&&1===n.dy&&e.y<=t.y)&&(f=!0),f){let t=0!==i.dx?c:d;o=Math.max(.35*t,30)}else o=u?Math.max(h,60):Math.max(.8*h,40);return{departX:a,departY:r,approachX:s,approachY:l,cp1X:a+i.dx*o,cp1Y:r+i.dy*o,cp2X:s+n.dx*o,cp2Y:l+n.dy*o,startDir:i,endDir:n}}distanceToSegment(t,e,o,i,n,a){let r=n-o,s=a-i,l=r*r+s*s;if(l<.001){let n=t-o,a=e-i;return Math.sqrt(n*n+a*a)}let c=((t-o)*r+(e-i)*s)/l;c<0&&(c=0),c>1&&(c=1);let d=t-(o+c*r),p=e-(i+c*s);return Math.sqrt(d*d+p*p)}getAutoMidpoint(t,e){let o=this.computeDirectionalGeometry(t,e);return this.evaluateCubicBezier({x:o.departX,y:o.departY},{x:o.cp1X,y:o.cp1Y},{x:o.cp2X,y:o.cp2Y},{x:o.approachX,y:o.approachY},.5)}getAutoMidpointSimple(t,e,o){let i=this.computeDepartApproach(t,e,o),n=Math.abs(i.approachX-i.departX),a=Math.abs(i.approachY-i.departY),r=.4*Math.max(n,a,40),s={x:i.departX,y:i.departY},l={x:i.departX+i.fromDir.dx*r,y:i.departY+i.fromDir.dy*r},c={x:i.approachX+i.toDir.dx*r,y:i.approachY+i.toDir.dy*r},d={x:i.approachX,y:i.approachY};return this.evaluateCubicBezier(s,l,c,d,.5)}}},{"fable-serviceproviderbase":89}],117:[function(t,e,o){const i=t("fable-serviceproviderbase");e.exports=class extends i{constructor(t,e,o){super(t,e,o),this.serviceType="PictServiceFlowPortRenderer",this._FlowView=e&&e.FlowView?e.FlowView:null}renderPorts(t,e,o,i,n,a){if(!this._FlowView)return;if(!t.Ports||!Array.isArray(t.Ports))return;n&&n.PortLabelsVertical,n&&n.PortLabelPadding,n&&n.PortLabelsOutside;let r=this._FlowView._GeometryProvider,s={};for(let e=0;e<t.Ports.length;e++){let o=t.Ports[e],i=o.Side||("input"===o.Direction?"left":"right");s[i]||(s[i]=[]),s[i].push(o)}let l={};for(let t in s)l[t]=s[t].length;for(let n in s){let c=s[n],d=r?r.getEdgeFromSide(n):n;for(let r=0;r<c.length;r++){let s=c[r],p=this.getPortLocalPosition(n,r,c.length,o,i,a,l),h=null;if(s.Label){let t,n,a,r,l,c,u,f,g,m,w={"event-in":"#3498db","event-out":"#2ecc71",setting:"#e67e22",value:"#f1c40f",error:"#e74c3c"},v=s.PortType&&w[s.PortType]||"#95a5a6",b=12,y=5,F=2,S=1,P=5,_=5*s.Label.length;"left"===d?(a=P+y+_+y+F,t=S,n=p.y-b/2,r=t+P+y,l="start",c=t+a-F,u=n,f=F,g=b,m="M "+t+" "+n+" L "+(t+a)+" "+n+" L "+(t+a)+" "+(n+b)+" L "+t+" "+(n+b)):"right"===d?(a=F+y+_+y+P,t=o-a-S,n=p.y-b/2,r=t+F+y,l="start",c=t,u=n,f=F,g=b,m="M "+(t+a)+" "+n+" L "+t+" "+n+" L "+t+" "+(n+b)+" L "+(t+a)+" "+(n+b)):"top"===d?(a=_+2*y,t=p.x-a/2,n=S,r=p.x,l="middle",c=t,u=n+b-F,f=a,g=F,m="M "+t+" "+n+" L "+t+" "+(n+b)+" L "+(t+a)+" "+(n+b)+" L "+(t+a)+" "+n):(a=_+2*y,t=p.x-a/2,n=i-b-S,r=p.x,l="middle",c=t,u=n,f=a,g=F,m="M "+t+" "+(n+b)+" L "+t+" "+n+" L "+(t+a)+" "+n+" L "+(t+a)+" "+(n+b));let x=this._FlowView._SVGHelperProvider.createSVGElement("rect");x.setAttribute("class","pict-flow-port-label-bg"),x.setAttribute("x",String(t)),x.setAttribute("y",String(n)),x.setAttribute("width",String(a)),x.setAttribute("height",String(b)),x.setAttribute("fill","var(--pf-port-label-bg, rgba(255, 253, 240, 0.5))"),e.appendChild(x);let D=this._FlowView._SVGHelperProvider.createSVGElement("path");D.setAttribute("class","pict-flow-port-label-bg"),D.setAttribute("d",m),D.setAttribute("fill","none"),D.setAttribute("stroke",v),D.setAttribute("stroke-width","0.75"),e.appendChild(D);let C=this._FlowView._SVGHelperProvider.createSVGElement("rect");C.setAttribute("class","pict-flow-port-label-bg"),C.setAttribute("x",String(c)),C.setAttribute("y",String(u)),C.setAttribute("width",String(f)),C.setAttribute("height",String(g)),C.setAttribute("fill",v),e.appendChild(C),h=this._FlowView._SVGHelperProvider.createSVGElement("text"),h.setAttribute("class","pict-flow-port-label"),h.setAttribute("fill","var(--pf-port-label-text, #2c3e50)"),h.textContent=s.Label,h.setAttribute("x",String(r)),h.setAttribute("y",String(n+b/2)),h.setAttribute("text-anchor",l),h.setAttribute("dominant-baseline","central")}let u,f=this._FlowView._ConnectorShapesProvider;if(f)u=f.createPortElement(s,p,t.Hash);else{u=this._FlowView._SVGHelperProvider.createSVGElement("circle");let e=`pict-flow-port ${s.Direction}`;s.PortType&&(e+=` port-type-${s.PortType}`),u.setAttribute("class",e),u.setAttribute("cx",String(p.x)),u.setAttribute("cy",String(p.y)),u.setAttribute("r","5"),u.setAttribute("data-port-hash",s.Hash),u.setAttribute("data-node-hash",t.Hash),u.setAttribute("data-port-direction",s.Direction),s.PortType&&u.setAttribute("data-port-type",s.PortType),u.setAttribute("data-element-type","port")}e.appendChild(u),h&&e.appendChild(h)}}}getPortLocalPosition(t,e,o,i,n,a,r){return this._FlowView._GeometryProvider.getPortLocalPosition(t,e,o,i,n,a,r)}}},{"fable-serviceproviderbase":89}],118:[function(t,e,o){const i=t("fable-serviceproviderbase");e.exports=class extends i{constructor(t,e,o){super(t,e,o),this.serviceType="PictServiceFlowRenderManager",this._FlowView=e&&e.FlowView?e.FlowView:null}renderFlow(){if(this._FlowView&&this._FlowView._NodesLayer&&this._FlowView._ConnectionsLayer){for(;this._FlowView._NodesLayer.firstChild;)this._FlowView._NodesLayer.removeChild(this._FlowView._NodesLayer.firstChild);for(;this._FlowView._ConnectionsLayer.firstChild;)this._FlowView._ConnectionsLayer.removeChild(this._FlowView._ConnectionsLayer.firstChild);for(let t=0;t<this._FlowView._FlowData.Connections.length;t++){let e=this._FlowView._FlowData.Connections[t],o=this._FlowView._FlowData.ViewState.SelectedConnectionHash===e.Hash;this._FlowView._ConnectionRenderer.renderConnection(e,this._FlowView._ConnectionsLayer,o)}for(let t=0;t<this._FlowView._FlowData.Nodes.length;t++){let e=this._FlowView._FlowData.Nodes[t],o=this._FlowView._FlowData.ViewState.SelectedNodeHash===e.Hash,i=this._FlowView._NodeTypeProvider.getNodeType(e.Type);if(i&&i.DefaultPorts&&e.Ports)for(let t=0;t<e.Ports.length;t++){let o=e.Ports[t];for(let t=0;t<i.DefaultPorts.length;t++){let e=i.DefaultPorts[t];if(e.Label===o.Label&&e.Direction===o.Direction){e.PortType&&(o.PortType=e.PortType),e.Side&&(o.Side=e.Side);break}}}this._FlowView._NodeView.renderNode(e,this._FlowView._NodesLayer,o,i)}this._FlowView._PropertiesPanelView&&this._FlowView._PanelsLayer&&this._FlowView._TethersLayer&&this._FlowView._PropertiesPanelView.renderPanels(this._FlowView._FlowData.OpenPanels,this._FlowView._PanelsLayer,this._FlowView._TethersLayer,this._FlowView._FlowData.ViewState.SelectedTetherHash),this._FlowView.updateViewportTransform()}}renderSingleConnection(t){if(!this._FlowView||!this._FlowView._ConnectionsLayer)return;let e=this._FlowView._ConnectionsLayer.querySelectorAll(`[data-connection-hash="${t}"]`);for(let t=0;t<e.length;t++)e[t].remove();let o=this._FlowView.getConnection(t);if(!o)return;let i=this._FlowView._FlowData.ViewState.SelectedConnectionHash===t;this._FlowView._ConnectionRenderer.renderConnection(o,this._FlowView._ConnectionsLayer,i)}renderSingleTether(t){if(!this._FlowView||!this._FlowView._TethersLayer||!this._FlowView._TetherService)return;let e=this._FlowView._TethersLayer.querySelectorAll(`[data-panel-hash="${t}"]`);for(let t=0;t<e.length;t++)e[t].remove();let o=this._FlowView._FlowData.OpenPanels.find(e=>e.Hash===t);if(!o)return;let i=this._FlowView.getNode(o.NodeHash);if(!i)return;let n=this._FlowView._FlowData.ViewState.SelectedTetherHash===t;this._FlowView._TetherService.renderTether(o,i,this._FlowView._TethersLayer,n,this._FlowView.options.ViewIdentifier)}updateNodePosition(t,e,o){if(!this._FlowView)return;let i=this._FlowView.getNode(t);if(!i)return;this._FlowView.options.EnableGridSnap&&(e=this._FlowView._LayoutService.snapToGrid(e,this._FlowView.options.GridSnapSize),o=this._FlowView._LayoutService.snapToGrid(o,this._FlowView.options.GridSnapSize)),i.X=e,i.Y=o,this._FlowView._resetHandlesForNode(t);let n=this._FlowView._NodesLayer.querySelector(`[data-node-hash="${t}"]`);n&&n.setAttribute("transform",`translate(${e}, ${o})`),this.renderConnectionsForNode(t),this.renderTethersForNode(t)}renderConnectionsForNode(t){if(!this._FlowView||!this._FlowView._ConnectionsLayer)return;let e=this._FlowView._FlowData.Connections.filter(e=>e.SourceNodeHash===t||e.TargetNodeHash===t);for(let t=0;t<e.length;t++){let o=e[t],i=this._FlowView._FlowData.ViewState.SelectedConnectionHash===o.Hash,n=this._FlowView._ConnectionsLayer.querySelectorAll(`[data-connection-hash="${o.Hash}"]`);for(let t=0;t<n.length;t++)n[t].remove();this._FlowView._ConnectionRenderer.renderConnection(o,this._FlowView._ConnectionsLayer,i)}}renderTethersForNode(t){if(!this._FlowView||!this._FlowView._TethersLayer||!this._FlowView._TetherService)return;let e=this._FlowView._FlowData.OpenPanels.filter(e=>e.NodeHash===t);if(0!==e.length)for(let t=0;t<e.length;t++){let o=this._FlowView._TethersLayer.querySelectorAll(`[data-panel-hash="${e[t].Hash}"]`);for(let t=0;t<o.length;t++)o[t].remove();let i=this._FlowView.getNode(e[t].NodeHash);if(!i)continue;let n=this._FlowView._FlowData.ViewState.SelectedTetherHash===e[t].Hash;this._FlowView._TetherService.renderTether(e[t],i,this._FlowView._TethersLayer,n,this._FlowView.options.ViewIdentifier)}}reinjectMarkerDefs(){if(!this._FlowView||!this._FlowView._ConnectorShapesProvider||!this._FlowView._SVGElement)return;let t=this._FlowView.options.ViewIdentifier,e=this._FlowView._SVGElement.querySelector("defs");if(!e)return;let o=e.querySelectorAll("marker");for(let t=0;t<o.length;t++)o[t].remove();let i=this._FlowView._ConnectorShapesProvider.generateMarkerDefs(t),n=document.createElementNS("http://www.w3.org/2000/svg","svg");for(n.innerHTML=i;n.firstChild;)e.appendChild(n.firstChild)}}},{"fable-serviceproviderbase":89}],119:[function(t,e,o){const i=t("fable-serviceproviderbase");e.exports=class extends i{constructor(t,e,o){super(t,e,o),this.serviceType="PictServiceFlowSelectionManager",this._FlowView=e&&e.FlowView?e.FlowView:null}selectNode(t){let e=this._FlowView._FlowData.ViewState.SelectedNodeHash;if(this._FlowView._FlowData.ViewState.SelectedNodeHash=t,this._FlowView._FlowData.ViewState.SelectedConnectionHash=null,this._FlowView._FlowData.ViewState.SelectedTetherHash=null,this._FlowView.renderFlow(),this._FlowView._EventHandlerProvider&&t!==e){let e=t?this._FlowView._FlowData.Nodes.find(e=>e.Hash===t):null;this._FlowView._EventHandlerProvider.fireEvent("onNodeSelected",e)}}selectConnection(t){let e=this._FlowView._FlowData.ViewState.SelectedConnectionHash;if(this._FlowView._FlowData.ViewState.SelectedConnectionHash=t,this._FlowView._FlowData.ViewState.SelectedNodeHash=null,this._FlowView._FlowData.ViewState.SelectedTetherHash=null,this._FlowView.renderFlow(),this._FlowView._EventHandlerProvider&&t!==e){let e=t?this._FlowView._FlowData.Connections.find(e=>e.Hash===t):null;this._FlowView._EventHandlerProvider.fireEvent("onConnectionSelected",e)}}selectTether(t){let e=this._FlowView._FlowData.ViewState.SelectedTetherHash;if(this._FlowView._FlowData.ViewState.SelectedTetherHash=t,this._FlowView._FlowData.ViewState.SelectedNodeHash=null,this._FlowView._FlowData.ViewState.SelectedConnectionHash=null,this._FlowView.renderFlow(),this._FlowView._EventHandlerProvider&&t!==e){let e=t?this._FlowView._FlowData.OpenPanels.find(e=>e.Hash===t):null;this._FlowView._EventHandlerProvider.fireEvent("onTetherSelected",e)}}deselectAll(){this._FlowView._FlowData.ViewState.SelectedNodeHash=null,this._FlowView._FlowData.ViewState.SelectedConnectionHash=null,this._FlowView._FlowData.ViewState.SelectedTetherHash=null,this._FlowView.renderFlow()}deleteSelected(){return this._FlowView._FlowData.ViewState.SelectedNodeHash?this._FlowView.removeNode(this._FlowView._FlowData.ViewState.SelectedNodeHash):!!this._FlowView._FlowData.ViewState.SelectedConnectionHash&&this._FlowView.removeConnection(this._FlowView._FlowData.ViewState.SelectedConnectionHash)}}},{"fable-serviceproviderbase":89}],120:[function(t,e,o){const i=t("fable-serviceproviderbase");e.exports=class extends i{constructor(t,e,o){super(t,e,o),this.serviceType="PictServiceFlowTether",this._FlowView=e&&e.FlowView?e.FlowView:null}getSmartAnchors(t,e){let o,i,n=e.X+e.Width/2,a=e.Y+e.Height/2,r=t.X+t.Width/2-n,s=t.Y+t.Height/2-a;Math.abs(r)>=Math.abs(s)?r>=0?(o="right",i="left"):(o="left",i="right"):s>=0?(o="bottom",i="top"):(o="top",i="bottom");let l=this._FlowView._GeometryProvider.getEdgeCenter(e,o),c=this._FlowView._GeometryProvider.getEdgeCenter(t,i);return{nodeAnchor:Object.assign(l,{side:o}),panelAnchor:Object.assign(c,{side:i})}}generateBezierPath(t,e,o,i){let n=this._FlowView._GeometryProvider.sideDirection(t.side),a=this._FlowView._GeometryProvider.sideDirection(e.side),r=t.x+20*n.dx,s=t.y+20*n.dy,l=e.x+20*a.dx,c=e.y+20*a.dy;if(null==o||null==i){let o=Math.abs(l-r),i=Math.abs(c-s),d=.4*Math.max(o,i,40),p=r+n.dx*d,h=s+n.dy*d,u=l+a.dx*d,f=c+a.dy*d;return this._FlowView._PathGenerator.buildBezierPathString({x:t.x,y:t.y},{x:r,y:s},{x:p,y:h},{x:u,y:f},{x:l,y:c},{x:e.x,y:e.y})}let d=r+30*n.dx,p=s+30*n.dy,h=l+30*a.dx,u=c+30*a.dy,f=l-r,g=c-s,m=Math.sqrt(f*f+g*g)||1;f/=m,g/=m;let w=o-25*f,v=i-25*g,b=o+25*f,y=i+25*g;return this._FlowView._PathGenerator.buildSplitBezierPathString({x:t.x,y:t.y},{x:r,y:s},{x:d,y:p},{x:w,y:v},{x:o,y:i},{x:b,y:y},{x:h,y:u},{x:l,y:c},{x:e.x,y:e.y})}generateOrthogonalPath(t,e,o,i){let n,a,r=this._FlowView._GeometryProvider.sideDirection(t.side),s=this._FlowView._GeometryProvider.sideDirection(e.side),l=t.x+20*r.dx,c=t.y+20*r.dy,d=e.x+20*s.dx,p=e.y+20*s.dy;if(o&&o.corner1&&o.corner2)n=o.corner1,a=o.corner2;else{let t=this._FlowView._PathGenerator.computeAutoOrthogonalCorners(l,c,d,p,r,s,i);n=t.corner1,a=t.corner2}return this._FlowView._PathGenerator.buildOrthogonalPathString({x:t.x,y:t.y},{x:l,y:c},{x:n.x,y:n.y},{x:a.x,y:a.y},{x:d,y:p},{x:e.x,y:e.y})}getAutoMidpoint(t,e){return this._FlowView._PathGenerator.getAutoMidpointSimple(t,e,20)}getOrthoGeometry(t,e,o){let i,n=this._FlowView._GeometryProvider.sideDirection(t.side),a=this._FlowView._GeometryProvider.sideDirection(e.side),r=t.x+20*n.dx,s=t.y+20*n.dy,l=e.x+20*a.dx,c=e.y+20*a.dy;o.TetherHandleCustomized&&null!=o.TetherOrthoCorner1X?(i=this._FlowView._PathGenerator.computeAutoOrthogonalCorners(r,s,l,c,n,a,o.TetherOrthoMidOffset||0),i.corner1={x:o.TetherOrthoCorner1X,y:o.TetherOrthoCorner1Y},i.corner2={x:o.TetherOrthoCorner2X,y:o.TetherOrthoCorner2Y}):i=this._FlowView._PathGenerator.computeAutoOrthogonalCorners(r,s,l,c,n,a,o.TetherOrthoMidOffset||0);let d={x:(i.corner1.x+i.corner2.x)/2,y:(i.corner1.y+i.corner2.y)/2};return{corner1:i.corner1,corner2:i.corner2,midpoint:d}}generatePath(t,e,o){if("orthogonal"===(t.TetherLineMode||"bezier")){let i=null;return t.TetherHandleCustomized&&null!=t.TetherOrthoCorner1X&&(i={corner1:{x:t.TetherOrthoCorner1X,y:t.TetherOrthoCorner1Y},corner2:{x:t.TetherOrthoCorner2X,y:t.TetherOrthoCorner2Y}}),this.generateOrthogonalPath(e,o,i,t.TetherOrthoMidOffset||0)}{let i=this._getTetherBezierHandles(t);if(i.length>0)return this.generateMultiBezierPath(e,o,i);let n=t.TetherHandleCustomized&&null!=t.TetherBezierHandleX?t.TetherBezierHandleX:null,a=t.TetherHandleCustomized&&null!=t.TetherBezierHandleY?t.TetherBezierHandleY:null;return this.generateBezierPath(e,o,n,a)}}_getTetherBezierHandles(t){return t&&t.TetherHandleCustomized?Array.isArray(t.TetherBezierHandles)&&t.TetherBezierHandles.length>0?t.TetherBezierHandles:null!=t.TetherBezierHandleX&&null!=t.TetherBezierHandleY?[{x:t.TetherBezierHandleX,y:t.TetherBezierHandleY}]:[]:[]}generateMultiBezierPath(t,e,o){let i=this._FlowView._GeometryProvider.sideDirection(t.side),n=this._FlowView._GeometryProvider.sideDirection(e.side),a={x:t.x+20*i.dx,y:t.y+20*i.dy},r={x:e.x+20*n.dx,y:e.y+20*n.dy};return this._FlowView._PathGenerator.buildMultiBezierPathString(t,a,t.side,r,e.side,e,o)}updateHandlePosition(t,e,o,i){if(t.TetherHandleCustomized=!0,e&&e.startsWith("bezier-handle-")){let n=parseInt(e.replace("bezier-handle-",""),10);return void(!isNaN(n)&&Array.isArray(t.TetherBezierHandles)&&n<t.TetherBezierHandles.length&&(t.TetherBezierHandles[n].x=o,t.TetherBezierHandles[n].y=i))}switch(e){case"bezier-midpoint":Array.isArray(t.TetherBezierHandles)&&0!==t.TetherBezierHandles.length?(t.TetherBezierHandles[0].x=o,t.TetherBezierHandles[0].y=i):t.TetherBezierHandles=[{x:o,y:i}],t.TetherBezierHandleX=o,t.TetherBezierHandleY=i;break;case"ortho-corner1":t.TetherOrthoCorner1X=o,t.TetherOrthoCorner1Y=i;break;case"ortho-corner2":t.TetherOrthoCorner2X=o,t.TetherOrthoCorner2Y=i;break;case"ortho-midpoint":t.TetherOrthoMidOffset=t.TetherOrthoMidOffset||0,t._TetherMidDragX=o,t._TetherMidDragY=i}}resetHandlePositions(t){t.TetherHandleCustomized&&(t.TetherHandleCustomized=!1,t.TetherBezierHandles=[],t.TetherBezierHandleX=null,t.TetherBezierHandleY=null,t.TetherOrthoCorner1X=null,t.TetherOrthoCorner1Y=null,t.TetherOrthoCorner2X=null,t.TetherOrthoCorner2Y=null,t.TetherOrthoMidOffset=0)}resetHandlesForNode(t,e){for(let o=0;o<t.length;o++){let i=t[o];i.NodeHash===e&&this.resetHandlePositions(i)}}addHandle(t,e,o,i,n){t.TetherLineMode="bezier",Array.isArray(t.TetherBezierHandles)||(t.TetherBezierHandles=[],null!=t.TetherBezierHandleX&&null!=t.TetherBezierHandleY&&t.TetherBezierHandles.push({x:t.TetherBezierHandleX,y:t.TetherBezierHandleY}));let a=0;this._FlowView._ConnectionRenderer&&i&&n&&(a=this._FlowView._ConnectionRenderer.computeInsertionIndex(t.TetherBezierHandles,{x:e,y:o},i,n)),t.TetherBezierHandles.splice(a,0,{x:e,y:o}),t.TetherHandleCustomized=!0}removeHandle(t,e){Array.isArray(t.TetherBezierHandles)&&(e<0||e>=t.TetherBezierHandles.length||(t.TetherBezierHandles.splice(e,1),0===t.TetherBezierHandles.length&&(t.TetherHandleCustomized=!1,t.TetherBezierHandleX=null,t.TetherBezierHandleY=null)))}toggleLineMode(t){let e=t.TetherLineMode||"bezier";return t.TetherLineMode="bezier"===e?"orthogonal":"bezier",t.TetherHandleCustomized=!1,t.TetherBezierHandles=[],t.TetherBezierHandleX=null,t.TetherBezierHandleY=null,t.TetherOrthoCorner1X=null,t.TetherOrthoCorner1Y=null,t.TetherOrthoCorner2X=null,t.TetherOrthoCorner2Y=null,t.TetherOrthoMidOffset=0,t.TetherLineMode}renderTether(t,e,o,i,n){if(!e)return;let a=this.getSmartAnchors(t,e),r=a.panelAnchor,s=a.nodeAnchor,l=this.generatePath(t,r,s),c=this._FlowView._ConnectorShapesProvider;if(c){let e=c.createTetherHitAreaElement(l,t.Hash);o.appendChild(e);let a=c.createTetherPathElement(l,t.Hash,i,n);o.appendChild(a)}else{let e=this._FlowView._SVGHelperProvider.createSVGElement("path");e.setAttribute("class","pict-flow-tether-hitarea"),e.setAttribute("d",l),e.setAttribute("data-element-type","tether-hitarea"),e.setAttribute("data-panel-hash",t.Hash),o.appendChild(e);let a=this._FlowView._SVGHelperProvider.createSVGElement("path");a.setAttribute("class","pict-flow-tether-line"+(i?" selected":"")),a.setAttribute("d",l),a.setAttribute("marker-end",`url(#flow-tether-arrowhead-${n})`),a.setAttribute("data-element-type","tether"),a.setAttribute("data-panel-hash",t.Hash),o.appendChild(a)}i&&this._renderHandles(t,o,r,s)}_renderHandles(t,e,o,i){if("orthogonal"===(t.TetherLineMode||"bezier")){let n=this.getOrthoGeometry(o,i,t);this._createHandle(e,t.Hash,"ortho-corner1",n.corner1.x,n.corner1.y,"pict-flow-tether-handle"),this._createHandle(e,t.Hash,"ortho-midpoint",n.midpoint.x,n.midpoint.y,"pict-flow-tether-handle-midpoint"),this._createHandle(e,t.Hash,"ortho-corner2",n.corner2.x,n.corner2.y,"pict-flow-tether-handle")}else{let n=this._getTetherBezierHandles(t);if(n.length>0)for(let o=0;o<n.length;o++)this._createHandle(e,t.Hash,"bezier-handle-"+o,n[o].x,n[o].y,"pict-flow-tether-handle");else{let n=this.getAutoMidpoint(o,i);this._createHandle(e,t.Hash,"bezier-midpoint",n.x,n.y,"pict-flow-tether-handle-midpoint")}}}_createHandle(t,e,o,i,n,a){if(!this._FlowView._ConnectorShapesProvider)return;let r="pict-flow-tether-handle-midpoint"===a?"tether-handle-midpoint":"tether-handle";this._FlowView._ConnectorShapesProvider.createFullHandle(t,e,o,i,n,r,"tether-handle","data-panel-hash")}}},{"fable-serviceproviderbase":89}],121:[function(t,e,o){const i=t("fable-serviceproviderbase");e.exports=class extends i{constructor(t,e,o){super(t,e,o),this.serviceType="PictServiceFlowViewportManager",this._FlowView=e&&e.FlowView?e.FlowView:null,this._IsFullscreen=!1}updateViewportTransform(){if(!this._FlowView._ViewportElement)return;let t=this._FlowView._FlowData.ViewState;this._FlowView._ViewportElement.setAttribute("transform",`translate(${t.PanX}, ${t.PanY}) scale(${t.Zoom})`)}setZoom(t,e,o){let i=Math.max(this._FlowView.options.MinZoom,Math.min(this._FlowView.options.MaxZoom,t)),n=this._FlowView._FlowData.ViewState.Zoom;if("number"==typeof e&&"number"==typeof o){let t=this._FlowView._FlowData.ViewState;t.PanX=e-(e-t.PanX)*(i/n),t.PanY=o-(o-t.PanY)*(i/n)}this._FlowView._FlowData.ViewState.Zoom=i,this.updateViewportTransform()}zoomToFit(){if(0===this._FlowView._FlowData.Nodes.length)return;if(!this._FlowView._SVGElement)return;let t=1/0,e=1/0,o=-1/0,i=-1/0;for(let n=0;n<this._FlowView._FlowData.Nodes.length;n++){let a=this._FlowView._FlowData.Nodes[n];t=Math.min(t,a.X),e=Math.min(e,a.Y),o=Math.max(o,a.X+a.Width),i=Math.max(i,a.Y+a.Height)}let n=o-t+100,a=i-e+100,r=this._FlowView._SVGElement.getBoundingClientRect(),s=r.width/n,l=r.height/a,c=Math.min(s,l,1);c=Math.max(this._FlowView.options.MinZoom,Math.min(this._FlowView.options.MaxZoom,c));let d=(t+o)/2,p=(e+i)/2;this._FlowView._FlowData.ViewState.Zoom=c,this._FlowView._FlowData.ViewState.PanX=r.width/2-d*c,this._FlowView._FlowData.ViewState.PanY=r.height/2-p*c,this.updateViewportTransform()}screenToSVGCoords(t,e){if(!this._FlowView._SVGElement)return{x:t,y:e};let o=this._FlowView._SVGElement.createSVGPoint();o.x=t,o.y=e;let i=this._FlowView._SVGElement.getScreenCTM();if(i){let t=i.inverse(),e=o.matrixTransform(t),n=this._FlowView._FlowData.ViewState;return{x:(e.x-n.PanX)/n.Zoom,y:(e.y-n.PanY)/n.Zoom}}return{x:t,y:e}}toggleFullscreen(){let t=this._FlowView.options.ViewIdentifier,e=this._FlowView.pict.ContentAssignment.getElement(`#Flow-Wrapper-${t}`);if(e.length<1)return this._IsFullscreen;let o=e[0];return this._IsFullscreen=!this._IsFullscreen,this._IsFullscreen?o.classList.add("pict-flow-fullscreen"):o.classList.remove("pict-flow-fullscreen"),this._IsFullscreen}exitFullscreen(){if(!this._IsFullscreen)return;let t=this._FlowView.options.ViewIdentifier,e=this._FlowView.pict.ContentAssignment.getElement(`#Flow-Wrapper-${t}`);e.length>0&&e[0].classList.remove("pict-flow-fullscreen"),this._IsFullscreen=!1}}},{"fable-serviceproviderbase":89}],122:[function(t,e,o){const i=t("pict-view"),n={ViewIdentifier:"Flow-FloatingToolbar",DefaultRenderable:"Flow-FloatingToolbar-Content",DefaultDestinationAddress:"#Flow-FloatingToolbar-Container",AutoRender:!1,FlowViewIdentifier:"Pict-Flow",CSS:!1,Templates:[{Hash:"Flow-FloatingToolbar-Template",Template:'\n<div class="pict-flow-floating-toolbar" id="Flow-FloatingToolbar-{~D:Record.FlowViewIdentifier~}">\n\t<div class="pict-flow-floating-grip" id="Flow-FloatingGrip-{~D:Record.FlowViewIdentifier~}" title="Drag to move · Double-click to collapse">\n\t\t<span id="Flow-FloatingIcon-grip-{~D:Record.FlowViewIdentifier~}"></span>\n\t</div>\n\t<button class="pict-flow-floating-btn" data-flow-action="add-node" title="Add Node">\n\t\t<span id="Flow-FloatingIcon-plus-{~D:Record.FlowViewIdentifier~}"></span>\n\t</button>\n\t<button class="pict-flow-floating-btn" data-flow-action="cards-popup" title="Cards">\n\t\t<span id="Flow-FloatingIcon-cards-{~D:Record.FlowViewIdentifier~}"></span>\n\t</button>\n\t<button class="pict-flow-floating-btn" data-flow-action="delete-selected" title="Delete Selected">\n\t\t<span id="Flow-FloatingIcon-trash-{~D:Record.FlowViewIdentifier~}"></span>\n\t</button>\n\t<div class="pict-flow-floating-separator"></div>\n\t<button class="pict-flow-floating-btn" data-flow-action="zoom-in" title="Zoom In">\n\t\t<span id="Flow-FloatingIcon-zoom-in-{~D:Record.FlowViewIdentifier~}"></span>\n\t</button>\n\t<button class="pict-flow-floating-btn" data-flow-action="zoom-out" title="Zoom Out">\n\t\t<span id="Flow-FloatingIcon-zoom-out-{~D:Record.FlowViewIdentifier~}"></span>\n\t</button>\n\t<button class="pict-flow-floating-btn" data-flow-action="zoom-fit" title="Fit to View">\n\t\t<span id="Flow-FloatingIcon-zoom-fit-{~D:Record.FlowViewIdentifier~}"></span>\n\t</button>\n\t<div class="pict-flow-floating-separator"></div>\n\t<button class="pict-flow-floating-btn" data-flow-action="auto-layout" title="Auto Layout">\n\t\t<span id="Flow-FloatingIcon-auto-layout-{~D:Record.FlowViewIdentifier~}"></span>\n\t</button>\n\t<button class="pict-flow-floating-btn" data-flow-action="layout-popup" title="Layout">\n\t\t<span id="Flow-FloatingIcon-layout-{~D:Record.FlowViewIdentifier~}"></span>\n\t</button>\n\t<button class="pict-flow-floating-btn" data-flow-action="fullscreen" title="Toggle Fullscreen">\n\t\t<span id="Flow-FloatingIcon-fullscreen-{~D:Record.FlowViewIdentifier~}"></span>\n\t</button>\n\t<div class="pict-flow-floating-separator"></div>\n\t<button class="pict-flow-floating-btn" data-flow-action="dock-toolbar" title="Dock Toolbar">\n\t\t<span id="Flow-FloatingIcon-dock-{~D:Record.FlowViewIdentifier~}"></span>\n\t</button>\n</div>\n'}],Renderables:[{RenderableHash:"Flow-FloatingToolbar-Content",TemplateHash:"Flow-FloatingToolbar-Template",DestinationAddress:"#Flow-FloatingToolbar-Container",RenderMethod:"replace"}]};e.exports=class extends i{constructor(t,e,o){super(t,Object.assign({},JSON.parse(JSON.stringify(n)),e),o),this.serviceType="PictViewFlowFloatingToolbar",this._ToolbarView=null,this._FlowView=null,this._IsCollapsed=!1,this._IsDragging=!1,this._DragStartX=0,this._DragStartY=0,this._DragStartLeft=0,this._DragStartTop=0,this._BoundMouseMove=null,this._BoundMouseUp=null}render(t,e,o){return super.render(t,e,this.options)}onAfterRender(t,e,o,i){let n=this.options.FlowViewIdentifier,a=this.pict.ContentAssignment.getElement(`#Flow-FloatingToolbar-${n}`);a.length>0&&a[0].addEventListener("click",t=>{let e=t.target;if(!e)return;let o=e.closest("[data-flow-action]");if(!o)return;let i=o.getAttribute("data-flow-action");"dock-toolbar"!==i?this._ToolbarView&&this._ToolbarView._handleToolbarAction(i):this._ToolbarView&&this._ToolbarView._setToolbarMode("docked")});let r=this.pict.ContentAssignment.getElement(`#Flow-FloatingGrip-${n}`);if(r.length>0&&(r[0].addEventListener("mousedown",t=>{this._startDrag(t)}),r[0].addEventListener("dblclick",t=>{t.preventDefault(),t.stopPropagation(),this._toggleCollapse()})),this._populateIcons(),a.length>0){if(!1===this.options.EnableAddNode){let t=a[0].querySelector('[data-flow-action="add-node"]');t&&t.remove()}if(!1===this.options.EnableCardPalette){let t=a[0].querySelector('[data-flow-action="cards-popup"]');t&&t.remove()}}return super.onAfterRender(t,e,o,i)}_populateIcons(){let t=this._FlowView?this._FlowView._IconProvider:null;if(!t)return;let e=this.options.FlowViewIdentifier,o={grip:"grip",plus:"plus",trash:"trash","zoom-in":"zoom-in","zoom-out":"zoom-out","zoom-fit":"zoom-fit","auto-layout":"auto-layout",cards:"cards",layout:"layout",fullscreen:"fullscreen",dock:"dock"},i=Object.keys(o);for(let n=0;n<i.length;n++){let a=`Flow-FloatingIcon-${i[n]}-${e}`,r=this.pict.ContentAssignment.getElement(`#${a}`);r.length>0&&(r[0].innerHTML=t.getIconSVGMarkup(o[i[n]],16))}}_toggleCollapse(){let t=this.options.FlowViewIdentifier,e=this.pict.ContentAssignment.getElement(`#Flow-FloatingToolbar-${t}`);e.length<1||(this._IsCollapsed=!this._IsCollapsed,this._IsCollapsed?e[0].classList.add("collapsed"):e[0].classList.remove("collapsed"))}_startDrag(t){t.preventDefault();let e=this.options.FlowViewIdentifier,o=this.pict.ContentAssignment.getElement(`#Flow-FloatingToolbar-${e}`);if(o.length<1)return;let i=o[0];this._IsDragging=!0,this._DragStartX=t.clientX,this._DragStartY=t.clientY,this._DragStartLeft=i.offsetLeft,this._DragStartTop=i.offsetTop,this._BoundMouseMove=t=>{this._onDragMove(t)},this._BoundMouseUp=()=>{this._onDragEnd()},document.addEventListener("mousemove",this._BoundMouseMove),document.addEventListener("mouseup",this._BoundMouseUp)}_onDragMove(t){if(!this._IsDragging)return;let e=this.options.FlowViewIdentifier,o=this.pict.ContentAssignment.getElement(`#Flow-FloatingToolbar-${e}`);if(o.length<1)return;let i=o[0],n=t.clientX-this._DragStartX,a=t.clientY-this._DragStartY,r=this._DragStartLeft+n,s=this._DragStartTop+a,l=i.parentElement;if(l){let t=l.clientWidth-i.offsetWidth,e=l.clientHeight-i.offsetHeight;r=Math.max(0,Math.min(r,t)),s=Math.max(0,Math.min(s,e))}i.style.left=r+"px",i.style.top=s+"px"}_onDragEnd(){if(this._IsDragging=!1,this._BoundMouseMove&&(document.removeEventListener("mousemove",this._BoundMouseMove),this._BoundMouseMove=null),this._BoundMouseUp&&(document.removeEventListener("mouseup",this._BoundMouseUp),this._BoundMouseUp=null),this._ToolbarView){let t=this.options.FlowViewIdentifier,e=this.pict.ContentAssignment.getElement(`#Flow-FloatingToolbar-${t}`);e.length>0&&(this._ToolbarView._FloatingPosition.X=e[0].offsetLeft,this._ToolbarView._FloatingPosition.Y=e[0].offsetTop)}}show(){let t=this.options.FlowViewIdentifier,e=this.pict.ContentAssignment.getElement(`#Flow-FloatingToolbar-Container-${t}`);e.length>0&&(e[0].style.display="block");let o=this.pict.ContentAssignment.getElement(`#Flow-FloatingToolbar-${t}`);o.length>0&&this._ToolbarView&&(o[0].style.left=this._ToolbarView._FloatingPosition.X+"px",o[0].style.top=this._ToolbarView._FloatingPosition.Y+"px"),this._IsCollapsed&&o.length>0&&(this._IsCollapsed=!1,o[0].classList.remove("collapsed"))}hide(){let t=this.options.FlowViewIdentifier,e=this.pict.ContentAssignment.getElement(`#Flow-FloatingToolbar-Container-${t}`);e.length>0&&(e[0].style.display="none")}},e.exports.default_configuration=n},{"pict-view":128}],123:[function(t,e,o){const i=t("pict-view"),n={ViewIdentifier:"Flow-NodeRenderer",AutoRender:!1,NodeTitleBarHeight:22};e.exports=class extends i{constructor(t,e,o){super(t,Object.assign({},JSON.parse(JSON.stringify(n)),e),o),this.serviceType="PictViewFlowNode",this._FlowView=null}renderNode(t,e,o,i){let n=this._FlowView._SVGHelperProvider.createSVGElement("g"),a=`pict-flow-node ${o?"selected":""} pict-flow-node-${t.Type||"default"}`;i&&(i.PortLabelsOnHover&&(a+=" pict-flow-node-port-labels-hover"),i.PortLabelsVertical&&(a+=" pict-flow-node-port-labels-vertical")),n.setAttribute("class",a),n.setAttribute("transform",`translate(${t.X}, ${t.Y})`),n.setAttribute("data-node-hash",t.Hash),n.setAttribute("data-element-type","node");let r=t.Width||180,s=t.Height||80,l=this.options.NodeTitleBarHeight,c=this._FlowView._GeometryProvider;if(c&&t.Ports&&t.Ports.length>0){let e=c.computeMinimumNodeHeight(t.Ports,l);e>s&&(s=e)}t.Width=r,t.Height=s;let d="rect";if(this._FlowView._ThemeProvider){let t=this._FlowView._ThemeProvider.getActiveTheme();t&&t.NodeBodyMode&&(d=t.NodeBodyMode)}"bracket"===d?this._renderBracketNodeBody(n,t,r,s,l,i):this._renderRectNodeBody(n,t,r,s,l,i);let p=!1,h=12;if(i&&i.CardMetadata){let t=i.CardMetadata,e=this._FlowView._IconProvider;(t.Icon||e)&&(p=!0)}let u=this._FlowView._SVGHelperProvider.createSVGElement("text");u.setAttribute("class","pict-flow-node-title"),p?(u.setAttribute("x",String(24)),u.setAttribute("text-anchor","start")):(u.setAttribute("x",String(r/2)),u.setAttribute("text-anchor","middle")),u.setAttribute("y",String(l/2+1)),u.setAttribute("dominant-baseline","central"),u.textContent=t.Title||"Untitled",n.appendChild(u);let f=!i||!1!==i.ShowTypeLabel,g=()=>{if(f&&i&&i.Label&&i.Label!==t.Title){let t=this._FlowView._SVGHelperProvider.createSVGElement("text");t.setAttribute("class","pict-flow-node-type-label"),t.setAttribute("x",String(r/2)),t.setAttribute("y",String(l+16)),t.setAttribute("text-anchor","middle"),t.setAttribute("dominant-baseline","central"),t.textContent=i.Label,n.appendChild(t)}if(i&&i.CardMetadata){let t=i.CardMetadata,e=this._FlowView._IconProvider,o=!1,a=8,c=(l-h)/2;if(t.Icon&&e&&!e.isEmojiIcon(t.Icon)){let i=e.resolveIconKey(t),r=e.renderIconIntoSVGGroup(i,n,a,c,h);r&&r.setAttribute("class",(r.getAttribute("class")||"")+" pict-flow-node-title-icon"),o=!0}else if(t.Icon&&e&&e.isEmojiIcon(t.Icon)){let e=this._FlowView._SVGHelperProvider.createSVGElement("text");e.setAttribute("class","pict-flow-node-card-icon pict-flow-node-title-icon-emoji"),e.setAttribute("font-size",String(h)),e.setAttribute("text-anchor","middle"),e.setAttribute("dominant-baseline","central"),e.setAttribute("pointer-events","none"),e.setAttribute("x",String(a+6)),e.setAttribute("y",String(l/2)),e.textContent=t.Icon,n.appendChild(e),o=!0}else if(t.Icon){let e=this._FlowView._SVGHelperProvider.createSVGElement("text");e.setAttribute("class","pict-flow-node-card-icon pict-flow-node-title-icon-emoji"),e.setAttribute("font-size",String(h)),e.setAttribute("text-anchor","middle"),e.setAttribute("dominant-baseline","central"),e.setAttribute("pointer-events","none"),e.setAttribute("x",String(a+6)),e.setAttribute("y",String(l/2)),e.textContent=t.Icon,n.appendChild(e),o=!0}if(!o&&e){let t=e.renderIconIntoSVGGroup("default",n,a,c,h);t&&t.setAttribute("class",(t.getAttribute("class")||"")+" pict-flow-node-title-icon")}let d=l+(s-l)/2;if(f&&t.Code){let e=this._FlowView._SVGHelperProvider.createSVGElement("text");e.setAttribute("class","pict-flow-node-card-code"),e.setAttribute("font-size","10"),e.setAttribute("font-family","monospace"),e.setAttribute("fill","#7f8c8d"),e.setAttribute("text-anchor","middle"),e.setAttribute("dominant-baseline","central"),e.setAttribute("pointer-events","none"),e.setAttribute("x",String(r/2)),e.setAttribute("y",String(d)),e.textContent=t.Code,n.appendChild(e)}if(t.Tooltip||t.Description){let e=this._FlowView._SVGHelperProvider.createSVGElement("title");e.textContent=t.Tooltip||t.Description,n.appendChild(e)}}};if(!i||!1!==i.LabelsInFront?(this._renderBodyContent(t,n,r,s,i),g(),this._renderPorts(t,n,r,s,i)):(g(),this._renderPorts(t,n,r,s,i),this._renderBodyContent(t,n,r,s,i)),i&&i.PropertiesPanel){let e,o=10,i=4,a=r-o-i,l=s-o-i,c=this._FlowView._ConnectorShapesProvider;c?e=c.createPanelIndicatorElement(t.Hash,a,l,o,o):(e=this._FlowView._SVGHelperProvider.createSVGElement("rect"),e.setAttribute("class","pict-flow-node-panel-indicator"),e.setAttribute("x",String(a)),e.setAttribute("y",String(l)),e.setAttribute("width",String(o)),e.setAttribute("height",String(o)),e.setAttribute("rx","2"),e.setAttribute("ry","2"),e.setAttribute("data-node-hash",t.Hash),e.setAttribute("data-element-type","panel-indicator"));let d=this._FlowView._SVGHelperProvider.createSVGElement("title");d.textContent="Double-click to open properties",e.appendChild(d),n.appendChild(e)}e.appendChild(n)}_renderPorts(t,e,o,i,n){this._FlowView._PortRenderer.renderPorts(t,e,o,i,n,this.options.NodeTitleBarHeight)}_renderBodyContent(t,e,o,i,n){if(!n||!n.BodyContent)return;let a=n.BodyContent,r=a.ContentType;if(!r)return;let s=this.options.NodeTitleBarHeight,l="number"==typeof a.Padding?a.Padding:2,c={x:l,y:s+l,width:o-2*l,height:i-s-2*l},d=this._FlowView.pict||this.pict;if(a.Templates&&Array.isArray(a.Templates)){this._registeredBodyTemplates||(this._registeredBodyTemplates=new Set);for(let t=0;t<a.Templates.length;t++){let e=a.Templates[t];e.Hash&&e.Template&&!this._registeredBodyTemplates.has(e.Hash)&&(d.TemplateProvider.addTemplate(e.Hash,e.Template,"PictViewFlowNode-BodyContent"),this._registeredBodyTemplates.add(e.Hash))}}switch(r){case"svg":this._renderBodyContentSVG(t,e,a,c,n,d);break;case"html":this._renderBodyContentHTML(t,e,a,c,n,d);break;case"canvas":this._renderBodyContentCanvas(t,e,a,c,n);break;default:this.log.warn("PictViewFlowNode _renderBodyContent: unknown ContentType ["+r+"]")}}_renderBodyContentSVG(t,e,o,i,n,a){let r=this._FlowView._SVGHelperProvider.createSVGElement("g");r.setAttribute("class","pict-flow-node-body-content"),r.setAttribute("transform",`translate(${i.x}, ${i.y})`);let s=this._resolveBodyTemplate(o,t,a);if(s){let t=document.createElementNS("http://www.w3.org/2000/svg","svg");for(t.innerHTML=s;t.firstChild;)r.appendChild(t.firstChild)}"function"==typeof o.RenderCallback&&o.RenderCallback(r,t,n,i),e.appendChild(r)}_renderBodyContentHTML(t,e,o,i,n,a){let r=this._FlowView._SVGHelperProvider.createSVGElement("foreignObject");r.setAttribute("class","pict-flow-node-body-content-fo"),r.setAttribute("x",String(i.x)),r.setAttribute("y",String(i.y)),r.setAttribute("width",String(i.width)),r.setAttribute("height",String(i.height));let s=document.createElement("div");s.setAttribute("xmlns","http://www.w3.org/1999/xhtml"),s.setAttribute("class","pict-flow-node-body-content-html"),s.addEventListener("pointerdown",t=>{t.stopPropagation()}),s.addEventListener("wheel",t=>{t.stopPropagation()});let l=this._resolveBodyTemplate(o,t,a);l&&(s.innerHTML=l),"function"==typeof o.RenderCallback&&o.RenderCallback(s,t,n,i),r.appendChild(s),e.appendChild(r)}_renderBodyContentCanvas(t,e,o,i,n){let a=this._FlowView._SVGHelperProvider.createSVGElement("foreignObject");a.setAttribute("class","pict-flow-node-body-content-fo"),a.setAttribute("x",String(i.x)),a.setAttribute("y",String(i.y)),a.setAttribute("width",String(i.width)),a.setAttribute("height",String(i.height));let r=document.createElement("canvas");r.setAttribute("xmlns","http://www.w3.org/1999/xhtml"),r.setAttribute("class","pict-flow-node-body-content-canvas"),r.width=Math.floor(i.width),r.height=Math.floor(i.height),r.style.width="100%",r.style.height="100%",r.addEventListener("pointerdown",t=>{t.stopPropagation()}),r.addEventListener("wheel",t=>{t.stopPropagation()}),"function"==typeof o.RenderCallback&&o.RenderCallback(r,t,n,i),a.appendChild(r),e.appendChild(a)}_resolveBodyTemplate(t,e,o){return t.TemplateHash?o.parseTemplateByHash(t.TemplateHash,e):t.Template?o.parseTemplate(t.Template,e,null,[e]):null}_renderRectNodeBody(t,e,o,i,n,a){let r=this._FlowView._SVGHelperProvider.createSVGElement("rect");if(r.setAttribute("class","pict-flow-node-body"),r.setAttribute("x","0"),r.setAttribute("y","0"),r.setAttribute("width",String(o)),r.setAttribute("height",String(i)),r.setAttribute("data-node-hash",e.Hash),r.setAttribute("data-element-type","node-body"),a&&a.BodyStyle)for(let t in a.BodyStyle)r.setAttribute(t,a.BodyStyle[t]);if(e.Style){let t=[];e.Style.BodyFill&&t.push("fill:"+e.Style.BodyFill),e.Style.BodyStroke&&t.push("stroke:"+e.Style.BodyStroke),e.Style.BodyStrokeWidth&&t.push("stroke-width:"+e.Style.BodyStrokeWidth),t.length>0&&r.setAttribute("style",t.join(";"))}t.appendChild(r);let s=this._FlowView._SVGHelperProvider.createSVGElement("rect");s.setAttribute("class","pict-flow-node-title-bar"),s.setAttribute("x","0"),s.setAttribute("y","0"),s.setAttribute("width",String(o)),s.setAttribute("height",String(n)),s.setAttribute("data-node-hash",e.Hash),s.setAttribute("data-element-type","node-body"),a&&a.TitleBarColor&&s.setAttribute("fill",a.TitleBarColor),t.appendChild(s);let l=this._FlowView._SVGHelperProvider.createSVGElement("rect");l.setAttribute("class","pict-flow-node-title-bar-bottom"),l.setAttribute("x","0"),l.setAttribute("y",String(n-8)),l.setAttribute("width",String(o)),l.setAttribute("height","8"),l.setAttribute("data-node-hash",e.Hash),l.setAttribute("data-element-type","node-body"),a&&a.TitleBarColor&&l.setAttribute("fill",a.TitleBarColor),e.Style&&e.Style.TitleBarColor&&(s.setAttribute("style","fill:"+e.Style.TitleBarColor),l.setAttribute("style","fill:"+e.Style.TitleBarColor)),t.appendChild(l)}_renderBracketNodeBody(t,e,o,i,n,a){let r=this._FlowView._SVGHelperProvider.createSVGElement("rect");if(r.setAttribute("class","pict-flow-node-body pict-flow-node-bracket-fill"),r.setAttribute("x","0"),r.setAttribute("y","0"),r.setAttribute("width",String(o)),r.setAttribute("height",String(i)),r.setAttribute("data-node-hash",e.Hash),r.setAttribute("data-element-type","node-body"),e.Style){let t=[];e.Style.BodyFill&&t.push("fill:"+e.Style.BodyFill),t.length>0&&r.setAttribute("style",t.join(";"))}t.appendChild(r);let s=this._FlowView._SVGHelperProvider.createSVGElement("rect");s.setAttribute("class","pict-flow-node-title-bar pict-flow-node-bracket-title-fill"),s.setAttribute("x","0"),s.setAttribute("y","0"),s.setAttribute("width",String(o)),s.setAttribute("height",String(n)),s.setAttribute("data-node-hash",e.Hash),s.setAttribute("data-element-type","node-body"),a&&a.TitleBarColor&&s.setAttribute("style","fill:"+a.TitleBarColor),e.Style&&e.Style.TitleBarColor&&s.setAttribute("style","fill:"+e.Style.TitleBarColor),t.appendChild(s);let l={SerifLength:6,TitleSeparator:!0};if(this._FlowView._ThemeProvider){let t=this._FlowView._ThemeProvider.getActiveTheme();t&&t.BracketConfig&&(l=Object.assign(l,t.BracketConfig))}let c=0;this._FlowView._ThemeProvider&&(c=this._FlowView._ThemeProvider.getNodeNoiseAmplitude());let d="";this._FlowView._NoiseProvider&&(d=this._FlowView._NoiseProvider.generateBracketPath(o,i,l.SerifLength,l.TitleSeparator?n:0,c,e.Hash));let p=this._FlowView._SVGHelperProvider.createSVGElement("path");if(p.setAttribute("class","pict-flow-node-bracket"),p.setAttribute("d",d),p.setAttribute("data-node-hash",e.Hash),p.setAttribute("data-element-type","node-body"),e.Style){let t=[];e.Style.BodyStroke&&t.push("stroke:"+e.Style.BodyStroke),e.Style.BodyStrokeWidth&&t.push("stroke-width:"+e.Style.BodyStrokeWidth),t.length>0&&p.setAttribute("style",t.join(";"))}t.appendChild(p)}},e.exports.default_configuration=n},{"pict-view":128}],124:[function(t,e,o){const i=t("pict-view"),n={ViewIdentifier:"Flow-PropertiesPanel",AutoRender:!1,Templates:[{Hash:"Flow-InfoPanel-Wrapper",Template:'<div class="pict-flow-info-panel">{~D:Record.PanelContent~}</div>'},{Hash:"Flow-InfoPanel-Header-Icon",Template:'<div class="pict-flow-info-panel-header with-icon">{~D:Record.Icon~} {~D:Record.Label~}</div>'},{Hash:"Flow-InfoPanel-Header",Template:'<div class="pict-flow-info-panel-header">{~D:Record.Label~}</div>'},{Hash:"Flow-InfoPanel-Description",Template:'<div class="pict-flow-info-panel-description">{~D:Record.Description~}</div>'},{Hash:"Flow-InfoPanel-Badges",Template:'<div class="pict-flow-info-panel-badges">{~D:Record.BadgesContent~}</div>'},{Hash:"Flow-InfoPanel-Badge-Category",Template:'<span class="pict-flow-info-panel-badge category">{~D:Record.Category~}</span>'},{Hash:"Flow-InfoPanel-Badge-Code",Template:'<span class="pict-flow-info-panel-badge code">{~D:Record.Code~}</span>'},{Hash:"Flow-InfoPanel-Section-Inputs",Template:'<div class="pict-flow-info-panel-section"><div class="pict-flow-info-panel-section-title">Inputs</div>{~D:Record.PortsContent~}</div>'},{Hash:"Flow-InfoPanel-Section-Outputs",Template:'<div class="pict-flow-info-panel-section"><div class="pict-flow-info-panel-section-title">Outputs</div>{~D:Record.PortsContent~}</div>'},{Hash:"Flow-InfoPanel-Port-Input",Template:'<div class="pict-flow-info-panel-port input">{~D:Record.Label~}{~D:Record.Constraint~}</div>'},{Hash:"Flow-InfoPanel-Port-Output",Template:'<div class="pict-flow-info-panel-port output">{~D:Record.Label~}</div>'},{Hash:"Flow-InfoPanel-Port-Constraint",Template:' <span class="pict-flow-info-panel-port-constraint">{~D:Record.ConstraintText~}</span>'},{Hash:"Flow-InfoPanel-Section-Generic",Template:'<div class="pict-flow-info-panel-section"><div class="pict-flow-info-panel-section-title">{~D:Record.SectionTitle~}</div>{~D:Record.PortsContent~}</div>'},{Hash:"Flow-InfoPanel-Port-Event",Template:'<div class="pict-flow-info-panel-port event">{~D:Record.Label~}</div>'},{Hash:"Flow-InfoPanel-Port-Value",Template:'<div class="pict-flow-info-panel-port value">{~D:Record.Label~}{~D:Record.DataType~}</div>'},{Hash:"Flow-InfoPanel-Port-DataType",Template:' <span class="pict-flow-info-panel-port-constraint">{~D:Record.DataTypeText~}</span>'},{Hash:"Flow-NodeProps-Editor",Template:'<div class="pict-flow-node-props-fields"><div class="pict-flow-node-props-field"><label class="pict-flow-node-props-label">Title</label><input type="text" class="pict-flow-node-props-input" data-prop="Title" value="{~D:Record.Title~}" /></div><div class="pict-flow-node-props-field"><label class="pict-flow-node-props-label">Width</label><input type="number" class="pict-flow-node-props-input" data-prop="Width" value="{~D:Record.Width~}" min="60" step="10" /></div><div class="pict-flow-node-props-field"><label class="pict-flow-node-props-label">Height</label><input type="number" class="pict-flow-node-props-input" data-prop="Height" value="{~D:Record.Height~}" min="40" step="10" /></div><div class="pict-flow-node-props-field"><label class="pict-flow-node-props-label">Body Fill</label><input type="color" class="pict-flow-node-props-input pict-flow-node-props-color" data-prop="Style.BodyFill" value="{~D:Record.BodyFillValue~}" /></div><div class="pict-flow-node-props-field"><label class="pict-flow-node-props-label">Body Stroke</label><input type="color" class="pict-flow-node-props-input pict-flow-node-props-color" data-prop="Style.BodyStroke" value="{~D:Record.BodyStrokeValue~}" /></div><div class="pict-flow-node-props-field"><label class="pict-flow-node-props-label">Stroke Width</label><input type="number" class="pict-flow-node-props-input" data-prop="Style.BodyStrokeWidth" value="{~D:Record.BodyStrokeWidthValue~}" min="0" max="10" step="0.5" /></div><div class="pict-flow-node-props-field"><label class="pict-flow-node-props-label">Title Bar</label><input type="color" class="pict-flow-node-props-input pict-flow-node-props-color" data-prop="Style.TitleBarColor" value="{~D:Record.TitleBarColorValue~}" /></div></div>'}]};e.exports=class extends i{constructor(t,e,o){super(t,Object.assign({},JSON.parse(JSON.stringify(n)),e),o),this.serviceType="PictViewFlowPropertiesPanel",this._FlowView=null,this._PanelInstances={}}renderPanels(t,e,o,i){if(!e||!o)return;if(!this._FlowView)return;let n=Array.isArray(t)?t:[],a=new Set,r=e.querySelectorAll(".pict-flow-panel-foreign-object");for(let t=0;t<r.length;t++)a.add(r[t].getAttribute("data-panel-hash"));let s=new Set;for(let t=0;t<n.length;t++)s.add(n[t].Hash);for(let t=0;t<r.length;t++){let e=r[t].getAttribute("data-panel-hash");s.has(e)||(r[t].remove(),this._PanelInstances[e]&&(this._PanelInstances[e].destroy(),delete this._PanelInstances[e]))}for(let t=0;t<n.length;t++){let o=n[t];if(a.has(o.Hash)){let t=e.querySelector(`[data-panel-hash="${o.Hash}"]`);t&&(t.setAttribute("x",String(o.X)),t.setAttribute("y",String(o.Y)),t.setAttribute("width",String(o.Width)),t.setAttribute("height",String(o.Height)))}else this._createPanelForeignObject(o,e)}for(;o.firstChild;)o.removeChild(o.firstChild);for(let t=0;t<n.length;t++){let e=i===n[t].Hash;this._renderTether(n[t],o,e)}}_createPanelForeignObject(t,e){let o=this._FlowView._PanelChromeProvider;if(!o)return;let i=o.createPanelForeignObject(t,e);i&&this._renderPanelContent(t,i);let n=e.querySelector(`[data-panel-hash="${t.Hash}"]`);n&&(this._renderAppearanceTab(t,n),this._renderHelpTab(t,n),this._wireTabSwitching(n))}_renderPanelContent(t,e){let o=this._FlowView.getNode(t.NodeHash);if(!o)return;let i=this._FlowView._NodeTypeProvider.getNodeType(o.Type);if(!i)return;if(!i.PropertiesPanel)return void this._renderInfoPanelContent(e,o,i);let n=i.PropertiesPanel,a=`PictFlowCardPropertiesPanel-${n.PanelType||"Base"}`,r=null;this._PanelInstances[t.Hash]?r=this._PanelInstances[t.Hash]:(this.fable.servicesMap.hasOwnProperty(a)?r=this.fable.instantiateServiceProviderWithoutRegistration(a,n):this.fable.servicesMap.hasOwnProperty("PictFlowCardPropertiesPanel")&&(r=this.fable.instantiateServiceProviderWithoutRegistration("PictFlowCardPropertiesPanel",n)),r&&(r._FlowView=this._FlowView,this._PanelInstances[t.Hash]=r)),r&&r.render(e,o),this._renderPortSummary(e,i)}_renderInfoPanelContent(t,e,o){let i=o.CardMetadata||{},n=o.DefaultPorts||[],a=n.filter(t=>"input"===t.Direction),r=n.filter(t=>"output"===t.Direction),s=o.Label||e.Type,l=[],c=this._FlowView._IconProvider;if(i.Icon&&c&&!c.isEmojiIcon(i.Icon)){let t=c.resolveIconKey(i),e=c.getIconSVGMarkup(t,18);l.push(this.pict.parseTemplateByHash("Flow-InfoPanel-Header-Icon",{Icon:e,Label:s}))}else if(i.Icon)l.push(this.pict.parseTemplateByHash("Flow-InfoPanel-Header-Icon",{Icon:i.Icon,Label:s}));else if(c){let t=c.getIconSVGMarkup("default",18);l.push(this.pict.parseTemplateByHash("Flow-InfoPanel-Header-Icon",{Icon:t,Label:s}))}else l.push(this.pict.parseTemplateByHash("Flow-InfoPanel-Header",{Label:s}));if(i.Description&&l.push(this.pict.parseTemplateByHash("Flow-InfoPanel-Description",{Description:i.Description})),i.Category||i.Code){let t="";i.Category&&(t+=this.pict.parseTemplateByHash("Flow-InfoPanel-Badge-Category",{Category:i.Category})),i.Code&&(t+=this.pict.parseTemplateByHash("Flow-InfoPanel-Badge-Code",{Code:i.Code})),l.push(this.pict.parseTemplateByHash("Flow-InfoPanel-Badges",{BadgesContent:t}))}if(a.length>0){let t="";for(let e=0;e<a.length;e++){let o=a[e],i=this._getPortConstraintHTML(o);t+=this.pict.parseTemplateByHash("Flow-InfoPanel-Port-Input",{Label:o.Label||"In",Constraint:i})}l.push(this.pict.parseTemplateByHash("Flow-InfoPanel-Section-Inputs",{PortsContent:t}))}if(r.length>0){let t="";for(let e=0;e<r.length;e++){let o=r[e];t+=this.pict.parseTemplateByHash("Flow-InfoPanel-Port-Output",{Label:o.Label||"Out"})}l.push(this.pict.parseTemplateByHash("Flow-InfoPanel-Section-Outputs",{PortsContent:t}))}t.innerHTML=this.pict.parseTemplateByHash("Flow-InfoPanel-Wrapper",{PanelContent:l.join("")})}_renderPortSummary(t,e){let o=e.DefaultPorts||[];if(0===o.length)return;let i=[],n=[],a=[];for(let t=0;t<o.length;t++){let e=o[t],r=e.PortType||"";"event-in"===r?i.push(e):"event-out"===r||"error"===r?n.push(e):"value"===r&&a.push(e)}if(0===i.length&&0===n.length&&0===a.length)return;let r=[];if(i.length>0){let t="";for(let e=0;e<i.length;e++)t+=this.pict.parseTemplateByHash("Flow-InfoPanel-Port-Event",{Label:i[e].Label||i[e].Name||"Event In"});r.push(this.pict.parseTemplateByHash("Flow-InfoPanel-Section-Generic",{SectionTitle:"Event Inputs",PortsContent:t}))}if(n.length>0){let t="";for(let e=0;e<n.length;e++){let o=n[e],i=o.Label||o.Name||"Event Out";"error"===o.PortType&&(i+=" ⚠"),t+=this.pict.parseTemplateByHash("Flow-InfoPanel-Port-Event",{Label:i})}r.push(this.pict.parseTemplateByHash("Flow-InfoPanel-Section-Generic",{SectionTitle:"Event Outputs",PortsContent:t}))}if(a.length>0){let t="";for(let e=0;e<a.length;e++){let o=a[e],i=o.Label||o.Name||"Output",n="";o.DataType&&(n=this.pict.parseTemplateByHash("Flow-InfoPanel-Port-DataType",{DataTypeText:o.DataType})),t+=this.pict.parseTemplateByHash("Flow-InfoPanel-Port-Value",{Label:i,DataType:n})}r.push(this.pict.parseTemplateByHash("Flow-InfoPanel-Section-Generic",{SectionTitle:"State Outputs",PortsContent:t}))}if(r.length>0){let e=document.createElement("div");e.className="pict-flow-info-panel pict-flow-port-summary",e.innerHTML=r.join(""),t.appendChild(e)}}_getPortConstraintHTML(t){let e="number"==typeof t.MinimumInputCount?t.MinimumInputCount:0,o="number"==typeof t.MaximumInputCount?t.MaximumInputCount:-1;if(e>0||o>0){let t="";return t=o<0?`(min ${e})`:e===o?`(exactly ${e})`:`(${e}–${o})`,this.pict.parseTemplateByHash("Flow-InfoPanel-Port-Constraint",{ConstraintText:t})}return""}_renderAppearanceTab(t,e){let o=this._FlowView.getNode(t.NodeHash);if(!o)return;let i=e.querySelector('.pict-flow-panel-tab-pane[data-tab="appearance"]');if(!i)return;let n=o.Style||{},a=this._FlowView._NodeTypeProvider.getNodeType(o.Type),r="#2c3e50",s="#ffffff",l="#d0d4d8";a&&(a.TitleBarColor&&(r=a.TitleBarColor),a.BodyStyle&&(a.BodyStyle.fill&&(s=a.BodyStyle.fill),a.BodyStyle.stroke&&(l=a.BodyStyle.stroke)));let c={Title:o.Title||"",Width:o.Width||180,Height:o.Height||80,BodyFillValue:n.BodyFill||s,BodyStrokeValue:n.BodyStroke||l,BodyStrokeWidthValue:n.BodyStrokeWidth||1,TitleBarColorValue:n.TitleBarColor||r};i.innerHTML=this.pict.parseTemplateByHash("Flow-NodeProps-Editor",c);let d=i.querySelectorAll(".pict-flow-node-props-input");for(let e=0;e<d.length;e++){let o=d[e],i=o.getAttribute("data-prop");o.addEventListener("input",e=>{e.stopPropagation(),this._applyNodePropChange(t.NodeHash,i,o.value,o.type)}),o.addEventListener("pointerdown",t=>{t.stopPropagation()})}}_renderHelpTab(t,e){let o=this._FlowView.getNode(t.NodeHash);if(!o)return;let i=this._FlowView._NodeTypeProvider.getNodeType(o.Type);if(!i)return;let n=i.CardMetadata&&i.CardMetadata.Help?i.CardMetadata.Help:null;if(!n)return;let a=e.querySelector('.pict-flow-panel-tab[data-tab-target="help"]');a&&(a.style.display="");let r=e.querySelector('.pict-flow-panel-tab-pane[data-tab="help"]');r&&(r.innerHTML='<div class="pict-flow-panel-help-content">'+n+"</div>")}_wireTabSwitching(t){let e=t.querySelectorAll(".pict-flow-panel-tab"),o=t.querySelectorAll(".pict-flow-panel-tab-pane");for(let i=0;i<e.length;i++)e[i].addEventListener("click",i=>{i.stopPropagation();let n=i.currentTarget.getAttribute("data-tab-target");for(let t=0;t<e.length;t++)e[t].classList.remove("active");for(let t=0;t<o.length;t++)o[t].classList.remove("active"),o[t].style.display="none";i.currentTarget.classList.add("active");let a=t.querySelector('.pict-flow-panel-tab-pane[data-tab="'+n+'"]');a&&(a.classList.add("active"),a.style.display="block")})}_applyNodePropChange(t,e,o,i){let n=this._FlowView.getNode(t);if(!n)return;let a=o;if("number"!==i||(a=parseFloat(o),!isNaN(a))){if("Title"===e)n.Title=a;else if("Width"===e)n.Width=a;else if("Height"===e)n.Height=a;else if(e.startsWith("Style.")){n.Style||(n.Style={});let t=e.substring(6);n.Style[t]=a}this._FlowView.renderFlow(),this._FlowView.marshalFromView(),this._FlowView._EventHandlerProvider&&this._FlowView._EventHandlerProvider.fireEvent("onFlowChanged",this._FlowView._FlowData)}}_renderTether(t,e,o){let i=this._FlowView._TetherService;if(!i)return;let n=this._FlowView.getNode(t.NodeHash);if(!n)return;let a=this._FlowView.options.ViewIdentifier;i.renderTether(t,n,e,o,a)}marshalAllFromPanels(){for(let t in this._PanelInstances){let e=this._PanelInstances[t];e&&e._NodeData&&e.marshalFromPanel(e._NodeData)}}destroyPanel(t){this._PanelInstances[t]&&(this._PanelInstances[t].destroy(),delete this._PanelInstances[t])}destroyAllPanels(){for(let t in this._PanelInstances)this._PanelInstances[t].destroy();this._PanelInstances={}}},e.exports.default_configuration=n},{"pict-view":128}],125:[function(t,e,o){const i=t("pict-view"),n={ViewIdentifier:"Flow-Toolbar",DefaultRenderable:"Flow-Toolbar-Content",DefaultDestinationAddress:"#Flow-Toolbar-Container",AutoRender:!1,FlowViewIdentifier:"Pict-Flow",EnablePalette:!0,EnableAddNode:!0,EnableCardPalette:!0,CSS:!1,Templates:[{Hash:"Flow-Toolbar-Template",Template:'\n<div class="pict-flow-toolbar" id="Flow-Toolbar-Bar-{~D:Record.FlowViewIdentifier~}">\n\t<div class="pict-flow-toolbar-group">\n\t\t<button class="pict-flow-toolbar-btn" data-flow-action="add-node" id="Flow-Toolbar-AddNode-{~D:Record.FlowViewIdentifier~}" title="Add Node">\n\t\t\t<span class="pict-flow-toolbar-btn-icon" id="Flow-Toolbar-Icon-plus-{~D:Record.FlowViewIdentifier~}"></span>\n\t\t\t<span class="pict-flow-toolbar-btn-text">Node</span>\n\t\t</button>\n\t\t<button class="pict-flow-toolbar-btn" data-flow-action="cards-popup" id="Flow-Toolbar-Cards-{~D:Record.FlowViewIdentifier~}" title="Card Palette">\n\t\t\t<span class="pict-flow-toolbar-btn-icon" id="Flow-Toolbar-Icon-cards-{~D:Record.FlowViewIdentifier~}"></span>\n\t\t\t<span class="pict-flow-toolbar-btn-text">Cards</span>\n\t\t\t<span class="pict-flow-toolbar-btn-chevron" id="Flow-Toolbar-CardsChevron-{~D:Record.FlowViewIdentifier~}"></span>\n\t\t</button>\n\t\t<button class="pict-flow-toolbar-btn" data-flow-action="delete-selected" title="Delete Node">\n\t\t\t<span class="pict-flow-toolbar-btn-icon" id="Flow-Toolbar-Icon-trash-{~D:Record.FlowViewIdentifier~}"></span>\n\t\t</button>\n\t</div>\n\t<div class="pict-flow-toolbar-group">\n\t\t<button class="pict-flow-toolbar-btn" data-flow-action="layout-popup" id="Flow-Toolbar-Layout-{~D:Record.FlowViewIdentifier~}" title="Manage Layouts">\n\t\t\t<span class="pict-flow-toolbar-btn-icon" id="Flow-Toolbar-Icon-layout-{~D:Record.FlowViewIdentifier~}"></span>\n\t\t\t<span class="pict-flow-toolbar-btn-text">Layout</span>\n\t\t\t<span class="pict-flow-toolbar-btn-chevron" id="Flow-Toolbar-LayoutChevron-{~D:Record.FlowViewIdentifier~}"></span>\n\t\t</button>\n\t\t<button class="pict-flow-toolbar-btn" data-flow-action="auto-layout" title="Auto Layout">\n\t\t\t<span class="pict-flow-toolbar-btn-icon" id="Flow-Toolbar-Icon-auto-layout-{~D:Record.FlowViewIdentifier~}"></span>\n\t\t\t<span class="pict-flow-toolbar-btn-text">Auto Layout</span>\n\t\t</button>\n\t</div>\n\t<div class="pict-flow-toolbar-group">\n\t\t<button class="pict-flow-toolbar-btn" data-flow-action="zoom-in" title="Zoom In">\n\t\t\t<span class="pict-flow-toolbar-btn-icon" id="Flow-Toolbar-Icon-zoom-in-{~D:Record.FlowViewIdentifier~}"></span>\n\t\t</button>\n\t\t<button class="pict-flow-toolbar-btn" data-flow-action="zoom-out" title="Zoom Out">\n\t\t\t<span class="pict-flow-toolbar-btn-icon" id="Flow-Toolbar-Icon-zoom-out-{~D:Record.FlowViewIdentifier~}"></span>\n\t\t</button>\n\t\t<button class="pict-flow-toolbar-btn" data-flow-action="zoom-fit" title="Fit to View">\n\t\t\t<span class="pict-flow-toolbar-btn-icon" id="Flow-Toolbar-Icon-zoom-fit-{~D:Record.FlowViewIdentifier~}"></span>\n\t\t</button>\n\t</div>\n\t<div class="pict-flow-toolbar-group pict-flow-toolbar-right">\n\t\t<button class="pict-flow-toolbar-btn" data-flow-action="settings-popup" id="Flow-Toolbar-Settings-{~D:Record.FlowViewIdentifier~}" title="Theme Settings">\n\t\t\t<span class="pict-flow-toolbar-btn-icon" id="Flow-Toolbar-Icon-settings-{~D:Record.FlowViewIdentifier~}"></span>\n\t\t</button>\n\t\t<button class="pict-flow-toolbar-btn" data-flow-action="fullscreen" id="Flow-Toolbar-Fullscreen-{~D:Record.FlowViewIdentifier~}" title="Toggle Fullscreen">\n\t\t\t<span class="pict-flow-toolbar-btn-icon" id="Flow-Toolbar-Fullscreen-Icon-{~D:Record.FlowViewIdentifier~}"></span>\n\t\t</button>\n\t\t<button class="pict-flow-toolbar-btn" data-flow-action="toggle-floating" title="Float">\n\t\t\t<span class="pict-flow-toolbar-btn-icon" id="Flow-Toolbar-Icon-grip-{~D:Record.FlowViewIdentifier~}"></span>\n\t\t</button>\n\t\t<button class="pict-flow-toolbar-btn" data-flow-action="collapse-toolbar" title="Collapse Toolbar">\n\t\t\t<span class="pict-flow-toolbar-btn-icon" id="Flow-Toolbar-Icon-collapse-{~D:Record.FlowViewIdentifier~}"></span>\n\t\t</button>\n\t</div>\n</div>\n<div class="pict-flow-toolbar-collapsed" id="Flow-Toolbar-Collapsed-{~D:Record.FlowViewIdentifier~}">\n\t<button class="pict-flow-toolbar-expand-btn" data-flow-action="expand-toolbar" title="Expand Toolbar" id="Flow-Toolbar-ExpandBtn-{~D:Record.FlowViewIdentifier~}">\n\t\t<span id="Flow-Toolbar-Icon-expand-{~D:Record.FlowViewIdentifier~}"></span>\n\t</button>\n</div>\n<div class="pict-flow-toolbar-popup-anchor" id="Flow-Toolbar-PopupAnchor-{~D:Record.FlowViewIdentifier~}">\n</div>\n'}],Renderables:[{RenderableHash:"Flow-Toolbar-Content",TemplateHash:"Flow-Toolbar-Template",DestinationAddress:"#Flow-Toolbar-Container",RenderMethod:"replace"}]};e.exports=class extends i{constructor(t,e,o){super(t,Object.assign({},JSON.parse(JSON.stringify(n)),e),o),this.serviceType="PictViewFlowToolbar",this._FlowView=null,this._ToolbarMode="docked",this._ActivePopup=null,this._FloatingPosition={X:80,Y:80},this._DocumentClickHandler=null,this._FloatingToolbarView=null}render(t,e,o){return super.render(t,e,this.options)}onAfterRender(t,e,o,i){let n=this.options.FlowViewIdentifier,a=this.pict.ContentAssignment.getElement(`#Flow-Toolbar-Bar-${n}`);a.length>0&&a[0].addEventListener("click",t=>{let e=t.target;if(!e)return;let o=e.closest("[data-flow-action]");if(!o)return;let i=o.getAttribute("data-flow-action");this._handleToolbarAction(i)});let r=this.pict.ContentAssignment.getElement(`#Flow-Toolbar-ExpandBtn-${n}`);if(r.length>0&&r[0].addEventListener("click",()=>{this._setToolbarMode("docked")}),this._populateToolbarIcons(),!1===this.options.EnableAddNode){let t=this.pict.ContentAssignment.getElement(`#Flow-Toolbar-AddNode-${n}`);t.length>0&&t[0].remove()}if(!1===this.options.EnableCardPalette){let t=this.pict.ContentAssignment.getElement(`#Flow-Toolbar-Cards-${n}`);t.length>0&&t[0].remove()}return super.onAfterRender(t,e,o,i)}_populateToolbarIcons(){let t=this._FlowView?this._FlowView._IconProvider:null;if(!t)return;let e=this.options.FlowViewIdentifier,o={plus:"plus",trash:"trash","zoom-in":"zoom-in","zoom-out":"zoom-out","zoom-fit":"zoom-fit","auto-layout":"auto-layout",cards:"cards",layout:"layout",settings:"settings",grip:"grip",collapse:"collapse",expand:"expand"},i=Object.keys(o);for(let n=0;n<i.length;n++){let a=`Flow-Toolbar-Icon-${i[n]}-${e}`,r=this.pict.ContentAssignment.getElement(`#${a}`);r.length>0&&(r[0].innerHTML=t.getIconSVGMarkup(o[i[n]],14))}let n=this.pict.ContentAssignment.getElement(`#Flow-Toolbar-Fullscreen-Icon-${e}`);n.length>0&&(n[0].innerHTML=t.getIconSVGMarkup("fullscreen",14));let a=this.pict.ContentAssignment.getElement(`#Flow-Toolbar-CardsChevron-${e}`);a.length>0&&(a[0].innerHTML=t.getIconSVGMarkup("chevron-down",8));let r=this.pict.ContentAssignment.getElement(`#Flow-Toolbar-LayoutChevron-${e}`);r.length>0&&(r[0].innerHTML=t.getIconSVGMarkup("chevron-down",8))}_openPopup(t){if(this._ActivePopup===t)return void this._closePopup();this._closePopup();let e=this.options.FlowViewIdentifier,o=this.pict.ContentAssignment.getElement(`#Flow-Toolbar-PopupAnchor-${e}`);if(o.length<1)return;let i=document.createElement("div");switch(i.className="pict-flow-toolbar-popup",i.setAttribute("id",`Flow-Toolbar-Popup-${e}`),t){case"add-node":this._buildAddNodePopup(i);break;case"cards":this._buildCardsPopup(i);break;case"layout":this._buildLayoutPopup(i);break;case"settings":this._buildSettingsPopup(i)}if(o[0].appendChild(i),this._ActivePopup=t,this._positionPopup(i,t),setTimeout(()=>{this._DocumentClickHandler=e=>{if(!i.contains(e.target)){let o=e.target.closest("[data-flow-action]");if(o){let e=o.getAttribute("data-flow-action");if(e===t||e===t.replace("-popup","")+"-popup")return}this._closePopup()}},document.addEventListener("click",this._DocumentClickHandler,!0)},0),"add-node"===t){let t=i.querySelector(".pict-flow-popup-search");t&&setTimeout(()=>{t.focus()},50)}}_closePopup(){this._DocumentClickHandler&&(document.removeEventListener("click",this._DocumentClickHandler,!0),this._DocumentClickHandler=null);let t=this.options.FlowViewIdentifier,e=this.pict.ContentAssignment.getElement(`#Flow-Toolbar-Popup-${t}`);e.length>0&&e[0].parentNode.removeChild(e[0]),this._ActivePopup=null}_positionPopup(t,e){let o,i=this.options.FlowViewIdentifier;switch(e){case"add-node":o=`#Flow-Toolbar-AddNode-${i}`;break;case"cards":o=`#Flow-Toolbar-Cards-${i}`;break;case"layout":o=`#Flow-Toolbar-Layout-${i}`;break;case"settings":o=`#Flow-Toolbar-Settings-${i}`;break;default:return}let n=this.pict.ContentAssignment.getElement(o);if(n.length<1)return;let a=this.pict.ContentAssignment.getElement(`#Flow-Toolbar-PopupAnchor-${i}`);if(a.length<1)return;let r=n[0].getBoundingClientRect(),s=a[0].getBoundingClientRect(),l=r.left-s.left;t.style.left=l+"px",t.style.top="0px"}_buildAddNodePopup(t){let e=document.createElement("div");e.className="pict-flow-popup-search-wrapper";let o=document.createElement("span");o.className="pict-flow-popup-search-icon";let i=this._FlowView?this._FlowView._IconProvider:null;i&&(o.innerHTML=i.getIconSVGMarkup("search",12)),e.appendChild(o);let n=document.createElement("input");n.className="pict-flow-popup-search",n.setAttribute("type","text"),n.setAttribute("placeholder","Search node types..."),e.appendChild(n),t.appendChild(e);let a=document.createElement("div");a.className="pict-flow-popup-node-list",t.appendChild(a),this._populateNodeList(a,""),n.addEventListener("input",()=>{this._populateNodeList(a,n.value)})}_populateNodeList(t,e){if(!this._FlowView||!this._FlowView._NodeTypeProvider)return;for(;t.firstChild;)t.removeChild(t.firstChild);let o=this._FlowView._NodeTypeProvider.getNodeTypes(),i=Object.keys(o),n=(e||"").toLowerCase().trim(),a=this._FlowView._IconProvider,r=0;for(let e=0;e<i.length;e++){let s=o[i[e]],l=s.CardMetadata||{};if(!1===l.Enabled)continue;if(n){let t=(s.Label||"").toLowerCase(),e=(l.Code||"").toLowerCase(),o=(l.Category||"").toLowerCase();if(t.indexOf(n)<0&&e.indexOf(n)<0&&o.indexOf(n)<0)continue}r++;let c=document.createElement("div");c.className="pict-flow-popup-list-item",c.setAttribute("data-node-type",i[e]);let d=document.createElement("span");if(d.className="pict-flow-popup-list-item-icon",a){let t=a.resolveIconKey(l);d.innerHTML=a.getIconSVGMarkup(t,16)}c.appendChild(d);let p=document.createElement("span");if(p.className="pict-flow-popup-list-item-label",p.textContent=s.Label,c.appendChild(p),l.Code){let t=document.createElement("span");t.className="pict-flow-popup-list-item-code",t.textContent=l.Code,c.appendChild(t)}c.addEventListener("click",()=>{this._addNodeAtCenter(i[e]),this._closePopup()}),t.appendChild(c)}if(0===r){let e=document.createElement("div");e.className="pict-flow-popup-list-empty",e.textContent="No matching node types",t.appendChild(e)}}_buildCardsPopup(t){let e=document.createElement("div");e.className="pict-flow-popup-search-wrapper";let o=document.createElement("span");o.className="pict-flow-popup-search-icon";let i=this._FlowView?this._FlowView._IconProvider:null;i&&(o.innerHTML=i.getIconSVGMarkup("search",12)),e.appendChild(o);let n=document.createElement("input");n.className="pict-flow-popup-search",n.setAttribute("type","text"),n.setAttribute("placeholder","Search cards..."),e.appendChild(n),t.appendChild(e);let a=document.createElement("div");a.className="pict-flow-popup-node-list",t.appendChild(a),this._renderPalette(a,""),n.addEventListener("input",()=>{this._renderPalette(a,n.value)}),setTimeout(()=>{n.focus()},50)}_renderPalette(t,e){if(!this._FlowView||!this._FlowView._NodeTypeProvider)return;for(;t.firstChild;)t.removeChild(t.firstChild);let o=this._FlowView._NodeTypeProvider.getCardsByCategory(),i=Object.keys(o),n=(e||"").toLowerCase().trim(),a=0;for(let e=0;e<i.length;e++){let r=i[e],s=o[r],l=[];for(let t=0;t<s.length;t++){let e=s[t],o=e.CardMetadata||{};if(n){let t=(e.Label||"").toLowerCase(),i=(o.Code||"").toLowerCase(),a=r.toLowerCase();if(t.indexOf(n)<0&&i.indexOf(n)<0&&a.indexOf(n)<0)continue}l.push(e)}if(0===l.length)continue;a+=l.length;let c=document.createElement("div");c.className="pict-flow-palette-category",c.style.padding="0.35em 0.5em";let d=document.createElement("div");d.className="pict-flow-palette-category-label",d.textContent=r,c.appendChild(d);let p=document.createElement("div");p.className="pict-flow-palette-cards";for(let t=0;t<l.length;t++){let e=l[t],o=e.CardMetadata||{},i=document.createElement("div");if(i.className="pict-flow-palette-card",!1===o.Enabled&&i.classList.add("disabled"),i.setAttribute("data-card-type",e.Hash),o.Tooltip?i.setAttribute("title",o.Tooltip):o.Description&&i.setAttribute("title",o.Description),o.Icon){let t=document.createElement("span");t.className="pict-flow-palette-card-icon";let e=this._FlowView._IconProvider;if(e&&!e.isEmojiIcon(o.Icon)){let i=e.resolveIconKey(o);t.innerHTML=e.getIconSVGMarkup(i,14)}else t.textContent=o.Icon;i.appendChild(t)}else if(this._FlowView._IconProvider){let t=document.createElement("span");t.className="pict-flow-palette-card-icon",t.innerHTML=this._FlowView._IconProvider.getIconSVGMarkup("default",14),i.appendChild(t)}else if(e.TitleBarColor){let t=document.createElement("span");t.className="pict-flow-palette-card-swatch",t.style.backgroundColor=e.TitleBarColor,i.appendChild(t)}let n=document.createElement("span");if(n.className="pict-flow-palette-card-title",n.textContent=e.Label,i.appendChild(n),o.Code){let t=document.createElement("span");t.className="pict-flow-palette-card-code",t.textContent=o.Code,i.appendChild(t)}i.addEventListener("click",()=>{this._addCardFromPalette(e.Hash),this._closePopup()}),p.appendChild(i)}c.appendChild(p),t.appendChild(c)}if(0===a){let e=document.createElement("div");e.className="pict-flow-popup-list-empty",e.textContent=n?"No matching cards":"No card types available",t.appendChild(e)}}_buildLayoutPopup(t){let e=this._FlowView?this._FlowView._IconProvider:null,o=document.createElement("div");o.className="pict-flow-popup-layout-save-section";let i=document.createElement("div");i.className="pict-flow-popup-layout-save-input-row",i.style.display="none";let n=document.createElement("input");n.className="pict-flow-popup-layout-save-input",n.setAttribute("type","text"),n.setAttribute("placeholder","Layout name..."),i.appendChild(n);let a=document.createElement("button");a.className="pict-flow-popup-layout-save-confirm",a.title="Save",e?a.innerHTML=e.getIconSVGMarkup("save",14):a.textContent="✓",i.appendChild(a);let r=document.createElement("div");r.className="pict-flow-popup-layout-save";let s=document.createElement("span");s.className="pict-flow-popup-layout-save-icon",e&&(s.innerHTML=e.getIconSVGMarkup("save",14)),r.appendChild(s);let l=document.createElement("span");l.textContent="Save Current Layout",r.appendChild(l),r.addEventListener("click",()=>{r.style.display="none",i.style.display="",n.value="",setTimeout(()=>{n.focus()},50)});let c=()=>{let e=n.value.trim();if(""!==e){for(this._FlowView._LayoutProvider.saveLayout(e);t.firstChild;)t.removeChild(t.firstChild);this._buildLayoutPopup(t)}};a.addEventListener("click",c),n.addEventListener("keydown",t=>{"Enter"===t.key?(t.preventDefault(),c()):"Escape"===t.key&&(i.style.display="none",r.style.display="")}),n.addEventListener("click",t=>{t.stopPropagation()}),o.appendChild(r),o.appendChild(i),t.appendChild(o);let d=document.createElement("div");if(d.className="pict-flow-popup-divider",t.appendChild(d),!this._FlowView||!this._FlowView._LayoutProvider){let e=document.createElement("div");return e.className="pict-flow-popup-list-empty",e.textContent="No saved layouts",void t.appendChild(e)}let p=this._FlowView._LayoutProvider.getLayouts();if(0===p.length){let e=document.createElement("div");return e.className="pict-flow-popup-list-empty",e.textContent="No saved layouts",void t.appendChild(e)}for(let o=0;o<p.length;o++){let i=p[o],n=document.createElement("div");n.className="pict-flow-popup-layout-row";let a=document.createElement("span");a.className="pict-flow-popup-layout-name",a.textContent=i.Name,n.appendChild(a);let r=document.createElement("button");r.className="pict-flow-popup-layout-delete",r.title="Delete layout",e?r.innerHTML=e.getIconSVGMarkup("trash",12):r.textContent="×",n.appendChild(r),n.addEventListener("click",t=>{t.target.closest(".pict-flow-popup-layout-delete")||(this._FlowView._LayoutProvider.restoreLayout(i.Hash),this._closePopup())}),r.addEventListener("click",e=>{for(e.stopPropagation(),this._FlowView._LayoutProvider.deleteLayout(i.Hash);t.firstChild;)t.removeChild(t.firstChild);this._buildLayoutPopup(t)}),t.appendChild(n)}}_buildSettingsPopup(t){if(!this._FlowView||!this._FlowView._ThemeProvider)return;let e=this._FlowView._ThemeProvider,o=document.createElement("div");o.className="pict-flow-popup-settings-section";let i=document.createElement("label");i.className="pict-flow-popup-settings-label",i.textContent="Theme",o.appendChild(i);let n=document.createElement("select");n.className="pict-flow-popup-settings-select";let a=e.getThemeKeys(),r=e.getActiveThemeKey();for(let t=0;t<a.length;t++){let o=document.createElement("option");o.value=a[t];let i=e._Themes[a[t]];o.textContent=i.Label||a[t],a[t]===r&&(o.selected=!0),n.appendChild(o)}n.addEventListener("change",()=>{this._FlowView.setTheme(n.value),this._refreshNoiseSlider(t)}),n.addEventListener("click",t=>{t.stopPropagation()}),o.appendChild(n),t.appendChild(o);let s=document.createElement("div");s.className="pict-flow-popup-divider",t.appendChild(s);let l=document.createElement("div");l.className="pict-flow-popup-settings-section pict-flow-popup-settings-noise",l.setAttribute("data-settings-type","noise");let c=document.createElement("label");c.className="pict-flow-popup-settings-label",c.textContent="Noise",l.appendChild(c);let d=document.createElement("div");d.className="pict-flow-popup-settings-slider-row";let p=document.createElement("input");p.type="range",p.className="pict-flow-popup-settings-slider",p.min="0",p.max="100",p.value=String(Math.round(100*e.getNoiseLevel()));let h=document.createElement("span");h.className="pict-flow-popup-settings-slider-value",h.textContent=p.value+"%",p.addEventListener("input",()=>{let t=parseInt(p.value,10)/100;h.textContent=p.value+"%",this._FlowView.setNoiseLevel(t)}),p.addEventListener("click",t=>{t.stopPropagation()}),p.addEventListener("pointerdown",t=>{t.stopPropagation()}),d.appendChild(p),d.appendChild(h),l.appendChild(d),t.appendChild(l),this._refreshNoiseSlider(t)}_refreshNoiseSlider(t){let e=t.querySelector('[data-settings-type="noise"]');if(!e)return;let o=this._FlowView._ThemeProvider.getActiveTheme();if(o&&o.NoiseConfig&&o.NoiseConfig.Enabled){e.style.display="";let t=e.querySelector(".pict-flow-popup-settings-slider"),o=e.querySelector(".pict-flow-popup-settings-slider-value");if(t){let e=Math.round(100*this._FlowView._ThemeProvider.getNoiseLevel());t.value=String(e),o&&(o.textContent=e+"%")}}else e.style.display="none"}_setToolbarMode(t){this._closePopup();let e=this.options.FlowViewIdentifier,o=this.pict.ContentAssignment.getElement(`#Flow-Toolbar-Bar-${e}`),i=this.pict.ContentAssignment.getElement(`#Flow-Toolbar-Collapsed-${e}`);switch(t){case"docked":o.length>0&&(o[0].style.display=""),i.length>0&&i[0].classList.remove("visible"),this._FloatingToolbarView&&this._FloatingToolbarView.hide();break;case"floating":o.length>0&&(o[0].style.display="none"),i.length>0&&i[0].classList.remove("visible"),this._showFloatingToolbar();break;case"collapsed":o.length>0&&(o[0].style.display="none"),i.length>0&&i[0].classList.add("visible"),this._FloatingToolbarView&&this._FloatingToolbarView.hide()}this._ToolbarMode=t}_showFloatingToolbar(){if(this._FlowView){if(!this._FloatingToolbarView){let t=this.options.FlowViewIdentifier;this._FloatingToolbarView=this.fable.instantiateServiceProviderWithoutRegistration("PictViewFlowFloatingToolbar",{FlowViewIdentifier:t,DefaultDestinationAddress:`#Flow-FloatingToolbar-Container-${t}`,EnableAddNode:this.options.EnableAddNode,EnableCardPalette:this.options.EnableCardPalette}),this._FloatingToolbarView._ToolbarView=this,this._FloatingToolbarView._FlowView=this._FlowView,this._FloatingToolbarView.render()}this._FloatingToolbarView.show()}}_addNodeAtCenter(t){if(!this._FlowView)return;let e=this._FlowView.viewState,o=this._FlowView._SVGElement,i=o?o.clientWidth:600,n=o?o.clientHeight:400,a=(-e.PanX+i/2)/e.Zoom,r=(-e.PanY+n/2)/e.Zoom,s=this._FlowView.flowData.Nodes.length;a+=s%5*30,r+=s%5*30,this._FlowView.addNode(t,a,r)}_addCardFromPalette(t){if(!this._FlowView)return;let e=this._FlowView.viewState,o=(200-e.PanX)/e.Zoom,i=(200-e.PanY)/e.Zoom,n=this._FlowView.flowData.Nodes.length;o+=n%5*40,i+=n%5*40,this._FlowView.addNode(t,o,i)}_handleToolbarAction(t){if(!this._FlowView)return;let e=this.options.FlowViewIdentifier;switch(t){case"add-node":this._openPopup("add-node");break;case"delete-selected":this._FlowView.deleteSelected();break;case"zoom-in":this._FlowView.setZoom(this._FlowView.viewState.Zoom+this._FlowView.options.ZoomStep);break;case"zoom-out":this._FlowView.setZoom(this._FlowView.viewState.Zoom-this._FlowView.options.ZoomStep);break;case"zoom-fit":this._FlowView.zoomToFit();break;case"auto-layout":this._FlowView.autoLayout();break;case"cards-popup":this._openPopup("cards");break;case"layout-popup":this._openPopup("layout");break;case"settings-popup":this._openPopup("settings");break;case"toggle-floating":"floating"===this._ToolbarMode?this._setToolbarMode("docked"):this._setToolbarMode("floating");break;case"collapse-toolbar":this._setToolbarMode("collapsed");break;case"expand-toolbar":this._setToolbarMode("docked");break;case"fullscreen":{let t=this._FlowView.toggleFullscreen(),o=this._FlowView._IconProvider,i=this.pict.ContentAssignment.getElement(`#Flow-Toolbar-Fullscreen-Icon-${e}`);i.length>0&&o&&(i[0].innerHTML=o.getIconSVGMarkup(t?"exit-fullscreen":"fullscreen",14));let n=this.pict.ContentAssignment.getElement(`#Flow-Toolbar-Fullscreen-${e}`);n.length>0&&n[0].setAttribute("title",t?"Exit Fullscreen":"Toggle Fullscreen")}break;default:this.log.warn(`PictViewFlowToolbar: unknown action '${t}'`)}}},e.exports.default_configuration=n},{"pict-view":128}],126:[function(t,e,o){const i=t("pict-view"),n=t("../services/PictService-Flow-InteractionManager.js"),a=t("../services/PictService-Flow-ConnectionRenderer.js"),r=t("../services/PictService-Flow-Tether.js"),s=t("../services/PictService-Flow-Layout.js"),l=t("../services/PictService-Flow-PathGenerator.js"),c=t("../services/PictService-Flow-ViewportManager.js"),d=t("../services/PictService-Flow-SelectionManager.js"),p=t("../services/PictService-Flow-PanelManager.js"),h=t("../services/PictService-Flow-DataManager.js"),u=t("../services/PictService-Flow-ConnectionHandleManager.js"),f=t("../services/PictService-Flow-RenderManager.js"),g=t("../services/PictService-Flow-PortRenderer.js"),m=t("../providers/PictProvider-Flow-NodeTypes.js"),w=t("../providers/PictProvider-Flow-EventHandler.js"),v=t("../providers/PictProvider-Flow-Layouts.js"),b=t("../providers/PictProvider-Flow-SVGHelpers.js"),y=t("../providers/PictProvider-Flow-Geometry.js"),F=t("../providers/PictProvider-Flow-PanelChrome.js"),S=t("../providers/PictProvider-Flow-CSS.js"),P=t("../providers/PictProvider-Flow-Icons.js"),_=t("../providers/PictProvider-Flow-ConnectorShapes.js"),x=t("../providers/PictProvider-Flow-Theme.js"),D=t("../providers/PictProvider-Flow-Noise.js"),C=t("./PictView-Flow-Node.js"),T=t("./PictView-Flow-Toolbar.js"),A=t("./PictView-Flow-FloatingToolbar.js"),I=t("./PictView-Flow-PropertiesPanel.js"),E=t("../PictFlowCardPropertiesPanel.js"),V=t("../panels/FlowCardPropertiesPanel-Template.js"),M=t("../panels/FlowCardPropertiesPanel-Markdown.js"),k=t("../panels/FlowCardPropertiesPanel-Form.js"),H=t("../panels/FlowCardPropertiesPanel-View.js"),R={ViewIdentifier:"Pict-Flow",DefaultRenderable:"Flow-Container",DefaultDestinationAddress:"#Flow-Container",AutoRender:!1,FlowDataAddress:!1,TargetElementAddress:"#Flow-SVG-Container",EnableToolbar:!0,EnableAddNode:!0,EnableCardPalette:!0,IncludeDefaultNodeTypes:!0,EnablePanning:!0,EnableZooming:!0,EnableNodeDragging:!0,EnableConnectionCreation:!0,EnableGridSnap:!1,GridSnapSize:20,MinZoom:.1,MaxZoom:5,ZoomStep:.1,DefaultNodeType:"default",DefaultNodeWidth:180,DefaultNodeHeight:80,CSS:!1,Templates:[{Hash:"Flow-PanelChrome-Template",Template:'<div class="pict-flow-panel" xmlns="http://www.w3.org/1999/xhtml"><div class="pict-flow-panel-titlebar" data-element-type="panel-titlebar" data-panel-hash="{~D:Record.Hash~}"><span class="pict-flow-panel-title-text">{~D:Record.Title~}</span><span class="pict-flow-panel-close-btn" data-element-type="panel-close" data-panel-hash="{~D:Record.Hash~}"><span class="pict-flow-panel-close-icon"></span></span></div><div class="pict-flow-panel-content" data-panel-hash="{~D:Record.Hash~}"><div class="pict-flow-panel-tab-pane active" data-tab="properties" data-panel-hash="{~D:Record.Hash~}"></div><div class="pict-flow-panel-tab-pane" data-tab="help" data-panel-hash="{~D:Record.Hash~}" style="display:none;"></div><div class="pict-flow-panel-tab-pane" data-tab="appearance" data-panel-hash="{~D:Record.Hash~}" style="display:none;"></div></div><div class="pict-flow-panel-resize-handle" data-element-type="panel-resize" data-panel-hash="{~D:Record.Hash~}"></div><div class="pict-flow-panel-tabbar" data-panel-hash="{~D:Record.Hash~}"><div class="pict-flow-panel-tab active" data-tab-target="properties" data-panel-hash="{~D:Record.Hash~}">Properties</div><div class="pict-flow-panel-tab" data-tab-target="help" data-panel-hash="{~D:Record.Hash~}" style="display:none;">Help</div><div class="pict-flow-panel-tab" data-tab-target="appearance" data-panel-hash="{~D:Record.Hash~}">Appearance</div></div></div>'},{Hash:"Flow-Container-Template",Template:'\n<div class="pict-flow-container" id="Flow-Wrapper-{~D:Record.ViewIdentifier~}">\n\t<div id="Flow-Toolbar-{~D:Record.ViewIdentifier~}"></div>\n\t<div id="Flow-FloatingToolbar-Container-{~D:Record.ViewIdentifier~}" style="display:none;position:absolute;top:0;left:0;width:100%;height:100%;pointer-events:none;z-index:100;"></div>\n\t<div class="pict-flow-svg-container" id="Flow-SVG-Container-{~D:Record.ViewIdentifier~}">\n\t\t<svg class="pict-flow-svg"\n\t\t\tid="Flow-SVG-{~D:Record.ViewIdentifier~}"\n\t\t\txmlns="http://www.w3.org/2000/svg">\n\t\t\t<defs>\n\t\t\t\t<pattern id="flow-grid-{~D:Record.ViewIdentifier~}"\n\t\t\t\t\twidth="20" height="20" patternUnits="userSpaceOnUse">\n\t\t\t\t\t<line x1="20" y1="0" x2="20" y2="20" class="pict-flow-grid-pattern" />\n\t\t\t\t\t<line x1="0" y1="20" x2="20" y2="20" class="pict-flow-grid-pattern" />\n\t\t\t\t</pattern>\n\t\t\t</defs>\n\t\t\t<rect width="10000" height="10000" x="-5000" y="-5000"\n\t\t\t\tfill="url(#flow-grid-{~D:Record.ViewIdentifier~})"\n\t\t\t\tclass="pict-flow-grid-background" />\n\t\t\t<g class="pict-flow-viewport" id="Flow-Viewport-{~D:Record.ViewIdentifier~}">\n\t\t\t\t<g class="pict-flow-connections-layer" id="Flow-Connections-{~D:Record.ViewIdentifier~}"></g>\n\t\t\t\t<g class="pict-flow-nodes-layer" id="Flow-Nodes-{~D:Record.ViewIdentifier~}"></g>\n\t\t\t\t<g class="pict-flow-tethers-layer" id="Flow-Tethers-{~D:Record.ViewIdentifier~}"></g>\n\t\t\t\t<g class="pict-flow-panels-layer" id="Flow-Panels-{~D:Record.ViewIdentifier~}"></g>\n\t\t\t</g>\n\t\t</svg>\n\t</div>\n</div>\n'}],Renderables:[{RenderableHash:"Flow-Container",TemplateHash:"Flow-Container-Template",DestinationAddress:"#Flow-Container",RenderMethod:"replace"}]};e.exports=class extends i{constructor(t,e,o){super(t,Object.assign({},JSON.parse(JSON.stringify(R)),e),o),this.serviceType="PictSectionFlow",this._ServiceRegistry=[{ServiceType:"PictProviderFlowSVGHelpers",Library:b,Property:"_SVGHelperProvider",NoFlowView:!0},{ServiceType:"PictProviderFlowGeometry",Library:y,Property:"_GeometryProvider",NoFlowView:!0},{ServiceType:"PictProviderFlowNoise",Library:D,Property:"_NoiseProvider",NoFlowView:!0},{ServiceType:"PictProviderFlowTheme",Library:x,Property:"_ThemeProvider"},{ServiceType:"PictProviderFlowCSS",Library:S,Property:"_CSSProvider",PostInit:"registerCSS"},{ServiceType:"PictProviderFlowIcons",Library:P,Property:"_IconProvider",PostInit:"registerIconTemplates"},{ServiceType:"PictProviderFlowConnectorShapes",Library:_,Property:"_ConnectorShapesProvider"},{ServiceType:"PictProviderFlowPanelChrome",Library:F,Property:"_PanelChromeProvider"},{ServiceType:"PictProviderFlowNodeTypes",Library:m,Property:"_NodeTypeProvider",ExtraOptions:()=>({AdditionalNodeTypes:this.options.NodeTypes,IncludeDefaultNodeTypes:this.options.IncludeDefaultNodeTypes})},{ServiceType:"PictProviderFlowEventHandler",Library:w,Property:"_EventHandlerProvider"},{ServiceType:"PictProviderFlowLayouts",Library:v,Property:"_LayoutProvider",PostInit:"loadPersistedLayouts"},{ServiceType:"PictServiceFlowPathGenerator",Library:l,Property:"_PathGenerator"},{ServiceType:"PictServiceFlowDataManager",Library:h,Property:"_DataManager"},{ServiceType:"PictServiceFlowConnectionHandleManager",Library:u,Property:"_ConnectionHandleManager"},{ServiceType:"PictServiceFlowRenderManager",Library:f,Property:"_RenderManager"},{ServiceType:"PictServiceFlowPortRenderer",Library:g,Property:"_PortRenderer"},{ServiceType:"PictServiceFlowInteractionManager",Library:n,Property:"_InteractionManager"},{ServiceType:"PictServiceFlowConnectionRenderer",Library:a,Property:"_ConnectionRenderer"},{ServiceType:"PictServiceFlowTether",Library:r,Property:"_TetherService"},{ServiceType:"PictServiceFlowLayout",Library:s,Property:"_LayoutService"},{ServiceType:"PictServiceFlowViewportManager",Library:c,Property:"_ViewportManager"},{ServiceType:"PictServiceFlowSelectionManager",Library:d,Property:"_SelectionManager"},{ServiceType:"PictServiceFlowPanelManager",Library:p,Property:"_PanelManager"},{ServiceType:"PictViewFlowNode",Library:C,RegisterOnly:!0},{ServiceType:"PictViewFlowToolbar",Library:T,RegisterOnly:!0},{ServiceType:"PictViewFlowFloatingToolbar",Library:A,RegisterOnly:!0},{ServiceType:"PictViewFlowPropertiesPanel",Library:I,RegisterOnly:!0},{ServiceType:"PictFlowCardPropertiesPanel",Library:E,RegisterOnly:!0},{ServiceType:"PictFlowCardPropertiesPanel-Template",Library:V,RegisterOnly:!0},{ServiceType:"PictFlowCardPropertiesPanel-Markdown",Library:M,RegisterOnly:!0},{ServiceType:"PictFlowCardPropertiesPanel-Form",Library:k,RegisterOnly:!0},{ServiceType:"PictFlowCardPropertiesPanel-View",Library:H,RegisterOnly:!0}],this._registerServiceTypes(),this._FlowData={Nodes:[],Connections:[],OpenPanels:[],SavedLayouts:[],ViewState:{PanX:0,PanY:0,Zoom:1,SelectedNodeHash:null,SelectedConnectionHash:null,SelectedTetherHash:null}},this._SVGElement=null,this._ViewportElement=null,this._NodesLayer=null,this._ConnectionsLayer=null,this._TethersLayer=null,this._PanelsLayer=null,this._DataManager=null,this._ConnectionHandleManager=null,this._RenderManager=null,this._PortRenderer=null,this._InteractionManager=null,this._ConnectionRenderer=null,this._TetherService=null,this._LayoutService=null,this._PathGenerator=null,this._ViewportManager=null,this._SelectionManager=null,this._PanelManager=null,this._CSSProvider=null,this._IconProvider=null,this._ConnectorShapesProvider=null,this._ThemeProvider=null,this._NoiseProvider=null,this._SVGHelperProvider=null,this._GeometryProvider=null,this._PanelChromeProvider=null,this._NodeTypeProvider=null,this._LayoutProvider=null,this._EventHandlerProvider=null,this._NodeView=null,this._ToolbarView=null,this._PropertiesPanelView=null,this.initialRenderComplete=!1}_registerServiceTypes(){for(let t=0;t<this._ServiceRegistry.length;t++){let e=this._ServiceRegistry[t];this.fable.servicesMap.hasOwnProperty(e.ServiceType)||this.fable.addServiceType(e.ServiceType,e.Library)}}_instantiateServices(){for(let t=0;t<this._ServiceRegistry.length;t++){let e=this._ServiceRegistry[t];if(e.RegisterOnly)continue;if(this[e.Property])continue;let o=e.NoFlowView?{}:{FlowView:this};"function"==typeof e.ExtraOptions&&Object.assign(o,e.ExtraOptions()),this[e.Property]=this.fable.instantiateServiceProviderWithoutRegistration(e.ServiceType,o),e.PostInit&&"function"==typeof this[e.Property][e.PostInit]&&this[e.Property][e.PostInit]()}}get flowData(){return this._FlowData}get viewState(){return this._FlowData.ViewState}get _IsFullscreen(){return!!this._ViewportManager&&this._ViewportManager._IsFullscreen}render(t,e){return super.render(t,e,this.options)}renderAsync(t,e,o,i,n){return"function"==typeof o||void 0===o?super.renderAsync(t,e,this.options,i,o||n):super.renderAsync(t,e,o,i,n)}onBeforeInitialize(){return super.onBeforeInitialize(),this._ThemeProvider=this.fable.instantiateServiceProviderWithoutRegistration("PictProviderFlowTheme",{FlowView:this}),this._NoiseProvider=this.fable.instantiateServiceProviderWithoutRegistration("PictProviderFlowNoise"),this.options.Theme&&this._ThemeProvider.setTheme(this.options.Theme),"number"==typeof this.options.NoiseLevel&&this._ThemeProvider.setNoiseLevel(this.options.NoiseLevel),this._instantiateServices(),super.onBeforeInitialize()}onAfterRender(t,e,o,i){return this.initialRenderComplete||(this.onAfterInitialRender(),this.initialRenderComplete=!0),super.onAfterRender(t,e,o,i)}onAfterInitialRender(){let t=this.options.ViewIdentifier,e=this.pict.ContentAssignment.getElement(`#Flow-SVG-${t}`);if(e.length<1)return this.log.error(`PictSectionFlow could not find SVG element #Flow-SVG-${t}`),!1;this._SVGElement=e[0];let o=this.pict.ContentAssignment.getElement(`#Flow-Viewport-${t}`);o.length>0&&(this._ViewportElement=o[0]);let i=this.pict.ContentAssignment.getElement(`#Flow-Nodes-${t}`);i.length>0&&(this._NodesLayer=i[0]);let n=this.pict.ContentAssignment.getElement(`#Flow-Connections-${t}`);n.length>0&&(this._ConnectionsLayer=n[0]);let a=this.pict.ContentAssignment.getElement(`#Flow-Tethers-${t}`);a.length>0&&(this._TethersLayer=a[0]);let r=this.pict.ContentAssignment.getElement(`#Flow-Panels-${t}`);if(r.length>0&&(this._PanelsLayer=r[0]),this._instantiateServices(),this._ConnectorShapesProvider&&this._SVGElement){let e=this._SVGElement.querySelector("defs");if(e){let o=this._ConnectorShapesProvider.generateMarkerDefs(t),i=document.createElementNS("http://www.w3.org/2000/svg","svg");for(i.innerHTML=o;i.firstChild;)e.appendChild(i.firstChild)}}this.options.EnableToolbar&&(this._ToolbarView=this.fable.instantiateServiceProviderWithoutRegistration("PictViewFlowToolbar",Object.assign({},T.default_configuration,{ViewIdentifier:`Flow-Toolbar-${t}`,DefaultDestinationAddress:`#Flow-Toolbar-${t}`,FlowViewIdentifier:t,EnableAddNode:this.options.EnableAddNode,EnableCardPalette:this.options.EnableCardPalette})),this._ToolbarView&&"function"==typeof this._ToolbarView.render&&(this._ToolbarView._FlowView=this,this._ToolbarView.render())),this._NodeView=this.fable.instantiateServiceProviderWithoutRegistration("PictViewFlowNode",Object.assign({},C.default_configuration,{ViewIdentifier:`Flow-NodeRenderer-${t}`,AutoRender:!1})),this._NodeView._FlowView=this,this._PropertiesPanelView=this.fable.instantiateServiceProviderWithoutRegistration("PictViewFlowPropertiesPanel",Object.assign({},I.default_configuration,{ViewIdentifier:`Flow-PropertiesPanel-${t}`,AutoRender:!1})),this._PropertiesPanelView._FlowView=this,this._InteractionManager.initialize(this._SVGElement,this._ViewportElement),this.options.FlowDataAddress&&this.marshalToView(),this.renderFlow()}marshalToView(){return this._DataManager.marshalToView()}marshalFromView(){return this._DataManager.marshalFromView()}getFlowData(){return this._DataManager.getFlowData()}setFlowData(t){return this._DataManager.setFlowData(t)}addNode(t,e,o,i,n){return this._DataManager.addNode(t,e,o,i,n)}removeNode(t){return this._DataManager.removeNode(t)}addConnection(t,e,o,i,n){return this._DataManager.addConnection(t,e,o,i,n)}removeConnection(t){return this._DataManager.removeConnection(t)}selectNode(t){return this._SelectionManager.selectNode(t)}selectConnection(t){return this._SelectionManager.selectConnection(t)}deselectAll(){return this._SelectionManager.deselectAll()}deleteSelected(){return this._SelectionManager.deleteSelected()}updateViewportTransform(){return this._ViewportManager.updateViewportTransform()}setZoom(t,e,o){return this._ViewportManager.setZoom(t,e,o)}zoomToFit(){return this._ViewportManager.zoomToFit()}autoLayout(){this._LayoutService&&(this._LayoutService.autoLayout(this._FlowData.Nodes,this._FlowData.Connections),this.renderFlow(),this.marshalFromView(),this._EventHandlerProvider&&this._EventHandlerProvider.fireEvent("onFlowChanged",this._FlowData))}toggleFullscreen(){return this._ViewportManager.toggleFullscreen()}exitFullscreen(){return this._ViewportManager.exitFullscreen()}setTheme(t){if(!this._ThemeProvider)return void this.log.warn("PictSectionFlow setTheme: ThemeProvider not available");this._ThemeProvider.setTheme(t)&&(this._CSSProvider&&this._CSSProvider.registerCSS(),this._reinjectMarkerDefs(),this.initialRenderComplete&&this.renderFlow(),this._EventHandlerProvider&&this._EventHandlerProvider.fireEvent("onThemeChanged",t))}setNoiseLevel(t){this._ThemeProvider?(this._ThemeProvider.setNoiseLevel(t),this.initialRenderComplete&&this.renderFlow()):this.log.warn("PictSectionFlow setNoiseLevel: ThemeProvider not available")}getNoiseLevel(){return this._ThemeProvider?this._ThemeProvider.getNoiseLevel():0}getThemeKey(){return this._ThemeProvider?this._ThemeProvider.getActiveThemeKey():"default"}_reinjectMarkerDefs(){return this._RenderManager.reinjectMarkerDefs()}getNode(t){return this._FlowData.Nodes.find(e=>e.Hash===t)||null}getConnection(t){return this._FlowData.Connections.find(e=>e.Hash===t)||null}selectTether(t){return this._SelectionManager.selectTether(t)}updateConnectionHandle(t,e,o,i){return this._ConnectionHandleManager.updateConnectionHandle(t,e,o,i)}addConnectionHandle(t,e,o){return this._ConnectionHandleManager.addConnectionHandle(t,e,o)}removeConnectionHandle(t,e){return this._ConnectionHandleManager.removeConnectionHandle(t,e)}_resetHandlesForNode(t){return this._ConnectionHandleManager.resetHandlesForNode(t)}_resetHandlesForPanel(t){return this._ConnectionHandleManager.resetHandlesForPanel(t)}addTetherHandle(t,e,o){let i=this._FlowData.OpenPanels.find(e=>e.Hash===t);if(!i||!this._TetherService)return;let n=this.getNode(i.NodeHash);if(!n)return;let a=this._TetherService.getSmartAnchors(i,n);this._TetherService.addHandle(i,e,o,a.panelAnchor,a.nodeAnchor),this.renderFlow(),this.marshalFromView(),this._EventHandlerProvider&&this._EventHandlerProvider.fireEvent("onFlowChanged",this._FlowData)}removeTetherHandle(t,e){let o=this._FlowData.OpenPanels.find(e=>e.Hash===t);o&&this._TetherService&&(this._TetherService.removeHandle(o,e),this.renderFlow(),this.marshalFromView(),this._EventHandlerProvider&&this._EventHandlerProvider.fireEvent("onFlowChanged",this._FlowData))}updateTetherHandle(t,e,o,i){let n=this._FlowData.OpenPanels.find(e=>e.Hash===t);n&&(this._TetherService&&this._TetherService.updateHandlePosition(n,e,o,i),this._renderSingleTether(t))}getPortPosition(t,e){let o=this.getNode(t);if(!o)return null;let i=o.Ports.find(t=>t.Hash===e);if(!i)return null;let n=o.Ports.filter(t=>t.Side===i.Side),a=n.indexOf(i),r=n.length,s=this._NodeView&&this._NodeView.options.NodeTitleBarHeight||28,l=o.Height||80;if(this._GeometryProvider&&o.Ports&&o.Ports.length>0){let t=this._GeometryProvider.computeMinimumNodeHeight(o.Ports,s);t>l&&(l=t)}let c=this._GeometryProvider.buildPortCountsBySide(o.Ports),d=this._GeometryProvider.getPortLocalPosition(i.Side,a,r,o.Width,l,s,c);return{x:o.X+d.x,y:o.Y+d.y,side:i.Side||"right"}}screenToSVGCoords(t,e){return this._ViewportManager.screenToSVGCoords(t,e)}renderFlow(){return this._RenderManager.renderFlow()}_renderSingleConnection(t){return this._RenderManager.renderSingleConnection(t)}_renderSingleTether(t){return this._RenderManager.renderSingleTether(t)}updateNodePosition(t,e,o){return this._RenderManager.updateNodePosition(t,e,o)}_renderConnectionsForNode(t){return this._RenderManager.renderConnectionsForNode(t)}_renderTethersForNode(t){return this._RenderManager.renderTethersForNode(t)}openPanel(t){return this._PanelManager.openPanel(t)}closePanel(t){return this._PanelManager.closePanel(t)}closePanelForNode(t){return this._PanelManager.closePanelForNode(t)}togglePanel(t){return this._PanelManager.togglePanel(t)}updatePanelPosition(t,e,o){return this._PanelManager.updatePanelPosition(t,e,o)}},e.exports.default_configuration=R},{"../PictFlowCardPropertiesPanel.js":94,"../panels/FlowCardPropertiesPanel-Form.js":95,"../panels/FlowCardPropertiesPanel-Markdown.js":96,"../panels/FlowCardPropertiesPanel-Template.js":97,"../panels/FlowCardPropertiesPanel-View.js":98,"../providers/PictProvider-Flow-CSS.js":99,"../providers/PictProvider-Flow-ConnectorShapes.js":100,"../providers/PictProvider-Flow-EventHandler.js":101,"../providers/PictProvider-Flow-Geometry.js":102,"../providers/PictProvider-Flow-Icons.js":103,"../providers/PictProvider-Flow-Layouts.js":104,"../providers/PictProvider-Flow-NodeTypes.js":105,"../providers/PictProvider-Flow-Noise.js":106,"../providers/PictProvider-Flow-PanelChrome.js":107,"../providers/PictProvider-Flow-SVGHelpers.js":108,"../providers/PictProvider-Flow-Theme.js":109,"../services/PictService-Flow-ConnectionHandleManager.js":110,"../services/PictService-Flow-ConnectionRenderer.js":111,"../services/PictService-Flow-DataManager.js":112,"../services/PictService-Flow-InteractionManager.js":113,"../services/PictService-Flow-Layout.js":114,"../services/PictService-Flow-PanelManager.js":115,"../services/PictService-Flow-PathGenerator.js":116,"../services/PictService-Flow-PortRenderer.js":117,"../services/PictService-Flow-RenderManager.js":118,"../services/PictService-Flow-SelectionManager.js":119,"../services/PictService-Flow-Tether.js":120,"../services/PictService-Flow-ViewportManager.js":121,"./PictView-Flow-FloatingToolbar.js":122,"./PictView-Flow-Node.js":123,"./PictView-Flow-PropertiesPanel.js":124,"./PictView-Flow-Toolbar.js":125,"pict-view":128}],127:[function(t,e,o){arguments[4][40][0].apply(o,arguments)},{dup:40}],128:[function(t,e,o){arguments[4][41][0].apply(o,arguments)},{"../package.json":127,dup:41,"fable-serviceproviderbase":89}],129:[function(t,e,o){const i=t("./views/PictView-MeadowMappingEditor.js"),n=t("./views/MappingEditor-SchemaUtils.js"),a=t("./views/flow-cards/FlowCard-MappingSource.js"),r=t("./views/flow-cards/FlowCard-MappingTarget.js"),s=t("./views/flow-cards/FlowCard-TemplateExpression.js"),l=t("./views/flow-cards/FlowCard-SolverExpression.js");e.exports={MeadowMappingEditorView:i,MappingEditorSchemaUtils:n,FlowCardMappingSource:a,FlowCardMappingTarget:r,FlowCardTemplateExpression:s,FlowCardSolverExpression:l}},{"./views/MappingEditor-SchemaUtils.js":130,"./views/PictView-MeadowMappingEditor.js":131,"./views/flow-cards/FlowCard-MappingSource.js":132,"./views/flow-cards/FlowCard-MappingTarget.js":133,"./views/flow-cards/FlowCard-SolverExpression.js":134,"./views/flow-cards/FlowCard-TemplateExpression.js":135}],130:[function(t,e,o){arguments[4][67][0].apply(o,arguments)},{dup:67}],131:[function(t,e,o){const i=t("pict-view"),n=t("./MappingEditor-SchemaUtils.js"),a={ViewIdentifier:"MeadowMappingEditor",DefaultRenderable:"MeadowMappingEditor-Content",DefaultDestinationAddress:"#MeadowMap-Editor-Container",AutoRender:!1,CSS:"\n\t\t/* Meadow Mapping Editor */\n\t\t.meadow-mapping-editor {\n\t\t\tdisplay: none;\n\t\t}\n\t\t.meadow-mapping-editor.active {\n\t\t\tdisplay: block;\n\t\t}\n\t\t.meadow-mapping-header {\n\t\t\tdisplay: flex;\n\t\t\talign-items: center;\n\t\t\tgap: 1em;\n\t\t\tmargin-bottom: 1em;\n\t\t}\n\t\t.meadow-mapping-header h3 {\n\t\t\tmargin: 0;\n\t\t\tflex: 1;\n\t\t}\n\t\t.meadow-mapping-list-table {\n\t\t\twidth: 100%;\n\t\t\tborder-collapse: collapse;\n\t\t\tmargin-bottom: 1em;\n\t\t}\n\t\t.meadow-mapping-list-table th {\n\t\t\ttext-align: left;\n\t\t\tfont-size: 0.72em;\n\t\t\tfont-weight: 600;\n\t\t\ttext-transform: uppercase;\n\t\t\tletter-spacing: 0.5px;\n\t\t\tcolor: var(--facto-text-tertiary, #a09070);\n\t\t\tpadding: 0.5em 0.4em;\n\t\t\tborder-bottom: 1px solid var(--facto-border, #d6c8ae);\n\t\t}\n\t\t.meadow-mapping-list-table td {\n\t\t\tpadding: 0.35em 0.4em;\n\t\t\tborder-bottom: 1px solid var(--facto-border-subtle, #e8ddc8);\n\t\t\tvertical-align: middle;\n\t\t}\n\t\t.meadow-flow-container {\n\t\t\twidth: 100%;\n\t\t\theight: 500px;\n\t\t\tborder: 1px solid var(--facto-border, #d6c8ae);\n\t\t\tborder-radius: 6px;\n\t\t\tbackground: var(--facto-bg-surface, #fcf8f0);\n\t\t\tmargin-bottom: 0.75em;\n\t\t}\n\t\t.meadow-mapping-json-editor {\n\t\t\twidth: 100%;\n\t\t\tmin-height: 300px;\n\t\t\tfont-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;\n\t\t\tfont-size: 0.85em;\n\t\t\tpadding: 0.75em;\n\t\t\tborder: 1px solid var(--facto-border, #d6c8ae);\n\t\t\tborder-radius: 6px;\n\t\t\tbackground: var(--facto-bg-input, #fcf8f0);\n\t\t\tcolor: var(--facto-text, #3a3020);\n\t\t\tresize: vertical;\n\t\t\ttab-size: 4;\n\t\t}\n\t\t.meadow-mapping-store-checklist {\n\t\t\tdisplay: flex;\n\t\t\tflex-wrap: wrap;\n\t\t\tgap: 0.5em;\n\t\t\tmargin-top: 0.25em;\n\t\t}\n\t\t.meadow-mapping-store-checklist label {\n\t\t\tdisplay: flex;\n\t\t\talign-items: center;\n\t\t\tgap: 0.35em;\n\t\t\tfont-size: 0.82em;\n\t\t\tcursor: pointer;\n\t\t\tpadding: 0.3em 0.5em;\n\t\t\tborder: 1px solid var(--facto-border-subtle, #e8ddc8);\n\t\t\tborder-radius: 4px;\n\t\t\tbackground: var(--facto-bg-input, #fcf8f0);\n\t\t}\n\t\t.meadow-mapping-store-checklist label:has(input:checked) {\n\t\t\tborder-color: var(--facto-brand, #18a5a0);\n\t\t\tbackground: var(--facto-brand-a12, rgba(24,165,160,0.12));\n\t\t}\n\t\t.meadow-mapping-btn {\n\t\t\tdisplay: inline-flex;\n\t\t\talign-items: center;\n\t\t\tjustify-content: center;\n\t\t\tpadding: 0.35em 0.9em;\n\t\t\tfont-size: 0.82em;\n\t\t\tfont-weight: 500;\n\t\t\tborder-radius: 4px;\n\t\t\tborder: 1px solid transparent;\n\t\t\tcursor: pointer;\n\t\t\ttext-decoration: none;\n\t\t\tline-height: 1.4;\n\t\t}\n\t\t.meadow-mapping-btn-primary {\n\t\t\tbackground: var(--facto-brand, #18a5a0);\n\t\t\tcolor: #fff;\n\t\t\tborder-color: var(--facto-brand, #18a5a0);\n\t\t}\n\t\t.meadow-mapping-btn-primary:hover {\n\t\t\topacity: 0.88;\n\t\t}\n\t\t.meadow-mapping-btn-secondary {\n\t\t\tbackground: var(--facto-bg-input, #fcf8f0);\n\t\t\tcolor: var(--facto-text, #3a3020);\n\t\t\tborder-color: var(--facto-border, #d6c8ae);\n\t\t}\n\t\t.meadow-mapping-btn-secondary:hover {\n\t\t\tbackground: var(--facto-border-subtle, #e8ddc8);\n\t\t}\n\t\t.meadow-mapping-btn-danger {\n\t\t\tbackground: #e74c3c;\n\t\t\tcolor: #fff;\n\t\t\tborder-color: #e74c3c;\n\t\t}\n\t\t.meadow-mapping-btn-danger:hover {\n\t\t\topacity: 0.88;\n\t\t}\n\t\t.meadow-mapping-btn-small {\n\t\t\tpadding: 0.2em 0.6em;\n\t\t\tfont-size: 0.78em;\n\t\t}\n\t\t.meadow-schema-mode-tabs {\n\t\t\tdisplay: flex;\n\t\t\tgap: 0.25em;\n\t\t}\n\t\t.meadow-schema-mode-tab {\n\t\t\tpadding: 0.25em 0.75em;\n\t\t\tfont-size: 0.8em;\n\t\t\tborder: 1px solid var(--facto-border, #d6c8ae);\n\t\t\tborder-radius: 4px;\n\t\t\tcursor: pointer;\n\t\t\tbackground: var(--facto-bg-input, #fcf8f0);\n\t\t\tcolor: var(--facto-text, #3a3020);\n\t\t}\n\t\t.meadow-schema-mode-tab.active {\n\t\t\tbackground: var(--facto-brand, #18a5a0);\n\t\t\tcolor: #fff;\n\t\t\tborder-color: var(--facto-brand, #18a5a0);\n\t\t}\n\t\t.meadow-section-title {\n\t\t\tfont-size: 0.72em;\n\t\t\tfont-weight: 600;\n\t\t\ttext-transform: uppercase;\n\t\t\tletter-spacing: 0.5px;\n\t\t\tcolor: var(--facto-text-tertiary, #a09070);\n\t\t}\n\t",Templates:[{Hash:"MeadowMappingEditor-Template",Template:'\n<div>\n\t<div id="MeadowMap-Editor" class="meadow-mapping-editor">\n\t\t<div class="meadow-mapping-header">\n\t\t\t<button class="meadow-mapping-btn meadow-mapping-btn-secondary meadow-mapping-btn-small" onclick="{~P~}.views[\'MeadowMappingEditor\'].closeMappingEditor()">← Back</button>\n\t\t\t<h3 id="MeadowMap-Title">Mapping Editor</h3>\n\t\t\t<div class="meadow-schema-mode-tabs">\n\t\t\t\t<button class="meadow-schema-mode-tab active" id="MeadowMap-Mode-Flow" onclick="{~P~}.views[\'MeadowMappingEditor\'].switchMapMode(\'flow\')">Visual Mapper</button>\n\t\t\t\t<button class="meadow-schema-mode-tab" id="MeadowMap-Mode-JSON" onclick="{~P~}.views[\'MeadowMappingEditor\'].switchMapMode(\'json\')">JSON Config</button>\n\t\t\t</div>\n\t\t</div>\n\n\t\t<div id="MeadowMap-List-Wrap">\n\t\t\t<div style="display:flex; align-items:center; justify-content:space-between; margin-bottom:0.75em;">\n\t\t\t\t<div class="meadow-section-title" style="margin:0;">Existing Mappings</div>\n\t\t\t\t<button class="meadow-mapping-btn meadow-mapping-btn-primary meadow-mapping-btn-small" onclick="{~P~}.views[\'MeadowMappingEditor\'].newMapping()">+ New Mapping</button>\n\t\t\t</div>\n\t\t\t<div id="MeadowMap-List"></div>\n\t\t</div>\n\n\t\t<div id="MeadowMap-Detail" style="display:none;">\n\t\t\t<div style="display:flex; gap:0.5em; align-items:center; margin-bottom:0.75em;">\n\t\t\t\t<label style="font-size:0.78em; font-weight:600;">Mapping Name</label>\n\t\t\t\t<input type="text" id="MeadowMap-Name" placeholder="Mapping name" style="flex:1; padding:0.3em 0.5em; font-size:0.85em; border:1px solid var(--facto-border); border-radius:4px; background:var(--facto-bg-input); color:var(--facto-text);">\n\t\t\t</div>\n\n\t\t\t<div style="display:flex; gap:0.5em; align-items:center; margin-bottom:0.75em;">\n\t\t\t\t<label style="font-size:0.78em; font-weight:600;">Source</label>\n\t\t\t\t<select id="MeadowMap-Source" style="flex:1; padding:0.3em 0.5em; font-size:0.85em; border:1px solid var(--facto-border); border-radius:4px;"></select>\n\t\t\t\t<button class="meadow-mapping-btn meadow-mapping-btn-secondary meadow-mapping-btn-small" onclick="{~P~}.views[\'MeadowMappingEditor\'].discoverSourceFields()">Discover Fields</button>\n\t\t\t</div>\n\n\t\t\t<div id="MeadowMap-Flow-Wrap">\n\t\t\t\t<div id="MeadowMap-Flow-Container" class="meadow-flow-container"></div>\n\t\t\t</div>\n\n\t\t\t<div id="MeadowMap-JSON-Wrap" style="display:none;">\n\t\t\t\t<textarea class="meadow-mapping-json-editor" id="MeadowMap-JSON" placeholder=\'{"Entity":"MyTable","GUIDTemplate":"{~D:Record.IDRecord~}","Mappings":{},"Solvers":[],"ManyfestAddresses":false}\'></textarea>\n\t\t\t</div>\n\n\t\t\t<div style="margin-top:0.75em;">\n\t\t\t\t<div style="font-size:0.72em; font-weight:600; text-transform:uppercase; letter-spacing:0.5px; color:var(--facto-text-tertiary); margin-bottom:0.35em;">Target Stores</div>\n\t\t\t\t<div id="MeadowMap-Stores" class="meadow-mapping-store-checklist"></div>\n\t\t\t</div>\n\n\t\t\t<div style="margin-top:0.75em; display:flex; gap:0.5em; flex-wrap:wrap; align-items:center;">\n\t\t\t\t<button class="meadow-mapping-btn meadow-mapping-btn-primary" onclick="{~P~}.views[\'MeadowMappingEditor\'].saveMapping()">Save Mapping</button>\n\t\t\t</div>\n\t\t</div>\n\t</div>\n</div>\n'}],Renderables:[{RenderableHash:"MeadowMappingEditor-Content",TemplateHash:"MeadowMappingEditor-Template",DestinationAddress:"#MeadowMap-Editor-Container",RenderMethod:"replace"}]};e.exports=class extends i{constructor(t,e,o){super(t,e,o),this._EditingContextID=0,this._EditingName="",this._CurrentMappings=[],this._SelectedMappingID=0,this._DiscoveredFields={},this._FlowView=null,this._MapEditorMode="flow",this._MappingSources=[],this._MappingStores=[],this._CurrentTargetSchema=null}_doLoadMappings(t){return Promise.resolve({Mappings:[]})}_doLoadSources(){return Promise.resolve([])}_doLoadStores(t){return Promise.resolve({Stores:[]})}_doLoadTargetSchema(t){return Promise.resolve({SchemaDefinition:""})}_doLoadMapping(t){return Promise.resolve({Mapping:null})}_doDeleteMapping(t){return Promise.resolve({})}_doDiscoverSourceFields(t,e,o){return Promise.resolve({Headers:[],SampleSize:0})}_doCreateMapping(t,e){return Promise.resolve({Mapping:{}})}_doUpdateMapping(t,e){return Promise.resolve({Mapping:{}})}_onClose(){}_doToast(t,e){let o=this.pict.views&&this.pict.views["Pict-Section-Modal"];o&&"function"==typeof o.toast?o.toast(t,e):this.log.info("[MeadowMappingEditor] "+t)}_doConfirm(t,e){let o=this.pict.views&&this.pict.views["Pict-Section-Modal"];return o&&"function"==typeof o.confirm?o.confirm(t,e):Promise.resolve("undefined"!=typeof window&&window.confirm(t))}editMappings(t,e){this._EditingContextID=t,this._EditingName=e||"",this.render();let o=document.getElementById("MeadowMap-Editor"),i=document.getElementById("MeadowMap-Title");o&&(o.classList.add("active"),o.scrollIntoView({behavior:"smooth",block:"nearest"})),i&&(i.textContent="Mappings: "+(e||"Untitled"));let n=document.getElementById("MeadowMap-List-Wrap"),a=document.getElementById("MeadowMap-Detail");n&&(n.style.display=""),a&&(a.style.display="none"),Promise.all([this._doLoadMappings(t),this._doLoadSources(),this._doLoadStores(t),this._doLoadTargetSchema(t)]).then(t=>{this._CurrentMappings=t[0]&&t[0].Mappings?t[0].Mappings:[],this._MappingSources=Array.isArray(t[1])?t[1]:[],this._MappingStores=t[2]&&t[2].Stores?t[2].Stores:[];for(let t=0;t<this._MappingSources.length;t++){let e=this._MappingSources[t];Array.isArray(e.Columns)&&e.Columns.length>0&&(this._DiscoveredFields[e.IDSource]=e.Columns)}let e=t[3];e&&e.SchemaDefinition&&(this._CurrentTargetSchema=e.SchemaDefinition),this.refreshMappingList()})}closeMappingEditor(){this._FlowView&&(this._FlowView=null),this._SelectedMappingID=0,this._onClose()}refreshMappingList(){let t=document.getElementById("MeadowMap-List");if(!t)return;if(0===this._CurrentMappings.length)return void(t.innerHTML='<div style="text-align:center; padding:1.5em; color:var(--facto-text-tertiary, #a09070);">No mappings yet. Create one to map source fields to target columns.</div>');let e=this.options.ViewIdentifier,o='<table class="meadow-mapping-list-table"><thead><tr>';o+="<th>ID</th><th>Name</th><th>Source</th><th>Active</th><th>Actions</th>",o+="</tr></thead><tbody>";for(let t=0;t<this._CurrentMappings.length;t++){let i=this._CurrentMappings[t],n="—";for(let t=0;t<this._MappingSources.length;t++)if(this._MappingSources[t].IDSource===i.IDSource){n=this._MappingSources[t].Name||"Source "+i.IDSource;break}o+="<tr>",o+="<td>"+i.IDProjectionMapping+"</td>",o+="<td><strong>"+(i.Name||"—")+"</strong></td>",o+="<td>"+n+"</td>",o+="<td>"+(i.Active?"✓":"✗")+"</td>",o+="<td>",o+='<button class="meadow-mapping-btn meadow-mapping-btn-primary meadow-mapping-btn-small" onclick="window._Pict.views[\''+e+"'].openMappingDetail("+i.IDProjectionMapping+')">Edit</button> ',o+='<button class="meadow-mapping-btn meadow-mapping-btn-danger meadow-mapping-btn-small" onclick="window._Pict.views[\''+e+"'].deleteMapping("+i.IDProjectionMapping+')">Delete</button>',o+="</td>",o+="</tr>"}o+="</tbody></table>",t.innerHTML=o}newMapping(){this._SelectedMappingID=0;let t=document.getElementById("MeadowMap-List-Wrap"),e=document.getElementById("MeadowMap-Detail");t&&(t.style.display="none"),e&&(e.style.display="");let o=document.getElementById("MeadowMap-Name");o&&(o.value="");let i=this._MappingSources.length>0?this._MappingSources[0].IDSource:void 0;this._populateSourceDropdown(i),this._populateStoreChecklist();let n=document.getElementById("MeadowMap-JSON");if(n){let t=(this._EditingName||"Record").replace(/[^a-zA-Z0-9_]/g,""),e="GUID"+t,o="ID"+t,i={};i[e]="{~D:Record.IDRecord~}",i[o]="{~D:Record.IDRecord~}",n.value=JSON.stringify({Entity:t,GUIDTemplate:"{~D:Record.IDRecord~}",GUIDName:e,Mappings:i,Solvers:[],ManyfestAddresses:!1},null,"\t")}let a=document.getElementById("MeadowMap-Flow-Container");a&&(a.innerHTML=""),this._FlowView=null,this.switchMapMode("flow"),this.initFlowView(),this._doLoadTargetSchema(this._EditingContextID).then(t=>{t&&t.SchemaDefinition&&(this._CurrentTargetSchema=t.SchemaDefinition),this._rebuildFlowNodes()})}openMappingDetail(t){this._SelectedMappingID=t,this._doLoadMapping(t).then(t=>{if(!t||!t.Mapping)return void this._doToast("Mapping not found.","error");let e=t.Mapping,o=document.getElementById("MeadowMap-List-Wrap"),i=document.getElementById("MeadowMap-Detail");o&&(o.style.display="none"),i&&(i.style.display="");let n=document.getElementById("MeadowMap-Name");n&&(n.value=e.Name||""),this._populateSourceDropdown(e.IDSource);let a=null;try{let t=JSON.parse(e.MappingConfiguration||"{}");Array.isArray(t.TargetStores)&&t.TargetStores.length>0&&(a=t.TargetStores)}catch(t){}!a&&e.IDProjectionStore&&(a=[e.IDProjectionStore]),this._populateStoreChecklist(a);let r={};try{r=JSON.parse(e.MappingConfiguration||"{}")}catch(t){}Array.isArray(r.sourceColumns)&&r.sourceColumns.length>0&&(this._DiscoveredFields[e.IDSource]=r.sourceColumns);let s=document.getElementById("MeadowMap-JSON");s&&(s.value=JSON.stringify(r,null,"\t"));let l=document.getElementById("MeadowMap-Flow-Container");l&&(l.innerHTML=""),this._FlowView=null,this.switchMapMode("flow"),this.initFlowView(),this._doLoadTargetSchema(this._EditingContextID).then(t=>{if(t&&t.SchemaDefinition&&(this._CurrentTargetSchema=t.SchemaDefinition),this._FlowView){let t=null;try{t=JSON.parse(e.FlowDiagramState||"null")}catch(t){}t&&t.Nodes&&t.Nodes.length>0&&"function"==typeof this._FlowView.setFlowData&&this._FlowView.setFlowData(t)}this._rebuildFlowNodes()})})}async deleteMapping(t){await this._doConfirm("Delete this mapping?",{title:"Delete Mapping",confirmLabel:"Delete",dangerous:!0})&&this._doDeleteMapping(t).then(()=>{this._doLoadMappings(this._EditingContextID).then(t=>{this._CurrentMappings=t&&t.Mappings?t.Mappings:[],this.refreshMappingList()})})}switchMapMode(t){this._MapEditorMode=t;let e=document.getElementById("MeadowMap-Flow-Wrap"),o=document.getElementById("MeadowMap-JSON-Wrap"),i=document.getElementById("MeadowMap-Mode-Flow"),n=document.getElementById("MeadowMap-Mode-JSON");if("flow"===t)e&&(e.style.display=""),o&&(o.style.display="none"),i&&i.classList.add("active"),n&&n.classList.remove("active");else if(e&&(e.style.display="none"),o&&(o.style.display=""),i&&i.classList.remove("active"),n&&n.classList.add("active"),this._FlowView&&"function"==typeof this._FlowView.getFlowData){let t=this.flowToMappingConfig(),e=document.getElementById("MeadowMap-JSON");e&&(e.value=JSON.stringify(t,null,"\t"))}}_populateSourceDropdown(t){let e=document.getElementById("MeadowMap-Source");if(!e)return;let o='<option value="0">Select a source...</option>';for(let e=0;e<this._MappingSources.length;e++){let i=this._MappingSources[e],n=i.IDSource===t?" selected":"";o+='<option value="'+i.IDSource+'"'+n+">"+(i.Name||"Source "+i.IDSource)+"</option>"}e.innerHTML=o}_populateStoreChecklist(t){let e=document.getElementById("MeadowMap-Stores");if(!e)return;let o={};if(Array.isArray(t))for(let e=0;e<t.length;e++)o[t[e]]=!0;else t&&(o[t]=!0);if(0===this._MappingStores.length)return void(e.innerHTML='<div style="font-size:0.82em; color:var(--facto-text-tertiary, #a09070);">No stores configured yet.</div>');let i="";for(let t=0;t<this._MappingStores.length;t++){let e=this._MappingStores[t],n=o[e.IDProjectionStore]?" checked":"",a=(e.TargetTableName||"Store "+e.IDProjectionStore)+" ("+(e.Status||"Unknown")+")";i+="<label>",i+='<input type="checkbox" value="'+e.IDProjectionStore+'"'+n+">",i+=" "+a,i+="</label>"}e.innerHTML=i}_getCheckedStoreIDs(){let t=document.getElementById("MeadowMap-Stores");if(!t)return[];let e=t.querySelectorAll('input[type="checkbox"]:checked'),o=[];for(let t=0;t<e.length;t++)o.push(parseInt(e[t].value,10));return o}discoverSourceFields(){let t=document.getElementById("MeadowMap-Source"),e=t?parseInt(t.value,10):0;e?this._doDiscoverSourceFields(this._EditingContextID,e,50).then(t=>{if(t&&t.Error)return void this._doToast("Error: "+t.Error,{type:"error"});let o=t&&t.Headers?t.Headers:[];this._DiscoveredFields[e]=o,this._doToast("Discovered "+o.length+" fields from "+(t.SampleSize||0)+" records: "+o.join(", "),{type:"success",duration:6e3}),this._rebuildFlowNodes()}):this._doToast("Select a source first.",{type:"warning"})}_rebuildFlowNodes(){let t=document.getElementById("MeadowMap-Source"),e=t?parseInt(t.value,10):0,o=this._DiscoveredFields[e]||[],i=this._getSchemaColumns();if(this.initFlowView(),!this._FlowView)return;let n="Source: "+(t&&t.selectedIndex>=0?t.options[t.selectedIndex].text:"Source"),a="Target: "+(this._EditingName||"Target"),r=[{Hash:"src-whole-record",Direction:"output",Side:"right",Label:"Whole Record"}];for(let t=0;t<o.length;t++)r.push({Hash:"src-field-"+o[t].replace(/[^a-zA-Z0-9_-]/g,"_"),Direction:"output",Side:"right",Label:o[t]});let s=(this._EditingName||"Record").replace(/[^a-zA-Z0-9_]/g,""),l="GUID"+s,c="ID"+s,d=[{Hash:"tgt-col-"+l,Direction:"input",Side:"left",Label:l},{Hash:"tgt-col-"+c,Direction:"input",Side:"left",Label:c}];for(let t=0;t<i.length;t++)i[t]!==l&&i[t]!==c&&d.push({Hash:"tgt-col-"+i[t].replace(/[^a-zA-Z0-9_-]/g,"_"),Direction:"input",Side:"left",Label:i[t]});let p=this._FlowView.getFlowData(),h=null,u=null;for(let t=0;t<p.Nodes.length;t++)"SRC"===p.Nodes[t].Type&&(h=p.Nodes[t]),"TGT"===p.Nodes[t].Type&&(u=p.Nodes[t]);if(h){let t=r.slice(),e={};for(let o=0;o<t.length;o++)e[t[o].Hash]=!0;let o=h.Ports||[];for(let i=0;i<o.length;i++)e[o[i].Hash]||t.push(o[i]);let i=this._FlowView._FlowData.Nodes;for(let e=0;e<i.length;e++)if(i[e].Hash===h.Hash){i[e].Ports=t,i[e].Title=n;break}}else this._FlowView._FlowData.Nodes.push({Hash:"node-src-"+this.fable.getUUID(),Type:"SRC",X:50,Y:50,Width:200,Height:100,Title:n,Ports:r,Data:{}});if(u){let t=d.slice(),e={};for(let o=0;o<t.length;o++)e[t[o].Hash]=!0;let o=u.Ports||[];for(let i=0;i<o.length;i++)e[o[i].Hash]||t.push(o[i]);let i=this._FlowView._FlowData.Nodes;for(let e=0;e<i.length;e++)if(i[e].Hash===u.Hash){i[e].Ports=t,i[e].Title=a;break}}else this._FlowView._FlowData.Nodes.push({Hash:"node-tgt-"+this.fable.getUUID(),Type:"TGT",X:550,Y:50,Width:200,Height:100,Title:a,Ports:d,Data:{}});"function"==typeof this._FlowView.renderFlow?this._FlowView.renderFlow():"function"==typeof this._FlowView.render&&this._FlowView.render()}_getSchemaColumns(){let t=[],e=this._CurrentTargetSchema||"";if(e){let o=n.microDDLToColumns(e);for(let e=0;e<o.length;e++)t.push(o[e].Name)}return t}initFlowView(){if(this._FlowView)return;let e=document.getElementById("MeadowMap-Flow-Container");if(e)try{let e=t("pict-section-flow");this._FlowView=this.pict.addView("MeadowMapping-Flow",{ViewIdentifier:"MeadowMapping-Flow",DefaultDestinationAddress:"#MeadowMap-Flow-Container",EnableToolbar:!0,EnablePanning:!0,EnableZooming:!0,EnableNodeDragging:!0,EnableConnectionCreation:!0},e);let o=t("./flow-cards/FlowCard-MappingSource.js"),i=t("./flow-cards/FlowCard-MappingTarget.js"),n=t("./flow-cards/FlowCard-TemplateExpression.js"),a=t("./flow-cards/FlowCard-SolverExpression.js");this.pict.addServiceType("FlowCardMappingSource",o),this.pict.addServiceType("FlowCardMappingTarget",i),this.pict.addServiceType("FlowCardTemplateExpression",n),this.pict.addServiceType("FlowCardSolverExpression",a),"function"==typeof this._FlowView.render&&this._FlowView.render();let r=this.pict.instantiateServiceProviderWithoutRegistration("FlowCardMappingSource",{}),s=this.pict.instantiateServiceProviderWithoutRegistration("FlowCardMappingTarget",{}),l=this.pict.instantiateServiceProviderWithoutRegistration("FlowCardTemplateExpression",{}),c=this.pict.instantiateServiceProviderWithoutRegistration("FlowCardSolverExpression",{});r.registerWithFlowView(this._FlowView),s.registerWithFlowView(this._FlowView),l.registerWithFlowView(this._FlowView),c.registerWithFlowView(this._FlowView)}catch(t){this.log.error("Failed to initialize flow view: "+t.message),e.innerHTML='<div style="padding:2em; text-align:center; color:var(--facto-text-tertiary, #a09070);">Flow editor could not be loaded. Use JSON Config mode instead.</div>'}}flowToMappingConfig(){let t=(this._EditingName||"Record").replace(/[^a-zA-Z0-9_]/g,""),e="GUID"+t,o="ID"+t,i={Entity:t,GUIDTemplate:"{~D:Record.IDRecord~}",GUIDName:e,Mappings:{},Solvers:[],ManyfestAddresses:!1};if(!this._FlowView||"function"!=typeof this._FlowView.getFlowData)return i;let n=this._FlowView.getFlowData();if(!n||!n.Connections)return i;let a={},r={};if(n.Nodes)for(let t=0;t<n.Nodes.length;t++){let e=n.Nodes[t];if(a[e.Hash]=e,e.Ports)for(let t=0;t<e.Ports.length;t++)r[e.Ports[t].Hash]={Label:e.Ports[t].Label,NodeHash:e.Hash,NodeType:e.Type}}let s={};for(let t=0;t<n.Connections.length;t++){let o=n.Connections[t],l=r[o.SourcePortHash],c=r[o.TargetPortHash];if(!l||!c)continue;if("TGT"!==c.NodeType)continue;let d=c.Label;if(!d)continue;let p=a[l.NodeHash];if(p)if("SRC"===p.Type){let t=l.Label;if("Whole Record"===t)continue;let n=o.Data&&o.Data.Template?o.Data.Template:"{~D:Record."+t+"~}";d===e&&(i.GUIDTemplate=n),i.Mappings[d]=n}else if("TPL"===p.Type){let t=p.Data&&p.Data.TemplateExpression?p.Data.TemplateExpression:"";t&&(d===e&&(i.GUIDTemplate=t),i.Mappings[d]=t)}else if("SOL"===p.Type){let t=p.Data&&p.Data.SolverExpression?p.Data.SolverExpression:"";t&&(s[p.Hash]||(s[p.Hash]={expression:t,outputs:{}}),s[p.Hash].outputs[d]=!0)}}i.Mappings.hasOwnProperty(e)||(i.Mappings[e]=i.GUIDTemplate),i.Mappings.hasOwnProperty(o)||(i.Mappings[o]="{~D:Record.IDRecord~}");let l=Object.keys(s);for(let t=0;t<l.length;t++)i.Solvers.push(s[l[t]]);return i}saveMapping(){let t,e=document.getElementById("MeadowMap-Name"),o=document.getElementById("MeadowMap-Source"),i=e?e.value.trim():"",n=o?parseInt(o.value,10):0,a=this._getCheckedStoreIDs(),r=a.length>0?a[0]:0;if(!i)return void this._doToast("Enter a mapping name.",{type:"warning"});if("json"===this._MapEditorMode){let e=document.getElementById("MeadowMap-JSON"),o=e?e.value:"{}";try{t=JSON.parse(o)}catch(t){return void this._doToast("Invalid JSON: "+t.message,{type:"error"})}}else t=this.flowToMappingConfig();t.TargetStores=a;let s=this._DiscoveredFields[n];Array.isArray(s)&&s.length>0&&(t.sourceColumns=s);let l={};this._FlowView&&"function"==typeof this._FlowView.getFlowData&&(l=this._FlowView.getFlowData());let c,d={Name:i,IDSource:n,IDProjectionStore:r,MappingConfiguration:JSON.stringify(t),FlowDiagramState:JSON.stringify(l),Active:1};c=this._SelectedMappingID?this._doUpdateMapping(this._SelectedMappingID,d):this._doCreateMapping(this._EditingContextID,d),c.then(t=>{t&&t.Error?this._doToast("Error: "+t.Error,{type:"error"}):(t&&t.Mapping&&t.Mapping.IDProjectionMapping&&(this._SelectedMappingID=t.Mapping.IDProjectionMapping),this._doToast("Mapping saved.",{type:"success"}),this._doLoadMappings(this._EditingContextID).then(t=>{this._CurrentMappings=t&&t.Mappings?t.Mappings:[]}))})}},e.exports.default_configuration=a},{"./MappingEditor-SchemaUtils.js":130,"./flow-cards/FlowCard-MappingSource.js":132,"./flow-cards/FlowCard-MappingTarget.js":133,"./flow-cards/FlowCard-SolverExpression.js":134,"./flow-cards/FlowCard-TemplateExpression.js":135,"pict-section-flow":92,"pict-view":128}],132:[function(t,e,o){const i=t("pict-section-flow").PictFlowCard;e.exports=class extends i{constructor(t,e,o){super(t,Object.assign({},{Title:"Mapping Source",Name:"Mapping Source",Code:"SRC",Category:"Data Source",Description:"Source dataset with discovered record fields",TitleBarColor:"#2980b9",Width:200,Height:100,Inputs:[],Outputs:[{Name:"Whole Record",Side:"right"}],ShowTypeLabel:!0,PortLabelsOnHover:!1,PortLabelsOutside:!0},e),o),this.serviceType="FlowCardMappingSource"}},e.exports.default_configuration={Title:"Mapping Source",Code:"SRC",Category:"Data Source",TitleBarColor:"#2980b9",Width:200,Height:100}},{"pict-section-flow":92}],133:[function(t,e,o){const i=t("pict-section-flow").PictFlowCard;e.exports=class extends i{constructor(t,e,o){super(t,Object.assign({},{Title:"Mapping Target",Name:"Mapping Target",Code:"TGT",Category:"Data Target",Description:"Mapping target table with schema columns",TitleBarColor:"#27ae60",Width:200,Height:100,Inputs:[],Outputs:[],ShowTypeLabel:!0,PortLabelsOnHover:!1,PortLabelsOutside:!0},e),o),this.serviceType="FlowCardMappingTarget"}},e.exports.default_configuration={Title:"Mapping Target",Code:"TGT",Category:"Data Target",TitleBarColor:"#27ae60",Width:200,Height:100}},{"pict-section-flow":92}],134:[function(t,e,o){const i=t("pict-section-flow").PictFlowCard;e.exports=class extends i{constructor(t,e,o){super(t,Object.assign({},{Title:"Solver Expression",Name:"Solver Expression",Code:"SOL",Category:"Transform",Description:"Apply a Fable solver expression for conditional logic and computed values",TitleBarColor:"#d35400",Width:220,Height:90,Inputs:[{Name:"Whole Record",Side:"left"}],Outputs:[{Name:"Result",Side:"right"}],ShowTypeLabel:!0,PortLabelsOnHover:!1,PortLabelsOutside:!0,LabelsInFront:!0,Enabled:!0,BodyContent:{ContentType:"html",Template:'<div style="font-size:10px; padding:2px 4px; color:#ccc; overflow:hidden; white-space:nowrap; text-overflow:ellipsis; max-width:200px;">{~D:Record.Data.SolverExpression~}</div>'},PropertiesPanel:{PanelType:"Template",DefaultWidth:420,DefaultHeight:160,Title:"Solver Expression",Configuration:{Template:"<div style=\"padding:8px;\"><label style=\"display:block; margin-bottom:4px; font-weight:bold; font-size:12px;\">Solver Expression</label><textarea id=\"FlowCard-SOL-{~D:Record.Hash~}\" style=\"width:100%; height:80px; font-family:monospace; font-size:12px; resize:vertical; background:#1a1a2e; color:#e0e0e0; border:1px solid #444; border-radius:4px; padding:6px;\" onchange=\"(function(el){var n=pict.views['MeadowMapping-Flow'];if(n&&n._FlowData){for(var i=0;i<n._FlowData.Nodes.length;i++){if(n._FlowData.Nodes[i].Hash==='{~D:Record.Hash~}'){n._FlowData.Nodes[i].Data.SolverExpression=el.value;if(typeof n.renderFlow==='function')n.renderFlow();break;}}}})(this)\">{~D:Record.Data.SolverExpression~}</textarea><div style=\"font-size:10px; color:#888; margin-top:4px;\">Example: IF(IncomingRecord.Type == 'Premium', 'GOLD', 'SILVER')</div></div>"}}},e),o),this.serviceType="FlowCardSolverExpression"}},e.exports.default_configuration={Title:"Solver Expression",Code:"SOL",Category:"Transform",TitleBarColor:"#d35400",Width:220,Height:90}},{"pict-section-flow":92}],135:[function(t,e,o){const i=t("pict-section-flow").PictFlowCard;e.exports=class extends i{constructor(t,e,o){super(t,Object.assign({},{Title:"Template Expression",Name:"Template Expression",Code:"TPL",Category:"Transform",Description:"Apply a Manyfest template expression to map source fields to a target column",TitleBarColor:"#8e44ad",Width:220,Height:90,Inputs:[{Name:"Whole Record",Side:"left"}],Outputs:[{Name:"Result",Side:"right"}],ShowTypeLabel:!0,PortLabelsOnHover:!1,PortLabelsOutside:!0,LabelsInFront:!0,Enabled:!0,BodyContent:{ContentType:"html",Template:'<div style="font-size:10px; padding:2px 4px; color:#ccc; overflow:hidden; white-space:nowrap; text-overflow:ellipsis; max-width:200px;">{~D:Record.Data.TemplateExpression~}</div>'},PropertiesPanel:{PanelType:"Template",DefaultWidth:420,DefaultHeight:160,Title:"Template Expression",Configuration:{Template:'<div style="padding:8px;"><label style="display:block; margin-bottom:4px; font-weight:bold; font-size:12px;">Template Expression</label><textarea id="FlowCard-TPL-{~D:Record.Hash~}" style="width:100%; height:80px; font-family:monospace; font-size:12px; resize:vertical; background:#1a1a2e; color:#e0e0e0; border:1px solid #444; border-radius:4px; padding:6px;" onchange="(function(el){var n=pict.views[\'MeadowMapping-Flow\'];if(n&&n._FlowData){for(var i=0;i<n._FlowData.Nodes.length;i++){if(n._FlowData.Nodes[i].Hash===\'{~D:Record.Hash~}\'){n._FlowData.Nodes[i].Data.TemplateExpression=el.value;if(typeof n.renderFlow===\'function\')n.renderFlow();break;}}}})(this)">{~D:Record.Data.TemplateExpression~}</textarea><div style="font-size:10px; color:#888; margin-top:4px;">Use {~D:Record.FieldName~} syntax. Example: {~D:Record.Name~} in {~D:Record.City~}</div></div>'}}},e),o),this.serviceType="FlowCardTemplateExpression"}},e.exports.default_configuration={Title:"Template Expression",Code:"TPL",Category:"Transform",TitleBarColor:"#8e44ad",Width:220,Height:90}},{"pict-section-flow":92}],136:[function(t,e,o){arguments[4][1][0].apply(o,arguments)},{dup:1}],137:[function(t,e,o){arguments[4][2][0].apply(o,arguments)},{"../package.json":136,dup:2}],138:[function(t,e,o){arguments[4][40][0].apply(o,arguments)},{dup:40}],139:[function(t,e,o){arguments[4][41][0].apply(o,arguments)},{"../package.json":138,dup:41,"fable-serviceproviderbase":137}],140:[function(t,e,o){e.exports=class{constructor(t){this._modal=t}confirm(t,e){let o=Object.assign({},this._modal.options.DefaultConfirmOptions,e);return new Promise(e=>{let i=this._buildDialog(o.title,t,e,o);this._showDialog(i,e)})}doubleConfirm(t,e){let o=Object.assign({},this._modal.options.DefaultDoubleConfirmOptions,e);return new Promise(e=>{let i=this._buildDoubleConfirmDialog(o.title,t,e,o);this._showDialog(i,e)})}_buildDialog(t,e,o,i){let n=this._modal._nextId(),a=i.dangerous?"danger":"primary",r=document.createElement("div");r.className="pict-modal-dialog",r.id="pict-modal-"+n,r.setAttribute("role","dialog"),r.setAttribute("aria-modal","true"),r.style.width="420px",r.innerHTML='<div class="pict-modal-dialog-header"><span class="pict-modal-dialog-title">'+this._escapeHTML(t)+'</span><button class="pict-modal-dialog-close" aria-label="Close">×</button></div><div class="pict-modal-dialog-body"><p>'+this._escapeHTML(e)+'</p></div><div class="pict-modal-dialog-footer"><button class="pict-modal-btn" data-action="cancel">'+this._escapeHTML(i.cancelLabel)+'</button><button class="pict-modal-btn pict-modal-btn--'+a+'" data-action="confirm">'+this._escapeHTML(i.confirmLabel)+"</button></div>";let s=r.querySelector(".pict-modal-dialog-close"),l=r.querySelector('[data-action="cancel"]'),c=r.querySelector('[data-action="confirm"]'),d=t=>{this._dismissDialog(r,t,o)};return s.addEventListener("click",()=>{d(!1)}),l.addEventListener("click",()=>{d(!1)}),c.addEventListener("click",()=>{d(!0)}),r._dismiss=d,r._focusTarget=l,r}_buildDoubleConfirmDialog(t,e,o,i){let n=this._modal._nextId(),a="string"==typeof i.confirmPhrase&&i.confirmPhrase.length>0,r=document.createElement("div");r.className="pict-modal-dialog",r.id="pict-modal-"+n,r.setAttribute("role","dialog"),r.setAttribute("aria-modal","true"),r.style.width="420px";let s="<p>"+this._escapeHTML(e)+"</p>";if(a){let t=i.phrasePrompt.replace("{phrase}",i.confirmPhrase);s+='<div class="pict-modal-confirm-prompt">'+this._escapeHTML(t)+'</div><input type="text" class="pict-modal-confirm-input" autocomplete="off" spellcheck="false" />'}r.innerHTML='<div class="pict-modal-dialog-header"><span class="pict-modal-dialog-title">'+this._escapeHTML(t)+'</span><button class="pict-modal-dialog-close" aria-label="Close">×</button></div><div class="pict-modal-dialog-body">'+s+'</div><div class="pict-modal-dialog-footer"><button class="pict-modal-btn" data-action="cancel">'+this._escapeHTML(i.cancelLabel)+'</button><button class="pict-modal-btn pict-modal-btn--danger" data-action="confirm" disabled>'+this._escapeHTML(i.confirmLabel)+"</button></div>";let l=r.querySelector(".pict-modal-dialog-close"),c=r.querySelector('[data-action="cancel"]'),d=r.querySelector('[data-action="confirm"]'),p=t=>{this._dismissDialog(r,t,o)};if(l.addEventListener("click",()=>{p(!1)}),c.addEventListener("click",()=>{p(!1)}),a){let t=r.querySelector(".pict-modal-confirm-input");t.addEventListener("input",()=>{d.disabled=t.value!==i.confirmPhrase}),d.addEventListener("click",()=>{d.disabled||p(!0)}),r._focusTarget=t}else{let t=0;i.confirmLabel;d.disabled=!1,d.addEventListener("click",()=>{t++,1===t?d.textContent="Click again to confirm":p(!0)}),r._focusTarget=c}return r._dismiss=p,r}_showDialog(t,e){let o={element:t,dismiss:t._dismiss,type:"confirm"},i=null;this._modal.options.OverlayClickDismisses&&(i=()=>{t._dismiss(!1)}),this._modal._overlay.show(i),document.body.appendChild(t),this._modal._activeModals.push(o),t.offsetHeight,t.classList.add("pict-modal-visible"),t._focusTarget&&t._focusTarget.focus(),t._keyHandler=e=>{"Escape"===e.key&&t._dismiss(!1)},document.addEventListener("keydown",t._keyHandler)}_dismissDialog(t,e,o){if(!t._dismissed){if(t._dismissed=!0,t._keyHandler&&document.removeEventListener("keydown",t._keyHandler),t.classList.remove("pict-modal-visible"),this._modal._activeModals=this._modal._activeModals.filter(e=>e.element!==t),this._modal._activeModals.length>0){let t=this._modal._activeModals[this._modal._activeModals.length-1];this._modal._overlay.updateClickHandler(this._modal.options.OverlayClickDismisses?t.dismiss:null)}this._modal._overlay.hide(),setTimeout(()=>{t.parentNode&&t.parentNode.removeChild(t)},220),o(e)}}_escapeHTML(t){return"string"!=typeof t?"":t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}}},{}],141:[function(t,e,o){e.exports=class{constructor(t){this._modal=t,this._element=null,this._refCount=0}show(t){this._refCount++,this._element||(this._element=document.createElement("div"),this._element.className="pict-modal-overlay",document.body.appendChild(this._element),this._element.offsetHeight,this._element.classList.add("pict-modal-visible")),t&&(this._currentClickHandler=t,this._element.onclick=t=>{t.target===this._element&&this._currentClickHandler&&this._currentClickHandler()})}updateClickHandler(t){this._currentClickHandler=t||null}hide(){if(this._refCount--,this._refCount<=0&&(this._refCount=0,this._element)){this._element.classList.remove("pict-modal-visible");let t=this._element;setTimeout(()=>{t.parentNode&&t.parentNode.removeChild(t)},220),this._element=null,this._currentClickHandler=null}}destroy(){this._refCount=0,this._element&&this._element.parentNode&&this._element.parentNode.removeChild(this._element),this._element=null,this._currentClickHandler=null}}},{}],142:[function(t,e,o){e.exports=class{constructor(t){this._modal=t,this._containers={}}toast(t,e){let o=Object.assign({},this._modal.options.DefaultToastOptions,e),i=this._getContainer(o.position),n=this._modal._nextId(),a=document.createElement("div");a.className="pict-modal-toast pict-modal-toast--"+o.type,a.id="pict-modal-toast-"+n;let r='<span class="pict-modal-toast-message">'+this._escapeHTML(t)+"</span>";o.dismissible&&(r+='<button class="pict-modal-toast-dismiss" aria-label="Dismiss">×</button>'),a.innerHTML=r;let s=!1,l=null,c=()=>{s||(s=!0,l&&clearTimeout(l),a.classList.remove("pict-modal-visible"),a.classList.add("pict-modal-toast-exit"),this._modal._activeToasts=this._modal._activeToasts.filter(t=>t.element!==a),setTimeout(()=>{a.parentNode&&a.parentNode.removeChild(a),this._cleanupContainer(o.position)},220))},d={dismiss:c};if(o.dismissible){let t=a.querySelector(".pict-modal-toast-dismiss");t&&t.addEventListener("click",c)}i.appendChild(a);let p={element:a,dismiss:c,handle:d};return this._modal._activeToasts.push(p),a.offsetHeight,a.classList.add("pict-modal-visible"),o.duration>0&&(l=setTimeout(c,o.duration)),d}_getContainer(t){if(this._containers[t])return this._containers[t];let e=document.createElement("div");return e.className="pict-modal-toast-container pict-modal-toast-container--"+t,document.body.appendChild(e),this._containers[t]=e,e}_cleanupContainer(t){let e=this._containers[t];e&&0===e.children.length&&(e.parentNode&&e.parentNode.removeChild(e),delete this._containers[t])}dismissAll(){let t=this._modal._activeToasts.slice();for(let e=0;e<t.length;e++)t[e].dismiss()}destroy(){this.dismissAll();let t=Object.keys(this._containers);for(let e=0;e<t.length;e++){let o=this._containers[t[e]];o&&o.parentNode&&o.parentNode.removeChild(o)}this._containers={}}_escapeHTML(t){return"string"!=typeof t?"":t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}}},{}],143:[function(t,e,o){e.exports=class{constructor(t){this._modal=t}tooltip(t,e,o){let i=Object.assign({},this._modal.options.DefaultTooltipOptions,o);return this._attachTooltip(t,e,!1,i)}richTooltip(t,e,o){let i=Object.assign({},this._modal.options.DefaultTooltipOptions,o);return this._attachTooltip(t,e,!0,i)}_attachTooltip(t,e,o,i){let n=null,a=null,r=null,s=!1,l=this._modal._nextId(),c=()=>{if(s||n)return;n=document.createElement("div"),n.className="pict-modal-tooltip pict-modal-tooltip--"+i.position,n.id="pict-modal-tooltip-"+l,n.setAttribute("role","tooltip"),n.style.maxWidth=i.maxWidth,i.interactive&&n.classList.add("pict-modal-tooltip-interactive");let a=document.createElement("div");a.className="pict-modal-tooltip-arrow";let c=document.createElement("div");o?c.innerHTML=e:c.textContent=e,n.appendChild(a),n.appendChild(c),document.body.appendChild(n),t.setAttribute("aria-describedby",n.id),this._positionTooltip(n,t,i.position),n.offsetHeight,n.classList.add("pict-modal-visible"),this._modal._activeTooltips.push({element:n,targetElement:t,destroy:g}),i.interactive&&n&&(n.addEventListener("mouseenter",()=>{r&&(clearTimeout(r),r=null)}),n.addEventListener("mouseleave",()=>{d()}))},d=()=>{if(!n)return;n.classList.remove("pict-modal-visible");let e=n;n=null,t.removeAttribute("aria-describedby"),this._modal._activeTooltips=this._modal._activeTooltips.filter(t=>t.element!==e),setTimeout(()=>{e.parentNode&&e.parentNode.removeChild(e)},220)},p=()=>{r&&(clearTimeout(r),r=null),a=setTimeout(c,i.delay)},h=()=>{a&&(clearTimeout(a),a=null),i.interactive?r=setTimeout(d,100):d()},u=()=>{a=setTimeout(c,i.delay)},f=()=>{a&&(clearTimeout(a),a=null),d()};t.addEventListener("mouseenter",p),t.addEventListener("mouseleave",h),t.addEventListener("focusin",u),t.addEventListener("focusout",f);let g=()=>{s||(s=!0,a&&clearTimeout(a),r&&clearTimeout(r),d(),t.removeEventListener("mouseenter",p),t.removeEventListener("mouseleave",h),t.removeEventListener("focusin",u),t.removeEventListener("focusout",f))};return{destroy:g}}_positionTooltip(t,e,o){let i=e.getBoundingClientRect(),n=t.getBoundingClientRect(),a=o;"top"===a&&i.top<n.height+8?a="bottom":"bottom"===a&&window.innerHeight-i.bottom<n.height+8?a="top":"left"===a&&i.left<n.width+8?a="right":"right"===a&&window.innerWidth-i.right<n.width+8&&(a="left"),t.className=t.className.replace(/pict-modal-tooltip--\w+/,"pict-modal-tooltip--"+a);let r=0,s=0;switch(a){case"top":r=i.top-n.height-8,s=i.left+i.width/2-n.width/2;break;case"bottom":r=i.bottom+8,s=i.left+i.width/2-n.width/2;break;case"left":r=i.top+i.height/2-n.height/2,s=i.left-n.width-8;break;case"right":r=i.top+i.height/2-n.height/2,s=i.right+8}s=Math.max(4,Math.min(s,window.innerWidth-n.width-4)),r=Math.max(4,Math.min(r,window.innerHeight-n.height-4)),t.style.top=r+"px",t.style.left=s+"px"}dismissAll(){let t=this._modal._activeTooltips.slice();for(let e=0;e<t.length;e++)t[e].destroy()}}},{}],144:[function(t,e,o){e.exports=class{constructor(t){this._modal=t}show(t){let e=Object.assign({},this._modal.options.DefaultModalOptions,t);return new Promise(t=>{let o=this._buildDialog(e,t);this._showDialog(o,e,t)})}_buildDialog(t,e){let o=this._modal._nextId(),i=document.createElement("div");i.className="pict-modal-dialog",i.id="pict-modal-"+o,i.setAttribute("role","dialog"),i.setAttribute("aria-modal","true"),i.style.width=t.width;let n="";(t.title||t.closeable)&&(n='<div class="pict-modal-dialog-header">',n+='<span class="pict-modal-dialog-title">'+this._escapeHTML(t.title)+"</span>",t.closeable&&(n+='<button class="pict-modal-dialog-close" aria-label="Close">×</button>'),n+="</div>");let a='<div class="pict-modal-dialog-body">'+(t.content||"")+"</div>",r="";if(t.buttons&&t.buttons.length>0){r='<div class="pict-modal-dialog-footer">';for(let e=0;e<t.buttons.length;e++){let o=t.buttons[e],i="pict-modal-btn";o.Style&&(i+=" pict-modal-btn--"+o.Style),r+='<button class="'+i+'" data-hash="'+this._escapeHTML(o.Hash)+'">'+this._escapeHTML(o.Label)+"</button>"}r+="</div>"}i.innerHTML=n+a+r;let s=o=>{this._dismissDialog(i,o,e,t)};if(t.closeable){let t=i.querySelector(".pict-modal-dialog-close");t&&t.addEventListener("click",()=>{s(null)})}let l=i.querySelectorAll("[data-hash]");for(let t=0;t<l.length;t++){let e=l[t];e.addEventListener("click",()=>{s(e.getAttribute("data-hash"))})}return i._dismiss=s,i}_showDialog(t,e,o){let i={element:t,dismiss:t._dismiss,type:"window"},n=null;this._modal.options.OverlayClickDismisses&&e.closeable&&(n=()=>{t._dismiss(null)}),this._modal._overlay.show(n),document.body.appendChild(t),this._modal._activeModals.push(i),t.offsetHeight,t.classList.add("pict-modal-visible");let a=t.querySelector(".pict-modal-btn")||t.querySelector(".pict-modal-dialog-close");a&&a.focus(),t._keyHandler=o=>{"Escape"===o.key&&e.closeable&&t._dismiss(null)},document.addEventListener("keydown",t._keyHandler),"function"==typeof e.onOpen&&e.onOpen(t)}_dismissDialog(t,e,o,i){if(!t._dismissed){if(t._dismissed=!0,t._keyHandler&&document.removeEventListener("keydown",t._keyHandler),t.classList.remove("pict-modal-visible"),this._modal._activeModals=this._modal._activeModals.filter(e=>e.element!==t),this._modal._activeModals.length>0){let t=this._modal._activeModals[this._modal._activeModals.length-1];this._modal._overlay.updateClickHandler(this._modal.options.OverlayClickDismisses?t.dismiss:null)}this._modal._overlay.hide(),setTimeout(()=>{t.parentNode&&t.parentNode.removeChild(t)},220),"function"==typeof i.onClose&&i.onClose(e),o(e)}}_escapeHTML(t){return"string"!=typeof t?"":t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}}},{}],145:[function(t,e,o){e.exports={AutoInitialize:!0,AutoRender:!1,AutoSolveWithApp:!1,ViewIdentifier:"Pict-Section-Modal",OverlayClickDismisses:!0,DefaultConfirmOptions:{title:"Confirm",confirmLabel:"OK",cancelLabel:"Cancel",dangerous:!1},DefaultDoubleConfirmOptions:{title:"Are you sure?",confirmLabel:"Confirm",cancelLabel:"Cancel",phrasePrompt:'Type "{phrase}" to confirm:',confirmPhrase:""},DefaultModalOptions:{title:"",content:"",buttons:[],closeable:!0,width:"480px"},DefaultTooltipOptions:{position:"top",delay:200,maxWidth:"300px",interactive:!1},DefaultToastOptions:{type:"info",duration:3e3,position:"top-right",dismissible:!0},Templates:[],Renderables:[],CSS:"\n/* pict-section-modal */\n.pict-modal-root\n{\n\t/* Overlay */\n\t--pict-modal-overlay-bg: rgba(0, 0, 0, 0.5);\n\n\t/* Dialog */\n\t--pict-modal-bg: #ffffff;\n\t--pict-modal-fg: #1a1a1a;\n\t--pict-modal-border: #e0e0e0;\n\t--pict-modal-border-radius: 8px;\n\t--pict-modal-shadow: 0 4px 24px rgba(0, 0, 0, 0.15);\n\t--pict-modal-header-bg: #f5f5f5;\n\t--pict-modal-header-fg: #1a1a1a;\n\t--pict-modal-header-border: #e0e0e0;\n\n\t/* Buttons */\n\t--pict-modal-btn-bg: #e0e0e0;\n\t--pict-modal-btn-fg: #1a1a1a;\n\t--pict-modal-btn-hover-bg: #d0d0d0;\n\t--pict-modal-btn-primary-bg: #2563eb;\n\t--pict-modal-btn-primary-fg: #ffffff;\n\t--pict-modal-btn-primary-hover-bg: #1d4ed8;\n\t--pict-modal-btn-danger-bg: #dc2626;\n\t--pict-modal-btn-danger-fg: #ffffff;\n\t--pict-modal-btn-danger-hover-bg: #b91c1c;\n\t--pict-modal-btn-border-radius: 4px;\n\n\t/* Toast */\n\t--pict-modal-toast-bg: #333333;\n\t--pict-modal-toast-fg: #ffffff;\n\t--pict-modal-toast-success-bg: #16a34a;\n\t--pict-modal-toast-warning-bg: #d97706;\n\t--pict-modal-toast-error-bg: #dc2626;\n\t--pict-modal-toast-info-bg: #2563eb;\n\t--pict-modal-toast-border-radius: 6px;\n\t--pict-modal-toast-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);\n\n\t/* Tooltip */\n\t--pict-modal-tooltip-bg: #1a1a1a;\n\t--pict-modal-tooltip-fg: #ffffff;\n\t--pict-modal-tooltip-border-radius: 4px;\n\t--pict-modal-tooltip-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);\n\n\t/* Typography */\n\t--pict-modal-font-family: system-ui, -apple-system, sans-serif;\n\t--pict-modal-font-size: 14px;\n\t--pict-modal-title-font-size: 16px;\n\n\t/* Animation */\n\t--pict-modal-transition-duration: 200ms;\n}\n\n/* Overlay */\n.pict-modal-overlay\n{\n\tposition: fixed;\n\ttop: 0;\n\tleft: 0;\n\twidth: 100%;\n\theight: 100%;\n\tz-index: 1000;\n\tbackground: var(--pict-modal-overlay-bg);\n\topacity: 0;\n\ttransition: opacity var(--pict-modal-transition-duration) ease;\n}\n\n.pict-modal-overlay.pict-modal-visible\n{\n\topacity: 1;\n}\n\n/* Dialog */\n.pict-modal-dialog\n{\n\tposition: fixed;\n\tz-index: 1010;\n\ttop: 50%;\n\tleft: 50%;\n\ttransform: translate(-50%, -50%) translateY(-20px);\n\topacity: 0;\n\ttransition: opacity var(--pict-modal-transition-duration) ease,\n\t transform var(--pict-modal-transition-duration) ease;\n\n\tmax-width: 90vw;\n\tmax-height: 90vh;\n\tdisplay: flex;\n\tflex-direction: column;\n\n\tbackground: var(--pict-modal-bg);\n\tcolor: var(--pict-modal-fg);\n\tborder: 1px solid var(--pict-modal-border);\n\tborder-radius: var(--pict-modal-border-radius);\n\tbox-shadow: var(--pict-modal-shadow);\n\tfont-family: var(--pict-modal-font-family);\n\tfont-size: var(--pict-modal-font-size);\n}\n\n.pict-modal-dialog.pict-modal-visible\n{\n\topacity: 1;\n\ttransform: translate(-50%, -50%) translateY(0);\n}\n\n.pict-modal-dialog-header\n{\n\tdisplay: flex;\n\talign-items: center;\n\tjustify-content: space-between;\n\tpadding: 12px 16px;\n\tbackground: var(--pict-modal-header-bg);\n\tcolor: var(--pict-modal-header-fg);\n\tborder-bottom: 1px solid var(--pict-modal-header-border);\n\tborder-radius: var(--pict-modal-border-radius) var(--pict-modal-border-radius) 0 0;\n}\n\n.pict-modal-dialog-title\n{\n\tfont-size: var(--pict-modal-title-font-size);\n\tfont-weight: 600;\n}\n\n.pict-modal-dialog-close\n{\n\tbackground: none;\n\tborder: none;\n\tfont-size: 20px;\n\tcursor: pointer;\n\tcolor: var(--pict-modal-fg);\n\tpadding: 0 4px;\n\tline-height: 1;\n\topacity: 0.6;\n}\n\n.pict-modal-dialog-close:hover\n{\n\topacity: 1;\n}\n\n.pict-modal-dialog-body\n{\n\tpadding: 16px;\n\toverflow-y: auto;\n\tflex: 1;\n}\n\n.pict-modal-dialog-footer\n{\n\tdisplay: flex;\n\tjustify-content: flex-end;\n\tgap: 8px;\n\tpadding: 12px 16px;\n\tborder-top: 1px solid var(--pict-modal-border);\n}\n\n/* Buttons */\n.pict-modal-btn\n{\n\tpadding: 8px 16px;\n\tborder: none;\n\tborder-radius: var(--pict-modal-btn-border-radius);\n\tfont-family: var(--pict-modal-font-family);\n\tfont-size: var(--pict-modal-font-size);\n\tcursor: pointer;\n\tbackground: var(--pict-modal-btn-bg);\n\tcolor: var(--pict-modal-btn-fg);\n\ttransition: background var(--pict-modal-transition-duration) ease;\n}\n\n.pict-modal-btn:hover\n{\n\tbackground: var(--pict-modal-btn-hover-bg);\n}\n\n.pict-modal-btn:disabled\n{\n\topacity: 0.5;\n\tcursor: not-allowed;\n}\n\n.pict-modal-btn--primary\n{\n\tbackground: var(--pict-modal-btn-primary-bg);\n\tcolor: var(--pict-modal-btn-primary-fg);\n}\n\n.pict-modal-btn--primary:hover\n{\n\tbackground: var(--pict-modal-btn-primary-hover-bg);\n}\n\n.pict-modal-btn--danger\n{\n\tbackground: var(--pict-modal-btn-danger-bg);\n\tcolor: var(--pict-modal-btn-danger-fg);\n}\n\n.pict-modal-btn--danger:hover\n{\n\tbackground: var(--pict-modal-btn-danger-hover-bg);\n}\n\n/* Double confirm input */\n.pict-modal-confirm-input\n{\n\twidth: 100%;\n\tpadding: 8px 12px;\n\tmargin-top: 12px;\n\tborder: 1px solid var(--pict-modal-border);\n\tborder-radius: var(--pict-modal-btn-border-radius);\n\tfont-family: var(--pict-modal-font-family);\n\tfont-size: var(--pict-modal-font-size);\n\tbox-sizing: border-box;\n}\n\n.pict-modal-confirm-input:focus\n{\n\toutline: 2px solid var(--pict-modal-btn-primary-bg);\n\toutline-offset: -1px;\n}\n\n.pict-modal-confirm-prompt\n{\n\tmargin-top: 12px;\n\tfont-size: 13px;\n\tcolor: var(--pict-modal-fg);\n\topacity: 0.7;\n}\n\n/* Toast container */\n.pict-modal-toast-container\n{\n\tposition: fixed;\n\tz-index: 1030;\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 8px;\n\tpointer-events: none;\n\tmax-width: 400px;\n}\n\n.pict-modal-toast-container--top-right\n{\n\ttop: 16px;\n\tright: 16px;\n}\n\n.pict-modal-toast-container--top-left\n{\n\ttop: 16px;\n\tleft: 16px;\n}\n\n.pict-modal-toast-container--bottom-right\n{\n\tbottom: 16px;\n\tright: 16px;\n}\n\n.pict-modal-toast-container--bottom-left\n{\n\tbottom: 16px;\n\tleft: 16px;\n}\n\n.pict-modal-toast-container--top-center\n{\n\ttop: 16px;\n\tleft: 50%;\n\ttransform: translateX(-50%);\n}\n\n.pict-modal-toast-container--bottom-center\n{\n\tbottom: 16px;\n\tleft: 50%;\n\ttransform: translateX(-50%);\n}\n\n/* Toast */\n.pict-modal-toast\n{\n\tdisplay: flex;\n\talign-items: center;\n\tgap: 10px;\n\tpadding: 12px 16px;\n\tborder-radius: var(--pict-modal-toast-border-radius);\n\tbox-shadow: var(--pict-modal-toast-shadow);\n\tfont-family: var(--pict-modal-font-family);\n\tfont-size: var(--pict-modal-font-size);\n\tbackground: var(--pict-modal-toast-bg);\n\tcolor: var(--pict-modal-toast-fg);\n\tpointer-events: auto;\n\topacity: 0;\n\ttransform: translateX(100%);\n\ttransition: opacity var(--pict-modal-transition-duration) ease,\n\t transform var(--pict-modal-transition-duration) ease;\n}\n\n.pict-modal-toast.pict-modal-visible\n{\n\topacity: 1;\n\ttransform: translateX(0);\n}\n\n.pict-modal-toast.pict-modal-toast-exit\n{\n\topacity: 0;\n\ttransform: translateX(100%);\n}\n\n.pict-modal-toast--info\n{\n\tbackground: var(--pict-modal-toast-info-bg);\n}\n\n.pict-modal-toast--success\n{\n\tbackground: var(--pict-modal-toast-success-bg);\n}\n\n.pict-modal-toast--warning\n{\n\tbackground: var(--pict-modal-toast-warning-bg);\n}\n\n.pict-modal-toast--error\n{\n\tbackground: var(--pict-modal-toast-error-bg);\n}\n\n.pict-modal-toast-message\n{\n\tflex: 1;\n}\n\n.pict-modal-toast-dismiss\n{\n\tbackground: none;\n\tborder: none;\n\tcolor: inherit;\n\tfont-size: 18px;\n\tcursor: pointer;\n\tpadding: 0 2px;\n\tline-height: 1;\n\topacity: 0.7;\n}\n\n.pict-modal-toast-dismiss:hover\n{\n\topacity: 1;\n}\n\n/* Tooltip */\n.pict-modal-tooltip\n{\n\tposition: fixed;\n\tz-index: 1020;\n\tpadding: 6px 10px;\n\tborder-radius: var(--pict-modal-tooltip-border-radius);\n\tbox-shadow: var(--pict-modal-tooltip-shadow);\n\tbackground: var(--pict-modal-tooltip-bg);\n\tcolor: var(--pict-modal-tooltip-fg);\n\tfont-family: var(--pict-modal-font-family);\n\tfont-size: 13px;\n\tpointer-events: none;\n\topacity: 0;\n\ttransition: opacity var(--pict-modal-transition-duration) ease;\n\twhite-space: normal;\n\tword-wrap: break-word;\n}\n\n.pict-modal-tooltip.pict-modal-tooltip-interactive\n{\n\tpointer-events: auto;\n}\n\n.pict-modal-tooltip.pict-modal-visible\n{\n\topacity: 1;\n}\n\n.pict-modal-tooltip-arrow\n{\n\tposition: absolute;\n\twidth: 8px;\n\theight: 8px;\n\tbackground: var(--pict-modal-tooltip-bg);\n\ttransform: rotate(45deg);\n}\n\n.pict-modal-tooltip--top .pict-modal-tooltip-arrow\n{\n\tbottom: -4px;\n\tleft: 50%;\n\tmargin-left: -4px;\n}\n\n.pict-modal-tooltip--bottom .pict-modal-tooltip-arrow\n{\n\ttop: -4px;\n\tleft: 50%;\n\tmargin-left: -4px;\n}\n\n.pict-modal-tooltip--left .pict-modal-tooltip-arrow\n{\n\tright: -4px;\n\ttop: 50%;\n\tmargin-top: -4px;\n}\n\n.pict-modal-tooltip--right .pict-modal-tooltip-arrow\n{\n\tleft: -4px;\n\ttop: 50%;\n\tmargin-top: -4px;\n}\n"}},{}],146:[function(t,e,o){const i=t("pict-view"),n=t("./Pict-Modal-Overlay.js"),a=t("./Pict-Modal-Confirm.js"),r=t("./Pict-Modal-Window.js"),s=t("./Pict-Modal-Toast.js"),l=t("./Pict-Modal-Tooltip.js"),c=t("./Pict-Section-Modal-DefaultConfiguration.js");e.exports=class extends i{constructor(t,e,o){super(t,Object.assign({},c,e),o),this._activeModals=[],this._activeTooltips=[],this._activeToasts=[],this._idCounter=0,this._overlay=new n(this),this._confirm=new a(this),this._window=new r(this),this._toast=new s(this),this._tooltip=new l(this)}onBeforeInitialize(){return super.onBeforeInitialize(),"undefined"!=typeof document&&document.body&&(document.body.classList.contains("pict-modal-root")||document.body.classList.add("pict-modal-root")),super.onBeforeInitialize()}_nextId(){return this._idCounter++,this._idCounter}confirm(t,e){return this._confirm.confirm(t,e)}doubleConfirm(t,e){return this._confirm.doubleConfirm(t,e)}show(t){return this._window.show(t)}tooltip(t,e,o){return this._tooltip.tooltip(t,e,o)}richTooltip(t,e,o){return this._tooltip.richTooltip(t,e,o)}toast(t,e){return this._toast.toast(t,e)}dismissModals(){let t=this._activeModals.slice();for(let e=t.length-1;e>=0;e--)t[e].dismiss(null)}dismissTooltips(){this._tooltip.dismissAll()}dismissToasts(){this._toast.dismissAll()}dismissAll(){this.dismissModals(),this.dismissTooltips(),this.dismissToasts()}destroy(){if(this.dismissAll(),this._overlay.destroy(),this._toast.destroy(),"function"==typeof super.destroy)return super.destroy()}},e.exports.default_configuration=c},{"./Pict-Modal-Confirm.js":140,"./Pict-Modal-Overlay.js":141,"./Pict-Modal-Toast.js":142,"./Pict-Modal-Tooltip.js":143,"./Pict-Modal-Window.js":144,"./Pict-Section-Modal-DefaultConfiguration.js":145,"pict-view":139}]},{},[70])(70)});
|
|
2
|
+
//# sourceMappingURL=retold-facto.min.js.map
|