retold-content-system 1.0.12 → 1.0.13
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/README.md +130 -68
- package/package.json +3 -3
- package/source/cli/ContentSystem-Server-Setup.js +7 -3
- package/web-application/js/pict.min.js +2 -2
- package/web-application/retold-content-system.compatible.js +50 -7
- package/web-application/retold-content-system.compatible.js.map +1 -1
- package/web-application/retold-content-system.compatible.min.js +5 -5
- package/web-application/retold-content-system.compatible.min.js.map +1 -1
- package/web-application/retold-content-system.js +49 -6
- package/web-application/retold-content-system.js.map +1 -1
- package/web-application/retold-content-system.min.js +1 -1
- package/web-application/retold-content-system.min.js.map +1 -1
|
@@ -85,5 +85,5 @@ M.Builder=function(){this._ref="id",this._fields=Object.create(null),this._docum
|
|
|
85
85
|
* @license MIT
|
|
86
86
|
* @author Steven Velozo <steven@velozo.com>
|
|
87
87
|
*/
|
|
88
|
-
const i=t("fable-serviceproviderbase"),o=t("path"),r=t("fs"),s=t("url"),a={BasePath:".",APIRoutePrefix:"/api/filebrowser",WebAppRoute:"/filebrowser/*",WebAppRouteStrip:"/filebrowser/",ServeWebApp:!0,IncludeHiddenFiles:!1,MaxTreeDepth:2};e.exports=class extends i{constructor(t,e,n){super(t,e,n),this.serviceType="PictFileBrowserService";for(let t in a)t in this.options||(this.options[t]=a[t]);this.basePath=o.resolve(this.options.BasePath)}connectRoutes(){if(!this.fable.Orator||!this.fable.Orator.serviceServer)return this.log.error("PictFileBrowserService: Orator service server is not available. Initialize Orator first."),!1;let t=this.fable.Orator.serviceServer,e=this.options.APIRoutePrefix;if(t.get(e+"/list",(t,e,n)=>{let i=this.parseQueryParams(t).path||"";this.listDirectory(i,(t,i)=>t?(e.send(400,{Error:t.message}),n()):(e.send(i),n()))}),t.get(e+"/tree",(t,e,n)=>{let i=this.parseQueryParams(t),o=this.options.MaxTreeDepth;i.depth&&(o=parseInt(i.depth)||this.options.MaxTreeDepth),this.buildFolderTree("",o,(t,i)=>t?(e.send(400,{Error:t.message}),n()):(e.send(i),n()))}),t.get(e+"/info",(t,e,n)=>{let i=this.parseQueryParams(t).path||"";this.getFileInfo(i,(t,i)=>t?(e.send(400,{Error:t.message}),n()):(e.send(i),n()))}),t.get(e+"/children",(t,e,n)=>{let i=this.parseQueryParams(t).path||"";this.listChildFolders(i,(t,i)=>t?(e.send(400,{Error:t.message}),n()):(e.send(i),n()))}),this.options.ServeWebApp){let t=o.join(n,"..","www");this.fable.Orator.addStaticRoute(t,"index.html",this.options.WebAppRoute,this.options.WebAppRouteStrip)}return this.log.info("PictFileBrowserService: Routes connected. Browsing path: "+this.basePath),!0}parseQueryParams(t){if(t.query&&"object"==typeof t.query)return t.query;return s.parse(t.url,!0).query||{}}resolveSafePath(t){let e=(t||"").replace(/\.\./g,"").replace(/\/\//g,"/"),n=o.resolve(this.basePath,e);return 0!==n.indexOf(this.basePath)?null:n}listDirectory(t,e){let n=this.resolveSafePath(t);if(!n)return e(new Error("Invalid path"));r.readdir(n,{withFileTypes:!0},(i,s)=>{if(i)return"ENOENT"===i.code?e(new Error("Path not found")):"ENOTDIR"===i.code?e(new Error("Path is not a directory")):e(i);let a=[],c=s.length;if(0===c)return e(null,a);for(let i=0;i<s.length;i++){let l=s[i],d=l.name;if(!this.options.IncludeHiddenFiles&&"."===d.charAt(0)){if(c--,0===c)return e(null,a);continue}let p=o.join(n,d),h=t?t+"/"+d:d;r.stat(p,((t,n,i)=>(r,s)=>{let l={Name:t,Path:n,Type:i?"folder":"file"};if(s&&!r&&(l.Size=s.size,l.Modified=s.mtime,l.Created=s.birthtime,i||(l.Extension=o.extname(t))),a.push(l),c--,0===c)return e(null,a)})(d,h,l.isDirectory()))}})}listChildFolders(t,e){let n=this.resolveSafePath(t);if(!n)return e(new Error("Invalid path"));r.readdir(n,{withFileTypes:!0},(i,s)=>{if(i)return"ENOENT"===i.code?e(new Error("Path not found")):"ENOTDIR"===i.code?e(new Error("Path is not a directory")):e(i);let a=[];for(let t=0;t<s.length;t++){if(!s[t].isDirectory())continue;let e=s[t].name;(this.options.IncludeHiddenFiles||"."!==e.charAt(0))&&a.push(e)}if(a.sort((t,e)=>t.localeCompare(e)),0===a.length)return e(null,[]);let c=[],l=a.length;for(let i=0;i<a.length;i++){let s=a[i],d=o.join(n,s),p=t?t+"/"+s:s;r.readdir(d,{withFileTypes:!0},((t,n)=>(i,o)=>{let r=!1;if(!i&&o)for(let t=0;t<o.length;t++)if(o[t].isDirectory()){let e=o[t].name;if(this.options.IncludeHiddenFiles||"."!==e.charAt(0)){r=!0;break}}if(c.push({Name:t,Path:n,HasChildren:r}),l--,0===l)return c.sort((t,e)=>t.Name.localeCompare(e.Name)),e(null,c)})(s,p))}})}buildFolderTree(t,e,n){let i=this.resolveSafePath(t);if(!i)return n(new Error("Invalid path"));this._buildTreeRecursive(i,t,e,0,n)}_buildTreeRecursive(t,e,n,i,s){if(n>0&&i>=n)return s(null,[]);r.readdir(t,{withFileTypes:!0},(r,a)=>{if(r)return s(null,[]);let c=[];for(let t=0;t<a.length;t++)if(a[t].isDirectory()){let e=a[t].name;if(!this.options.IncludeHiddenFiles&&"."===e.charAt(0))continue;c.push(e)}if(0===c.length)return s(null,[]);let l=[],d=c.length;for(let r=0;r<c.length;r++){let a=c[r],p=o.join(t,a),h=e?e+"/"+a:a;this._buildTreeRecursive(p,h,n,i+1,((t,e)=>(n,i)=>{if(l.push({Name:t,Path:e,Children:i||[]}),d--,0===d)return l.sort((t,e)=>t.Name.localeCompare(e.Name)),s(null,l)})(a,h))}})}getFileInfo(t,e){let n=this.resolveSafePath(t);if(!n)return e(new Error("Invalid path"));r.stat(n,(i,r)=>{if(i)return"ENOENT"===i.code?e(new Error("Path not found")):e(i);let s=o.basename(n),a={Name:s,Path:t||s,Type:r.isDirectory()?"folder":"file",Size:r.size,Modified:r.mtime,Created:r.birthtime};return r.isDirectory()||(a.Extension=o.extname(s)),e(null,a)})}},e.exports.default_configuration=a}).call(this)}).call(this,"/node_modules/pict-section-filebrowser/source/services")},{"fable-serviceproviderbase":20,fs:2,path:42,url:100}],70:[function(t,e,n){const i=t("pict-view"),o={ViewIdentifier:"Pict-FileBrowser-BrowseSearch",DefaultRenderable:"BrowseSearch-Container",DefaultDestinationAddress:"#Pict-FileBrowser-BrowsePane",AutoRender:!1,Templates:[{Hash:"FileBrowser-BrowseSearch-Container-Template",Template:'\n<div class="pict-fb-search">\n\t<input type="text" class="pict-fb-search-input"\n\t\tid="Pict-FileBrowser-SearchInput"\n\t\tplaceholder="Search files..."\n\t\toninput="pict.views[\'{~D:Record.ViewHash~}\'].onSearchInput(this.value)" />\n\t<div class="pict-fb-search-results" id="Pict-FileBrowser-SearchResults"></div>\n</div>\n'},{Hash:"FileBrowser-BrowseSearch-Result-Template",Template:'\n<div class="pict-fb-search-result" onclick="{~D:Record.ClickHandler~}">\n\t<span class="pict-fb-search-result-icon">{~D:Record.Icon~}</span>\n\t<span class="pict-fb-search-result-name">{~D:Record.Name~}</span>\n\t<span class="pict-fb-search-result-path">{~D:Record.Path~}</span>\n</div>\n'},{Hash:"FileBrowser-BrowseSearch-Empty-Template",Template:'<div class="pict-fb-empty">{~D:Record.Message~}</div>'}],Renderables:[{RenderableHash:"BrowseSearch-Container",TemplateHash:"FileBrowser-BrowseSearch-Container-Template",DestinationAddress:"#Pict-FileBrowser-BrowsePane",RenderMethod:"replace"}]};e.exports=class extends i{constructor(t,e,n){super(t,Object.assign({},o,e),n),this.lastQuery="",this.debounceTimer=null}onAfterRender(t){let e=this.pict.parseTemplateByHash("FileBrowser-BrowseSearch-Container-Template",{ViewHash:this.Hash});return this.pict.ContentAssignment.assignContent("#Pict-FileBrowser-BrowsePane",e),this.pict.CSSMap.injectCSS(),super.onAfterRender(t)}onSearchInput(t){this.lastQuery=t||"",this.debounceTimer&&clearTimeout(this.debounceTimer),this.debounceTimer=setTimeout(()=>{this.performSearch(this.lastQuery)},150)}performSearch(t){let e="#Pict-FileBrowser-SearchResults";if(!t||t.length<1)return void this.pict.ContentAssignment.assignContent(e,"");let n=this.pict.providers["Pict-FileBrowser-Browse"];if(!n)return;let i=n.searchFiles(t),o=this.pict.providers["Pict-FileBrowser-List"];if(0===i.length){let t=this.pict.parseTemplateByHash("FileBrowser-BrowseSearch-Empty-Template",{Message:"No results found"});return void this.pict.ContentAssignment.assignContent(e,t)}let r="";for(let t=0;t<i.length&&t<50;t++){let e=i[t],n=o?o.getEntryIcon(e):"📄",s=e.Path||"",a={Name:e.Name,Path:s,Icon:n,ClickHandler:"pict.views['"+this.Hash+"'].selectResult("+t+")"};r+=this.pict.parseTemplateByHash("FileBrowser-BrowseSearch-Result-Template",a)}this.pict.ContentAssignment.assignContent(e,r),this._lastResults=i}selectResult(t){if(!this._lastResults||t>=this._lastResults.length)return;let e=this._lastResults[t],n=this.pict.providers["Pict-FileBrowser-List"];n&&n.openEntry(e)}},e.exports.default_configuration=o},{"pict-view":88}],71:[function(t,e,n){const i=t("pict-view"),o={ViewIdentifier:"Pict-FileBrowser-BrowseTree",DefaultRenderable:"BrowseTree-Container",DefaultDestinationAddress:"#Pict-FileBrowser-BrowsePane",AutoRender:!1,Templates:[{Hash:"FileBrowser-BrowseTree-Container-Template",Template:'<div class="pict-fb-tree" id="Pict-FileBrowser-Tree"></div>'},{Hash:"FileBrowser-BrowseTree-Node-Template",Template:'\n<div class="pict-fb-tree-node{~D:Record.SelectedClass~}" style="padding-left: {~D:Record.Indent~}px;" data-path="{~D:Record.Path~}" onclick="{~D:Record.ClickHandler~}">\n\t<span class="{~D:Record.ToggleClass~}" onclick="{~D:Record.ToggleHandler~}">{~D:Record.ToggleIcon~}</span>\n\t<span class="pict-fb-tree-icon">{~D:Record.Icon~}</span>\n\t<span class="pict-fb-tree-label">{~D:Record.Name~}</span>\n</div>\n<div class="pict-fb-tree-children{~D:Record.ExpandedClass~}" id="Pict-FB-TreeChildren-{~D:Record.NodeID~}">\n{~D:Record.ChildrenHTML~}\n</div>\n'}],Renderables:[{RenderableHash:"BrowseTree-Container",TemplateHash:"FileBrowser-BrowseTree-Container-Template",DestinationAddress:"#Pict-FileBrowser-BrowsePane",RenderMethod:"replace"}]};e.exports=class extends i{constructor(t,e,n){super(t,Object.assign({},o,e),n),this.expandedPaths={}}onAfterRender(t){return this.rebuildTree(),this.pict.CSSMap.injectCSS(),super.onAfterRender(t)}rebuildTree(){if(!this.pict.providers["Pict-FileBrowser-Browse"])return;let t=this.getCurrentLocation(),e=this.renderTreeLevel("",0,t);this.pict.ContentAssignment.assignContent("#Pict-FileBrowser-Tree",e)}renderTreeLevel(t,e,n){let i=this.pict.providers["Pict-FileBrowser-Browse"];if(!i)return"";let o=i.getChildFolders(t);if(!o)return this.expandedPaths[t]?'<div class="pict-fb-tree-loading" style="padding-left: '+(24+16*e)+'px;">Loading...</div>':"";let r="";for(let t=0;t<o.length;t++){let s=o[t],a=s.Path,c=a.replace(/[^a-zA-Z0-9]/g,"_"),l=!!this.expandedPaths[a],d=a===n,p=i.getChildFolders(a),h=s.HasChildren||p&&p.length>0,u="";l&&(u=this.renderTreeLevel(a,e+1,n));let f=this.pict.providers["Pict-FileBrowser-Icons"],g=f?f.getIcon("folder",16):"📁",m="";h&&(m=f?l?f.getIcon("chevron-down",10):f.getIcon("chevron-right",10):l?"▾":"▸");let v={Name:s.Name,Path:a,NodeID:c,Indent:8+16*e,Icon:g,ToggleIcon:m,ToggleClass:h?"pict-fb-tree-toggle":"pict-fb-tree-toggle-empty",ToggleHandler:h?"event.stopPropagation(); pict.views['"+this.Hash+"'].toggleNode('"+a+"')":"",ClickHandler:"pict.views['"+this.Hash+"'].selectFolder('"+a+"')",SelectedClass:d?" selected":"",ExpandedClass:l?" expanded":"",ChildrenHTML:u};r+=this.pict.parseTemplateByHash("FileBrowser-BrowseTree-Node-Template",v)}return r}toggleNode(t){if(this.expandedPaths[t]=!this.expandedPaths[t],this.expandedPaths[t]){let e=this.pict.providers["Pict-FileBrowser-Browse"];if(e){e.getChildFolders(t)||"function"==typeof this.onRequestChildren&&this.onRequestChildren(t)}}this.rebuildTree()}onRequestChildren(t){}selectFolder(t){this.expandedPaths[t]=!0;let e=this.pict.providers["Pict-FileBrowser-Browse"];if(e){e.getChildFolders(t)||"function"==typeof this.onRequestChildren&&this.onRequestChildren(t),e.navigateToFolder(t)}this.rebuildTree()}getCurrentLocation(){let t=(this.options.StateAddresses||{}).CurrentLocation||"AppData.PictFileBrowser.CurrentLocation";return this.pict.manifest.getValueByHash({AppData:this.pict.AppData,Pict:this.pict},t)||""}},e.exports.default_configuration=o},{"pict-view":88}],72:[function(t,e,n){const i=t("pict-view"),o={ViewIdentifier:"Pict-FileBrowser-ListDetail",DefaultRenderable:"ListDetail-Container",DefaultDestinationAddress:"#Pict-FileBrowser-ListPane",AutoRender:!1,Templates:[{Hash:"FileBrowser-ListDetail-Container-Template",Template:'\n<div class="pict-fb-detail" id="Pict-FileBrowser-DetailList">\n\t<div class="pict-fb-breadcrumb" id="Pict-FileBrowser-Breadcrumb"></div>\n\t<div class="pict-fb-detail-header">\n\t\t<div class="pict-fb-detail-header-cell pict-fb-detail-col-name" onclick="pict.views[\'{~D:Record.ViewHash~}\'].sortBy(\'Name\')">Name</div>\n\t\t<div class="pict-fb-detail-header-cell pict-fb-detail-col-size" onclick="pict.views[\'{~D:Record.ViewHash~}\'].sortBy(\'Size\')">Size</div>\n\t\t<div class="pict-fb-detail-header-cell pict-fb-detail-col-modified" onclick="pict.views[\'{~D:Record.ViewHash~}\'].sortBy(\'Modified\')">Modified</div>\n\t</div>\n\t<div id="Pict-FileBrowser-DetailRows"></div>\n</div>\n'},{Hash:"FileBrowser-ListDetail-Row-Template",Template:'\n<div class="pict-fb-detail-row{~D:Record.SelectedClass~}" data-index="{~D:Record.Index~}" onclick="{~D:Record.ClickHandler~}" ondblclick="{~D:Record.DblClickHandler~}">\n\t<span class="pict-fb-detail-icon">{~D:Record.Icon~}</span>\n\t<span class="pict-fb-detail-name">{~D:Record.Name~}</span>\n\t<span class="pict-fb-detail-size">{~D:Record.SizeFormatted~}</span>\n\t<span class="pict-fb-detail-modified">{~D:Record.ModifiedFormatted~}</span>\n</div>\n'},{Hash:"FileBrowser-ListDetail-Empty-Template",Template:'<div class="pict-fb-empty">{~D:Record.Message~}</div>'},{Hash:"FileBrowser-Breadcrumb-Segment-Template",Template:'<span class="pict-fb-breadcrumb-segment" onclick="{~D:Record.ClickHandler~}">{~D:Record.Label~}</span>'},{Hash:"FileBrowser-Breadcrumb-Separator-Template",Template:'<span class="pict-fb-breadcrumb-separator">/</span>'},{Hash:"FileBrowser-Breadcrumb-Current-Template",Template:'<span class="pict-fb-breadcrumb-current">{~D:Record.Label~}</span>'}],Renderables:[{RenderableHash:"ListDetail-Container",TemplateHash:"FileBrowser-ListDetail-Container-Template",DestinationAddress:"#Pict-FileBrowser-ListPane",RenderMethod:"replace"}]};e.exports=class extends i{constructor(t,e,n){super(t,Object.assign({},o,e),n),this._cachedFileList=[]}onAfterRender(t){let e=this.pict.parseTemplateByHash("FileBrowser-ListDetail-Container-Template",{ViewHash:this.Hash});return this.pict.ContentAssignment.assignContent("#Pict-FileBrowser-ListPane",e),this.rebuildList(),this.rebuildBreadcrumb(),this.pict.CSSMap.injectCSS(),super.onAfterRender(t)}rebuildList(){let t=this.pict.providers["Pict-FileBrowser-List"];if(!t)return;let e=t.getSortedFileList();this._cachedFileList=e;let n=t.getSelectedFile();if(0===e.length){let t=this.pict.parseTemplateByHash("FileBrowser-ListDetail-Empty-Template",{Message:"This folder is empty"});return void this.pict.ContentAssignment.assignContent("#Pict-FileBrowser-DetailRows",t)}let i="";for(let o=0;o<e.length;o++){let r=e[o],s=n&&n.Name===r.Name&&n.Path===r.Path,a={Index:o,Name:r.Name,Icon:t.getEntryIcon(r),SizeFormatted:"folder"===r.Type?"--":t.formatFileSize(r.Size),ModifiedFormatted:t.formatDate(r.Modified),SelectedClass:s?" selected":"",ClickHandler:"pict.views['"+this.Hash+"'].selectEntry("+o+")",DblClickHandler:"pict.views['"+this.Hash+"'].openEntry("+o+")"};i+=this.pict.parseTemplateByHash("FileBrowser-ListDetail-Row-Template",a)}this.pict.ContentAssignment.assignContent("#Pict-FileBrowser-DetailRows",i)}rebuildBreadcrumb(){let t=this.getCurrentLocation(),e="",n=this.pict.providers["Pict-FileBrowser-Icons"],i=n?n.getIcon("home",16):"🏠";if(e+=this.pict.parseTemplateByHash("FileBrowser-Breadcrumb-Segment-Template",{Label:i,ClickHandler:"pict.views['"+this.Hash+"'].navigateToPath('')"}),t){let n=t.split("/"),i="";for(let t=0;t<n.length;t++)if(i=i?i+"/"+n[t]:n[t],e+=this.pict.parseTemplateByHash("FileBrowser-Breadcrumb-Separator-Template",{}),t===n.length-1)e+=this.pict.parseTemplateByHash("FileBrowser-Breadcrumb-Current-Template",{Label:n[t]});else{let o=i;e+=this.pict.parseTemplateByHash("FileBrowser-Breadcrumb-Segment-Template",{Label:n[t],ClickHandler:"pict.views['"+this.Hash+"'].navigateToPath('"+o+"')"})}}this.pict.ContentAssignment.assignContent("#Pict-FileBrowser-Breadcrumb",e)}selectEntry(t){if(t<0||t>=this._cachedFileList.length)return;let e=this.pict.providers["Pict-FileBrowser-List"];e&&e.selectFile(this._cachedFileList[t]),this.rebuildList()}openEntry(t){if(t<0||t>=this._cachedFileList.length)return;let e=this.pict.providers["Pict-FileBrowser-List"];e&&e.openEntry(this._cachedFileList[t]),this.rebuildList(),this.rebuildBreadcrumb()}sortBy(t){let e=this.pict.providers["Pict-FileBrowser-List"];e&&e.setSortField(t),this.rebuildList()}navigateToPath(t){let e=this.pict.providers["Pict-FileBrowser-Browse"];e&&e.navigateToFolder(t),this.rebuildList(),this.rebuildBreadcrumb()}getCurrentLocation(){let t=(this.options.StateAddresses||{}).CurrentLocation||"AppData.PictFileBrowser.CurrentLocation";return this.pict.manifest.getValueByHash({AppData:this.pict.AppData,Pict:this.pict},t)||""}},e.exports.default_configuration=o},{"pict-view":88}],73:[function(t,e,n){const i=t("pict-view"),o={ViewIdentifier:"Pict-FileBrowser-ListIcons",DefaultRenderable:"ListIcons-Container",DefaultDestinationAddress:"#Pict-FileBrowser-ListPane",AutoRender:!1,Templates:[{Hash:"FileBrowser-ListIcons-Container-Template",Template:'\n<div id="Pict-FileBrowser-IconList">\n\t<div class="pict-fb-breadcrumb" id="Pict-FileBrowser-IconBreadcrumb"></div>\n\t<div class="pict-fb-icons" id="Pict-FileBrowser-IconGrid"></div>\n</div>\n'},{Hash:"FileBrowser-ListIcons-Item-Template",Template:'\n<div class="pict-fb-icon-item{~D:Record.SelectedClass~}" data-index="{~D:Record.Index~}" onclick="{~D:Record.ClickHandler~}" ondblclick="{~D:Record.DblClickHandler~}">\n\t<div class="pict-fb-icon-graphic">{~D:Record.Icon~}</div>\n\t<div class="pict-fb-icon-label">{~D:Record.Name~}</div>\n</div>\n'},{Hash:"FileBrowser-ListIcons-Empty-Template",Template:'<div class="pict-fb-empty">{~D:Record.Message~}</div>'}],Renderables:[{RenderableHash:"ListIcons-Container",TemplateHash:"FileBrowser-ListIcons-Container-Template",DestinationAddress:"#Pict-FileBrowser-ListPane",RenderMethod:"replace"}]};e.exports=class extends i{constructor(t,e,n){super(t,Object.assign({},o,e),n),this._cachedFileList=[]}onAfterRender(t){return this.rebuildGrid(),this.rebuildBreadcrumb(),this.pict.CSSMap.injectCSS(),super.onAfterRender(t)}rebuildGrid(){let t=this.pict.providers["Pict-FileBrowser-List"];if(!t)return;let e=t.getSortedFileList();this._cachedFileList=e;let n=t.getSelectedFile();if(0===e.length){let t=this.pict.parseTemplateByHash("FileBrowser-ListIcons-Empty-Template",{Message:"This folder is empty"});return void this.pict.ContentAssignment.assignContent("#Pict-FileBrowser-IconGrid",t)}let i="";for(let o=0;o<e.length;o++){let r=e[o],s=n&&n.Name===r.Name&&n.Path===r.Path,a={Index:o,Name:r.Name,Icon:t.getEntryIcon(r),SelectedClass:s?" selected":"",ClickHandler:"pict.views['"+this.Hash+"'].selectEntry("+o+")",DblClickHandler:"pict.views['"+this.Hash+"'].openEntry("+o+")"};i+=this.pict.parseTemplateByHash("FileBrowser-ListIcons-Item-Template",a)}this.pict.ContentAssignment.assignContent("#Pict-FileBrowser-IconGrid",i)}rebuildBreadcrumb(){let t=this.getCurrentLocation(),e="";if(e+=this.pict.parseTemplateByHash("FileBrowser-Breadcrumb-Segment-Template",{Label:"🏠",ClickHandler:"pict.views['"+this.Hash+"'].navigateToPath('')"}),t){let n=t.split("/"),i="";for(let t=0;t<n.length;t++)if(i=i?i+"/"+n[t]:n[t],e+=this.pict.parseTemplateByHash("FileBrowser-Breadcrumb-Separator-Template",{}),t===n.length-1)e+=this.pict.parseTemplateByHash("FileBrowser-Breadcrumb-Current-Template",{Label:n[t]});else{let o=i;e+=this.pict.parseTemplateByHash("FileBrowser-Breadcrumb-Segment-Template",{Label:n[t],ClickHandler:"pict.views['"+this.Hash+"'].navigateToPath('"+o+"')"})}}this.pict.ContentAssignment.assignContent("#Pict-FileBrowser-IconBreadcrumb",e)}selectEntry(t){if(t<0||t>=this._cachedFileList.length)return;let e=this.pict.providers["Pict-FileBrowser-List"];e&&e.selectFile(this._cachedFileList[t]),this.rebuildGrid()}openEntry(t){if(t<0||t>=this._cachedFileList.length)return;let e=this.pict.providers["Pict-FileBrowser-List"];e&&e.openEntry(this._cachedFileList[t]),this.rebuildGrid(),this.rebuildBreadcrumb()}navigateToPath(t){let e=this.pict.providers["Pict-FileBrowser-Browse"];e&&e.navigateToFolder(t),this.rebuildGrid(),this.rebuildBreadcrumb()}getCurrentLocation(){let t=(this.options.StateAddresses||{}).CurrentLocation||"AppData.PictFileBrowser.CurrentLocation";return this.pict.manifest.getValueByHash({AppData:this.pict.AppData,Pict:this.pict},t)||""}},e.exports.default_configuration=o},{"pict-view":88}],74:[function(t,e,n){const i=t("pict-view"),o={ViewIdentifier:"Pict-FileBrowser-ViewFileInfo",DefaultRenderable:"ViewFileInfo-Container",DefaultDestinationAddress:"#Pict-FileBrowser-ViewPane",AutoRender:!1,Templates:[{Hash:"FileBrowser-ViewFileInfo-Container-Template",Template:'<div class="pict-fb-fileinfo" id="Pict-FileBrowser-FileInfo"></div>'},{Hash:"FileBrowser-ViewFileInfo-Detail-Template",Template:'\n<div class="pict-fb-fileinfo-title">{~D:Record.Name~}</div>\n<table class="pict-fb-fileinfo-table">\n\t<tr>\n\t\t<td class="pict-fb-fileinfo-label">Type</td>\n\t\t<td class="pict-fb-fileinfo-value">{~D:Record.TypeDescription~}</td>\n\t</tr>\n\t<tr>\n\t\t<td class="pict-fb-fileinfo-label">Size</td>\n\t\t<td class="pict-fb-fileinfo-value">{~D:Record.SizeFormatted~}</td>\n\t</tr>\n\t<tr>\n\t\t<td class="pict-fb-fileinfo-label">Modified</td>\n\t\t<td class="pict-fb-fileinfo-value">{~D:Record.ModifiedFormatted~}</td>\n\t</tr>\n\t<tr>\n\t\t<td class="pict-fb-fileinfo-label">Extension</td>\n\t\t<td class="pict-fb-fileinfo-value">{~D:Record.Extension~}</td>\n\t</tr>\n\t<tr>\n\t\t<td class="pict-fb-fileinfo-label">Path</td>\n\t\t<td class="pict-fb-fileinfo-value">{~D:Record.Path~}</td>\n\t</tr>\n</table>\n'},{Hash:"FileBrowser-ViewFileInfo-Empty-Template",Template:'<div class="pict-fb-fileinfo-none">No file selected</div>'}],Renderables:[{RenderableHash:"ViewFileInfo-Container",TemplateHash:"FileBrowser-ViewFileInfo-Container-Template",DestinationAddress:"#Pict-FileBrowser-ViewPane",RenderMethod:"replace"}]};e.exports=class extends i{constructor(t,e,n){super(t,Object.assign({},o,e),n)}onAfterRender(t){return this.rebuildFileInfo(),this.pict.CSSMap.injectCSS(),super.onAfterRender(t)}rebuildFileInfo(){let t=this.pict.providers["Pict-FileBrowser-View"],e=this.pict.providers["Pict-FileBrowser-List"],n=t?t.getCurrentFile():null;if(!n){let t=this.pict.parseTemplateByHash("FileBrowser-ViewFileInfo-Empty-Template",{});return void this.pict.ContentAssignment.assignContent("#Pict-FileBrowser-FileInfo",t)}let i={Name:n.Name||"Unknown",TypeDescription:t?t.getFileTypeDescription(n):"File",SizeFormatted:e?e.formatFileSize(n.Size):n.Size||"--",ModifiedFormatted:e?e.formatDate(n.Modified):n.Modified||"--",Extension:n.Extension||"--",Path:n.Path||"--"},o=this.pict.parseTemplateByHash("FileBrowser-ViewFileInfo-Detail-Template",i);this.pict.ContentAssignment.assignContent("#Pict-FileBrowser-FileInfo",o)}},e.exports.default_configuration=o},{"pict-view":88}],75:[function(t,e,n){const i=t("pict-view"),o={ViewIdentifier:"Pict-FileBrowser-ViewImage",DefaultRenderable:"ViewImage-Container",DefaultDestinationAddress:"#Pict-FileBrowser-ViewPane",AutoRender:!1,Templates:[{Hash:"FileBrowser-ViewImage-Container-Template",Template:'<div class="pict-fb-image-viewer" id="Pict-FileBrowser-ImageViewer"></div>'},{Hash:"FileBrowser-ViewImage-Display-Template",Template:'<img src="{~D:Record.ImageURL~}" alt="{~D:Record.Name~}" />'},{Hash:"FileBrowser-ViewImage-NoImage-Template",Template:'<div class="pict-fb-image-viewer-none">{~D:Record.Message~}</div>'}],Renderables:[{RenderableHash:"ViewImage-Container",TemplateHash:"FileBrowser-ViewImage-Container-Template",DestinationAddress:"#Pict-FileBrowser-ViewPane",RenderMethod:"replace"}]};e.exports=class extends i{constructor(t,e,n){super(t,Object.assign({},o,e),n)}onAfterRender(t){return this.rebuildImageView(),this.pict.CSSMap.injectCSS(),super.onAfterRender(t)}rebuildImageView(){let t=this.pict.providers["Pict-FileBrowser-View"],e=t?t.getCurrentFile():null;if(!e){let t=this.pict.parseTemplateByHash("FileBrowser-ViewImage-NoImage-Template",{Message:"No file selected"});return void this.pict.ContentAssignment.assignContent("#Pict-FileBrowser-ImageViewer",t)}if(!(!!t&&t.isImage(e))){let t=this.pict.parseTemplateByHash("FileBrowser-ViewImage-NoImage-Template",{Message:"Selected file is not an image"});return void this.pict.ContentAssignment.assignContent("#Pict-FileBrowser-ImageViewer",t)}let n=t?t.getImageURL(e):null;if(!n){let t=this.pict.parseTemplateByHash("FileBrowser-ViewImage-NoImage-Template",{Message:"No image URL available"});return void this.pict.ContentAssignment.assignContent("#Pict-FileBrowser-ImageViewer",t)}let i=this.pict.parseTemplateByHash("FileBrowser-ViewImage-Display-Template",{ImageURL:n,Name:e.Name||"Image"});this.pict.ContentAssignment.assignContent("#Pict-FileBrowser-ImageViewer",i)}},e.exports.default_configuration=o},{"pict-view":88}],76:[function(t,e,n){const i=t("pict-view"),o=t("../Pict-Section-FileBrowser-DefaultConfiguration.js"),r=t("../providers/Pict-Provider-FileBrowserBrowse.js"),s=t("../providers/Pict-Provider-FileBrowserList.js"),a=t("../providers/Pict-Provider-FileBrowserView.js"),c=t("../providers/Pict-Provider-FileBrowserLayout.js"),l=t("../providers/Pict-Provider-FileBrowserIcons.js");e.exports=class extends i{constructor(t,e,n){super(t,Object.assign({},JSON.parse(JSON.stringify(o)),e),n),this.pict.providers["Pict-FileBrowser-Browse"]||this.pict.addProvider("Pict-FileBrowser-Browse",r.default_configuration,r),this.pict.providers["Pict-FileBrowser-List"]||this.pict.addProvider("Pict-FileBrowser-List",s.default_configuration,s),this.pict.providers["Pict-FileBrowser-View"]||this.pict.addProvider("Pict-FileBrowser-View",a.default_configuration,a),this.pict.providers["Pict-FileBrowser-Layout"]||this.pict.addProvider("Pict-FileBrowser-Layout",c.default_configuration,c),this.pict.providers["Pict-FileBrowser-Icons"]||this.pict.addProvider("Pict-FileBrowser-Icons",l.default_configuration,l),this.ensureDefaultState()}ensureDefaultState(){let t=this.options.DefaultState||{},e=this.options.StateAddresses||{},n={AppData:this.pict.AppData,Pict:this.pict};this.pict.AppData.PictFileBrowser||(this.pict.AppData.PictFileBrowser={});for(let i in e){let o=e[i],r=this.pict.manifest.getValueByHash(n,o);if(null==r){let e=t[i];void 0!==e&&this.pict.manifest.setValueByHash(n,o,e)}}this.pict.AppData.PictFileBrowser.FileList||(this.pict.AppData.PictFileBrowser.FileList=[]),this.pict.AppData.PictFileBrowser.FolderTree||(this.pict.AppData.PictFileBrowser.FolderTree=[])}onAfterRender(t){return this.pict.CSSMap.injectCSS(),super.onAfterRender(t)}getState(t){let e=(this.options.StateAddresses||{})[t];if(e)return this.pict.manifest.getValueByHash({AppData:this.pict.AppData,Pict:this.pict},e)}setState(t,e){let n=(this.options.StateAddresses||{})[t];n&&this.pict.manifest.setValueByHash({AppData:this.pict.AppData,Pict:this.pict},n,e)}},e.exports.default_configuration=o},{"../Pict-Section-FileBrowser-DefaultConfiguration.js":62,"../providers/Pict-Provider-FileBrowserBrowse.js":64,"../providers/Pict-Provider-FileBrowserIcons.js":65,"../providers/Pict-Provider-FileBrowserLayout.js":66,"../providers/Pict-Provider-FileBrowserList.js":67,"../providers/Pict-Provider-FileBrowserView.js":68,"pict-view":88}],77:[function(t,e,n){arguments[4][45][0].apply(n,arguments)},{"./providers/Pict-Provider-Content.js":78,"./views/Pict-View-Content.js":79,dup:45}],78:[function(t,e,n){arguments[4][46][0].apply(n,arguments)},{dup:46,"pict-provider":58,"pict-section-code":61}],79:[function(t,e,n){const i=t("pict-view");e.exports=class extends i{constructor(t,e,n){super(t,e,n)}displayContent(t,e){let n=e||"Pict-Content-Body";this.pict.ContentAssignment.assignContent("#"+n,t);let i=document.getElementById(n);i&&i.parentElement&&(i.parentElement.scrollTop=0),this.renderMermaidDiagrams(n),this.renderKaTeXEquations(n)}renderMermaidDiagrams(t){if("undefined"==typeof mermaid)return;let e=t||"Pict-Content-Body",n=document.getElementById(e);if(!n)return;let i=n.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",n=document.getElementById(e);if(!n)return;let i=n.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 o=n.querySelectorAll(".pict-content-katex-display");for(let t=0;t<o.length;t++)try{katex.render(o[t].textContent,o[t],{throwOnError:!1,displayMode:!0})}catch(t){this.log.warn("KaTeX display error: "+t.message)}}showLoading(t,e){let n=e||"Pict-Content-Body",i=t||"Loading content...";this.pict.ContentAssignment.assignContent("#"+n,'<div class="pict-content-loading">'+i+"</div>")}},e.exports.default_configuration={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"}]}},{"pict-view":88}],80:[function(t,e,n){e.exports.attach=function(t){t._createEditorInContainer=function(e,n,i){let o=t._codeMirrorModules,r=[];r.push(o.EditorView.domEventHandlers({keydown:(e,i)=>(e.ctrlKey||e.metaKey)&&"b"===e.key?(e.preventDefault(),t.applyFormatting(n,"bold"),!0):(e.ctrlKey||e.metaKey)&&"i"===e.key?(e.preventDefault(),t.applyFormatting(n,"italic"),!0):(e.ctrlKey||e.metaKey)&&"e"===e.key?(e.preventDefault(),t.applyFormatting(n,"code"),!0):void 0,paste:(e,i)=>{let o=e.clipboardData&&e.clipboardData.items;if(!o)return!1;for(let i=0;i<o.length;i++)if(o[i].type.startsWith("image/")){e.preventDefault();let r=o[i].getAsFile();return r&&t._processImageFile(r,n),!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 o=e.dataTransfer.files[0];if(o.type&&o.type.startsWith("image/")){e.preventDefault(),e.stopPropagation(),t._processImageFile(o,n);let r=i.dom.closest(".pict-mde-segment-editor");return r&&r.classList.remove("pict-mde-image-dragover"),!0}return!1}})),o.extensions&&Array.isArray(o.extensions)&&(r=r.concat(o.extensions)),r.push(o.EditorView.updateListener.of(e=>{e.docChanged&&t._onSegmentContentChange(n,e.state.doc.toString()),e.focusChanged&&(e.view.hasFocus?(t._setActiveSegment(n),t._updateSidebarPosition(n)):setTimeout(()=>{if(t._activeSegmentIndex===n){let e=document.getElementById("PictMDE-Segment-".concat(n));e&&!e.contains(document.activeElement)&&(t._clearActiveSegment(n),t._resetSidebarPosition(n))}},100)),e.selectionSet&&e.view.hasFocus&&t._updateSidebarPosition(n)}));let s=t._buildDataURICollapseExtension();s&&r.push(s),t.options.ReadOnly&&(r.push(o.EditorState.readOnly.of(!0)),r.push(o.EditorView.editable.of(!1))),r=t.customConfigureExtensions(r,n);let a=o.EditorState.create({doc:i||"",extensions:r}),c=new o.EditorView({state:a,parent:e});t._segmentEditors[n]=c,c.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=c.state,o=i.selection.main.head,r=i.doc.lineAt(o),s=o-r.from;if("ArrowDown"===e.key){if(r.to<i.doc.length)return;let o=t._getOrderedSegmentIndices(),a=t._getLogicalIndex(n);if(a<0||a>=o.length-1)return;let c=o[a+1],l=t._segmentEditors[c];if(!l)return;e.preventDefault(),e.stopPropagation();let d=l.state.doc.line(1),p=Math.min(s,d.to-d.from);l.focus(),l.dispatch({selection:{anchor:d.from+p}}),t._setActiveSegment(c)}else if("ArrowUp"===e.key){if(r.number>1)return;let i=t._getOrderedSegmentIndices(),o=t._getLogicalIndex(n);if(o<=0)return;let a=i[o-1],c=t._segmentEditors[a];if(!c)return;e.preventDefault(),e.stopPropagation();let l=c.state.doc.line(c.state.doc.lines),d=Math.min(s,l.to-l.from);c.focus(),c.dispatch({selection:{anchor:l.from+d}}),t._setActiveSegment(a)}},!0),c.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,n);let o=document.getElementById("PictMDE-SegmentEditor-".concat(n));o&&o.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 n=e.Decoration,i=e.ViewPlugin,o=e.WidgetType;class r extends o{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 s(t){let e=[],i=t.state.doc;for(let o of t.visibleRanges){let t,s=o.from,a=o.to,c=i.sliceString(s,a),l=/!\[[^\]]*\]\(data:([^;]+);base64,/g;for(;null!==(t=l.exec(c));){let o=s+t.index+t[0].length,a=-1,c=o,l=i.length,d=Math.min(l,c+5242880),p=4096;for(let t=c;t<d;t+=p){let e=Math.min(t+p,d),n=i.sliceString(t,e).indexOf(")");if(n>=0){a=t+n;break}}if(a<0)continue;let h=a-o;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="…".concat(u,")"),m=n.replace({widget:new r(g)});e.push(m.range(o,a+1))}}return n.set(e,!0)}return i.fromClass(class{constructor(t){this.decorations=s(t)}update(t){(t.docChanged||t.viewportChanged)&&(this.decorations=s(t.view))}},{decorations:t=>t.decorations})}}},{}],81:[function(t,e,n){e.exports.attach=function(t){t._wireSegmentDragEvents=function(e,n){let i=e.querySelector(".pict-mde-drag-handle");i&&(i.addEventListener("dragstart",i=>{t._dragSourceIndex=n,i.dataTransfer.effectAllowed="move",i.dataTransfer.setData("text/plain",String(n));let o=t._getContainerElement();o&&o.classList.add("pict-mde-dragging"),setTimeout(()=>{e.style.opacity="0.4"},0)}),i.addEventListener("dragend",()=>{e.style.opacity="",t._dragSourceIndex=-1,t._clearAllDropIndicators();let n=t._getContainerElement();n&&n.classList.remove("pict-mde-dragging")}),e.addEventListener("dragover",n=>{n.preventDefault(),n.dataTransfer.dropEffect="move",t._clearAllDropIndicators();let i=e.getBoundingClientRect(),o=i.top+i.height/2;n.clientY<o?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 o=e.classList.contains("pict-mde-drag-over-bottom");t._clearAllDropIndicators();let r=t._dragSourceIndex;r<0||r===n||t._reorderSegment(r,n,o)}))},t._clearAllDropIndicators=function(){let e=t._getContainerElement();if(!e)return;let n=e.querySelectorAll(".pict-mde-segment");for(let t=0;t<n.length;t++)n[t].classList.remove("pict-mde-drag-over-top"),n[t].classList.remove("pict-mde-drag-over-bottom")},t._reorderSegment=function(e,n,i){let o=t._getLogicalIndex(e),r=t._getLogicalIndex(n);if(o<0||r<0)return void t.log.warn("PICT-MarkdownEditor _reorderSegment: could not resolve logical indices (from=".concat(o,", to=").concat(r,")."));if(o===r)return;t._marshalAllEditorsToData();let s=t._getSegmentsFromData();if(!s||s.length<2)return;let a=i?r+1:r;if(o<a&&a--,a===o)return;let c=s.splice(o,1)[0];s.splice(a,0,c),t._setSegmentsToData(s),t._reorderHiddenPreviewState(o,a),t._reorderSegmentTabStates(o,a),t._buildEditorUI()},t._reorderHiddenPreviewState=function(e,n){if(e===n)return;let i=Object.keys(t._hiddenPreviewSegments).map(t=>parseInt(t,10));if(0===i.length)return;let o=Math.max(...i,e,n),r=[];for(let e=0;e<=o;e++)r.push(!!t._hiddenPreviewSegments[e]);let s=r.splice(e,1)[0];r.splice(n,0,s),t._hiddenPreviewSegments={};for(let e=0;e<r.length;e++)r[e]&&(t._hiddenPreviewSegments[e]=!0)},t._swapHiddenPreviewState=function(e,n){let i=!!t._hiddenPreviewSegments[e];!!t._hiddenPreviewSegments[n]?t._hiddenPreviewSegments[e]=!0:delete t._hiddenPreviewSegments[e],i?t._hiddenPreviewSegments[n]=!0:delete t._hiddenPreviewSegments[n]},t._reorderSegmentTabStates=function(e,n){if(e===n)return;let i=Object.keys(t._segmentTabStates).map(t=>parseInt(t,10));if(0===i.length)return;let o=Math.max(...i,e,n),r=[];for(let e=0;e<=o;e++)r.push(t._segmentTabStates[e]||"editor");let s=r.splice(e,1)[0];r.splice(n,0,s),t._segmentTabStates={};for(let e=0;e<r.length;e++)"editor"!==r[e]&&(t._segmentTabStates[e]=r[e])},t._swapSegmentTabStates=function(e,n){let i=t._segmentTabStates[e]||"editor",o=t._segmentTabStates[n]||"editor";"editor"!==o?t._segmentTabStates[e]=o:delete t._segmentTabStates[e],"editor"!==i?t._segmentTabStates[n]=i:delete t._segmentTabStates[n]},t._setActiveSegment=function(e){if(t._activeSegmentIndex>=0&&t._activeSegmentIndex!==e){let e=document.getElementById("PictMDE-Segment-".concat(t._activeSegmentIndex));e&&e.classList.remove("pict-mde-active")}t._activeSegmentIndex=e;let n=document.getElementById("PictMDE-Segment-".concat(e));n&&n.classList.add("pict-mde-active")},t._clearActiveSegment=function(e){t._activeSegmentIndex===e&&(t._activeSegmentIndex=-1);let n=document.getElementById("PictMDE-Segment-".concat(e));n&&n.classList.remove("pict-mde-active"),t._resetSidebarPosition(e)},t._updateSidebarPosition=function(e){let n=document.getElementById("PictMDE-Segment-".concat(e));if(!n)return;let i=n.querySelector(".pict-mde-quadrant-tr");if(!i)return;let o=t._segmentEditors[e];if(!o)return;let r=o.state.selection.main.head,s=o.coordsAtPos(r);if(!s)return void t._resetSidebarPosition(e);let a=n.getBoundingClientRect(),c=s.top-a.top,l=i.offsetHeight||0,d=n.offsetHeight||0,p=Math.max(0,d-l);c=Math.max(0,Math.min(c,p)),i.classList.add("pict-mde-sidebar-at-cursor"),i.style.setProperty("--pict-mde-sidebar-top","".concat(c,"px"))},t._resetSidebarPosition=function(t){let e=document.getElementById("PictMDE-Segment-".concat(t));if(!e)return;let n=e.querySelector(".pict-mde-quadrant-tr");n&&(n.classList.remove("pict-mde-sidebar-at-cursor"),n.style.removeProperty("--pict-mde-sidebar-top"))}}},{}],82:[function(t,e,n){const i={bold:{wrap:"**"},italic:{wrap:"*"},code:{wrap:"`"},heading:{prefix:"# "},link:{before:"[",after:"](url)"}};e.exports.attach=function(t){t.applyFormatting=function(e,n){let o=t._segmentEditors[e];if(!o)return void t.log.warn("PICT-MarkdownEditor applyFormatting: no editor for segment ".concat(e,"."));let r=i[n];if(!r)return void t.log.warn('PICT-MarkdownEditor applyFormatting: unknown format type "'.concat(n,'".'));let s,a,c=o.state,l=c.selection.main,d=l.from,p=l.to,h=d!==p,u=h?c.sliceDoc(d,p):"";if(r.wrap){let t=r.wrap;if(h){let e=c.sliceDoc(Math.max(0,d-t.length),d),n=c.sliceDoc(p,Math.min(c.doc.length,p+t.length));if(e===t&&n===t)return s=[{from:d-t.length,to:d,insert:""},{from:p,to:p+t.length,insert:""}],a=d-t.length,void o.dispatch({changes:s,selection:{anchor:a,head:a+u.length}});s={from:d,to:p,insert:t+u+t},a=d+t.length,o.dispatch({changes:s,selection:{anchor:a,head:a+u.length}})}else{s={from:d,insert:t+t},a=d+t.length,o.dispatch({changes:s,selection:{anchor:a}})}}else if(r.prefix){let t=c.doc.lineAt(d);s=t.text.startsWith(r.prefix)?{from:t.from,to:t.from+r.prefix.length,insert:""}:{from:t.from,insert:r.prefix},o.dispatch({changes:s})}else if(r.before&&r.after)if(h){s={from:d,to:p,insert:r.before+u+r.after},a=d+r.before.length+u.length+2,o.dispatch({changes:s,selection:{anchor:a,head:a+3}})}else{s={from:d,insert:r.before+r.after},a=d+r.before.length,o.dispatch({changes:s,selection:{anchor:a}})}o.focus()}}},{}],83:[function(t,e,n){e.exports.attach=function(t){t.openImagePicker=function(e){let n=document.getElementById("PictMDE-ImageInput-".concat(e));n?(n.onchange=()=>{n.files&&n.files.length>0&&t._processImageFile(n.files[0],e),n.value=""},n.click()):t.log.warn("PICT-MarkdownEditor openImagePicker: file input not found for segment ".concat(e,"."))},t._processImageFile=function(e,n){if(!e||!e.type||!e.type.startsWith("image/"))return void t.log.warn("PICT-MarkdownEditor _processImageFile: not an image file (type: ".concat(e?e.type:"null",")."));let i=e.name?e.name.replace(/\.[^.]+$/,""):"image";if(t.onImageUpload(e,n,(e,o)=>{e?t.log.error("PICT-MarkdownEditor image upload error: ".concat(e)):o&&t._insertImageMarkdown(n,o,i)}))return;if("undefined"==typeof FileReader)return void t.log.error("PICT-MarkdownEditor _processImageFile: FileReader not available in this environment.");let o=new FileReader;o.onload=()=>{t._insertImageMarkdown(n,o.result,i)},o.onerror=()=>{t.log.error("PICT-MarkdownEditor _processImageFile: FileReader error.")},o.readAsDataURL(e)},t._insertImageMarkdown=function(e,n,i){let o=t._segmentEditors[e];if(!o)return void t.log.warn("PICT-MarkdownEditor _insertImageMarkdown: no editor for segment ".concat(e,"."));let r=".concat(n,")"),s=o.state.selection.main.head;o.dispatch({changes:{from:s,insert:r},selection:{anchor:s+r.length}}),o.focus(),t._updateImagePreviews(e)},t._updateImagePreviews=function(e){let n=document.getElementById("PictMDE-ImagePreview-".concat(e));if(!n)return;let i=t._segmentEditors[e];if(!i)return n.innerHTML="",void n.classList.remove("pict-mde-has-images");let o,r=i.state.doc.toString(),s=/!\[([^\]]*)\]\(([^)]+)\)/g,a=[];for(;null!==(o=s.exec(r));)a.push({alt:o[1]||"image",url:o[2]});if(0===a.length)return n.innerHTML="",void n.classList.remove("pict-mde-has-images");let c="";for(let e=0;e<a.length;e++){let n=a[e].alt.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,"""),i=t._resolveImageURL(a[e].url).replace(/&/g,"&").replace(/"/g,""");c+='<div class="pict-mde-image-preview-item"><img src="'.concat(i,'" alt="').concat(n,'" /><span class="pict-mde-image-preview-label">').concat(n,"</span></div>")}n.innerHTML=c,n.classList.add("pict-mde-has-images")},t._wireImageDragEvents=function(e,n){e.addEventListener("dragover",n=>{t._dragSourceIndex>=0||!n.dataTransfer||!n.dataTransfer.types||n.dataTransfer.types.indexOf("Files")<0||(n.preventDefault(),n.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 o=i.dataTransfer.files[0];o.type&&o.type.startsWith("image/")&&(i.preventDefault(),i.stopPropagation(),t._processImageFile(o,n))})}}},{}],84:[function(t,e,n){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 n=document.getElementById("PictMDE-RichPreview-".concat(e));if(!n)return;let i=t._segmentEditors[e];if(!i)return n.innerHTML="",void n.classList.remove("pict-mde-has-rich-preview");let o=i.state.doc.toString();if(!o||0===o.trim().length)return n.innerHTML="",void n.classList.remove("pict-mde-has-rich-preview");let r=t._getContentProvider().parseMarkdown(o);if(!r||0===r.trim().length)return n.innerHTML="",void n.classList.remove("pict-mde-has-rich-preview");let s="PictMDE-RichPreviewBody-".concat(e);if(n.innerHTML='<div class="pict-content" id="'.concat(s,'">').concat(r,"</div>"),n.classList.add("pict-mde-has-rich-preview"),t.options.ImageBaseURL){let e=n.querySelectorAll("img");for(let n=0;n<e.length;n++){let i=e[n].getAttribute("src");if(i){let o=t._resolveImageURL(i);o!==i&&e[n].setAttribute("src",o)}}}let a=(t._richPreviewGenerations[e]||0)+1;t._richPreviewGenerations[e]=a,t._postRenderMermaid(s,e,a),t._postRenderKaTeX(s)},t._postRenderMermaid=function(e,n,i){if("undefined"==typeof mermaid)return;let o=document.getElementById(e);if(!o)return;let r=o.querySelectorAll("pre.mermaid");if(!(r.length<1))try{let e=mermaid.run({nodes:r});e&&"function"==typeof e.catch&&e.catch(e=>{(-1===n?t._renderedViewGeneration:t._richPreviewGenerations[n])===i&&t.log.warn("PICT-MarkdownEditor mermaid render error: ".concat(e.message||e))})}catch(e){t.log.warn("PICT-MarkdownEditor mermaid render error: ".concat(e.message||e))}},t._postRenderKaTeX=function(e){if("undefined"==typeof katex)return;let n=document.getElementById(e);if(!n)return;let i=n.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: ".concat(e.message||e))}let o=n.querySelectorAll(".pict-content-katex-display");for(let e=0;e<o.length;e++)try{katex.render(o[e].textContent,o[e],{throwOnError:!1,displayMode:!0})}catch(e){t.log.warn("PICT-MarkdownEditor KaTeX display error: ".concat(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 n=t._getSegmentsFromData(),i="";if(n&&n.length>0){let t=[];for(let e=0;e<n.length;e++)t.push(n[e].Content||"");i=t.join("\n\n")}for(let e in t._segmentEditors)t._segmentEditors[e]&&t._segmentEditors[e].destroy();t._segmentEditors={};let o=t._getContentProvider().parseMarkdown(i),r="PictMDE-RenderedView";if(e.innerHTML='<div class="pict-mde-rendered-view" id="'.concat(r,'"><div class="pict-content">').concat(o||"","</div></div>"),e.classList.add("pict-mde-rendered-mode"),t.options.ImageBaseURL){let n=e.querySelectorAll(".pict-mde-rendered-view img");for(let e=0;e<n.length;e++){let i=n[e].getAttribute("src");if(i){let o=t._resolveImageURL(i);o!==i&&n[e].setAttribute("src",o)}}}t._renderedViewGeneration++;let s=t._renderedViewGeneration,a=e.querySelector("#".concat(r," .pict-content"));if(a){let e="PictMDE-RenderedViewContent";a.id=e,t._postRenderMermaid(e,-1,s),t._postRenderKaTeX(e)}},t._restoreEditingView=function(){let e=t._getContainerElement();e&&(e.classList.remove("pict-mde-rendered-mode"),t._buildEditorUI())}}},{"pict-section-content":77}],85:[function(t,e,n){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"}},{}],86:[function(t,e,n){const i=t("pict-view"),o=t("pict-section-content"),r=t("./Pict-Section-MarkdownEditor-DefaultConfiguration.js"),s=t("./Pict-MDE-Formatting.js"),a=t("./Pict-MDE-ImageHandling.js"),c=t("./Pict-MDE-DragAndReorder.js"),l=t("./Pict-MDE-RichPreview.js"),d=t("./Pict-MDE-CodeMirror.js");e.exports=class extends i{constructor(t,e,n){super(t,Object.assign({},r,e),n),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,s.attach(this),a.attach(this),c.attach(this),l.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=o.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 [".concat(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.".concat(e);return"_Pict.servicesMap.PictView['".concat(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 n=0;n<e.length;n++)this._renderSegment(t,n,e[n].Content||"");this._renderAddButton(t)}_renderSegment(t,e,n){let i=this._segmentCounter++,o={SegmentIndex:i,SegmentDisplayIndex:e+1,ViewIdentifier:this._viewCallIdentifier},r=this.pict.parseTemplateByHash("MarkdownEditor-Segment",o),s=document.createElement("div");s.innerHTML=r;let a=s.firstElementChild;if(t.appendChild(a),this._buildQuadrantButtons(a,i),this._hiddenPreviewSegments[e]&&a.classList.add("pict-mde-preview-hidden"),"tabbed"===this._previewMode&&"preview"===this._segmentTabStates[e]){a.classList.add("pict-mde-tab-showing-preview");let t=a.querySelector(".pict-mde-tab-bar");if(t){let e=t.querySelector('[data-tab="editor"]'),n=t.querySelector('[data-tab="preview"]');e&&e.classList.remove("pict-mde-tab-active"),n&&n.classList.add("pict-mde-tab-active")}}this._wireSegmentDragEvents(a,i);let c=document.getElementById("PictMDE-SegmentEditor-".concat(i));c&&(this._createEditorInContainer(c,i,n),this._wireImageDragEvents(c,i),n&&(this._updateImagePreviews(i),this._updateRichPreviews(i)))}_buildQuadrantButtons(t,e){let n=[{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 o=0;o<n.length;o++){let r=n[o],s=t.querySelector(r.selector);if(!s)continue;let a=this.options[r.key];if(Array.isArray(a))for(let t=0;t<a.length;t++){let n=a[t],o=document.createElement("button");o.type="button",o.className=r.baseClass,n.Class&&(o.className+=" "+n.Class),o.innerHTML=n.HTML||"",o.title=n.Title||"";let c=n.Action||"",l=c,d=null,p=c.indexOf(":");p>=0&&(l=c.substring(0,p),d=c.substring(p+1)),function(t,e,n){o.addEventListener("click",()=>{"function"==typeof i[t]?null!==e?i[t](n,e):i[t](n):i.log.warn('PICT-MarkdownEditor _buildQuadrantButtons: method "'.concat(t,'" not found.'))})}(l,d,e),s.appendChild(o)}}}customConfigureExtensions(t,e){return t}_renderAddButton(t){let e={ViewIdentifier:this._viewCallIdentifier},n=this.pict.parseTemplateByHash("MarkdownEditor-AddSegment",e),i=document.createElement("div");i.innerHTML=n;let o=i.firstElementChild;t.appendChild(o)}onImageUpload(t,e,n){return!1}toggleControls(t,e){let n=e;"boolean"==typeof t&&(n=t),this._controlsVisible="boolean"==typeof n?n:!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 "'.concat(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"],n=(e.indexOf(this._previewMode)+1)%e.length;this.setPreviewMode(e[n])}switchSegmentTab(t,e){let n=this._getLogicalIndex(t);if(n<0)return;this._segmentTabStates[n]=e;let i=document.getElementById("PictMDE-Segment-".concat(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 o=document.getElementById("PictMDE-TabBar-".concat(t));if(o){let t=o.querySelectorAll(".pict-mde-tab");for(let n=0;n<t.length;n++)t[n].getAttribute("data-tab")===e?t[n].classList.add("pict-mde-tab-active"):t[n].classList.remove("pict-mde-tab-active")}}toggleSegmentPreview(t,e){let n=this._getLogicalIndex(t);if(n<0)return;let i=!!this._hiddenPreviewSegments[n];i="boolean"==typeof e?!e:!i,i?this._hiddenPreviewSegments[n]=!0:delete this._hiddenPreviewSegments[n];let o=document.getElementById("PictMDE-Segment-".concat(t));o&&(i?o.classList.add("pict-mde-preview-hidden"):(o.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 n=this._getLogicalIndex(t);if(n<0)return;let i=this._getSegmentsFromData();if(!i)return;n<i.length&&(i[n].Content=e),this.onContentChange(n,e);let o=this;this._imagePreviewTimers[t]&&clearTimeout(this._imagePreviewTimers[t]),this._imagePreviewTimers[t]=setTimeout(()=>{o._updateImagePreviews(t),delete o._imagePreviewTimers[t]},500),this._richPreviewTimers[t]&&clearTimeout(this._richPreviewTimers[t]),this._richPreviewTimers[t]=setTimeout(()=>{o._updateRichPreviews(t),delete o._richPreviewTimers[t]},500)}onContentChange(t,e){}_getLogicalIndex(t){let e=this._getContainerElement();if(!e)return-1;let n=e.querySelectorAll(".pict-mde-segment");for(let e=0;e<n.length;e++){if(parseInt(n[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"),n=[];for(let t=0;t<e.length;t++)n.push(parseInt(e[t].getAttribute("data-segment-index"),10));return n}addSegment(t){let e="string"==typeof t?t:"",n=this._getSegmentsFromData();n||(n=[]),n.push({Content:e}),this._setSegmentsToData(n),this._buildEditorUI()}removeSegment(t){let e=this._getLogicalIndex(t);if(e<0)return void this.log.warn("PICT-MarkdownEditor removeSegment: segment index ".concat(t," not found."));let n=this._getSegmentsFromData();if(!n||n.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]),n.splice(e,1),this._setSegmentsToData(n);let i={};for(let t in this._hiddenPreviewSegments){let n=parseInt(t,10);n<e?i[n]=!0:n>e&&(i[n-1]=!0)}this._hiddenPreviewSegments=i;let o={};for(let t in this._segmentTabStates){let n=parseInt(t,10);n<e?o[n]=this._segmentTabStates[t]:n>e&&(o[n-1]=this._segmentTabStates[t])}this._segmentTabStates=o,this._buildEditorUI()}moveSegmentUp(t){let e=this._getLogicalIndex(t);if(e<=0)return;this._marshalAllEditorsToData();let n=this._getSegmentsFromData();if(!n)return;let i=n[e];n[e]=n[e-1],n[e-1]=i,this._swapHiddenPreviewState(e,e-1),this._swapSegmentTabStates(e,e-1),this._buildEditorUI()}moveSegmentDown(t){let e=this._getLogicalIndex(t),n=this._getSegmentsFromData();if(!n||e<0||e>=n.length-1)return;this._marshalAllEditorsToData();let i=n[e];n[e]=n[e+1],n[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 n=e[t],i=this._segmentEditors[n];return i?i.state.doc.toString():""}setSegmentContent(t,e){let n=this._getOrderedSegmentIndices();if(t<0||t>=n.length)return void this.log.warn("PICT-MarkdownEditor setSegmentContent: index ".concat(t," out of range."));let i=n[t],o=this._segmentEditors[i];o&&o.dispatch({changes:{from:0,to:o.state.doc.length,insert:e}})}getSegmentCount(){return this._getOrderedSegmentIndices().length}getAllContent(t){let e="string"==typeof t?t:"\n\n",n=this._getOrderedSegmentIndices(),i=[];for(let t=0;t<n.length;t++){let e=this._segmentEditors[n[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 n=0;n<e.length;n++){let i=this._segmentEditors[e[n]];i&&n<t.length&&(t[n].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=r},{"./Pict-MDE-CodeMirror.js":80,"./Pict-MDE-DragAndReorder.js":81,"./Pict-MDE-Formatting.js":82,"./Pict-MDE-ImageHandling.js":83,"./Pict-MDE-RichPreview.js":84,"./Pict-Section-MarkdownEditor-DefaultConfiguration.js":85,"pict-section-content":77,"pict-view":88}],87:[function(t,e,n){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"}}},{}],88:[function(t,e,n){const i=t("fable-serviceproviderbase"),o=t("../package.json"),r={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,n){super(t,Object.assign({},JSON.parse(JSON.stringify(r)),e),n),this.fable,this.options,this.UUID,this.Hash,this.log;const i=this.Hash===this.UUID;this.UUID="V-".concat(this.UUID),i&&(this.Hash=this.UUID),this.options.ViewIdentifier||(this.options.ViewIdentifier="AutoViewID-".concat(this.fable.getUUID())),this.serviceType="PictView",this._Package=o,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 [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," options object.")),this.pict.TemplateProvider.addTemplate(e.Hash,e.Template,e.Source)):this.log.error("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," could not load Template ").concat(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 [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," options object.")),this.pict.TemplateProvider.addDefaultTemplate(e.Prefix,e.Postfix,e.Template,e.Source)):this.log.error("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," could not load Default Template ").concat(t," in the options array."),e)}if(this.options.CSS){let t=this.options.CSSHash?this.options.CSSHash:"View-".concat(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,n,i,o){let r;if("object"==typeof t)r=t;else{r={RenderableHash:t,TemplateHash:e,DefaultTemplateRecordAddress:n,ContentDestinationAddress:i,RenderMethod:"string"!=typeof o?o:"replace"}}"string"!=typeof r.RenderableHash||"string"!=typeof r.TemplateHash?this.log.error("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," could not load Renderable; RenderableHash or TemplateHash are invalid."),r):(this.pict.LogNoisiness>0&&this.log.trace("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," adding renderable [").concat(r.RenderableHash,"] pointed to template ").concat(r.TemplateHash,".")),this.renderables[r.RenderableHash]=r)}onBeforeInitialize(){return this.pict.LogNoisiness>3&&this.log.trace("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," onBeforeInitialize:")),!0}onBeforeInitializeAsync(t){return this.onBeforeInitialize(),t()}onInitialize(){return this.pict.LogNoisiness>3&&this.log.trace("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," onInitialize:")),!0}onInitializeAsync(t){return this.onInitialize(),t()}initialize(){return this.pict.LogControlFlow&&this.log.trace("PICT-ControlFlow VIEW [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," initialize:")),this.initializeTimestamp?(this.log.warn("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(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 [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," initializeAsync:")),this.initializeTimestamp)return this.log.warn("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(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 [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(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 [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," initialization failed: ").concat(e.message||e),{stack:e.stack}),this.initializeTimestamp=this.pict.log.getTimeStamp(),this.pict.LogNoisiness>0&&this.log.info("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," initialization complete.")),t()))}}onAfterInitialize(){return this.pict.LogNoisiness>3&&this.log.trace("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," onAfterInitialize:")),!0}onAfterInitializeAsync(t){return this.onAfterInitialize(),t()}onBeforeRender(t){return this.pict.LogNoisiness>3&&this.log.trace("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," onBeforeRender:")),!0}onBeforeRenderAsync(t,e){return this.onBeforeRender(e),t()}onBeforeProject(t){return this.pict.LogNoisiness>3&&this.log.trace("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," onBeforeProject:")),!0}onBeforeProjectAsync(t,e){return this.onBeforeProject(e),t()}buildRenderOptions(t,e,n){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 [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," could not find a suitable RenderableHash ").concat(i.RenderableHash," (param ").concat(t,"because it is not a valid renderable.")),i.Valid=!1),i.Renderable=this.renderables[i.RenderableHash],i.Renderable||(this.log.error("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," could not render ").concat(i.RenderableHash," (param ").concat(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 [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," could not render ").concat(i.RenderableHash," (param ").concat(t,") because it does not have a valid destination address (param ").concat(e,").")),i.Valid=!1),"object"==typeof n?(i.RecordAddress="Passed in as object",i.Record=n):(i.RecordAddress="string"==typeof n?n:"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,n){return this.pict.ContentAssignment.projectContent(t.RenderMethod,e,n,t.TestAddress)}render(t,e,n,i){return this.renderWithScope(this,t,e,n,i)}renderWithScope(t,e,n,i,o){let r,s,a,c="string"==typeof e?e:"string"==typeof this.options.DefaultRenderable&&this.options.DefaultRenderable;return c?("__Virtual"==c?r={RenderableHash:"__Virtual",TemplateHash:this.renderables[this.options.DefaultRenderable].TemplateHash,ContentDestinationAddress:"string"==typeof n?n:"string"==typeof r.ContentDestinationAddress?r.ContentDestinationAddress:"string"==typeof this.options.DefaultDestinationAddress?this.options.DefaultDestinationAddress:null,RenderMethod:"virtual-assignment",TransactionHash:o&&o.TransactionHash,RootRenderableViewHash:o&&o.RootRenderableViewHash}:(r=Object.assign({},this.renderables[c]),r.ContentDestinationAddress="string"==typeof n?n:"string"==typeof r.ContentDestinationAddress?r.ContentDestinationAddress:"string"==typeof this.options.DefaultDestinationAddress?this.options.DefaultDestinationAddress:null),r.TransactionHash||(r.TransactionHash="ViewRender-V-".concat(this.options.ViewIdentifier,"-R-").concat(c,"-U-").concat(this.pict.getUUID()),r.RootRenderableViewHash=this.Hash,this.pict.TransactionTracking.registerTransaction(r.TransactionHash)),r?r.ContentDestinationAddress?("object"==typeof i?(a=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,a="string"==typeof s?this.pict.DataProvider.getDataByAddress(s):void 0),this.onBeforeRender(r),this.pict.LogControlFlow&&this.log.trace("PICT-ControlFlow VIEW [".concat(this.UUID,"]::[").concat(this.Hash,"] Renderable[").concat(c,"] Destination[").concat(r.ContentDestinationAddress,"] TemplateRecordAddress[").concat(s,"] render:")),this.pict.LogNoisiness>0&&this.log.trace("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," Beginning Render of Renderable[").concat(c,"] to Destination [").concat(r.ContentDestinationAddress,"]...")),r.Content=this.pict.parseTemplateByHash(r.TemplateHash,a,null,[this],t,{RootRenderable:"object"==typeof o?o:r}),this.pict.LogNoisiness>0&&this.log.trace("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," Assigning Renderable[").concat(c,"] content length ").concat(r.Content.length," to Destination [").concat(r.ContentDestinationAddress,"] using render method [").concat(r.RenderMethod,"].")),this.onBeforeProject(r),this.onProject(r),"virtual-assignment"!==r.RenderMethod&&(this.onAfterProject(r),this.onAfterRender(r)),!0):(this.log.error("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," could not render ").concat(c," (param ").concat(e,") because it does not have a valid destination address.")),!1):(this.log.error("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," could not render ").concat(c," (param ").concat(e,") because it does not exist.")),!1)):(this.log.error("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," could not render ").concat(c," (param ").concat(e,") because it is not a valid renderable.")),!1)}renderAsync(t,e,n,i,o){return this.renderWithScopeAsync(this,t,e,n,i,o)}renderWithScopeAsync(t,e,n,i,o,r){let s,a,c,l="string"==typeof e?e:"string"==typeof this.options.DefaultRenderable&&this.options.DefaultRenderable,d="function"==typeof r?r:"function"==typeof i?i:"function"==typeof n?n:"function"==typeof e?e:"function"==typeof o?o:null;if(d||(this.log.warn("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(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 [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.Name," renderAsync Auto Callback Error: ").concat(t),t)}),!l)return this.log.error("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," could not asynchronously render ").concat(l," (param ").concat(e,"because it is not a valid renderable.")),d(new Error("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," could not asynchronously render ").concat(l," (param ").concat(e,"because it is not a valid renderable.")));if("__Virtual"==l?s={RenderableHash:"__Virtual",TemplateHash:this.renderables[this.options.DefaultRenderable].TemplateHash,ContentDestinationAddress:"string"==typeof n?n:"string"==typeof this.options.DefaultDestinationAddress?this.options.DefaultDestinationAddress:null,RenderMethod:"virtual-assignment",TransactionHash:o&&"function"!=typeof o&&o.TransactionHash,RootRenderableViewHash:o&&"function"!=typeof o&&o.RootRenderableViewHash}:(s=Object.assign({},this.renderables[l]),s.ContentDestinationAddress="string"==typeof n?n:"string"==typeof s.ContentDestinationAddress?s.ContentDestinationAddress:"string"==typeof this.options.DefaultDestinationAddress?this.options.DefaultDestinationAddress:null),s.TransactionHash||(s.TransactionHash="ViewRender-V-".concat(this.options.ViewIdentifier,"-R-").concat(l,"-U-").concat(this.pict.getUUID()),s.RootRenderableViewHash=this.Hash,this.pict.TransactionTracking.registerTransaction(s.TransactionHash)),!s)return this.log.error("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," could not render ").concat(l," (param ").concat(e,") because it does not exist.")),d(new Error("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," could not render ").concat(l," (param ").concat(e,") because it does not exist.")));if(!s.ContentDestinationAddress)return this.log.error("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," could not render ").concat(l," (param ").concat(e,") because it does not have a valid destination address.")),d(new Error("Could not render ".concat(l)));"object"==typeof i?(c=i,a="Passed in as object"):(a="string"==typeof i?i:"string"==typeof s.DefaultTemplateRecordAddress?s.DefaultTemplateRecordAddress:"string"==typeof this.options.DefaultTemplateRecordAddress&&this.options.DefaultTemplateRecordAddress,c="string"==typeof a?this.pict.DataProvider.getDataByAddress(a):void 0),this.pict.LogControlFlow&&this.log.trace("PICT-ControlFlow VIEW [".concat(this.UUID,"]::[").concat(this.Hash,"] Renderable[").concat(l,"] Destination[").concat(s.ContentDestinationAddress,"] TemplateRecordAddress[").concat(a,"] renderAsync:")),this.pict.LogNoisiness>2&&this.log.trace("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," Beginning Asynchronous Render (callback-style)..."));let p=this.fable.newAnticipate();p.anticipate(t=>{this.onBeforeRenderAsync(t,s)}),p.anticipate(n=>{this.pict.parseTemplateByHash(s.TemplateHash,c,(t,i)=>t?(this.log.error("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," could not render (asynchronously) ").concat(l," (param ").concat(e,") because it did not parse the template."),t),n(t)):(s.Content=i,n()),[this],t,{RootRenderable:"object"==typeof o?o:s})}),p.anticipate(t=>{this.onBeforeProjectAsync(t,s)}),p.anticipate(t=>{this.onProjectAsync(t,s)}),"virtual-assignment"!==s.RenderMethod&&(p.anticipate(t=>{this.onAfterProjectAsync(t,s)}),p.anticipate(t=>{this.onAfterRenderAsync(t,s)})),p.wait(d)}renderDefaultAsync(t){this.renderAsync(t)}basicRender(t,e,n){return this.basicRenderWithScope(this,t,e,n)}basicRenderWithScope(t,e,n,i){let o=this.buildRenderOptions(e,n,i);return o.Valid?(this.assignRenderContent(o.Renderable,o.DestinationAddress,this.pict.parseTemplateByHash(o.Renderable.TemplateHash,o.Record,null,[this],t,{RootRenderable:o.Renderable})),!0):(this.log.error("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," could not perform a basic render of ").concat(o.RenderableHash," because it is not valid.")),!1)}basicRenderAsync(t,e,n,i){return this.basicRenderWithScopeAsync(this,t,e,n,i)}basicRenderWithScopeAsync(t,e,n,i,o){let r="function"==typeof o?o:"function"==typeof i?i:"function"==typeof n?n:"function"==typeof e?e:null;r||(this.log.warn("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.Name," basicRenderAsync was called without a valid callback. A callback will be generated but this could lead to race conditions.")),r=t=>{t&&this.log.error("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.Name," basicRenderAsync Auto Callback Error: ").concat(t),t)});const s=this.buildRenderOptions(e,n,i);if(!s.Valid){let t="PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," could not perform a basic render of ").concat(s.RenderableHash," because it is not valid.");return this.log.error(t),r(new Error(t))}this.pict.parseTemplateByHash(s.Renderable.TemplateHash,s.Record,(t,e)=>t?(this.log.error("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," could not render (asynchronously) ").concat(s.RenderableHash," because it did not parse the template."),t),r(t)):(this.assignRenderContent(s.Renderable,s.DestinationAddress,e),r()),[this],t,{RootRenderable:s.Renderable})}onProject(t){this.pict.LogNoisiness>3&&this.log.trace("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(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 [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," Assigning Renderable[").concat(t.RenderableHash,"] content length ").concat(t.Content.length," to Destination [").concat(t.ContentDestinationAddress,"] using Async render method ").concat(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 [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," onAfterRender:")),t&&t.RootRenderableViewHash===this.Hash){const e=this.pict.TransactionTracking.clearTransactionQueue(t.TransactionHash)||[];for(const n of e){const e=this.pict.views[n.Data.ViewHash];e?(e.onAfterProject(),e.onAfterRender(n.Data.Renderable)):this.log.error("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," onAfterRender: Could not find view for transaction hash ").concat(t.TransactionHash," and ViewHash ").concat(n.Data.ViewHash,"."))}}return!0}onAfterRenderAsync(t,e){this.onAfterRender(e);const n=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?(n.anticipate(t.onAfterProjectAsync.bind(t)),n.anticipate(e=>{t.onAfterRenderAsync(e,i.Data.Renderable)})):this.log.error("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," onAfterRenderAsync: Could not find view for transaction hash ").concat(e.TransactionHash," and ViewHash ").concat(i.Data.ViewHash,"."))}}return n.wait(t)}onAfterProject(t){return this.pict.LogNoisiness>3&&this.log.trace("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," onAfterProject:")),!0}onAfterProjectAsync(t,e){return t()}onBeforeSolve(){return this.pict.LogNoisiness>3&&this.log.trace("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," onBeforeSolve:")),!0}onBeforeSolveAsync(t){return this.onBeforeSolve(),t()}onSolve(){return this.pict.LogNoisiness>3&&this.log.trace("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," onSolve:")),!0}onSolveAsync(t){return this.onSolve(),t()}solve(){return this.pict.LogNoisiness>2&&this.log.trace("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(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"),n="function"==typeof t?t:null;n||(this.log.warn("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.Name," solveAsync was called without a valid callback. A callback will be generated but this could lead to race conditions.")),n=t=>{t&&this.log.error("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.Name," solveAsync Auto Callback Error: ").concat(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 [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," solveAsync() complete.")),this.lastSolvedTimestamp=this.pict.log.getTimeStamp(),n(t)))}onAfterSolve(){return this.pict.LogNoisiness>3&&this.log.trace("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," onAfterSolve:")),!0}onAfterSolveAsync(t){return this.onAfterSolve(),t()}onBeforeMarshalFromView(){return this.pict.LogNoisiness>3&&this.log.trace("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," onBeforeMarshalFromView:")),!0}onBeforeMarshalFromViewAsync(t){return this.onBeforeMarshalFromView(),t()}onMarshalFromView(){return this.pict.LogNoisiness>3&&this.log.trace("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," onMarshalFromView:")),!0}onMarshalFromViewAsync(t){return this.onMarshalFromView(),t()}marshalFromView(){return this.pict.LogNoisiness>2&&this.log.trace("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(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"),n="function"==typeof t?t:null;n||(this.log.warn("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.Name," marshalFromViewAsync was called without a valid callback. A callback will be generated but this could lead to race conditions.")),n=t=>{t&&this.log.error("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.Name," marshalFromViewAsync Auto Callback Error: ").concat(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 [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," marshalFromViewAsync() complete.")),this.lastMarshalFromViewTimestamp=this.pict.log.getTimeStamp(),n(t)))}onAfterMarshalFromView(){return this.pict.LogNoisiness>3&&this.log.trace("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," onAfterMarshalFromView:")),!0}onAfterMarshalFromViewAsync(t){return this.onAfterMarshalFromView(),t()}onBeforeMarshalToView(){return this.pict.LogNoisiness>3&&this.log.trace("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," onBeforeMarshalToView:")),!0}onBeforeMarshalToViewAsync(t){return this.onBeforeMarshalToView(),t()}onMarshalToView(){return this.pict.LogNoisiness>3&&this.log.trace("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," onMarshalToView:")),!0}onMarshalToViewAsync(t){return this.onMarshalToView(),t()}marshalToView(){return this.pict.LogNoisiness>2&&this.log.trace("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(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"),n="function"==typeof t?t:null;n||(this.log.warn("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.Name," marshalToViewAsync was called without a valid callback. A callback will be generated but this could lead to race conditions.")),n=t=>{t&&this.log.error("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.Name," marshalToViewAsync Auto Callback Error: ").concat(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 [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," marshalToViewAsync() complete.")),this.lastMarshalToViewTimestamp=this.pict.log.getTimeStamp(),n(t)))}onAfterMarshalToView(){return this.pict.LogNoisiness>3&&this.log.trace("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," onAfterMarshalToView:")),!0}onAfterMarshalToViewAsync(t){return this.onAfterMarshalToView(),t()}get isPictView(){return!0}}},{"../package.json":87,"fable-serviceproviderbase":20}],89:[function(t,e,n){var i,o,r=e.exports={};function s(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function c(t){if(i===setTimeout)return setTimeout(t,0);if((i===s||!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:s}catch(t){i=s}try{o="function"==typeof clearTimeout?clearTimeout:a}catch(t){o=a}}();var l,d=[],p=!1,h=-1;function u(){p&&l&&(p=!1,l.length?d=l.concat(d):h=-1,d.length&&f())}function f(){if(!p){var t=c(u);p=!0;for(var e=d.length;e;){for(l=d,d=[];++h<e;)l&&l[h].run();h=-1,e=d.length}l=null,p=!1,function(t){if(o===clearTimeout)return clearTimeout(t);if((o===a||!o)&&clearTimeout)return o=clearTimeout,clearTimeout(t);try{return o(t)}catch(e){try{return o.call(null,t)}catch(e){return o.call(this,t)}}}(t)}}function g(t,e){this.fun=t,this.array=e}function m(){}r.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];d.push(new g(t,e)),1!==d.length||p||c(f)},g.prototype.run=function(){this.fun.apply(null,this.array)},r.title="browser",r.browser=!0,r.env={},r.argv=[],r.version="",r.versions={},r.on=m,r.addListener=m,r.once=m,r.off=m,r.removeListener=m,r.removeAllListeners=m,r.emit=m,r.prependListener=m,r.prependOnceListener=m,r.listeners=function(t){return[]},r.binding=function(t){throw new Error("process.binding is not supported")},r.cwd=function(){return"/"},r.chdir=function(t){throw new Error("process.chdir is not supported")},r.umask=function(){return 0}},{}],90:[function(t,e,n){(function(t){(function(){!function(i){var o="object"==typeof n&&n&&!n.nodeType&&n,r="object"==typeof e&&e&&!e.nodeType&&e,s="object"==typeof t&&t;s.global!==s&&s.window!==s&&s.self!==s||(i=s);var a,c,l=2147483647,d=36,p=/^xn--/,h=/[^\x20-\x7E]/,u=/[\x2E\u3002\uFF0E\uFF61]/g,f={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},g=Math.floor,m=String.fromCharCode;function v(t){throw new RangeError(f[t])}function b(t,e){for(var n=t.length,i=[];n--;)i[n]=e(t[n]);return i}function w(t,e){var n=t.split("@"),i="";return n.length>1&&(i=n[0]+"@",t=n[1]),i+b((t=t.replace(u,".")).split("."),e).join(".")}function y(t){for(var e,n,i=[],o=0,r=t.length;o<r;)(e=t.charCodeAt(o++))>=55296&&e<=56319&&o<r?56320==(64512&(n=t.charCodeAt(o++)))?i.push(((1023&e)<<10)+(1023&n)+65536):(i.push(e),o--):i.push(e);return i}function C(t){return b(t,function(t){var e="";return t>65535&&(e+=m((t-=65536)>>>10&1023|55296),t=56320|1023&t),e+=m(t)}).join("")}function x(t){return t-48<10?t-22:t-65<26?t-65:t-97<26?t-97:d}function A(t,e){return t+22+75*(t<26)-((0!=e)<<5)}function D(t,e,n){var i=0;for(t=n?g(t/700):t>>1,t+=g(t/e);t>455;i+=d)t=g(t/35);return g(i+36*t/(t+38))}function E(t){var e,n,i,o,r,s,a,c,p,h,u=[],f=t.length,m=0,b=128,w=72;for((n=t.lastIndexOf("-"))<0&&(n=0),i=0;i<n;++i)t.charCodeAt(i)>=128&&v("not-basic"),u.push(t.charCodeAt(i));for(o=n>0?n+1:0;o<f;){for(r=m,s=1,a=d;o>=f&&v("invalid-input"),((c=x(t.charCodeAt(o++)))>=d||c>g((l-m)/s))&&v("overflow"),m+=c*s,!(c<(p=a<=w?1:a>=w+26?26:a-w));a+=d)s>g(l/(h=d-p))&&v("overflow"),s*=h;w=D(m-r,e=u.length+1,0==r),g(m/e)>l-b&&v("overflow"),b+=g(m/e),m%=e,u.splice(m++,0,b)}return C(u)}function S(t){var e,n,i,o,r,s,a,c,p,h,u,f,b,w,C,x=[];for(f=(t=y(t)).length,e=128,n=0,r=72,s=0;s<f;++s)(u=t[s])<128&&x.push(m(u));for(i=o=x.length,o&&x.push("-");i<f;){for(a=l,s=0;s<f;++s)(u=t[s])>=e&&u<a&&(a=u);for(a-e>g((l-n)/(b=i+1))&&v("overflow"),n+=(a-e)*b,e=a,s=0;s<f;++s)if((u=t[s])<e&&++n>l&&v("overflow"),u==e){for(c=n,p=d;!(c<(h=p<=r?1:p>=r+26?26:p-r));p+=d)C=c-h,w=d-h,x.push(m(A(h+C%w,0))),c=g(C/w);x.push(m(A(c,0))),r=D(n,b,i==o),n=0,++i}++n,++e}return x.join("")}if(a={version:"1.4.1",ucs2:{decode:y,encode:C},decode:E,encode:S,toASCII:function(t){return w(t,function(t){return h.test(t)?"xn--"+S(t):t})},toUnicode:function(t){return w(t,function(t){return p.test(t)?E(t.slice(4).toLowerCase()):t})}},o&&r)if(e.exports==o)r.exports=a;else for(c in a)a.hasOwnProperty(c)&&(o[c]=a[c]);else i.punycode=a}(this)}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],91:[function(t,e,n){var i=String.prototype.replace,o=/%20/g,r="RFC1738",s="RFC3986";e.exports={default:s,formatters:{RFC1738:function(t){return i.call(t,o,"+")},RFC3986:function(t){return String(t)}},RFC1738:r,RFC3986:s}},{}],92:[function(t,e,n){var i=t("./stringify"),o=t("./parse"),r=t("./formats");e.exports={formats:r,parse:o,stringify:i}},{"./formats":91,"./parse":93,"./stringify":94}],93:[function(t,e,n){var i=t("./utils"),o=Object.prototype.hasOwnProperty,r=Array.isArray,s={allowDots:!1,allowEmptyArrays:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decodeDotInKeys:!1,decoder:i.decode,delimiter:"&",depth:5,duplicates:"combine",ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictDepth:!1,strictMerge:!0,strictNullHandling:!1,throwOnLimitExceeded:!1},a=function(t){return t.replace(/&#(\d+);/g,function(t,e){return String.fromCharCode(parseInt(e,10))})},c=function(t,e,n){if(t&&"string"==typeof t&&e.comma&&t.indexOf(",")>-1)return t.split(",");if(e.throwOnLimitExceeded&&n>=e.arrayLimit)throw new RangeError("Array limit exceeded. Only "+e.arrayLimit+" element"+(1===e.arrayLimit?"":"s")+" allowed in an array.");return t},l=function(t,e,n,r){if(t){var s=function(t,e){var n=e.allowDots?t.replace(/\.([^.[]+)/g,"[$1]"):t;if(e.depth<=0){if(!e.plainObjects&&o.call(Object.prototype,n)&&!e.allowPrototypes)return;return[n]}var i=/(\[[^[\]]*])/g,r=/(\[[^[\]]*])/.exec(n),s=r?n.slice(0,r.index):n,a=[];if(s){if(!e.plainObjects&&o.call(Object.prototype,s)&&!e.allowPrototypes)return;a[a.length]=s}for(var c=0;null!==(r=i.exec(n))&&c<e.depth;){c+=1;var l=r[1].slice(1,-1);if(!e.plainObjects&&o.call(Object.prototype,l)&&!e.allowPrototypes)return;a[a.length]=r[1]}if(r){if(!0===e.strictDepth)throw new RangeError("Input depth exceeded depth option of "+e.depth+" and strictDepth is true");a[a.length]="["+n.slice(r.index)+"]"}return a}(t,n);if(s)return function(t,e,n,o){var r=0;if(t.length>0&&"[]"===t[t.length-1]){var s=t.slice(0,-1).join("");r=Array.isArray(e)&&e[s]?e[s].length:0}for(var a=o?e:c(e,n,r),l=t.length-1;l>=0;--l){var d,p=t[l];if("[]"===p&&n.parseArrays)d=i.isOverflow(a)?a:n.allowEmptyArrays&&(""===a||n.strictNullHandling&&null===a)?[]:i.combine([],a,n.arrayLimit,n.plainObjects);else{d=n.plainObjects?{__proto__:null}:{};var h="["===p.charAt(0)&&"]"===p.charAt(p.length-1)?p.slice(1,-1):p,u=n.decodeDotInKeys?h.replace(/%2E/g,"."):h,f=parseInt(u,10),g=!isNaN(f)&&p!==u&&String(f)===u&&f>=0&&n.parseArrays;if(n.parseArrays||""!==u)if(g&&f<n.arrayLimit)(d=[])[f]=a;else{if(g&&n.throwOnLimitExceeded)throw new RangeError("Array limit exceeded. Only "+n.arrayLimit+" element"+(1===n.arrayLimit?"":"s")+" allowed in an array.");g?(d[f]=a,i.markOverflow(d,f)):"__proto__"!==u&&(d[u]=a)}else d={0:a}}a=d}return a}(s,e,n,r)}};e.exports=function(t,e){var n=function(t){if(!t)return s;if(void 0!==t.allowEmptyArrays&&"boolean"!=typeof t.allowEmptyArrays)throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(void 0!==t.decodeDotInKeys&&"boolean"!=typeof t.decodeDotInKeys)throw new TypeError("`decodeDotInKeys` option can only be `true` or `false`, when provided");if(null!==t.decoder&&void 0!==t.decoder&&"function"!=typeof t.decoder)throw new TypeError("Decoder has to be a function.");if(void 0!==t.charset&&"utf-8"!==t.charset&&"iso-8859-1"!==t.charset)throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");if(void 0!==t.throwOnLimitExceeded&&"boolean"!=typeof t.throwOnLimitExceeded)throw new TypeError("`throwOnLimitExceeded` option must be a boolean");var e=void 0===t.charset?s.charset:t.charset,n=void 0===t.duplicates?s.duplicates:t.duplicates;if("combine"!==n&&"first"!==n&&"last"!==n)throw new TypeError("The duplicates option must be either combine, first, or last");return{allowDots:void 0===t.allowDots?!0===t.decodeDotInKeys||s.allowDots:!!t.allowDots,allowEmptyArrays:"boolean"==typeof t.allowEmptyArrays?!!t.allowEmptyArrays:s.allowEmptyArrays,allowPrototypes:"boolean"==typeof t.allowPrototypes?t.allowPrototypes:s.allowPrototypes,allowSparse:"boolean"==typeof t.allowSparse?t.allowSparse:s.allowSparse,arrayLimit:"number"==typeof t.arrayLimit?t.arrayLimit:s.arrayLimit,charset:e,charsetSentinel:"boolean"==typeof t.charsetSentinel?t.charsetSentinel:s.charsetSentinel,comma:"boolean"==typeof t.comma?t.comma:s.comma,decodeDotInKeys:"boolean"==typeof t.decodeDotInKeys?t.decodeDotInKeys:s.decodeDotInKeys,decoder:"function"==typeof t.decoder?t.decoder:s.decoder,delimiter:"string"==typeof t.delimiter||i.isRegExp(t.delimiter)?t.delimiter:s.delimiter,depth:"number"==typeof t.depth||!1===t.depth?+t.depth:s.depth,duplicates:n,ignoreQueryPrefix:!0===t.ignoreQueryPrefix,interpretNumericEntities:"boolean"==typeof t.interpretNumericEntities?t.interpretNumericEntities:s.interpretNumericEntities,parameterLimit:"number"==typeof t.parameterLimit?t.parameterLimit:s.parameterLimit,parseArrays:!1!==t.parseArrays,plainObjects:"boolean"==typeof t.plainObjects?t.plainObjects:s.plainObjects,strictDepth:"boolean"==typeof t.strictDepth?!!t.strictDepth:s.strictDepth,strictMerge:"boolean"==typeof t.strictMerge?!!t.strictMerge:s.strictMerge,strictNullHandling:"boolean"==typeof t.strictNullHandling?t.strictNullHandling:s.strictNullHandling,throwOnLimitExceeded:"boolean"==typeof t.throwOnLimitExceeded&&t.throwOnLimitExceeded}}(e);if(""===t||null==t)return n.plainObjects?{__proto__:null}:{};for(var d="string"==typeof t?function(t,e){var n={__proto__:null},l=e.ignoreQueryPrefix?t.replace(/^\?/,""):t;l=l.replace(/%5B/gi,"[").replace(/%5D/gi,"]");var d=e.parameterLimit===1/0?void 0:e.parameterLimit,p=l.split(e.delimiter,e.throwOnLimitExceeded?d+1:d);if(e.throwOnLimitExceeded&&p.length>d)throw new RangeError("Parameter limit exceeded. Only "+d+" parameter"+(1===d?"":"s")+" allowed.");var h,u=-1,f=e.charset;if(e.charsetSentinel)for(h=0;h<p.length;++h)0===p[h].indexOf("utf8=")&&("utf8=%E2%9C%93"===p[h]?f="utf-8":"utf8=%26%2310003%3B"===p[h]&&(f="iso-8859-1"),u=h,h=p.length);for(h=0;h<p.length;++h)if(h!==u){var g,m,v=p[h],b=v.indexOf("]="),w=-1===b?v.indexOf("="):b+1;if(-1===w?(g=e.decoder(v,s.decoder,f,"key"),m=e.strictNullHandling?null:""):null!==(g=e.decoder(v.slice(0,w),s.decoder,f,"key"))&&(m=i.maybeMap(c(v.slice(w+1),e,r(n[g])?n[g].length:0),function(t){return e.decoder(t,s.decoder,f,"value")})),m&&e.interpretNumericEntities&&"iso-8859-1"===f&&(m=a(String(m))),v.indexOf("[]=")>-1&&(m=r(m)?[m]:m),e.comma&&r(m)&&m.length>e.arrayLimit){if(e.throwOnLimitExceeded)throw new RangeError("Array limit exceeded. Only "+e.arrayLimit+" element"+(1===e.arrayLimit?"":"s")+" allowed in an array.");m=i.combine([],m,e.arrayLimit,e.plainObjects)}if(null!==g){var y=o.call(n,g);y&&("combine"===e.duplicates||v.indexOf("[]=")>-1)?n[g]=i.combine(n[g],m,e.arrayLimit,e.plainObjects):y&&"last"!==e.duplicates||(n[g]=m)}}return n}(t,n):t,p=n.plainObjects?{__proto__:null}:{},h=Object.keys(d),u=0;u<h.length;++u){var f=h[u],g=l(f,d[f],n,"string"==typeof t);p=i.merge(p,g,n)}return!0===n.allowSparse?p:i.compact(p)}},{"./utils":95}],94:[function(t,e,n){var i=t("side-channel"),o=t("./utils"),r=t("./formats"),s=Object.prototype.hasOwnProperty,a={brackets:function(t){return t+"[]"},comma:"comma",indices:function(t,e){return t+"["+e+"]"},repeat:function(t){return t}},c=Array.isArray,l=Array.prototype.push,d=function(t,e){l.apply(t,c(e)?e:[e])},p=Date.prototype.toISOString,h=r.default,u={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,commaRoundTrip:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:o.encode,encodeValuesOnly:!1,filter:void 0,format:h,formatter:r.formatters[h],indices:!1,serializeDate:function(t){return p.call(t)},skipNulls:!1,strictNullHandling:!1},f={},g=function t(e,n,r,s,a,l,p,h,g,m,v,b,w,y,C,x,A,D){for(var E,S=e,P=D,T=0,k=!1;void 0!==(P=P.get(f))&&!k;){var F=P.get(e);if(T+=1,void 0!==F){if(F===T)throw new RangeError("Cyclic object value");k=!0}void 0===P.get(f)&&(T=0)}if("function"==typeof m?S=m(n,S):S instanceof Date?S=w(S):"comma"===r&&c(S)&&(S=o.maybeMap(S,function(t){return t instanceof Date?w(t):t})),null===S){if(l)return g&&!x?g(n,u.encoder,A,"key",y):n;S=""}if("string"==typeof(E=S)||"number"==typeof E||"boolean"==typeof E||"symbol"==typeof E||"bigint"==typeof E||o.isBuffer(S))return g?[C(x?n:g(n,u.encoder,A,"key",y))+"="+C(g(S,u.encoder,A,"value",y))]:[C(n)+"="+C(String(S))];var I,L=[];if(void 0===S)return L;if("comma"===r&&c(S))x&&g&&(S=o.maybeMap(S,g)),I=[{value:S.length>0?S.join(",")||null:void 0}];else if(c(m))I=m;else{var M=Object.keys(S);I=v?M.sort(v):M}var R=h?String(n).replace(/\./g,"%2E"):String(n),_=s&&c(S)&&1===S.length?R+"[]":R;if(a&&c(S)&&0===S.length)return _+"[]";for(var B=0;B<I.length;++B){var H=I[B],V="object"==typeof H&&H&&void 0!==H.value?H.value:S[H];if(!p||null!==V){var j=b&&h?String(H).replace(/\./g,"%2E"):String(H),N=c(S)?"function"==typeof r?r(_,j):_:_+(b?"."+j:"["+j+"]");D.set(e,T);var O=i();O.set(f,D),d(L,t(V,N,r,s,a,l,p,h,"comma"===r&&x&&c(S)?null:g,m,v,b,w,y,C,x,A,O))}}return L};e.exports=function(t,e){var n,o=t,l=function(t){if(!t)return u;if(void 0!==t.allowEmptyArrays&&"boolean"!=typeof t.allowEmptyArrays)throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(void 0!==t.encodeDotInKeys&&"boolean"!=typeof t.encodeDotInKeys)throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(null!==t.encoder&&void 0!==t.encoder&&"function"!=typeof t.encoder)throw new TypeError("Encoder has to be a function.");var e=t.charset||u.charset;if(void 0!==t.charset&&"utf-8"!==t.charset&&"iso-8859-1"!==t.charset)throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var n=r.default;if(void 0!==t.format){if(!s.call(r.formatters,t.format))throw new TypeError("Unknown format option provided.");n=t.format}var i,o=r.formatters[n],l=u.filter;if(("function"==typeof t.filter||c(t.filter))&&(l=t.filter),i=t.arrayFormat in a?t.arrayFormat:"indices"in t?t.indices?"indices":"repeat":u.arrayFormat,"commaRoundTrip"in t&&"boolean"!=typeof t.commaRoundTrip)throw new TypeError("`commaRoundTrip` must be a boolean, or absent");var d=void 0===t.allowDots?!0===t.encodeDotInKeys||u.allowDots:!!t.allowDots;return{addQueryPrefix:"boolean"==typeof t.addQueryPrefix?t.addQueryPrefix:u.addQueryPrefix,allowDots:d,allowEmptyArrays:"boolean"==typeof t.allowEmptyArrays?!!t.allowEmptyArrays:u.allowEmptyArrays,arrayFormat:i,charset:e,charsetSentinel:"boolean"==typeof t.charsetSentinel?t.charsetSentinel:u.charsetSentinel,commaRoundTrip:!!t.commaRoundTrip,delimiter:void 0===t.delimiter?u.delimiter:t.delimiter,encode:"boolean"==typeof t.encode?t.encode:u.encode,encodeDotInKeys:"boolean"==typeof t.encodeDotInKeys?t.encodeDotInKeys:u.encodeDotInKeys,encoder:"function"==typeof t.encoder?t.encoder:u.encoder,encodeValuesOnly:"boolean"==typeof t.encodeValuesOnly?t.encodeValuesOnly:u.encodeValuesOnly,filter:l,format:n,formatter:o,serializeDate:"function"==typeof t.serializeDate?t.serializeDate:u.serializeDate,skipNulls:"boolean"==typeof t.skipNulls?t.skipNulls:u.skipNulls,sort:"function"==typeof t.sort?t.sort:null,strictNullHandling:"boolean"==typeof t.strictNullHandling?t.strictNullHandling:u.strictNullHandling}}(e);"function"==typeof l.filter?o=(0,l.filter)("",o):c(l.filter)&&(n=l.filter);var p=[];if("object"!=typeof o||null===o)return"";var h=a[l.arrayFormat],f="comma"===h&&l.commaRoundTrip;n||(n=Object.keys(o)),l.sort&&n.sort(l.sort);for(var m=i(),v=0;v<n.length;++v){var b=n[v],w=o[b];l.skipNulls&&null===w||d(p,g(w,b,h,f,l.allowEmptyArrays,l.strictNullHandling,l.skipNulls,l.encodeDotInKeys,l.encode?l.encoder:null,l.filter,l.sort,l.allowDots,l.serializeDate,l.format,l.formatter,l.encodeValuesOnly,l.charset,m))}var y=p.join(l.delimiter),C=!0===l.addQueryPrefix?"?":"";return l.charsetSentinel&&("iso-8859-1"===l.charset?C+="utf8=%26%2310003%3B&":C+="utf8=%E2%9C%93&"),y.length>0?C+y:""}},{"./formats":91,"./utils":95,"side-channel":99}],95:[function(t,e,n){var i=t("./formats"),o=t("side-channel"),r=Object.prototype.hasOwnProperty,s=Array.isArray,a=o(),c=function(t,e){return a.set(t,e),t},l=function(t){return a.has(t)},d=function(t){return a.get(t)},p=function(t,e){a.set(t,e)},h=function(){for(var t=[],e=0;e<256;++e)t[t.length]="%"+((e<16?"0":"")+e.toString(16)).toUpperCase();return t}(),u=function(t,e){for(var n=e&&e.plainObjects?{__proto__:null}:{},i=0;i<t.length;++i)void 0!==t[i]&&(n[i]=t[i]);return n},f=1024;e.exports={arrayToObject:u,assign:function(t,e){return Object.keys(e).reduce(function(t,n){return t[n]=e[n],t},t)},combine:function(t,e,n,i){if(l(t)){var o=d(t)+1;return t[o]=e,p(t,o),t}var r=[].concat(t,e);return r.length>n?c(u(r,{plainObjects:i}),r.length-1):r},compact:function(t){for(var e=[{obj:{o:t},prop:"o"}],n=[],i=0;i<e.length;++i)for(var o=e[i],r=o.obj[o.prop],a=Object.keys(r),c=0;c<a.length;++c){var l=a[c],d=r[l];"object"==typeof d&&null!==d&&-1===n.indexOf(d)&&(e[e.length]={obj:r,prop:l},n[n.length]=d)}return function(t){for(;t.length>1;){var e=t.pop(),n=e.obj[e.prop];if(s(n)){for(var i=[],o=0;o<n.length;++o)void 0!==n[o]&&(i[i.length]=n[o]);e.obj[e.prop]=i}}}(e),t},decode:function(t,e,n){var i=t.replace(/\+/g," ");if("iso-8859-1"===n)return i.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(i)}catch(t){return i}},encode:function(t,e,n,o,r){if(0===t.length)return t;var s=t;if("symbol"==typeof t?s=Symbol.prototype.toString.call(t):"string"!=typeof t&&(s=String(t)),"iso-8859-1"===n)return escape(s).replace(/%u[0-9a-f]{4}/gi,function(t){return"%26%23"+parseInt(t.slice(2),16)+"%3B"});for(var a="",c=0;c<s.length;c+=f){for(var l=s.length>=f?s.slice(c,c+f):s,d=[],p=0;p<l.length;++p){var u=l.charCodeAt(p);45===u||46===u||95===u||126===u||u>=48&&u<=57||u>=65&&u<=90||u>=97&&u<=122||r===i.RFC1738&&(40===u||41===u)?d[d.length]=l.charAt(p):u<128?d[d.length]=h[u]:u<2048?d[d.length]=h[192|u>>6]+h[128|63&u]:u<55296||u>=57344?d[d.length]=h[224|u>>12]+h[128|u>>6&63]+h[128|63&u]:(p+=1,u=65536+((1023&u)<<10|1023&l.charCodeAt(p)),d[d.length]=h[240|u>>18]+h[128|u>>12&63]+h[128|u>>6&63]+h[128|63&u])}a+=d.join("")}return a},isBuffer:function(t){return!(!t||"object"!=typeof t)&&!!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t))},isOverflow:l,isRegExp:function(t){return"[object RegExp]"===Object.prototype.toString.call(t)},markOverflow:c,maybeMap:function(t,e){if(s(t)){for(var n=[],i=0;i<t.length;i+=1)n[n.length]=e(t[i]);return n}return e(t)},merge:function t(e,n,i){if(!n)return e;if("object"!=typeof n&&"function"!=typeof n){if(s(e)){var o=e.length;if(i&&"number"==typeof i.arrayLimit&&o>i.arrayLimit)return c(u(e.concat(n),i),o);e[o]=n}else{if(!e||"object"!=typeof e)return[e,n];if(l(e)){var a=d(e)+1;e[a]=n,p(e,a)}else{if(i&&i.strictMerge)return[e,n];(i&&(i.plainObjects||i.allowPrototypes)||!r.call(Object.prototype,n))&&(e[n]=!0)}}return e}if(!e||"object"!=typeof e){if(l(n)){for(var h=Object.keys(n),f=i&&i.plainObjects?{__proto__:null,0:e}:{0:e},g=0;g<h.length;g++){f[parseInt(h[g],10)+1]=n[h[g]]}return c(f,d(n)+1)}var m=[e].concat(n);return i&&"number"==typeof i.arrayLimit&&m.length>i.arrayLimit?c(u(m,i),m.length-1):m}var v=e;return s(e)&&!s(n)&&(v=u(e,i)),s(e)&&s(n)?(n.forEach(function(n,o){if(r.call(e,o)){var s=e[o];s&&"object"==typeof s&&n&&"object"==typeof n?e[o]=t(s,n,i):e[e.length]=n}else e[o]=n}),e):Object.keys(n).reduce(function(e,o){var s=n[o];if(r.call(e,o)?e[o]=t(e[o],s,i):e[o]=s,l(n)&&!l(e)&&c(e,d(n)),l(e)){var a=parseInt(o,10);String(a)===o&&a>=0&&a>d(e)&&p(e,a)}return e},v)}}},{"./formats":91,"side-channel":99}],96:[function(t,e,n){var i=t("object-inspect"),o=t("es-errors/type"),r=function(t,e,n){for(var i,o=t;null!=(i=o.next);o=i)if(i.key===e)return o.next=i.next,n||(i.next=t.next,t.next=i),i};e.exports=function(){var t,e={assert:function(t){if(!e.has(t))throw new o("Side channel does not contain "+i(t))},delete:function(e){var n=t&&t.next,i=function(t,e){if(t)return r(t,e,!0)}(t,e);return i&&n&&n===i&&(t=void 0),!!i},get:function(e){return function(t,e){if(t){var n=r(t,e);return n&&n.value}}(t,e)},has:function(e){return function(t,e){return!!t&&!!r(t,e)}(t,e)},set:function(e,n){t||(t={next:void 0}),function(t,e,n){var i=r(t,e);i?i.value=n:t.next={key:e,next:t.next,value:n}}(t,e,n)}};return e}},{"es-errors/type":16,"object-inspect":41}],97:[function(t,e,n){var i=t("get-intrinsic"),o=t("call-bound"),r=t("object-inspect"),s=t("es-errors/type"),a=i("%Map%",!0),c=o("Map.prototype.get",!0),l=o("Map.prototype.set",!0),d=o("Map.prototype.has",!0),p=o("Map.prototype.delete",!0),h=o("Map.prototype.size",!0);e.exports=!!a&&function(){var t,e={assert:function(t){if(!e.has(t))throw new s("Side channel does not contain "+r(t))},delete:function(e){if(t){var n=p(t,e);return 0===h(t)&&(t=void 0),n}return!1},get:function(e){if(t)return c(t,e)},has:function(e){return!!t&&d(t,e)},set:function(e,n){t||(t=new a),l(t,e,n)}};return e}},{"call-bound":8,"es-errors/type":16,"get-intrinsic":23,"object-inspect":41}],98:[function(t,e,n){var i=t("get-intrinsic"),o=t("call-bound"),r=t("object-inspect"),s=t("side-channel-map"),a=t("es-errors/type"),c=i("%WeakMap%",!0),l=o("WeakMap.prototype.get",!0),d=o("WeakMap.prototype.set",!0),p=o("WeakMap.prototype.has",!0),h=o("WeakMap.prototype.delete",!0);e.exports=c?function(){var t,e,n={assert:function(t){if(!n.has(t))throw new a("Side channel does not contain "+r(t))},delete:function(n){if(c&&n&&("object"==typeof n||"function"==typeof n)){if(t)return h(t,n)}else if(s&&e)return e.delete(n);return!1},get:function(n){return c&&n&&("object"==typeof n||"function"==typeof n)&&t?l(t,n):e&&e.get(n)},has:function(n){return c&&n&&("object"==typeof n||"function"==typeof n)&&t?p(t,n):!!e&&e.has(n)},set:function(n,i){c&&n&&("object"==typeof n||"function"==typeof n)?(t||(t=new c),d(t,n,i)):s&&(e||(e=s()),e.set(n,i))}};return n}:s},{"call-bound":8,"es-errors/type":16,"get-intrinsic":23,"object-inspect":41,"side-channel-map":97}],99:[function(t,e,n){var i=t("es-errors/type"),o=t("object-inspect"),r=t("side-channel-list"),s=t("side-channel-map"),a=t("side-channel-weakmap")||s||r;e.exports=function(){var t,e={assert:function(t){if(!e.has(t))throw new i("Side channel does not contain "+o(t))},delete:function(e){return!!t&&t.delete(e)},get:function(e){return t&&t.get(e)},has:function(e){return!!t&&t.has(e)},set:function(e,n){t||(t=a()),t.set(e,n)}};return e}},{"es-errors/type":16,"object-inspect":41,"side-channel-list":96,"side-channel-map":97,"side-channel-weakmap":98}],100:[function(t,e,n){var i=t("punycode/");function o(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}var r=/^([a-z0-9.+-]+:)/i,s=/:[0-9]*$/,a=/^(\/\/?(?!\/)[^?\s]*)(\?[^\s]*)?$/,c=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r","\n","\t"]),l=["'"].concat(c),d=["%","/","?",";","#"].concat(l),p=["/","?","#"],h=/^[+a-z0-9A-Z_-]{0,63}$/,u=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,f={javascript:!0,"javascript:":!0},g={javascript:!0,"javascript:":!0},m={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},v=t("qs");function b(t,e,n){if(t&&"object"==typeof t&&t instanceof o)return t;var i=new o;return i.parse(t,e,n),i}o.prototype.parse=function(t,e,n){if("string"!=typeof t)throw new TypeError("Parameter 'url' must be a string, not "+typeof t);var o=t.indexOf("?"),s=-1!==o&&o<t.indexOf("#")?"?":"#",c=t.split(s);c[0]=c[0].replace(/\\/g,"/");var b=t=c.join(s);if(b=b.trim(),!n&&1===t.split("#").length){var w=a.exec(b);if(w)return this.path=b,this.href=b,this.pathname=w[1],w[2]?(this.search=w[2],this.query=e?v.parse(this.search.substr(1)):this.search.substr(1)):e&&(this.search="",this.query={}),this}var y=r.exec(b);if(y){var C=(y=y[0]).toLowerCase();this.protocol=C,b=b.substr(y.length)}if(n||y||b.match(/^\/\/[^@/]+@[^@/]+/)){var x="//"===b.substr(0,2);!x||y&&g[y]||(b=b.substr(2),this.slashes=!0)}if(!g[y]&&(x||y&&!m[y])){for(var A,D,E=-1,S=0;S<p.length;S++){-1!==(P=b.indexOf(p[S]))&&(-1===E||P<E)&&(E=P)}-1!==(D=-1===E?b.lastIndexOf("@"):b.lastIndexOf("@",E))&&(A=b.slice(0,D),b=b.slice(D+1),this.auth=decodeURIComponent(A)),E=-1;for(S=0;S<d.length;S++){var P;-1!==(P=b.indexOf(d[S]))&&(-1===E||P<E)&&(E=P)}-1===E&&(E=b.length),this.host=b.slice(0,E),b=b.slice(E),this.parseHost(),this.hostname=this.hostname||"";var T="["===this.hostname[0]&&"]"===this.hostname[this.hostname.length-1];if(!T)for(var k=this.hostname.split(/\./),F=(S=0,k.length);S<F;S++){var I=k[S];if(I&&!I.match(h)){for(var L="",M=0,R=I.length;M<R;M++)I.charCodeAt(M)>127?L+="x":L+=I[M];if(!L.match(h)){var _=k.slice(0,S),B=k.slice(S+1),H=I.match(u);H&&(_.push(H[1]),B.unshift(H[2])),B.length&&(b="/"+B.join(".")+b),this.hostname=_.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),T||(this.hostname=i.toASCII(this.hostname));var V=this.port?":"+this.port:"",j=this.hostname||"";this.host=j+V,this.href+=this.host,T&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==b[0]&&(b="/"+b))}if(!f[C])for(S=0,F=l.length;S<F;S++){var N=l[S];if(-1!==b.indexOf(N)){var O=encodeURIComponent(N);O===N&&(O=escape(N)),b=b.split(N).join(O)}}var U=b.indexOf("#");-1!==U&&(this.hash=b.substr(U),b=b.slice(0,U));var z=b.indexOf("?");if(-1!==z?(this.search=b.substr(z),this.query=b.substr(z+1),e&&(this.query=v.parse(this.query)),b=b.slice(0,z)):e&&(this.search="",this.query={}),b&&(this.pathname=b),m[C]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){V=this.pathname||"";var W=this.search||"";this.path=V+W}return this.href=this.format(),this},o.prototype.format=function(){var t=this.auth||"";t&&(t=(t=encodeURIComponent(t)).replace(/%3A/i,":"),t+="@");var e=this.protocol||"",n=this.pathname||"",i=this.hash||"",o=!1,r="";this.host?o=t+this.host:this.hostname&&(o=t+(-1===this.hostname.indexOf(":")?this.hostname:"["+this.hostname+"]"),this.port&&(o+=":"+this.port)),this.query&&"object"==typeof this.query&&Object.keys(this.query).length&&(r=v.stringify(this.query,{arrayFormat:"repeat",addQueryPrefix:!1}));var s=this.search||r&&"?"+r||"";return e&&":"!==e.substr(-1)&&(e+=":"),this.slashes||(!e||m[e])&&!1!==o?(o="//"+(o||""),n&&"/"!==n.charAt(0)&&(n="/"+n)):o||(o=""),i&&"#"!==i.charAt(0)&&(i="#"+i),s&&"?"!==s.charAt(0)&&(s="?"+s),e+o+(n=n.replace(/[?#]/g,function(t){return encodeURIComponent(t)}))+(s=s.replace("#","%23"))+i},o.prototype.resolve=function(t){return this.resolveObject(b(t,!1,!0)).format()},o.prototype.resolveObject=function(t){if("string"==typeof t){var e=new o;e.parse(t,!1,!0),t=e}for(var n=new o,i=Object.keys(this),r=0;r<i.length;r++){var s=i[r];n[s]=this[s]}if(n.hash=t.hash,""===t.href)return n.href=n.format(),n;if(t.slashes&&!t.protocol){for(var a=Object.keys(t),c=0;c<a.length;c++){var l=a[c];"protocol"!==l&&(n[l]=t[l])}return m[n.protocol]&&n.hostname&&!n.pathname&&(n.pathname="/",n.path=n.pathname),n.href=n.format(),n}if(t.protocol&&t.protocol!==n.protocol){if(!m[t.protocol]){for(var d=Object.keys(t),p=0;p<d.length;p++){var h=d[p];n[h]=t[h]}return n.href=n.format(),n}if(n.protocol=t.protocol,t.host||g[t.protocol])n.pathname=t.pathname;else{for(var u=(t.pathname||"").split("/");u.length&&!(t.host=u.shift()););t.host||(t.host=""),t.hostname||(t.hostname=""),""!==u[0]&&u.unshift(""),u.length<2&&u.unshift(""),n.pathname=u.join("/")}if(n.search=t.search,n.query=t.query,n.host=t.host||"",n.auth=t.auth,n.hostname=t.hostname||t.host,n.port=t.port,n.pathname||n.search){var f=n.pathname||"",v=n.search||"";n.path=f+v}return n.slashes=n.slashes||t.slashes,n.href=n.format(),n}var b=n.pathname&&"/"===n.pathname.charAt(0),w=t.host||t.pathname&&"/"===t.pathname.charAt(0),y=w||b||n.host&&t.pathname,C=y,x=n.pathname&&n.pathname.split("/")||[],A=(u=t.pathname&&t.pathname.split("/")||[],n.protocol&&!m[n.protocol]);if(A&&(n.hostname="",n.port=null,n.host&&(""===x[0]?x[0]=n.host:x.unshift(n.host)),n.host="",t.protocol&&(t.hostname=null,t.port=null,t.host&&(""===u[0]?u[0]=t.host:u.unshift(t.host)),t.host=null),y=y&&(""===u[0]||""===x[0])),w)n.host=t.host||""===t.host?t.host:n.host,n.hostname=t.hostname||""===t.hostname?t.hostname:n.hostname,n.search=t.search,n.query=t.query,x=u;else if(u.length)x||(x=[]),x.pop(),x=x.concat(u),n.search=t.search,n.query=t.query;else if(null!=t.search){if(A)n.host=x.shift(),n.hostname=n.host,(T=!!(n.host&&n.host.indexOf("@")>0)&&n.host.split("@"))&&(n.auth=T.shift(),n.hostname=T.shift(),n.host=n.hostname);return n.search=t.search,n.query=t.query,null===n.pathname&&null===n.search||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.href=n.format(),n}if(!x.length)return n.pathname=null,n.search?n.path="/"+n.search:n.path=null,n.href=n.format(),n;for(var D=x.slice(-1)[0],E=(n.host||t.host||x.length>1)&&("."===D||".."===D)||""===D,S=0,P=x.length;P>=0;P--)"."===(D=x[P])?x.splice(P,1):".."===D?(x.splice(P,1),S++):S&&(x.splice(P,1),S--);if(!y&&!C)for(;S--;S)x.unshift("..");!y||""===x[0]||x[0]&&"/"===x[0].charAt(0)||x.unshift(""),E&&"/"!==x.join("/").substr(-1)&&x.push("");var T,k=""===x[0]||x[0]&&"/"===x[0].charAt(0);A&&(n.hostname=k?"":x.length?x.shift():"",n.host=n.hostname,(T=!!(n.host&&n.host.indexOf("@")>0)&&n.host.split("@"))&&(n.auth=T.shift(),n.hostname=T.shift(),n.host=n.hostname));return(y=y||n.host&&x.length)&&!k&&x.unshift(""),x.length>0?n.pathname=x.join("/"):(n.pathname=null,n.path=null),null===n.pathname&&null===n.search||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.auth=t.auth||n.auth,n.slashes=n.slashes||t.slashes,n.href=n.format(),n},o.prototype.parseHost=function(){var t=this.host,e=s.exec(t);e&&(":"!==(e=e[0])&&(this.port=e.substr(1)),t=t.substr(0,t.length-e.length)),t&&(this.hostname=t)},n.parse=b,n.resolve=function(t,e){return b(t,!1,!0).resolve(e)},n.resolveObject=function(t,e){return t?b(t,!1,!0).resolveObject(e):e},n.format=function(t){return"string"==typeof t&&(t=b(t)),t instanceof o?t.format():o.prototype.format.call(t)},n.Url=o},{"punycode/":90,qs:92}],101:[function(t,e,n){e.exports={Name:"Retold Content Editor",Hash:"ContentEditor",MainViewportViewIdentifier:"ContentEditor-Layout",AutoSolveAfterInitialize:!0,AutoRenderMainViewportViewAfterInitialize:!1,AutoRenderViewsAfterInitialize:!1,pict_configuration:{Product:"ContentEditor-Pict-Application"}}},{}],102:[function(t,e,n){const i=t("pict-application"),o=t("pict-section-filebrowser"),r=t("./providers/Pict-Provider-ContentEditor.js"),s=t("./views/PictView-Editor-Layout.js"),a=t("./views/PictView-Editor-TopBar.js"),c=t("./views/PictView-Editor-MarkdownEditor.js"),l=t("./views/PictView-Editor-CodeEditor.js"),d=t("./views/PictView-Editor-SettingsPanel.js"),p=t("./views/PictView-Editor-MarkdownReference.js"),h=t("./views/PictView-Editor-Topics.js");e.exports=class extends i{constructor(t,e,n){super(t,e,n),this.pict.addProvider("ContentEditor-Provider",r.default_configuration,r),this.pict.addView("ContentEditor-Layout",s.default_configuration,s),this.pict.addView("ContentEditor-TopBar",a.default_configuration,a),this.pict.addView("ContentEditor-MarkdownEditor",c.default_configuration,c),this.pict.addView("ContentEditor-CodeEditor",l.default_configuration,l),this.pict.addView("ContentEditor-SettingsPanel",d.default_configuration,d),this.pict.addView("ContentEditor-MarkdownReference",p.default_configuration,p),this.pict.addView("ContentEditor-Topics",h.default_configuration,h);let i=JSON.parse(JSON.stringify(o.default_configuration));i.DefaultDestinationAddress="#ContentEditor-Sidebar-Container",i.DefaultState.Layout="list-only",this.pict.addView("Pict-FileBrowser",i,o);let u=JSON.parse(JSON.stringify(o.PictViewListDetail.default_configuration));for(let t=0;t<u.Templates.length;t++)"FileBrowser-ListDetail-Container-Template"===u.Templates[t].Hash&&(u.Templates[t].Template='\n<div class="pict-fb-detail" id="Pict-FileBrowser-DetailList">\n\t<div class="pict-fb-breadcrumb-bar">\n\t\t<div class="pict-fb-breadcrumb" id="Pict-FileBrowser-Breadcrumb"></div>\n\t\t<button class="pict-fb-breadcrumb-addfolder" onclick="pict.PictApplication.promptNewFolder()" title="New folder">+</button>\n\t</div>\n\t<div class="pict-fb-detail-header">\n\t\t<div class="pict-fb-detail-header-cell pict-fb-detail-col-name" onclick="pict.views[\'{~D:Record.ViewHash~}\'].sortBy(\'Name\')">Name</div>\n\t\t<div class="pict-fb-detail-header-cell pict-fb-detail-col-size" onclick="pict.views[\'{~D:Record.ViewHash~}\'].sortBy(\'Size\')">Size</div>\n\t\t<div class="pict-fb-detail-header-cell pict-fb-detail-col-modified" onclick="pict.views[\'{~D:Record.ViewHash~}\'].sortBy(\'Modified\')">Modified</div>\n\t</div>\n\t<div id="Pict-FileBrowser-DetailRows"></div>\n</div>\n'),"FileBrowser-ListDetail-Row-Template"===u.Templates[t].Hash&&(u.Templates[t].Template='\n<div class="pict-fb-detail-row{~D:Record.SelectedClass~}" data-index="{~D:Record.Index~}" data-name="{~D:Record.Name~}" onclick="{~D:Record.ClickHandler~}" ondblclick="{~D:Record.DblClickHandler~}">\n\t<span class="pict-fb-detail-icon">{~D:Record.Icon~}</span>\n\t<span class="pict-fb-detail-name">{~D:Record.Name~}</span>\n\t<span class="pict-fb-detail-size">{~D:Record.SizeFormatted~}</span>\n\t<span class="pict-fb-detail-modified">{~D:Record.ModifiedFormatted~}</span>\n\t<button class="pict-fb-insert-btn" onclick="event.stopPropagation(); pict.PictApplication.insertFileReference(this.parentElement.getAttribute(\'data-name\'))" title="Insert into editor">+</button>\n</div>\n');this.pict.addView("Pict-FileBrowser-ListDetail",u,o.PictViewListDetail)}onAfterInitializeAsync(t){"undefined"!=typeof window&&(window.pict=this.pict),this.pict.AppData.ContentEditor={CurrentFile:"",ActiveEditor:"markdown",IsDirty:!1,IsSaving:!1,IsLoading:!1,Files:[],Document:{Segments:[{Content:""}]},CodeContent:"",SaveStatus:"",SaveStatusClass:"",AutoSegmentMarkdown:!1,AutoSegmentDepth:1,ContentPreviewMode:"off",MarkdownEditingControls:!0,MarkdownWordWrap:!0,CodeWordWrap:!1,SidebarCollapsed:!1,SidebarWidth:250,AutoPreviewImages:!0,AutoPreviewVideo:!1,AutoPreviewAudio:!1,ShowHiddenFiles:!1,TopicsFilePath:".pict_documentation_topics.json"},this._loadSettings(),this.pict.views["ContentEditor-Layout"].render();let e=this,n=this.pict.providers["Pict-FileBrowser-List"];if(n){let t=n.selectFile.bind(n);n.selectFile=function(n){t(n),n&&"file"===n.Type&&e.navigateToFile(n.Path)}}let i=this.pict.providers["Pict-FileBrowser-Browse"];if(i){let t=i.navigateToFolder.bind(i);i.navigateToFolder=function(n){t(n),e.loadFileList(n)}}this.syncHiddenFilesSetting(()=>{e.loadFileList(null,()=>{e.resolveHash()})});let o=this.pict.AppData.ContentEditor.TopicsFilePath;if(o){let t=this.pict.views["ContentEditor-Topics"];t&&t.loadTopicsFile(o,()=>{})}return super.onAfterInitializeAsync(t)}syncHiddenFilesSetting(t){let e="function"==typeof t?t:()=>{},n=this.pict.AppData.ContentEditor.ShowHiddenFiles;fetch("/api/filebrowser/settings",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({IncludeHiddenFiles:!!n})}).then(()=>e()).catch(()=>e())}loadFileList(t,e){let n="function"==typeof e?e:"function"==typeof t?t:()=>{},i=this,o="string"==typeof t?t:null;null===o&&this.pict.AppData.PictFileBrowser&&this.pict.AppData.PictFileBrowser.CurrentLocation&&(o=this.pict.AppData.PictFileBrowser.CurrentLocation);let r="/api/filebrowser/list";o&&o.length>0&&(r+="?path="+encodeURIComponent(o)),fetch(r).then(t=>t.json()).then(t=>{i.pict.AppData.PictFileBrowser=i.pict.AppData.PictFileBrowser||{},i.pict.AppData.PictFileBrowser.FileList=t||[];let e=i.pict.views["Pict-FileBrowser"];e&&e.render();let o=i.pict.views["Pict-FileBrowser-ListDetail"];return o&&o.render(),n()}).catch(t=>(i.log.error("Failed to load file list: ".concat(t.message)),n()))}resolveHash(){let t=(window.location.hash||"").replace(/^#\/?/,"");if(!t)return;let e=t.split("/");if("edit"===e[0]&&e.length>=2){let t=e.slice(1).join("/");if(this.pict.AppData.ContentEditor.CurrentFile===t)return;this.navigateToFile(t)}}getEditorTypeForFile(t){if(!t)return"markdown";let e=t.replace(/^.*\./,"").toLowerCase();if("md"===e||"markdown"===e)return"markdown";return{png:!0,jpg:!0,jpeg:!0,gif:!0,bmp:!0,webp:!0,ico:!0,svg:!0,tiff:!0,tif:!0,avif:!0,heic:!0,heif:!0,mp3:!0,wav:!0,ogg:!0,flac:!0,aac:!0,m4a:!0,wma:!0,mp4:!0,avi:!0,mkv:!0,mov:!0,wmv:!0,webm:!0,flv:!0,m4v:!0,pdf:!0,doc:!0,docx:!0,xls:!0,xlsx:!0,ppt:!0,pptx:!0,odt:!0,ods:!0,odp:!0,zip:!0,tar:!0,gz:!0,bz2:!0,xz:!0,"7z":!0,rar:!0,ttf:!0,otf:!0,woff:!0,woff2:!0,eot:!0,exe:!0,dll:!0,so:!0,dylib:!0,o:!0,class:!0,pyc:!0,wasm:!0}[e]?"binary":"code"}_cleanupEditors(){let t=this.pict.views["ContentEditor-CodeEditor"];t&&(t.codeJar&&t.destroy(),t.initialRenderComplete=!1);let e=this.pict.ContentAssignment.getElement("#ContentEditor-Editor-Container");e&&e[0]&&(e[0].innerHTML="")}_formatFileSize(t){if(0===t)return"0 B";let e=["B","KB","MB","GB","TB"],n=Math.floor(Math.log(t)/Math.log(1024));return n>=e.length&&(n=e.length-1),(t/Math.pow(1024,n)).toFixed(0===n?0:1)+" "+e[n]}_getMediaType(t){return{png:!0,jpg:!0,jpeg:!0,gif:!0,webp:!0,svg:!0,bmp:!0,ico:!0,avif:!0}[t]?"image":{mp4:!0,webm:!0,mov:!0,mkv:!0,avi:!0,wmv:!0,flv:!0,m4v:!0,ogv:!0}[t]?"video":{mp3:!0,wav:!0,ogg:!0,flac:!0,aac:!0,m4a:!0,wma:!0,oga:!0}[t]?"audio":"other"}_buildMediaPreviewHTML(t,e,n){return"image"===t?'<div class="binary-preview-image-wrap"><div class="binary-preview-image"><img src="'+e+'" alt="'+n+'"></div></div>':"video"===t?'<div class="binary-preview-media-wrap"><video class="binary-preview-video" controls preload="metadata"><source src="'+e+'">Your browser does not support the video tag.</video></div>':"audio"===t?'<div class="binary-preview-media-wrap"><audio class="binary-preview-audio" controls preload="metadata"><source src="'+e+'">Your browser does not support the audio tag.</audio></div>':""}loadMediaPreview(t,e,n){let i=document.getElementById("ContentEditor-MediaPreviewPlaceholder");i&&(i.innerHTML=this._buildMediaPreviewHTML(t,e,n))}_showBinaryPreview(t){let e=this,n=t.replace(/^.*\//,""),i=t.replace(/^.*\./,"").toLowerCase(),o="/content/"+encodeURIComponent(t),r=this._getMediaType(i),s=this.pict.AppData.ContentEditor,a=!1;"image"===r&&(a=s.AutoPreviewImages),"video"===r&&(a=s.AutoPreviewVideo),"audio"===r&&(a=s.AutoPreviewAudio),fetch("/api/filebrowser/info?path="+encodeURIComponent(t)).then(t=>t.json()).then(t=>{let s=t&&"number"==typeof t.Size?e._formatFileSize(t.Size):"Unknown",c=t&&t.Modified?new Date(t.Modified).toLocaleString():"Unknown",l=e.pict.ContentAssignment.getElement("#ContentEditor-Editor-Container");if(!l||!l[0])return;let d="";"other"!==r&&(a?d+=e._buildMediaPreviewHTML(r,o,n):(d+='<div id="ContentEditor-MediaPreviewPlaceholder">',d+='<button class="binary-preview-btn binary-preview-btn-preview"',d+=' onclick="pict.PictApplication.loadMediaPreview(',d+="'"+r+"','"+o+"','"+n.replace(/'/g,"\\'")+"'",d+=')">Preview '+r.charAt(0).toUpperCase()+r.slice(1)+"</button>",d+="</div>")),d+='<div class="binary-preview-card">',d+='<div class="binary-preview-icon">'+i.toUpperCase()+"</div>",d+='<div class="binary-preview-info">',d+='<div class="binary-preview-name">'+n+"</div>",d+='<div class="binary-preview-meta">Size: '+s+"</div>",d+='<div class="binary-preview-meta">Modified: '+c+"</div>",d+='<div class="binary-preview-meta">Type: .'+i+"</div>",d+="</div>",d+='<div class="binary-preview-actions">',d+='<a class="binary-preview-btn" href="'+o+'" download="'+n+'">Download</a>',d+='<a class="binary-preview-btn binary-preview-btn-secondary" href="'+o+'" target="_blank">Open in New Tab</a>',d+="</div>",d+="</div>",l[0].innerHTML=d}).catch(()=>{let t=e.pict.ContentAssignment.getElement("#ContentEditor-Editor-Container");t&&t[0]&&(t[0].innerHTML='<div class="binary-preview-card"><div class="binary-preview-icon">'+i.toUpperCase()+'</div><div class="binary-preview-info"><div class="binary-preview-name">'+n+'</div><div class="binary-preview-meta">Binary file — cannot be edited in the browser</div></div><div class="binary-preview-actions"><a class="binary-preview-btn" href="'+o+'" download="'+n+'">Download</a><a class="binary-preview-btn binary-preview-btn-secondary" href="'+o+'" target="_blank">Open in New Tab</a></div></div>')})}segmentMarkdownContent(t){let e=this.pict.AppData.ContentEditor;if(!e.AutoSegmentMarkdown||!t)return[{Content:t||""}];let n=parseInt(e.AutoSegmentDepth,10)||1;if(1===n){let e=t.split("\n"),n=[],i=[],o=!1;for(let t=0;t<e.length;t++){let r=e[t];/^(`{3,}|~{3,})/.test(r.trim())?(o=!o,i.push(r)):o||""!==r.trim()?i.push(r):i.length>0&&(n.push({Content:i.join("\n")}),i=[])}return i.length>0&&n.push({Content:i.join("\n")}),n.length>0?n:[{Content:""}]}let i=new RegExp("^(#{1,"+n+"})\\s"),o=t.split("\n"),r=[],s=[];for(let t=0;t<o.length;t++){let e=o[t];i.test(e.trim())&&s.length>0&&(r.push({Content:s.join("\n")}),s=[]),s.push(e)}return s.length>0&&r.push({Content:s.join("\n")}),r.length>0?r:[{Content:""}]}navigateToFile(t){if(!t)return;let e=this,n=this.getEditorTypeForFile(t);if(this.pict.AppData.ContentEditor.SaveStatus="",this.pict.AppData.ContentEditor.SaveStatusClass="",window.location.hash="#/edit/"+t,this.pict.AppData.ContentEditor.CurrentFile=t,this.pict.AppData.ContentEditor.IsDirty=!1,this.pict.AppData.ContentEditor.ActiveEditor=n,this._cleanupEditors(),this.pict.views["ContentEditor-TopBar"].render(),"binary"===n)return this._showBinaryPreview(t),void this.updateStats();let i=this.pict.providers["ContentEditor-Provider"];this.pict.AppData.ContentEditor.IsLoading=!0,i.loadFile(t,(i,o)=>{if(e.pict.AppData.ContentEditor.IsLoading=!1,i)return e.pict.AppData.ContentEditor.SaveStatus="Error loading file: "+i,e.pict.AppData.ContentEditor.SaveStatusClass="content-editor-status-error",void e.pict.views["ContentEditor-TopBar"].render();if("markdown"===n){e.pict.AppData.ContentEditor.Document.Segments=e.segmentMarkdownContent(o);let n=e.pict.views["ContentEditor-MarkdownEditor"];if(n){let i="/content/",o=t.lastIndexOf("/");o>0&&(i="/content/"+t.substring(0,o)+"/"),n.options.ImageBaseURL=i,n.render(),n.marshalToView(),n.setPreviewMode(e.pict.AppData.ContentEditor.ContentPreviewMode||"off"),n.toggleControls(e.pict.AppData.ContentEditor.MarkdownEditingControls)}e.updateStats()}else{e.pict.AppData.ContentEditor.CodeContent=o;let n=t.replace(/^.*\./,"").toLowerCase(),i=l.getLanguageForExtension?l.getLanguageForExtension(n):l.ExtensionLanguageMap[n]||"plaintext",r=e.pict.views["ContentEditor-CodeEditor"];r&&(r.initialRenderComplete=!1,r._language=i,r._suppressNextDirty=!0,r.render(),r.marshalToView(),e.pict.AppData.ContentEditor.CodeWordWrap&&r._editorElement&&(r._editorElement.style.whiteSpace="pre-wrap",r._editorElement.style.overflowWrap="break-word")),e.updateStats()}})}saveCurrentFile(){let t=this.pict.AppData.ContentEditor.CurrentFile;if(!t)return;let e=this.pict.providers["ContentEditor-Provider"],n=this,i="";if("code"===this.pict.AppData.ContentEditor.ActiveEditor){let t=this.pict.views["ContentEditor-CodeEditor"];t&&t.marshalFromView(),i=this.pict.AppData.ContentEditor.CodeContent||""}else{let t=this.pict.views["ContentEditor-MarkdownEditor"];t&&t.marshalFromView();let e=this.pict.AppData.ContentEditor.Document.Segments;if(e&&e.length>0){let t=[];for(let n=0;n<e.length;n++)t.push(e[n].Content||"");i=t.join("\n\n")}}this.pict.AppData.ContentEditor.IsSaving=!0,this.pict.AppData.ContentEditor.SaveStatus="Saving...",this.pict.AppData.ContentEditor.SaveStatusClass="content-editor-status-saving",this.pict.views["ContentEditor-TopBar"].render(),e.saveFile(t,i,t=>{n.pict.AppData.ContentEditor.IsSaving=!1,t?(n.pict.AppData.ContentEditor.SaveStatus="Error: "+t,n.pict.AppData.ContentEditor.SaveStatusClass="content-editor-status-error"):(n.pict.AppData.ContentEditor.IsDirty=!1,n.pict.AppData.ContentEditor.SaveStatus="Saved",n.pict.AppData.ContentEditor.SaveStatusClass="content-editor-status-saved",n.loadFileList(),setTimeout(()=>{"Saved"===n.pict.AppData.ContentEditor.SaveStatus&&(n.pict.AppData.ContentEditor.SaveStatus="",n.pict.AppData.ContentEditor.SaveStatusClass="",n.pict.views["ContentEditor-TopBar"].render())},3e3)),n.pict.views["ContentEditor-TopBar"].render()})}closeCurrentFile(){this.pict.AppData.ContentEditor.CurrentFile&&(this.pict.AppData.ContentEditor.IsDirty?this._showCloseConfirmation():this._doCloseFile())}_doCloseFile(){this._hideCloseConfirmation(),this._cleanupEditors(),this.pict.AppData.ContentEditor.CurrentFile="",this.pict.AppData.ContentEditor.ActiveEditor="markdown",this.pict.AppData.ContentEditor.IsDirty=!1,this.pict.AppData.ContentEditor.SaveStatus="",this.pict.AppData.ContentEditor.SaveStatusClass="",this.pict.AppData.ContentEditor.Document.Segments=[{Content:""}],this.pict.AppData.ContentEditor.CodeContent="",window.location.hash="",this.pict.views["ContentEditor-TopBar"].render();let t=this.pict.ContentAssignment.getElement("#ContentEditor-Editor-Container");t&&t[0]&&(t[0].innerHTML='<div style="display:flex;align-items:center;justify-content:center;height:100%;color:#8A7F72;font-size:1.1em;">Select a file from the sidebar to begin editing</div>'),this.updateStats()}confirmCloseFile(){this._doCloseFile()}cancelCloseFile(){this._hideCloseConfirmation()}_showCloseConfirmation(){let t=document.getElementById("ContentEditor-ConfirmOverlay");if(t&&t.classList.add("open"),!this._confirmKeyHandler){let t=this;this._confirmKeyHandler=e=>{let n=e.key.toLowerCase();"y"===n?(e.preventDefault(),t.confirmCloseFile()):"n"!==n&&"Escape"!==e.key||(e.preventDefault(),t.cancelCloseFile())}}window.addEventListener("keydown",this._confirmKeyHandler)}_hideCloseConfirmation(){let t=document.getElementById("ContentEditor-ConfirmOverlay");t&&t.classList.remove("open"),this._confirmKeyHandler&&window.removeEventListener("keydown",this._confirmKeyHandler)}createNewFile(t){if(!t)return;t.replace(/^.*\//,"").indexOf(".")<0&&(t+=".md");let e=this.pict.providers["ContentEditor-Provider"],n=this,i="";i=t.endsWith(".md")?"# "+t.replace(/\.[^.]+$/,"").replace(/^.*\//,"")+"\n\n":"// "+t.replace(/^.*\//,"")+"\n",e.saveFile(t,i,e=>{e||n.loadFileList(null,()=>{n.navigateToFile(t)})})}promptNewFile(){let t=prompt("Enter a name for the new file (e.g. my-page.md, script.js, style.css):");t&&t.trim()&&this.createNewFile(t.trim())}promptNewFolder(){let t=prompt("Enter a name for the new folder:");if(!t||!t.trim())return;t=t.trim();let e="";this.pict.AppData.PictFileBrowser&&this.pict.AppData.PictFileBrowser.CurrentLocation&&(e=this.pict.AppData.PictFileBrowser.CurrentLocation);let n=e?e+"/"+t:t,i=this;fetch("/api/content/mkdir",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({Path:n})}).then(t=>t.json()).then(t=>{t&&t.Success?(i.log.info("Folder created: ".concat(n)),i.loadFileList()):alert("Could not create folder: "+(t?t.Error:"Unknown error"))}).catch(t=>{alert("Error creating folder: "+t.message)})}insertFileReference(t){if(!t)return;let e=this.pict.views["ContentEditor-MarkdownEditor"];if(!e||"markdown"!==this.pict.AppData.ContentEditor.ActiveEditor)return;let n=e._activeSegmentIndex;if(n<0){let t=e._getOrderedSegmentIndices();t.length>0&&(n=t[0])}if(n<0)return;let i=t.replace(/\.[^.]+$/,"");i=i.replace(/^\d{10,}-/,""),i=i.replace(/[-_]+/g," ").trim()||"image";let o=t.substring(t.lastIndexOf(".")).toLowerCase();if([".png",".jpg",".jpeg",".gif",".webp",".svg",".bmp",".avif",".apng",".ico",".tiff",".tif",".jfif"].indexOf(o)>=0)e._insertImageMarkdown(n,t,i);else{let o=e._segmentEditors[n];if(o){let e="["+i+"]("+t+")",n=o.state.selection.main.head;o.dispatch({changes:{from:n,insert:e},selection:{anchor:n+e.length}}),o.focus()}}}handleF4TopicAction(){let t=this.pict.views["ContentEditor-Layout"],e=this.pict.views["ContentEditor-Topics"];if(!t||!e)return;let n=this.pict.AppData.ContentEditor,i=n.ActiveEditor,o=n.CurrentFile,r=0,s=!1;if("markdown"===i&&o){let t=this.pict.views["ContentEditor-MarkdownEditor"];if(t&&t._segmentEditors){let e=0;for(let n in t._segmentEditors){let i=t._segmentEditors[n];if(i&&i.hasFocus){let t=i.state.selection.main.head;r=e+i.state.doc.lineAt(t).number,s=!0;break}i&&i.state&&(e+=i.state.doc.lines)}}}if(n.SidebarCollapsed&&t.toggleSidebar(),t.switchSidebarTab("topics"),s&&o){let t={TopicCode:"New-Topic",TopicHelpFilePath:o,TopicTitle:this._extractFirstHeading()||"New Topic"};r>0&&(t.RelevantMarkdownLine=r),e.addTopic(t)}}_extractFirstHeading(){let t=this.pict.views["ContentEditor-MarkdownEditor"];if(!t||!t._segmentEditors)return"";let e=7,n="";for(let i in t._segmentEditors){let o=t._segmentEditors[i];if(!o||!o.state||!o.state.doc)continue;let r=o.state.doc;for(let t=1;t<=r.lines;t++){let i=r.line(t).text.match(/^(#{1,6})\s+(.+)/);if(i){let t=i[1].length;if(t<e&&(e=t,n=i[2].trim(),1===e))return n}}}return n}updateStats(){let t=document.getElementById("ContentEditor-Stats");if(!t)return;let e=this.pict.AppData.ContentEditor.ActiveEditor,n=0,i=0,o=0;if("markdown"===e){let t=this.pict.views["ContentEditor-MarkdownEditor"];if(t&&t._segmentEditors)for(let e in t._segmentEditors){let r=t._segmentEditors[e];if(r&&r.state&&r.state.doc){n+=r.state.doc.lines,i+=r.state.doc.length;let t=r.state.doc.toString().match(/\S+/g);t&&(o+=t.length)}}}else{if("code"!==e)return void(t.textContent="");{let t=this.pict.views["ContentEditor-CodeEditor"];if(t&&t.codeJar){let e=t.codeJar.toString();i=e.length,n=e.split("\n").length;let r=e.match(/\S+/g);r&&(o=r.length)}}}t.textContent=n+" lines · "+o+" words · "+i+" chars"}markDirty(){this.pict.AppData.ContentEditor.IsDirty||(this.pict.AppData.ContentEditor.IsDirty=!0,this.pict.views["ContentEditor-TopBar"].render())}get _settingsKey(){return"retold-content-editor-settings"}saveSettings(){if("undefined"==typeof window||!window.localStorage)return;let t=this.pict.AppData.ContentEditor,e={AutoSegmentMarkdown:t.AutoSegmentMarkdown,AutoSegmentDepth:t.AutoSegmentDepth,ContentPreviewMode:t.ContentPreviewMode,MarkdownEditingControls:t.MarkdownEditingControls,MarkdownWordWrap:t.MarkdownWordWrap,CodeWordWrap:t.CodeWordWrap,SidebarCollapsed:t.SidebarCollapsed,SidebarWidth:t.SidebarWidth,AutoPreviewImages:t.AutoPreviewImages,AutoPreviewVideo:t.AutoPreviewVideo,AutoPreviewAudio:t.AutoPreviewAudio,ShowHiddenFiles:t.ShowHiddenFiles,TopicsFilePath:t.TopicsFilePath};try{window.localStorage.setItem(this._settingsKey,JSON.stringify(e))}catch(t){this.log.warn("Failed to save settings: "+t.message)}}_loadSettings(){if("undefined"!=typeof window&&window.localStorage)try{let t=window.localStorage.getItem(this._settingsKey);if(!t)return;let e=JSON.parse(t),n=this.pict.AppData.ContentEditor;"boolean"==typeof e.AutoSegmentMarkdown&&(n.AutoSegmentMarkdown=e.AutoSegmentMarkdown),"number"==typeof e.AutoSegmentDepth&&(n.AutoSegmentDepth=e.AutoSegmentDepth),"string"==typeof e.ContentPreviewMode?n.ContentPreviewMode=e.ContentPreviewMode:"boolean"==typeof e.AutoContentPreview&&(n.ContentPreviewMode=e.AutoContentPreview?"bottom":"off"),"boolean"==typeof e.MarkdownEditingControls&&(n.MarkdownEditingControls=e.MarkdownEditingControls),"boolean"==typeof e.MarkdownWordWrap&&(n.MarkdownWordWrap=e.MarkdownWordWrap),"boolean"==typeof e.CodeWordWrap&&(n.CodeWordWrap=e.CodeWordWrap),"boolean"==typeof e.SidebarCollapsed&&(n.SidebarCollapsed=e.SidebarCollapsed),"number"==typeof e.SidebarWidth&&(n.SidebarWidth=e.SidebarWidth),"boolean"==typeof e.AutoPreviewImages&&(n.AutoPreviewImages=e.AutoPreviewImages),"boolean"==typeof e.AutoPreviewVideo&&(n.AutoPreviewVideo=e.AutoPreviewVideo),"boolean"==typeof e.AutoPreviewAudio&&(n.AutoPreviewAudio=e.AutoPreviewAudio),"boolean"==typeof e.ShowHiddenFiles&&(n.ShowHiddenFiles=e.ShowHiddenFiles),"string"==typeof e.TopicsFilePath&&(n.TopicsFilePath=e.TopicsFilePath)}catch(t){this.log.warn("Failed to load settings: "+t.message)}}},e.exports.default_configuration=t("./Pict-Application-ContentEditor-Configuration.json")},{"./Pict-Application-ContentEditor-Configuration.json":101,"./providers/Pict-Provider-ContentEditor.js":106,"./views/PictView-Editor-CodeEditor.js":107,"./views/PictView-Editor-Layout.js":108,"./views/PictView-Editor-MarkdownEditor.js":109,"./views/PictView-Editor-MarkdownReference.js":110,"./views/PictView-Editor-SettingsPanel.js":111,"./views/PictView-Editor-TopBar.js":112,"./views/PictView-Editor-Topics.js":113,"pict-application":44,"pict-section-filebrowser":63}],103:[function(t,e,n){e.exports={Name:"Retold Content Reader",Hash:"ContentReader",MainViewportViewIdentifier:"Docuserve-Layout",AutoSolveAfterInitialize:!0,AutoRenderMainViewportViewAfterInitialize:!1,AutoRenderViewsAfterInitialize:!1,pict_configuration:{Product:"ContentReader-Pict-Application"}}},{}],104:[function(t,e,n){const i=t("pict-docuserve");e.exports=class extends i{constructor(t,e,n){super(t,e,n)}onAfterInitializeAsync(t){this.pict.AppData.Docuserve={CatalogLoaded:!1,Catalog:null,CoverLoaded:!1,Cover:null,SidebarLoaded:!1,SidebarGroups:[],TopBarLoaded:!1,TopBar:null,ErrorPageLoaded:!1,ErrorPageHTML:null,KeywordIndexLoaded:!1,KeywordDocumentCount:0,CurrentGroup:"",CurrentModule:"",CurrentPath:"",SidebarVisible:!0,DocsBaseURL:"/content/",CatalogURL:"/content/retold-catalog.json"},this.pict.providers["Docuserve-Documentation"].loadCatalog(()=>{let e=this.pict.AppData.Docuserve;return e.CoverLoaded&&e.Cover&&e.Cover.Title?document.title=e.Cover.Title.replace(/<[^>]*>/g,""):e.TopBarLoaded&&e.TopBar&&e.TopBar.Brand&&(document.title=e.TopBar.Brand.replace(/<[^>]*>/g,"")),e.TopBar?(Array.isArray(e.TopBar.ExternalLinks)||(e.TopBar.ExternalLinks=[]),e.TopBar.ExternalLinks.push({Text:"Edit",Href:"/"})):(e.TopBarLoaded=!0,e.TopBar={Brand:"Content System",NavLinks:[],ExternalLinks:[{Text:"Edit",Href:"/"}]}),this.pict.views["Docuserve-Layout"].render(),t()})}},e.exports.default_configuration=t("./Pict-Application-ContentReader-Configuration.json")},{"./Pict-Application-ContentReader-Configuration.json":103,"pict-docuserve":49}],105:[function(t,e,n){e.exports={PictContentReader:t("./Pict-Application-ContentReader.js"),PictContentEditor:t("./Pict-Application-ContentEditor.js")},"undefined"!=typeof window&&(window.PictContentReader=e.exports.PictContentReader,window.PictContentEditor=e.exports.PictContentEditor)},{"./Pict-Application-ContentEditor.js":102,"./Pict-Application-ContentReader.js":104}],106:[function(t,e,n){const i=t("pict-provider");e.exports=class extends i{constructor(t,e,n){super(t,e,n)}loadFile(t,e){let n="function"==typeof e?e:()=>{};if(!t)return n("No file path specified","");fetch("/api/content/read/"+encodeURIComponent(t)).then(t=>t.ok?t.json():n("File not found: "+t.status,"")).then(t=>t&&t.Success?n(null,t.Content||""):n(t?t.Error:"Unknown error","")).catch(e=>(this.log.warn("ContentEditor: Error loading file [".concat(t,"]: ").concat(e)),n(e.message,"")))}saveFile(t,e,n){let i="function"==typeof n?n:()=>{};if(!t)return i("No file path specified");fetch("/api/content/save/"+encodeURIComponent(t),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({Content:e})}).then(t=>t.ok?t.json():i("Save failed: "+t.status)).then(t=>t&&t.Success?i(null):i(t?t.Error:"Unknown error")).catch(e=>(this.log.warn("ContentEditor: Error saving file [".concat(t,"]: ").concat(e)),i(e.message)))}uploadImage(t,e){let n="function"==typeof e?e:()=>{},i="",o=this.pict.AppData.ContentEditor.CurrentFile;if(o){let t=o.lastIndexOf("/");t>0&&(i=o.substring(0,t))}else this.pict.AppData.PictFileBrowser&&this.pict.AppData.PictFileBrowser.CurrentLocation&&(i=this.pict.AppData.PictFileBrowser.CurrentLocation);let r={"Content-Type":t.type,"x-filename":t.name};i&&(r["x-upload-path"]=i),fetch("/api/content/upload-image",{method:"POST",body:t,headers:r}).then(t=>t.json()).then(t=>t&&t.Success&&t.URL?n(null,t.URL):n(t?t.Error:"Upload failed")).catch(t=>(this.log.warn("ContentEditor: Image upload failed: ".concat(t)),n(t.message)))}},e.exports.default_configuration={ProviderIdentifier:"ContentEditor-Provider",AutoInitialize:!0,AutoInitializeOrdinal:0}},{"pict-provider":58}],107:[function(t,e,n){const i=t("pict-section-code"),o={js:"javascript",mjs:"javascript",cjs:"javascript",jsx:"javascript",ts:"typescript",tsx:"typescript",json:"json",html:"xml",htm:"xml",xml:"xml",svg:"xml",css:"css",scss:"scss",sass:"scss",less:"less",sql:"sql",py:"python",rb:"ruby",java:"java",kt:"kotlin",kts:"kotlin",go:"go",rs:"rust",c:"c",h:"c",cpp:"cpp",cc:"cpp",hpp:"cpp",cs:"csharp",swift:"swift",php:"php",sh:"bash",bash:"bash",zsh:"bash",fish:"bash",yml:"yaml",yaml:"yaml",toml:"ini",ini:"ini",cfg:"ini",conf:"ini",dockerfile:"dockerfile",docker:"dockerfile",makefile:"makefile",mk:"makefile",md:"markdown",markdown:"markdown",lua:"lua",r:"r",pl:"perl",pm:"perl",ex:"elixir",exs:"elixir",erl:"erlang",hrl:"erlang",hs:"haskell",clj:"clojure",scala:"scala",dart:"dart",groovy:"groovy",gradle:"groovy",tf:"terraform",vim:"vim",diff:"diff",patch:"diff",log:"accesslog",txt:"plaintext"};e.exports=class extends i{constructor(t,e,n){super(t,e,n),this._suppressNextDirty=!1}onAfterInitialRender(){if("undefined"!=typeof window&&window.CodeJarModules&&window.CodeJarModules.CodeJar&&this.connectCodeJarPrototype(window.CodeJarModules.CodeJar),"undefined"!=typeof window&&window.CodeJarModules&&window.CodeJarModules.hljs){let t=window.CodeJarModules.hljs,e=this._language;this._highlightFunction=function(n){n.removeAttribute("data-highlighted"),delete n.dataset.highlighted,n.className=n.className.replace(/\bhljs\b/g,"").replace(/\blanguage-\S+/g,"").trim(),n.classList.add("hljs"),e&&"plaintext"!==e&&n.classList.add("language-"+e),t.highlightElement(n)}}return super.onAfterInitialRender()}setLanguage(t){if(this._language=t,"undefined"!=typeof window&&window.CodeJarModules&&window.CodeJarModules.hljs){let e=window.CodeJarModules.hljs,n=t;this._highlightFunction=function(t){t.removeAttribute("data-highlighted"),delete t.dataset.highlighted,t.className=t.className.replace(/\bhljs\b/g,"").replace(/\blanguage-\S+/g,"").trim(),t.classList.add("hljs"),n&&"plaintext"!==n&&t.classList.add("language-"+n),e.highlightElement(t)}}if(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.codeJar.updateCode(t),this.codeJar.onUpdate(t=>{this._updateLineNumbers(),this.onCodeChange(t)})}}onCodeChange(t){super.onCodeChange(t),this._suppressNextDirty?this._suppressNextDirty=!1:this.pict.PictApplication&&(this.pict.PictApplication.markDirty(),this.pict.PictApplication.updateStats())}static getLanguageForExtension(t){if(!t)return"plaintext";let e=t.toLowerCase();return o[e]||"plaintext"}},e.exports.default_configuration={ViewIdentifier:"ContentEditor-CodeEditor",DefaultRenderable:"CodeEditor-Wrap",DefaultDestinationAddress:"#ContentEditor-Editor-Container",TargetElementAddress:"#ContentEditor-Editor-Container",CodeDataAddress:"AppData.ContentEditor.CodeContent",ReadOnly:!1,LineNumbers:!0,Language:"javascript",Tab:"\t",AutoRender:!1,Renderables:[{RenderableHash:"CodeEditor-Wrap",TemplateHash:"CodeEditor-Container",DestinationAddress:"#ContentEditor-Editor-Container"}]},e.exports.ExtensionLanguageMap=o},{"pict-section-code":61}],108:[function(t,e,n){const i=t("pict-view");e.exports=class extends i{constructor(t,e,n){super(t,e,n),this._minSidebarWidth=140,this._maxSidebarWidth=600}onAfterRender(t,e,n,i){this.pict.views["ContentEditor-TopBar"].render();let o=this.pict.ContentAssignment.getElement("#ContentEditor-Editor-Container");o&&o[0]&&!this.pict.AppData.ContentEditor.CurrentFile&&(o[0].innerHTML='<div style="display:flex;align-items:center;justify-content:center;height:100%;color:#8A7F72;font-size:1.1em;">Select a file from the sidebar to begin editing</div>'),this.pict.CSSMap.injectCSS();let r=this.pict.AppData.ContentEditor,s=document.getElementById("ContentEditor-SidebarWrap"),a=document.getElementById("ContentEditor-SidebarToggle");if(s){let t=window.innerWidth<=768;s.style.width=t?"100%":r.SidebarWidth+"px",r.SidebarCollapsed?(s.classList.add("collapsed"),a&&(a.innerHTML=t?"▼":"▶")):t&&(r.SidebarCollapsed=!0,s.classList.add("collapsed"),a&&(a.innerHTML="▼"))}let c=this;return a&&a.addEventListener("click",()=>{c.toggleSidebar()}),this._wireResizeHandle(),window.addEventListener("hashchange",()=>{c.pict.PictApplication.resolveHash()}),window.addEventListener("keydown",t=>{if((t.metaKey||t.ctrlKey)&&"s"===t.key)return t.preventDefault(),void c.pict.PictApplication.saveCurrentFile();if("F1"===t.key)return t.preventDefault(),void c._handleF1();if("F2"===t.key)return t.preventDefault(),void c.toggleSidebar();if("F3"===t.key)return t.preventDefault(),void c.toggleUploadForm();if((t.metaKey||t.ctrlKey)&&t.shiftKey&&("u"===t.key||"U"===t.key))return t.preventDefault(),void c.toggleUploadForm();if("F4"===t.key)return t.preventDefault(),void c.pict.PictApplication.handleF4TopicAction();if((t.metaKey||t.ctrlKey)&&t.shiftKey&&("t"===t.key||"T"===t.key))return t.preventDefault(),void c.pict.PictApplication.handleF4TopicAction();if("Escape"===t.key){let e=document.getElementById("ContentEditor-UploadOverlay");if(e&&e.classList.contains("open"))return void c.closeUploadForm();let n=document.getElementById("ContentEditor-ConfirmOverlay");if(n&&n.classList.contains("open"))return;if(c.pict.AppData.ContentEditor.CurrentFile)return t.preventDefault(),void c.pict.PictApplication.closeCurrentFile()}}),super.onAfterRender(t,e,n,i)}toggleSidebar(){let t=document.getElementById("ContentEditor-SidebarWrap"),e=document.getElementById("ContentEditor-SidebarToggle");if(!t)return;let n=this.pict.AppData.ContentEditor;n.SidebarCollapsed=!n.SidebarCollapsed;let i=window.innerWidth<=768;n.SidebarCollapsed?(t.classList.add("collapsed"),e&&(e.innerHTML=i?"▼":"▶")):(t.classList.remove("collapsed"),t.style.width=i?"100%":n.SidebarWidth+"px",e&&(e.innerHTML=i?"▲":"◀")),this.pict.PictApplication.saveSettings()}switchSidebarTab(t){let e={files:document.getElementById("ContentEditor-Sidebar-Container"),reference:document.getElementById("ContentEditor-SidebarReference-Container"),topics:document.getElementById("ContentEditor-SidebarTopics-Container")},n={files:document.getElementById("ContentEditor-SidebarTab-Files"),reference:document.getElementById("ContentEditor-SidebarTab-Reference"),topics:document.getElementById("ContentEditor-SidebarTab-Topics")};for(let t in e)e[t]&&(e[t].style.display="none"),n[t]&&n[t].classList.remove("active");e[t]&&(e[t].style.display=""),n[t]&&n[t].classList.add("active");let i=document.getElementById("ContentEditor-SidebarWrap");if(i&&("reference"===t||"topics"===t?i.classList.add("sidebar-expanded-pane"):i.classList.remove("sidebar-expanded-pane")),"reference"===t){let t=this.pict.views["ContentEditor-MarkdownReference"];t&&!t._hasRendered&&t.render()}if("topics"===t){let t=this.pict.views["ContentEditor-Topics"];t&&!t._hasRendered&&t.render()}}_handleF1(){if(this.pict.AppData.ContentEditor.SidebarCollapsed)return this.toggleSidebar(),void this.switchSidebarTab("reference");let t=document.getElementById("ContentEditor-SidebarTab-Reference");t&&t.classList.contains("active")?this.switchSidebarTab("files"):this.switchSidebarTab("reference")}getActiveSidebarTab(){let t=document.getElementById("ContentEditor-SidebarTab-Reference"),e=document.getElementById("ContentEditor-SidebarTab-Topics");return t&&t.classList.contains("active")?"reference":e&&e.classList.contains("active")?"topics":"files"}toggleUploadForm(){let t=document.getElementById("ContentEditor-UploadOverlay");t&&(t.classList.contains("open")?this.closeUploadForm():this.openUploadForm())}openUploadForm(){let t=document.getElementById("ContentEditor-UploadOverlay");t&&t.classList.add("open"),this._wireUploadDropzone()}closeUploadForm(){let t=document.getElementById("ContentEditor-UploadOverlay");t&&t.classList.remove("open");let e=document.getElementById("ContentEditor-UploadFileInput");e&&(e.value="");let n=document.getElementById("ContentEditor-UploadStatus");n&&(n.innerHTML="");let i=document.getElementById("ContentEditor-UploadResult");i&&(i.innerHTML="")}onUploadOverlayClick(t){"ContentEditor-UploadOverlay"===t.target.id&&this.closeUploadForm()}onUploadFileSelected(t){t.files&&t.files.length>0&&this._uploadFile(t.files[0])}_wireUploadDropzone(){let t=document.getElementById("ContentEditor-UploadDropzone");if(!t||t._wired)return;t._wired=!0;let e=this;t.addEventListener("dragover",e=>{e.preventDefault(),e.stopPropagation(),t.classList.add("dragover")}),t.addEventListener("dragleave",e=>{e.preventDefault(),e.stopPropagation(),t.classList.remove("dragover")}),t.addEventListener("drop",n=>{n.preventDefault(),n.stopPropagation(),t.classList.remove("dragover"),n.dataTransfer&&n.dataTransfer.files&&n.dataTransfer.files.length>0&&e._uploadFile(n.dataTransfer.files[0])})}_uploadFile(t){let e=document.getElementById("ContentEditor-UploadStatus"),n=document.getElementById("ContentEditor-UploadResult");if(!t)return;if(!t.type.startsWith("image/"))return void(e&&(e.innerHTML='<span class="content-editor-upload-status-error">Only image files are supported.</span>'));e&&(e.innerHTML="Uploading <strong>"+t.name+"</strong>..."),n&&(n.innerHTML="");let i=this,o=this.pict.providers["ContentEditor-Provider"];o?o.uploadImage(t,(o,r)=>{if(o)return void(e&&(e.innerHTML='<span class="content-editor-upload-status-error">Upload failed: '+o+"</span>"));e&&(e.innerHTML='<span class="content-editor-upload-status-success">Uploaded successfully!</span>');let s="";n&&(n.innerHTML='<div class="content-editor-upload-result"><div class="content-editor-upload-result-label">Markdown</div><div class="content-editor-upload-result-url"><span class="content-editor-upload-result-text">'+s+'</span><button class="content-editor-upload-result-copy" onclick="navigator.clipboard.writeText(\''+s.replace(/'/g,"\\'")+'\').then(function(){this.textContent=\'Copied!\'}.bind(this))">Copy</button></div><div class="content-editor-upload-result-label" style="margin-top:8px">URL</div><div class="content-editor-upload-result-url"><span class="content-editor-upload-result-text">'+r+'</span><button class="content-editor-upload-result-copy" onclick="navigator.clipboard.writeText(\''+r.replace(/'/g,"\\'")+"').then(function(){this.textContent='Copied!'}.bind(this))\">Copy</button></div></div>"),i.pict.PictApplication.loadFileList()}):e&&(e.innerHTML='<span class="content-editor-upload-status-error">Provider not available.</span>')}_wireResizeHandle(){let t=document.getElementById("ContentEditor-ResizeHandle"),e=document.getElementById("ContentEditor-SidebarWrap");if(!t||!e)return;let n=this,i=!1,o=0,r=0;function s(t){if(!i)return;let s=t.clientX-o,a=r+s;a<n._minSidebarWidth&&(a=n._minSidebarWidth),a>n._maxSidebarWidth&&(a=n._maxSidebarWidth),e.style.width=a+"px"}function a(){i&&(i=!1,t.classList.remove("dragging"),e.style.transition="",document.body.style.userSelect="",document.body.style.cursor="",n.pict.AppData.ContentEditor.SidebarWidth=e.offsetWidth,n.pict.PictApplication.saveSettings(),document.removeEventListener("mousemove",s),document.removeEventListener("mouseup",a))}t.addEventListener("mousedown",function(c){n.pict.AppData.ContentEditor.SidebarCollapsed||(c.preventDefault(),i=!0,o=c.clientX,r=e.offsetWidth,t.classList.add("dragging"),e.style.transition="none",document.body.style.userSelect="none",document.body.style.cursor="col-resize",document.addEventListener("mousemove",s),document.addEventListener("mouseup",a))})}},e.exports.default_configuration={ViewIdentifier:"ContentEditor-Layout",DefaultRenderable:"ContentEditor-Layout-Shell",DefaultDestinationAddress:"#ContentEditor-Application-Container",AutoRender:!1,CSS:'\n\t\t#ContentEditor-Application-Container\n\t\t{\n\t\t\tdisplay: flex;\n\t\t\tflex-direction: column;\n\t\t\theight: 100vh;\n\t\t\tbackground: #F5F3EE;\n\t\t}\n\t\t#ContentEditor-TopBar-Container\n\t\t{\n\t\t\tflex-shrink: 0;\n\t\t}\n\t\t.content-editor-body\n\t\t{\n\t\t\tdisplay: flex;\n\t\t\tflex: 1;\n\t\t\tmin-height: 0;\n\t\t\toverflow: hidden;\n\t\t}\n\t\t/* Sidebar wrapper holds the sidebar content + collapse toggle */\n\t\t.content-editor-sidebar-wrap\n\t\t{\n\t\t\tdisplay: flex;\n\t\t\tflex-shrink: 0;\n\t\t\tposition: relative;\n\t\t\ttransition: width 0.2s ease;\n\t\t}\n\t\t/* Inner wrapper: vertical flex for tab bar + panes */\n\t\t.content-editor-sidebar-inner\n\t\t{\n\t\t\tdisplay: flex;\n\t\t\tflex-direction: column;\n\t\t\tflex: 1;\n\t\t\tmin-width: 0;\n\t\t\tmin-height: 0;\n\t\t\toverflow: hidden;\n\t\t}\n\t\t/* Sidebar tab bar */\n\t\t.content-editor-sidebar-tabs\n\t\t{\n\t\t\tdisplay: flex;\n\t\t\tflex-shrink: 0;\n\t\t\tborder-bottom: 1px solid #DDD6CA;\n\t\t\tbackground: #F5F0EA;\n\t\t}\n\t\t.content-editor-sidebar-tab\n\t\t{\n\t\t\tflex: 1;\n\t\t\tpadding: 7px 0;\n\t\t\tborder: none;\n\t\t\tbackground: transparent;\n\t\t\tfont-size: 0.78rem;\n\t\t\tfont-weight: 600;\n\t\t\tcolor: #8A7F72;\n\t\t\tcursor: pointer;\n\t\t\tborder-bottom: 2px solid transparent;\n\t\t\ttransition: color 0.15s, border-color 0.15s;\n\t\t}\n\t\t.content-editor-sidebar-tab:hover\n\t\t{\n\t\t\tcolor: #3D3229;\n\t\t}\n\t\t.content-editor-sidebar-tab.active\n\t\t{\n\t\t\tcolor: #2E7D74;\n\t\t\tborder-bottom-color: #2E7D74;\n\t\t}\n\t\t.content-editor-sidebar-addfile\n\t\t{\n\t\t\tflex-shrink: 0;\n\t\t\twidth: 30px;\n\t\t\tborder: none;\n\t\t\tbackground: transparent;\n\t\t\tfont-size: 1.1rem;\n\t\t\tfont-weight: 400;\n\t\t\tcolor: #8A7F72;\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\tborder-bottom: 2px solid transparent;\n\t\t\ttransition: color 0.15s, background 0.15s;\n\t\t}\n\t\t.content-editor-sidebar-addfile:hover\n\t\t{\n\t\t\tcolor: #2E7D74;\n\t\t\tbackground: #EDE9E3;\n\t\t}\n\t\t/* Sidebar panes */\n\t\t.content-editor-sidebar-pane\n\t\t{\n\t\t\tflex: 1;\n\t\t\toverflow-y: auto;\n\t\t\toverflow-x: hidden;\n\t\t\tmin-width: 0;\n\t\t\tmin-height: 0;\n\t\t}\n\t\t#ContentEditor-Sidebar-Container\n\t\t{\n\t\t\tbackground: #FAF8F4;\n\t\t}\n\t\t/* Collapsed state */\n\t\t.content-editor-sidebar-wrap.collapsed\n\t\t{\n\t\t\twidth: 0 !important;\n\t\t}\n\t\t.content-editor-sidebar-wrap.collapsed .content-editor-sidebar-inner\n\t\t{\n\t\t\tvisibility: hidden;\n\t\t}\n\t\t.content-editor-sidebar-wrap.collapsed .content-editor-resize-handle\n\t\t{\n\t\t\tdisplay: none;\n\t\t}\n\t\t/* Collapse / expand toggle */\n\t\t.content-editor-sidebar-toggle\n\t\t{\n\t\t\tposition: absolute;\n\t\t\ttop: 8px;\n\t\t\tright: -20px;\n\t\t\twidth: 20px;\n\t\t\theight: 28px;\n\t\t\tdisplay: flex;\n\t\t\talign-items: center;\n\t\t\tjustify-content: center;\n\t\t\tbackground: #FAF8F4;\n\t\t\tborder: 1px solid #DDD6CA;\n\t\t\tborder-left: none;\n\t\t\tborder-radius: 0 4px 4px 0;\n\t\t\tcursor: pointer;\n\t\t\tz-index: 10;\n\t\t\tcolor: #8A7F72;\n\t\t\tfont-size: 11px;\n\t\t\tline-height: 1;\n\t\t\ttransition: color 0.15s;\n\t\t}\n\t\t.content-editor-sidebar-toggle:hover\n\t\t{\n\t\t\tcolor: #3D3229;\n\t\t}\n\t\t.content-editor-sidebar-wrap.collapsed .content-editor-sidebar-toggle\n\t\t{\n\t\t\tright: -20px;\n\t\t}\n\t\t/* Resize handle */\n\t\t.content-editor-resize-handle\n\t\t{\n\t\t\tflex-shrink: 0;\n\t\t\twidth: 5px;\n\t\t\tcursor: col-resize;\n\t\t\tbackground: transparent;\n\t\t\tborder-right: 1px solid #DDD6CA;\n\t\t\ttransition: background 0.15s;\n\t\t}\n\t\t.content-editor-resize-handle:hover,\n\t\t.content-editor-resize-handle.dragging\n\t\t{\n\t\t\tbackground: #2E7D74;\n\t\t\tborder-right-color: #2E7D74;\n\t\t}\n\t\t/* File browser layout overrides for sidebar use */\n\t\t#ContentEditor-Sidebar-Container .pict-filebrowser\n\t\t{\n\t\t\tborder: none;\n\t\t\tborder-radius: 0;\n\t\t\tbackground: transparent;\n\t\t}\n\t\t#ContentEditor-Sidebar-Container .pict-filebrowser-browse-pane\n\t\t{\n\t\t\tdisplay: none;\n\t\t}\n\t\t#ContentEditor-Sidebar-Container .pict-filebrowser-view-pane\n\t\t{\n\t\t\tdisplay: none;\n\t\t}\n\t\t/* Hide size/date columns — the sidebar is too narrow for them */\n\t\t#ContentEditor-Sidebar-Container .pict-fb-detail-col-size,\n\t\t#ContentEditor-Sidebar-Container .pict-fb-detail-col-modified,\n\t\t#ContentEditor-Sidebar-Container .pict-fb-detail-size,\n\t\t#ContentEditor-Sidebar-Container .pict-fb-detail-modified\n\t\t{\n\t\t\tdisplay: none;\n\t\t}\n\t\t/* Hide the column header bar in sidebar mode */\n\t\t#ContentEditor-Sidebar-Container .pict-fb-detail-header\n\t\t{\n\t\t\tdisplay: none;\n\t\t}\n\t\t/* Breadcrumb bar: flex wrapper with create-folder button */\n\t\t.pict-fb-breadcrumb-bar\n\t\t{\n\t\t\tdisplay: flex;\n\t\t\talign-items: center;\n\t\t\tbackground: #F5F0E8;\n\t\t\tborder-bottom: 1px solid #DDD6CA;\n\t\t}\n\t\t.pict-fb-breadcrumb-bar .pict-fb-breadcrumb\n\t\t{\n\t\t\tflex: 1;\n\t\t\tborder-bottom: none;\n\t\t}\n\t\t.pict-fb-breadcrumb-addfolder\n\t\t{\n\t\t\tflex-shrink: 0;\n\t\t\tbackground: transparent;\n\t\t\tborder: none;\n\t\t\tfont-size: 1.1rem;\n\t\t\tfont-weight: 600;\n\t\t\tcolor: #8A7F72;\n\t\t\tcursor: pointer;\n\t\t\tpadding: 4px 10px;\n\t\t\tline-height: 1;\n\t\t\tborder-radius: 4px;\n\t\t\tmargin-right: 4px;\n\t\t}\n\t\t.pict-fb-breadcrumb-addfolder:hover\n\t\t{\n\t\t\tcolor: #2E7D74;\n\t\t\tbackground: #EAE3D8;\n\t\t}\n\t\t#ContentEditor-Editor-Container\n\t\t{\n\t\t\tflex: 1;\n\t\t\toverflow-y: auto;\n\t\t\tpadding: 44px 16px 16px 16px;\n\t\t}\n\t\t/* Code editor: fill the container and remove outer border */\n\t\t#ContentEditor-Editor-Container .pict-code-editor-wrap\n\t\t{\n\t\t\theight: calc(100% - 4px);\n\t\t\tborder: none;\n\t\t\tborder-radius: 0;\n\t\t}\n\t\t#ContentEditor-Editor-Container .pict-code-editor\n\t\t{\n\t\t\tmin-height: unset;\n\t\t\theight: 100%;\n\t\t\tbackground: #FAFAFA;\n\t\t}\n\t\t/* Binary file preview */\n\t\t.binary-preview-image-wrap\n\t\t{\n\t\t\tmargin-bottom: 20px;\n\t\t}\n\t\t.binary-preview-image\n\t\t{\n\t\t\tdisplay: inline-block;\n\t\t\tbackground: #FFF;\n\t\t\tborder: 1px solid #DDD6CA;\n\t\t\tborder-radius: 6px;\n\t\t\tpadding: 24px;\n\t\t}\n\t\t.binary-preview-image img\n\t\t{\n\t\t\tdisplay: block;\n\t\t\tmax-width: 100%;\n\t\t\tmax-height: 400px;\n\t\t\tobject-fit: contain;\n\t\t\tborder-radius: 4px;\n\t\t}\n\t\t.binary-preview-card\n\t\t{\n\t\t\tdisplay: flex;\n\t\t\talign-items: center;\n\t\t\tgap: 20px;\n\t\t\tbackground: #FFF;\n\t\t\tborder: 1px solid #DDD6CA;\n\t\t\tborder-radius: 6px;\n\t\t\tpadding: 24px;\n\t\t\tmax-width: 600px;\n\t\t}\n\t\t.binary-preview-icon\n\t\t{\n\t\t\tflex-shrink: 0;\n\t\t\twidth: 64px;\n\t\t\theight: 64px;\n\t\t\tdisplay: flex;\n\t\t\talign-items: center;\n\t\t\tjustify-content: center;\n\t\t\tbackground: #F0EDE8;\n\t\t\tborder-radius: 8px;\n\t\t\tfont-size: 0.75rem;\n\t\t\tfont-weight: 700;\n\t\t\tcolor: #5E5549;\n\t\t\tletter-spacing: 0.5px;\n\t\t}\n\t\t.binary-preview-info\n\t\t{\n\t\t\tflex: 1;\n\t\t\tmin-width: 0;\n\t\t}\n\t\t.binary-preview-name\n\t\t{\n\t\t\tfont-size: 1rem;\n\t\t\tfont-weight: 600;\n\t\t\tcolor: #3D3229;\n\t\t\tmargin-bottom: 6px;\n\t\t\tword-break: break-all;\n\t\t}\n\t\t.binary-preview-meta\n\t\t{\n\t\t\tfont-size: 0.8rem;\n\t\t\tcolor: #8A7F72;\n\t\t\tline-height: 1.6;\n\t\t}\n\t\t.binary-preview-actions\n\t\t{\n\t\t\tflex-shrink: 0;\n\t\t\tdisplay: flex;\n\t\t\tflex-direction: column;\n\t\t\tgap: 8px;\n\t\t}\n\t\t.binary-preview-btn\n\t\t{\n\t\t\tdisplay: inline-block;\n\t\t\tpadding: 8px 16px;\n\t\t\tborder-radius: 4px;\n\t\t\tfont-size: 0.8rem;\n\t\t\tfont-weight: 600;\n\t\t\ttext-decoration: none;\n\t\t\ttext-align: center;\n\t\t\tcursor: pointer;\n\t\t\tbackground: #2E7D74;\n\t\t\tcolor: #FFF;\n\t\t}\n\t\t.binary-preview-btn:hover\n\t\t{\n\t\t\tbackground: #3A9E92;\n\t\t}\n\t\t.binary-preview-btn-secondary\n\t\t{\n\t\t\tbackground: transparent;\n\t\t\tcolor: #5E5549;\n\t\t\tborder: 1px solid #DDD6CA;\n\t\t}\n\t\t.binary-preview-btn-secondary:hover\n\t\t{\n\t\t\tborder-color: #8A7F72;\n\t\t\tcolor: #3D3229;\n\t\t}\n\t\t.binary-preview-btn-preview\n\t\t{\n\t\t\tpadding: 10px 20px;\n\t\t\tfont-size: 0.85rem;\n\t\t\tborder: 1px solid #DDD6CA;\n\t\t\tbackground: #FAF8F4;\n\t\t\tcolor: #3D3229;\n\t\t\tcursor: pointer;\n\t\t\tborder-radius: 6px;\n\t\t\ttransition: background 0.15s, border-color 0.15s;\n\t\t}\n\t\t.binary-preview-btn-preview:hover\n\t\t{\n\t\t\tbackground: #F0EDE8;\n\t\t\tborder-color: #8A7F72;\n\t\t}\n\t\t#ContentEditor-MediaPreviewPlaceholder\n\t\t{\n\t\t\tmargin-bottom: 20px;\n\t\t}\n\t\t.binary-preview-media-wrap\n\t\t{\n\t\t\tmargin-bottom: 20px;\n\t\t}\n\t\t.binary-preview-video\n\t\t{\n\t\t\tdisplay: block;\n\t\t\tmax-width: 100%;\n\t\t\tmax-height: 500px;\n\t\t\tborder-radius: 6px;\n\t\t\tborder: 1px solid #DDD6CA;\n\t\t\tbackground: #000;\n\t\t}\n\t\t.binary-preview-audio\n\t\t{\n\t\t\tdisplay: block;\n\t\t\twidth: 100%;\n\t\t\tmax-width: 500px;\n\t\t}\n\t\t/* Image upload overlay */\n\t\t.content-editor-upload-overlay\n\t\t{\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: 1099;\n\t\t\tbackground: rgba(0, 0, 0, 0.35);\n\t\t}\n\t\t.content-editor-upload-overlay.open\n\t\t{\n\t\t\tdisplay: flex;\n\t\t\talign-items: center;\n\t\t\tjustify-content: center;\n\t\t}\n\t\t.content-editor-upload-panel\n\t\t{\n\t\t\tbackground: #FFF;\n\t\t\tborder: 1px solid #DDD6CA;\n\t\t\tborder-radius: 10px;\n\t\t\tbox-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);\n\t\t\twidth: 420px;\n\t\t\tmax-width: 90vw;\n\t\t\toverflow: hidden;\n\t\t}\n\t\t.content-editor-upload-header\n\t\t{\n\t\t\tdisplay: flex;\n\t\t\talign-items: center;\n\t\t\tjustify-content: space-between;\n\t\t\tpadding: 14px 18px;\n\t\t\tborder-bottom: 1px solid #EDE9E3;\n\t\t}\n\t\t.content-editor-upload-title\n\t\t{\n\t\t\tfont-size: 0.95rem;\n\t\t\tfont-weight: 600;\n\t\t\tcolor: #3D3229;\n\t\t}\n\t\t.content-editor-upload-close\n\t\t{\n\t\t\tbackground: transparent;\n\t\t\tborder: none;\n\t\t\tfont-size: 1.2rem;\n\t\t\tcolor: #8A7F72;\n\t\t\tcursor: pointer;\n\t\t\tpadding: 2px 6px;\n\t\t\tline-height: 1;\n\t\t\tborder-radius: 4px;\n\t\t}\n\t\t.content-editor-upload-close:hover\n\t\t{\n\t\t\tcolor: #3D3229;\n\t\t\tbackground: #F0EDE8;\n\t\t}\n\t\t.content-editor-upload-body\n\t\t{\n\t\t\tpadding: 18px;\n\t\t}\n\t\t.content-editor-upload-dropzone\n\t\t{\n\t\t\tborder: 2px dashed #DDD6CA;\n\t\t\tborder-radius: 8px;\n\t\t\tpadding: 28px 16px;\n\t\t\ttext-align: center;\n\t\t\tcursor: pointer;\n\t\t\ttransition: border-color 0.15s, background 0.15s;\n\t\t\tbackground: #FAF8F4;\n\t\t}\n\t\t.content-editor-upload-dropzone:hover,\n\t\t.content-editor-upload-dropzone.dragover\n\t\t{\n\t\t\tborder-color: #2E7D74;\n\t\t\tbackground: #F0FAF8;\n\t\t}\n\t\t.content-editor-upload-dropzone-icon\n\t\t{\n\t\t\tfont-size: 2rem;\n\t\t\tcolor: #8A7F72;\n\t\t\tmargin-bottom: 6px;\n\t\t}\n\t\t.content-editor-upload-dropzone-text\n\t\t{\n\t\t\tfont-size: 0.82rem;\n\t\t\tcolor: #5E5549;\n\t\t}\n\t\t.content-editor-upload-dropzone-hint\n\t\t{\n\t\t\tfont-size: 0.72rem;\n\t\t\tcolor: #8A7F72;\n\t\t\tmargin-top: 4px;\n\t\t}\n\t\t.content-editor-upload-file-input\n\t\t{\n\t\t\tdisplay: none;\n\t\t}\n\t\t.content-editor-upload-status\n\t\t{\n\t\t\tmargin-top: 12px;\n\t\t\tfont-size: 0.82rem;\n\t\t\tcolor: #5E5549;\n\t\t\tmin-height: 20px;\n\t\t}\n\t\t.content-editor-upload-status-error\n\t\t{\n\t\t\tcolor: #D9534F;\n\t\t}\n\t\t.content-editor-upload-status-success\n\t\t{\n\t\t\tcolor: #2E7D74;\n\t\t}\n\t\t.content-editor-upload-result\n\t\t{\n\t\t\tmargin-top: 12px;\n\t\t\tpadding: 10px 12px;\n\t\t\tbackground: #F0EDE8;\n\t\t\tborder: 1px solid #DDD6CA;\n\t\t\tborder-radius: 6px;\n\t\t}\n\t\t.content-editor-upload-result-label\n\t\t{\n\t\t\tfont-size: 0.72rem;\n\t\t\tcolor: #8A7F72;\n\t\t\tmargin-bottom: 4px;\n\t\t}\n\t\t.content-editor-upload-result-url\n\t\t{\n\t\t\tdisplay: flex;\n\t\t\talign-items: center;\n\t\t\tgap: 6px;\n\t\t}\n\t\t.content-editor-upload-result-text\n\t\t{\n\t\t\tflex: 1;\n\t\t\tfont-family: monospace;\n\t\t\tfont-size: 0.78rem;\n\t\t\tcolor: #3D3229;\n\t\t\tword-break: break-all;\n\t\t}\n\t\t.content-editor-upload-result-copy\n\t\t{\n\t\t\tflex-shrink: 0;\n\t\t\tbackground: #2E7D74;\n\t\t\tcolor: #FFF;\n\t\t\tborder: none;\n\t\t\tborder-radius: 4px;\n\t\t\tpadding: 4px 10px;\n\t\t\tfont-size: 0.72rem;\n\t\t\tfont-weight: 600;\n\t\t\tcursor: pointer;\n\t\t}\n\t\t.content-editor-upload-result-copy:hover\n\t\t{\n\t\t\tbackground: #3A9E92;\n\t\t}\n\t\t.content-editor-upload-kbd\n\t\t{\n\t\t\tdisplay: inline-block;\n\t\t\tpadding: 1px 5px;\n\t\t\tfont-size: 0.68rem;\n\t\t\tfont-family: monospace;\n\t\t\tbackground: #F0EDE8;\n\t\t\tborder: 1px solid #DDD6CA;\n\t\t\tborder-radius: 3px;\n\t\t\tcolor: #5E5549;\n\t\t}\n\t\t.content-editor-upload-footer\n\t\t{\n\t\t\tpadding: 10px 18px;\n\t\t\tborder-top: 1px solid #EDE9E3;\n\t\t\tfont-size: 0.72rem;\n\t\t\tcolor: #8A7F72;\n\t\t\ttext-align: center;\n\t\t}\n\n\t\t/* File browser row insert button — hidden by default, shown on\n\t\t hover for image file rows via CSS attribute selectors. */\n\t\t.pict-fb-insert-btn\n\t\t{\n\t\t\tdisplay: none;\n\t\t\tposition: absolute;\n\t\t\tright: 6px;\n\t\t\ttop: 50%;\n\t\t\ttransform: translateY(-50%);\n\t\t\tbackground: #2E7D74;\n\t\t\tcolor: #FFF;\n\t\t\tborder: none;\n\t\t\tborder-radius: 4px;\n\t\t\tfont-size: 0.78rem;\n\t\t\tfont-weight: 700;\n\t\t\tline-height: 1;\n\t\t\tpadding: 2px 7px;\n\t\t\tcursor: pointer;\n\t\t}\n\t\t.pict-fb-insert-btn:hover\n\t\t{\n\t\t\tbackground: #3A9E92;\n\t\t}\n\t\t/* Make the row position:relative so the button can be absolutely placed */\n\t\t#ContentEditor-Sidebar-Container .pict-fb-detail-row\n\t\t{\n\t\t\tposition: relative;\n\t\t}\n\t\t/* Show the insert button on hover for image file extensions.\n\t\t CSS attribute selector [data-name$=".ext" i] matches\n\t\t the end of the data-name attribute, case-insensitive. */\n\t\t#ContentEditor-Sidebar-Container .pict-fb-detail-row[data-name$=".png" i]:hover .pict-fb-insert-btn,\n\t\t#ContentEditor-Sidebar-Container .pict-fb-detail-row[data-name$=".jpg" i]:hover .pict-fb-insert-btn,\n\t\t#ContentEditor-Sidebar-Container .pict-fb-detail-row[data-name$=".jpeg" i]:hover .pict-fb-insert-btn,\n\t\t#ContentEditor-Sidebar-Container .pict-fb-detail-row[data-name$=".gif" i]:hover .pict-fb-insert-btn,\n\t\t#ContentEditor-Sidebar-Container .pict-fb-detail-row[data-name$=".webp" i]:hover .pict-fb-insert-btn,\n\t\t#ContentEditor-Sidebar-Container .pict-fb-detail-row[data-name$=".svg" i]:hover .pict-fb-insert-btn,\n\t\t#ContentEditor-Sidebar-Container .pict-fb-detail-row[data-name$=".bmp" i]:hover .pict-fb-insert-btn,\n\t\t#ContentEditor-Sidebar-Container .pict-fb-detail-row[data-name$=".avif" i]:hover .pict-fb-insert-btn,\n\t\t#ContentEditor-Sidebar-Container .pict-fb-detail-row[data-name$=".apng" i]:hover .pict-fb-insert-btn,\n\t\t#ContentEditor-Sidebar-Container .pict-fb-detail-row[data-name$=".ico" i]:hover .pict-fb-insert-btn,\n\t\t#ContentEditor-Sidebar-Container .pict-fb-detail-row[data-name$=".tiff" i]:hover .pict-fb-insert-btn,\n\t\t#ContentEditor-Sidebar-Container .pict-fb-detail-row[data-name$=".tif" i]:hover .pict-fb-insert-btn,\n\t\t#ContentEditor-Sidebar-Container .pict-fb-detail-row[data-name$=".jfif" i]:hover .pict-fb-insert-btn\n\t\t{\n\t\t\tdisplay: inline-block;\n\t\t}\n\n\t\t/* ============================================\n\t\t RESPONSIVE: Tablet / Phone (max-width: 768px)\n\t\t ============================================ */\n\t\t@media (max-width: 768px)\n\t\t{\n\t\t\t/* Prevent horizontal scroll on the whole app */\n\t\t\t#ContentEditor-Application-Container\n\t\t\t{\n\t\t\t\toverflow-x: hidden;\n\t\t\t\twidth: 100%;\n\t\t\t\tmax-width: 100vw;\n\t\t\t}\n\n\t\t\t/* Stack sidebar ABOVE editor instead of side-by-side */\n\t\t\t.content-editor-body\n\t\t\t{\n\t\t\t\tflex-direction: column;\n\t\t\t}\n\n\t\t\t/* Sidebar becomes a horizontal strip at the top */\n\t\t\t.content-editor-sidebar-wrap\n\t\t\t{\n\t\t\t\twidth: 100% !important;\n\t\t\t\tmax-height: 40vh;\n\t\t\t\tflex-shrink: 0;\n\t\t\t\tborder-bottom: 1px solid #DDD6CA;\n\t\t\t\tborder-right: none;\n\t\t\t}\n\n\t\t\t/* Give the Reference and Topics tabs much more room on mobile\n\t\t\t since they contain long scrollable content */\n\t\t\t.content-editor-sidebar-wrap.sidebar-expanded-pane\n\t\t\t{\n\t\t\t\tmax-height: 70vh;\n\t\t\t}\n\n\t\t\t/* When collapsed on mobile, hide the inner content but keep the\n\t\t\t toggle button visible (it\'s positioned below the sidebar strip) */\n\t\t\t.content-editor-sidebar-wrap.collapsed\n\t\t\t{\n\t\t\t\twidth: 100% !important;\n\t\t\t\tmax-height: 0;\n\t\t\t\toverflow: visible;\n\t\t\t}\n\t\t\t.content-editor-sidebar-wrap.collapsed .content-editor-sidebar-inner\n\t\t\t{\n\t\t\t\tdisplay: none;\n\t\t\t}\n\n\t\t\t/* Hide the resize handle (desktop-only interaction) */\n\t\t\t.content-editor-resize-handle\n\t\t\t{\n\t\t\t\tdisplay: none;\n\t\t\t}\n\n\t\t\t/* Reposition the sidebar toggle for horizontal layout —\n\t\t\t place it at the bottom-center of the sidebar strip */\n\t\t\t.content-editor-sidebar-toggle\n\t\t\t{\n\t\t\t\tposition: absolute;\n\t\t\t\ttop: auto;\n\t\t\t\tbottom: -20px;\n\t\t\t\tright: auto;\n\t\t\t\tleft: 50%;\n\t\t\t\ttransform: translateX(-50%);\n\t\t\t\twidth: 28px;\n\t\t\t\theight: 20px;\n\t\t\t\tborder-radius: 0 0 4px 4px;\n\t\t\t\tborder: 1px solid #DDD6CA;\n\t\t\t\tborder-top: none;\n\t\t\t\tz-index: 10;\n\t\t\t}\n\t\t\t.content-editor-sidebar-wrap.collapsed .content-editor-sidebar-toggle\n\t\t\t{\n\t\t\t\tbottom: -20px;\n\t\t\t\tright: auto;\n\t\t\t\tleft: 50%;\n\t\t\t\ttransform: translateX(-50%);\n\t\t\t}\n\n\t\t\t/* Reduce editor container padding (less gutters) */\n\t\t\t#ContentEditor-Editor-Container\n\t\t\t{\n\t\t\t\tpadding: 24px 8px 8px 8px;\n\t\t\t}\n\n\t\t\t/* Reduce binary preview padding */\n\t\t\t.binary-preview-image\n\t\t\t{\n\t\t\t\tpadding: 12px;\n\t\t\t}\n\t\t\t.binary-preview-card\n\t\t\t{\n\t\t\t\tpadding: 12px;\n\t\t\t\tgap: 12px;\n\t\t\t}\n\n\t\t\t/* Upload panel: fill more of the screen */\n\t\t\t.content-editor-upload-panel\n\t\t\t{\n\t\t\t\twidth: 95vw;\n\t\t\t\tmax-width: 95vw;\n\t\t\t}\n\n\t\t}\n\n\t\t/* ============================================\n\t\t RESPONSIVE: Small phone (max-width: 480px)\n\t\t ============================================ */\n\t\t@media (max-width: 480px)\n\t\t{\n\t\t\t/* Even tighter editor padding */\n\t\t\t#ContentEditor-Editor-Container\n\t\t\t{\n\t\t\t\tpadding: 20px 4px 4px 4px;\n\t\t\t}\n\n\t\t\t/* Sidebar gets a smaller max height */\n\t\t\t.content-editor-sidebar-wrap\n\t\t\t{\n\t\t\t\tmax-height: 35vh;\n\t\t\t}\n\t\t\t.content-editor-sidebar-wrap.sidebar-expanded-pane\n\t\t\t{\n\t\t\t\tmax-height: 65vh;\n\t\t\t}\n\t\t}\n\t',Templates:[{Hash:"ContentEditor-Layout-Shell-Template",Template:'\n<div id="ContentEditor-TopBar-Container"></div>\n<div class="content-editor-body">\n\t<div class="content-editor-sidebar-wrap" id="ContentEditor-SidebarWrap" style="width:250px">\n\t\t<div class="content-editor-sidebar-inner">\n\t\t\t<div class="content-editor-sidebar-tabs">\n\t\t\t\t<button class="content-editor-sidebar-tab active" id="ContentEditor-SidebarTab-Files"\n\t\t\t\t\tonclick="{~P~}.views[\'ContentEditor-Layout\'].switchSidebarTab(\'files\')">Files</button>\n\t\t\t\t<button class="content-editor-sidebar-tab" id="ContentEditor-SidebarTab-Reference"\n\t\t\t\t\tonclick="{~P~}.views[\'ContentEditor-Layout\'].switchSidebarTab(\'reference\')">Reference</button>\n\t\t\t\t<button class="content-editor-sidebar-tab" id="ContentEditor-SidebarTab-Topics"\n\t\t\t\t\tonclick="{~P~}.views[\'ContentEditor-Layout\'].switchSidebarTab(\'topics\')">Topics</button>\n\t\t\t\t<button class="content-editor-sidebar-addfile" title="New file"\n\t\t\t\t\tonclick="{~P~}.PictApplication.promptNewFile()">+</button>\n\t\t\t</div>\n\t\t\t<div id="ContentEditor-Sidebar-Container" class="content-editor-sidebar-pane"></div>\n\t\t\t<div id="ContentEditor-SidebarReference-Container" class="content-editor-sidebar-pane" style="display:none"></div>\n\t\t\t<div id="ContentEditor-SidebarTopics-Container" class="content-editor-sidebar-pane" style="display:none"></div>\n\t\t</div>\n\t\t<div class="content-editor-resize-handle" id="ContentEditor-ResizeHandle"></div>\n\t\t<div class="content-editor-sidebar-toggle" id="ContentEditor-SidebarToggle">◀</div>\n\t</div>\n\t<div id="ContentEditor-Editor-Container"></div>\n</div>\n<div class="content-editor-upload-overlay" id="ContentEditor-UploadOverlay"\n\tonclick="{~P~}.views[\'ContentEditor-Layout\'].onUploadOverlayClick(event)">\n\t<div class="content-editor-upload-panel">\n\t\t<div class="content-editor-upload-header">\n\t\t\t<span class="content-editor-upload-title">Upload Image</span>\n\t\t\t<button class="content-editor-upload-close"\n\t\t\t\tonclick="{~P~}.views[\'ContentEditor-Layout\'].toggleUploadForm()">×</button>\n\t\t</div>\n\t\t<div class="content-editor-upload-body">\n\t\t\t<div class="content-editor-upload-dropzone" id="ContentEditor-UploadDropzone"\n\t\t\t\tonclick="document.getElementById(\'ContentEditor-UploadFileInput\').click()">\n\t\t\t\t<div class="content-editor-upload-dropzone-icon">📷</div>\n\t\t\t\t<div class="content-editor-upload-dropzone-text">Drop an image here or click to browse</div>\n\t\t\t\t<div class="content-editor-upload-dropzone-hint">PNG, JPG, GIF, WebP, SVG, BMP</div>\n\t\t\t</div>\n\t\t\t<input type="file" class="content-editor-upload-file-input" id="ContentEditor-UploadFileInput"\n\t\t\t\taccept="image/png,image/jpeg,image/gif,image/webp,image/svg+xml,image/bmp"\n\t\t\t\tonchange="{~P~}.views[\'ContentEditor-Layout\'].onUploadFileSelected(this)">\n\t\t\t<div class="content-editor-upload-status" id="ContentEditor-UploadStatus"></div>\n\t\t\t<div id="ContentEditor-UploadResult"></div>\n\t\t</div>\n\t\t<div class="content-editor-upload-footer">\n\t\t\t<span class="content-editor-upload-kbd">F3</span> or\n\t\t\t<span class="content-editor-upload-kbd">Ctrl+Shift+U</span> to toggle\n\t\t</div>\n\t</div>\n</div>\n'}],Renderables:[{RenderableHash:"ContentEditor-Layout-Shell",TemplateHash:"ContentEditor-Layout-Shell-Template",DestinationAddress:"#ContentEditor-Application-Container",RenderMethod:"replace"}]}},{"pict-view":88}],109:[function(t,e,n){const i=t("pict-section-markdowneditor");e.exports=class extends i{constructor(t,e,n){super(t,e,n)}onImageUpload(t,e,n){let i=this.pict.providers["ContentEditor-Provider"];return!!i&&(i.uploadImage(t,(t,e)=>{t?n(t):n(null,e)}),!0)}customConfigureExtensions(t,e){if(this.pict.AppData.ContentEditor&&this.pict.AppData.ContentEditor.MarkdownWordWrap){let e=this._codeMirrorModules;e&&e.EditorView&&e.EditorView.lineWrapping&&t.push(e.EditorView.lineWrapping)}return t}onContentChange(t,e){this.pict.PictApplication&&(this.pict.PictApplication.markDirty(),this.pict.PictApplication.updateStats())}},e.exports.default_configuration={ViewIdentifier:"ContentEditor-MarkdownEditor",DefaultRenderable:"MarkdownEditor-Wrap",DefaultDestinationAddress:"#ContentEditor-Editor-Container",TargetElementAddress:"#ContentEditor-Editor-Container",ContentDataAddress:"AppData.ContentEditor.Document.Segments",ReadOnly:!1,EnableRichPreview:!0,AutoRender:!1,Renderables:[{RenderableHash:"MarkdownEditor-Wrap",TemplateHash:"MarkdownEditor-Container",DestinationAddress:"#ContentEditor-Editor-Container"}]}},{"pict-section-markdowneditor":86}],110:[function(t,e,n){const i=t("pict-view"),o={ViewIdentifier:"ContentEditor-MarkdownReference",DefaultRenderable:"ContentEditor-MarkdownReference-Display",DefaultDestinationAddress:"#ContentEditor-SidebarReference-Container",AutoRender:!1,CSS:"\n\t\t.md-ref-container\n\t\t{\n\t\t\tdisplay: flex;\n\t\t\tflex-direction: column;\n\t\t\theight: 100%;\n\t\t\tbackground: #FAF8F4;\n\t\t}\n\t\t.md-ref-search-bar\n\t\t{\n\t\t\tposition: sticky;\n\t\t\ttop: 0;\n\t\t\tz-index: 5;\n\t\t\tdisplay: flex;\n\t\t\talign-items: center;\n\t\t\tgap: 4px;\n\t\t\tpadding: 6px 8px;\n\t\t\tbackground: #F5F0EA;\n\t\t\tborder-bottom: 1px solid #DDD6CA;\n\t\t\tflex-shrink: 0;\n\t\t}\n\t\t.md-ref-search-input\n\t\t{\n\t\t\tflex: 1;\n\t\t\tmin-width: 0;\n\t\t\tpadding: 5px 8px;\n\t\t\tborder: 1px solid #DDD6CA;\n\t\t\tborder-radius: 4px;\n\t\t\tfont-size: 0.8rem;\n\t\t\tbackground: #FFF;\n\t\t\tcolor: #3D3229;\n\t\t\toutline: none;\n\t\t}\n\t\t.md-ref-search-input:focus\n\t\t{\n\t\t\tborder-color: #2E7D74;\n\t\t}\n\t\t.md-ref-search-nav\n\t\t{\n\t\t\tbackground: transparent;\n\t\t\tborder: 1px solid #DDD6CA;\n\t\t\tborder-radius: 4px;\n\t\t\twidth: 26px;\n\t\t\theight: 26px;\n\t\t\tcursor: pointer;\n\t\t\tcolor: #5E5549;\n\t\t\tfont-size: 0.7rem;\n\t\t\tdisplay: flex;\n\t\t\talign-items: center;\n\t\t\tjustify-content: center;\n\t\t\tflex-shrink: 0;\n\t\t}\n\t\t.md-ref-search-nav:hover\n\t\t{\n\t\t\tbackground: #EDE9E3;\n\t\t}\n\t\t.md-ref-search-nav:disabled\n\t\t{\n\t\t\topacity: 0.3;\n\t\t\tcursor: not-allowed;\n\t\t}\n\t\t.md-ref-search-count\n\t\t{\n\t\t\tfont-size: 0.7rem;\n\t\t\tcolor: #8A7F72;\n\t\t\twhite-space: nowrap;\n\t\t\tmin-width: 32px;\n\t\t\ttext-align: center;\n\t\t\tflex-shrink: 0;\n\t\t}\n\t\t.md-ref-content\n\t\t{\n\t\t\tflex: 1;\n\t\t\toverflow-y: auto;\n\t\t\tpadding: 12px;\n\t\t\tfont-size: 0.82rem;\n\t\t\tline-height: 1.6;\n\t\t\tcolor: #3D3229;\n\t\t}\n\t\t.md-ref-content h2\n\t\t{\n\t\t\tfont-size: 0.95rem;\n\t\t\tmargin: 20px 0 8px 0;\n\t\t\tpadding-bottom: 4px;\n\t\t\tborder-bottom: 1px solid #EDE9E3;\n\t\t\tcolor: #2E7D74;\n\t\t}\n\t\t.md-ref-content h2:first-child\n\t\t{\n\t\t\tmargin-top: 0;\n\t\t}\n\t\t.md-ref-content h3\n\t\t{\n\t\t\tfont-size: 0.85rem;\n\t\t\tmargin: 14px 0 6px 0;\n\t\t\tcolor: #5E5549;\n\t\t}\n\t\t.md-ref-content p\n\t\t{\n\t\t\tmargin: 6px 0;\n\t\t}\n\t\t.md-ref-content code\n\t\t{\n\t\t\tbackground: #F0EDE8;\n\t\t\tpadding: 1px 4px;\n\t\t\tborder-radius: 3px;\n\t\t\tfont-size: 0.78rem;\n\t\t\tfont-family: monospace;\n\t\t}\n\t\t.md-ref-content pre\n\t\t{\n\t\t\tbackground: #F0EDE8;\n\t\t\tborder: 1px solid #DDD6CA;\n\t\t\tborder-radius: 4px;\n\t\t\tpadding: 8px 10px;\n\t\t\toverflow-x: auto;\n\t\t\tfont-size: 0.76rem;\n\t\t\tline-height: 1.5;\n\t\t\tmargin: 6px 0;\n\t\t\tposition: relative;\n\t\t}\n\t\t.md-ref-content pre code\n\t\t{\n\t\t\tbackground: none;\n\t\t\tpadding: 0;\n\t\t\tfont-size: inherit;\n\t\t}\n\t\t.md-ref-copy-btn\n\t\t{\n\t\t\tposition: absolute;\n\t\t\ttop: 4px;\n\t\t\tright: 4px;\n\t\t\tbackground: #FAF8F4;\n\t\t\tborder: 1px solid #DDD6CA;\n\t\t\tborder-radius: 3px;\n\t\t\tpadding: 2px 6px;\n\t\t\tfont-size: 0.65rem;\n\t\t\tcolor: #8A7F72;\n\t\t\tcursor: pointer;\n\t\t\topacity: 0;\n\t\t\ttransition: opacity 0.15s;\n\t\t}\n\t\t.md-ref-content pre:hover .md-ref-copy-btn\n\t\t{\n\t\t\topacity: 1;\n\t\t}\n\t\t.md-ref-copy-btn:hover\n\t\t{\n\t\t\tbackground: #EDE9E3;\n\t\t\tcolor: #3D3229;\n\t\t}\n\t\t.md-ref-docs-link\n\t\t{\n\t\t\tdisplay: flex;\n\t\t\talign-items: center;\n\t\t\tjustify-content: center;\n\t\t\tgap: 6px;\n\t\t\tpadding: 8px 10px;\n\t\t\tbackground: #F0FAF8;\n\t\t\tborder-bottom: 1px solid #DDD6CA;\n\t\t\tfont-size: 0.8rem;\n\t\t\tfont-weight: 600;\n\t\t\tflex-shrink: 0;\n\t\t}\n\t\t.md-ref-docs-link a\n\t\t{\n\t\t\tcolor: #2E7D74;\n\t\t\ttext-decoration: none;\n\t\t}\n\t\t.md-ref-docs-link a:hover\n\t\t{\n\t\t\ttext-decoration: underline;\n\t\t}\n\t\t/* Search highlight */\n\t\tmark.md-ref-highlight\n\t\t{\n\t\t\tbackground: #FFEAA7;\n\t\t\tcolor: inherit;\n\t\t\tpadding: 0;\n\t\t\tborder-radius: 2px;\n\t\t}\n\t\tmark.md-ref-highlight-active\n\t\t{\n\t\t\tbackground: #E8A94D;\n\t\t\tcolor: #FFF;\n\t\t}\n\t",Templates:[{Hash:"ContentEditor-MarkdownReference-Template",Template:'\n<div class="md-ref-container">\n\t<div class="md-ref-docs-link">\n\t\t<span>📖</span>\n\t\t<a href="/docs/" target="_blank">Full Documentation</a>\n\t</div>\n\t<div class="md-ref-search-bar">\n\t\t<input type="text" class="md-ref-search-input"\n\t\t\tid="ContentEditor-MdRef-SearchInput"\n\t\t\tplaceholder="Search reference..."\n\t\t\toninput="{~P~}.views[\'ContentEditor-MarkdownReference\'].onSearchInput(this.value)"\n\t\t\tonkeydown="{~P~}.views[\'ContentEditor-MarkdownReference\'].onSearchKeydown(event)">\n\t\t<span class="md-ref-search-count" id="ContentEditor-MdRef-SearchCount"></span>\n\t\t<button class="md-ref-search-nav" id="ContentEditor-MdRef-SearchPrev"\n\t\t\tonclick="{~P~}.views[\'ContentEditor-MarkdownReference\'].navigateMatch(-1)" disabled>▲</button>\n\t\t<button class="md-ref-search-nav" id="ContentEditor-MdRef-SearchNext"\n\t\t\tonclick="{~P~}.views[\'ContentEditor-MarkdownReference\'].navigateMatch(1)" disabled>▼</button>\n\t</div>\n\t<div class="md-ref-content" id="ContentEditor-MdRef-Content">\n\n<h2>Headings</h2>\n<p>Use <code>#</code> through <code>######</code> for heading levels 1–6.</p>\n<pre><code># Heading 1\n## Heading 2\n### Heading 3\n#### Heading 4\n##### Heading 5\n###### Heading 6</code><button class="md-ref-copy-btn" onclick="pict.views[\'ContentEditor-MarkdownReference\'].copyCodeBlock(this)">Copy</button></pre>\n\n<h2>Emphasis</h2>\n<p>Bold, italic, strikethrough, and combinations.</p>\n<pre><code>**bold text**\n*italic text*\n***bold and italic***\n~~strikethrough~~\n**bold and ~~strikethrough~~**</code><button class="md-ref-copy-btn" onclick="pict.views[\'ContentEditor-MarkdownReference\'].copyCodeBlock(this)">Copy</button></pre>\n\n<h2>Inline Code</h2>\n<p>Wrap text in backticks for inline code.</p>\n<pre><code>Use `console.log()` to debug.\nUse ``double backticks for `literal` backticks``.</code><button class="md-ref-copy-btn" onclick="pict.views[\'ContentEditor-MarkdownReference\'].copyCodeBlock(this)">Copy</button></pre>\n\n<h2>Links</h2>\n<p>Inline links, reference links, and autolinks.</p>\n<pre><code>[Link text](https://example.com)\n[Link with title](https://example.com "Title text")\n\n[Reference link][1]\n[1]: https://example.com\n\nAutolink: https://example.com\nEmail: user@example.com</code><button class="md-ref-copy-btn" onclick="pict.views[\'ContentEditor-MarkdownReference\'].copyCodeBlock(this)">Copy</button></pre>\n\n<h2>Images</h2>\n<pre><code>\n\n\n[](https://example.com)</code><button class="md-ref-copy-btn" onclick="pict.views[\'ContentEditor-MarkdownReference\'].copyCodeBlock(this)">Copy</button></pre>\n\n<h2>Unordered Lists</h2>\n<p>Use <code>-</code>, <code>*</code>, or <code>+</code> for bullet items.</p>\n<pre><code>- Item one\n- Item two\n - Nested item\n - Another nested\n - Deeply nested\n- Item three</code><button class="md-ref-copy-btn" onclick="pict.views[\'ContentEditor-MarkdownReference\'].copyCodeBlock(this)">Copy</button></pre>\n\n<h2>Ordered Lists</h2>\n<pre><code>1. First item\n2. Second item\n3. Third item\n 1. Sub-item A\n 2. Sub-item B</code><button class="md-ref-copy-btn" onclick="pict.views[\'ContentEditor-MarkdownReference\'].copyCodeBlock(this)">Copy</button></pre>\n\n<h2>Task Lists</h2>\n<pre><code>- [x] Completed task\n- [ ] Incomplete task\n- [ ] Another task</code><button class="md-ref-copy-btn" onclick="pict.views[\'ContentEditor-MarkdownReference\'].copyCodeBlock(this)">Copy</button></pre>\n\n<h2>Blockquotes</h2>\n<pre><code>> This is a blockquote.\n>\n> It can span multiple paragraphs.\n>\n>> Nested blockquote.</code><button class="md-ref-copy-btn" onclick="pict.views[\'ContentEditor-MarkdownReference\'].copyCodeBlock(this)">Copy</button></pre>\n\n<h2>Code Blocks</h2>\n<p>Use triple backticks with an optional language identifier.</p>\n<pre><code>```javascript\nfunction hello()\n{\n console.log("Hello, world!");\n}\n```\n\n```python\ndef hello():\n print("Hello, world!")\n```\n\n```css\n.container {\n display: flex;\n gap: 16px;\n}\n```</code><button class="md-ref-copy-btn" onclick="pict.views[\'ContentEditor-MarkdownReference\'].copyCodeBlock(this)">Copy</button></pre>\n\n<h2>Tables</h2>\n<p>Use pipes and hyphens. Colons control alignment.</p>\n<pre><code>| Left Align | Center Align | Right Align |\n|:-----------|:------------:|------------:|\n| Cell 1 | Cell 2 | Cell 3 |\n| Cell 4 | Cell 5 | Cell 6 |</code><button class="md-ref-copy-btn" onclick="pict.views[\'ContentEditor-MarkdownReference\'].copyCodeBlock(this)">Copy</button></pre>\n\n<h2>Horizontal Rules</h2>\n<p>Three or more hyphens, asterisks, or underscores.</p>\n<pre><code>---\n\n***\n\n___</code><button class="md-ref-copy-btn" onclick="pict.views[\'ContentEditor-MarkdownReference\'].copyCodeBlock(this)">Copy</button></pre>\n\n<h2>Footnotes</h2>\n<pre><code>Here is a footnote reference[^1] and another[^note].\n\n[^1]: This is the footnote content.\n[^note]: Footnotes can have any label.</code><button class="md-ref-copy-btn" onclick="pict.views[\'ContentEditor-MarkdownReference\'].copyCodeBlock(this)">Copy</button></pre>\n\n<h2>HTML in Markdown</h2>\n<p>Raw HTML is allowed in GitHub-Flavored Markdown.</p>\n<pre><code><details>\n<summary>Click to expand</summary>\n\nHidden content here.\n\n</details>\n\n<kbd>Ctrl</kbd> + <kbd>S</kbd> to save.\n\n<mark>Highlighted text</mark>\n\n<sup>superscript</sup> and <sub>subscript</sub></code><button class="md-ref-copy-btn" onclick="pict.views[\'ContentEditor-MarkdownReference\'].copyCodeBlock(this)">Copy</button></pre>\n\n<h2>Escaping Characters</h2>\n<p>Backslash-escape special markdown characters.</p>\n<pre><code>\\*not italic\\*\n\\# not a heading\n\\[not a link\\](url)\n\\`not code\\`</code><button class="md-ref-copy-btn" onclick="pict.views[\'ContentEditor-MarkdownReference\'].copyCodeBlock(this)">Copy</button></pre>\n\n<h2>Line Breaks</h2>\n<pre><code>End a line with two spaces\nto create a line break.\n\nOr use a blank line\n\nfor a new paragraph.</code><button class="md-ref-copy-btn" onclick="pict.views[\'ContentEditor-MarkdownReference\'].copyCodeBlock(this)">Copy</button></pre>\n\n<h2>KaTeX — Inline Math</h2>\n<p>Wrap expressions with single dollar signs for inline math.</p>\n<pre><code>The equation $E = mc^2$ is famous.\n\nThe quadratic formula is $x = \\frac{-b \\pm \\sqrt{b^2 - 4ac}}{2a}$.\n\nGreek letters: $\\alpha$, $\\beta$, $\\gamma$, $\\delta$, $\\theta$, $\\pi$.\n\nSubscripts and superscripts: $x_i^2$ and $a_{n+1}$.</code><button class="md-ref-copy-btn" onclick="pict.views[\'ContentEditor-MarkdownReference\'].copyCodeBlock(this)">Copy</button></pre>\n\n<h2>KaTeX — Display Math</h2>\n<p>Use double dollar signs on their own lines for display (block) math.</p>\n\n<h3>Integral</h3>\n<pre><code>$$\n\\int_{-\\infty}^{\\infty} e^{-x^2} \\, dx = \\sqrt{\\pi}\n$$</code><button class="md-ref-copy-btn" onclick="pict.views[\'ContentEditor-MarkdownReference\'].copyCodeBlock(this)">Copy</button></pre>\n\n<h3>Summation</h3>\n<pre><code>$$\n\\sum_{n=1}^{\\infty} \\frac{1}{n^2} = \\frac{\\pi^2}{6}\n$$</code><button class="md-ref-copy-btn" onclick="pict.views[\'ContentEditor-MarkdownReference\'].copyCodeBlock(this)">Copy</button></pre>\n\n<h3>Matrix</h3>\n<pre><code>$$\n\\begin{bmatrix}\na & b \\\\\nc & d\n\\end{bmatrix}\n\\begin{bmatrix}\nx \\\\\ny\n\\end{bmatrix}\n=\n\\begin{bmatrix}\nax + by \\\\\ncx + dy\n\\end{bmatrix}\n$$</code><button class="md-ref-copy-btn" onclick="pict.views[\'ContentEditor-MarkdownReference\'].copyCodeBlock(this)">Copy</button></pre>\n\n<h3>Aligned Equations</h3>\n<pre><code>$$\n\\begin{aligned}\nf(x) &= x^2 + 2x + 1 \\\\\n &= (x + 1)^2\n\\end{aligned}\n$$</code><button class="md-ref-copy-btn" onclick="pict.views[\'ContentEditor-MarkdownReference\'].copyCodeBlock(this)">Copy</button></pre>\n\n<h3>Cases (Piecewise)</h3>\n<pre><code>$$\nf(x) = \\begin{cases}\nx^2 & \\text{if } x \\geq 0 \\\\\n-x^2 & \\text{if } x < 0\n\\end{cases}\n$$</code><button class="md-ref-copy-btn" onclick="pict.views[\'ContentEditor-MarkdownReference\'].copyCodeBlock(this)">Copy</button></pre>\n\n<h3>Fractions & Limits</h3>\n<pre><code>$$\n\\lim_{x \\to 0} \\frac{\\sin x}{x} = 1\n$$</code><button class="md-ref-copy-btn" onclick="pict.views[\'ContentEditor-MarkdownReference\'].copyCodeBlock(this)">Copy</button></pre>\n\n<h2>Mermaid — Flowchart</h2>\n<pre><code>```mermaid\ngraph TD\n A[Start] --> B{Decision}\n B -->|Yes| C[Do something]\n B -->|No| D[Do something else]\n C --> E[End]\n D --> E\n```</code><button class="md-ref-copy-btn" onclick="pict.views[\'ContentEditor-MarkdownReference\'].copyCodeBlock(this)">Copy</button></pre>\n\n<h2>Mermaid — Sequence Diagram</h2>\n<pre><code>```mermaid\nsequenceDiagram\n participant A as Alice\n participant B as Bob\n A->>B: Hello Bob\n B-->>A: Hi Alice\n A->>B: How are you?\n B-->>A: Great!\n```</code><button class="md-ref-copy-btn" onclick="pict.views[\'ContentEditor-MarkdownReference\'].copyCodeBlock(this)">Copy</button></pre>\n\n<h2>Mermaid — Gantt Chart</h2>\n<pre><code>```mermaid\ngantt\n title Project Timeline\n dateFormat YYYY-MM-DD\n section Phase 1\n Research :a1, 2024-01-01, 30d\n Design :a2, after a1, 20d\n section Phase 2\n Development :b1, after a2, 40d\n Testing :b2, after b1, 15d\n```</code><button class="md-ref-copy-btn" onclick="pict.views[\'ContentEditor-MarkdownReference\'].copyCodeBlock(this)">Copy</button></pre>\n\n<h2>Mermaid — Class Diagram</h2>\n<pre><code>```mermaid\nclassDiagram\n Animal <|-- Duck\n Animal <|-- Fish\n Animal : +int age\n Animal : +String gender\n Animal : +swim()\n Duck : +String beakColor\n Duck : +quack()\n Fish : +int sizeInFeet\n Fish : +canEat()\n```</code><button class="md-ref-copy-btn" onclick="pict.views[\'ContentEditor-MarkdownReference\'].copyCodeBlock(this)">Copy</button></pre>\n\n<h2>Mermaid — State Diagram</h2>\n<pre><code>```mermaid\nstateDiagram-v2\n [*] --> Idle\n Idle --> Processing : Start\n Processing --> Done : Complete\n Processing --> Error : Fail\n Error --> Idle : Reset\n Done --> [*]\n```</code><button class="md-ref-copy-btn" onclick="pict.views[\'ContentEditor-MarkdownReference\'].copyCodeBlock(this)">Copy</button></pre>\n\n\t</div>\n</div>\n'}],Renderables:[{RenderableHash:"ContentEditor-MarkdownReference-Display",TemplateHash:"ContentEditor-MarkdownReference-Template",DestinationAddress:"#ContentEditor-SidebarReference-Container",RenderMethod:"replace"}]};e.exports=class extends i{constructor(t,e,n){super(t,e,n),this._hasRendered=!1,this._searchMatches=[],this._currentMatchIndex=-1,this._originalContent=""}onAfterRender(t,e,n,i){this._hasRendered=!0;let o=document.getElementById("ContentEditor-MdRef-Content");return o&&(this._originalContent=o.innerHTML),this.pict.CSSMap.injectCSS(),super.onAfterRender(t,e,n,i)}copyCodeBlock(t){let e=t.closest("pre");if(!e)return;let n=e.querySelector("code");if(!n)return;let i=n.textContent;navigator.clipboard&&navigator.clipboard.writeText(i).then(()=>{t.textContent="Copied!",setTimeout(()=>{t.textContent="Copy"},1500)})}onSearchInput(t){this._performSearch(t)}onSearchKeydown(t){"Enter"===t.key&&(t.preventDefault(),t.shiftKey?this.navigateMatch(-1):this.navigateMatch(1)),"Escape"===t.key&&(t.target.value="",this._clearSearch())}navigateMatch(t){if(0===this._searchMatches.length)return;this._currentMatchIndex>=0&&this._searchMatches[this._currentMatchIndex]&&this._searchMatches[this._currentMatchIndex].classList.remove("md-ref-highlight-active"),this._currentMatchIndex+=t,this._currentMatchIndex>=this._searchMatches.length&&(this._currentMatchIndex=0),this._currentMatchIndex<0&&(this._currentMatchIndex=this._searchMatches.length-1);let e=this._searchMatches[this._currentMatchIndex];e.classList.add("md-ref-highlight-active"),e.scrollIntoView({behavior:"smooth",block:"center"}),this._updateSearchCount()}_performSearch(t){let e=document.getElementById("ContentEditor-MdRef-Content");if(!e)return;if(e.innerHTML=this._originalContent,this._searchMatches=[],this._currentMatchIndex=-1,!t||t.length<2)return this._updateSearchCount(),void this._updateNavButtons();let n,i=t.toLowerCase(),o=document.createTreeWalker(e,NodeFilter.SHOW_TEXT,null,!1),r=[];for(;n=o.nextNode();)n.nodeValue.toLowerCase().indexOf(i)>=0&&r.push(n);for(let t=0;t<r.length;t++)this._highlightTextNode(r[t],i);this._searchMatches=Array.from(e.querySelectorAll("mark.md-ref-highlight")),this._searchMatches.length>0&&(this._currentMatchIndex=0,this._searchMatches[0].classList.add("md-ref-highlight-active"),this._searchMatches[0].scrollIntoView({behavior:"smooth",block:"center"})),this._updateSearchCount(),this._updateNavButtons()}_highlightTextNode(t,e){let n=t.nodeValue,i=n.toLowerCase(),o=t.parentNode,r=document.createDocumentFragment(),s=0,a=i.indexOf(e);for(;a>=0;){a>s&&r.appendChild(document.createTextNode(n.substring(s,a)));let t=document.createElement("mark");t.className="md-ref-highlight",t.textContent=n.substring(a,a+e.length),r.appendChild(t),s=a+e.length,a=i.indexOf(e,s)}s<n.length&&r.appendChild(document.createTextNode(n.substring(s))),o.replaceChild(r,t)}_updateSearchCount(){let t=document.getElementById("ContentEditor-MdRef-SearchCount");if(t)if(0===this._searchMatches.length){let e=document.getElementById("ContentEditor-MdRef-SearchInput");e&&e.value&&e.value.length>=2?t.textContent="0":t.textContent=""}else t.textContent=this._currentMatchIndex+1+"/"+this._searchMatches.length}_updateNavButtons(){let t=document.getElementById("ContentEditor-MdRef-SearchPrev"),e=document.getElementById("ContentEditor-MdRef-SearchNext"),n=this._searchMatches.length>0;t&&(t.disabled=!n),e&&(e.disabled=!n)}_clearSearch(){let t=document.getElementById("ContentEditor-MdRef-Content");t&&this._originalContent&&(t.innerHTML=this._originalContent),this._searchMatches=[],this._currentMatchIndex=-1,this._updateSearchCount(),this._updateNavButtons()}},e.exports.default_configuration=o},{"pict-view":88}],111:[function(t,e,n){const i=t("pict-view");e.exports=class extends i{constructor(t,e,n){super(t,e,n),this._isOpen=!1}onAfterRender(t,e,n,i){let o=this.pict.AppData.ContentEditor,r=this.pict.ContentAssignment.getElement("#ContentEditor-Setting-MarkdownWordWrap");r&&r[0]&&(r[0].checked=o.MarkdownWordWrap);let s=this.pict.ContentAssignment.getElement("#ContentEditor-Setting-CodeWordWrap");s&&s[0]&&(s[0].checked=o.CodeWordWrap);let a=this.pict.ContentAssignment.getElement("#ContentEditor-Setting-EditingControls");a&&a[0]&&(a[0].checked=o.MarkdownEditingControls);let c=this.pict.ContentAssignment.getElement("#ContentEditor-Setting-ContentPreviewMode");c&&c[0]&&(c[0].value=o.ContentPreviewMode||"off");let l=this.pict.ContentAssignment.getElement("#ContentEditor-Setting-AutoSegment");l&&l[0]&&(l[0].checked=o.AutoSegmentMarkdown);let d=this.pict.ContentAssignment.getElement("#ContentEditor-Setting-SegmentDepth");d&&d[0]&&(d[0].value=String(o.AutoSegmentDepth),d[0].disabled=!o.AutoSegmentMarkdown);let p=this.pict.ContentAssignment.getElement("#ContentEditor-Setting-AutoPreviewImages");p&&p[0]&&(p[0].checked=o.AutoPreviewImages);let h=this.pict.ContentAssignment.getElement("#ContentEditor-Setting-AutoPreviewVideo");h&&h[0]&&(h[0].checked=o.AutoPreviewVideo);let u=this.pict.ContentAssignment.getElement("#ContentEditor-Setting-AutoPreviewAudio");u&&u[0]&&(u[0].checked=o.AutoPreviewAudio);let f=this.pict.ContentAssignment.getElement("#ContentEditor-Setting-ShowHiddenFiles");return f&&f[0]&&(f[0].checked=o.ShowHiddenFiles),super.onAfterRender(t,e,n,i)}togglePanel(){this._isOpen?this.closePanel():this.openPanel()}openPanel(){this._isOpen=!0;let t=this.pict.ContentAssignment.getElement("#ContentEditor-SettingsFlyout"),e=this.pict.ContentAssignment.getElement("#ContentEditor-SettingsOverlay"),n=this.pict.ContentAssignment.getElement("#ContentEditor-SettingsGear");t&&t[0]&&t[0].classList.add("open"),e&&e[0]&&e[0].classList.add("open"),n&&n[0]&&n[0].classList.add("active")}closePanel(){this._isOpen=!1;let t=this.pict.ContentAssignment.getElement("#ContentEditor-SettingsFlyout"),e=this.pict.ContentAssignment.getElement("#ContentEditor-SettingsOverlay"),n=this.pict.ContentAssignment.getElement("#ContentEditor-SettingsGear");t&&t[0]&&t[0].classList.remove("open"),e&&e[0]&&e[0].classList.remove("open"),n&&n[0]&&n[0].classList.remove("active")}onMarkdownWordWrapChanged(t){this.pict.AppData.ContentEditor.MarkdownWordWrap=t,this.pict.PictApplication.saveSettings();let e=this.pict.views["ContentEditor-MarkdownEditor"];if(e&&"markdown"===this.pict.AppData.ContentEditor.ActiveEditor&&e._segmentEditors)for(let n in e._segmentEditors){let i=e._segmentEditors[n];i&&i.contentDOM&&(t?i.contentDOM.classList.add("cm-lineWrapping"):i.contentDOM.classList.remove("cm-lineWrapping"))}}onCodeWordWrapChanged(t){this.pict.AppData.ContentEditor.CodeWordWrap=t,this.pict.PictApplication.saveSettings();let e=this.pict.views["ContentEditor-CodeEditor"];e&&e._editorElement&&"code"===this.pict.AppData.ContentEditor.ActiveEditor&&(t?(e._editorElement.style.whiteSpace="pre-wrap",e._editorElement.style.overflowWrap="break-word"):(e._editorElement.style.whiteSpace="pre",e._editorElement.style.overflowWrap="normal"))}onEditingControlsChanged(t){this.pict.AppData.ContentEditor.MarkdownEditingControls=t,this.pict.PictApplication.saveSettings();let e=this.pict.views["ContentEditor-MarkdownEditor"];e&&"markdown"===this.pict.AppData.ContentEditor.ActiveEditor&&e.toggleControls(t)}onContentPreviewModeChanged(t){this.pict.AppData.ContentEditor.ContentPreviewMode=t,this.pict.PictApplication.saveSettings();let e=this.pict.views["ContentEditor-MarkdownEditor"];e&&"markdown"===this.pict.AppData.ContentEditor.ActiveEditor&&e.setPreviewMode(t)}onAutoSegmentChanged(t){this.pict.AppData.ContentEditor.AutoSegmentMarkdown=t,this.pict.PictApplication.saveSettings();let e=this.pict.ContentAssignment.getElement("#ContentEditor-Setting-SegmentDepth");e&&e[0]&&(e[0].disabled=!t)}onSegmentDepthChanged(t){this.pict.AppData.ContentEditor.AutoSegmentDepth=parseInt(t,10)||1,this.pict.PictApplication.saveSettings()}onAutoPreviewImagesChanged(t){this.pict.AppData.ContentEditor.AutoPreviewImages=t,this.pict.PictApplication.saveSettings()}onAutoPreviewVideoChanged(t){this.pict.AppData.ContentEditor.AutoPreviewVideo=t,this.pict.PictApplication.saveSettings()}onAutoPreviewAudioChanged(t){this.pict.AppData.ContentEditor.AutoPreviewAudio=t,this.pict.PictApplication.saveSettings()}onShowHiddenFilesChanged(t){this.pict.AppData.ContentEditor.ShowHiddenFiles=t,this.pict.PictApplication.saveSettings();let e=this;this.pict.PictApplication.syncHiddenFilesSetting(()=>{e.pict.PictApplication.loadFileList()})}},e.exports.default_configuration={ViewIdentifier:"ContentEditor-SettingsPanel",DefaultRenderable:"ContentEditor-SettingsPanel-Display",DefaultDestinationAddress:"#ContentEditor-SettingsPanel-Container",AutoRender:!1,CSS:"\n\t\t.content-editor-settings-wrap\n\t\t{\n\t\t\tposition: relative;\n\t\t\tdisplay: flex;\n\t\t\talign-items: center;\n\t\t}\n\t\t.content-editor-settings-gear\n\t\t{\n\t\t\tbackground: transparent;\n\t\t\tborder: none;\n\t\t\tcursor: pointer;\n\t\t\tpadding: 6px;\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: #B8AFA4;\n\t\t\ttransition: color 0.15s;\n\t\t}\n\t\t.content-editor-settings-gear:hover,\n\t\t.content-editor-settings-gear.active\n\t\t{\n\t\t\tcolor: #E8E0D4;\n\t\t}\n\t\t.content-editor-settings-gear svg\n\t\t{\n\t\t\twidth: 20px;\n\t\t\theight: 20px;\n\t\t\tfill: currentColor;\n\t\t}\n\t\t/* Flyout overlay — covers viewport to catch clicks outside */\n\t\t.content-editor-settings-overlay\n\t\t{\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.content-editor-settings-overlay.open\n\t\t{\n\t\t\tdisplay: block;\n\t\t}\n\t\t/* Flyout panel */\n\t\t.content-editor-settings-flyout\n\t\t{\n\t\t\tposition: absolute;\n\t\t\ttop: 44px;\n\t\t\tright: 0;\n\t\t\twidth: 270px;\n\t\t\tbackground: #FFF;\n\t\t\tborder: 1px solid #DDD6CA;\n\t\t\tborder-radius: 8px;\n\t\t\tbox-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);\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.content-editor-settings-flyout.open\n\t\t{\n\t\t\topacity: 1;\n\t\t\ttransform: translateY(0);\n\t\t\tpointer-events: auto;\n\t\t}\n\t\t/* Speech bubble arrow */\n\t\t.content-editor-settings-flyout::before\n\t\t{\n\t\t\tcontent: '';\n\t\t\tposition: absolute;\n\t\t\ttop: -7px;\n\t\t\tright: 12px;\n\t\t\twidth: 12px;\n\t\t\theight: 12px;\n\t\t\tbackground: #FFF;\n\t\t\tborder-left: 1px solid #DDD6CA;\n\t\t\tborder-top: 1px solid #DDD6CA;\n\t\t\ttransform: rotate(45deg);\n\t\t}\n\t\t.content-editor-settings-flyout-body\n\t\t{\n\t\t\tpadding: 8px;\n\t\t}\n\t\t.content-editor-settings-flyout-link\n\t\t{\n\t\t\tdisplay: flex;\n\t\t\talign-items: center;\n\t\t\tgap: 8px;\n\t\t\tpadding: 10px 12px;\n\t\t\tborder-radius: 6px;\n\t\t\ttext-decoration: none;\n\t\t\tcolor: #3D3229;\n\t\t\tfont-size: 0.85rem;\n\t\t\tfont-weight: 500;\n\t\t\ttransition: background 0.1s;\n\t\t}\n\t\t.content-editor-settings-flyout-link:hover\n\t\t{\n\t\t\tbackground: #F5F3EE;\n\t\t}\n\t\t.content-editor-settings-flyout-link svg\n\t\t{\n\t\t\twidth: 16px;\n\t\t\theight: 16px;\n\t\t\tflex-shrink: 0;\n\t\t\tfill: #8A7F72;\n\t\t}\n\t\t.content-editor-settings-divider\n\t\t{\n\t\t\theight: 1px;\n\t\t\tbackground: #EDE9E3;\n\t\t\tmargin: 4px 8px;\n\t\t}\n\t\t/* Settings controls */\n\t\t.content-editor-settings-section\n\t\t{\n\t\t\tpadding: 8px 12px;\n\t\t}\n\t\t.content-editor-settings-label\n\t\t{\n\t\t\tfont-size: 0.72rem;\n\t\t\tfont-weight: 600;\n\t\t\ttext-transform: uppercase;\n\t\t\tletter-spacing: 0.5px;\n\t\t\tcolor: #8A7F72;\n\t\t\tmargin-bottom: 8px;\n\t\t}\n\t\t.content-editor-settings-row\n\t\t{\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: 6px;\n\t\t}\n\t\t.content-editor-settings-row:last-child\n\t\t{\n\t\t\tmargin-bottom: 0;\n\t\t}\n\t\t.content-editor-settings-checkbox\n\t\t{\n\t\t\twidth: 16px;\n\t\t\theight: 16px;\n\t\t\taccent-color: #2E7D74;\n\t\t\tcursor: pointer;\n\t\t\tflex-shrink: 0;\n\t\t}\n\t\t.content-editor-settings-checkbox-label\n\t\t{\n\t\t\tfont: inherit;\n\t\t\tfont-size: 0.85rem;\n\t\t\tcolor: #3D3229;\n\t\t\tcursor: pointer;\n\t\t\tuser-select: none;\n\t\t}\n\t\t.content-editor-settings-select\n\t\t{\n\t\t\twidth: 140px;\n\t\t\tpadding: 5px 8px;\n\t\t\tborder: 1px solid #DDD6CA;\n\t\t\tborder-radius: 4px;\n\t\t\tbackground: #FFF;\n\t\t\tfont-size: 0.82rem;\n\t\t\tcolor: #3D3229;\n\t\t\tcursor: pointer;\n\t\t}\n\t\t.content-editor-settings-select:disabled\n\t\t{\n\t\t\topacity: 0.45;\n\t\t\tcursor: not-allowed;\n\t\t}\n\t\t.content-editor-settings-select-label\n\t\t{\n\t\t\tfont-size: 0.82rem;\n\t\t\tcolor: #5E5549;\n\t\t\twhite-space: nowrap;\n\t\t}\n\n\t\t/* ============================================\n\t\t RESPONSIVE: Tablet / Phone (max-width: 768px)\n\t\t ============================================ */\n\t\t@media (max-width: 768px)\n\t\t{\n\t\t\t/* Settings flyout: position from left edge for more room */\n\t\t\t.content-editor-settings-flyout\n\t\t\t{\n\t\t\t\tright: -8px;\n\t\t\t\twidth: 260px;\n\t\t\t}\n\t\t}\n\n\t\t/* ============================================\n\t\t RESPONSIVE: Small phone (max-width: 480px)\n\t\t ============================================ */\n\t\t@media (max-width: 480px)\n\t\t{\n\t\t\t/* Full-width settings flyout on small phones */\n\t\t\t.content-editor-settings-flyout\n\t\t\t{\n\t\t\t\tposition: fixed;\n\t\t\t\ttop: 48px;\n\t\t\t\tright: 0;\n\t\t\t\tleft: 0;\n\t\t\t\twidth: 100%;\n\t\t\t\tborder-radius: 0 0 8px 8px;\n\t\t\t}\n\t\t\t.content-editor-settings-flyout::before\n\t\t\t{\n\t\t\t\tdisplay: none;\n\t\t\t}\n\t\t}\n\t",Templates:[{Hash:"ContentEditor-SettingsPanel-Template",Template:'\n<div class="content-editor-settings-wrap">\n\t<button class="content-editor-settings-gear" id="ContentEditor-SettingsGear"\n\t\tonclick="{~P~}.views[\'ContentEditor-SettingsPanel\'].togglePanel()">\n\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</button>\n\t<div class="content-editor-settings-overlay" id="ContentEditor-SettingsOverlay"\n\t\tonclick="{~P~}.views[\'ContentEditor-SettingsPanel\'].closePanel()"></div>\n\t<div class="content-editor-settings-flyout" id="ContentEditor-SettingsFlyout">\n\t\t<div class="content-editor-settings-flyout-body">\n\t\t\t<a class="content-editor-settings-flyout-link"\n\t\t\t\thref="/preview.html{~D:AppData.ContentEditor.ViewerHash~}" target="_blank">\n\t\t\t\t<svg viewBox="0 0 24 24"><path d="M12 4.5C7 4.5 2.73 7.61 1 12c1.73 4.39 6 7.5 11 7.5s9.27-3.11 11-7.5c-1.73-4.39-6-7.5-11-7.5zM12 17c-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5-2.24 5-5 5zm0-8c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3z"/></svg>\n\t\t\t\tDocuserve Preview\n\t\t\t</a>\n\t\t\t<div class="content-editor-settings-divider"></div>\n\t\t\t<div class="content-editor-settings-section">\n\t\t\t\t<div class="content-editor-settings-label">Word Wrap</div>\n\t\t\t\t<div class="content-editor-settings-row">\n\t\t\t\t\t<label class="content-editor-settings-checkbox-label"\n\t\t\t\t\t\tfor="ContentEditor-Setting-MarkdownWordWrap">Markdown Word Wrap</label>\n\t\t\t\t\t<input type="checkbox" class="content-editor-settings-checkbox"\n\t\t\t\t\t\tid="ContentEditor-Setting-MarkdownWordWrap"\n\t\t\t\t\t\tonchange="{~P~}.views[\'ContentEditor-SettingsPanel\'].onMarkdownWordWrapChanged(this.checked)">\n\t\t\t\t</div>\n\t\t\t\t<div class="content-editor-settings-row">\n\t\t\t\t\t<label class="content-editor-settings-checkbox-label"\n\t\t\t\t\t\tfor="ContentEditor-Setting-CodeWordWrap">Code Word Wrap</label>\n\t\t\t\t\t<input type="checkbox" class="content-editor-settings-checkbox"\n\t\t\t\t\t\tid="ContentEditor-Setting-CodeWordWrap"\n\t\t\t\t\t\tonchange="{~P~}.views[\'ContentEditor-SettingsPanel\'].onCodeWordWrapChanged(this.checked)">\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t\t<div class="content-editor-settings-divider"></div>\n\t\t\t<div class="content-editor-settings-section">\n\t\t\t\t<div class="content-editor-settings-label">Markdown Editor</div>\n\t\t\t\t<div class="content-editor-settings-row">\n\t\t\t\t\t<label class="content-editor-settings-checkbox-label"\n\t\t\t\t\t\tfor="ContentEditor-Setting-EditingControls">Editing Controls</label>\n\t\t\t\t\t<input type="checkbox" class="content-editor-settings-checkbox"\n\t\t\t\t\t\tid="ContentEditor-Setting-EditingControls"\n\t\t\t\t\t\tonchange="{~P~}.views[\'ContentEditor-SettingsPanel\'].onEditingControlsChanged(this.checked)">\n\t\t\t\t</div>\n\t\t\t\t<div class="content-editor-settings-row">\n\t\t\t\t\t<span class="content-editor-settings-select-label">Content Preview</span>\n\t\t\t\t\t<select class="content-editor-settings-select"\n\t\t\t\t\t\tid="ContentEditor-Setting-ContentPreviewMode"\n\t\t\t\t\t\tonchange="{~P~}.views[\'ContentEditor-SettingsPanel\'].onContentPreviewModeChanged(this.value)">\n\t\t\t\t\t\t<option value="off">Off</option>\n\t\t\t\t\t\t<option value="bottom">Underneath</option>\n\t\t\t\t\t\t<option value="side">Beside</option>\n\t\t\t\t\t\t<option value="tabbed">Tab</option>\n\t\t\t\t\t</select>\n\t\t\t\t</div>\n\t\t\t\t<div class="content-editor-settings-row">\n\t\t\t\t\t<label class="content-editor-settings-checkbox-label"\n\t\t\t\t\t\tfor="ContentEditor-Setting-AutoSegment">Auto Segment Markdown</label>\n\t\t\t\t\t<input type="checkbox" class="content-editor-settings-checkbox"\n\t\t\t\t\t\tid="ContentEditor-Setting-AutoSegment"\n\t\t\t\t\t\tonchange="{~P~}.views[\'ContentEditor-SettingsPanel\'].onAutoSegmentChanged(this.checked)">\n\t\t\t\t</div>\n\t\t\t\t<div class="content-editor-settings-row">\n\t\t\t\t\t<span class="content-editor-settings-select-label">Segment Depth</span>\n\t\t\t\t\t<select class="content-editor-settings-select"\n\t\t\t\t\t\tid="ContentEditor-Setting-SegmentDepth"\n\t\t\t\t\t\tdisabled\n\t\t\t\t\t\tonchange="{~P~}.views[\'ContentEditor-SettingsPanel\'].onSegmentDepthChanged(this.value)">\n\t\t\t\t\t\t<option value="1">Depth 1: Blocks</option>\n\t\t\t\t\t\t<option value="2">Depth 2: ##</option>\n\t\t\t\t\t\t<option value="3">Depth 3: ###</option>\n\t\t\t\t\t\t<option value="4">Depth 4: ####</option>\n\t\t\t\t\t\t<option value="5">Depth 5: #####</option>\n\t\t\t\t\t\t<option value="6">Depth 6: ######</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="content-editor-settings-divider"></div>\n\t\t\t<div class="content-editor-settings-section">\n\t\t\t\t<div class="content-editor-settings-label">Media Preview</div>\n\t\t\t\t<div class="content-editor-settings-row">\n\t\t\t\t\t<label class="content-editor-settings-checkbox-label"\n\t\t\t\t\t\tfor="ContentEditor-Setting-AutoPreviewImages">Auto-Preview Images</label>\n\t\t\t\t\t<input type="checkbox" class="content-editor-settings-checkbox"\n\t\t\t\t\t\tid="ContentEditor-Setting-AutoPreviewImages"\n\t\t\t\t\t\tonchange="{~P~}.views[\'ContentEditor-SettingsPanel\'].onAutoPreviewImagesChanged(this.checked)">\n\t\t\t\t</div>\n\t\t\t\t<div class="content-editor-settings-row">\n\t\t\t\t\t<label class="content-editor-settings-checkbox-label"\n\t\t\t\t\t\tfor="ContentEditor-Setting-AutoPreviewVideo">Auto-Preview Video</label>\n\t\t\t\t\t<input type="checkbox" class="content-editor-settings-checkbox"\n\t\t\t\t\t\tid="ContentEditor-Setting-AutoPreviewVideo"\n\t\t\t\t\t\tonchange="{~P~}.views[\'ContentEditor-SettingsPanel\'].onAutoPreviewVideoChanged(this.checked)">\n\t\t\t\t</div>\n\t\t\t\t<div class="content-editor-settings-row">\n\t\t\t\t\t<label class="content-editor-settings-checkbox-label"\n\t\t\t\t\t\tfor="ContentEditor-Setting-AutoPreviewAudio">Auto-Preview Audio</label>\n\t\t\t\t\t<input type="checkbox" class="content-editor-settings-checkbox"\n\t\t\t\t\t\tid="ContentEditor-Setting-AutoPreviewAudio"\n\t\t\t\t\t\tonchange="{~P~}.views[\'ContentEditor-SettingsPanel\'].onAutoPreviewAudioChanged(this.checked)">\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t\t<div class="content-editor-settings-divider"></div>\n\t\t\t<div class="content-editor-settings-section">\n\t\t\t\t<div class="content-editor-settings-label">File Browser</div>\n\t\t\t\t<div class="content-editor-settings-row">\n\t\t\t\t\t<label class="content-editor-settings-checkbox-label"\n\t\t\t\t\t\tfor="ContentEditor-Setting-ShowHiddenFiles">Show Hidden Files</label>\n\t\t\t\t\t<input type="checkbox" class="content-editor-settings-checkbox"\n\t\t\t\t\t\tid="ContentEditor-Setting-ShowHiddenFiles"\n\t\t\t\t\t\tonchange="{~P~}.views[\'ContentEditor-SettingsPanel\'].onShowHiddenFilesChanged(this.checked)">\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</div>\n\t</div>\n</div>\n'}],Renderables:[{RenderableHash:"ContentEditor-SettingsPanel-Display",TemplateHash:"ContentEditor-SettingsPanel-Template",DestinationAddress:"#ContentEditor-SettingsPanel-Container",RenderMethod:"replace"}]}},{"pict-view":88}],112:[function(t,e,n){const i=t("pict-view");e.exports=class extends i{constructor(t,e,n){super(t,e,n)}onBeforeRender(t,e,n){let i=this.pict.AppData.ContentEditor;if(i.DirtyIndicatorHTML=i.IsDirty?' <span class="content-editor-dirty-indicator">*</span>':"",i.SaveDisabledAttr=!i.CurrentFile||i.IsSaving?"disabled":"",i.SaveVisibilityAttr=i.IsDirty||i.IsSaving||i.SaveStatus?"":'style="display:none"',i.CloseVisibilityAttr=i.CurrentFile?"":'style="display:none"',i.CurrentFile){let t=i.CurrentFile.replace(/\.md$/,"");i.ViewerHash="#/page/"+t}else i.ViewerHash="";return super.onBeforeRender(t,e,n)}onAfterRender(t,e,n,i){let o=this.pict.views["ContentEditor-SettingsPanel"];return o&&o.render(),super.onAfterRender(t,e,n,i)}},e.exports.default_configuration={ViewIdentifier:"ContentEditor-TopBar",DefaultRenderable:"ContentEditor-TopBar-Display",DefaultDestinationAddress:"#ContentEditor-TopBar-Container",AutoRender:!1,CSS:"\n\t\t.content-editor-topbar\n\t\t{\n\t\t\tdisplay: flex;\n\t\t\talign-items: center;\n\t\t\tbackground: #3D3229;\n\t\t\tcolor: #E8E0D4;\n\t\t\tpadding: 0;\n\t\t\theight: 48px;\n\t\t\tborder-bottom: 3px solid #2E7D74;\n\t\t\tposition: relative;\n\t\t}\n\t\t.content-editor-topbar-brand\n\t\t{\n\t\t\tpadding: 0 16px;\n\t\t\tfont-size: 1rem;\n\t\t\tfont-weight: 600;\n\t\t\tcolor: #E8E0D4;\n\t\t\twhite-space: nowrap;\n\t\t\tflex-shrink: 0;\n\t\t}\n\t\t/* Centered file name — absolutely positioned so it stays\n\t\t centered in the full bar regardless of left/right content */\n\t\t.content-editor-topbar-file\n\t\t{\n\t\t\tposition: absolute;\n\t\t\tleft: 50%;\n\t\t\ttransform: translateX(-50%);\n\t\t\tmax-width: 50%;\n\t\t\ttext-align: center;\n\t\t\toverflow: hidden;\n\t\t\ttext-overflow: ellipsis;\n\t\t\twhite-space: nowrap;\n\t\t\tpointer-events: none;\n\t\t}\n\t\t.content-editor-topbar-filename\n\t\t{\n\t\t\tfont-size: 0.9rem;\n\t\t\tfont-weight: 500;\n\t\t\tcolor: #E8E0D4;\n\t\t\tletter-spacing: 0.2px;\n\t\t}\n\t\t.content-editor-topbar-file .content-editor-dirty-indicator\n\t\t{\n\t\t\tcolor: #E8A94D;\n\t\t\tfont-weight: bold;\n\t\t}\n\t\t/* Left spacer pushes actions to the right */\n\t\t.content-editor-topbar-spacer\n\t\t{\n\t\t\tflex: 1;\n\t\t}\n\t\t.content-editor-topbar-status\n\t\t{\n\t\t\tpadding: 0 12px;\n\t\t\tfont-size: 0.78rem;\n\t\t\tflex-shrink: 0;\n\t\t}\n\t\t.content-editor-status-saving\n\t\t{\n\t\t\tcolor: #E8A94D;\n\t\t}\n\t\t.content-editor-status-saved\n\t\t{\n\t\t\tcolor: #7BC47F;\n\t\t}\n\t\t.content-editor-status-error\n\t\t{\n\t\t\tcolor: #D9534F;\n\t\t}\n\t\t.content-editor-topbar-stats\n\t\t{\n\t\t\tfont-size: 0.72rem;\n\t\t\tcolor: #8A7F72;\n\t\t\twhite-space: nowrap;\n\t\t\tpadding: 0 8px;\n\t\t\tflex-shrink: 0;\n\t\t\tletter-spacing: 0.2px;\n\t\t}\n\t\t.content-editor-topbar-actions\n\t\t{\n\t\t\tdisplay: flex;\n\t\t\talign-items: center;\n\t\t\tgap: 8px;\n\t\t\tpadding: 0 12px;\n\t\t\tflex-shrink: 0;\n\t\t}\n\t\t.content-editor-topbar-btn\n\t\t{\n\t\t\tpadding: 6px 14px;\n\t\t\tborder: none;\n\t\t\tborder-radius: 4px;\n\t\t\tcursor: pointer;\n\t\t\tfont-size: 0.8rem;\n\t\t\tfont-weight: 600;\n\t\t}\n\t\t.content-editor-topbar-btn-save\n\t\t{\n\t\t\tbackground: #2E7D74;\n\t\t\tcolor: #FFF;\n\t\t}\n\t\t.content-editor-topbar-btn-save:hover\n\t\t{\n\t\t\tbackground: #3A9E92;\n\t\t}\n\t\t.content-editor-topbar-btn-save:disabled\n\t\t{\n\t\t\tbackground: #5E5549;\n\t\t\tcolor: #8A7F72;\n\t\t\tcursor: not-allowed;\n\t\t}\n\t\t.content-editor-topbar-btn-close\n\t\t{\n\t\t\tbackground: transparent;\n\t\t\tcolor: #B8AFA4;\n\t\t\tborder: 1px solid #5E5549;\n\t\t}\n\t\t.content-editor-topbar-btn-close:hover\n\t\t{\n\t\t\tcolor: #E8E0D4;\n\t\t\tborder-color: #8A7F72;\n\t\t\tbackground: rgba(255, 255, 255, 0.05);\n\t\t}\n\t\t/* Close-file confirmation overlay */\n\t\t.content-editor-confirm-overlay\n\t\t{\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: 1099;\n\t\t\tbackground: rgba(0, 0, 0, 0.35);\n\t\t}\n\t\t.content-editor-confirm-overlay.open\n\t\t{\n\t\t\tdisplay: flex;\n\t\t\talign-items: center;\n\t\t\tjustify-content: center;\n\t\t}\n\t\t.content-editor-confirm-panel\n\t\t{\n\t\t\tbackground: #FFF;\n\t\t\tborder: 1px solid #DDD6CA;\n\t\t\tborder-radius: 10px;\n\t\t\tbox-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);\n\t\t\twidth: 360px;\n\t\t\tmax-width: 90vw;\n\t\t\toverflow: hidden;\n\t\t}\n\t\t.content-editor-confirm-body\n\t\t{\n\t\t\tpadding: 24px 22px 16px;\n\t\t\ttext-align: center;\n\t\t}\n\t\t.content-editor-confirm-icon\n\t\t{\n\t\t\tfont-size: 2rem;\n\t\t\tmargin-bottom: 8px;\n\t\t\tcolor: #E8A94D;\n\t\t}\n\t\t.content-editor-confirm-title\n\t\t{\n\t\t\tfont-size: 0.95rem;\n\t\t\tfont-weight: 600;\n\t\t\tcolor: #3D3229;\n\t\t\tmargin-bottom: 6px;\n\t\t}\n\t\t.content-editor-confirm-message\n\t\t{\n\t\t\tfont-size: 0.82rem;\n\t\t\tcolor: #5E5549;\n\t\t\tmargin-bottom: 16px;\n\t\t\tline-height: 1.5;\n\t\t}\n\t\t.content-editor-confirm-actions\n\t\t{\n\t\t\tdisplay: flex;\n\t\t\tgap: 10px;\n\t\t\tjustify-content: center;\n\t\t}\n\t\t.content-editor-confirm-btn\n\t\t{\n\t\t\tpadding: 8px 20px;\n\t\t\tborder: none;\n\t\t\tborder-radius: 5px;\n\t\t\tfont-size: 0.82rem;\n\t\t\tfont-weight: 600;\n\t\t\tcursor: pointer;\n\t\t}\n\t\t.content-editor-confirm-btn-discard\n\t\t{\n\t\t\tbackground: #D9534F;\n\t\t\tcolor: #FFF;\n\t\t}\n\t\t.content-editor-confirm-btn-discard:hover\n\t\t{\n\t\t\tbackground: #C9302C;\n\t\t}\n\t\t.content-editor-confirm-btn-cancel\n\t\t{\n\t\t\tbackground: transparent;\n\t\t\tcolor: #5E5549;\n\t\t\tborder: 1px solid #DDD6CA;\n\t\t}\n\t\t.content-editor-confirm-btn-cancel:hover\n\t\t{\n\t\t\tbackground: #F0EDE8;\n\t\t}\n\t\t.content-editor-confirm-footer\n\t\t{\n\t\t\tpadding: 10px 22px;\n\t\t\tborder-top: 1px solid #EDE9E3;\n\t\t\tfont-size: 0.72rem;\n\t\t\tcolor: #8A7F72;\n\t\t\ttext-align: center;\n\t\t}\n\t\t.content-editor-confirm-kbd\n\t\t{\n\t\t\tdisplay: inline-block;\n\t\t\tpadding: 1px 5px;\n\t\t\tfont-size: 0.68rem;\n\t\t\tfont-family: monospace;\n\t\t\tbackground: #F0EDE8;\n\t\t\tborder: 1px solid #DDD6CA;\n\t\t\tborder-radius: 3px;\n\t\t\tcolor: #5E5549;\n\t\t}\n\n\t\t/* ============================================\n\t\t RESPONSIVE: Tablet / Phone (max-width: 768px)\n\t\t ============================================ */\n\t\t@media (max-width: 768px)\n\t\t{\n\t\t\t.content-editor-topbar\n\t\t\t{\n\t\t\t\theight: auto;\n\t\t\t\tmin-height: 44px;\n\t\t\t\tflex-wrap: wrap;\n\t\t\t\tpadding: 4px 0;\n\t\t\t}\n\n\t\t\t/* Brand text: shrink */\n\t\t\t.content-editor-topbar-brand\n\t\t\t{\n\t\t\t\tpadding: 0 8px;\n\t\t\t\tfont-size: 0.85rem;\n\t\t\t}\n\n\t\t\t/* File name: switch from absolute centering to flow layout */\n\t\t\t.content-editor-topbar-file\n\t\t\t{\n\t\t\t\tposition: static;\n\t\t\t\ttransform: none;\n\t\t\t\tmax-width: none;\n\t\t\t\tflex: 1;\n\t\t\t\tmin-width: 0;\n\t\t\t\tpadding: 0 4px;\n\t\t\t}\n\n\t\t\t/* Hide the spacer (not needed when file is in-flow) */\n\t\t\t.content-editor-topbar-spacer\n\t\t\t{\n\t\t\t\tdisplay: none;\n\t\t\t}\n\n\t\t\t/* Hide word/line count stats on mobile to save space */\n\t\t\t.content-editor-topbar-stats\n\t\t\t{\n\t\t\t\tdisplay: none;\n\t\t\t}\n\n\t\t\t/* Compact action buttons */\n\t\t\t.content-editor-topbar-actions\n\t\t\t{\n\t\t\t\tgap: 4px;\n\t\t\t\tpadding: 0 6px;\n\t\t\t}\n\n\t\t\t.content-editor-topbar-btn\n\t\t\t{\n\t\t\t\tpadding: 5px 10px;\n\t\t\t\tfont-size: 0.75rem;\n\t\t\t}\n\n\t\t\t/* Status text */\n\t\t\t.content-editor-topbar-status\n\t\t\t{\n\t\t\t\tpadding: 0 6px;\n\t\t\t\tfont-size: 0.72rem;\n\t\t\t}\n\n\t\t\t/* Confirm dialog: tighter for mobile */\n\t\t\t.content-editor-confirm-panel\n\t\t\t{\n\t\t\t\twidth: 95vw;\n\t\t\t\tmax-width: 95vw;\n\t\t\t}\n\t\t}\n\n\t\t/* ============================================\n\t\t RESPONSIVE: Small phone (max-width: 480px)\n\t\t ============================================ */\n\t\t@media (max-width: 480px)\n\t\t{\n\t\t\t/* Hide brand text entirely on very small screens */\n\t\t\t.content-editor-topbar-brand\n\t\t\t{\n\t\t\t\tdisplay: none;\n\t\t\t}\n\n\t\t\t.content-editor-topbar-filename\n\t\t\t{\n\t\t\t\tfont-size: 0.8rem;\n\t\t\t}\n\n\t\t\t.content-editor-topbar-actions\n\t\t\t{\n\t\t\t\tpadding: 0 4px;\n\t\t\t}\n\t\t}\n\t",Templates:[{Hash:"ContentEditor-TopBar-Template",Template:'\n<div class="content-editor-topbar">\n\t<div class="content-editor-topbar-brand">Content Editor</div>\n\t<div class="content-editor-topbar-file">\n\t\t<span class="content-editor-topbar-filename">{~D:AppData.ContentEditor.CurrentFile~}</span>{~D:AppData.ContentEditor.DirtyIndicatorHTML~}\n\t</div>\n\t<div class="content-editor-topbar-spacer"></div>\n\t<div class="content-editor-topbar-status {~D:AppData.ContentEditor.SaveStatusClass~}">\n\t\t{~D:AppData.ContentEditor.SaveStatus~}\n\t</div>\n\t<span class="content-editor-topbar-stats" id="ContentEditor-Stats"></span>\n\t<div class="content-editor-topbar-actions">\n\t\t<button class="content-editor-topbar-btn content-editor-topbar-btn-save"\n\t\t\tonclick="{~P~}.PictApplication.saveCurrentFile()"\n\t\t\t{~D:AppData.ContentEditor.SaveDisabledAttr~} {~D:AppData.ContentEditor.SaveVisibilityAttr~}>Save</button>\n\t\t<button class="content-editor-topbar-btn content-editor-topbar-btn-close"\n\t\t\tonclick="{~P~}.PictApplication.closeCurrentFile()"\n\t\t\t{~D:AppData.ContentEditor.CloseVisibilityAttr~}>Close</button>\n\t\t<div id="ContentEditor-SettingsPanel-Container"></div>\n\t</div>\n</div>\n<div class="content-editor-confirm-overlay" id="ContentEditor-ConfirmOverlay"\n\tonclick="{~P~}.PictApplication.cancelCloseFile()">\n\t<div class="content-editor-confirm-panel" onclick="event.stopPropagation()">\n\t\t<div class="content-editor-confirm-body">\n\t\t\t<div class="content-editor-confirm-icon">⚠</div>\n\t\t\t<div class="content-editor-confirm-title">Unsaved Changes</div>\n\t\t\t<div class="content-editor-confirm-message">\n\t\t\t\tThis file has unsaved changes.<br>Close without saving?\n\t\t\t</div>\n\t\t\t<div class="content-editor-confirm-actions">\n\t\t\t\t<button class="content-editor-confirm-btn content-editor-confirm-btn-discard"\n\t\t\t\t\tonclick="{~P~}.PictApplication.confirmCloseFile()">Discard & Close</button>\n\t\t\t\t<button class="content-editor-confirm-btn content-editor-confirm-btn-cancel"\n\t\t\t\t\tonclick="{~P~}.PictApplication.cancelCloseFile()">Cancel</button>\n\t\t\t</div>\n\t\t</div>\n\t\t<div class="content-editor-confirm-footer">\n\t\t\t<span class="content-editor-confirm-kbd">Y</span> to discard ·\n\t\t\t<span class="content-editor-confirm-kbd">N</span> or\n\t\t\t<span class="content-editor-confirm-kbd">Esc</span> to cancel\n\t\t</div>\n\t</div>\n</div>\n'}],Renderables:[{RenderableHash:"ContentEditor-TopBar-Display",TemplateHash:"ContentEditor-TopBar-Template",DestinationAddress:"#ContentEditor-TopBar-Container",RenderMethod:"replace"}]}},{"pict-view":88}],113:[function(t,e,n){const i=t("pict-view");e.exports=class extends i{constructor(t,e,n){super(t,e,n),this._topics={},this._topicsFilePath="",this._hasRendered=!1,this._editingTopicCode=null}onAfterRender(){this._hasRendered=!0,this.pict.CSSMap.injectCSS(),this._topicsFilePath?(this._updateHeaderTitle(),this.renderTopicList()):this._showEmptyState()}loadTopicsFile(t,e){let n="function"==typeof e?e:()=>{},i=this;if(!t)return n("No path specified");let o=this.pict.providers["ContentEditor-Provider"];if(!o)return n("Provider not available");o.loadFile(t,(e,o)=>{if(e)return i._topics={},i._topicsFilePath="",i._hasRendered&&i._showEmptyState(),n(e);try{let t=JSON.parse(o);"object"!=typeof t||null===t||Array.isArray(t)?i._topics={}:i._topics=t}catch(t){i._topics={},i.log.warn("ContentEditor-Topics: Failed to parse topics JSON: "+t.message)}return i._topicsFilePath=t,i.pict.AppData.ContentEditor.TopicsFilePath=t,i.pict.PictApplication.saveSettings(),i._hasRendered&&(i._updateHeaderTitle(),i.renderTopicList(),i._showFooter(!0)),n(null)})}saveTopicsFile(t){let e="function"==typeof t?t:()=>{};if(!this._topicsFilePath)return e("No topics file loaded");let n=this.pict.providers["ContentEditor-Provider"];if(!n)return e("Provider not available");let i=JSON.stringify(this._topics,null,"\t");n.saveFile(this._topicsFilePath,i,e)}closeTopicsFile(){this._topics={},this._topicsFilePath="",this._editingTopicCode=null,this.pict.AppData.ContentEditor.TopicsFilePath="",this.pict.PictApplication.saveSettings(),this._hasRendered&&this._showEmptyState()}addTopic(t){if(!this._topicsFilePath)return void this._createDefaultTopicsFile(()=>{this.addTopic(t)});let e=t||{},n=e.TopicCode||this._generateUniqueCode("New-Topic"),i={TopicCode:n,TopicHelpFilePath:e.TopicHelpFilePath||"",TopicTitle:e.TopicTitle||""};"number"==typeof e.RelevantMarkdownLine&&(i.RelevantMarkdownLine=e.RelevantMarkdownLine),this._topics[n]=i;let o=this;this.saveTopicsFile(()=>{o.renderTopicList(),o.startEditTopic(n)})}removeTopic(t){if(!t||!this._topics[t])return;if(!confirm('Remove topic "'+t+'"?'))return;delete this._topics[t],this._editingTopicCode=null;let e=this;this.saveTopicsFile(()=>{e.renderTopicList()})}startEditTopic(t){if(!t||!this._topics[t])return;this._editingTopicCode=t,this.renderTopicList();let e=document.getElementById("topics-edit-code");e&&(e.focus(),e.select())}saveEditTopic(t){if(!t||!this._topics[t])return;let e=document.getElementById("topics-edit-code"),n=document.getElementById("topics-edit-title"),i=document.getElementById("topics-edit-path"),o=document.getElementById("topics-edit-line");if(!e)return;let r=e.value.trim(),s=n?n.value.trim():"",a=i?i.value.trim():"",c=o?parseInt(o.value,10):NaN;if(!r)return void(e.style.borderColor="#D9534F");if(r!==t&&this._topics[r])return e.style.borderColor="#D9534F",void alert('A topic with code "'+r+'" already exists.');r!==t&&delete this._topics[t];let l={TopicCode:r,TopicHelpFilePath:a,TopicTitle:s};!isNaN(c)&&c>0&&(l.RelevantMarkdownLine=c),this._topics[r]=l,this._editingTopicCode=null;let d=this;this.saveTopicsFile(()=>{d.renderTopicList()})}cancelEditTopic(){this._editingTopicCode=null,this.renderTopicList()}navigateToTopic(t){if(!t||!this._topics[t])return;let e=this._topics[t],n=e.TopicHelpFilePath;if(n&&(this.pict.PictApplication.navigateToFile(n),"number"==typeof e.RelevantMarkdownLine&&e.RelevantMarkdownLine>0)){let t=e.RelevantMarkdownLine;setTimeout(()=>{let e=this.pict.views["ContentEditor-MarkdownEditor"];if(e&&e._segmentEditors){let n=0;for(let i in e._segmentEditors){let o=e._segmentEditors[i];if(o&&o.state&&o.state.doc){let e=o.state.doc.lines;if(n+e>=t){let i=t-n;i<1&&(i=1),i>e&&(i=e);let r=o.state.doc.line(i);o.dispatch({selection:{anchor:r.from},scrollIntoView:!0}),o.focus();break}n+=e}}}},500)}}renderTopicList(){let t=document.getElementById("ContentEditor-Topics-List");if(!t)return;let e=Object.keys(this._topics);if(0===e.length)return void(t.innerHTML='<div style="padding:16px;text-align:center;color:#8A7F72;font-size:0.78rem;">No topics yet. Click "+ Add Topic" to create one.</div>');let n="";for(let t=0;t<e.length;t++){let i=e[t],o=this._topics[i];this._editingTopicCode===i?n+=this._buildEditFormHTML(o):n+=this._buildTopicRowHTML(o)}t.innerHTML=n}_buildTopicRowHTML(t){let e=this._escapeHTML(t.TopicCode||""),n=this._escapeHTML(t.TopicTitle||""),i=this._escapeHTML(t.TopicHelpFilePath||""),o="number"==typeof t.RelevantMarkdownLine?" :"+t.RelevantMarkdownLine:"",r=this._escapeAttr(t.TopicCode||""),s="<div class=\"topics-row\" ondblclick=\"pict.views['ContentEditor-Topics'].startEditTopic('"+r+"')\">";return s+='<div class="topics-row-info">',s+='<div class="topics-row-code">'+e+"</div>",n&&(s+='<div class="topics-row-title">'+n+"</div>"),i&&(s+='<div class="topics-row-path">'+i+o+"</div>"),s+="</div>",s+='<div class="topics-row-actions">',s+='<button class="topics-row-btn" title="Edit" onclick="event.stopPropagation();pict.views[\'ContentEditor-Topics\'].startEditTopic(\''+r+"')\">✎</button>",s+='<button class="topics-row-btn topics-row-btn-delete" title="Delete" onclick="event.stopPropagation();pict.views[\'ContentEditor-Topics\'].removeTopic(\''+r+"')\">✖</button>",i&&(s+='<button class="topics-row-btn" title="Go to file" onclick="event.stopPropagation();pict.views[\'ContentEditor-Topics\'].navigateToTopic(\''+r+"')\">→</button>"),s+="</div>",s+="</div>",s}_buildEditFormHTML(t){let e='<div class="topics-edit">';return e+='<div class="topics-edit-field">',e+='<label class="topics-edit-label">Topic Code</label>',e+='<input class="topics-edit-input" id="topics-edit-code" type="text" value="'+this._escapeAttr(t.TopicCode||"")+'" placeholder="My-Topic-Code">',e+="</div>",e+='<div class="topics-edit-field">',e+='<label class="topics-edit-label">Title</label>',e+='<input class="topics-edit-input" id="topics-edit-title" type="text" value="'+this._escapeAttr(t.TopicTitle||"")+'" placeholder="Topic title">',e+="</div>",e+='<div class="topics-edit-field">',e+='<label class="topics-edit-label">Help File Path</label>',e+='<input class="topics-edit-input" id="topics-edit-path" type="text" value="'+this._escapeAttr(t.TopicHelpFilePath||"")+'" placeholder="path/to/file.md">',e+="</div>",e+='<div class="topics-edit-field">',e+='<label class="topics-edit-label">Line Number (optional)</label>',e+='<input class="topics-edit-input" id="topics-edit-line" type="number" value="'+("number"==typeof t.RelevantMarkdownLine?t.RelevantMarkdownLine:"")+'" placeholder="e.g. 23" min="1">',e+="</div>",e+='<div class="topics-edit-actions">',e+="<button class=\"topics-edit-save\" onclick=\"pict.views['ContentEditor-Topics'].saveEditTopic('"+this._escapeAttr(t.TopicCode||"")+"')\">Save</button>",e+='<button class="topics-edit-cancel" onclick="pict.views[\'ContentEditor-Topics\'].cancelEditTopic()">Cancel</button>',e+="</div>",e+="</div>",e}_showEmptyState(){let t=document.getElementById("ContentEditor-Topics-Container");if(!t){let t=document.getElementById("ContentEditor-SidebarTopics-Container");return void(t&&(t.innerHTML=this._buildEmptyStateHTML()))}t.innerHTML=this._buildEmptyStateHTML()}_buildEmptyStateHTML(){let t='<div class="topics-empty">';return t+='<div class="topics-empty-icon">📑</div>',t+="<div>No topics file loaded</div>",t+='<button class="topics-empty-btn" onclick="pict.views[\'ContentEditor-Topics\'].loadDefaultTopicsFile()">Load .pict_documentation_topics.json</button>',t+='<button class="topics-empty-btn topics-empty-btn-secondary" onclick="pict.views[\'ContentEditor-Topics\'].promptSelectTopicsFile()">Select file...</button>',t+="</div>",'<div class="topics-empty"><div class="topics-empty-icon">📑</div><div>No topics file loaded</div><button class="topics-empty-btn" onclick="pict.views[\'ContentEditor-Topics\'].loadDefaultTopicsFile()">Load .pict_documentation_topics.json</button><button class="topics-empty-btn topics-empty-btn-secondary" onclick="pict.views[\'ContentEditor-Topics\'].promptSelectTopicsFile()">Select file...</button></div>'}loadDefaultTopicsFile(){let t=this;this.loadTopicsFile(".pict_documentation_topics.json",e=>{e&&t._createDefaultTopicsFile()})}promptSelectTopicsFile(){let t=prompt("Enter the path to a topics JSON file:",".pict_documentation_topics.json");if(t&&t.trim()){let e=this;this.loadTopicsFile(t.trim(),n=>{n&&confirm('File not found. Create "'+t.trim()+'"?')&&(e._topicsFilePath=t.trim(),e._topics={},e.pict.AppData.ContentEditor.TopicsFilePath=t.trim(),e.pict.PictApplication.saveSettings(),e.saveTopicsFile(()=>{e._hasRendered&&e.render()}))})}}_createDefaultTopicsFile(t){let e="function"==typeof t?t:()=>{},n=this,i=".pict_documentation_topics.json";this._topicsFilePath=i,this._topics={},this.pict.AppData.ContentEditor.TopicsFilePath=i,this.pict.PictApplication.saveSettings(),this.saveTopicsFile(()=>{n._hasRendered&&n.render(),e()})}_updateHeaderTitle(){let t=document.getElementById("ContentEditor-Topics-HeaderTitle");if(t){let e=this._topicsFilePath.replace(/^.*\//,"");t.textContent=e||"Topics",t.title=this._topicsFilePath}}_showFooter(t){let e=document.getElementById("ContentEditor-Topics-Footer");e&&(e.style.display=t?"":"none")}_generateUniqueCode(t){if(!this._topics[t])return t;let e=2;for(;this._topics[t+"-"+e];)e++;return t+"-"+e}_escapeHTML(t){return String(t).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}_escapeAttr(t){return String(t).replace(/&/g,"&").replace(/'/g,"'").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}},e.exports.default_configuration={ViewIdentifier:"ContentEditor-Topics",DefaultRenderable:"Topics-Wrap",DefaultDestinationAddress:"#ContentEditor-SidebarTopics-Container",AutoRender:!1,CSS:"\n\t\t.topics-container\n\t\t{\n\t\t\tdisplay: flex;\n\t\t\tflex-direction: column;\n\t\t\theight: 100%;\n\t\t\tfont-size: 0.82rem;\n\t\t\tcolor: #3D3229;\n\t\t}\n\t\t.topics-header\n\t\t{\n\t\t\tdisplay: flex;\n\t\t\talign-items: center;\n\t\t\tgap: 6px;\n\t\t\tpadding: 8px 10px;\n\t\t\tborder-bottom: 1px solid #EDE9E3;\n\t\t\tbackground: #FAF8F4;\n\t\t\tflex-shrink: 0;\n\t\t}\n\t\t.topics-header-title\n\t\t{\n\t\t\tflex: 1;\n\t\t\tfont-weight: 600;\n\t\t\tfont-size: 0.78rem;\n\t\t\tcolor: #5E5549;\n\t\t\twhite-space: nowrap;\n\t\t\toverflow: hidden;\n\t\t\ttext-overflow: ellipsis;\n\t\t}\n\t\t.topics-header-btn\n\t\t{\n\t\t\tbackground: transparent;\n\t\t\tborder: none;\n\t\t\tcursor: pointer;\n\t\t\tfont-size: 0.82rem;\n\t\t\tcolor: #8A7F72;\n\t\t\tpadding: 2px 6px;\n\t\t\tborder-radius: 3px;\n\t\t\tline-height: 1;\n\t\t}\n\t\t.topics-header-btn:hover\n\t\t{\n\t\t\tcolor: #3D3229;\n\t\t\tbackground: #EDE9E3;\n\t\t}\n\t\t.topics-list\n\t\t{\n\t\t\tflex: 1;\n\t\t\toverflow-y: auto;\n\t\t\toverflow-x: hidden;\n\t\t}\n\t\t.topics-row\n\t\t{\n\t\t\tdisplay: flex;\n\t\t\talign-items: flex-start;\n\t\t\tgap: 6px;\n\t\t\tpadding: 8px 10px;\n\t\t\tborder-bottom: 1px solid #F0EDE8;\n\t\t\tcursor: pointer;\n\t\t\ttransition: background 0.1s;\n\t\t}\n\t\t.topics-row:hover\n\t\t{\n\t\t\tbackground: #F5F0EA;\n\t\t}\n\t\t.topics-row-info\n\t\t{\n\t\t\tflex: 1;\n\t\t\tmin-width: 0;\n\t\t}\n\t\t.topics-row-code\n\t\t{\n\t\t\tfont-weight: 600;\n\t\t\tfont-size: 0.78rem;\n\t\t\tcolor: #2E7D74;\n\t\t\twhite-space: nowrap;\n\t\t\toverflow: hidden;\n\t\t\ttext-overflow: ellipsis;\n\t\t}\n\t\t.topics-row-title\n\t\t{\n\t\t\tfont-size: 0.72rem;\n\t\t\tcolor: #5E5549;\n\t\t\twhite-space: nowrap;\n\t\t\toverflow: hidden;\n\t\t\ttext-overflow: ellipsis;\n\t\t\tmargin-top: 1px;\n\t\t}\n\t\t.topics-row-path\n\t\t{\n\t\t\tfont-size: 0.68rem;\n\t\t\tcolor: #8A7F72;\n\t\t\twhite-space: nowrap;\n\t\t\toverflow: hidden;\n\t\t\ttext-overflow: ellipsis;\n\t\t\tmargin-top: 1px;\n\t\t}\n\t\t.topics-row-actions\n\t\t{\n\t\t\tflex-shrink: 0;\n\t\t\tdisplay: flex;\n\t\t\tgap: 2px;\n\t\t\tpadding-top: 1px;\n\t\t}\n\t\t.topics-row-btn\n\t\t{\n\t\t\tbackground: transparent;\n\t\t\tborder: none;\n\t\t\tcursor: pointer;\n\t\t\tfont-size: 0.72rem;\n\t\t\tcolor: #8A7F72;\n\t\t\tpadding: 2px 4px;\n\t\t\tborder-radius: 3px;\n\t\t\tline-height: 1;\n\t\t}\n\t\t.topics-row-btn:hover\n\t\t{\n\t\t\tcolor: #3D3229;\n\t\t\tbackground: #EDE9E3;\n\t\t}\n\t\t.topics-row-btn-delete:hover\n\t\t{\n\t\t\tcolor: #D9534F;\n\t\t\tbackground: #FDF0EF;\n\t\t}\n\t\t/* Inline edit form */\n\t\t.topics-edit\n\t\t{\n\t\t\tpadding: 8px 10px;\n\t\t\tborder-bottom: 1px solid #DDD6CA;\n\t\t\tbackground: #FFF9F0;\n\t\t}\n\t\t.topics-edit-field\n\t\t{\n\t\t\tmargin-bottom: 6px;\n\t\t}\n\t\t.topics-edit-label\n\t\t{\n\t\t\tdisplay: block;\n\t\t\tfont-size: 0.68rem;\n\t\t\tfont-weight: 600;\n\t\t\tcolor: #8A7F72;\n\t\t\tmargin-bottom: 2px;\n\t\t}\n\t\t.topics-edit-input\n\t\t{\n\t\t\tdisplay: block;\n\t\t\twidth: 100%;\n\t\t\tbox-sizing: border-box;\n\t\t\tpadding: 4px 6px;\n\t\t\tfont-size: 0.78rem;\n\t\t\tborder: 1px solid #DDD6CA;\n\t\t\tborder-radius: 3px;\n\t\t\tbackground: #FFF;\n\t\t\tcolor: #3D3229;\n\t\t\tfont-family: inherit;\n\t\t}\n\t\t.topics-edit-input:focus\n\t\t{\n\t\t\toutline: none;\n\t\t\tborder-color: #2E7D74;\n\t\t}\n\t\t.topics-edit-actions\n\t\t{\n\t\t\tdisplay: flex;\n\t\t\tgap: 6px;\n\t\t\tmargin-top: 8px;\n\t\t}\n\t\t.topics-edit-save\n\t\t{\n\t\t\tbackground: #2E7D74;\n\t\t\tcolor: #FFF;\n\t\t\tborder: none;\n\t\t\tborder-radius: 3px;\n\t\t\tpadding: 4px 12px;\n\t\t\tfont-size: 0.72rem;\n\t\t\tfont-weight: 600;\n\t\t\tcursor: pointer;\n\t\t}\n\t\t.topics-edit-save:hover\n\t\t{\n\t\t\tbackground: #3A9E92;\n\t\t}\n\t\t.topics-edit-cancel\n\t\t{\n\t\t\tbackground: transparent;\n\t\t\tcolor: #5E5549;\n\t\t\tborder: 1px solid #DDD6CA;\n\t\t\tborder-radius: 3px;\n\t\t\tpadding: 4px 12px;\n\t\t\tfont-size: 0.72rem;\n\t\t\tfont-weight: 600;\n\t\t\tcursor: pointer;\n\t\t}\n\t\t.topics-edit-cancel:hover\n\t\t{\n\t\t\tbackground: #F0EDE8;\n\t\t}\n\t\t/* Footer add button */\n\t\t.topics-footer\n\t\t{\n\t\t\tflex-shrink: 0;\n\t\t\tpadding: 8px 10px;\n\t\t\tborder-top: 1px solid #EDE9E3;\n\t\t\tbackground: #FAF8F4;\n\t\t}\n\t\t.topics-add-btn\n\t\t{\n\t\t\tdisplay: block;\n\t\t\twidth: 100%;\n\t\t\tpadding: 6px 0;\n\t\t\tbackground: #2E7D74;\n\t\t\tcolor: #FFF;\n\t\t\tborder: none;\n\t\t\tborder-radius: 4px;\n\t\t\tfont-size: 0.78rem;\n\t\t\tfont-weight: 600;\n\t\t\tcursor: pointer;\n\t\t\ttext-align: center;\n\t\t}\n\t\t.topics-add-btn:hover\n\t\t{\n\t\t\tbackground: #3A9E92;\n\t\t}\n\t\t/* Empty state */\n\t\t.topics-empty\n\t\t{\n\t\t\tdisplay: flex;\n\t\t\tflex-direction: column;\n\t\t\talign-items: center;\n\t\t\tjustify-content: center;\n\t\t\tgap: 12px;\n\t\t\tpadding: 32px 16px;\n\t\t\ttext-align: center;\n\t\t\tcolor: #8A7F72;\n\t\t\tfont-size: 0.82rem;\n\t\t}\n\t\t.topics-empty-icon\n\t\t{\n\t\t\tfont-size: 2rem;\n\t\t\tcolor: #C4BDB3;\n\t\t}\n\t\t.topics-empty-btn\n\t\t{\n\t\t\tdisplay: inline-block;\n\t\t\tpadding: 6px 14px;\n\t\t\tbackground: #2E7D74;\n\t\t\tcolor: #FFF;\n\t\t\tborder: none;\n\t\t\tborder-radius: 4px;\n\t\t\tfont-size: 0.78rem;\n\t\t\tfont-weight: 600;\n\t\t\tcursor: pointer;\n\t\t}\n\t\t.topics-empty-btn:hover\n\t\t{\n\t\t\tbackground: #3A9E92;\n\t\t}\n\t\t.topics-empty-btn-secondary\n\t\t{\n\t\t\tbackground: transparent;\n\t\t\tcolor: #5E5549;\n\t\t\tborder: 1px solid #DDD6CA;\n\t\t}\n\t\t.topics-empty-btn-secondary:hover\n\t\t{\n\t\t\tbackground: #F0EDE8;\n\t\t\tborder-color: #8A7F72;\n\t\t}\n\t",Templates:[{Hash:"Topics-Container-Template",Template:'\n<div class="topics-container" id="ContentEditor-Topics-Container">\n\t<div class="topics-header">\n\t\t<span class="topics-header-title" id="ContentEditor-Topics-HeaderTitle">Topics</span>\n\t\t<button class="topics-header-btn" title="Close topics file"\n\t\t\tonclick="pict.views[\'ContentEditor-Topics\'].closeTopicsFile()">×</button>\n\t</div>\n\t<div class="topics-list" id="ContentEditor-Topics-List"></div>\n\t<div class="topics-footer" id="ContentEditor-Topics-Footer">\n\t\t<button class="topics-add-btn"\n\t\t\tonclick="pict.views[\'ContentEditor-Topics\'].addTopic()">+ Add Topic</button>\n\t</div>\n</div>\n'}],Renderables:[{RenderableHash:"Topics-Wrap",TemplateHash:"Topics-Container-Template",DestinationAddress:"#ContentEditor-SidebarTopics-Container"}]}},{"pict-view":88}]},{},[105])(105)});
|
|
88
|
+
const i=t("fable-serviceproviderbase"),o=t("path"),r=t("fs"),s=t("url"),a={BasePath:".",APIRoutePrefix:"/api/filebrowser",WebAppRoute:"/filebrowser/*",WebAppRouteStrip:"/filebrowser/",ServeWebApp:!0,IncludeHiddenFiles:!1,MaxTreeDepth:2};e.exports=class extends i{constructor(t,e,n){super(t,e,n),this.serviceType="PictFileBrowserService";for(let t in a)t in this.options||(this.options[t]=a[t]);this.basePath=o.resolve(this.options.BasePath)}connectRoutes(){if(!this.fable.Orator||!this.fable.Orator.serviceServer)return this.log.error("PictFileBrowserService: Orator service server is not available. Initialize Orator first."),!1;let t=this.fable.Orator.serviceServer,e=this.options.APIRoutePrefix;if(t.get(e+"/list",(t,e,n)=>{let i=this.parseQueryParams(t).path||"";this.listDirectory(i,(t,i)=>t?(e.send(400,{Error:t.message}),n()):(e.send(i),n()))}),t.get(e+"/tree",(t,e,n)=>{let i=this.parseQueryParams(t),o=this.options.MaxTreeDepth;i.depth&&(o=parseInt(i.depth)||this.options.MaxTreeDepth),this.buildFolderTree("",o,(t,i)=>t?(e.send(400,{Error:t.message}),n()):(e.send(i),n()))}),t.get(e+"/info",(t,e,n)=>{let i=this.parseQueryParams(t).path||"";this.getFileInfo(i,(t,i)=>t?(e.send(400,{Error:t.message}),n()):(e.send(i),n()))}),t.get(e+"/children",(t,e,n)=>{let i=this.parseQueryParams(t).path||"";this.listChildFolders(i,(t,i)=>t?(e.send(400,{Error:t.message}),n()):(e.send(i),n()))}),this.options.ServeWebApp){let t=o.join(n,"..","www");this.fable.Orator.addStaticRoute(t,"index.html",this.options.WebAppRoute,this.options.WebAppRouteStrip)}return this.log.info("PictFileBrowserService: Routes connected. Browsing path: "+this.basePath),!0}parseQueryParams(t){if(t.query&&"object"==typeof t.query)return t.query;return s.parse(t.url,!0).query||{}}resolveSafePath(t){let e=(t||"").replace(/\.\./g,"").replace(/\/\//g,"/"),n=o.resolve(this.basePath,e);return 0!==n.indexOf(this.basePath)?null:n}listDirectory(t,e){let n=this.resolveSafePath(t);if(!n)return e(new Error("Invalid path"));r.readdir(n,{withFileTypes:!0},(i,s)=>{if(i)return"ENOENT"===i.code?e(new Error("Path not found")):"ENOTDIR"===i.code?e(new Error("Path is not a directory")):e(i);let a=[],c=s.length;if(0===c)return e(null,a);for(let i=0;i<s.length;i++){let l=s[i],d=l.name;if(!this.options.IncludeHiddenFiles&&"."===d.charAt(0)){if(c--,0===c)return e(null,a);continue}let p=o.join(n,d),h=t?t+"/"+d:d;r.stat(p,((t,n,i)=>(r,s)=>{let l={Name:t,Path:n,Type:i?"folder":"file"};if(s&&!r&&(l.Size=s.size,l.Modified=s.mtime,l.Created=s.birthtime,i||(l.Extension=o.extname(t))),a.push(l),c--,0===c)return e(null,a)})(d,h,l.isDirectory()))}})}listChildFolders(t,e){let n=this.resolveSafePath(t);if(!n)return e(new Error("Invalid path"));r.readdir(n,{withFileTypes:!0},(i,s)=>{if(i)return"ENOENT"===i.code?e(new Error("Path not found")):"ENOTDIR"===i.code?e(new Error("Path is not a directory")):e(i);let a=[];for(let t=0;t<s.length;t++){if(!s[t].isDirectory())continue;let e=s[t].name;(this.options.IncludeHiddenFiles||"."!==e.charAt(0))&&a.push(e)}if(a.sort((t,e)=>t.localeCompare(e)),0===a.length)return e(null,[]);let c=[],l=a.length;for(let i=0;i<a.length;i++){let s=a[i],d=o.join(n,s),p=t?t+"/"+s:s;r.readdir(d,{withFileTypes:!0},((t,n)=>(i,o)=>{let r=!1;if(!i&&o)for(let t=0;t<o.length;t++)if(o[t].isDirectory()){let e=o[t].name;if(this.options.IncludeHiddenFiles||"."!==e.charAt(0)){r=!0;break}}if(c.push({Name:t,Path:n,HasChildren:r}),l--,0===l)return c.sort((t,e)=>t.Name.localeCompare(e.Name)),e(null,c)})(s,p))}})}buildFolderTree(t,e,n){let i=this.resolveSafePath(t);if(!i)return n(new Error("Invalid path"));this._buildTreeRecursive(i,t,e,0,n)}_buildTreeRecursive(t,e,n,i,s){if(n>0&&i>=n)return s(null,[]);r.readdir(t,{withFileTypes:!0},(r,a)=>{if(r)return s(null,[]);let c=[];for(let t=0;t<a.length;t++)if(a[t].isDirectory()){let e=a[t].name;if(!this.options.IncludeHiddenFiles&&"."===e.charAt(0))continue;c.push(e)}if(0===c.length)return s(null,[]);let l=[],d=c.length;for(let r=0;r<c.length;r++){let a=c[r],p=o.join(t,a),h=e?e+"/"+a:a;this._buildTreeRecursive(p,h,n,i+1,((t,e)=>(n,i)=>{if(l.push({Name:t,Path:e,Children:i||[]}),d--,0===d)return l.sort((t,e)=>t.Name.localeCompare(e.Name)),s(null,l)})(a,h))}})}getFileInfo(t,e){let n=this.resolveSafePath(t);if(!n)return e(new Error("Invalid path"));r.stat(n,(i,r)=>{if(i)return"ENOENT"===i.code?e(new Error("Path not found")):e(i);let s=o.basename(n),a={Name:s,Path:t||s,Type:r.isDirectory()?"folder":"file",Size:r.size,Modified:r.mtime,Created:r.birthtime};return r.isDirectory()||(a.Extension=o.extname(s)),e(null,a)})}},e.exports.default_configuration=a}).call(this)}).call(this,"/node_modules/pict-section-filebrowser/source/services")},{"fable-serviceproviderbase":20,fs:2,path:42,url:100}],70:[function(t,e,n){const i=t("pict-view"),o={ViewIdentifier:"Pict-FileBrowser-BrowseSearch",DefaultRenderable:"BrowseSearch-Container",DefaultDestinationAddress:"#Pict-FileBrowser-BrowsePane",AutoRender:!1,Templates:[{Hash:"FileBrowser-BrowseSearch-Container-Template",Template:'\n<div class="pict-fb-search">\n\t<input type="text" class="pict-fb-search-input"\n\t\tid="Pict-FileBrowser-SearchInput"\n\t\tplaceholder="Search files..."\n\t\toninput="pict.views[\'{~D:Record.ViewHash~}\'].onSearchInput(this.value)" />\n\t<div class="pict-fb-search-results" id="Pict-FileBrowser-SearchResults"></div>\n</div>\n'},{Hash:"FileBrowser-BrowseSearch-Result-Template",Template:'\n<div class="pict-fb-search-result" onclick="{~D:Record.ClickHandler~}">\n\t<span class="pict-fb-search-result-icon">{~D:Record.Icon~}</span>\n\t<span class="pict-fb-search-result-name">{~D:Record.Name~}</span>\n\t<span class="pict-fb-search-result-path">{~D:Record.Path~}</span>\n</div>\n'},{Hash:"FileBrowser-BrowseSearch-Empty-Template",Template:'<div class="pict-fb-empty">{~D:Record.Message~}</div>'}],Renderables:[{RenderableHash:"BrowseSearch-Container",TemplateHash:"FileBrowser-BrowseSearch-Container-Template",DestinationAddress:"#Pict-FileBrowser-BrowsePane",RenderMethod:"replace"}]};e.exports=class extends i{constructor(t,e,n){super(t,Object.assign({},o,e),n),this.lastQuery="",this.debounceTimer=null}onAfterRender(t){let e=this.pict.parseTemplateByHash("FileBrowser-BrowseSearch-Container-Template",{ViewHash:this.Hash});return this.pict.ContentAssignment.assignContent("#Pict-FileBrowser-BrowsePane",e),this.pict.CSSMap.injectCSS(),super.onAfterRender(t)}onSearchInput(t){this.lastQuery=t||"",this.debounceTimer&&clearTimeout(this.debounceTimer),this.debounceTimer=setTimeout(()=>{this.performSearch(this.lastQuery)},150)}performSearch(t){let e="#Pict-FileBrowser-SearchResults";if(!t||t.length<1)return void this.pict.ContentAssignment.assignContent(e,"");let n=this.pict.providers["Pict-FileBrowser-Browse"];if(!n)return;let i=n.searchFiles(t),o=this.pict.providers["Pict-FileBrowser-List"];if(0===i.length){let t=this.pict.parseTemplateByHash("FileBrowser-BrowseSearch-Empty-Template",{Message:"No results found"});return void this.pict.ContentAssignment.assignContent(e,t)}let r="";for(let t=0;t<i.length&&t<50;t++){let e=i[t],n=o?o.getEntryIcon(e):"📄",s=e.Path||"",a={Name:e.Name,Path:s,Icon:n,ClickHandler:"pict.views['"+this.Hash+"'].selectResult("+t+")"};r+=this.pict.parseTemplateByHash("FileBrowser-BrowseSearch-Result-Template",a)}this.pict.ContentAssignment.assignContent(e,r),this._lastResults=i}selectResult(t){if(!this._lastResults||t>=this._lastResults.length)return;let e=this._lastResults[t],n=this.pict.providers["Pict-FileBrowser-List"];n&&n.openEntry(e)}},e.exports.default_configuration=o},{"pict-view":88}],71:[function(t,e,n){const i=t("pict-view"),o={ViewIdentifier:"Pict-FileBrowser-BrowseTree",DefaultRenderable:"BrowseTree-Container",DefaultDestinationAddress:"#Pict-FileBrowser-BrowsePane",AutoRender:!1,Templates:[{Hash:"FileBrowser-BrowseTree-Container-Template",Template:'<div class="pict-fb-tree" id="Pict-FileBrowser-Tree"></div>'},{Hash:"FileBrowser-BrowseTree-Node-Template",Template:'\n<div class="pict-fb-tree-node{~D:Record.SelectedClass~}" style="padding-left: {~D:Record.Indent~}px;" data-path="{~D:Record.Path~}" onclick="{~D:Record.ClickHandler~}">\n\t<span class="{~D:Record.ToggleClass~}" onclick="{~D:Record.ToggleHandler~}">{~D:Record.ToggleIcon~}</span>\n\t<span class="pict-fb-tree-icon">{~D:Record.Icon~}</span>\n\t<span class="pict-fb-tree-label">{~D:Record.Name~}</span>\n</div>\n<div class="pict-fb-tree-children{~D:Record.ExpandedClass~}" id="Pict-FB-TreeChildren-{~D:Record.NodeID~}">\n{~D:Record.ChildrenHTML~}\n</div>\n'}],Renderables:[{RenderableHash:"BrowseTree-Container",TemplateHash:"FileBrowser-BrowseTree-Container-Template",DestinationAddress:"#Pict-FileBrowser-BrowsePane",RenderMethod:"replace"}]};e.exports=class extends i{constructor(t,e,n){super(t,Object.assign({},o,e),n),this.expandedPaths={}}onAfterRender(t){return this.rebuildTree(),this.pict.CSSMap.injectCSS(),super.onAfterRender(t)}rebuildTree(){if(!this.pict.providers["Pict-FileBrowser-Browse"])return;let t=this.getCurrentLocation(),e=this.renderTreeLevel("",0,t);this.pict.ContentAssignment.assignContent("#Pict-FileBrowser-Tree",e)}renderTreeLevel(t,e,n){let i=this.pict.providers["Pict-FileBrowser-Browse"];if(!i)return"";let o=i.getChildFolders(t);if(!o)return this.expandedPaths[t]?'<div class="pict-fb-tree-loading" style="padding-left: '+(24+16*e)+'px;">Loading...</div>':"";let r="";for(let t=0;t<o.length;t++){let s=o[t],a=s.Path,c=a.replace(/[^a-zA-Z0-9]/g,"_"),l=!!this.expandedPaths[a],d=a===n,p=i.getChildFolders(a),h=s.HasChildren||p&&p.length>0,u="";l&&(u=this.renderTreeLevel(a,e+1,n));let f=this.pict.providers["Pict-FileBrowser-Icons"],g=f?f.getIcon("folder",16):"📁",m="";h&&(m=f?l?f.getIcon("chevron-down",10):f.getIcon("chevron-right",10):l?"▾":"▸");let v={Name:s.Name,Path:a,NodeID:c,Indent:8+16*e,Icon:g,ToggleIcon:m,ToggleClass:h?"pict-fb-tree-toggle":"pict-fb-tree-toggle-empty",ToggleHandler:h?"event.stopPropagation(); pict.views['"+this.Hash+"'].toggleNode('"+a+"')":"",ClickHandler:"pict.views['"+this.Hash+"'].selectFolder('"+a+"')",SelectedClass:d?" selected":"",ExpandedClass:l?" expanded":"",ChildrenHTML:u};r+=this.pict.parseTemplateByHash("FileBrowser-BrowseTree-Node-Template",v)}return r}toggleNode(t){if(this.expandedPaths[t]=!this.expandedPaths[t],this.expandedPaths[t]){let e=this.pict.providers["Pict-FileBrowser-Browse"];if(e){e.getChildFolders(t)||"function"==typeof this.onRequestChildren&&this.onRequestChildren(t)}}this.rebuildTree()}onRequestChildren(t){}selectFolder(t){this.expandedPaths[t]=!0;let e=this.pict.providers["Pict-FileBrowser-Browse"];if(e){e.getChildFolders(t)||"function"==typeof this.onRequestChildren&&this.onRequestChildren(t),e.navigateToFolder(t)}this.rebuildTree()}getCurrentLocation(){let t=(this.options.StateAddresses||{}).CurrentLocation||"AppData.PictFileBrowser.CurrentLocation";return this.pict.manifest.getValueByHash({AppData:this.pict.AppData,Pict:this.pict},t)||""}},e.exports.default_configuration=o},{"pict-view":88}],72:[function(t,e,n){const i=t("pict-view"),o={ViewIdentifier:"Pict-FileBrowser-ListDetail",DefaultRenderable:"ListDetail-Container",DefaultDestinationAddress:"#Pict-FileBrowser-ListPane",AutoRender:!1,Templates:[{Hash:"FileBrowser-ListDetail-Container-Template",Template:'\n<div class="pict-fb-detail" id="Pict-FileBrowser-DetailList">\n\t<div class="pict-fb-breadcrumb" id="Pict-FileBrowser-Breadcrumb"></div>\n\t<div class="pict-fb-detail-header">\n\t\t<div class="pict-fb-detail-header-cell pict-fb-detail-col-name" onclick="pict.views[\'{~D:Record.ViewHash~}\'].sortBy(\'Name\')">Name</div>\n\t\t<div class="pict-fb-detail-header-cell pict-fb-detail-col-size" onclick="pict.views[\'{~D:Record.ViewHash~}\'].sortBy(\'Size\')">Size</div>\n\t\t<div class="pict-fb-detail-header-cell pict-fb-detail-col-modified" onclick="pict.views[\'{~D:Record.ViewHash~}\'].sortBy(\'Modified\')">Modified</div>\n\t</div>\n\t<div id="Pict-FileBrowser-DetailRows"></div>\n</div>\n'},{Hash:"FileBrowser-ListDetail-Row-Template",Template:'\n<div class="pict-fb-detail-row{~D:Record.SelectedClass~}" data-index="{~D:Record.Index~}" onclick="{~D:Record.ClickHandler~}" ondblclick="{~D:Record.DblClickHandler~}">\n\t<span class="pict-fb-detail-icon">{~D:Record.Icon~}</span>\n\t<span class="pict-fb-detail-name">{~D:Record.Name~}</span>\n\t<span class="pict-fb-detail-size">{~D:Record.SizeFormatted~}</span>\n\t<span class="pict-fb-detail-modified">{~D:Record.ModifiedFormatted~}</span>\n</div>\n'},{Hash:"FileBrowser-ListDetail-Empty-Template",Template:'<div class="pict-fb-empty">{~D:Record.Message~}</div>'},{Hash:"FileBrowser-Breadcrumb-Segment-Template",Template:'<span class="pict-fb-breadcrumb-segment" onclick="{~D:Record.ClickHandler~}">{~D:Record.Label~}</span>'},{Hash:"FileBrowser-Breadcrumb-Separator-Template",Template:'<span class="pict-fb-breadcrumb-separator">/</span>'},{Hash:"FileBrowser-Breadcrumb-Current-Template",Template:'<span class="pict-fb-breadcrumb-current">{~D:Record.Label~}</span>'}],Renderables:[{RenderableHash:"ListDetail-Container",TemplateHash:"FileBrowser-ListDetail-Container-Template",DestinationAddress:"#Pict-FileBrowser-ListPane",RenderMethod:"replace"}]};e.exports=class extends i{constructor(t,e,n){super(t,Object.assign({},o,e),n),this._cachedFileList=[],this._activeRebuildFrame=null,this._activeRebuildToken=0}_cancelActiveRebuild(){null!==this._activeRebuildFrame&&"function"==typeof cancelAnimationFrame&&(cancelAnimationFrame(this._activeRebuildFrame),this._activeRebuildFrame=null),this._activeRebuildToken++}onAfterRender(t){let e=this.pict.parseTemplateByHash("FileBrowser-ListDetail-Container-Template",{ViewHash:this.Hash});return this.pict.ContentAssignment.assignContent("#Pict-FileBrowser-ListPane",e),this.rebuildList(),this.rebuildBreadcrumb(),this.pict.CSSMap.injectCSS(),super.onAfterRender(t)}rebuildList(){this._cancelActiveRebuild();let t=this.pict.providers["Pict-FileBrowser-List"];if(!t)return;let e=t.getSortedFileList();this._cachedFileList=e;let n=t.getSelectedFile();if(0===e.length){let t=this.pict.parseTemplateByHash("FileBrowser-ListDetail-Empty-Template",{Message:"This folder is empty"});return void this.pict.ContentAssignment.assignContent("#Pict-FileBrowser-DetailRows",t)}if(e.length<=500){let t="";for(let i=0;i<e.length;i++)t+=this._buildRowHTML(e[i],i,n);return void this.pict.ContentAssignment.assignContent("#Pict-FileBrowser-DetailRows",t)}let i='<div class="retold-remote-filebrowser-loading-row">Loading '+e.length.toLocaleString()+" items…</div>";this.pict.ContentAssignment.assignContent("#Pict-FileBrowser-DetailRows",i),this._rebuildListChunked(e,n)}_buildRowHTML(t,e,n){let i=this.pict.providers["Pict-FileBrowser-List"],o=n&&n.Name===t.Name&&n.Path===t.Path,r={Index:e,Name:t.Name,Icon:i.getEntryIcon(t),SizeFormatted:"folder"===t.Type?"--":i.formatFileSize(t.Size),ModifiedFormatted:i.formatDate(t.Modified),SelectedClass:o?" selected":"",ClickHandler:"pict.views['"+this.Hash+"'].selectEntry("+e+")",DblClickHandler:"pict.views['"+this.Hash+"'].openEntry("+e+")"};return this.pict.parseTemplateByHash("FileBrowser-ListDetail-Row-Template",r)}_rebuildListChunked(t,e){let n=this,i=++this._activeRebuildToken,o=t.length,r=0,s=function(){if(i!==n._activeRebuildToken)return;let a=document.getElementById("Pict-FileBrowser-DetailRows");if(!a)return;let c=0===r?200:400,l=Math.min(r+c,o),d="";for(let i=r;i<l;i++)d+=n._buildRowHTML(t[i],i,e);0===r?a.innerHTML=d:a.insertAdjacentHTML("beforeend",d),r=l,n._activeRebuildFrame=r<o?requestAnimationFrame(s):null};if("function"==typeof requestAnimationFrame)this._activeRebuildFrame=requestAnimationFrame(s);else for(s();r<o;)s()}rebuildBreadcrumb(){let t=this.getCurrentLocation(),e="",n=this.pict.providers["Pict-FileBrowser-Icons"],i=n?n.getIcon("home",16):"🏠";if(e+=this.pict.parseTemplateByHash("FileBrowser-Breadcrumb-Segment-Template",{Label:i,ClickHandler:"pict.views['"+this.Hash+"'].navigateToPath('')"}),t){let n=t.split("/"),i="";for(let t=0;t<n.length;t++)if(i=i?i+"/"+n[t]:n[t],e+=this.pict.parseTemplateByHash("FileBrowser-Breadcrumb-Separator-Template",{}),t===n.length-1)e+=this.pict.parseTemplateByHash("FileBrowser-Breadcrumb-Current-Template",{Label:n[t]});else{let o=i;e+=this.pict.parseTemplateByHash("FileBrowser-Breadcrumb-Segment-Template",{Label:n[t],ClickHandler:"pict.views['"+this.Hash+"'].navigateToPath('"+o+"')"})}}this.pict.ContentAssignment.assignContent("#Pict-FileBrowser-Breadcrumb",e)}selectEntry(t){if(t<0||t>=this._cachedFileList.length)return;let e=this.pict.providers["Pict-FileBrowser-List"];e&&e.selectFile(this._cachedFileList[t]),this.rebuildList()}openEntry(t){if(t<0||t>=this._cachedFileList.length)return;let e=this.pict.providers["Pict-FileBrowser-List"];e&&e.openEntry(this._cachedFileList[t]),this.rebuildList(),this.rebuildBreadcrumb()}sortBy(t){let e=this.pict.providers["Pict-FileBrowser-List"];e&&e.setSortField(t),this.rebuildList()}navigateToPath(t){let e=this.pict.providers["Pict-FileBrowser-Browse"];e&&e.navigateToFolder(t),this.rebuildList(),this.rebuildBreadcrumb()}getCurrentLocation(){let t=(this.options.StateAddresses||{}).CurrentLocation||"AppData.PictFileBrowser.CurrentLocation";return this.pict.manifest.getValueByHash({AppData:this.pict.AppData,Pict:this.pict},t)||""}},e.exports.default_configuration=o},{"pict-view":88}],73:[function(t,e,n){const i=t("pict-view"),o={ViewIdentifier:"Pict-FileBrowser-ListIcons",DefaultRenderable:"ListIcons-Container",DefaultDestinationAddress:"#Pict-FileBrowser-ListPane",AutoRender:!1,Templates:[{Hash:"FileBrowser-ListIcons-Container-Template",Template:'\n<div id="Pict-FileBrowser-IconList">\n\t<div class="pict-fb-breadcrumb" id="Pict-FileBrowser-IconBreadcrumb"></div>\n\t<div class="pict-fb-icons" id="Pict-FileBrowser-IconGrid"></div>\n</div>\n'},{Hash:"FileBrowser-ListIcons-Item-Template",Template:'\n<div class="pict-fb-icon-item{~D:Record.SelectedClass~}" data-index="{~D:Record.Index~}" onclick="{~D:Record.ClickHandler~}" ondblclick="{~D:Record.DblClickHandler~}">\n\t<div class="pict-fb-icon-graphic">{~D:Record.Icon~}</div>\n\t<div class="pict-fb-icon-label">{~D:Record.Name~}</div>\n</div>\n'},{Hash:"FileBrowser-ListIcons-Empty-Template",Template:'<div class="pict-fb-empty">{~D:Record.Message~}</div>'}],Renderables:[{RenderableHash:"ListIcons-Container",TemplateHash:"FileBrowser-ListIcons-Container-Template",DestinationAddress:"#Pict-FileBrowser-ListPane",RenderMethod:"replace"}]};e.exports=class extends i{constructor(t,e,n){super(t,Object.assign({},o,e),n),this._cachedFileList=[]}onAfterRender(t){return this.rebuildGrid(),this.rebuildBreadcrumb(),this.pict.CSSMap.injectCSS(),super.onAfterRender(t)}rebuildGrid(){let t=this.pict.providers["Pict-FileBrowser-List"];if(!t)return;let e=t.getSortedFileList();this._cachedFileList=e;let n=t.getSelectedFile();if(0===e.length){let t=this.pict.parseTemplateByHash("FileBrowser-ListIcons-Empty-Template",{Message:"This folder is empty"});return void this.pict.ContentAssignment.assignContent("#Pict-FileBrowser-IconGrid",t)}let i="";for(let o=0;o<e.length;o++){let r=e[o],s=n&&n.Name===r.Name&&n.Path===r.Path,a={Index:o,Name:r.Name,Icon:t.getEntryIcon(r),SelectedClass:s?" selected":"",ClickHandler:"pict.views['"+this.Hash+"'].selectEntry("+o+")",DblClickHandler:"pict.views['"+this.Hash+"'].openEntry("+o+")"};i+=this.pict.parseTemplateByHash("FileBrowser-ListIcons-Item-Template",a)}this.pict.ContentAssignment.assignContent("#Pict-FileBrowser-IconGrid",i)}rebuildBreadcrumb(){let t=this.getCurrentLocation(),e="";if(e+=this.pict.parseTemplateByHash("FileBrowser-Breadcrumb-Segment-Template",{Label:"🏠",ClickHandler:"pict.views['"+this.Hash+"'].navigateToPath('')"}),t){let n=t.split("/"),i="";for(let t=0;t<n.length;t++)if(i=i?i+"/"+n[t]:n[t],e+=this.pict.parseTemplateByHash("FileBrowser-Breadcrumb-Separator-Template",{}),t===n.length-1)e+=this.pict.parseTemplateByHash("FileBrowser-Breadcrumb-Current-Template",{Label:n[t]});else{let o=i;e+=this.pict.parseTemplateByHash("FileBrowser-Breadcrumb-Segment-Template",{Label:n[t],ClickHandler:"pict.views['"+this.Hash+"'].navigateToPath('"+o+"')"})}}this.pict.ContentAssignment.assignContent("#Pict-FileBrowser-IconBreadcrumb",e)}selectEntry(t){if(t<0||t>=this._cachedFileList.length)return;let e=this.pict.providers["Pict-FileBrowser-List"];e&&e.selectFile(this._cachedFileList[t]),this.rebuildGrid()}openEntry(t){if(t<0||t>=this._cachedFileList.length)return;let e=this.pict.providers["Pict-FileBrowser-List"];e&&e.openEntry(this._cachedFileList[t]),this.rebuildGrid(),this.rebuildBreadcrumb()}navigateToPath(t){let e=this.pict.providers["Pict-FileBrowser-Browse"];e&&e.navigateToFolder(t),this.rebuildGrid(),this.rebuildBreadcrumb()}getCurrentLocation(){let t=(this.options.StateAddresses||{}).CurrentLocation||"AppData.PictFileBrowser.CurrentLocation";return this.pict.manifest.getValueByHash({AppData:this.pict.AppData,Pict:this.pict},t)||""}},e.exports.default_configuration=o},{"pict-view":88}],74:[function(t,e,n){const i=t("pict-view"),o={ViewIdentifier:"Pict-FileBrowser-ViewFileInfo",DefaultRenderable:"ViewFileInfo-Container",DefaultDestinationAddress:"#Pict-FileBrowser-ViewPane",AutoRender:!1,Templates:[{Hash:"FileBrowser-ViewFileInfo-Container-Template",Template:'<div class="pict-fb-fileinfo" id="Pict-FileBrowser-FileInfo"></div>'},{Hash:"FileBrowser-ViewFileInfo-Detail-Template",Template:'\n<div class="pict-fb-fileinfo-title">{~D:Record.Name~}</div>\n<table class="pict-fb-fileinfo-table">\n\t<tr>\n\t\t<td class="pict-fb-fileinfo-label">Type</td>\n\t\t<td class="pict-fb-fileinfo-value">{~D:Record.TypeDescription~}</td>\n\t</tr>\n\t<tr>\n\t\t<td class="pict-fb-fileinfo-label">Size</td>\n\t\t<td class="pict-fb-fileinfo-value">{~D:Record.SizeFormatted~}</td>\n\t</tr>\n\t<tr>\n\t\t<td class="pict-fb-fileinfo-label">Modified</td>\n\t\t<td class="pict-fb-fileinfo-value">{~D:Record.ModifiedFormatted~}</td>\n\t</tr>\n\t<tr>\n\t\t<td class="pict-fb-fileinfo-label">Extension</td>\n\t\t<td class="pict-fb-fileinfo-value">{~D:Record.Extension~}</td>\n\t</tr>\n\t<tr>\n\t\t<td class="pict-fb-fileinfo-label">Path</td>\n\t\t<td class="pict-fb-fileinfo-value">{~D:Record.Path~}</td>\n\t</tr>\n</table>\n'},{Hash:"FileBrowser-ViewFileInfo-Empty-Template",Template:'<div class="pict-fb-fileinfo-none">No file selected</div>'}],Renderables:[{RenderableHash:"ViewFileInfo-Container",TemplateHash:"FileBrowser-ViewFileInfo-Container-Template",DestinationAddress:"#Pict-FileBrowser-ViewPane",RenderMethod:"replace"}]};e.exports=class extends i{constructor(t,e,n){super(t,Object.assign({},o,e),n)}onAfterRender(t){return this.rebuildFileInfo(),this.pict.CSSMap.injectCSS(),super.onAfterRender(t)}rebuildFileInfo(){let t=this.pict.providers["Pict-FileBrowser-View"],e=this.pict.providers["Pict-FileBrowser-List"],n=t?t.getCurrentFile():null;if(!n){let t=this.pict.parseTemplateByHash("FileBrowser-ViewFileInfo-Empty-Template",{});return void this.pict.ContentAssignment.assignContent("#Pict-FileBrowser-FileInfo",t)}let i={Name:n.Name||"Unknown",TypeDescription:t?t.getFileTypeDescription(n):"File",SizeFormatted:e?e.formatFileSize(n.Size):n.Size||"--",ModifiedFormatted:e?e.formatDate(n.Modified):n.Modified||"--",Extension:n.Extension||"--",Path:n.Path||"--"},o=this.pict.parseTemplateByHash("FileBrowser-ViewFileInfo-Detail-Template",i);this.pict.ContentAssignment.assignContent("#Pict-FileBrowser-FileInfo",o)}},e.exports.default_configuration=o},{"pict-view":88}],75:[function(t,e,n){const i=t("pict-view"),o={ViewIdentifier:"Pict-FileBrowser-ViewImage",DefaultRenderable:"ViewImage-Container",DefaultDestinationAddress:"#Pict-FileBrowser-ViewPane",AutoRender:!1,Templates:[{Hash:"FileBrowser-ViewImage-Container-Template",Template:'<div class="pict-fb-image-viewer" id="Pict-FileBrowser-ImageViewer"></div>'},{Hash:"FileBrowser-ViewImage-Display-Template",Template:'<img src="{~D:Record.ImageURL~}" alt="{~D:Record.Name~}" />'},{Hash:"FileBrowser-ViewImage-NoImage-Template",Template:'<div class="pict-fb-image-viewer-none">{~D:Record.Message~}</div>'}],Renderables:[{RenderableHash:"ViewImage-Container",TemplateHash:"FileBrowser-ViewImage-Container-Template",DestinationAddress:"#Pict-FileBrowser-ViewPane",RenderMethod:"replace"}]};e.exports=class extends i{constructor(t,e,n){super(t,Object.assign({},o,e),n)}onAfterRender(t){return this.rebuildImageView(),this.pict.CSSMap.injectCSS(),super.onAfterRender(t)}rebuildImageView(){let t=this.pict.providers["Pict-FileBrowser-View"],e=t?t.getCurrentFile():null;if(!e){let t=this.pict.parseTemplateByHash("FileBrowser-ViewImage-NoImage-Template",{Message:"No file selected"});return void this.pict.ContentAssignment.assignContent("#Pict-FileBrowser-ImageViewer",t)}if(!(!!t&&t.isImage(e))){let t=this.pict.parseTemplateByHash("FileBrowser-ViewImage-NoImage-Template",{Message:"Selected file is not an image"});return void this.pict.ContentAssignment.assignContent("#Pict-FileBrowser-ImageViewer",t)}let n=t?t.getImageURL(e):null;if(!n){let t=this.pict.parseTemplateByHash("FileBrowser-ViewImage-NoImage-Template",{Message:"No image URL available"});return void this.pict.ContentAssignment.assignContent("#Pict-FileBrowser-ImageViewer",t)}let i=this.pict.parseTemplateByHash("FileBrowser-ViewImage-Display-Template",{ImageURL:n,Name:e.Name||"Image"});this.pict.ContentAssignment.assignContent("#Pict-FileBrowser-ImageViewer",i)}},e.exports.default_configuration=o},{"pict-view":88}],76:[function(t,e,n){const i=t("pict-view"),o=t("../Pict-Section-FileBrowser-DefaultConfiguration.js"),r=t("../providers/Pict-Provider-FileBrowserBrowse.js"),s=t("../providers/Pict-Provider-FileBrowserList.js"),a=t("../providers/Pict-Provider-FileBrowserView.js"),c=t("../providers/Pict-Provider-FileBrowserLayout.js"),l=t("../providers/Pict-Provider-FileBrowserIcons.js");e.exports=class extends i{constructor(t,e,n){super(t,Object.assign({},JSON.parse(JSON.stringify(o)),e),n),this.pict.providers["Pict-FileBrowser-Browse"]||this.pict.addProvider("Pict-FileBrowser-Browse",r.default_configuration,r),this.pict.providers["Pict-FileBrowser-List"]||this.pict.addProvider("Pict-FileBrowser-List",s.default_configuration,s),this.pict.providers["Pict-FileBrowser-View"]||this.pict.addProvider("Pict-FileBrowser-View",a.default_configuration,a),this.pict.providers["Pict-FileBrowser-Layout"]||this.pict.addProvider("Pict-FileBrowser-Layout",c.default_configuration,c),this.pict.providers["Pict-FileBrowser-Icons"]||this.pict.addProvider("Pict-FileBrowser-Icons",l.default_configuration,l),this.ensureDefaultState()}ensureDefaultState(){let t=this.options.DefaultState||{},e=this.options.StateAddresses||{},n={AppData:this.pict.AppData,Pict:this.pict};this.pict.AppData.PictFileBrowser||(this.pict.AppData.PictFileBrowser={});for(let i in e){let o=e[i],r=this.pict.manifest.getValueByHash(n,o);if(null==r){let e=t[i];void 0!==e&&this.pict.manifest.setValueByHash(n,o,e)}}this.pict.AppData.PictFileBrowser.FileList||(this.pict.AppData.PictFileBrowser.FileList=[]),this.pict.AppData.PictFileBrowser.FolderTree||(this.pict.AppData.PictFileBrowser.FolderTree=[])}onAfterRender(t){return this.pict.CSSMap.injectCSS(),super.onAfterRender(t)}getState(t){let e=(this.options.StateAddresses||{})[t];if(e)return this.pict.manifest.getValueByHash({AppData:this.pict.AppData,Pict:this.pict},e)}setState(t,e){let n=(this.options.StateAddresses||{})[t];n&&this.pict.manifest.setValueByHash({AppData:this.pict.AppData,Pict:this.pict},n,e)}},e.exports.default_configuration=o},{"../Pict-Section-FileBrowser-DefaultConfiguration.js":62,"../providers/Pict-Provider-FileBrowserBrowse.js":64,"../providers/Pict-Provider-FileBrowserIcons.js":65,"../providers/Pict-Provider-FileBrowserLayout.js":66,"../providers/Pict-Provider-FileBrowserList.js":67,"../providers/Pict-Provider-FileBrowserView.js":68,"pict-view":88}],77:[function(t,e,n){arguments[4][45][0].apply(n,arguments)},{"./providers/Pict-Provider-Content.js":78,"./views/Pict-View-Content.js":79,dup:45}],78:[function(t,e,n){arguments[4][46][0].apply(n,arguments)},{dup:46,"pict-provider":58,"pict-section-code":61}],79:[function(t,e,n){const i=t("pict-view");e.exports=class extends i{constructor(t,e,n){super(t,e,n)}displayContent(t,e){let n=e||"Pict-Content-Body";this.pict.ContentAssignment.assignContent("#"+n,t);let i=document.getElementById(n);i&&i.parentElement&&(i.parentElement.scrollTop=0),this.renderMermaidDiagrams(n),this.renderKaTeXEquations(n)}renderMermaidDiagrams(t){if("undefined"==typeof mermaid)return;let e=t||"Pict-Content-Body",n=document.getElementById(e);if(!n)return;let i=n.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",n=document.getElementById(e);if(!n)return;let i=n.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 o=n.querySelectorAll(".pict-content-katex-display");for(let t=0;t<o.length;t++)try{katex.render(o[t].textContent,o[t],{throwOnError:!1,displayMode:!0})}catch(t){this.log.warn("KaTeX display error: "+t.message)}}showLoading(t,e){let n=e||"Pict-Content-Body",i=t||"Loading content...";this.pict.ContentAssignment.assignContent("#"+n,'<div class="pict-content-loading">'+i+"</div>")}},e.exports.default_configuration={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"}]}},{"pict-view":88}],80:[function(t,e,n){e.exports.attach=function(t){t._createEditorInContainer=function(e,n,i){let o=t._codeMirrorModules,r=[];r.push(o.EditorView.domEventHandlers({keydown:(e,i)=>(e.ctrlKey||e.metaKey)&&"b"===e.key?(e.preventDefault(),t.applyFormatting(n,"bold"),!0):(e.ctrlKey||e.metaKey)&&"i"===e.key?(e.preventDefault(),t.applyFormatting(n,"italic"),!0):(e.ctrlKey||e.metaKey)&&"e"===e.key?(e.preventDefault(),t.applyFormatting(n,"code"),!0):void 0,paste:(e,i)=>{let o=e.clipboardData&&e.clipboardData.items;if(!o)return!1;for(let i=0;i<o.length;i++)if(o[i].type.startsWith("image/")){e.preventDefault();let r=o[i].getAsFile();return r&&t._processImageFile(r,n),!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 o=e.dataTransfer.files[0];if(o.type&&o.type.startsWith("image/")){e.preventDefault(),e.stopPropagation(),t._processImageFile(o,n);let r=i.dom.closest(".pict-mde-segment-editor");return r&&r.classList.remove("pict-mde-image-dragover"),!0}return!1}})),o.extensions&&Array.isArray(o.extensions)&&(r=r.concat(o.extensions)),r.push(o.EditorView.updateListener.of(e=>{e.docChanged&&t._onSegmentContentChange(n,e.state.doc.toString()),e.focusChanged&&(e.view.hasFocus?(t._setActiveSegment(n),t._updateSidebarPosition(n)):setTimeout(()=>{if(t._activeSegmentIndex===n){let e=document.getElementById("PictMDE-Segment-".concat(n));e&&!e.contains(document.activeElement)&&(t._clearActiveSegment(n),t._resetSidebarPosition(n))}},100)),e.selectionSet&&e.view.hasFocus&&t._updateSidebarPosition(n)}));let s=t._buildDataURICollapseExtension();s&&r.push(s),t.options.ReadOnly&&(r.push(o.EditorState.readOnly.of(!0)),r.push(o.EditorView.editable.of(!1))),r=t.customConfigureExtensions(r,n);let a=o.EditorState.create({doc:i||"",extensions:r}),c=new o.EditorView({state:a,parent:e});t._segmentEditors[n]=c,c.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=c.state,o=i.selection.main.head,r=i.doc.lineAt(o),s=o-r.from;if("ArrowDown"===e.key){if(r.to<i.doc.length)return;let o=t._getOrderedSegmentIndices(),a=t._getLogicalIndex(n);if(a<0||a>=o.length-1)return;let c=o[a+1],l=t._segmentEditors[c];if(!l)return;e.preventDefault(),e.stopPropagation();let d=l.state.doc.line(1),p=Math.min(s,d.to-d.from);l.focus(),l.dispatch({selection:{anchor:d.from+p}}),t._setActiveSegment(c)}else if("ArrowUp"===e.key){if(r.number>1)return;let i=t._getOrderedSegmentIndices(),o=t._getLogicalIndex(n);if(o<=0)return;let a=i[o-1],c=t._segmentEditors[a];if(!c)return;e.preventDefault(),e.stopPropagation();let l=c.state.doc.line(c.state.doc.lines),d=Math.min(s,l.to-l.from);c.focus(),c.dispatch({selection:{anchor:l.from+d}}),t._setActiveSegment(a)}},!0),c.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,n);let o=document.getElementById("PictMDE-SegmentEditor-".concat(n));o&&o.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 n=e.Decoration,i=e.ViewPlugin,o=e.WidgetType;class r extends o{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 s(t){let e=[],i=t.state.doc;for(let o of t.visibleRanges){let t,s=o.from,a=o.to,c=i.sliceString(s,a),l=/!\[[^\]]*\]\(data:([^;]+);base64,/g;for(;null!==(t=l.exec(c));){let o=s+t.index+t[0].length,a=-1,c=o,l=i.length,d=Math.min(l,c+5242880),p=4096;for(let t=c;t<d;t+=p){let e=Math.min(t+p,d),n=i.sliceString(t,e).indexOf(")");if(n>=0){a=t+n;break}}if(a<0)continue;let h=a-o;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="…".concat(u,")"),m=n.replace({widget:new r(g)});e.push(m.range(o,a+1))}}return n.set(e,!0)}return i.fromClass(class{constructor(t){this.decorations=s(t)}update(t){(t.docChanged||t.viewportChanged)&&(this.decorations=s(t.view))}},{decorations:t=>t.decorations})}}},{}],81:[function(t,e,n){e.exports.attach=function(t){t._wireSegmentDragEvents=function(e,n){let i=e.querySelector(".pict-mde-drag-handle");i&&(i.addEventListener("dragstart",i=>{t._dragSourceIndex=n,i.dataTransfer.effectAllowed="move",i.dataTransfer.setData("text/plain",String(n));let o=t._getContainerElement();o&&o.classList.add("pict-mde-dragging"),setTimeout(()=>{e.style.opacity="0.4"},0)}),i.addEventListener("dragend",()=>{e.style.opacity="",t._dragSourceIndex=-1,t._clearAllDropIndicators();let n=t._getContainerElement();n&&n.classList.remove("pict-mde-dragging")}),e.addEventListener("dragover",n=>{n.preventDefault(),n.dataTransfer.dropEffect="move",t._clearAllDropIndicators();let i=e.getBoundingClientRect(),o=i.top+i.height/2;n.clientY<o?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 o=e.classList.contains("pict-mde-drag-over-bottom");t._clearAllDropIndicators();let r=t._dragSourceIndex;r<0||r===n||t._reorderSegment(r,n,o)}))},t._clearAllDropIndicators=function(){let e=t._getContainerElement();if(!e)return;let n=e.querySelectorAll(".pict-mde-segment");for(let t=0;t<n.length;t++)n[t].classList.remove("pict-mde-drag-over-top"),n[t].classList.remove("pict-mde-drag-over-bottom")},t._reorderSegment=function(e,n,i){let o=t._getLogicalIndex(e),r=t._getLogicalIndex(n);if(o<0||r<0)return void t.log.warn("PICT-MarkdownEditor _reorderSegment: could not resolve logical indices (from=".concat(o,", to=").concat(r,")."));if(o===r)return;t._marshalAllEditorsToData();let s=t._getSegmentsFromData();if(!s||s.length<2)return;let a=i?r+1:r;if(o<a&&a--,a===o)return;let c=s.splice(o,1)[0];s.splice(a,0,c),t._setSegmentsToData(s),t._reorderHiddenPreviewState(o,a),t._reorderSegmentTabStates(o,a),t._buildEditorUI()},t._reorderHiddenPreviewState=function(e,n){if(e===n)return;let i=Object.keys(t._hiddenPreviewSegments).map(t=>parseInt(t,10));if(0===i.length)return;let o=Math.max(...i,e,n),r=[];for(let e=0;e<=o;e++)r.push(!!t._hiddenPreviewSegments[e]);let s=r.splice(e,1)[0];r.splice(n,0,s),t._hiddenPreviewSegments={};for(let e=0;e<r.length;e++)r[e]&&(t._hiddenPreviewSegments[e]=!0)},t._swapHiddenPreviewState=function(e,n){let i=!!t._hiddenPreviewSegments[e];!!t._hiddenPreviewSegments[n]?t._hiddenPreviewSegments[e]=!0:delete t._hiddenPreviewSegments[e],i?t._hiddenPreviewSegments[n]=!0:delete t._hiddenPreviewSegments[n]},t._reorderSegmentTabStates=function(e,n){if(e===n)return;let i=Object.keys(t._segmentTabStates).map(t=>parseInt(t,10));if(0===i.length)return;let o=Math.max(...i,e,n),r=[];for(let e=0;e<=o;e++)r.push(t._segmentTabStates[e]||"editor");let s=r.splice(e,1)[0];r.splice(n,0,s),t._segmentTabStates={};for(let e=0;e<r.length;e++)"editor"!==r[e]&&(t._segmentTabStates[e]=r[e])},t._swapSegmentTabStates=function(e,n){let i=t._segmentTabStates[e]||"editor",o=t._segmentTabStates[n]||"editor";"editor"!==o?t._segmentTabStates[e]=o:delete t._segmentTabStates[e],"editor"!==i?t._segmentTabStates[n]=i:delete t._segmentTabStates[n]},t._setActiveSegment=function(e){if(t._activeSegmentIndex>=0&&t._activeSegmentIndex!==e){let e=document.getElementById("PictMDE-Segment-".concat(t._activeSegmentIndex));e&&e.classList.remove("pict-mde-active")}t._activeSegmentIndex=e;let n=document.getElementById("PictMDE-Segment-".concat(e));n&&n.classList.add("pict-mde-active")},t._clearActiveSegment=function(e){t._activeSegmentIndex===e&&(t._activeSegmentIndex=-1);let n=document.getElementById("PictMDE-Segment-".concat(e));n&&n.classList.remove("pict-mde-active"),t._resetSidebarPosition(e)},t._updateSidebarPosition=function(e){let n=document.getElementById("PictMDE-Segment-".concat(e));if(!n)return;let i=n.querySelector(".pict-mde-quadrant-tr");if(!i)return;let o=t._segmentEditors[e];if(!o)return;let r=o.state.selection.main.head,s=o.coordsAtPos(r);if(!s)return void t._resetSidebarPosition(e);let a=n.getBoundingClientRect(),c=s.top-a.top,l=i.offsetHeight||0,d=n.offsetHeight||0,p=Math.max(0,d-l);c=Math.max(0,Math.min(c,p)),i.classList.add("pict-mde-sidebar-at-cursor"),i.style.setProperty("--pict-mde-sidebar-top","".concat(c,"px"))},t._resetSidebarPosition=function(t){let e=document.getElementById("PictMDE-Segment-".concat(t));if(!e)return;let n=e.querySelector(".pict-mde-quadrant-tr");n&&(n.classList.remove("pict-mde-sidebar-at-cursor"),n.style.removeProperty("--pict-mde-sidebar-top"))}}},{}],82:[function(t,e,n){const i={bold:{wrap:"**"},italic:{wrap:"*"},code:{wrap:"`"},heading:{prefix:"# "},link:{before:"[",after:"](url)"}};e.exports.attach=function(t){t.applyFormatting=function(e,n){let o=t._segmentEditors[e];if(!o)return void t.log.warn("PICT-MarkdownEditor applyFormatting: no editor for segment ".concat(e,"."));let r=i[n];if(!r)return void t.log.warn('PICT-MarkdownEditor applyFormatting: unknown format type "'.concat(n,'".'));let s,a,c=o.state,l=c.selection.main,d=l.from,p=l.to,h=d!==p,u=h?c.sliceDoc(d,p):"";if(r.wrap){let t=r.wrap;if(h){let e=c.sliceDoc(Math.max(0,d-t.length),d),n=c.sliceDoc(p,Math.min(c.doc.length,p+t.length));if(e===t&&n===t)return s=[{from:d-t.length,to:d,insert:""},{from:p,to:p+t.length,insert:""}],a=d-t.length,void o.dispatch({changes:s,selection:{anchor:a,head:a+u.length}});s={from:d,to:p,insert:t+u+t},a=d+t.length,o.dispatch({changes:s,selection:{anchor:a,head:a+u.length}})}else{s={from:d,insert:t+t},a=d+t.length,o.dispatch({changes:s,selection:{anchor:a}})}}else if(r.prefix){let t=c.doc.lineAt(d);s=t.text.startsWith(r.prefix)?{from:t.from,to:t.from+r.prefix.length,insert:""}:{from:t.from,insert:r.prefix},o.dispatch({changes:s})}else if(r.before&&r.after)if(h){s={from:d,to:p,insert:r.before+u+r.after},a=d+r.before.length+u.length+2,o.dispatch({changes:s,selection:{anchor:a,head:a+3}})}else{s={from:d,insert:r.before+r.after},a=d+r.before.length,o.dispatch({changes:s,selection:{anchor:a}})}o.focus()}}},{}],83:[function(t,e,n){e.exports.attach=function(t){t.openImagePicker=function(e){let n=document.getElementById("PictMDE-ImageInput-".concat(e));n?(n.onchange=()=>{n.files&&n.files.length>0&&t._processImageFile(n.files[0],e),n.value=""},n.click()):t.log.warn("PICT-MarkdownEditor openImagePicker: file input not found for segment ".concat(e,"."))},t._processImageFile=function(e,n){if(!e||!e.type||!e.type.startsWith("image/"))return void t.log.warn("PICT-MarkdownEditor _processImageFile: not an image file (type: ".concat(e?e.type:"null",")."));let i=e.name?e.name.replace(/\.[^.]+$/,""):"image";if(t.onImageUpload(e,n,(e,o)=>{e?t.log.error("PICT-MarkdownEditor image upload error: ".concat(e)):o&&t._insertImageMarkdown(n,o,i)}))return;if("undefined"==typeof FileReader)return void t.log.error("PICT-MarkdownEditor _processImageFile: FileReader not available in this environment.");let o=new FileReader;o.onload=()=>{t._insertImageMarkdown(n,o.result,i)},o.onerror=()=>{t.log.error("PICT-MarkdownEditor _processImageFile: FileReader error.")},o.readAsDataURL(e)},t._insertImageMarkdown=function(e,n,i){let o=t._segmentEditors[e];if(!o)return void t.log.warn("PICT-MarkdownEditor _insertImageMarkdown: no editor for segment ".concat(e,"."));let r=".concat(n,")"),s=o.state.selection.main.head;o.dispatch({changes:{from:s,insert:r},selection:{anchor:s+r.length}}),o.focus(),t._updateImagePreviews(e)},t._updateImagePreviews=function(e){let n=document.getElementById("PictMDE-ImagePreview-".concat(e));if(!n)return;let i=t._segmentEditors[e];if(!i)return n.innerHTML="",void n.classList.remove("pict-mde-has-images");let o,r=i.state.doc.toString(),s=/!\[([^\]]*)\]\(([^)]+)\)/g,a=[];for(;null!==(o=s.exec(r));)a.push({alt:o[1]||"image",url:o[2]});if(0===a.length)return n.innerHTML="",void n.classList.remove("pict-mde-has-images");let c="";for(let e=0;e<a.length;e++){let n=a[e].alt.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,"""),i=t._resolveImageURL(a[e].url).replace(/&/g,"&").replace(/"/g,""");c+='<div class="pict-mde-image-preview-item"><img src="'.concat(i,'" alt="').concat(n,'" /><span class="pict-mde-image-preview-label">').concat(n,"</span></div>")}n.innerHTML=c,n.classList.add("pict-mde-has-images")},t._wireImageDragEvents=function(e,n){e.addEventListener("dragover",n=>{t._dragSourceIndex>=0||!n.dataTransfer||!n.dataTransfer.types||n.dataTransfer.types.indexOf("Files")<0||(n.preventDefault(),n.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 o=i.dataTransfer.files[0];o.type&&o.type.startsWith("image/")&&(i.preventDefault(),i.stopPropagation(),t._processImageFile(o,n))})}}},{}],84:[function(t,e,n){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 n=document.getElementById("PictMDE-RichPreview-".concat(e));if(!n)return;let i=t._segmentEditors[e];if(!i)return n.innerHTML="",void n.classList.remove("pict-mde-has-rich-preview");let o=i.state.doc.toString();if(!o||0===o.trim().length)return n.innerHTML="",void n.classList.remove("pict-mde-has-rich-preview");let r=t._getContentProvider().parseMarkdown(o);if(!r||0===r.trim().length)return n.innerHTML="",void n.classList.remove("pict-mde-has-rich-preview");let s="PictMDE-RichPreviewBody-".concat(e);if(n.innerHTML='<div class="pict-content" id="'.concat(s,'">').concat(r,"</div>"),n.classList.add("pict-mde-has-rich-preview"),t.options.ImageBaseURL){let e=n.querySelectorAll("img");for(let n=0;n<e.length;n++){let i=e[n].getAttribute("src");if(i){let o=t._resolveImageURL(i);o!==i&&e[n].setAttribute("src",o)}}}let a=(t._richPreviewGenerations[e]||0)+1;t._richPreviewGenerations[e]=a,t._postRenderMermaid(s,e,a),t._postRenderKaTeX(s)},t._postRenderMermaid=function(e,n,i){if("undefined"==typeof mermaid)return;let o=document.getElementById(e);if(!o)return;let r=o.querySelectorAll("pre.mermaid");if(!(r.length<1))try{let e=mermaid.run({nodes:r});e&&"function"==typeof e.catch&&e.catch(e=>{(-1===n?t._renderedViewGeneration:t._richPreviewGenerations[n])===i&&t.log.warn("PICT-MarkdownEditor mermaid render error: ".concat(e.message||e))})}catch(e){t.log.warn("PICT-MarkdownEditor mermaid render error: ".concat(e.message||e))}},t._postRenderKaTeX=function(e){if("undefined"==typeof katex)return;let n=document.getElementById(e);if(!n)return;let i=n.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: ".concat(e.message||e))}let o=n.querySelectorAll(".pict-content-katex-display");for(let e=0;e<o.length;e++)try{katex.render(o[e].textContent,o[e],{throwOnError:!1,displayMode:!0})}catch(e){t.log.warn("PICT-MarkdownEditor KaTeX display error: ".concat(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 n=t._getSegmentsFromData(),i="";if(n&&n.length>0){let t=[];for(let e=0;e<n.length;e++)t.push(n[e].Content||"");i=t.join("\n\n")}for(let e in t._segmentEditors)t._segmentEditors[e]&&t._segmentEditors[e].destroy();t._segmentEditors={};let o=t._getContentProvider().parseMarkdown(i),r="PictMDE-RenderedView";if(e.innerHTML='<div class="pict-mde-rendered-view" id="'.concat(r,'"><div class="pict-content">').concat(o||"","</div></div>"),e.classList.add("pict-mde-rendered-mode"),t.options.ImageBaseURL){let n=e.querySelectorAll(".pict-mde-rendered-view img");for(let e=0;e<n.length;e++){let i=n[e].getAttribute("src");if(i){let o=t._resolveImageURL(i);o!==i&&n[e].setAttribute("src",o)}}}t._renderedViewGeneration++;let s=t._renderedViewGeneration,a=e.querySelector("#".concat(r," .pict-content"));if(a){let e="PictMDE-RenderedViewContent";a.id=e,t._postRenderMermaid(e,-1,s),t._postRenderKaTeX(e)}},t._restoreEditingView=function(){let e=t._getContainerElement();e&&(e.classList.remove("pict-mde-rendered-mode"),t._buildEditorUI())}}},{"pict-section-content":77}],85:[function(t,e,n){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"}},{}],86:[function(t,e,n){const i=t("pict-view"),o=t("pict-section-content"),r=t("./Pict-Section-MarkdownEditor-DefaultConfiguration.js"),s=t("./Pict-MDE-Formatting.js"),a=t("./Pict-MDE-ImageHandling.js"),c=t("./Pict-MDE-DragAndReorder.js"),l=t("./Pict-MDE-RichPreview.js"),d=t("./Pict-MDE-CodeMirror.js");e.exports=class extends i{constructor(t,e,n){super(t,Object.assign({},r,e),n),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,s.attach(this),a.attach(this),c.attach(this),l.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=o.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 [".concat(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.".concat(e);return"_Pict.servicesMap.PictView['".concat(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 n=0;n<e.length;n++)this._renderSegment(t,n,e[n].Content||"");this._renderAddButton(t)}_renderSegment(t,e,n){let i=this._segmentCounter++,o={SegmentIndex:i,SegmentDisplayIndex:e+1,ViewIdentifier:this._viewCallIdentifier},r=this.pict.parseTemplateByHash("MarkdownEditor-Segment",o),s=document.createElement("div");s.innerHTML=r;let a=s.firstElementChild;if(t.appendChild(a),this._buildQuadrantButtons(a,i),this._hiddenPreviewSegments[e]&&a.classList.add("pict-mde-preview-hidden"),"tabbed"===this._previewMode&&"preview"===this._segmentTabStates[e]){a.classList.add("pict-mde-tab-showing-preview");let t=a.querySelector(".pict-mde-tab-bar");if(t){let e=t.querySelector('[data-tab="editor"]'),n=t.querySelector('[data-tab="preview"]');e&&e.classList.remove("pict-mde-tab-active"),n&&n.classList.add("pict-mde-tab-active")}}this._wireSegmentDragEvents(a,i);let c=document.getElementById("PictMDE-SegmentEditor-".concat(i));c&&(this._createEditorInContainer(c,i,n),this._wireImageDragEvents(c,i),n&&(this._updateImagePreviews(i),this._updateRichPreviews(i)))}_buildQuadrantButtons(t,e){let n=[{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 o=0;o<n.length;o++){let r=n[o],s=t.querySelector(r.selector);if(!s)continue;let a=this.options[r.key];if(Array.isArray(a))for(let t=0;t<a.length;t++){let n=a[t],o=document.createElement("button");o.type="button",o.className=r.baseClass,n.Class&&(o.className+=" "+n.Class),o.innerHTML=n.HTML||"",o.title=n.Title||"";let c=n.Action||"",l=c,d=null,p=c.indexOf(":");p>=0&&(l=c.substring(0,p),d=c.substring(p+1)),function(t,e,n){o.addEventListener("click",()=>{"function"==typeof i[t]?null!==e?i[t](n,e):i[t](n):i.log.warn('PICT-MarkdownEditor _buildQuadrantButtons: method "'.concat(t,'" not found.'))})}(l,d,e),s.appendChild(o)}}}customConfigureExtensions(t,e){return t}_renderAddButton(t){let e={ViewIdentifier:this._viewCallIdentifier},n=this.pict.parseTemplateByHash("MarkdownEditor-AddSegment",e),i=document.createElement("div");i.innerHTML=n;let o=i.firstElementChild;t.appendChild(o)}onImageUpload(t,e,n){return!1}toggleControls(t,e){let n=e;"boolean"==typeof t&&(n=t),this._controlsVisible="boolean"==typeof n?n:!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 "'.concat(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"],n=(e.indexOf(this._previewMode)+1)%e.length;this.setPreviewMode(e[n])}switchSegmentTab(t,e){let n=this._getLogicalIndex(t);if(n<0)return;this._segmentTabStates[n]=e;let i=document.getElementById("PictMDE-Segment-".concat(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 o=document.getElementById("PictMDE-TabBar-".concat(t));if(o){let t=o.querySelectorAll(".pict-mde-tab");for(let n=0;n<t.length;n++)t[n].getAttribute("data-tab")===e?t[n].classList.add("pict-mde-tab-active"):t[n].classList.remove("pict-mde-tab-active")}}toggleSegmentPreview(t,e){let n=this._getLogicalIndex(t);if(n<0)return;let i=!!this._hiddenPreviewSegments[n];i="boolean"==typeof e?!e:!i,i?this._hiddenPreviewSegments[n]=!0:delete this._hiddenPreviewSegments[n];let o=document.getElementById("PictMDE-Segment-".concat(t));o&&(i?o.classList.add("pict-mde-preview-hidden"):(o.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 n=this._getLogicalIndex(t);if(n<0)return;let i=this._getSegmentsFromData();if(!i)return;n<i.length&&(i[n].Content=e),this.onContentChange(n,e);let o=this;this._imagePreviewTimers[t]&&clearTimeout(this._imagePreviewTimers[t]),this._imagePreviewTimers[t]=setTimeout(()=>{o._updateImagePreviews(t),delete o._imagePreviewTimers[t]},500),this._richPreviewTimers[t]&&clearTimeout(this._richPreviewTimers[t]),this._richPreviewTimers[t]=setTimeout(()=>{o._updateRichPreviews(t),delete o._richPreviewTimers[t]},500)}onContentChange(t,e){}_getLogicalIndex(t){let e=this._getContainerElement();if(!e)return-1;let n=e.querySelectorAll(".pict-mde-segment");for(let e=0;e<n.length;e++){if(parseInt(n[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"),n=[];for(let t=0;t<e.length;t++)n.push(parseInt(e[t].getAttribute("data-segment-index"),10));return n}addSegment(t){let e="string"==typeof t?t:"",n=this._getSegmentsFromData();n||(n=[]),n.push({Content:e}),this._setSegmentsToData(n),this._buildEditorUI()}removeSegment(t){let e=this._getLogicalIndex(t);if(e<0)return void this.log.warn("PICT-MarkdownEditor removeSegment: segment index ".concat(t," not found."));let n=this._getSegmentsFromData();if(!n||n.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]),n.splice(e,1),this._setSegmentsToData(n);let i={};for(let t in this._hiddenPreviewSegments){let n=parseInt(t,10);n<e?i[n]=!0:n>e&&(i[n-1]=!0)}this._hiddenPreviewSegments=i;let o={};for(let t in this._segmentTabStates){let n=parseInt(t,10);n<e?o[n]=this._segmentTabStates[t]:n>e&&(o[n-1]=this._segmentTabStates[t])}this._segmentTabStates=o,this._buildEditorUI()}moveSegmentUp(t){let e=this._getLogicalIndex(t);if(e<=0)return;this._marshalAllEditorsToData();let n=this._getSegmentsFromData();if(!n)return;let i=n[e];n[e]=n[e-1],n[e-1]=i,this._swapHiddenPreviewState(e,e-1),this._swapSegmentTabStates(e,e-1),this._buildEditorUI()}moveSegmentDown(t){let e=this._getLogicalIndex(t),n=this._getSegmentsFromData();if(!n||e<0||e>=n.length-1)return;this._marshalAllEditorsToData();let i=n[e];n[e]=n[e+1],n[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 n=e[t],i=this._segmentEditors[n];return i?i.state.doc.toString():""}setSegmentContent(t,e){let n=this._getOrderedSegmentIndices();if(t<0||t>=n.length)return void this.log.warn("PICT-MarkdownEditor setSegmentContent: index ".concat(t," out of range."));let i=n[t],o=this._segmentEditors[i];o&&o.dispatch({changes:{from:0,to:o.state.doc.length,insert:e}})}getSegmentCount(){return this._getOrderedSegmentIndices().length}getAllContent(t){let e="string"==typeof t?t:"\n\n",n=this._getOrderedSegmentIndices(),i=[];for(let t=0;t<n.length;t++){let e=this._segmentEditors[n[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 n=0;n<e.length;n++){let i=this._segmentEditors[e[n]];i&&n<t.length&&(t[n].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=r},{"./Pict-MDE-CodeMirror.js":80,"./Pict-MDE-DragAndReorder.js":81,"./Pict-MDE-Formatting.js":82,"./Pict-MDE-ImageHandling.js":83,"./Pict-MDE-RichPreview.js":84,"./Pict-Section-MarkdownEditor-DefaultConfiguration.js":85,"pict-section-content":77,"pict-view":88}],87:[function(t,e,n){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"}}},{}],88:[function(t,e,n){const i=t("fable-serviceproviderbase"),o=t("../package.json"),r={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,n){super(t,Object.assign({},JSON.parse(JSON.stringify(r)),e),n),this.fable,this.options,this.UUID,this.Hash,this.log;const i=this.Hash===this.UUID;this.UUID="V-".concat(this.UUID),i&&(this.Hash=this.UUID),this.options.ViewIdentifier||(this.options.ViewIdentifier="AutoViewID-".concat(this.fable.getUUID())),this.serviceType="PictView",this._Package=o,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 [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," options object.")),this.pict.TemplateProvider.addTemplate(e.Hash,e.Template,e.Source)):this.log.error("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," could not load Template ").concat(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 [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," options object.")),this.pict.TemplateProvider.addDefaultTemplate(e.Prefix,e.Postfix,e.Template,e.Source)):this.log.error("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," could not load Default Template ").concat(t," in the options array."),e)}if(this.options.CSS){let t=this.options.CSSHash?this.options.CSSHash:"View-".concat(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,n,i,o){let r;if("object"==typeof t)r=t;else{r={RenderableHash:t,TemplateHash:e,DefaultTemplateRecordAddress:n,ContentDestinationAddress:i,RenderMethod:"string"!=typeof o?o:"replace"}}"string"!=typeof r.RenderableHash||"string"!=typeof r.TemplateHash?this.log.error("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," could not load Renderable; RenderableHash or TemplateHash are invalid."),r):(this.pict.LogNoisiness>0&&this.log.trace("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," adding renderable [").concat(r.RenderableHash,"] pointed to template ").concat(r.TemplateHash,".")),this.renderables[r.RenderableHash]=r)}onBeforeInitialize(){return this.pict.LogNoisiness>3&&this.log.trace("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," onBeforeInitialize:")),!0}onBeforeInitializeAsync(t){return this.onBeforeInitialize(),t()}onInitialize(){return this.pict.LogNoisiness>3&&this.log.trace("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," onInitialize:")),!0}onInitializeAsync(t){return this.onInitialize(),t()}initialize(){return this.pict.LogControlFlow&&this.log.trace("PICT-ControlFlow VIEW [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," initialize:")),this.initializeTimestamp?(this.log.warn("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(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 [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," initializeAsync:")),this.initializeTimestamp)return this.log.warn("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(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 [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(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 [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," initialization failed: ").concat(e.message||e),{stack:e.stack}),this.initializeTimestamp=this.pict.log.getTimeStamp(),this.pict.LogNoisiness>0&&this.log.info("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," initialization complete.")),t()))}}onAfterInitialize(){return this.pict.LogNoisiness>3&&this.log.trace("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," onAfterInitialize:")),!0}onAfterInitializeAsync(t){return this.onAfterInitialize(),t()}onBeforeRender(t){return this.pict.LogNoisiness>3&&this.log.trace("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," onBeforeRender:")),!0}onBeforeRenderAsync(t,e){return this.onBeforeRender(e),t()}onBeforeProject(t){return this.pict.LogNoisiness>3&&this.log.trace("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," onBeforeProject:")),!0}onBeforeProjectAsync(t,e){return this.onBeforeProject(e),t()}buildRenderOptions(t,e,n){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 [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," could not find a suitable RenderableHash ").concat(i.RenderableHash," (param ").concat(t,"because it is not a valid renderable.")),i.Valid=!1),i.Renderable=this.renderables[i.RenderableHash],i.Renderable||(this.log.error("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," could not render ").concat(i.RenderableHash," (param ").concat(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 [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," could not render ").concat(i.RenderableHash," (param ").concat(t,") because it does not have a valid destination address (param ").concat(e,").")),i.Valid=!1),"object"==typeof n?(i.RecordAddress="Passed in as object",i.Record=n):(i.RecordAddress="string"==typeof n?n:"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,n){return this.pict.ContentAssignment.projectContent(t.RenderMethod,e,n,t.TestAddress)}render(t,e,n,i){return this.renderWithScope(this,t,e,n,i)}renderWithScope(t,e,n,i,o){let r,s,a,c="string"==typeof e?e:"string"==typeof this.options.DefaultRenderable&&this.options.DefaultRenderable;return c?("__Virtual"==c?r={RenderableHash:"__Virtual",TemplateHash:this.renderables[this.options.DefaultRenderable].TemplateHash,ContentDestinationAddress:"string"==typeof n?n:"string"==typeof r.ContentDestinationAddress?r.ContentDestinationAddress:"string"==typeof this.options.DefaultDestinationAddress?this.options.DefaultDestinationAddress:null,RenderMethod:"virtual-assignment",TransactionHash:o&&o.TransactionHash,RootRenderableViewHash:o&&o.RootRenderableViewHash}:(r=Object.assign({},this.renderables[c]),r.ContentDestinationAddress="string"==typeof n?n:"string"==typeof r.ContentDestinationAddress?r.ContentDestinationAddress:"string"==typeof this.options.DefaultDestinationAddress?this.options.DefaultDestinationAddress:null),r.TransactionHash||(r.TransactionHash="ViewRender-V-".concat(this.options.ViewIdentifier,"-R-").concat(c,"-U-").concat(this.pict.getUUID()),r.RootRenderableViewHash=this.Hash,this.pict.TransactionTracking.registerTransaction(r.TransactionHash)),r?r.ContentDestinationAddress?("object"==typeof i?(a=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,a="string"==typeof s?this.pict.DataProvider.getDataByAddress(s):void 0),this.onBeforeRender(r),this.pict.LogControlFlow&&this.log.trace("PICT-ControlFlow VIEW [".concat(this.UUID,"]::[").concat(this.Hash,"] Renderable[").concat(c,"] Destination[").concat(r.ContentDestinationAddress,"] TemplateRecordAddress[").concat(s,"] render:")),this.pict.LogNoisiness>0&&this.log.trace("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," Beginning Render of Renderable[").concat(c,"] to Destination [").concat(r.ContentDestinationAddress,"]...")),r.Content=this.pict.parseTemplateByHash(r.TemplateHash,a,null,[this],t,{RootRenderable:"object"==typeof o?o:r}),this.pict.LogNoisiness>0&&this.log.trace("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," Assigning Renderable[").concat(c,"] content length ").concat(r.Content.length," to Destination [").concat(r.ContentDestinationAddress,"] using render method [").concat(r.RenderMethod,"].")),this.onBeforeProject(r),this.onProject(r),"virtual-assignment"!==r.RenderMethod&&(this.onAfterProject(r),this.onAfterRender(r)),!0):(this.log.error("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," could not render ").concat(c," (param ").concat(e,") because it does not have a valid destination address.")),!1):(this.log.error("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," could not render ").concat(c," (param ").concat(e,") because it does not exist.")),!1)):(this.log.error("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," could not render ").concat(c," (param ").concat(e,") because it is not a valid renderable.")),!1)}renderAsync(t,e,n,i,o){return this.renderWithScopeAsync(this,t,e,n,i,o)}renderWithScopeAsync(t,e,n,i,o,r){let s,a,c,l="string"==typeof e?e:"string"==typeof this.options.DefaultRenderable&&this.options.DefaultRenderable,d="function"==typeof r?r:"function"==typeof i?i:"function"==typeof n?n:"function"==typeof e?e:"function"==typeof o?o:null;if(d||(this.log.warn("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(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 [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.Name," renderAsync Auto Callback Error: ").concat(t),t)}),!l)return this.log.error("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," could not asynchronously render ").concat(l," (param ").concat(e,"because it is not a valid renderable.")),d(new Error("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," could not asynchronously render ").concat(l," (param ").concat(e,"because it is not a valid renderable.")));if("__Virtual"==l?s={RenderableHash:"__Virtual",TemplateHash:this.renderables[this.options.DefaultRenderable].TemplateHash,ContentDestinationAddress:"string"==typeof n?n:"string"==typeof this.options.DefaultDestinationAddress?this.options.DefaultDestinationAddress:null,RenderMethod:"virtual-assignment",TransactionHash:o&&"function"!=typeof o&&o.TransactionHash,RootRenderableViewHash:o&&"function"!=typeof o&&o.RootRenderableViewHash}:(s=Object.assign({},this.renderables[l]),s.ContentDestinationAddress="string"==typeof n?n:"string"==typeof s.ContentDestinationAddress?s.ContentDestinationAddress:"string"==typeof this.options.DefaultDestinationAddress?this.options.DefaultDestinationAddress:null),s.TransactionHash||(s.TransactionHash="ViewRender-V-".concat(this.options.ViewIdentifier,"-R-").concat(l,"-U-").concat(this.pict.getUUID()),s.RootRenderableViewHash=this.Hash,this.pict.TransactionTracking.registerTransaction(s.TransactionHash)),!s)return this.log.error("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," could not render ").concat(l," (param ").concat(e,") because it does not exist.")),d(new Error("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," could not render ").concat(l," (param ").concat(e,") because it does not exist.")));if(!s.ContentDestinationAddress)return this.log.error("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," could not render ").concat(l," (param ").concat(e,") because it does not have a valid destination address.")),d(new Error("Could not render ".concat(l)));"object"==typeof i?(c=i,a="Passed in as object"):(a="string"==typeof i?i:"string"==typeof s.DefaultTemplateRecordAddress?s.DefaultTemplateRecordAddress:"string"==typeof this.options.DefaultTemplateRecordAddress&&this.options.DefaultTemplateRecordAddress,c="string"==typeof a?this.pict.DataProvider.getDataByAddress(a):void 0),this.pict.LogControlFlow&&this.log.trace("PICT-ControlFlow VIEW [".concat(this.UUID,"]::[").concat(this.Hash,"] Renderable[").concat(l,"] Destination[").concat(s.ContentDestinationAddress,"] TemplateRecordAddress[").concat(a,"] renderAsync:")),this.pict.LogNoisiness>2&&this.log.trace("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," Beginning Asynchronous Render (callback-style)..."));let p=this.fable.newAnticipate();p.anticipate(t=>{this.onBeforeRenderAsync(t,s)}),p.anticipate(n=>{this.pict.parseTemplateByHash(s.TemplateHash,c,(t,i)=>t?(this.log.error("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," could not render (asynchronously) ").concat(l," (param ").concat(e,") because it did not parse the template."),t),n(t)):(s.Content=i,n()),[this],t,{RootRenderable:"object"==typeof o?o:s})}),p.anticipate(t=>{this.onBeforeProjectAsync(t,s)}),p.anticipate(t=>{this.onProjectAsync(t,s)}),"virtual-assignment"!==s.RenderMethod&&(p.anticipate(t=>{this.onAfterProjectAsync(t,s)}),p.anticipate(t=>{this.onAfterRenderAsync(t,s)})),p.wait(d)}renderDefaultAsync(t){this.renderAsync(t)}basicRender(t,e,n){return this.basicRenderWithScope(this,t,e,n)}basicRenderWithScope(t,e,n,i){let o=this.buildRenderOptions(e,n,i);return o.Valid?(this.assignRenderContent(o.Renderable,o.DestinationAddress,this.pict.parseTemplateByHash(o.Renderable.TemplateHash,o.Record,null,[this],t,{RootRenderable:o.Renderable})),!0):(this.log.error("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," could not perform a basic render of ").concat(o.RenderableHash," because it is not valid.")),!1)}basicRenderAsync(t,e,n,i){return this.basicRenderWithScopeAsync(this,t,e,n,i)}basicRenderWithScopeAsync(t,e,n,i,o){let r="function"==typeof o?o:"function"==typeof i?i:"function"==typeof n?n:"function"==typeof e?e:null;r||(this.log.warn("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.Name," basicRenderAsync was called without a valid callback. A callback will be generated but this could lead to race conditions.")),r=t=>{t&&this.log.error("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.Name," basicRenderAsync Auto Callback Error: ").concat(t),t)});const s=this.buildRenderOptions(e,n,i);if(!s.Valid){let t="PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," could not perform a basic render of ").concat(s.RenderableHash," because it is not valid.");return this.log.error(t),r(new Error(t))}this.pict.parseTemplateByHash(s.Renderable.TemplateHash,s.Record,(t,e)=>t?(this.log.error("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," could not render (asynchronously) ").concat(s.RenderableHash," because it did not parse the template."),t),r(t)):(this.assignRenderContent(s.Renderable,s.DestinationAddress,e),r()),[this],t,{RootRenderable:s.Renderable})}onProject(t){this.pict.LogNoisiness>3&&this.log.trace("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(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 [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," Assigning Renderable[").concat(t.RenderableHash,"] content length ").concat(t.Content.length," to Destination [").concat(t.ContentDestinationAddress,"] using Async render method ").concat(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 [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," onAfterRender:")),t&&t.RootRenderableViewHash===this.Hash){const e=this.pict.TransactionTracking.clearTransactionQueue(t.TransactionHash)||[];for(const n of e){const e=this.pict.views[n.Data.ViewHash];e?(e.onAfterProject(),e.onAfterRender(n.Data.Renderable)):this.log.error("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," onAfterRender: Could not find view for transaction hash ").concat(t.TransactionHash," and ViewHash ").concat(n.Data.ViewHash,"."))}this.pict.TransactionTracking.unregisterTransaction(t.TransactionHash)}return!0}onAfterRenderAsync(t,e){this.onAfterRender(e);const n=this.fable.newAnticipate(),i=e&&e.RootRenderableViewHash===this.Hash;if(i){const t=this.pict.TransactionTracking.clearTransactionQueue(e.TransactionHash)||[];for(const i of t){const t=this.pict.views[i.Data.ViewHash];t?(n.anticipate(t.onAfterProjectAsync.bind(t)),n.anticipate(e=>{t.onAfterRenderAsync(e,i.Data.Renderable)})):this.log.error("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," onAfterRenderAsync: Could not find view for transaction hash ").concat(e.TransactionHash," and ViewHash ").concat(i.Data.ViewHash,"."))}}return n.wait(n=>(i&&e&&e.TransactionHash&&this.pict.TransactionTracking.unregisterTransaction(e.TransactionHash),t(n)))}onAfterProject(t){return this.pict.LogNoisiness>3&&this.log.trace("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," onAfterProject:")),!0}onAfterProjectAsync(t,e){return t()}onBeforeSolve(){return this.pict.LogNoisiness>3&&this.log.trace("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," onBeforeSolve:")),!0}onBeforeSolveAsync(t){return this.onBeforeSolve(),t()}onSolve(){return this.pict.LogNoisiness>3&&this.log.trace("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," onSolve:")),!0}onSolveAsync(t){return this.onSolve(),t()}solve(){return this.pict.LogNoisiness>2&&this.log.trace("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(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"),n="function"==typeof t?t:null;n||(this.log.warn("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.Name," solveAsync was called without a valid callback. A callback will be generated but this could lead to race conditions.")),n=t=>{t&&this.log.error("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.Name," solveAsync Auto Callback Error: ").concat(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 [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," solveAsync() complete.")),this.lastSolvedTimestamp=this.pict.log.getTimeStamp(),n(t)))}onAfterSolve(){return this.pict.LogNoisiness>3&&this.log.trace("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," onAfterSolve:")),!0}onAfterSolveAsync(t){return this.onAfterSolve(),t()}onBeforeMarshalFromView(){return this.pict.LogNoisiness>3&&this.log.trace("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," onBeforeMarshalFromView:")),!0}onBeforeMarshalFromViewAsync(t){return this.onBeforeMarshalFromView(),t()}onMarshalFromView(){return this.pict.LogNoisiness>3&&this.log.trace("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," onMarshalFromView:")),!0}onMarshalFromViewAsync(t){return this.onMarshalFromView(),t()}marshalFromView(){return this.pict.LogNoisiness>2&&this.log.trace("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(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"),n="function"==typeof t?t:null;n||(this.log.warn("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.Name," marshalFromViewAsync was called without a valid callback. A callback will be generated but this could lead to race conditions.")),n=t=>{t&&this.log.error("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.Name," marshalFromViewAsync Auto Callback Error: ").concat(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 [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," marshalFromViewAsync() complete.")),this.lastMarshalFromViewTimestamp=this.pict.log.getTimeStamp(),n(t)))}onAfterMarshalFromView(){return this.pict.LogNoisiness>3&&this.log.trace("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," onAfterMarshalFromView:")),!0}onAfterMarshalFromViewAsync(t){return this.onAfterMarshalFromView(),t()}onBeforeMarshalToView(){return this.pict.LogNoisiness>3&&this.log.trace("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," onBeforeMarshalToView:")),!0}onBeforeMarshalToViewAsync(t){return this.onBeforeMarshalToView(),t()}onMarshalToView(){return this.pict.LogNoisiness>3&&this.log.trace("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," onMarshalToView:")),!0}onMarshalToViewAsync(t){return this.onMarshalToView(),t()}marshalToView(){return this.pict.LogNoisiness>2&&this.log.trace("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(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"),n="function"==typeof t?t:null;n||(this.log.warn("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.Name," marshalToViewAsync was called without a valid callback. A callback will be generated but this could lead to race conditions.")),n=t=>{t&&this.log.error("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.Name," marshalToViewAsync Auto Callback Error: ").concat(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 [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," marshalToViewAsync() complete.")),this.lastMarshalToViewTimestamp=this.pict.log.getTimeStamp(),n(t)))}onAfterMarshalToView(){return this.pict.LogNoisiness>3&&this.log.trace("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," onAfterMarshalToView:")),!0}onAfterMarshalToViewAsync(t){return this.onAfterMarshalToView(),t()}get isPictView(){return!0}}},{"../package.json":87,"fable-serviceproviderbase":20}],89:[function(t,e,n){var i,o,r=e.exports={};function s(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function c(t){if(i===setTimeout)return setTimeout(t,0);if((i===s||!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:s}catch(t){i=s}try{o="function"==typeof clearTimeout?clearTimeout:a}catch(t){o=a}}();var l,d=[],p=!1,h=-1;function u(){p&&l&&(p=!1,l.length?d=l.concat(d):h=-1,d.length&&f())}function f(){if(!p){var t=c(u);p=!0;for(var e=d.length;e;){for(l=d,d=[];++h<e;)l&&l[h].run();h=-1,e=d.length}l=null,p=!1,function(t){if(o===clearTimeout)return clearTimeout(t);if((o===a||!o)&&clearTimeout)return o=clearTimeout,clearTimeout(t);try{return o(t)}catch(e){try{return o.call(null,t)}catch(e){return o.call(this,t)}}}(t)}}function g(t,e){this.fun=t,this.array=e}function m(){}r.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];d.push(new g(t,e)),1!==d.length||p||c(f)},g.prototype.run=function(){this.fun.apply(null,this.array)},r.title="browser",r.browser=!0,r.env={},r.argv=[],r.version="",r.versions={},r.on=m,r.addListener=m,r.once=m,r.off=m,r.removeListener=m,r.removeAllListeners=m,r.emit=m,r.prependListener=m,r.prependOnceListener=m,r.listeners=function(t){return[]},r.binding=function(t){throw new Error("process.binding is not supported")},r.cwd=function(){return"/"},r.chdir=function(t){throw new Error("process.chdir is not supported")},r.umask=function(){return 0}},{}],90:[function(t,e,n){(function(t){(function(){!function(i){var o="object"==typeof n&&n&&!n.nodeType&&n,r="object"==typeof e&&e&&!e.nodeType&&e,s="object"==typeof t&&t;s.global!==s&&s.window!==s&&s.self!==s||(i=s);var a,c,l=2147483647,d=36,p=/^xn--/,h=/[^\x20-\x7E]/,u=/[\x2E\u3002\uFF0E\uFF61]/g,f={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},g=Math.floor,m=String.fromCharCode;function v(t){throw new RangeError(f[t])}function b(t,e){for(var n=t.length,i=[];n--;)i[n]=e(t[n]);return i}function w(t,e){var n=t.split("@"),i="";return n.length>1&&(i=n[0]+"@",t=n[1]),i+b((t=t.replace(u,".")).split("."),e).join(".")}function y(t){for(var e,n,i=[],o=0,r=t.length;o<r;)(e=t.charCodeAt(o++))>=55296&&e<=56319&&o<r?56320==(64512&(n=t.charCodeAt(o++)))?i.push(((1023&e)<<10)+(1023&n)+65536):(i.push(e),o--):i.push(e);return i}function C(t){return b(t,function(t){var e="";return t>65535&&(e+=m((t-=65536)>>>10&1023|55296),t=56320|1023&t),e+=m(t)}).join("")}function x(t){return t-48<10?t-22:t-65<26?t-65:t-97<26?t-97:d}function A(t,e){return t+22+75*(t<26)-((0!=e)<<5)}function D(t,e,n){var i=0;for(t=n?g(t/700):t>>1,t+=g(t/e);t>455;i+=d)t=g(t/35);return g(i+36*t/(t+38))}function E(t){var e,n,i,o,r,s,a,c,p,h,u=[],f=t.length,m=0,b=128,w=72;for((n=t.lastIndexOf("-"))<0&&(n=0),i=0;i<n;++i)t.charCodeAt(i)>=128&&v("not-basic"),u.push(t.charCodeAt(i));for(o=n>0?n+1:0;o<f;){for(r=m,s=1,a=d;o>=f&&v("invalid-input"),((c=x(t.charCodeAt(o++)))>=d||c>g((l-m)/s))&&v("overflow"),m+=c*s,!(c<(p=a<=w?1:a>=w+26?26:a-w));a+=d)s>g(l/(h=d-p))&&v("overflow"),s*=h;w=D(m-r,e=u.length+1,0==r),g(m/e)>l-b&&v("overflow"),b+=g(m/e),m%=e,u.splice(m++,0,b)}return C(u)}function S(t){var e,n,i,o,r,s,a,c,p,h,u,f,b,w,C,x=[];for(f=(t=y(t)).length,e=128,n=0,r=72,s=0;s<f;++s)(u=t[s])<128&&x.push(m(u));for(i=o=x.length,o&&x.push("-");i<f;){for(a=l,s=0;s<f;++s)(u=t[s])>=e&&u<a&&(a=u);for(a-e>g((l-n)/(b=i+1))&&v("overflow"),n+=(a-e)*b,e=a,s=0;s<f;++s)if((u=t[s])<e&&++n>l&&v("overflow"),u==e){for(c=n,p=d;!(c<(h=p<=r?1:p>=r+26?26:p-r));p+=d)C=c-h,w=d-h,x.push(m(A(h+C%w,0))),c=g(C/w);x.push(m(A(c,0))),r=D(n,b,i==o),n=0,++i}++n,++e}return x.join("")}if(a={version:"1.4.1",ucs2:{decode:y,encode:C},decode:E,encode:S,toASCII:function(t){return w(t,function(t){return h.test(t)?"xn--"+S(t):t})},toUnicode:function(t){return w(t,function(t){return p.test(t)?E(t.slice(4).toLowerCase()):t})}},o&&r)if(e.exports==o)r.exports=a;else for(c in a)a.hasOwnProperty(c)&&(o[c]=a[c]);else i.punycode=a}(this)}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],91:[function(t,e,n){var i=String.prototype.replace,o=/%20/g,r="RFC1738",s="RFC3986";e.exports={default:s,formatters:{RFC1738:function(t){return i.call(t,o,"+")},RFC3986:function(t){return String(t)}},RFC1738:r,RFC3986:s}},{}],92:[function(t,e,n){var i=t("./stringify"),o=t("./parse"),r=t("./formats");e.exports={formats:r,parse:o,stringify:i}},{"./formats":91,"./parse":93,"./stringify":94}],93:[function(t,e,n){var i=t("./utils"),o=Object.prototype.hasOwnProperty,r=Array.isArray,s={allowDots:!1,allowEmptyArrays:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decodeDotInKeys:!1,decoder:i.decode,delimiter:"&",depth:5,duplicates:"combine",ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictDepth:!1,strictMerge:!0,strictNullHandling:!1,throwOnLimitExceeded:!1},a=function(t){return t.replace(/&#(\d+);/g,function(t,e){return String.fromCharCode(parseInt(e,10))})},c=function(t,e,n){if(t&&"string"==typeof t&&e.comma&&t.indexOf(",")>-1)return t.split(",");if(e.throwOnLimitExceeded&&n>=e.arrayLimit)throw new RangeError("Array limit exceeded. Only "+e.arrayLimit+" element"+(1===e.arrayLimit?"":"s")+" allowed in an array.");return t},l=function(t,e,n,r){if(t){var s=function(t,e){var n=e.allowDots?t.replace(/\.([^.[]+)/g,"[$1]"):t;if(e.depth<=0){if(!e.plainObjects&&o.call(Object.prototype,n)&&!e.allowPrototypes)return;return[n]}var i=/(\[[^[\]]*])/g,r=/(\[[^[\]]*])/.exec(n),s=r?n.slice(0,r.index):n,a=[];if(s){if(!e.plainObjects&&o.call(Object.prototype,s)&&!e.allowPrototypes)return;a[a.length]=s}for(var c=0;null!==(r=i.exec(n))&&c<e.depth;){c+=1;var l=r[1].slice(1,-1);if(!e.plainObjects&&o.call(Object.prototype,l)&&!e.allowPrototypes)return;a[a.length]=r[1]}if(r){if(!0===e.strictDepth)throw new RangeError("Input depth exceeded depth option of "+e.depth+" and strictDepth is true");a[a.length]="["+n.slice(r.index)+"]"}return a}(t,n);if(s)return function(t,e,n,o){var r=0;if(t.length>0&&"[]"===t[t.length-1]){var s=t.slice(0,-1).join("");r=Array.isArray(e)&&e[s]?e[s].length:0}for(var a=o?e:c(e,n,r),l=t.length-1;l>=0;--l){var d,p=t[l];if("[]"===p&&n.parseArrays)d=i.isOverflow(a)?a:n.allowEmptyArrays&&(""===a||n.strictNullHandling&&null===a)?[]:i.combine([],a,n.arrayLimit,n.plainObjects);else{d=n.plainObjects?{__proto__:null}:{};var h="["===p.charAt(0)&&"]"===p.charAt(p.length-1)?p.slice(1,-1):p,u=n.decodeDotInKeys?h.replace(/%2E/g,"."):h,f=parseInt(u,10),g=!isNaN(f)&&p!==u&&String(f)===u&&f>=0&&n.parseArrays;if(n.parseArrays||""!==u)if(g&&f<n.arrayLimit)(d=[])[f]=a;else{if(g&&n.throwOnLimitExceeded)throw new RangeError("Array limit exceeded. Only "+n.arrayLimit+" element"+(1===n.arrayLimit?"":"s")+" allowed in an array.");g?(d[f]=a,i.markOverflow(d,f)):"__proto__"!==u&&(d[u]=a)}else d={0:a}}a=d}return a}(s,e,n,r)}};e.exports=function(t,e){var n=function(t){if(!t)return s;if(void 0!==t.allowEmptyArrays&&"boolean"!=typeof t.allowEmptyArrays)throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(void 0!==t.decodeDotInKeys&&"boolean"!=typeof t.decodeDotInKeys)throw new TypeError("`decodeDotInKeys` option can only be `true` or `false`, when provided");if(null!==t.decoder&&void 0!==t.decoder&&"function"!=typeof t.decoder)throw new TypeError("Decoder has to be a function.");if(void 0!==t.charset&&"utf-8"!==t.charset&&"iso-8859-1"!==t.charset)throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");if(void 0!==t.throwOnLimitExceeded&&"boolean"!=typeof t.throwOnLimitExceeded)throw new TypeError("`throwOnLimitExceeded` option must be a boolean");var e=void 0===t.charset?s.charset:t.charset,n=void 0===t.duplicates?s.duplicates:t.duplicates;if("combine"!==n&&"first"!==n&&"last"!==n)throw new TypeError("The duplicates option must be either combine, first, or last");return{allowDots:void 0===t.allowDots?!0===t.decodeDotInKeys||s.allowDots:!!t.allowDots,allowEmptyArrays:"boolean"==typeof t.allowEmptyArrays?!!t.allowEmptyArrays:s.allowEmptyArrays,allowPrototypes:"boolean"==typeof t.allowPrototypes?t.allowPrototypes:s.allowPrototypes,allowSparse:"boolean"==typeof t.allowSparse?t.allowSparse:s.allowSparse,arrayLimit:"number"==typeof t.arrayLimit?t.arrayLimit:s.arrayLimit,charset:e,charsetSentinel:"boolean"==typeof t.charsetSentinel?t.charsetSentinel:s.charsetSentinel,comma:"boolean"==typeof t.comma?t.comma:s.comma,decodeDotInKeys:"boolean"==typeof t.decodeDotInKeys?t.decodeDotInKeys:s.decodeDotInKeys,decoder:"function"==typeof t.decoder?t.decoder:s.decoder,delimiter:"string"==typeof t.delimiter||i.isRegExp(t.delimiter)?t.delimiter:s.delimiter,depth:"number"==typeof t.depth||!1===t.depth?+t.depth:s.depth,duplicates:n,ignoreQueryPrefix:!0===t.ignoreQueryPrefix,interpretNumericEntities:"boolean"==typeof t.interpretNumericEntities?t.interpretNumericEntities:s.interpretNumericEntities,parameterLimit:"number"==typeof t.parameterLimit?t.parameterLimit:s.parameterLimit,parseArrays:!1!==t.parseArrays,plainObjects:"boolean"==typeof t.plainObjects?t.plainObjects:s.plainObjects,strictDepth:"boolean"==typeof t.strictDepth?!!t.strictDepth:s.strictDepth,strictMerge:"boolean"==typeof t.strictMerge?!!t.strictMerge:s.strictMerge,strictNullHandling:"boolean"==typeof t.strictNullHandling?t.strictNullHandling:s.strictNullHandling,throwOnLimitExceeded:"boolean"==typeof t.throwOnLimitExceeded&&t.throwOnLimitExceeded}}(e);if(""===t||null==t)return n.plainObjects?{__proto__:null}:{};for(var d="string"==typeof t?function(t,e){var n={__proto__:null},l=e.ignoreQueryPrefix?t.replace(/^\?/,""):t;l=l.replace(/%5B/gi,"[").replace(/%5D/gi,"]");var d=e.parameterLimit===1/0?void 0:e.parameterLimit,p=l.split(e.delimiter,e.throwOnLimitExceeded?d+1:d);if(e.throwOnLimitExceeded&&p.length>d)throw new RangeError("Parameter limit exceeded. Only "+d+" parameter"+(1===d?"":"s")+" allowed.");var h,u=-1,f=e.charset;if(e.charsetSentinel)for(h=0;h<p.length;++h)0===p[h].indexOf("utf8=")&&("utf8=%E2%9C%93"===p[h]?f="utf-8":"utf8=%26%2310003%3B"===p[h]&&(f="iso-8859-1"),u=h,h=p.length);for(h=0;h<p.length;++h)if(h!==u){var g,m,v=p[h],b=v.indexOf("]="),w=-1===b?v.indexOf("="):b+1;if(-1===w?(g=e.decoder(v,s.decoder,f,"key"),m=e.strictNullHandling?null:""):null!==(g=e.decoder(v.slice(0,w),s.decoder,f,"key"))&&(m=i.maybeMap(c(v.slice(w+1),e,r(n[g])?n[g].length:0),function(t){return e.decoder(t,s.decoder,f,"value")})),m&&e.interpretNumericEntities&&"iso-8859-1"===f&&(m=a(String(m))),v.indexOf("[]=")>-1&&(m=r(m)?[m]:m),e.comma&&r(m)&&m.length>e.arrayLimit){if(e.throwOnLimitExceeded)throw new RangeError("Array limit exceeded. Only "+e.arrayLimit+" element"+(1===e.arrayLimit?"":"s")+" allowed in an array.");m=i.combine([],m,e.arrayLimit,e.plainObjects)}if(null!==g){var y=o.call(n,g);y&&("combine"===e.duplicates||v.indexOf("[]=")>-1)?n[g]=i.combine(n[g],m,e.arrayLimit,e.plainObjects):y&&"last"!==e.duplicates||(n[g]=m)}}return n}(t,n):t,p=n.plainObjects?{__proto__:null}:{},h=Object.keys(d),u=0;u<h.length;++u){var f=h[u],g=l(f,d[f],n,"string"==typeof t);p=i.merge(p,g,n)}return!0===n.allowSparse?p:i.compact(p)}},{"./utils":95}],94:[function(t,e,n){var i=t("side-channel"),o=t("./utils"),r=t("./formats"),s=Object.prototype.hasOwnProperty,a={brackets:function(t){return t+"[]"},comma:"comma",indices:function(t,e){return t+"["+e+"]"},repeat:function(t){return t}},c=Array.isArray,l=Array.prototype.push,d=function(t,e){l.apply(t,c(e)?e:[e])},p=Date.prototype.toISOString,h=r.default,u={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,commaRoundTrip:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:o.encode,encodeValuesOnly:!1,filter:void 0,format:h,formatter:r.formatters[h],indices:!1,serializeDate:function(t){return p.call(t)},skipNulls:!1,strictNullHandling:!1},f={},g=function t(e,n,r,s,a,l,p,h,g,m,v,b,w,y,C,x,A,D){for(var E,S=e,P=D,T=0,k=!1;void 0!==(P=P.get(f))&&!k;){var F=P.get(e);if(T+=1,void 0!==F){if(F===T)throw new RangeError("Cyclic object value");k=!0}void 0===P.get(f)&&(T=0)}if("function"==typeof m?S=m(n,S):S instanceof Date?S=w(S):"comma"===r&&c(S)&&(S=o.maybeMap(S,function(t){return t instanceof Date?w(t):t})),null===S){if(l)return g&&!x?g(n,u.encoder,A,"key",y):n;S=""}if("string"==typeof(E=S)||"number"==typeof E||"boolean"==typeof E||"symbol"==typeof E||"bigint"==typeof E||o.isBuffer(S))return g?[C(x?n:g(n,u.encoder,A,"key",y))+"="+C(g(S,u.encoder,A,"value",y))]:[C(n)+"="+C(String(S))];var I,L=[];if(void 0===S)return L;if("comma"===r&&c(S))x&&g&&(S=o.maybeMap(S,g)),I=[{value:S.length>0?S.join(",")||null:void 0}];else if(c(m))I=m;else{var M=Object.keys(S);I=v?M.sort(v):M}var R=h?String(n).replace(/\./g,"%2E"):String(n),_=s&&c(S)&&1===S.length?R+"[]":R;if(a&&c(S)&&0===S.length)return _+"[]";for(var B=0;B<I.length;++B){var H=I[B],V="object"==typeof H&&H&&void 0!==H.value?H.value:S[H];if(!p||null!==V){var j=b&&h?String(H).replace(/\./g,"%2E"):String(H),N=c(S)?"function"==typeof r?r(_,j):_:_+(b?"."+j:"["+j+"]");D.set(e,T);var O=i();O.set(f,D),d(L,t(V,N,r,s,a,l,p,h,"comma"===r&&x&&c(S)?null:g,m,v,b,w,y,C,x,A,O))}}return L};e.exports=function(t,e){var n,o=t,l=function(t){if(!t)return u;if(void 0!==t.allowEmptyArrays&&"boolean"!=typeof t.allowEmptyArrays)throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(void 0!==t.encodeDotInKeys&&"boolean"!=typeof t.encodeDotInKeys)throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(null!==t.encoder&&void 0!==t.encoder&&"function"!=typeof t.encoder)throw new TypeError("Encoder has to be a function.");var e=t.charset||u.charset;if(void 0!==t.charset&&"utf-8"!==t.charset&&"iso-8859-1"!==t.charset)throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var n=r.default;if(void 0!==t.format){if(!s.call(r.formatters,t.format))throw new TypeError("Unknown format option provided.");n=t.format}var i,o=r.formatters[n],l=u.filter;if(("function"==typeof t.filter||c(t.filter))&&(l=t.filter),i=t.arrayFormat in a?t.arrayFormat:"indices"in t?t.indices?"indices":"repeat":u.arrayFormat,"commaRoundTrip"in t&&"boolean"!=typeof t.commaRoundTrip)throw new TypeError("`commaRoundTrip` must be a boolean, or absent");var d=void 0===t.allowDots?!0===t.encodeDotInKeys||u.allowDots:!!t.allowDots;return{addQueryPrefix:"boolean"==typeof t.addQueryPrefix?t.addQueryPrefix:u.addQueryPrefix,allowDots:d,allowEmptyArrays:"boolean"==typeof t.allowEmptyArrays?!!t.allowEmptyArrays:u.allowEmptyArrays,arrayFormat:i,charset:e,charsetSentinel:"boolean"==typeof t.charsetSentinel?t.charsetSentinel:u.charsetSentinel,commaRoundTrip:!!t.commaRoundTrip,delimiter:void 0===t.delimiter?u.delimiter:t.delimiter,encode:"boolean"==typeof t.encode?t.encode:u.encode,encodeDotInKeys:"boolean"==typeof t.encodeDotInKeys?t.encodeDotInKeys:u.encodeDotInKeys,encoder:"function"==typeof t.encoder?t.encoder:u.encoder,encodeValuesOnly:"boolean"==typeof t.encodeValuesOnly?t.encodeValuesOnly:u.encodeValuesOnly,filter:l,format:n,formatter:o,serializeDate:"function"==typeof t.serializeDate?t.serializeDate:u.serializeDate,skipNulls:"boolean"==typeof t.skipNulls?t.skipNulls:u.skipNulls,sort:"function"==typeof t.sort?t.sort:null,strictNullHandling:"boolean"==typeof t.strictNullHandling?t.strictNullHandling:u.strictNullHandling}}(e);"function"==typeof l.filter?o=(0,l.filter)("",o):c(l.filter)&&(n=l.filter);var p=[];if("object"!=typeof o||null===o)return"";var h=a[l.arrayFormat],f="comma"===h&&l.commaRoundTrip;n||(n=Object.keys(o)),l.sort&&n.sort(l.sort);for(var m=i(),v=0;v<n.length;++v){var b=n[v],w=o[b];l.skipNulls&&null===w||d(p,g(w,b,h,f,l.allowEmptyArrays,l.strictNullHandling,l.skipNulls,l.encodeDotInKeys,l.encode?l.encoder:null,l.filter,l.sort,l.allowDots,l.serializeDate,l.format,l.formatter,l.encodeValuesOnly,l.charset,m))}var y=p.join(l.delimiter),C=!0===l.addQueryPrefix?"?":"";return l.charsetSentinel&&("iso-8859-1"===l.charset?C+="utf8=%26%2310003%3B&":C+="utf8=%E2%9C%93&"),y.length>0?C+y:""}},{"./formats":91,"./utils":95,"side-channel":99}],95:[function(t,e,n){var i=t("./formats"),o=t("side-channel"),r=Object.prototype.hasOwnProperty,s=Array.isArray,a=o(),c=function(t,e){return a.set(t,e),t},l=function(t){return a.has(t)},d=function(t){return a.get(t)},p=function(t,e){a.set(t,e)},h=function(){for(var t=[],e=0;e<256;++e)t[t.length]="%"+((e<16?"0":"")+e.toString(16)).toUpperCase();return t}(),u=function(t,e){for(var n=e&&e.plainObjects?{__proto__:null}:{},i=0;i<t.length;++i)void 0!==t[i]&&(n[i]=t[i]);return n},f=1024;e.exports={arrayToObject:u,assign:function(t,e){return Object.keys(e).reduce(function(t,n){return t[n]=e[n],t},t)},combine:function(t,e,n,i){if(l(t)){var o=d(t)+1;return t[o]=e,p(t,o),t}var r=[].concat(t,e);return r.length>n?c(u(r,{plainObjects:i}),r.length-1):r},compact:function(t){for(var e=[{obj:{o:t},prop:"o"}],n=[],i=0;i<e.length;++i)for(var o=e[i],r=o.obj[o.prop],a=Object.keys(r),c=0;c<a.length;++c){var l=a[c],d=r[l];"object"==typeof d&&null!==d&&-1===n.indexOf(d)&&(e[e.length]={obj:r,prop:l},n[n.length]=d)}return function(t){for(;t.length>1;){var e=t.pop(),n=e.obj[e.prop];if(s(n)){for(var i=[],o=0;o<n.length;++o)void 0!==n[o]&&(i[i.length]=n[o]);e.obj[e.prop]=i}}}(e),t},decode:function(t,e,n){var i=t.replace(/\+/g," ");if("iso-8859-1"===n)return i.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(i)}catch(t){return i}},encode:function(t,e,n,o,r){if(0===t.length)return t;var s=t;if("symbol"==typeof t?s=Symbol.prototype.toString.call(t):"string"!=typeof t&&(s=String(t)),"iso-8859-1"===n)return escape(s).replace(/%u[0-9a-f]{4}/gi,function(t){return"%26%23"+parseInt(t.slice(2),16)+"%3B"});for(var a="",c=0;c<s.length;c+=f){for(var l=s.length>=f?s.slice(c,c+f):s,d=[],p=0;p<l.length;++p){var u=l.charCodeAt(p);45===u||46===u||95===u||126===u||u>=48&&u<=57||u>=65&&u<=90||u>=97&&u<=122||r===i.RFC1738&&(40===u||41===u)?d[d.length]=l.charAt(p):u<128?d[d.length]=h[u]:u<2048?d[d.length]=h[192|u>>6]+h[128|63&u]:u<55296||u>=57344?d[d.length]=h[224|u>>12]+h[128|u>>6&63]+h[128|63&u]:(p+=1,u=65536+((1023&u)<<10|1023&l.charCodeAt(p)),d[d.length]=h[240|u>>18]+h[128|u>>12&63]+h[128|u>>6&63]+h[128|63&u])}a+=d.join("")}return a},isBuffer:function(t){return!(!t||"object"!=typeof t)&&!!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t))},isOverflow:l,isRegExp:function(t){return"[object RegExp]"===Object.prototype.toString.call(t)},markOverflow:c,maybeMap:function(t,e){if(s(t)){for(var n=[],i=0;i<t.length;i+=1)n[n.length]=e(t[i]);return n}return e(t)},merge:function t(e,n,i){if(!n)return e;if("object"!=typeof n&&"function"!=typeof n){if(s(e)){var o=e.length;if(i&&"number"==typeof i.arrayLimit&&o>i.arrayLimit)return c(u(e.concat(n),i),o);e[o]=n}else{if(!e||"object"!=typeof e)return[e,n];if(l(e)){var a=d(e)+1;e[a]=n,p(e,a)}else{if(i&&i.strictMerge)return[e,n];(i&&(i.plainObjects||i.allowPrototypes)||!r.call(Object.prototype,n))&&(e[n]=!0)}}return e}if(!e||"object"!=typeof e){if(l(n)){for(var h=Object.keys(n),f=i&&i.plainObjects?{__proto__:null,0:e}:{0:e},g=0;g<h.length;g++){f[parseInt(h[g],10)+1]=n[h[g]]}return c(f,d(n)+1)}var m=[e].concat(n);return i&&"number"==typeof i.arrayLimit&&m.length>i.arrayLimit?c(u(m,i),m.length-1):m}var v=e;return s(e)&&!s(n)&&(v=u(e,i)),s(e)&&s(n)?(n.forEach(function(n,o){if(r.call(e,o)){var s=e[o];s&&"object"==typeof s&&n&&"object"==typeof n?e[o]=t(s,n,i):e[e.length]=n}else e[o]=n}),e):Object.keys(n).reduce(function(e,o){var s=n[o];if(r.call(e,o)?e[o]=t(e[o],s,i):e[o]=s,l(n)&&!l(e)&&c(e,d(n)),l(e)){var a=parseInt(o,10);String(a)===o&&a>=0&&a>d(e)&&p(e,a)}return e},v)}}},{"./formats":91,"side-channel":99}],96:[function(t,e,n){var i=t("object-inspect"),o=t("es-errors/type"),r=function(t,e,n){for(var i,o=t;null!=(i=o.next);o=i)if(i.key===e)return o.next=i.next,n||(i.next=t.next,t.next=i),i};e.exports=function(){var t,e={assert:function(t){if(!e.has(t))throw new o("Side channel does not contain "+i(t))},delete:function(e){var n=t&&t.next,i=function(t,e){if(t)return r(t,e,!0)}(t,e);return i&&n&&n===i&&(t=void 0),!!i},get:function(e){return function(t,e){if(t){var n=r(t,e);return n&&n.value}}(t,e)},has:function(e){return function(t,e){return!!t&&!!r(t,e)}(t,e)},set:function(e,n){t||(t={next:void 0}),function(t,e,n){var i=r(t,e);i?i.value=n:t.next={key:e,next:t.next,value:n}}(t,e,n)}};return e}},{"es-errors/type":16,"object-inspect":41}],97:[function(t,e,n){var i=t("get-intrinsic"),o=t("call-bound"),r=t("object-inspect"),s=t("es-errors/type"),a=i("%Map%",!0),c=o("Map.prototype.get",!0),l=o("Map.prototype.set",!0),d=o("Map.prototype.has",!0),p=o("Map.prototype.delete",!0),h=o("Map.prototype.size",!0);e.exports=!!a&&function(){var t,e={assert:function(t){if(!e.has(t))throw new s("Side channel does not contain "+r(t))},delete:function(e){if(t){var n=p(t,e);return 0===h(t)&&(t=void 0),n}return!1},get:function(e){if(t)return c(t,e)},has:function(e){return!!t&&d(t,e)},set:function(e,n){t||(t=new a),l(t,e,n)}};return e}},{"call-bound":8,"es-errors/type":16,"get-intrinsic":23,"object-inspect":41}],98:[function(t,e,n){var i=t("get-intrinsic"),o=t("call-bound"),r=t("object-inspect"),s=t("side-channel-map"),a=t("es-errors/type"),c=i("%WeakMap%",!0),l=o("WeakMap.prototype.get",!0),d=o("WeakMap.prototype.set",!0),p=o("WeakMap.prototype.has",!0),h=o("WeakMap.prototype.delete",!0);e.exports=c?function(){var t,e,n={assert:function(t){if(!n.has(t))throw new a("Side channel does not contain "+r(t))},delete:function(n){if(c&&n&&("object"==typeof n||"function"==typeof n)){if(t)return h(t,n)}else if(s&&e)return e.delete(n);return!1},get:function(n){return c&&n&&("object"==typeof n||"function"==typeof n)&&t?l(t,n):e&&e.get(n)},has:function(n){return c&&n&&("object"==typeof n||"function"==typeof n)&&t?p(t,n):!!e&&e.has(n)},set:function(n,i){c&&n&&("object"==typeof n||"function"==typeof n)?(t||(t=new c),d(t,n,i)):s&&(e||(e=s()),e.set(n,i))}};return n}:s},{"call-bound":8,"es-errors/type":16,"get-intrinsic":23,"object-inspect":41,"side-channel-map":97}],99:[function(t,e,n){var i=t("es-errors/type"),o=t("object-inspect"),r=t("side-channel-list"),s=t("side-channel-map"),a=t("side-channel-weakmap")||s||r;e.exports=function(){var t,e={assert:function(t){if(!e.has(t))throw new i("Side channel does not contain "+o(t))},delete:function(e){return!!t&&t.delete(e)},get:function(e){return t&&t.get(e)},has:function(e){return!!t&&t.has(e)},set:function(e,n){t||(t=a()),t.set(e,n)}};return e}},{"es-errors/type":16,"object-inspect":41,"side-channel-list":96,"side-channel-map":97,"side-channel-weakmap":98}],100:[function(t,e,n){var i=t("punycode/");function o(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}var r=/^([a-z0-9.+-]+:)/i,s=/:[0-9]*$/,a=/^(\/\/?(?!\/)[^?\s]*)(\?[^\s]*)?$/,c=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r","\n","\t"]),l=["'"].concat(c),d=["%","/","?",";","#"].concat(l),p=["/","?","#"],h=/^[+a-z0-9A-Z_-]{0,63}$/,u=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,f={javascript:!0,"javascript:":!0},g={javascript:!0,"javascript:":!0},m={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},v=t("qs");function b(t,e,n){if(t&&"object"==typeof t&&t instanceof o)return t;var i=new o;return i.parse(t,e,n),i}o.prototype.parse=function(t,e,n){if("string"!=typeof t)throw new TypeError("Parameter 'url' must be a string, not "+typeof t);var o=t.indexOf("?"),s=-1!==o&&o<t.indexOf("#")?"?":"#",c=t.split(s);c[0]=c[0].replace(/\\/g,"/");var b=t=c.join(s);if(b=b.trim(),!n&&1===t.split("#").length){var w=a.exec(b);if(w)return this.path=b,this.href=b,this.pathname=w[1],w[2]?(this.search=w[2],this.query=e?v.parse(this.search.substr(1)):this.search.substr(1)):e&&(this.search="",this.query={}),this}var y=r.exec(b);if(y){var C=(y=y[0]).toLowerCase();this.protocol=C,b=b.substr(y.length)}if(n||y||b.match(/^\/\/[^@/]+@[^@/]+/)){var x="//"===b.substr(0,2);!x||y&&g[y]||(b=b.substr(2),this.slashes=!0)}if(!g[y]&&(x||y&&!m[y])){for(var A,D,E=-1,S=0;S<p.length;S++){-1!==(P=b.indexOf(p[S]))&&(-1===E||P<E)&&(E=P)}-1!==(D=-1===E?b.lastIndexOf("@"):b.lastIndexOf("@",E))&&(A=b.slice(0,D),b=b.slice(D+1),this.auth=decodeURIComponent(A)),E=-1;for(S=0;S<d.length;S++){var P;-1!==(P=b.indexOf(d[S]))&&(-1===E||P<E)&&(E=P)}-1===E&&(E=b.length),this.host=b.slice(0,E),b=b.slice(E),this.parseHost(),this.hostname=this.hostname||"";var T="["===this.hostname[0]&&"]"===this.hostname[this.hostname.length-1];if(!T)for(var k=this.hostname.split(/\./),F=(S=0,k.length);S<F;S++){var I=k[S];if(I&&!I.match(h)){for(var L="",M=0,R=I.length;M<R;M++)I.charCodeAt(M)>127?L+="x":L+=I[M];if(!L.match(h)){var _=k.slice(0,S),B=k.slice(S+1),H=I.match(u);H&&(_.push(H[1]),B.unshift(H[2])),B.length&&(b="/"+B.join(".")+b),this.hostname=_.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),T||(this.hostname=i.toASCII(this.hostname));var V=this.port?":"+this.port:"",j=this.hostname||"";this.host=j+V,this.href+=this.host,T&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==b[0]&&(b="/"+b))}if(!f[C])for(S=0,F=l.length;S<F;S++){var N=l[S];if(-1!==b.indexOf(N)){var O=encodeURIComponent(N);O===N&&(O=escape(N)),b=b.split(N).join(O)}}var U=b.indexOf("#");-1!==U&&(this.hash=b.substr(U),b=b.slice(0,U));var z=b.indexOf("?");if(-1!==z?(this.search=b.substr(z),this.query=b.substr(z+1),e&&(this.query=v.parse(this.query)),b=b.slice(0,z)):e&&(this.search="",this.query={}),b&&(this.pathname=b),m[C]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){V=this.pathname||"";var W=this.search||"";this.path=V+W}return this.href=this.format(),this},o.prototype.format=function(){var t=this.auth||"";t&&(t=(t=encodeURIComponent(t)).replace(/%3A/i,":"),t+="@");var e=this.protocol||"",n=this.pathname||"",i=this.hash||"",o=!1,r="";this.host?o=t+this.host:this.hostname&&(o=t+(-1===this.hostname.indexOf(":")?this.hostname:"["+this.hostname+"]"),this.port&&(o+=":"+this.port)),this.query&&"object"==typeof this.query&&Object.keys(this.query).length&&(r=v.stringify(this.query,{arrayFormat:"repeat",addQueryPrefix:!1}));var s=this.search||r&&"?"+r||"";return e&&":"!==e.substr(-1)&&(e+=":"),this.slashes||(!e||m[e])&&!1!==o?(o="//"+(o||""),n&&"/"!==n.charAt(0)&&(n="/"+n)):o||(o=""),i&&"#"!==i.charAt(0)&&(i="#"+i),s&&"?"!==s.charAt(0)&&(s="?"+s),e+o+(n=n.replace(/[?#]/g,function(t){return encodeURIComponent(t)}))+(s=s.replace("#","%23"))+i},o.prototype.resolve=function(t){return this.resolveObject(b(t,!1,!0)).format()},o.prototype.resolveObject=function(t){if("string"==typeof t){var e=new o;e.parse(t,!1,!0),t=e}for(var n=new o,i=Object.keys(this),r=0;r<i.length;r++){var s=i[r];n[s]=this[s]}if(n.hash=t.hash,""===t.href)return n.href=n.format(),n;if(t.slashes&&!t.protocol){for(var a=Object.keys(t),c=0;c<a.length;c++){var l=a[c];"protocol"!==l&&(n[l]=t[l])}return m[n.protocol]&&n.hostname&&!n.pathname&&(n.pathname="/",n.path=n.pathname),n.href=n.format(),n}if(t.protocol&&t.protocol!==n.protocol){if(!m[t.protocol]){for(var d=Object.keys(t),p=0;p<d.length;p++){var h=d[p];n[h]=t[h]}return n.href=n.format(),n}if(n.protocol=t.protocol,t.host||g[t.protocol])n.pathname=t.pathname;else{for(var u=(t.pathname||"").split("/");u.length&&!(t.host=u.shift()););t.host||(t.host=""),t.hostname||(t.hostname=""),""!==u[0]&&u.unshift(""),u.length<2&&u.unshift(""),n.pathname=u.join("/")}if(n.search=t.search,n.query=t.query,n.host=t.host||"",n.auth=t.auth,n.hostname=t.hostname||t.host,n.port=t.port,n.pathname||n.search){var f=n.pathname||"",v=n.search||"";n.path=f+v}return n.slashes=n.slashes||t.slashes,n.href=n.format(),n}var b=n.pathname&&"/"===n.pathname.charAt(0),w=t.host||t.pathname&&"/"===t.pathname.charAt(0),y=w||b||n.host&&t.pathname,C=y,x=n.pathname&&n.pathname.split("/")||[],A=(u=t.pathname&&t.pathname.split("/")||[],n.protocol&&!m[n.protocol]);if(A&&(n.hostname="",n.port=null,n.host&&(""===x[0]?x[0]=n.host:x.unshift(n.host)),n.host="",t.protocol&&(t.hostname=null,t.port=null,t.host&&(""===u[0]?u[0]=t.host:u.unshift(t.host)),t.host=null),y=y&&(""===u[0]||""===x[0])),w)n.host=t.host||""===t.host?t.host:n.host,n.hostname=t.hostname||""===t.hostname?t.hostname:n.hostname,n.search=t.search,n.query=t.query,x=u;else if(u.length)x||(x=[]),x.pop(),x=x.concat(u),n.search=t.search,n.query=t.query;else if(null!=t.search){if(A)n.host=x.shift(),n.hostname=n.host,(T=!!(n.host&&n.host.indexOf("@")>0)&&n.host.split("@"))&&(n.auth=T.shift(),n.hostname=T.shift(),n.host=n.hostname);return n.search=t.search,n.query=t.query,null===n.pathname&&null===n.search||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.href=n.format(),n}if(!x.length)return n.pathname=null,n.search?n.path="/"+n.search:n.path=null,n.href=n.format(),n;for(var D=x.slice(-1)[0],E=(n.host||t.host||x.length>1)&&("."===D||".."===D)||""===D,S=0,P=x.length;P>=0;P--)"."===(D=x[P])?x.splice(P,1):".."===D?(x.splice(P,1),S++):S&&(x.splice(P,1),S--);if(!y&&!C)for(;S--;S)x.unshift("..");!y||""===x[0]||x[0]&&"/"===x[0].charAt(0)||x.unshift(""),E&&"/"!==x.join("/").substr(-1)&&x.push("");var T,k=""===x[0]||x[0]&&"/"===x[0].charAt(0);A&&(n.hostname=k?"":x.length?x.shift():"",n.host=n.hostname,(T=!!(n.host&&n.host.indexOf("@")>0)&&n.host.split("@"))&&(n.auth=T.shift(),n.hostname=T.shift(),n.host=n.hostname));return(y=y||n.host&&x.length)&&!k&&x.unshift(""),x.length>0?n.pathname=x.join("/"):(n.pathname=null,n.path=null),null===n.pathname&&null===n.search||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.auth=t.auth||n.auth,n.slashes=n.slashes||t.slashes,n.href=n.format(),n},o.prototype.parseHost=function(){var t=this.host,e=s.exec(t);e&&(":"!==(e=e[0])&&(this.port=e.substr(1)),t=t.substr(0,t.length-e.length)),t&&(this.hostname=t)},n.parse=b,n.resolve=function(t,e){return b(t,!1,!0).resolve(e)},n.resolveObject=function(t,e){return t?b(t,!1,!0).resolveObject(e):e},n.format=function(t){return"string"==typeof t&&(t=b(t)),t instanceof o?t.format():o.prototype.format.call(t)},n.Url=o},{"punycode/":90,qs:92}],101:[function(t,e,n){e.exports={Name:"Retold Content Editor",Hash:"ContentEditor",MainViewportViewIdentifier:"ContentEditor-Layout",AutoSolveAfterInitialize:!0,AutoRenderMainViewportViewAfterInitialize:!1,AutoRenderViewsAfterInitialize:!1,pict_configuration:{Product:"ContentEditor-Pict-Application"}}},{}],102:[function(t,e,n){const i=t("pict-application"),o=t("pict-section-filebrowser"),r=t("./providers/Pict-Provider-ContentEditor.js"),s=t("./views/PictView-Editor-Layout.js"),a=t("./views/PictView-Editor-TopBar.js"),c=t("./views/PictView-Editor-MarkdownEditor.js"),l=t("./views/PictView-Editor-CodeEditor.js"),d=t("./views/PictView-Editor-SettingsPanel.js"),p=t("./views/PictView-Editor-MarkdownReference.js"),h=t("./views/PictView-Editor-Topics.js");e.exports=class extends i{constructor(t,e,n){super(t,e,n),this.pict.addProvider("ContentEditor-Provider",r.default_configuration,r),this.pict.addView("ContentEditor-Layout",s.default_configuration,s),this.pict.addView("ContentEditor-TopBar",a.default_configuration,a),this.pict.addView("ContentEditor-MarkdownEditor",c.default_configuration,c),this.pict.addView("ContentEditor-CodeEditor",l.default_configuration,l),this.pict.addView("ContentEditor-SettingsPanel",d.default_configuration,d),this.pict.addView("ContentEditor-MarkdownReference",p.default_configuration,p),this.pict.addView("ContentEditor-Topics",h.default_configuration,h);let i=JSON.parse(JSON.stringify(o.default_configuration));i.DefaultDestinationAddress="#ContentEditor-Sidebar-Container",i.DefaultState.Layout="list-only",this.pict.addView("Pict-FileBrowser",i,o);let u=JSON.parse(JSON.stringify(o.PictViewListDetail.default_configuration));for(let t=0;t<u.Templates.length;t++)"FileBrowser-ListDetail-Container-Template"===u.Templates[t].Hash&&(u.Templates[t].Template='\n<div class="pict-fb-detail" id="Pict-FileBrowser-DetailList">\n\t<div class="pict-fb-breadcrumb-bar">\n\t\t<div class="pict-fb-breadcrumb" id="Pict-FileBrowser-Breadcrumb"></div>\n\t\t<button class="pict-fb-breadcrumb-addfolder" onclick="pict.PictApplication.promptNewFolder()" title="New folder">+</button>\n\t</div>\n\t<div class="pict-fb-detail-header">\n\t\t<div class="pict-fb-detail-header-cell pict-fb-detail-col-name" onclick="pict.views[\'{~D:Record.ViewHash~}\'].sortBy(\'Name\')">Name</div>\n\t\t<div class="pict-fb-detail-header-cell pict-fb-detail-col-size" onclick="pict.views[\'{~D:Record.ViewHash~}\'].sortBy(\'Size\')">Size</div>\n\t\t<div class="pict-fb-detail-header-cell pict-fb-detail-col-modified" onclick="pict.views[\'{~D:Record.ViewHash~}\'].sortBy(\'Modified\')">Modified</div>\n\t</div>\n\t<div id="Pict-FileBrowser-DetailRows"></div>\n</div>\n'),"FileBrowser-ListDetail-Row-Template"===u.Templates[t].Hash&&(u.Templates[t].Template='\n<div class="pict-fb-detail-row{~D:Record.SelectedClass~}" data-index="{~D:Record.Index~}" data-name="{~D:Record.Name~}" onclick="{~D:Record.ClickHandler~}" ondblclick="{~D:Record.DblClickHandler~}">\n\t<span class="pict-fb-detail-icon">{~D:Record.Icon~}</span>\n\t<span class="pict-fb-detail-name">{~D:Record.Name~}</span>\n\t<span class="pict-fb-detail-size">{~D:Record.SizeFormatted~}</span>\n\t<span class="pict-fb-detail-modified">{~D:Record.ModifiedFormatted~}</span>\n\t<button class="pict-fb-insert-btn" onclick="event.stopPropagation(); pict.PictApplication.insertFileReference(this.parentElement.getAttribute(\'data-name\'))" title="Insert into editor">+</button>\n</div>\n');this.pict.addView("Pict-FileBrowser-ListDetail",u,o.PictViewListDetail)}onAfterInitializeAsync(t){"undefined"!=typeof window&&(window.pict=this.pict),this.pict.AppData.ContentEditor={CurrentFile:"",ActiveEditor:"markdown",IsDirty:!1,IsSaving:!1,IsLoading:!1,Files:[],Document:{Segments:[{Content:""}]},CodeContent:"",SaveStatus:"",SaveStatusClass:"",AutoSegmentMarkdown:!1,AutoSegmentDepth:1,ContentPreviewMode:"off",MarkdownEditingControls:!0,MarkdownWordWrap:!0,CodeWordWrap:!1,SidebarCollapsed:!1,SidebarWidth:250,AutoPreviewImages:!0,AutoPreviewVideo:!1,AutoPreviewAudio:!1,ShowHiddenFiles:!1,TopicsFilePath:".pict_documentation_topics.json"},this._loadSettings(),this.pict.views["ContentEditor-Layout"].render();let e=this,n=this.pict.providers["Pict-FileBrowser-List"];if(n){let t=n.selectFile.bind(n);n.selectFile=function(n){t(n),n&&"file"===n.Type&&e.navigateToFile(n.Path)}}let i=this.pict.providers["Pict-FileBrowser-Browse"];if(i){let t=i.navigateToFolder.bind(i);i.navigateToFolder=function(n){t(n),e.loadFileList(n)}}this.syncHiddenFilesSetting(()=>{e.loadFileList(null,()=>{e.resolveHash()})});let o=this.pict.AppData.ContentEditor.TopicsFilePath;if(o){let t=this.pict.views["ContentEditor-Topics"];t&&t.loadTopicsFile(o,()=>{})}return super.onAfterInitializeAsync(t)}syncHiddenFilesSetting(t){let e="function"==typeof t?t:()=>{},n=this.pict.AppData.ContentEditor.ShowHiddenFiles;fetch("/api/filebrowser/settings",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({IncludeHiddenFiles:!!n})}).then(()=>e()).catch(()=>e())}loadFileList(t,e){let n="function"==typeof e?e:"function"==typeof t?t:()=>{},i=this,o="string"==typeof t?t:null;null===o&&this.pict.AppData.PictFileBrowser&&this.pict.AppData.PictFileBrowser.CurrentLocation&&(o=this.pict.AppData.PictFileBrowser.CurrentLocation);let r="/api/filebrowser/list";o&&o.length>0&&(r+="?path="+encodeURIComponent(o)),fetch(r).then(t=>t.json()).then(t=>{i.pict.AppData.PictFileBrowser=i.pict.AppData.PictFileBrowser||{},i.pict.AppData.PictFileBrowser.FileList=t||[];let e=i.pict.views["Pict-FileBrowser"];e&&e.render();let o=i.pict.views["Pict-FileBrowser-ListDetail"];return o&&o.render(),n()}).catch(t=>(i.log.error("Failed to load file list: ".concat(t.message)),n()))}resolveHash(){let t=(window.location.hash||"").replace(/^#\/?/,"");if(!t)return;let e=t.split("/");if("edit"===e[0]&&e.length>=2){let t=e.slice(1).join("/");if(this.pict.AppData.ContentEditor.CurrentFile===t)return;this.navigateToFile(t)}}getEditorTypeForFile(t){if(!t)return"markdown";let e=t.replace(/^.*\./,"").toLowerCase();if("md"===e||"markdown"===e)return"markdown";return{png:!0,jpg:!0,jpeg:!0,gif:!0,bmp:!0,webp:!0,ico:!0,svg:!0,tiff:!0,tif:!0,avif:!0,heic:!0,heif:!0,mp3:!0,wav:!0,ogg:!0,flac:!0,aac:!0,m4a:!0,wma:!0,mp4:!0,avi:!0,mkv:!0,mov:!0,wmv:!0,webm:!0,flv:!0,m4v:!0,pdf:!0,doc:!0,docx:!0,xls:!0,xlsx:!0,ppt:!0,pptx:!0,odt:!0,ods:!0,odp:!0,zip:!0,tar:!0,gz:!0,bz2:!0,xz:!0,"7z":!0,rar:!0,ttf:!0,otf:!0,woff:!0,woff2:!0,eot:!0,exe:!0,dll:!0,so:!0,dylib:!0,o:!0,class:!0,pyc:!0,wasm:!0}[e]?"binary":"code"}_cleanupEditors(){let t=this.pict.views["ContentEditor-CodeEditor"];t&&(t.codeJar&&t.destroy(),t.initialRenderComplete=!1);let e=this.pict.ContentAssignment.getElement("#ContentEditor-Editor-Container");e&&e[0]&&(e[0].innerHTML="")}_formatFileSize(t){if(0===t)return"0 B";let e=["B","KB","MB","GB","TB"],n=Math.floor(Math.log(t)/Math.log(1024));return n>=e.length&&(n=e.length-1),(t/Math.pow(1024,n)).toFixed(0===n?0:1)+" "+e[n]}_getMediaType(t){return{png:!0,jpg:!0,jpeg:!0,gif:!0,webp:!0,svg:!0,bmp:!0,ico:!0,avif:!0}[t]?"image":{mp4:!0,webm:!0,mov:!0,mkv:!0,avi:!0,wmv:!0,flv:!0,m4v:!0,ogv:!0}[t]?"video":{mp3:!0,wav:!0,ogg:!0,flac:!0,aac:!0,m4a:!0,wma:!0,oga:!0}[t]?"audio":"other"}_buildMediaPreviewHTML(t,e,n){return"image"===t?'<div class="binary-preview-image-wrap"><div class="binary-preview-image"><img src="'+e+'" alt="'+n+'"></div></div>':"video"===t?'<div class="binary-preview-media-wrap"><video class="binary-preview-video" controls preload="metadata"><source src="'+e+'">Your browser does not support the video tag.</video></div>':"audio"===t?'<div class="binary-preview-media-wrap"><audio class="binary-preview-audio" controls preload="metadata"><source src="'+e+'">Your browser does not support the audio tag.</audio></div>':""}loadMediaPreview(t,e,n){let i=document.getElementById("ContentEditor-MediaPreviewPlaceholder");i&&(i.innerHTML=this._buildMediaPreviewHTML(t,e,n))}_showBinaryPreview(t){let e=this,n=t.replace(/^.*\//,""),i=t.replace(/^.*\./,"").toLowerCase(),o="/content/"+encodeURIComponent(t),r=this._getMediaType(i),s=this.pict.AppData.ContentEditor,a=!1;"image"===r&&(a=s.AutoPreviewImages),"video"===r&&(a=s.AutoPreviewVideo),"audio"===r&&(a=s.AutoPreviewAudio),fetch("/api/filebrowser/info?path="+encodeURIComponent(t)).then(t=>t.json()).then(t=>{let s=t&&"number"==typeof t.Size?e._formatFileSize(t.Size):"Unknown",c=t&&t.Modified?new Date(t.Modified).toLocaleString():"Unknown",l=e.pict.ContentAssignment.getElement("#ContentEditor-Editor-Container");if(!l||!l[0])return;let d="";"other"!==r&&(a?d+=e._buildMediaPreviewHTML(r,o,n):(d+='<div id="ContentEditor-MediaPreviewPlaceholder">',d+='<button class="binary-preview-btn binary-preview-btn-preview"',d+=' onclick="pict.PictApplication.loadMediaPreview(',d+="'"+r+"','"+o+"','"+n.replace(/'/g,"\\'")+"'",d+=')">Preview '+r.charAt(0).toUpperCase()+r.slice(1)+"</button>",d+="</div>")),d+='<div class="binary-preview-card">',d+='<div class="binary-preview-icon">'+i.toUpperCase()+"</div>",d+='<div class="binary-preview-info">',d+='<div class="binary-preview-name">'+n+"</div>",d+='<div class="binary-preview-meta">Size: '+s+"</div>",d+='<div class="binary-preview-meta">Modified: '+c+"</div>",d+='<div class="binary-preview-meta">Type: .'+i+"</div>",d+="</div>",d+='<div class="binary-preview-actions">',d+='<a class="binary-preview-btn" href="'+o+'" download="'+n+'">Download</a>',d+='<a class="binary-preview-btn binary-preview-btn-secondary" href="'+o+'" target="_blank">Open in New Tab</a>',d+="</div>",d+="</div>",l[0].innerHTML=d}).catch(()=>{let t=e.pict.ContentAssignment.getElement("#ContentEditor-Editor-Container");t&&t[0]&&(t[0].innerHTML='<div class="binary-preview-card"><div class="binary-preview-icon">'+i.toUpperCase()+'</div><div class="binary-preview-info"><div class="binary-preview-name">'+n+'</div><div class="binary-preview-meta">Binary file — cannot be edited in the browser</div></div><div class="binary-preview-actions"><a class="binary-preview-btn" href="'+o+'" download="'+n+'">Download</a><a class="binary-preview-btn binary-preview-btn-secondary" href="'+o+'" target="_blank">Open in New Tab</a></div></div>')})}segmentMarkdownContent(t){let e=this.pict.AppData.ContentEditor;if(!e.AutoSegmentMarkdown||!t)return[{Content:t||""}];let n=parseInt(e.AutoSegmentDepth,10)||1;if(1===n){let e=t.split("\n"),n=[],i=[],o=!1;for(let t=0;t<e.length;t++){let r=e[t];/^(`{3,}|~{3,})/.test(r.trim())?(o=!o,i.push(r)):o||""!==r.trim()?i.push(r):i.length>0&&(n.push({Content:i.join("\n")}),i=[])}return i.length>0&&n.push({Content:i.join("\n")}),n.length>0?n:[{Content:""}]}let i=new RegExp("^(#{1,"+n+"})\\s"),o=t.split("\n"),r=[],s=[];for(let t=0;t<o.length;t++){let e=o[t];i.test(e.trim())&&s.length>0&&(r.push({Content:s.join("\n")}),s=[]),s.push(e)}return s.length>0&&r.push({Content:s.join("\n")}),r.length>0?r:[{Content:""}]}navigateToFile(t){if(!t)return;let e=this,n=this.getEditorTypeForFile(t);if(this.pict.AppData.ContentEditor.SaveStatus="",this.pict.AppData.ContentEditor.SaveStatusClass="",window.location.hash="#/edit/"+t,this.pict.AppData.ContentEditor.CurrentFile=t,this.pict.AppData.ContentEditor.IsDirty=!1,this.pict.AppData.ContentEditor.ActiveEditor=n,this._cleanupEditors(),this.pict.views["ContentEditor-TopBar"].render(),"binary"===n)return this._showBinaryPreview(t),void this.updateStats();let i=this.pict.providers["ContentEditor-Provider"];this.pict.AppData.ContentEditor.IsLoading=!0,i.loadFile(t,(i,o)=>{if(e.pict.AppData.ContentEditor.IsLoading=!1,i)return e.pict.AppData.ContentEditor.SaveStatus="Error loading file: "+i,e.pict.AppData.ContentEditor.SaveStatusClass="content-editor-status-error",void e.pict.views["ContentEditor-TopBar"].render();if("markdown"===n){e.pict.AppData.ContentEditor.Document.Segments=e.segmentMarkdownContent(o);let n=e.pict.views["ContentEditor-MarkdownEditor"];if(n){let i="/content/",o=t.lastIndexOf("/");o>0&&(i="/content/"+t.substring(0,o)+"/"),n.options.ImageBaseURL=i,n.render(),n.marshalToView(),n.setPreviewMode(e.pict.AppData.ContentEditor.ContentPreviewMode||"off"),n.toggleControls(e.pict.AppData.ContentEditor.MarkdownEditingControls)}e.updateStats()}else{e.pict.AppData.ContentEditor.CodeContent=o;let n=t.replace(/^.*\./,"").toLowerCase(),i=l.getLanguageForExtension?l.getLanguageForExtension(n):l.ExtensionLanguageMap[n]||"plaintext",r=e.pict.views["ContentEditor-CodeEditor"];r&&(r.initialRenderComplete=!1,r._language=i,r._suppressNextDirty=!0,r.render(),r.marshalToView(),e.pict.AppData.ContentEditor.CodeWordWrap&&r._editorElement&&(r._editorElement.style.whiteSpace="pre-wrap",r._editorElement.style.overflowWrap="break-word")),e.updateStats()}})}saveCurrentFile(){let t=this.pict.AppData.ContentEditor.CurrentFile;if(!t)return;let e=this.pict.providers["ContentEditor-Provider"],n=this,i="";if("code"===this.pict.AppData.ContentEditor.ActiveEditor){let t=this.pict.views["ContentEditor-CodeEditor"];t&&t.marshalFromView(),i=this.pict.AppData.ContentEditor.CodeContent||""}else{let t=this.pict.views["ContentEditor-MarkdownEditor"];t&&t.marshalFromView();let e=this.pict.AppData.ContentEditor.Document.Segments;if(e&&e.length>0){let t=[];for(let n=0;n<e.length;n++)t.push(e[n].Content||"");i=t.join("\n\n")}}this.pict.AppData.ContentEditor.IsSaving=!0,this.pict.AppData.ContentEditor.SaveStatus="Saving...",this.pict.AppData.ContentEditor.SaveStatusClass="content-editor-status-saving",this.pict.views["ContentEditor-TopBar"].render(),e.saveFile(t,i,t=>{n.pict.AppData.ContentEditor.IsSaving=!1,t?(n.pict.AppData.ContentEditor.SaveStatus="Error: "+t,n.pict.AppData.ContentEditor.SaveStatusClass="content-editor-status-error"):(n.pict.AppData.ContentEditor.IsDirty=!1,n.pict.AppData.ContentEditor.SaveStatus="Saved",n.pict.AppData.ContentEditor.SaveStatusClass="content-editor-status-saved",n.loadFileList(),setTimeout(()=>{"Saved"===n.pict.AppData.ContentEditor.SaveStatus&&(n.pict.AppData.ContentEditor.SaveStatus="",n.pict.AppData.ContentEditor.SaveStatusClass="",n.pict.views["ContentEditor-TopBar"].render())},3e3)),n.pict.views["ContentEditor-TopBar"].render()})}closeCurrentFile(){this.pict.AppData.ContentEditor.CurrentFile&&(this.pict.AppData.ContentEditor.IsDirty?this._showCloseConfirmation():this._doCloseFile())}_doCloseFile(){this._hideCloseConfirmation(),this._cleanupEditors(),this.pict.AppData.ContentEditor.CurrentFile="",this.pict.AppData.ContentEditor.ActiveEditor="markdown",this.pict.AppData.ContentEditor.IsDirty=!1,this.pict.AppData.ContentEditor.SaveStatus="",this.pict.AppData.ContentEditor.SaveStatusClass="",this.pict.AppData.ContentEditor.Document.Segments=[{Content:""}],this.pict.AppData.ContentEditor.CodeContent="",window.location.hash="",this.pict.views["ContentEditor-TopBar"].render();let t=this.pict.ContentAssignment.getElement("#ContentEditor-Editor-Container");t&&t[0]&&(t[0].innerHTML='<div style="display:flex;align-items:center;justify-content:center;height:100%;color:#8A7F72;font-size:1.1em;">Select a file from the sidebar to begin editing</div>'),this.updateStats()}confirmCloseFile(){this._doCloseFile()}cancelCloseFile(){this._hideCloseConfirmation()}_showCloseConfirmation(){let t=document.getElementById("ContentEditor-ConfirmOverlay");if(t&&t.classList.add("open"),!this._confirmKeyHandler){let t=this;this._confirmKeyHandler=e=>{let n=e.key.toLowerCase();"y"===n?(e.preventDefault(),t.confirmCloseFile()):"n"!==n&&"Escape"!==e.key||(e.preventDefault(),t.cancelCloseFile())}}window.addEventListener("keydown",this._confirmKeyHandler)}_hideCloseConfirmation(){let t=document.getElementById("ContentEditor-ConfirmOverlay");t&&t.classList.remove("open"),this._confirmKeyHandler&&window.removeEventListener("keydown",this._confirmKeyHandler)}createNewFile(t){if(!t)return;t.replace(/^.*\//,"").indexOf(".")<0&&(t+=".md");let e=this.pict.providers["ContentEditor-Provider"],n=this,i="";i=t.endsWith(".md")?"# "+t.replace(/\.[^.]+$/,"").replace(/^.*\//,"")+"\n\n":"// "+t.replace(/^.*\//,"")+"\n",e.saveFile(t,i,e=>{e||n.loadFileList(null,()=>{n.navigateToFile(t)})})}promptNewFile(){let t=prompt("Enter a name for the new file (e.g. my-page.md, script.js, style.css):");t&&t.trim()&&this.createNewFile(t.trim())}promptNewFolder(){let t=prompt("Enter a name for the new folder:");if(!t||!t.trim())return;t=t.trim();let e="";this.pict.AppData.PictFileBrowser&&this.pict.AppData.PictFileBrowser.CurrentLocation&&(e=this.pict.AppData.PictFileBrowser.CurrentLocation);let n=e?e+"/"+t:t,i=this;fetch("/api/content/mkdir",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({Path:n})}).then(t=>t.json()).then(t=>{t&&t.Success?(i.log.info("Folder created: ".concat(n)),i.loadFileList()):alert("Could not create folder: "+(t?t.Error:"Unknown error"))}).catch(t=>{alert("Error creating folder: "+t.message)})}insertFileReference(t){if(!t)return;let e=this.pict.views["ContentEditor-MarkdownEditor"];if(!e||"markdown"!==this.pict.AppData.ContentEditor.ActiveEditor)return;let n=e._activeSegmentIndex;if(n<0){let t=e._getOrderedSegmentIndices();t.length>0&&(n=t[0])}if(n<0)return;let i=t.replace(/\.[^.]+$/,"");i=i.replace(/^\d{10,}-/,""),i=i.replace(/[-_]+/g," ").trim()||"image";let o=t.substring(t.lastIndexOf(".")).toLowerCase();if([".png",".jpg",".jpeg",".gif",".webp",".svg",".bmp",".avif",".apng",".ico",".tiff",".tif",".jfif"].indexOf(o)>=0)e._insertImageMarkdown(n,t,i);else{let o=e._segmentEditors[n];if(o){let e="["+i+"]("+t+")",n=o.state.selection.main.head;o.dispatch({changes:{from:n,insert:e},selection:{anchor:n+e.length}}),o.focus()}}}handleF4TopicAction(){let t=this.pict.views["ContentEditor-Layout"],e=this.pict.views["ContentEditor-Topics"];if(!t||!e)return;let n=this.pict.AppData.ContentEditor,i=n.ActiveEditor,o=n.CurrentFile,r=0,s=!1;if("markdown"===i&&o){let t=this.pict.views["ContentEditor-MarkdownEditor"];if(t&&t._segmentEditors){let e=0;for(let n in t._segmentEditors){let i=t._segmentEditors[n];if(i&&i.hasFocus){let t=i.state.selection.main.head;r=e+i.state.doc.lineAt(t).number,s=!0;break}i&&i.state&&(e+=i.state.doc.lines)}}}if(n.SidebarCollapsed&&t.toggleSidebar(),t.switchSidebarTab("topics"),s&&o){let t={TopicCode:"New-Topic",TopicHelpFilePath:o,TopicTitle:this._extractFirstHeading()||"New Topic"};r>0&&(t.RelevantMarkdownLine=r),e.addTopic(t)}}_extractFirstHeading(){let t=this.pict.views["ContentEditor-MarkdownEditor"];if(!t||!t._segmentEditors)return"";let e=7,n="";for(let i in t._segmentEditors){let o=t._segmentEditors[i];if(!o||!o.state||!o.state.doc)continue;let r=o.state.doc;for(let t=1;t<=r.lines;t++){let i=r.line(t).text.match(/^(#{1,6})\s+(.+)/);if(i){let t=i[1].length;if(t<e&&(e=t,n=i[2].trim(),1===e))return n}}}return n}updateStats(){let t=document.getElementById("ContentEditor-Stats");if(!t)return;let e=this.pict.AppData.ContentEditor.ActiveEditor,n=0,i=0,o=0;if("markdown"===e){let t=this.pict.views["ContentEditor-MarkdownEditor"];if(t&&t._segmentEditors)for(let e in t._segmentEditors){let r=t._segmentEditors[e];if(r&&r.state&&r.state.doc){n+=r.state.doc.lines,i+=r.state.doc.length;let t=r.state.doc.toString().match(/\S+/g);t&&(o+=t.length)}}}else{if("code"!==e)return void(t.textContent="");{let t=this.pict.views["ContentEditor-CodeEditor"];if(t&&t.codeJar){let e=t.codeJar.toString();i=e.length,n=e.split("\n").length;let r=e.match(/\S+/g);r&&(o=r.length)}}}t.textContent=n+" lines · "+o+" words · "+i+" chars"}markDirty(){this.pict.AppData.ContentEditor.IsDirty||(this.pict.AppData.ContentEditor.IsDirty=!0,this.pict.views["ContentEditor-TopBar"].render())}get _settingsKey(){return"retold-content-editor-settings"}saveSettings(){if("undefined"==typeof window||!window.localStorage)return;let t=this.pict.AppData.ContentEditor,e={AutoSegmentMarkdown:t.AutoSegmentMarkdown,AutoSegmentDepth:t.AutoSegmentDepth,ContentPreviewMode:t.ContentPreviewMode,MarkdownEditingControls:t.MarkdownEditingControls,MarkdownWordWrap:t.MarkdownWordWrap,CodeWordWrap:t.CodeWordWrap,SidebarCollapsed:t.SidebarCollapsed,SidebarWidth:t.SidebarWidth,AutoPreviewImages:t.AutoPreviewImages,AutoPreviewVideo:t.AutoPreviewVideo,AutoPreviewAudio:t.AutoPreviewAudio,ShowHiddenFiles:t.ShowHiddenFiles,TopicsFilePath:t.TopicsFilePath};try{window.localStorage.setItem(this._settingsKey,JSON.stringify(e))}catch(t){this.log.warn("Failed to save settings: "+t.message)}}_loadSettings(){if("undefined"!=typeof window&&window.localStorage)try{let t=window.localStorage.getItem(this._settingsKey);if(!t)return;let e=JSON.parse(t),n=this.pict.AppData.ContentEditor;"boolean"==typeof e.AutoSegmentMarkdown&&(n.AutoSegmentMarkdown=e.AutoSegmentMarkdown),"number"==typeof e.AutoSegmentDepth&&(n.AutoSegmentDepth=e.AutoSegmentDepth),"string"==typeof e.ContentPreviewMode?n.ContentPreviewMode=e.ContentPreviewMode:"boolean"==typeof e.AutoContentPreview&&(n.ContentPreviewMode=e.AutoContentPreview?"bottom":"off"),"boolean"==typeof e.MarkdownEditingControls&&(n.MarkdownEditingControls=e.MarkdownEditingControls),"boolean"==typeof e.MarkdownWordWrap&&(n.MarkdownWordWrap=e.MarkdownWordWrap),"boolean"==typeof e.CodeWordWrap&&(n.CodeWordWrap=e.CodeWordWrap),"boolean"==typeof e.SidebarCollapsed&&(n.SidebarCollapsed=e.SidebarCollapsed),"number"==typeof e.SidebarWidth&&(n.SidebarWidth=e.SidebarWidth),"boolean"==typeof e.AutoPreviewImages&&(n.AutoPreviewImages=e.AutoPreviewImages),"boolean"==typeof e.AutoPreviewVideo&&(n.AutoPreviewVideo=e.AutoPreviewVideo),"boolean"==typeof e.AutoPreviewAudio&&(n.AutoPreviewAudio=e.AutoPreviewAudio),"boolean"==typeof e.ShowHiddenFiles&&(n.ShowHiddenFiles=e.ShowHiddenFiles),"string"==typeof e.TopicsFilePath&&(n.TopicsFilePath=e.TopicsFilePath)}catch(t){this.log.warn("Failed to load settings: "+t.message)}}},e.exports.default_configuration=t("./Pict-Application-ContentEditor-Configuration.json")},{"./Pict-Application-ContentEditor-Configuration.json":101,"./providers/Pict-Provider-ContentEditor.js":106,"./views/PictView-Editor-CodeEditor.js":107,"./views/PictView-Editor-Layout.js":108,"./views/PictView-Editor-MarkdownEditor.js":109,"./views/PictView-Editor-MarkdownReference.js":110,"./views/PictView-Editor-SettingsPanel.js":111,"./views/PictView-Editor-TopBar.js":112,"./views/PictView-Editor-Topics.js":113,"pict-application":44,"pict-section-filebrowser":63}],103:[function(t,e,n){e.exports={Name:"Retold Content Reader",Hash:"ContentReader",MainViewportViewIdentifier:"Docuserve-Layout",AutoSolveAfterInitialize:!0,AutoRenderMainViewportViewAfterInitialize:!1,AutoRenderViewsAfterInitialize:!1,pict_configuration:{Product:"ContentReader-Pict-Application"}}},{}],104:[function(t,e,n){const i=t("pict-docuserve");e.exports=class extends i{constructor(t,e,n){super(t,e,n)}onAfterInitializeAsync(t){this.pict.AppData.Docuserve={CatalogLoaded:!1,Catalog:null,CoverLoaded:!1,Cover:null,SidebarLoaded:!1,SidebarGroups:[],TopBarLoaded:!1,TopBar:null,ErrorPageLoaded:!1,ErrorPageHTML:null,KeywordIndexLoaded:!1,KeywordDocumentCount:0,CurrentGroup:"",CurrentModule:"",CurrentPath:"",SidebarVisible:!0,DocsBaseURL:"/content/",CatalogURL:"/content/retold-catalog.json"},this.pict.providers["Docuserve-Documentation"].loadCatalog(()=>{let e=this.pict.AppData.Docuserve;return e.CoverLoaded&&e.Cover&&e.Cover.Title?document.title=e.Cover.Title.replace(/<[^>]*>/g,""):e.TopBarLoaded&&e.TopBar&&e.TopBar.Brand&&(document.title=e.TopBar.Brand.replace(/<[^>]*>/g,"")),e.TopBar?(Array.isArray(e.TopBar.ExternalLinks)||(e.TopBar.ExternalLinks=[]),e.TopBar.ExternalLinks.push({Text:"Edit",Href:"/"})):(e.TopBarLoaded=!0,e.TopBar={Brand:"Content System",NavLinks:[],ExternalLinks:[{Text:"Edit",Href:"/"}]}),this.pict.views["Docuserve-Layout"].render(),t()})}},e.exports.default_configuration=t("./Pict-Application-ContentReader-Configuration.json")},{"./Pict-Application-ContentReader-Configuration.json":103,"pict-docuserve":49}],105:[function(t,e,n){e.exports={PictContentReader:t("./Pict-Application-ContentReader.js"),PictContentEditor:t("./Pict-Application-ContentEditor.js")},"undefined"!=typeof window&&(window.PictContentReader=e.exports.PictContentReader,window.PictContentEditor=e.exports.PictContentEditor)},{"./Pict-Application-ContentEditor.js":102,"./Pict-Application-ContentReader.js":104}],106:[function(t,e,n){const i=t("pict-provider");e.exports=class extends i{constructor(t,e,n){super(t,e,n)}loadFile(t,e){let n="function"==typeof e?e:()=>{};if(!t)return n("No file path specified","");fetch("/api/content/read/"+encodeURIComponent(t)).then(t=>t.ok?t.json():n("File not found: "+t.status,"")).then(t=>t&&t.Success?n(null,t.Content||""):n(t?t.Error:"Unknown error","")).catch(e=>(this.log.warn("ContentEditor: Error loading file [".concat(t,"]: ").concat(e)),n(e.message,"")))}saveFile(t,e,n){let i="function"==typeof n?n:()=>{};if(!t)return i("No file path specified");fetch("/api/content/save/"+encodeURIComponent(t),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({Content:e})}).then(t=>t.ok?t.json():i("Save failed: "+t.status)).then(t=>t&&t.Success?i(null):i(t?t.Error:"Unknown error")).catch(e=>(this.log.warn("ContentEditor: Error saving file [".concat(t,"]: ").concat(e)),i(e.message)))}uploadImage(t,e){let n="function"==typeof e?e:()=>{},i="",o=this.pict.AppData.ContentEditor.CurrentFile;if(o){let t=o.lastIndexOf("/");t>0&&(i=o.substring(0,t))}else this.pict.AppData.PictFileBrowser&&this.pict.AppData.PictFileBrowser.CurrentLocation&&(i=this.pict.AppData.PictFileBrowser.CurrentLocation);let r={"Content-Type":t.type,"x-filename":t.name};i&&(r["x-upload-path"]=i),fetch("/api/content/upload-image",{method:"POST",body:t,headers:r}).then(t=>t.json()).then(t=>t&&t.Success&&t.URL?n(null,t.URL):n(t?t.Error:"Upload failed")).catch(t=>(this.log.warn("ContentEditor: Image upload failed: ".concat(t)),n(t.message)))}},e.exports.default_configuration={ProviderIdentifier:"ContentEditor-Provider",AutoInitialize:!0,AutoInitializeOrdinal:0}},{"pict-provider":58}],107:[function(t,e,n){const i=t("pict-section-code"),o={js:"javascript",mjs:"javascript",cjs:"javascript",jsx:"javascript",ts:"typescript",tsx:"typescript",json:"json",html:"xml",htm:"xml",xml:"xml",svg:"xml",css:"css",scss:"scss",sass:"scss",less:"less",sql:"sql",py:"python",rb:"ruby",java:"java",kt:"kotlin",kts:"kotlin",go:"go",rs:"rust",c:"c",h:"c",cpp:"cpp",cc:"cpp",hpp:"cpp",cs:"csharp",swift:"swift",php:"php",sh:"bash",bash:"bash",zsh:"bash",fish:"bash",yml:"yaml",yaml:"yaml",toml:"ini",ini:"ini",cfg:"ini",conf:"ini",dockerfile:"dockerfile",docker:"dockerfile",makefile:"makefile",mk:"makefile",md:"markdown",markdown:"markdown",lua:"lua",r:"r",pl:"perl",pm:"perl",ex:"elixir",exs:"elixir",erl:"erlang",hrl:"erlang",hs:"haskell",clj:"clojure",scala:"scala",dart:"dart",groovy:"groovy",gradle:"groovy",tf:"terraform",vim:"vim",diff:"diff",patch:"diff",log:"accesslog",txt:"plaintext"};e.exports=class extends i{constructor(t,e,n){super(t,e,n),this._suppressNextDirty=!1}onAfterInitialRender(){if("undefined"!=typeof window&&window.CodeJarModules&&window.CodeJarModules.CodeJar&&this.connectCodeJarPrototype(window.CodeJarModules.CodeJar),"undefined"!=typeof window&&window.CodeJarModules&&window.CodeJarModules.hljs){let t=window.CodeJarModules.hljs,e=this._language;this._highlightFunction=function(n){n.removeAttribute("data-highlighted"),delete n.dataset.highlighted,n.className=n.className.replace(/\bhljs\b/g,"").replace(/\blanguage-\S+/g,"").trim(),n.classList.add("hljs"),e&&"plaintext"!==e&&n.classList.add("language-"+e),t.highlightElement(n)}}return super.onAfterInitialRender()}setLanguage(t){if(this._language=t,"undefined"!=typeof window&&window.CodeJarModules&&window.CodeJarModules.hljs){let e=window.CodeJarModules.hljs,n=t;this._highlightFunction=function(t){t.removeAttribute("data-highlighted"),delete t.dataset.highlighted,t.className=t.className.replace(/\bhljs\b/g,"").replace(/\blanguage-\S+/g,"").trim(),t.classList.add("hljs"),n&&"plaintext"!==n&&t.classList.add("language-"+n),e.highlightElement(t)}}if(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.codeJar.updateCode(t),this.codeJar.onUpdate(t=>{this._updateLineNumbers(),this.onCodeChange(t)})}}onCodeChange(t){super.onCodeChange(t),this._suppressNextDirty?this._suppressNextDirty=!1:this.pict.PictApplication&&(this.pict.PictApplication.markDirty(),this.pict.PictApplication.updateStats())}static getLanguageForExtension(t){if(!t)return"plaintext";let e=t.toLowerCase();return o[e]||"plaintext"}},e.exports.default_configuration={ViewIdentifier:"ContentEditor-CodeEditor",DefaultRenderable:"CodeEditor-Wrap",DefaultDestinationAddress:"#ContentEditor-Editor-Container",TargetElementAddress:"#ContentEditor-Editor-Container",CodeDataAddress:"AppData.ContentEditor.CodeContent",ReadOnly:!1,LineNumbers:!0,Language:"javascript",Tab:"\t",AutoRender:!1,Renderables:[{RenderableHash:"CodeEditor-Wrap",TemplateHash:"CodeEditor-Container",DestinationAddress:"#ContentEditor-Editor-Container"}]},e.exports.ExtensionLanguageMap=o},{"pict-section-code":61}],108:[function(t,e,n){const i=t("pict-view");e.exports=class extends i{constructor(t,e,n){super(t,e,n),this._minSidebarWidth=140,this._maxSidebarWidth=600}onAfterRender(t,e,n,i){this.pict.views["ContentEditor-TopBar"].render();let o=this.pict.ContentAssignment.getElement("#ContentEditor-Editor-Container");o&&o[0]&&!this.pict.AppData.ContentEditor.CurrentFile&&(o[0].innerHTML='<div style="display:flex;align-items:center;justify-content:center;height:100%;color:#8A7F72;font-size:1.1em;">Select a file from the sidebar to begin editing</div>'),this.pict.CSSMap.injectCSS();let r=this.pict.AppData.ContentEditor,s=document.getElementById("ContentEditor-SidebarWrap"),a=document.getElementById("ContentEditor-SidebarToggle");if(s){let t=window.innerWidth<=768;s.style.width=t?"100%":r.SidebarWidth+"px",r.SidebarCollapsed?(s.classList.add("collapsed"),a&&(a.innerHTML=t?"▼":"▶")):t&&(r.SidebarCollapsed=!0,s.classList.add("collapsed"),a&&(a.innerHTML="▼"))}let c=this;return a&&a.addEventListener("click",()=>{c.toggleSidebar()}),this._wireResizeHandle(),window.addEventListener("hashchange",()=>{c.pict.PictApplication.resolveHash()}),window.addEventListener("keydown",t=>{if((t.metaKey||t.ctrlKey)&&"s"===t.key)return t.preventDefault(),void c.pict.PictApplication.saveCurrentFile();if("F1"===t.key)return t.preventDefault(),void c._handleF1();if("F2"===t.key)return t.preventDefault(),void c.toggleSidebar();if("F3"===t.key)return t.preventDefault(),void c.toggleUploadForm();if((t.metaKey||t.ctrlKey)&&t.shiftKey&&("u"===t.key||"U"===t.key))return t.preventDefault(),void c.toggleUploadForm();if("F4"===t.key)return t.preventDefault(),void c.pict.PictApplication.handleF4TopicAction();if((t.metaKey||t.ctrlKey)&&t.shiftKey&&("t"===t.key||"T"===t.key))return t.preventDefault(),void c.pict.PictApplication.handleF4TopicAction();if("Escape"===t.key){let e=document.getElementById("ContentEditor-UploadOverlay");if(e&&e.classList.contains("open"))return void c.closeUploadForm();let n=document.getElementById("ContentEditor-ConfirmOverlay");if(n&&n.classList.contains("open"))return;if(c.pict.AppData.ContentEditor.CurrentFile)return t.preventDefault(),void c.pict.PictApplication.closeCurrentFile()}}),super.onAfterRender(t,e,n,i)}toggleSidebar(){let t=document.getElementById("ContentEditor-SidebarWrap"),e=document.getElementById("ContentEditor-SidebarToggle");if(!t)return;let n=this.pict.AppData.ContentEditor;n.SidebarCollapsed=!n.SidebarCollapsed;let i=window.innerWidth<=768;n.SidebarCollapsed?(t.classList.add("collapsed"),e&&(e.innerHTML=i?"▼":"▶")):(t.classList.remove("collapsed"),t.style.width=i?"100%":n.SidebarWidth+"px",e&&(e.innerHTML=i?"▲":"◀")),this.pict.PictApplication.saveSettings()}switchSidebarTab(t){let e={files:document.getElementById("ContentEditor-Sidebar-Container"),reference:document.getElementById("ContentEditor-SidebarReference-Container"),topics:document.getElementById("ContentEditor-SidebarTopics-Container")},n={files:document.getElementById("ContentEditor-SidebarTab-Files"),reference:document.getElementById("ContentEditor-SidebarTab-Reference"),topics:document.getElementById("ContentEditor-SidebarTab-Topics")};for(let t in e)e[t]&&(e[t].style.display="none"),n[t]&&n[t].classList.remove("active");e[t]&&(e[t].style.display=""),n[t]&&n[t].classList.add("active");let i=document.getElementById("ContentEditor-SidebarWrap");if(i&&("reference"===t||"topics"===t?i.classList.add("sidebar-expanded-pane"):i.classList.remove("sidebar-expanded-pane")),"reference"===t){let t=this.pict.views["ContentEditor-MarkdownReference"];t&&!t._hasRendered&&t.render()}if("topics"===t){let t=this.pict.views["ContentEditor-Topics"];t&&!t._hasRendered&&t.render()}}_handleF1(){if(this.pict.AppData.ContentEditor.SidebarCollapsed)return this.toggleSidebar(),void this.switchSidebarTab("reference");let t=document.getElementById("ContentEditor-SidebarTab-Reference");t&&t.classList.contains("active")?this.switchSidebarTab("files"):this.switchSidebarTab("reference")}getActiveSidebarTab(){let t=document.getElementById("ContentEditor-SidebarTab-Reference"),e=document.getElementById("ContentEditor-SidebarTab-Topics");return t&&t.classList.contains("active")?"reference":e&&e.classList.contains("active")?"topics":"files"}toggleUploadForm(){let t=document.getElementById("ContentEditor-UploadOverlay");t&&(t.classList.contains("open")?this.closeUploadForm():this.openUploadForm())}openUploadForm(){let t=document.getElementById("ContentEditor-UploadOverlay");t&&t.classList.add("open"),this._wireUploadDropzone()}closeUploadForm(){let t=document.getElementById("ContentEditor-UploadOverlay");t&&t.classList.remove("open");let e=document.getElementById("ContentEditor-UploadFileInput");e&&(e.value="");let n=document.getElementById("ContentEditor-UploadStatus");n&&(n.innerHTML="");let i=document.getElementById("ContentEditor-UploadResult");i&&(i.innerHTML="")}onUploadOverlayClick(t){"ContentEditor-UploadOverlay"===t.target.id&&this.closeUploadForm()}onUploadFileSelected(t){t.files&&t.files.length>0&&this._uploadFile(t.files[0])}_wireUploadDropzone(){let t=document.getElementById("ContentEditor-UploadDropzone");if(!t||t._wired)return;t._wired=!0;let e=this;t.addEventListener("dragover",e=>{e.preventDefault(),e.stopPropagation(),t.classList.add("dragover")}),t.addEventListener("dragleave",e=>{e.preventDefault(),e.stopPropagation(),t.classList.remove("dragover")}),t.addEventListener("drop",n=>{n.preventDefault(),n.stopPropagation(),t.classList.remove("dragover"),n.dataTransfer&&n.dataTransfer.files&&n.dataTransfer.files.length>0&&e._uploadFile(n.dataTransfer.files[0])})}_uploadFile(t){let e=document.getElementById("ContentEditor-UploadStatus"),n=document.getElementById("ContentEditor-UploadResult");if(!t)return;if(!t.type.startsWith("image/"))return void(e&&(e.innerHTML='<span class="content-editor-upload-status-error">Only image files are supported.</span>'));e&&(e.innerHTML="Uploading <strong>"+t.name+"</strong>..."),n&&(n.innerHTML="");let i=this,o=this.pict.providers["ContentEditor-Provider"];o?o.uploadImage(t,(o,r)=>{if(o)return void(e&&(e.innerHTML='<span class="content-editor-upload-status-error">Upload failed: '+o+"</span>"));e&&(e.innerHTML='<span class="content-editor-upload-status-success">Uploaded successfully!</span>');let s="";n&&(n.innerHTML='<div class="content-editor-upload-result"><div class="content-editor-upload-result-label">Markdown</div><div class="content-editor-upload-result-url"><span class="content-editor-upload-result-text">'+s+'</span><button class="content-editor-upload-result-copy" onclick="navigator.clipboard.writeText(\''+s.replace(/'/g,"\\'")+'\').then(function(){this.textContent=\'Copied!\'}.bind(this))">Copy</button></div><div class="content-editor-upload-result-label" style="margin-top:8px">URL</div><div class="content-editor-upload-result-url"><span class="content-editor-upload-result-text">'+r+'</span><button class="content-editor-upload-result-copy" onclick="navigator.clipboard.writeText(\''+r.replace(/'/g,"\\'")+"').then(function(){this.textContent='Copied!'}.bind(this))\">Copy</button></div></div>"),i.pict.PictApplication.loadFileList()}):e&&(e.innerHTML='<span class="content-editor-upload-status-error">Provider not available.</span>')}_wireResizeHandle(){let t=document.getElementById("ContentEditor-ResizeHandle"),e=document.getElementById("ContentEditor-SidebarWrap");if(!t||!e)return;let n=this,i=!1,o=0,r=0;function s(t){if(!i)return;let s=t.clientX-o,a=r+s;a<n._minSidebarWidth&&(a=n._minSidebarWidth),a>n._maxSidebarWidth&&(a=n._maxSidebarWidth),e.style.width=a+"px"}function a(){i&&(i=!1,t.classList.remove("dragging"),e.style.transition="",document.body.style.userSelect="",document.body.style.cursor="",n.pict.AppData.ContentEditor.SidebarWidth=e.offsetWidth,n.pict.PictApplication.saveSettings(),document.removeEventListener("mousemove",s),document.removeEventListener("mouseup",a))}t.addEventListener("mousedown",function(c){n.pict.AppData.ContentEditor.SidebarCollapsed||(c.preventDefault(),i=!0,o=c.clientX,r=e.offsetWidth,t.classList.add("dragging"),e.style.transition="none",document.body.style.userSelect="none",document.body.style.cursor="col-resize",document.addEventListener("mousemove",s),document.addEventListener("mouseup",a))})}},e.exports.default_configuration={ViewIdentifier:"ContentEditor-Layout",DefaultRenderable:"ContentEditor-Layout-Shell",DefaultDestinationAddress:"#ContentEditor-Application-Container",AutoRender:!1,CSS:'\n\t\t#ContentEditor-Application-Container\n\t\t{\n\t\t\tdisplay: flex;\n\t\t\tflex-direction: column;\n\t\t\theight: 100vh;\n\t\t\tbackground: #F5F3EE;\n\t\t}\n\t\t#ContentEditor-TopBar-Container\n\t\t{\n\t\t\tflex-shrink: 0;\n\t\t}\n\t\t.content-editor-body\n\t\t{\n\t\t\tdisplay: flex;\n\t\t\tflex: 1;\n\t\t\tmin-height: 0;\n\t\t\toverflow: hidden;\n\t\t}\n\t\t/* Sidebar wrapper holds the sidebar content + collapse toggle */\n\t\t.content-editor-sidebar-wrap\n\t\t{\n\t\t\tdisplay: flex;\n\t\t\tflex-shrink: 0;\n\t\t\tposition: relative;\n\t\t\ttransition: width 0.2s ease;\n\t\t}\n\t\t/* Inner wrapper: vertical flex for tab bar + panes */\n\t\t.content-editor-sidebar-inner\n\t\t{\n\t\t\tdisplay: flex;\n\t\t\tflex-direction: column;\n\t\t\tflex: 1;\n\t\t\tmin-width: 0;\n\t\t\tmin-height: 0;\n\t\t\toverflow: hidden;\n\t\t}\n\t\t/* Sidebar tab bar */\n\t\t.content-editor-sidebar-tabs\n\t\t{\n\t\t\tdisplay: flex;\n\t\t\tflex-shrink: 0;\n\t\t\tborder-bottom: 1px solid #DDD6CA;\n\t\t\tbackground: #F5F0EA;\n\t\t}\n\t\t.content-editor-sidebar-tab\n\t\t{\n\t\t\tflex: 1;\n\t\t\tpadding: 7px 0;\n\t\t\tborder: none;\n\t\t\tbackground: transparent;\n\t\t\tfont-size: 0.78rem;\n\t\t\tfont-weight: 600;\n\t\t\tcolor: #8A7F72;\n\t\t\tcursor: pointer;\n\t\t\tborder-bottom: 2px solid transparent;\n\t\t\ttransition: color 0.15s, border-color 0.15s;\n\t\t}\n\t\t.content-editor-sidebar-tab:hover\n\t\t{\n\t\t\tcolor: #3D3229;\n\t\t}\n\t\t.content-editor-sidebar-tab.active\n\t\t{\n\t\t\tcolor: #2E7D74;\n\t\t\tborder-bottom-color: #2E7D74;\n\t\t}\n\t\t.content-editor-sidebar-addfile\n\t\t{\n\t\t\tflex-shrink: 0;\n\t\t\twidth: 30px;\n\t\t\tborder: none;\n\t\t\tbackground: transparent;\n\t\t\tfont-size: 1.1rem;\n\t\t\tfont-weight: 400;\n\t\t\tcolor: #8A7F72;\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\tborder-bottom: 2px solid transparent;\n\t\t\ttransition: color 0.15s, background 0.15s;\n\t\t}\n\t\t.content-editor-sidebar-addfile:hover\n\t\t{\n\t\t\tcolor: #2E7D74;\n\t\t\tbackground: #EDE9E3;\n\t\t}\n\t\t/* Sidebar panes */\n\t\t.content-editor-sidebar-pane\n\t\t{\n\t\t\tflex: 1;\n\t\t\toverflow-y: auto;\n\t\t\toverflow-x: hidden;\n\t\t\tmin-width: 0;\n\t\t\tmin-height: 0;\n\t\t}\n\t\t#ContentEditor-Sidebar-Container\n\t\t{\n\t\t\tbackground: #FAF8F4;\n\t\t}\n\t\t/* Collapsed state */\n\t\t.content-editor-sidebar-wrap.collapsed\n\t\t{\n\t\t\twidth: 0 !important;\n\t\t}\n\t\t.content-editor-sidebar-wrap.collapsed .content-editor-sidebar-inner\n\t\t{\n\t\t\tvisibility: hidden;\n\t\t}\n\t\t.content-editor-sidebar-wrap.collapsed .content-editor-resize-handle\n\t\t{\n\t\t\tdisplay: none;\n\t\t}\n\t\t/* Collapse / expand toggle */\n\t\t.content-editor-sidebar-toggle\n\t\t{\n\t\t\tposition: absolute;\n\t\t\ttop: 8px;\n\t\t\tright: -20px;\n\t\t\twidth: 20px;\n\t\t\theight: 28px;\n\t\t\tdisplay: flex;\n\t\t\talign-items: center;\n\t\t\tjustify-content: center;\n\t\t\tbackground: #FAF8F4;\n\t\t\tborder: 1px solid #DDD6CA;\n\t\t\tborder-left: none;\n\t\t\tborder-radius: 0 4px 4px 0;\n\t\t\tcursor: pointer;\n\t\t\tz-index: 10;\n\t\t\tcolor: #8A7F72;\n\t\t\tfont-size: 11px;\n\t\t\tline-height: 1;\n\t\t\ttransition: color 0.15s;\n\t\t}\n\t\t.content-editor-sidebar-toggle:hover\n\t\t{\n\t\t\tcolor: #3D3229;\n\t\t}\n\t\t.content-editor-sidebar-wrap.collapsed .content-editor-sidebar-toggle\n\t\t{\n\t\t\tright: -20px;\n\t\t}\n\t\t/* Resize handle */\n\t\t.content-editor-resize-handle\n\t\t{\n\t\t\tflex-shrink: 0;\n\t\t\twidth: 5px;\n\t\t\tcursor: col-resize;\n\t\t\tbackground: transparent;\n\t\t\tborder-right: 1px solid #DDD6CA;\n\t\t\ttransition: background 0.15s;\n\t\t}\n\t\t.content-editor-resize-handle:hover,\n\t\t.content-editor-resize-handle.dragging\n\t\t{\n\t\t\tbackground: #2E7D74;\n\t\t\tborder-right-color: #2E7D74;\n\t\t}\n\t\t/* File browser layout overrides for sidebar use */\n\t\t#ContentEditor-Sidebar-Container .pict-filebrowser\n\t\t{\n\t\t\tborder: none;\n\t\t\tborder-radius: 0;\n\t\t\tbackground: transparent;\n\t\t}\n\t\t#ContentEditor-Sidebar-Container .pict-filebrowser-browse-pane\n\t\t{\n\t\t\tdisplay: none;\n\t\t}\n\t\t#ContentEditor-Sidebar-Container .pict-filebrowser-view-pane\n\t\t{\n\t\t\tdisplay: none;\n\t\t}\n\t\t/* Hide size/date columns — the sidebar is too narrow for them */\n\t\t#ContentEditor-Sidebar-Container .pict-fb-detail-col-size,\n\t\t#ContentEditor-Sidebar-Container .pict-fb-detail-col-modified,\n\t\t#ContentEditor-Sidebar-Container .pict-fb-detail-size,\n\t\t#ContentEditor-Sidebar-Container .pict-fb-detail-modified\n\t\t{\n\t\t\tdisplay: none;\n\t\t}\n\t\t/* Hide the column header bar in sidebar mode */\n\t\t#ContentEditor-Sidebar-Container .pict-fb-detail-header\n\t\t{\n\t\t\tdisplay: none;\n\t\t}\n\t\t/* Breadcrumb bar: flex wrapper with create-folder button */\n\t\t.pict-fb-breadcrumb-bar\n\t\t{\n\t\t\tdisplay: flex;\n\t\t\talign-items: center;\n\t\t\tbackground: #F5F0E8;\n\t\t\tborder-bottom: 1px solid #DDD6CA;\n\t\t}\n\t\t.pict-fb-breadcrumb-bar .pict-fb-breadcrumb\n\t\t{\n\t\t\tflex: 1;\n\t\t\tborder-bottom: none;\n\t\t}\n\t\t.pict-fb-breadcrumb-addfolder\n\t\t{\n\t\t\tflex-shrink: 0;\n\t\t\tbackground: transparent;\n\t\t\tborder: none;\n\t\t\tfont-size: 1.1rem;\n\t\t\tfont-weight: 600;\n\t\t\tcolor: #8A7F72;\n\t\t\tcursor: pointer;\n\t\t\tpadding: 4px 10px;\n\t\t\tline-height: 1;\n\t\t\tborder-radius: 4px;\n\t\t\tmargin-right: 4px;\n\t\t}\n\t\t.pict-fb-breadcrumb-addfolder:hover\n\t\t{\n\t\t\tcolor: #2E7D74;\n\t\t\tbackground: #EAE3D8;\n\t\t}\n\t\t#ContentEditor-Editor-Container\n\t\t{\n\t\t\tflex: 1;\n\t\t\toverflow-y: auto;\n\t\t\tpadding: 44px 16px 16px 16px;\n\t\t}\n\t\t/* Code editor: fill the container and remove outer border */\n\t\t#ContentEditor-Editor-Container .pict-code-editor-wrap\n\t\t{\n\t\t\theight: calc(100% - 4px);\n\t\t\tborder: none;\n\t\t\tborder-radius: 0;\n\t\t}\n\t\t#ContentEditor-Editor-Container .pict-code-editor\n\t\t{\n\t\t\tmin-height: unset;\n\t\t\theight: 100%;\n\t\t\tbackground: #FAFAFA;\n\t\t}\n\t\t/* Binary file preview */\n\t\t.binary-preview-image-wrap\n\t\t{\n\t\t\tmargin-bottom: 20px;\n\t\t}\n\t\t.binary-preview-image\n\t\t{\n\t\t\tdisplay: inline-block;\n\t\t\tbackground: #FFF;\n\t\t\tborder: 1px solid #DDD6CA;\n\t\t\tborder-radius: 6px;\n\t\t\tpadding: 24px;\n\t\t}\n\t\t.binary-preview-image img\n\t\t{\n\t\t\tdisplay: block;\n\t\t\tmax-width: 100%;\n\t\t\tmax-height: 400px;\n\t\t\tobject-fit: contain;\n\t\t\tborder-radius: 4px;\n\t\t}\n\t\t.binary-preview-card\n\t\t{\n\t\t\tdisplay: flex;\n\t\t\talign-items: center;\n\t\t\tgap: 20px;\n\t\t\tbackground: #FFF;\n\t\t\tborder: 1px solid #DDD6CA;\n\t\t\tborder-radius: 6px;\n\t\t\tpadding: 24px;\n\t\t\tmax-width: 600px;\n\t\t}\n\t\t.binary-preview-icon\n\t\t{\n\t\t\tflex-shrink: 0;\n\t\t\twidth: 64px;\n\t\t\theight: 64px;\n\t\t\tdisplay: flex;\n\t\t\talign-items: center;\n\t\t\tjustify-content: center;\n\t\t\tbackground: #F0EDE8;\n\t\t\tborder-radius: 8px;\n\t\t\tfont-size: 0.75rem;\n\t\t\tfont-weight: 700;\n\t\t\tcolor: #5E5549;\n\t\t\tletter-spacing: 0.5px;\n\t\t}\n\t\t.binary-preview-info\n\t\t{\n\t\t\tflex: 1;\n\t\t\tmin-width: 0;\n\t\t}\n\t\t.binary-preview-name\n\t\t{\n\t\t\tfont-size: 1rem;\n\t\t\tfont-weight: 600;\n\t\t\tcolor: #3D3229;\n\t\t\tmargin-bottom: 6px;\n\t\t\tword-break: break-all;\n\t\t}\n\t\t.binary-preview-meta\n\t\t{\n\t\t\tfont-size: 0.8rem;\n\t\t\tcolor: #8A7F72;\n\t\t\tline-height: 1.6;\n\t\t}\n\t\t.binary-preview-actions\n\t\t{\n\t\t\tflex-shrink: 0;\n\t\t\tdisplay: flex;\n\t\t\tflex-direction: column;\n\t\t\tgap: 8px;\n\t\t}\n\t\t.binary-preview-btn\n\t\t{\n\t\t\tdisplay: inline-block;\n\t\t\tpadding: 8px 16px;\n\t\t\tborder-radius: 4px;\n\t\t\tfont-size: 0.8rem;\n\t\t\tfont-weight: 600;\n\t\t\ttext-decoration: none;\n\t\t\ttext-align: center;\n\t\t\tcursor: pointer;\n\t\t\tbackground: #2E7D74;\n\t\t\tcolor: #FFF;\n\t\t}\n\t\t.binary-preview-btn:hover\n\t\t{\n\t\t\tbackground: #3A9E92;\n\t\t}\n\t\t.binary-preview-btn-secondary\n\t\t{\n\t\t\tbackground: transparent;\n\t\t\tcolor: #5E5549;\n\t\t\tborder: 1px solid #DDD6CA;\n\t\t}\n\t\t.binary-preview-btn-secondary:hover\n\t\t{\n\t\t\tborder-color: #8A7F72;\n\t\t\tcolor: #3D3229;\n\t\t}\n\t\t.binary-preview-btn-preview\n\t\t{\n\t\t\tpadding: 10px 20px;\n\t\t\tfont-size: 0.85rem;\n\t\t\tborder: 1px solid #DDD6CA;\n\t\t\tbackground: #FAF8F4;\n\t\t\tcolor: #3D3229;\n\t\t\tcursor: pointer;\n\t\t\tborder-radius: 6px;\n\t\t\ttransition: background 0.15s, border-color 0.15s;\n\t\t}\n\t\t.binary-preview-btn-preview:hover\n\t\t{\n\t\t\tbackground: #F0EDE8;\n\t\t\tborder-color: #8A7F72;\n\t\t}\n\t\t#ContentEditor-MediaPreviewPlaceholder\n\t\t{\n\t\t\tmargin-bottom: 20px;\n\t\t}\n\t\t.binary-preview-media-wrap\n\t\t{\n\t\t\tmargin-bottom: 20px;\n\t\t}\n\t\t.binary-preview-video\n\t\t{\n\t\t\tdisplay: block;\n\t\t\tmax-width: 100%;\n\t\t\tmax-height: 500px;\n\t\t\tborder-radius: 6px;\n\t\t\tborder: 1px solid #DDD6CA;\n\t\t\tbackground: #000;\n\t\t}\n\t\t.binary-preview-audio\n\t\t{\n\t\t\tdisplay: block;\n\t\t\twidth: 100%;\n\t\t\tmax-width: 500px;\n\t\t}\n\t\t/* Image upload overlay */\n\t\t.content-editor-upload-overlay\n\t\t{\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: 1099;\n\t\t\tbackground: rgba(0, 0, 0, 0.35);\n\t\t}\n\t\t.content-editor-upload-overlay.open\n\t\t{\n\t\t\tdisplay: flex;\n\t\t\talign-items: center;\n\t\t\tjustify-content: center;\n\t\t}\n\t\t.content-editor-upload-panel\n\t\t{\n\t\t\tbackground: #FFF;\n\t\t\tborder: 1px solid #DDD6CA;\n\t\t\tborder-radius: 10px;\n\t\t\tbox-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);\n\t\t\twidth: 420px;\n\t\t\tmax-width: 90vw;\n\t\t\toverflow: hidden;\n\t\t}\n\t\t.content-editor-upload-header\n\t\t{\n\t\t\tdisplay: flex;\n\t\t\talign-items: center;\n\t\t\tjustify-content: space-between;\n\t\t\tpadding: 14px 18px;\n\t\t\tborder-bottom: 1px solid #EDE9E3;\n\t\t}\n\t\t.content-editor-upload-title\n\t\t{\n\t\t\tfont-size: 0.95rem;\n\t\t\tfont-weight: 600;\n\t\t\tcolor: #3D3229;\n\t\t}\n\t\t.content-editor-upload-close\n\t\t{\n\t\t\tbackground: transparent;\n\t\t\tborder: none;\n\t\t\tfont-size: 1.2rem;\n\t\t\tcolor: #8A7F72;\n\t\t\tcursor: pointer;\n\t\t\tpadding: 2px 6px;\n\t\t\tline-height: 1;\n\t\t\tborder-radius: 4px;\n\t\t}\n\t\t.content-editor-upload-close:hover\n\t\t{\n\t\t\tcolor: #3D3229;\n\t\t\tbackground: #F0EDE8;\n\t\t}\n\t\t.content-editor-upload-body\n\t\t{\n\t\t\tpadding: 18px;\n\t\t}\n\t\t.content-editor-upload-dropzone\n\t\t{\n\t\t\tborder: 2px dashed #DDD6CA;\n\t\t\tborder-radius: 8px;\n\t\t\tpadding: 28px 16px;\n\t\t\ttext-align: center;\n\t\t\tcursor: pointer;\n\t\t\ttransition: border-color 0.15s, background 0.15s;\n\t\t\tbackground: #FAF8F4;\n\t\t}\n\t\t.content-editor-upload-dropzone:hover,\n\t\t.content-editor-upload-dropzone.dragover\n\t\t{\n\t\t\tborder-color: #2E7D74;\n\t\t\tbackground: #F0FAF8;\n\t\t}\n\t\t.content-editor-upload-dropzone-icon\n\t\t{\n\t\t\tfont-size: 2rem;\n\t\t\tcolor: #8A7F72;\n\t\t\tmargin-bottom: 6px;\n\t\t}\n\t\t.content-editor-upload-dropzone-text\n\t\t{\n\t\t\tfont-size: 0.82rem;\n\t\t\tcolor: #5E5549;\n\t\t}\n\t\t.content-editor-upload-dropzone-hint\n\t\t{\n\t\t\tfont-size: 0.72rem;\n\t\t\tcolor: #8A7F72;\n\t\t\tmargin-top: 4px;\n\t\t}\n\t\t.content-editor-upload-file-input\n\t\t{\n\t\t\tdisplay: none;\n\t\t}\n\t\t.content-editor-upload-status\n\t\t{\n\t\t\tmargin-top: 12px;\n\t\t\tfont-size: 0.82rem;\n\t\t\tcolor: #5E5549;\n\t\t\tmin-height: 20px;\n\t\t}\n\t\t.content-editor-upload-status-error\n\t\t{\n\t\t\tcolor: #D9534F;\n\t\t}\n\t\t.content-editor-upload-status-success\n\t\t{\n\t\t\tcolor: #2E7D74;\n\t\t}\n\t\t.content-editor-upload-result\n\t\t{\n\t\t\tmargin-top: 12px;\n\t\t\tpadding: 10px 12px;\n\t\t\tbackground: #F0EDE8;\n\t\t\tborder: 1px solid #DDD6CA;\n\t\t\tborder-radius: 6px;\n\t\t}\n\t\t.content-editor-upload-result-label\n\t\t{\n\t\t\tfont-size: 0.72rem;\n\t\t\tcolor: #8A7F72;\n\t\t\tmargin-bottom: 4px;\n\t\t}\n\t\t.content-editor-upload-result-url\n\t\t{\n\t\t\tdisplay: flex;\n\t\t\talign-items: center;\n\t\t\tgap: 6px;\n\t\t}\n\t\t.content-editor-upload-result-text\n\t\t{\n\t\t\tflex: 1;\n\t\t\tfont-family: monospace;\n\t\t\tfont-size: 0.78rem;\n\t\t\tcolor: #3D3229;\n\t\t\tword-break: break-all;\n\t\t}\n\t\t.content-editor-upload-result-copy\n\t\t{\n\t\t\tflex-shrink: 0;\n\t\t\tbackground: #2E7D74;\n\t\t\tcolor: #FFF;\n\t\t\tborder: none;\n\t\t\tborder-radius: 4px;\n\t\t\tpadding: 4px 10px;\n\t\t\tfont-size: 0.72rem;\n\t\t\tfont-weight: 600;\n\t\t\tcursor: pointer;\n\t\t}\n\t\t.content-editor-upload-result-copy:hover\n\t\t{\n\t\t\tbackground: #3A9E92;\n\t\t}\n\t\t.content-editor-upload-kbd\n\t\t{\n\t\t\tdisplay: inline-block;\n\t\t\tpadding: 1px 5px;\n\t\t\tfont-size: 0.68rem;\n\t\t\tfont-family: monospace;\n\t\t\tbackground: #F0EDE8;\n\t\t\tborder: 1px solid #DDD6CA;\n\t\t\tborder-radius: 3px;\n\t\t\tcolor: #5E5549;\n\t\t}\n\t\t.content-editor-upload-footer\n\t\t{\n\t\t\tpadding: 10px 18px;\n\t\t\tborder-top: 1px solid #EDE9E3;\n\t\t\tfont-size: 0.72rem;\n\t\t\tcolor: #8A7F72;\n\t\t\ttext-align: center;\n\t\t}\n\n\t\t/* File browser row insert button — hidden by default, shown on\n\t\t hover for image file rows via CSS attribute selectors. */\n\t\t.pict-fb-insert-btn\n\t\t{\n\t\t\tdisplay: none;\n\t\t\tposition: absolute;\n\t\t\tright: 6px;\n\t\t\ttop: 50%;\n\t\t\ttransform: translateY(-50%);\n\t\t\tbackground: #2E7D74;\n\t\t\tcolor: #FFF;\n\t\t\tborder: none;\n\t\t\tborder-radius: 4px;\n\t\t\tfont-size: 0.78rem;\n\t\t\tfont-weight: 700;\n\t\t\tline-height: 1;\n\t\t\tpadding: 2px 7px;\n\t\t\tcursor: pointer;\n\t\t}\n\t\t.pict-fb-insert-btn:hover\n\t\t{\n\t\t\tbackground: #3A9E92;\n\t\t}\n\t\t/* Make the row position:relative so the button can be absolutely placed */\n\t\t#ContentEditor-Sidebar-Container .pict-fb-detail-row\n\t\t{\n\t\t\tposition: relative;\n\t\t}\n\t\t/* Show the insert button on hover for image file extensions.\n\t\t CSS attribute selector [data-name$=".ext" i] matches\n\t\t the end of the data-name attribute, case-insensitive. */\n\t\t#ContentEditor-Sidebar-Container .pict-fb-detail-row[data-name$=".png" i]:hover .pict-fb-insert-btn,\n\t\t#ContentEditor-Sidebar-Container .pict-fb-detail-row[data-name$=".jpg" i]:hover .pict-fb-insert-btn,\n\t\t#ContentEditor-Sidebar-Container .pict-fb-detail-row[data-name$=".jpeg" i]:hover .pict-fb-insert-btn,\n\t\t#ContentEditor-Sidebar-Container .pict-fb-detail-row[data-name$=".gif" i]:hover .pict-fb-insert-btn,\n\t\t#ContentEditor-Sidebar-Container .pict-fb-detail-row[data-name$=".webp" i]:hover .pict-fb-insert-btn,\n\t\t#ContentEditor-Sidebar-Container .pict-fb-detail-row[data-name$=".svg" i]:hover .pict-fb-insert-btn,\n\t\t#ContentEditor-Sidebar-Container .pict-fb-detail-row[data-name$=".bmp" i]:hover .pict-fb-insert-btn,\n\t\t#ContentEditor-Sidebar-Container .pict-fb-detail-row[data-name$=".avif" i]:hover .pict-fb-insert-btn,\n\t\t#ContentEditor-Sidebar-Container .pict-fb-detail-row[data-name$=".apng" i]:hover .pict-fb-insert-btn,\n\t\t#ContentEditor-Sidebar-Container .pict-fb-detail-row[data-name$=".ico" i]:hover .pict-fb-insert-btn,\n\t\t#ContentEditor-Sidebar-Container .pict-fb-detail-row[data-name$=".tiff" i]:hover .pict-fb-insert-btn,\n\t\t#ContentEditor-Sidebar-Container .pict-fb-detail-row[data-name$=".tif" i]:hover .pict-fb-insert-btn,\n\t\t#ContentEditor-Sidebar-Container .pict-fb-detail-row[data-name$=".jfif" i]:hover .pict-fb-insert-btn\n\t\t{\n\t\t\tdisplay: inline-block;\n\t\t}\n\n\t\t/* ============================================\n\t\t RESPONSIVE: Tablet / Phone (max-width: 768px)\n\t\t ============================================ */\n\t\t@media (max-width: 768px)\n\t\t{\n\t\t\t/* Prevent horizontal scroll on the whole app */\n\t\t\t#ContentEditor-Application-Container\n\t\t\t{\n\t\t\t\toverflow-x: hidden;\n\t\t\t\twidth: 100%;\n\t\t\t\tmax-width: 100vw;\n\t\t\t}\n\n\t\t\t/* Stack sidebar ABOVE editor instead of side-by-side */\n\t\t\t.content-editor-body\n\t\t\t{\n\t\t\t\tflex-direction: column;\n\t\t\t}\n\n\t\t\t/* Sidebar becomes a horizontal strip at the top */\n\t\t\t.content-editor-sidebar-wrap\n\t\t\t{\n\t\t\t\twidth: 100% !important;\n\t\t\t\tmax-height: 40vh;\n\t\t\t\tflex-shrink: 0;\n\t\t\t\tborder-bottom: 1px solid #DDD6CA;\n\t\t\t\tborder-right: none;\n\t\t\t}\n\n\t\t\t/* Give the Reference and Topics tabs much more room on mobile\n\t\t\t since they contain long scrollable content */\n\t\t\t.content-editor-sidebar-wrap.sidebar-expanded-pane\n\t\t\t{\n\t\t\t\tmax-height: 70vh;\n\t\t\t}\n\n\t\t\t/* When collapsed on mobile, hide the inner content but keep the\n\t\t\t toggle button visible (it\'s positioned below the sidebar strip) */\n\t\t\t.content-editor-sidebar-wrap.collapsed\n\t\t\t{\n\t\t\t\twidth: 100% !important;\n\t\t\t\tmax-height: 0;\n\t\t\t\toverflow: visible;\n\t\t\t}\n\t\t\t.content-editor-sidebar-wrap.collapsed .content-editor-sidebar-inner\n\t\t\t{\n\t\t\t\tdisplay: none;\n\t\t\t}\n\n\t\t\t/* Hide the resize handle (desktop-only interaction) */\n\t\t\t.content-editor-resize-handle\n\t\t\t{\n\t\t\t\tdisplay: none;\n\t\t\t}\n\n\t\t\t/* Reposition the sidebar toggle for horizontal layout —\n\t\t\t place it at the bottom-center of the sidebar strip */\n\t\t\t.content-editor-sidebar-toggle\n\t\t\t{\n\t\t\t\tposition: absolute;\n\t\t\t\ttop: auto;\n\t\t\t\tbottom: -20px;\n\t\t\t\tright: auto;\n\t\t\t\tleft: 50%;\n\t\t\t\ttransform: translateX(-50%);\n\t\t\t\twidth: 28px;\n\t\t\t\theight: 20px;\n\t\t\t\tborder-radius: 0 0 4px 4px;\n\t\t\t\tborder: 1px solid #DDD6CA;\n\t\t\t\tborder-top: none;\n\t\t\t\tz-index: 10;\n\t\t\t}\n\t\t\t.content-editor-sidebar-wrap.collapsed .content-editor-sidebar-toggle\n\t\t\t{\n\t\t\t\tbottom: -20px;\n\t\t\t\tright: auto;\n\t\t\t\tleft: 50%;\n\t\t\t\ttransform: translateX(-50%);\n\t\t\t}\n\n\t\t\t/* Reduce editor container padding (less gutters) */\n\t\t\t#ContentEditor-Editor-Container\n\t\t\t{\n\t\t\t\tpadding: 24px 8px 8px 8px;\n\t\t\t}\n\n\t\t\t/* Reduce binary preview padding */\n\t\t\t.binary-preview-image\n\t\t\t{\n\t\t\t\tpadding: 12px;\n\t\t\t}\n\t\t\t.binary-preview-card\n\t\t\t{\n\t\t\t\tpadding: 12px;\n\t\t\t\tgap: 12px;\n\t\t\t}\n\n\t\t\t/* Upload panel: fill more of the screen */\n\t\t\t.content-editor-upload-panel\n\t\t\t{\n\t\t\t\twidth: 95vw;\n\t\t\t\tmax-width: 95vw;\n\t\t\t}\n\n\t\t}\n\n\t\t/* ============================================\n\t\t RESPONSIVE: Small phone (max-width: 480px)\n\t\t ============================================ */\n\t\t@media (max-width: 480px)\n\t\t{\n\t\t\t/* Even tighter editor padding */\n\t\t\t#ContentEditor-Editor-Container\n\t\t\t{\n\t\t\t\tpadding: 20px 4px 4px 4px;\n\t\t\t}\n\n\t\t\t/* Sidebar gets a smaller max height */\n\t\t\t.content-editor-sidebar-wrap\n\t\t\t{\n\t\t\t\tmax-height: 35vh;\n\t\t\t}\n\t\t\t.content-editor-sidebar-wrap.sidebar-expanded-pane\n\t\t\t{\n\t\t\t\tmax-height: 65vh;\n\t\t\t}\n\t\t}\n\t',Templates:[{Hash:"ContentEditor-Layout-Shell-Template",Template:'\n<div id="ContentEditor-TopBar-Container"></div>\n<div class="content-editor-body">\n\t<div class="content-editor-sidebar-wrap" id="ContentEditor-SidebarWrap" style="width:250px">\n\t\t<div class="content-editor-sidebar-inner">\n\t\t\t<div class="content-editor-sidebar-tabs">\n\t\t\t\t<button class="content-editor-sidebar-tab active" id="ContentEditor-SidebarTab-Files"\n\t\t\t\t\tonclick="{~P~}.views[\'ContentEditor-Layout\'].switchSidebarTab(\'files\')">Files</button>\n\t\t\t\t<button class="content-editor-sidebar-tab" id="ContentEditor-SidebarTab-Reference"\n\t\t\t\t\tonclick="{~P~}.views[\'ContentEditor-Layout\'].switchSidebarTab(\'reference\')">Reference</button>\n\t\t\t\t<button class="content-editor-sidebar-tab" id="ContentEditor-SidebarTab-Topics"\n\t\t\t\t\tonclick="{~P~}.views[\'ContentEditor-Layout\'].switchSidebarTab(\'topics\')">Topics</button>\n\t\t\t\t<button class="content-editor-sidebar-addfile" title="New file"\n\t\t\t\t\tonclick="{~P~}.PictApplication.promptNewFile()">+</button>\n\t\t\t</div>\n\t\t\t<div id="ContentEditor-Sidebar-Container" class="content-editor-sidebar-pane"></div>\n\t\t\t<div id="ContentEditor-SidebarReference-Container" class="content-editor-sidebar-pane" style="display:none"></div>\n\t\t\t<div id="ContentEditor-SidebarTopics-Container" class="content-editor-sidebar-pane" style="display:none"></div>\n\t\t</div>\n\t\t<div class="content-editor-resize-handle" id="ContentEditor-ResizeHandle"></div>\n\t\t<div class="content-editor-sidebar-toggle" id="ContentEditor-SidebarToggle">◀</div>\n\t</div>\n\t<div id="ContentEditor-Editor-Container"></div>\n</div>\n<div class="content-editor-upload-overlay" id="ContentEditor-UploadOverlay"\n\tonclick="{~P~}.views[\'ContentEditor-Layout\'].onUploadOverlayClick(event)">\n\t<div class="content-editor-upload-panel">\n\t\t<div class="content-editor-upload-header">\n\t\t\t<span class="content-editor-upload-title">Upload Image</span>\n\t\t\t<button class="content-editor-upload-close"\n\t\t\t\tonclick="{~P~}.views[\'ContentEditor-Layout\'].toggleUploadForm()">×</button>\n\t\t</div>\n\t\t<div class="content-editor-upload-body">\n\t\t\t<div class="content-editor-upload-dropzone" id="ContentEditor-UploadDropzone"\n\t\t\t\tonclick="document.getElementById(\'ContentEditor-UploadFileInput\').click()">\n\t\t\t\t<div class="content-editor-upload-dropzone-icon">📷</div>\n\t\t\t\t<div class="content-editor-upload-dropzone-text">Drop an image here or click to browse</div>\n\t\t\t\t<div class="content-editor-upload-dropzone-hint">PNG, JPG, GIF, WebP, SVG, BMP</div>\n\t\t\t</div>\n\t\t\t<input type="file" class="content-editor-upload-file-input" id="ContentEditor-UploadFileInput"\n\t\t\t\taccept="image/png,image/jpeg,image/gif,image/webp,image/svg+xml,image/bmp"\n\t\t\t\tonchange="{~P~}.views[\'ContentEditor-Layout\'].onUploadFileSelected(this)">\n\t\t\t<div class="content-editor-upload-status" id="ContentEditor-UploadStatus"></div>\n\t\t\t<div id="ContentEditor-UploadResult"></div>\n\t\t</div>\n\t\t<div class="content-editor-upload-footer">\n\t\t\t<span class="content-editor-upload-kbd">F3</span> or\n\t\t\t<span class="content-editor-upload-kbd">Ctrl+Shift+U</span> to toggle\n\t\t</div>\n\t</div>\n</div>\n'}],Renderables:[{RenderableHash:"ContentEditor-Layout-Shell",TemplateHash:"ContentEditor-Layout-Shell-Template",DestinationAddress:"#ContentEditor-Application-Container",RenderMethod:"replace"}]}},{"pict-view":88}],109:[function(t,e,n){const i=t("pict-section-markdowneditor");e.exports=class extends i{constructor(t,e,n){super(t,e,n)}onImageUpload(t,e,n){let i=this.pict.providers["ContentEditor-Provider"];return!!i&&(i.uploadImage(t,(t,e)=>{t?n(t):n(null,e)}),!0)}customConfigureExtensions(t,e){if(this.pict.AppData.ContentEditor&&this.pict.AppData.ContentEditor.MarkdownWordWrap){let e=this._codeMirrorModules;e&&e.EditorView&&e.EditorView.lineWrapping&&t.push(e.EditorView.lineWrapping)}return t}onContentChange(t,e){this.pict.PictApplication&&(this.pict.PictApplication.markDirty(),this.pict.PictApplication.updateStats())}},e.exports.default_configuration={ViewIdentifier:"ContentEditor-MarkdownEditor",DefaultRenderable:"MarkdownEditor-Wrap",DefaultDestinationAddress:"#ContentEditor-Editor-Container",TargetElementAddress:"#ContentEditor-Editor-Container",ContentDataAddress:"AppData.ContentEditor.Document.Segments",ReadOnly:!1,EnableRichPreview:!0,AutoRender:!1,Renderables:[{RenderableHash:"MarkdownEditor-Wrap",TemplateHash:"MarkdownEditor-Container",DestinationAddress:"#ContentEditor-Editor-Container"}]}},{"pict-section-markdowneditor":86}],110:[function(t,e,n){const i=t("pict-view"),o={ViewIdentifier:"ContentEditor-MarkdownReference",DefaultRenderable:"ContentEditor-MarkdownReference-Display",DefaultDestinationAddress:"#ContentEditor-SidebarReference-Container",AutoRender:!1,CSS:"\n\t\t.md-ref-container\n\t\t{\n\t\t\tdisplay: flex;\n\t\t\tflex-direction: column;\n\t\t\theight: 100%;\n\t\t\tbackground: #FAF8F4;\n\t\t}\n\t\t.md-ref-search-bar\n\t\t{\n\t\t\tposition: sticky;\n\t\t\ttop: 0;\n\t\t\tz-index: 5;\n\t\t\tdisplay: flex;\n\t\t\talign-items: center;\n\t\t\tgap: 4px;\n\t\t\tpadding: 6px 8px;\n\t\t\tbackground: #F5F0EA;\n\t\t\tborder-bottom: 1px solid #DDD6CA;\n\t\t\tflex-shrink: 0;\n\t\t}\n\t\t.md-ref-search-input\n\t\t{\n\t\t\tflex: 1;\n\t\t\tmin-width: 0;\n\t\t\tpadding: 5px 8px;\n\t\t\tborder: 1px solid #DDD6CA;\n\t\t\tborder-radius: 4px;\n\t\t\tfont-size: 0.8rem;\n\t\t\tbackground: #FFF;\n\t\t\tcolor: #3D3229;\n\t\t\toutline: none;\n\t\t}\n\t\t.md-ref-search-input:focus\n\t\t{\n\t\t\tborder-color: #2E7D74;\n\t\t}\n\t\t.md-ref-search-nav\n\t\t{\n\t\t\tbackground: transparent;\n\t\t\tborder: 1px solid #DDD6CA;\n\t\t\tborder-radius: 4px;\n\t\t\twidth: 26px;\n\t\t\theight: 26px;\n\t\t\tcursor: pointer;\n\t\t\tcolor: #5E5549;\n\t\t\tfont-size: 0.7rem;\n\t\t\tdisplay: flex;\n\t\t\talign-items: center;\n\t\t\tjustify-content: center;\n\t\t\tflex-shrink: 0;\n\t\t}\n\t\t.md-ref-search-nav:hover\n\t\t{\n\t\t\tbackground: #EDE9E3;\n\t\t}\n\t\t.md-ref-search-nav:disabled\n\t\t{\n\t\t\topacity: 0.3;\n\t\t\tcursor: not-allowed;\n\t\t}\n\t\t.md-ref-search-count\n\t\t{\n\t\t\tfont-size: 0.7rem;\n\t\t\tcolor: #8A7F72;\n\t\t\twhite-space: nowrap;\n\t\t\tmin-width: 32px;\n\t\t\ttext-align: center;\n\t\t\tflex-shrink: 0;\n\t\t}\n\t\t.md-ref-content\n\t\t{\n\t\t\tflex: 1;\n\t\t\toverflow-y: auto;\n\t\t\tpadding: 12px;\n\t\t\tfont-size: 0.82rem;\n\t\t\tline-height: 1.6;\n\t\t\tcolor: #3D3229;\n\t\t}\n\t\t.md-ref-content h2\n\t\t{\n\t\t\tfont-size: 0.95rem;\n\t\t\tmargin: 20px 0 8px 0;\n\t\t\tpadding-bottom: 4px;\n\t\t\tborder-bottom: 1px solid #EDE9E3;\n\t\t\tcolor: #2E7D74;\n\t\t}\n\t\t.md-ref-content h2:first-child\n\t\t{\n\t\t\tmargin-top: 0;\n\t\t}\n\t\t.md-ref-content h3\n\t\t{\n\t\t\tfont-size: 0.85rem;\n\t\t\tmargin: 14px 0 6px 0;\n\t\t\tcolor: #5E5549;\n\t\t}\n\t\t.md-ref-content p\n\t\t{\n\t\t\tmargin: 6px 0;\n\t\t}\n\t\t.md-ref-content code\n\t\t{\n\t\t\tbackground: #F0EDE8;\n\t\t\tpadding: 1px 4px;\n\t\t\tborder-radius: 3px;\n\t\t\tfont-size: 0.78rem;\n\t\t\tfont-family: monospace;\n\t\t}\n\t\t.md-ref-content pre\n\t\t{\n\t\t\tbackground: #F0EDE8;\n\t\t\tborder: 1px solid #DDD6CA;\n\t\t\tborder-radius: 4px;\n\t\t\tpadding: 8px 10px;\n\t\t\toverflow-x: auto;\n\t\t\tfont-size: 0.76rem;\n\t\t\tline-height: 1.5;\n\t\t\tmargin: 6px 0;\n\t\t\tposition: relative;\n\t\t}\n\t\t.md-ref-content pre code\n\t\t{\n\t\t\tbackground: none;\n\t\t\tpadding: 0;\n\t\t\tfont-size: inherit;\n\t\t}\n\t\t.md-ref-copy-btn\n\t\t{\n\t\t\tposition: absolute;\n\t\t\ttop: 4px;\n\t\t\tright: 4px;\n\t\t\tbackground: #FAF8F4;\n\t\t\tborder: 1px solid #DDD6CA;\n\t\t\tborder-radius: 3px;\n\t\t\tpadding: 2px 6px;\n\t\t\tfont-size: 0.65rem;\n\t\t\tcolor: #8A7F72;\n\t\t\tcursor: pointer;\n\t\t\topacity: 0;\n\t\t\ttransition: opacity 0.15s;\n\t\t}\n\t\t.md-ref-content pre:hover .md-ref-copy-btn\n\t\t{\n\t\t\topacity: 1;\n\t\t}\n\t\t.md-ref-copy-btn:hover\n\t\t{\n\t\t\tbackground: #EDE9E3;\n\t\t\tcolor: #3D3229;\n\t\t}\n\t\t.md-ref-docs-link\n\t\t{\n\t\t\tdisplay: flex;\n\t\t\talign-items: center;\n\t\t\tjustify-content: center;\n\t\t\tgap: 6px;\n\t\t\tpadding: 8px 10px;\n\t\t\tbackground: #F0FAF8;\n\t\t\tborder-bottom: 1px solid #DDD6CA;\n\t\t\tfont-size: 0.8rem;\n\t\t\tfont-weight: 600;\n\t\t\tflex-shrink: 0;\n\t\t}\n\t\t.md-ref-docs-link a\n\t\t{\n\t\t\tcolor: #2E7D74;\n\t\t\ttext-decoration: none;\n\t\t}\n\t\t.md-ref-docs-link a:hover\n\t\t{\n\t\t\ttext-decoration: underline;\n\t\t}\n\t\t/* Search highlight */\n\t\tmark.md-ref-highlight\n\t\t{\n\t\t\tbackground: #FFEAA7;\n\t\t\tcolor: inherit;\n\t\t\tpadding: 0;\n\t\t\tborder-radius: 2px;\n\t\t}\n\t\tmark.md-ref-highlight-active\n\t\t{\n\t\t\tbackground: #E8A94D;\n\t\t\tcolor: #FFF;\n\t\t}\n\t",Templates:[{Hash:"ContentEditor-MarkdownReference-Template",Template:'\n<div class="md-ref-container">\n\t<div class="md-ref-docs-link">\n\t\t<span>📖</span>\n\t\t<a href="/docs/" target="_blank">Full Documentation</a>\n\t</div>\n\t<div class="md-ref-search-bar">\n\t\t<input type="text" class="md-ref-search-input"\n\t\t\tid="ContentEditor-MdRef-SearchInput"\n\t\t\tplaceholder="Search reference..."\n\t\t\toninput="{~P~}.views[\'ContentEditor-MarkdownReference\'].onSearchInput(this.value)"\n\t\t\tonkeydown="{~P~}.views[\'ContentEditor-MarkdownReference\'].onSearchKeydown(event)">\n\t\t<span class="md-ref-search-count" id="ContentEditor-MdRef-SearchCount"></span>\n\t\t<button class="md-ref-search-nav" id="ContentEditor-MdRef-SearchPrev"\n\t\t\tonclick="{~P~}.views[\'ContentEditor-MarkdownReference\'].navigateMatch(-1)" disabled>▲</button>\n\t\t<button class="md-ref-search-nav" id="ContentEditor-MdRef-SearchNext"\n\t\t\tonclick="{~P~}.views[\'ContentEditor-MarkdownReference\'].navigateMatch(1)" disabled>▼</button>\n\t</div>\n\t<div class="md-ref-content" id="ContentEditor-MdRef-Content">\n\n<h2>Headings</h2>\n<p>Use <code>#</code> through <code>######</code> for heading levels 1–6.</p>\n<pre><code># Heading 1\n## Heading 2\n### Heading 3\n#### Heading 4\n##### Heading 5\n###### Heading 6</code><button class="md-ref-copy-btn" onclick="pict.views[\'ContentEditor-MarkdownReference\'].copyCodeBlock(this)">Copy</button></pre>\n\n<h2>Emphasis</h2>\n<p>Bold, italic, strikethrough, and combinations.</p>\n<pre><code>**bold text**\n*italic text*\n***bold and italic***\n~~strikethrough~~\n**bold and ~~strikethrough~~**</code><button class="md-ref-copy-btn" onclick="pict.views[\'ContentEditor-MarkdownReference\'].copyCodeBlock(this)">Copy</button></pre>\n\n<h2>Inline Code</h2>\n<p>Wrap text in backticks for inline code.</p>\n<pre><code>Use `console.log()` to debug.\nUse ``double backticks for `literal` backticks``.</code><button class="md-ref-copy-btn" onclick="pict.views[\'ContentEditor-MarkdownReference\'].copyCodeBlock(this)">Copy</button></pre>\n\n<h2>Links</h2>\n<p>Inline links, reference links, and autolinks.</p>\n<pre><code>[Link text](https://example.com)\n[Link with title](https://example.com "Title text")\n\n[Reference link][1]\n[1]: https://example.com\n\nAutolink: https://example.com\nEmail: user@example.com</code><button class="md-ref-copy-btn" onclick="pict.views[\'ContentEditor-MarkdownReference\'].copyCodeBlock(this)">Copy</button></pre>\n\n<h2>Images</h2>\n<pre><code>\n\n\n[](https://example.com)</code><button class="md-ref-copy-btn" onclick="pict.views[\'ContentEditor-MarkdownReference\'].copyCodeBlock(this)">Copy</button></pre>\n\n<h2>Unordered Lists</h2>\n<p>Use <code>-</code>, <code>*</code>, or <code>+</code> for bullet items.</p>\n<pre><code>- Item one\n- Item two\n - Nested item\n - Another nested\n - Deeply nested\n- Item three</code><button class="md-ref-copy-btn" onclick="pict.views[\'ContentEditor-MarkdownReference\'].copyCodeBlock(this)">Copy</button></pre>\n\n<h2>Ordered Lists</h2>\n<pre><code>1. First item\n2. Second item\n3. Third item\n 1. Sub-item A\n 2. Sub-item B</code><button class="md-ref-copy-btn" onclick="pict.views[\'ContentEditor-MarkdownReference\'].copyCodeBlock(this)">Copy</button></pre>\n\n<h2>Task Lists</h2>\n<pre><code>- [x] Completed task\n- [ ] Incomplete task\n- [ ] Another task</code><button class="md-ref-copy-btn" onclick="pict.views[\'ContentEditor-MarkdownReference\'].copyCodeBlock(this)">Copy</button></pre>\n\n<h2>Blockquotes</h2>\n<pre><code>> This is a blockquote.\n>\n> It can span multiple paragraphs.\n>\n>> Nested blockquote.</code><button class="md-ref-copy-btn" onclick="pict.views[\'ContentEditor-MarkdownReference\'].copyCodeBlock(this)">Copy</button></pre>\n\n<h2>Code Blocks</h2>\n<p>Use triple backticks with an optional language identifier.</p>\n<pre><code>```javascript\nfunction hello()\n{\n console.log("Hello, world!");\n}\n```\n\n```python\ndef hello():\n print("Hello, world!")\n```\n\n```css\n.container {\n display: flex;\n gap: 16px;\n}\n```</code><button class="md-ref-copy-btn" onclick="pict.views[\'ContentEditor-MarkdownReference\'].copyCodeBlock(this)">Copy</button></pre>\n\n<h2>Tables</h2>\n<p>Use pipes and hyphens. Colons control alignment.</p>\n<pre><code>| Left Align | Center Align | Right Align |\n|:-----------|:------------:|------------:|\n| Cell 1 | Cell 2 | Cell 3 |\n| Cell 4 | Cell 5 | Cell 6 |</code><button class="md-ref-copy-btn" onclick="pict.views[\'ContentEditor-MarkdownReference\'].copyCodeBlock(this)">Copy</button></pre>\n\n<h2>Horizontal Rules</h2>\n<p>Three or more hyphens, asterisks, or underscores.</p>\n<pre><code>---\n\n***\n\n___</code><button class="md-ref-copy-btn" onclick="pict.views[\'ContentEditor-MarkdownReference\'].copyCodeBlock(this)">Copy</button></pre>\n\n<h2>Footnotes</h2>\n<pre><code>Here is a footnote reference[^1] and another[^note].\n\n[^1]: This is the footnote content.\n[^note]: Footnotes can have any label.</code><button class="md-ref-copy-btn" onclick="pict.views[\'ContentEditor-MarkdownReference\'].copyCodeBlock(this)">Copy</button></pre>\n\n<h2>HTML in Markdown</h2>\n<p>Raw HTML is allowed in GitHub-Flavored Markdown.</p>\n<pre><code><details>\n<summary>Click to expand</summary>\n\nHidden content here.\n\n</details>\n\n<kbd>Ctrl</kbd> + <kbd>S</kbd> to save.\n\n<mark>Highlighted text</mark>\n\n<sup>superscript</sup> and <sub>subscript</sub></code><button class="md-ref-copy-btn" onclick="pict.views[\'ContentEditor-MarkdownReference\'].copyCodeBlock(this)">Copy</button></pre>\n\n<h2>Escaping Characters</h2>\n<p>Backslash-escape special markdown characters.</p>\n<pre><code>\\*not italic\\*\n\\# not a heading\n\\[not a link\\](url)\n\\`not code\\`</code><button class="md-ref-copy-btn" onclick="pict.views[\'ContentEditor-MarkdownReference\'].copyCodeBlock(this)">Copy</button></pre>\n\n<h2>Line Breaks</h2>\n<pre><code>End a line with two spaces\nto create a line break.\n\nOr use a blank line\n\nfor a new paragraph.</code><button class="md-ref-copy-btn" onclick="pict.views[\'ContentEditor-MarkdownReference\'].copyCodeBlock(this)">Copy</button></pre>\n\n<h2>KaTeX — Inline Math</h2>\n<p>Wrap expressions with single dollar signs for inline math.</p>\n<pre><code>The equation $E = mc^2$ is famous.\n\nThe quadratic formula is $x = \\frac{-b \\pm \\sqrt{b^2 - 4ac}}{2a}$.\n\nGreek letters: $\\alpha$, $\\beta$, $\\gamma$, $\\delta$, $\\theta$, $\\pi$.\n\nSubscripts and superscripts: $x_i^2$ and $a_{n+1}$.</code><button class="md-ref-copy-btn" onclick="pict.views[\'ContentEditor-MarkdownReference\'].copyCodeBlock(this)">Copy</button></pre>\n\n<h2>KaTeX — Display Math</h2>\n<p>Use double dollar signs on their own lines for display (block) math.</p>\n\n<h3>Integral</h3>\n<pre><code>$$\n\\int_{-\\infty}^{\\infty} e^{-x^2} \\, dx = \\sqrt{\\pi}\n$$</code><button class="md-ref-copy-btn" onclick="pict.views[\'ContentEditor-MarkdownReference\'].copyCodeBlock(this)">Copy</button></pre>\n\n<h3>Summation</h3>\n<pre><code>$$\n\\sum_{n=1}^{\\infty} \\frac{1}{n^2} = \\frac{\\pi^2}{6}\n$$</code><button class="md-ref-copy-btn" onclick="pict.views[\'ContentEditor-MarkdownReference\'].copyCodeBlock(this)">Copy</button></pre>\n\n<h3>Matrix</h3>\n<pre><code>$$\n\\begin{bmatrix}\na & b \\\\\nc & d\n\\end{bmatrix}\n\\begin{bmatrix}\nx \\\\\ny\n\\end{bmatrix}\n=\n\\begin{bmatrix}\nax + by \\\\\ncx + dy\n\\end{bmatrix}\n$$</code><button class="md-ref-copy-btn" onclick="pict.views[\'ContentEditor-MarkdownReference\'].copyCodeBlock(this)">Copy</button></pre>\n\n<h3>Aligned Equations</h3>\n<pre><code>$$\n\\begin{aligned}\nf(x) &= x^2 + 2x + 1 \\\\\n &= (x + 1)^2\n\\end{aligned}\n$$</code><button class="md-ref-copy-btn" onclick="pict.views[\'ContentEditor-MarkdownReference\'].copyCodeBlock(this)">Copy</button></pre>\n\n<h3>Cases (Piecewise)</h3>\n<pre><code>$$\nf(x) = \\begin{cases}\nx^2 & \\text{if } x \\geq 0 \\\\\n-x^2 & \\text{if } x < 0\n\\end{cases}\n$$</code><button class="md-ref-copy-btn" onclick="pict.views[\'ContentEditor-MarkdownReference\'].copyCodeBlock(this)">Copy</button></pre>\n\n<h3>Fractions & Limits</h3>\n<pre><code>$$\n\\lim_{x \\to 0} \\frac{\\sin x}{x} = 1\n$$</code><button class="md-ref-copy-btn" onclick="pict.views[\'ContentEditor-MarkdownReference\'].copyCodeBlock(this)">Copy</button></pre>\n\n<h2>Mermaid — Flowchart</h2>\n<pre><code>```mermaid\ngraph TD\n A[Start] --> B{Decision}\n B -->|Yes| C[Do something]\n B -->|No| D[Do something else]\n C --> E[End]\n D --> E\n```</code><button class="md-ref-copy-btn" onclick="pict.views[\'ContentEditor-MarkdownReference\'].copyCodeBlock(this)">Copy</button></pre>\n\n<h2>Mermaid — Sequence Diagram</h2>\n<pre><code>```mermaid\nsequenceDiagram\n participant A as Alice\n participant B as Bob\n A->>B: Hello Bob\n B-->>A: Hi Alice\n A->>B: How are you?\n B-->>A: Great!\n```</code><button class="md-ref-copy-btn" onclick="pict.views[\'ContentEditor-MarkdownReference\'].copyCodeBlock(this)">Copy</button></pre>\n\n<h2>Mermaid — Gantt Chart</h2>\n<pre><code>```mermaid\ngantt\n title Project Timeline\n dateFormat YYYY-MM-DD\n section Phase 1\n Research :a1, 2024-01-01, 30d\n Design :a2, after a1, 20d\n section Phase 2\n Development :b1, after a2, 40d\n Testing :b2, after b1, 15d\n```</code><button class="md-ref-copy-btn" onclick="pict.views[\'ContentEditor-MarkdownReference\'].copyCodeBlock(this)">Copy</button></pre>\n\n<h2>Mermaid — Class Diagram</h2>\n<pre><code>```mermaid\nclassDiagram\n Animal <|-- Duck\n Animal <|-- Fish\n Animal : +int age\n Animal : +String gender\n Animal : +swim()\n Duck : +String beakColor\n Duck : +quack()\n Fish : +int sizeInFeet\n Fish : +canEat()\n```</code><button class="md-ref-copy-btn" onclick="pict.views[\'ContentEditor-MarkdownReference\'].copyCodeBlock(this)">Copy</button></pre>\n\n<h2>Mermaid — State Diagram</h2>\n<pre><code>```mermaid\nstateDiagram-v2\n [*] --> Idle\n Idle --> Processing : Start\n Processing --> Done : Complete\n Processing --> Error : Fail\n Error --> Idle : Reset\n Done --> [*]\n```</code><button class="md-ref-copy-btn" onclick="pict.views[\'ContentEditor-MarkdownReference\'].copyCodeBlock(this)">Copy</button></pre>\n\n\t</div>\n</div>\n'}],Renderables:[{RenderableHash:"ContentEditor-MarkdownReference-Display",TemplateHash:"ContentEditor-MarkdownReference-Template",DestinationAddress:"#ContentEditor-SidebarReference-Container",RenderMethod:"replace"}]};e.exports=class extends i{constructor(t,e,n){super(t,e,n),this._hasRendered=!1,this._searchMatches=[],this._currentMatchIndex=-1,this._originalContent=""}onAfterRender(t,e,n,i){this._hasRendered=!0;let o=document.getElementById("ContentEditor-MdRef-Content");return o&&(this._originalContent=o.innerHTML),this.pict.CSSMap.injectCSS(),super.onAfterRender(t,e,n,i)}copyCodeBlock(t){let e=t.closest("pre");if(!e)return;let n=e.querySelector("code");if(!n)return;let i=n.textContent;navigator.clipboard&&navigator.clipboard.writeText(i).then(()=>{t.textContent="Copied!",setTimeout(()=>{t.textContent="Copy"},1500)})}onSearchInput(t){this._performSearch(t)}onSearchKeydown(t){"Enter"===t.key&&(t.preventDefault(),t.shiftKey?this.navigateMatch(-1):this.navigateMatch(1)),"Escape"===t.key&&(t.target.value="",this._clearSearch())}navigateMatch(t){if(0===this._searchMatches.length)return;this._currentMatchIndex>=0&&this._searchMatches[this._currentMatchIndex]&&this._searchMatches[this._currentMatchIndex].classList.remove("md-ref-highlight-active"),this._currentMatchIndex+=t,this._currentMatchIndex>=this._searchMatches.length&&(this._currentMatchIndex=0),this._currentMatchIndex<0&&(this._currentMatchIndex=this._searchMatches.length-1);let e=this._searchMatches[this._currentMatchIndex];e.classList.add("md-ref-highlight-active"),e.scrollIntoView({behavior:"smooth",block:"center"}),this._updateSearchCount()}_performSearch(t){let e=document.getElementById("ContentEditor-MdRef-Content");if(!e)return;if(e.innerHTML=this._originalContent,this._searchMatches=[],this._currentMatchIndex=-1,!t||t.length<2)return this._updateSearchCount(),void this._updateNavButtons();let n,i=t.toLowerCase(),o=document.createTreeWalker(e,NodeFilter.SHOW_TEXT,null,!1),r=[];for(;n=o.nextNode();)n.nodeValue.toLowerCase().indexOf(i)>=0&&r.push(n);for(let t=0;t<r.length;t++)this._highlightTextNode(r[t],i);this._searchMatches=Array.from(e.querySelectorAll("mark.md-ref-highlight")),this._searchMatches.length>0&&(this._currentMatchIndex=0,this._searchMatches[0].classList.add("md-ref-highlight-active"),this._searchMatches[0].scrollIntoView({behavior:"smooth",block:"center"})),this._updateSearchCount(),this._updateNavButtons()}_highlightTextNode(t,e){let n=t.nodeValue,i=n.toLowerCase(),o=t.parentNode,r=document.createDocumentFragment(),s=0,a=i.indexOf(e);for(;a>=0;){a>s&&r.appendChild(document.createTextNode(n.substring(s,a)));let t=document.createElement("mark");t.className="md-ref-highlight",t.textContent=n.substring(a,a+e.length),r.appendChild(t),s=a+e.length,a=i.indexOf(e,s)}s<n.length&&r.appendChild(document.createTextNode(n.substring(s))),o.replaceChild(r,t)}_updateSearchCount(){let t=document.getElementById("ContentEditor-MdRef-SearchCount");if(t)if(0===this._searchMatches.length){let e=document.getElementById("ContentEditor-MdRef-SearchInput");e&&e.value&&e.value.length>=2?t.textContent="0":t.textContent=""}else t.textContent=this._currentMatchIndex+1+"/"+this._searchMatches.length}_updateNavButtons(){let t=document.getElementById("ContentEditor-MdRef-SearchPrev"),e=document.getElementById("ContentEditor-MdRef-SearchNext"),n=this._searchMatches.length>0;t&&(t.disabled=!n),e&&(e.disabled=!n)}_clearSearch(){let t=document.getElementById("ContentEditor-MdRef-Content");t&&this._originalContent&&(t.innerHTML=this._originalContent),this._searchMatches=[],this._currentMatchIndex=-1,this._updateSearchCount(),this._updateNavButtons()}},e.exports.default_configuration=o},{"pict-view":88}],111:[function(t,e,n){const i=t("pict-view");e.exports=class extends i{constructor(t,e,n){super(t,e,n),this._isOpen=!1}onAfterRender(t,e,n,i){let o=this.pict.AppData.ContentEditor,r=this.pict.ContentAssignment.getElement("#ContentEditor-Setting-MarkdownWordWrap");r&&r[0]&&(r[0].checked=o.MarkdownWordWrap);let s=this.pict.ContentAssignment.getElement("#ContentEditor-Setting-CodeWordWrap");s&&s[0]&&(s[0].checked=o.CodeWordWrap);let a=this.pict.ContentAssignment.getElement("#ContentEditor-Setting-EditingControls");a&&a[0]&&(a[0].checked=o.MarkdownEditingControls);let c=this.pict.ContentAssignment.getElement("#ContentEditor-Setting-ContentPreviewMode");c&&c[0]&&(c[0].value=o.ContentPreviewMode||"off");let l=this.pict.ContentAssignment.getElement("#ContentEditor-Setting-AutoSegment");l&&l[0]&&(l[0].checked=o.AutoSegmentMarkdown);let d=this.pict.ContentAssignment.getElement("#ContentEditor-Setting-SegmentDepth");d&&d[0]&&(d[0].value=String(o.AutoSegmentDepth),d[0].disabled=!o.AutoSegmentMarkdown);let p=this.pict.ContentAssignment.getElement("#ContentEditor-Setting-AutoPreviewImages");p&&p[0]&&(p[0].checked=o.AutoPreviewImages);let h=this.pict.ContentAssignment.getElement("#ContentEditor-Setting-AutoPreviewVideo");h&&h[0]&&(h[0].checked=o.AutoPreviewVideo);let u=this.pict.ContentAssignment.getElement("#ContentEditor-Setting-AutoPreviewAudio");u&&u[0]&&(u[0].checked=o.AutoPreviewAudio);let f=this.pict.ContentAssignment.getElement("#ContentEditor-Setting-ShowHiddenFiles");return f&&f[0]&&(f[0].checked=o.ShowHiddenFiles),super.onAfterRender(t,e,n,i)}togglePanel(){this._isOpen?this.closePanel():this.openPanel()}openPanel(){this._isOpen=!0;let t=this.pict.ContentAssignment.getElement("#ContentEditor-SettingsFlyout"),e=this.pict.ContentAssignment.getElement("#ContentEditor-SettingsOverlay"),n=this.pict.ContentAssignment.getElement("#ContentEditor-SettingsGear");t&&t[0]&&t[0].classList.add("open"),e&&e[0]&&e[0].classList.add("open"),n&&n[0]&&n[0].classList.add("active")}closePanel(){this._isOpen=!1;let t=this.pict.ContentAssignment.getElement("#ContentEditor-SettingsFlyout"),e=this.pict.ContentAssignment.getElement("#ContentEditor-SettingsOverlay"),n=this.pict.ContentAssignment.getElement("#ContentEditor-SettingsGear");t&&t[0]&&t[0].classList.remove("open"),e&&e[0]&&e[0].classList.remove("open"),n&&n[0]&&n[0].classList.remove("active")}onMarkdownWordWrapChanged(t){this.pict.AppData.ContentEditor.MarkdownWordWrap=t,this.pict.PictApplication.saveSettings();let e=this.pict.views["ContentEditor-MarkdownEditor"];if(e&&"markdown"===this.pict.AppData.ContentEditor.ActiveEditor&&e._segmentEditors)for(let n in e._segmentEditors){let i=e._segmentEditors[n];i&&i.contentDOM&&(t?i.contentDOM.classList.add("cm-lineWrapping"):i.contentDOM.classList.remove("cm-lineWrapping"))}}onCodeWordWrapChanged(t){this.pict.AppData.ContentEditor.CodeWordWrap=t,this.pict.PictApplication.saveSettings();let e=this.pict.views["ContentEditor-CodeEditor"];e&&e._editorElement&&"code"===this.pict.AppData.ContentEditor.ActiveEditor&&(t?(e._editorElement.style.whiteSpace="pre-wrap",e._editorElement.style.overflowWrap="break-word"):(e._editorElement.style.whiteSpace="pre",e._editorElement.style.overflowWrap="normal"))}onEditingControlsChanged(t){this.pict.AppData.ContentEditor.MarkdownEditingControls=t,this.pict.PictApplication.saveSettings();let e=this.pict.views["ContentEditor-MarkdownEditor"];e&&"markdown"===this.pict.AppData.ContentEditor.ActiveEditor&&e.toggleControls(t)}onContentPreviewModeChanged(t){this.pict.AppData.ContentEditor.ContentPreviewMode=t,this.pict.PictApplication.saveSettings();let e=this.pict.views["ContentEditor-MarkdownEditor"];e&&"markdown"===this.pict.AppData.ContentEditor.ActiveEditor&&e.setPreviewMode(t)}onAutoSegmentChanged(t){this.pict.AppData.ContentEditor.AutoSegmentMarkdown=t,this.pict.PictApplication.saveSettings();let e=this.pict.ContentAssignment.getElement("#ContentEditor-Setting-SegmentDepth");e&&e[0]&&(e[0].disabled=!t)}onSegmentDepthChanged(t){this.pict.AppData.ContentEditor.AutoSegmentDepth=parseInt(t,10)||1,this.pict.PictApplication.saveSettings()}onAutoPreviewImagesChanged(t){this.pict.AppData.ContentEditor.AutoPreviewImages=t,this.pict.PictApplication.saveSettings()}onAutoPreviewVideoChanged(t){this.pict.AppData.ContentEditor.AutoPreviewVideo=t,this.pict.PictApplication.saveSettings()}onAutoPreviewAudioChanged(t){this.pict.AppData.ContentEditor.AutoPreviewAudio=t,this.pict.PictApplication.saveSettings()}onShowHiddenFilesChanged(t){this.pict.AppData.ContentEditor.ShowHiddenFiles=t,this.pict.PictApplication.saveSettings();let e=this;this.pict.PictApplication.syncHiddenFilesSetting(()=>{e.pict.PictApplication.loadFileList()})}},e.exports.default_configuration={ViewIdentifier:"ContentEditor-SettingsPanel",DefaultRenderable:"ContentEditor-SettingsPanel-Display",DefaultDestinationAddress:"#ContentEditor-SettingsPanel-Container",AutoRender:!1,CSS:"\n\t\t.content-editor-settings-wrap\n\t\t{\n\t\t\tposition: relative;\n\t\t\tdisplay: flex;\n\t\t\talign-items: center;\n\t\t}\n\t\t.content-editor-settings-gear\n\t\t{\n\t\t\tbackground: transparent;\n\t\t\tborder: none;\n\t\t\tcursor: pointer;\n\t\t\tpadding: 6px;\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: #B8AFA4;\n\t\t\ttransition: color 0.15s;\n\t\t}\n\t\t.content-editor-settings-gear:hover,\n\t\t.content-editor-settings-gear.active\n\t\t{\n\t\t\tcolor: #E8E0D4;\n\t\t}\n\t\t.content-editor-settings-gear svg\n\t\t{\n\t\t\twidth: 20px;\n\t\t\theight: 20px;\n\t\t\tfill: currentColor;\n\t\t}\n\t\t/* Flyout overlay — covers viewport to catch clicks outside */\n\t\t.content-editor-settings-overlay\n\t\t{\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.content-editor-settings-overlay.open\n\t\t{\n\t\t\tdisplay: block;\n\t\t}\n\t\t/* Flyout panel */\n\t\t.content-editor-settings-flyout\n\t\t{\n\t\t\tposition: absolute;\n\t\t\ttop: 44px;\n\t\t\tright: 0;\n\t\t\twidth: 270px;\n\t\t\tbackground: #FFF;\n\t\t\tborder: 1px solid #DDD6CA;\n\t\t\tborder-radius: 8px;\n\t\t\tbox-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);\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.content-editor-settings-flyout.open\n\t\t{\n\t\t\topacity: 1;\n\t\t\ttransform: translateY(0);\n\t\t\tpointer-events: auto;\n\t\t}\n\t\t/* Speech bubble arrow */\n\t\t.content-editor-settings-flyout::before\n\t\t{\n\t\t\tcontent: '';\n\t\t\tposition: absolute;\n\t\t\ttop: -7px;\n\t\t\tright: 12px;\n\t\t\twidth: 12px;\n\t\t\theight: 12px;\n\t\t\tbackground: #FFF;\n\t\t\tborder-left: 1px solid #DDD6CA;\n\t\t\tborder-top: 1px solid #DDD6CA;\n\t\t\ttransform: rotate(45deg);\n\t\t}\n\t\t.content-editor-settings-flyout-body\n\t\t{\n\t\t\tpadding: 8px;\n\t\t}\n\t\t.content-editor-settings-flyout-link\n\t\t{\n\t\t\tdisplay: flex;\n\t\t\talign-items: center;\n\t\t\tgap: 8px;\n\t\t\tpadding: 10px 12px;\n\t\t\tborder-radius: 6px;\n\t\t\ttext-decoration: none;\n\t\t\tcolor: #3D3229;\n\t\t\tfont-size: 0.85rem;\n\t\t\tfont-weight: 500;\n\t\t\ttransition: background 0.1s;\n\t\t}\n\t\t.content-editor-settings-flyout-link:hover\n\t\t{\n\t\t\tbackground: #F5F3EE;\n\t\t}\n\t\t.content-editor-settings-flyout-link svg\n\t\t{\n\t\t\twidth: 16px;\n\t\t\theight: 16px;\n\t\t\tflex-shrink: 0;\n\t\t\tfill: #8A7F72;\n\t\t}\n\t\t.content-editor-settings-divider\n\t\t{\n\t\t\theight: 1px;\n\t\t\tbackground: #EDE9E3;\n\t\t\tmargin: 4px 8px;\n\t\t}\n\t\t/* Settings controls */\n\t\t.content-editor-settings-section\n\t\t{\n\t\t\tpadding: 8px 12px;\n\t\t}\n\t\t.content-editor-settings-label\n\t\t{\n\t\t\tfont-size: 0.72rem;\n\t\t\tfont-weight: 600;\n\t\t\ttext-transform: uppercase;\n\t\t\tletter-spacing: 0.5px;\n\t\t\tcolor: #8A7F72;\n\t\t\tmargin-bottom: 8px;\n\t\t}\n\t\t.content-editor-settings-row\n\t\t{\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: 6px;\n\t\t}\n\t\t.content-editor-settings-row:last-child\n\t\t{\n\t\t\tmargin-bottom: 0;\n\t\t}\n\t\t.content-editor-settings-checkbox\n\t\t{\n\t\t\twidth: 16px;\n\t\t\theight: 16px;\n\t\t\taccent-color: #2E7D74;\n\t\t\tcursor: pointer;\n\t\t\tflex-shrink: 0;\n\t\t}\n\t\t.content-editor-settings-checkbox-label\n\t\t{\n\t\t\tfont: inherit;\n\t\t\tfont-size: 0.85rem;\n\t\t\tcolor: #3D3229;\n\t\t\tcursor: pointer;\n\t\t\tuser-select: none;\n\t\t}\n\t\t.content-editor-settings-select\n\t\t{\n\t\t\twidth: 140px;\n\t\t\tpadding: 5px 8px;\n\t\t\tborder: 1px solid #DDD6CA;\n\t\t\tborder-radius: 4px;\n\t\t\tbackground: #FFF;\n\t\t\tfont-size: 0.82rem;\n\t\t\tcolor: #3D3229;\n\t\t\tcursor: pointer;\n\t\t}\n\t\t.content-editor-settings-select:disabled\n\t\t{\n\t\t\topacity: 0.45;\n\t\t\tcursor: not-allowed;\n\t\t}\n\t\t.content-editor-settings-select-label\n\t\t{\n\t\t\tfont-size: 0.82rem;\n\t\t\tcolor: #5E5549;\n\t\t\twhite-space: nowrap;\n\t\t}\n\n\t\t/* ============================================\n\t\t RESPONSIVE: Tablet / Phone (max-width: 768px)\n\t\t ============================================ */\n\t\t@media (max-width: 768px)\n\t\t{\n\t\t\t/* Settings flyout: position from left edge for more room */\n\t\t\t.content-editor-settings-flyout\n\t\t\t{\n\t\t\t\tright: -8px;\n\t\t\t\twidth: 260px;\n\t\t\t}\n\t\t}\n\n\t\t/* ============================================\n\t\t RESPONSIVE: Small phone (max-width: 480px)\n\t\t ============================================ */\n\t\t@media (max-width: 480px)\n\t\t{\n\t\t\t/* Full-width settings flyout on small phones */\n\t\t\t.content-editor-settings-flyout\n\t\t\t{\n\t\t\t\tposition: fixed;\n\t\t\t\ttop: 48px;\n\t\t\t\tright: 0;\n\t\t\t\tleft: 0;\n\t\t\t\twidth: 100%;\n\t\t\t\tborder-radius: 0 0 8px 8px;\n\t\t\t}\n\t\t\t.content-editor-settings-flyout::before\n\t\t\t{\n\t\t\t\tdisplay: none;\n\t\t\t}\n\t\t}\n\t",Templates:[{Hash:"ContentEditor-SettingsPanel-Template",Template:'\n<div class="content-editor-settings-wrap">\n\t<button class="content-editor-settings-gear" id="ContentEditor-SettingsGear"\n\t\tonclick="{~P~}.views[\'ContentEditor-SettingsPanel\'].togglePanel()">\n\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</button>\n\t<div class="content-editor-settings-overlay" id="ContentEditor-SettingsOverlay"\n\t\tonclick="{~P~}.views[\'ContentEditor-SettingsPanel\'].closePanel()"></div>\n\t<div class="content-editor-settings-flyout" id="ContentEditor-SettingsFlyout">\n\t\t<div class="content-editor-settings-flyout-body">\n\t\t\t<a class="content-editor-settings-flyout-link"\n\t\t\t\thref="/preview.html{~D:AppData.ContentEditor.ViewerHash~}" target="_blank">\n\t\t\t\t<svg viewBox="0 0 24 24"><path d="M12 4.5C7 4.5 2.73 7.61 1 12c1.73 4.39 6 7.5 11 7.5s9.27-3.11 11-7.5c-1.73-4.39-6-7.5-11-7.5zM12 17c-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5-2.24 5-5 5zm0-8c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3z"/></svg>\n\t\t\t\tDocuserve Preview\n\t\t\t</a>\n\t\t\t<div class="content-editor-settings-divider"></div>\n\t\t\t<div class="content-editor-settings-section">\n\t\t\t\t<div class="content-editor-settings-label">Word Wrap</div>\n\t\t\t\t<div class="content-editor-settings-row">\n\t\t\t\t\t<label class="content-editor-settings-checkbox-label"\n\t\t\t\t\t\tfor="ContentEditor-Setting-MarkdownWordWrap">Markdown Word Wrap</label>\n\t\t\t\t\t<input type="checkbox" class="content-editor-settings-checkbox"\n\t\t\t\t\t\tid="ContentEditor-Setting-MarkdownWordWrap"\n\t\t\t\t\t\tonchange="{~P~}.views[\'ContentEditor-SettingsPanel\'].onMarkdownWordWrapChanged(this.checked)">\n\t\t\t\t</div>\n\t\t\t\t<div class="content-editor-settings-row">\n\t\t\t\t\t<label class="content-editor-settings-checkbox-label"\n\t\t\t\t\t\tfor="ContentEditor-Setting-CodeWordWrap">Code Word Wrap</label>\n\t\t\t\t\t<input type="checkbox" class="content-editor-settings-checkbox"\n\t\t\t\t\t\tid="ContentEditor-Setting-CodeWordWrap"\n\t\t\t\t\t\tonchange="{~P~}.views[\'ContentEditor-SettingsPanel\'].onCodeWordWrapChanged(this.checked)">\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t\t<div class="content-editor-settings-divider"></div>\n\t\t\t<div class="content-editor-settings-section">\n\t\t\t\t<div class="content-editor-settings-label">Markdown Editor</div>\n\t\t\t\t<div class="content-editor-settings-row">\n\t\t\t\t\t<label class="content-editor-settings-checkbox-label"\n\t\t\t\t\t\tfor="ContentEditor-Setting-EditingControls">Editing Controls</label>\n\t\t\t\t\t<input type="checkbox" class="content-editor-settings-checkbox"\n\t\t\t\t\t\tid="ContentEditor-Setting-EditingControls"\n\t\t\t\t\t\tonchange="{~P~}.views[\'ContentEditor-SettingsPanel\'].onEditingControlsChanged(this.checked)">\n\t\t\t\t</div>\n\t\t\t\t<div class="content-editor-settings-row">\n\t\t\t\t\t<span class="content-editor-settings-select-label">Content Preview</span>\n\t\t\t\t\t<select class="content-editor-settings-select"\n\t\t\t\t\t\tid="ContentEditor-Setting-ContentPreviewMode"\n\t\t\t\t\t\tonchange="{~P~}.views[\'ContentEditor-SettingsPanel\'].onContentPreviewModeChanged(this.value)">\n\t\t\t\t\t\t<option value="off">Off</option>\n\t\t\t\t\t\t<option value="bottom">Underneath</option>\n\t\t\t\t\t\t<option value="side">Beside</option>\n\t\t\t\t\t\t<option value="tabbed">Tab</option>\n\t\t\t\t\t</select>\n\t\t\t\t</div>\n\t\t\t\t<div class="content-editor-settings-row">\n\t\t\t\t\t<label class="content-editor-settings-checkbox-label"\n\t\t\t\t\t\tfor="ContentEditor-Setting-AutoSegment">Auto Segment Markdown</label>\n\t\t\t\t\t<input type="checkbox" class="content-editor-settings-checkbox"\n\t\t\t\t\t\tid="ContentEditor-Setting-AutoSegment"\n\t\t\t\t\t\tonchange="{~P~}.views[\'ContentEditor-SettingsPanel\'].onAutoSegmentChanged(this.checked)">\n\t\t\t\t</div>\n\t\t\t\t<div class="content-editor-settings-row">\n\t\t\t\t\t<span class="content-editor-settings-select-label">Segment Depth</span>\n\t\t\t\t\t<select class="content-editor-settings-select"\n\t\t\t\t\t\tid="ContentEditor-Setting-SegmentDepth"\n\t\t\t\t\t\tdisabled\n\t\t\t\t\t\tonchange="{~P~}.views[\'ContentEditor-SettingsPanel\'].onSegmentDepthChanged(this.value)">\n\t\t\t\t\t\t<option value="1">Depth 1: Blocks</option>\n\t\t\t\t\t\t<option value="2">Depth 2: ##</option>\n\t\t\t\t\t\t<option value="3">Depth 3: ###</option>\n\t\t\t\t\t\t<option value="4">Depth 4: ####</option>\n\t\t\t\t\t\t<option value="5">Depth 5: #####</option>\n\t\t\t\t\t\t<option value="6">Depth 6: ######</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="content-editor-settings-divider"></div>\n\t\t\t<div class="content-editor-settings-section">\n\t\t\t\t<div class="content-editor-settings-label">Media Preview</div>\n\t\t\t\t<div class="content-editor-settings-row">\n\t\t\t\t\t<label class="content-editor-settings-checkbox-label"\n\t\t\t\t\t\tfor="ContentEditor-Setting-AutoPreviewImages">Auto-Preview Images</label>\n\t\t\t\t\t<input type="checkbox" class="content-editor-settings-checkbox"\n\t\t\t\t\t\tid="ContentEditor-Setting-AutoPreviewImages"\n\t\t\t\t\t\tonchange="{~P~}.views[\'ContentEditor-SettingsPanel\'].onAutoPreviewImagesChanged(this.checked)">\n\t\t\t\t</div>\n\t\t\t\t<div class="content-editor-settings-row">\n\t\t\t\t\t<label class="content-editor-settings-checkbox-label"\n\t\t\t\t\t\tfor="ContentEditor-Setting-AutoPreviewVideo">Auto-Preview Video</label>\n\t\t\t\t\t<input type="checkbox" class="content-editor-settings-checkbox"\n\t\t\t\t\t\tid="ContentEditor-Setting-AutoPreviewVideo"\n\t\t\t\t\t\tonchange="{~P~}.views[\'ContentEditor-SettingsPanel\'].onAutoPreviewVideoChanged(this.checked)">\n\t\t\t\t</div>\n\t\t\t\t<div class="content-editor-settings-row">\n\t\t\t\t\t<label class="content-editor-settings-checkbox-label"\n\t\t\t\t\t\tfor="ContentEditor-Setting-AutoPreviewAudio">Auto-Preview Audio</label>\n\t\t\t\t\t<input type="checkbox" class="content-editor-settings-checkbox"\n\t\t\t\t\t\tid="ContentEditor-Setting-AutoPreviewAudio"\n\t\t\t\t\t\tonchange="{~P~}.views[\'ContentEditor-SettingsPanel\'].onAutoPreviewAudioChanged(this.checked)">\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t\t<div class="content-editor-settings-divider"></div>\n\t\t\t<div class="content-editor-settings-section">\n\t\t\t\t<div class="content-editor-settings-label">File Browser</div>\n\t\t\t\t<div class="content-editor-settings-row">\n\t\t\t\t\t<label class="content-editor-settings-checkbox-label"\n\t\t\t\t\t\tfor="ContentEditor-Setting-ShowHiddenFiles">Show Hidden Files</label>\n\t\t\t\t\t<input type="checkbox" class="content-editor-settings-checkbox"\n\t\t\t\t\t\tid="ContentEditor-Setting-ShowHiddenFiles"\n\t\t\t\t\t\tonchange="{~P~}.views[\'ContentEditor-SettingsPanel\'].onShowHiddenFilesChanged(this.checked)">\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</div>\n\t</div>\n</div>\n'}],Renderables:[{RenderableHash:"ContentEditor-SettingsPanel-Display",TemplateHash:"ContentEditor-SettingsPanel-Template",DestinationAddress:"#ContentEditor-SettingsPanel-Container",RenderMethod:"replace"}]}},{"pict-view":88}],112:[function(t,e,n){const i=t("pict-view");e.exports=class extends i{constructor(t,e,n){super(t,e,n)}onBeforeRender(t,e,n){let i=this.pict.AppData.ContentEditor;if(i.DirtyIndicatorHTML=i.IsDirty?' <span class="content-editor-dirty-indicator">*</span>':"",i.SaveDisabledAttr=!i.CurrentFile||i.IsSaving?"disabled":"",i.SaveVisibilityAttr=i.IsDirty||i.IsSaving||i.SaveStatus?"":'style="display:none"',i.CloseVisibilityAttr=i.CurrentFile?"":'style="display:none"',i.CurrentFile){let t=i.CurrentFile.replace(/\.md$/,"");i.ViewerHash="#/page/"+t}else i.ViewerHash="";return super.onBeforeRender(t,e,n)}onAfterRender(t,e,n,i){let o=this.pict.views["ContentEditor-SettingsPanel"];return o&&o.render(),super.onAfterRender(t,e,n,i)}},e.exports.default_configuration={ViewIdentifier:"ContentEditor-TopBar",DefaultRenderable:"ContentEditor-TopBar-Display",DefaultDestinationAddress:"#ContentEditor-TopBar-Container",AutoRender:!1,CSS:"\n\t\t.content-editor-topbar\n\t\t{\n\t\t\tdisplay: flex;\n\t\t\talign-items: center;\n\t\t\tbackground: #3D3229;\n\t\t\tcolor: #E8E0D4;\n\t\t\tpadding: 0;\n\t\t\theight: 48px;\n\t\t\tborder-bottom: 3px solid #2E7D74;\n\t\t\tposition: relative;\n\t\t}\n\t\t.content-editor-topbar-brand\n\t\t{\n\t\t\tpadding: 0 16px;\n\t\t\tfont-size: 1rem;\n\t\t\tfont-weight: 600;\n\t\t\tcolor: #E8E0D4;\n\t\t\twhite-space: nowrap;\n\t\t\tflex-shrink: 0;\n\t\t}\n\t\t/* Centered file name — absolutely positioned so it stays\n\t\t centered in the full bar regardless of left/right content */\n\t\t.content-editor-topbar-file\n\t\t{\n\t\t\tposition: absolute;\n\t\t\tleft: 50%;\n\t\t\ttransform: translateX(-50%);\n\t\t\tmax-width: 50%;\n\t\t\ttext-align: center;\n\t\t\toverflow: hidden;\n\t\t\ttext-overflow: ellipsis;\n\t\t\twhite-space: nowrap;\n\t\t\tpointer-events: none;\n\t\t}\n\t\t.content-editor-topbar-filename\n\t\t{\n\t\t\tfont-size: 0.9rem;\n\t\t\tfont-weight: 500;\n\t\t\tcolor: #E8E0D4;\n\t\t\tletter-spacing: 0.2px;\n\t\t}\n\t\t.content-editor-topbar-file .content-editor-dirty-indicator\n\t\t{\n\t\t\tcolor: #E8A94D;\n\t\t\tfont-weight: bold;\n\t\t}\n\t\t/* Left spacer pushes actions to the right */\n\t\t.content-editor-topbar-spacer\n\t\t{\n\t\t\tflex: 1;\n\t\t}\n\t\t.content-editor-topbar-status\n\t\t{\n\t\t\tpadding: 0 12px;\n\t\t\tfont-size: 0.78rem;\n\t\t\tflex-shrink: 0;\n\t\t}\n\t\t.content-editor-status-saving\n\t\t{\n\t\t\tcolor: #E8A94D;\n\t\t}\n\t\t.content-editor-status-saved\n\t\t{\n\t\t\tcolor: #7BC47F;\n\t\t}\n\t\t.content-editor-status-error\n\t\t{\n\t\t\tcolor: #D9534F;\n\t\t}\n\t\t.content-editor-topbar-stats\n\t\t{\n\t\t\tfont-size: 0.72rem;\n\t\t\tcolor: #8A7F72;\n\t\t\twhite-space: nowrap;\n\t\t\tpadding: 0 8px;\n\t\t\tflex-shrink: 0;\n\t\t\tletter-spacing: 0.2px;\n\t\t}\n\t\t.content-editor-topbar-actions\n\t\t{\n\t\t\tdisplay: flex;\n\t\t\talign-items: center;\n\t\t\tgap: 8px;\n\t\t\tpadding: 0 12px;\n\t\t\tflex-shrink: 0;\n\t\t}\n\t\t.content-editor-topbar-btn\n\t\t{\n\t\t\tpadding: 6px 14px;\n\t\t\tborder: none;\n\t\t\tborder-radius: 4px;\n\t\t\tcursor: pointer;\n\t\t\tfont-size: 0.8rem;\n\t\t\tfont-weight: 600;\n\t\t}\n\t\t.content-editor-topbar-btn-save\n\t\t{\n\t\t\tbackground: #2E7D74;\n\t\t\tcolor: #FFF;\n\t\t}\n\t\t.content-editor-topbar-btn-save:hover\n\t\t{\n\t\t\tbackground: #3A9E92;\n\t\t}\n\t\t.content-editor-topbar-btn-save:disabled\n\t\t{\n\t\t\tbackground: #5E5549;\n\t\t\tcolor: #8A7F72;\n\t\t\tcursor: not-allowed;\n\t\t}\n\t\t.content-editor-topbar-btn-close\n\t\t{\n\t\t\tbackground: transparent;\n\t\t\tcolor: #B8AFA4;\n\t\t\tborder: 1px solid #5E5549;\n\t\t}\n\t\t.content-editor-topbar-btn-close:hover\n\t\t{\n\t\t\tcolor: #E8E0D4;\n\t\t\tborder-color: #8A7F72;\n\t\t\tbackground: rgba(255, 255, 255, 0.05);\n\t\t}\n\t\t/* Close-file confirmation overlay */\n\t\t.content-editor-confirm-overlay\n\t\t{\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: 1099;\n\t\t\tbackground: rgba(0, 0, 0, 0.35);\n\t\t}\n\t\t.content-editor-confirm-overlay.open\n\t\t{\n\t\t\tdisplay: flex;\n\t\t\talign-items: center;\n\t\t\tjustify-content: center;\n\t\t}\n\t\t.content-editor-confirm-panel\n\t\t{\n\t\t\tbackground: #FFF;\n\t\t\tborder: 1px solid #DDD6CA;\n\t\t\tborder-radius: 10px;\n\t\t\tbox-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);\n\t\t\twidth: 360px;\n\t\t\tmax-width: 90vw;\n\t\t\toverflow: hidden;\n\t\t}\n\t\t.content-editor-confirm-body\n\t\t{\n\t\t\tpadding: 24px 22px 16px;\n\t\t\ttext-align: center;\n\t\t}\n\t\t.content-editor-confirm-icon\n\t\t{\n\t\t\tfont-size: 2rem;\n\t\t\tmargin-bottom: 8px;\n\t\t\tcolor: #E8A94D;\n\t\t}\n\t\t.content-editor-confirm-title\n\t\t{\n\t\t\tfont-size: 0.95rem;\n\t\t\tfont-weight: 600;\n\t\t\tcolor: #3D3229;\n\t\t\tmargin-bottom: 6px;\n\t\t}\n\t\t.content-editor-confirm-message\n\t\t{\n\t\t\tfont-size: 0.82rem;\n\t\t\tcolor: #5E5549;\n\t\t\tmargin-bottom: 16px;\n\t\t\tline-height: 1.5;\n\t\t}\n\t\t.content-editor-confirm-actions\n\t\t{\n\t\t\tdisplay: flex;\n\t\t\tgap: 10px;\n\t\t\tjustify-content: center;\n\t\t}\n\t\t.content-editor-confirm-btn\n\t\t{\n\t\t\tpadding: 8px 20px;\n\t\t\tborder: none;\n\t\t\tborder-radius: 5px;\n\t\t\tfont-size: 0.82rem;\n\t\t\tfont-weight: 600;\n\t\t\tcursor: pointer;\n\t\t}\n\t\t.content-editor-confirm-btn-discard\n\t\t{\n\t\t\tbackground: #D9534F;\n\t\t\tcolor: #FFF;\n\t\t}\n\t\t.content-editor-confirm-btn-discard:hover\n\t\t{\n\t\t\tbackground: #C9302C;\n\t\t}\n\t\t.content-editor-confirm-btn-cancel\n\t\t{\n\t\t\tbackground: transparent;\n\t\t\tcolor: #5E5549;\n\t\t\tborder: 1px solid #DDD6CA;\n\t\t}\n\t\t.content-editor-confirm-btn-cancel:hover\n\t\t{\n\t\t\tbackground: #F0EDE8;\n\t\t}\n\t\t.content-editor-confirm-footer\n\t\t{\n\t\t\tpadding: 10px 22px;\n\t\t\tborder-top: 1px solid #EDE9E3;\n\t\t\tfont-size: 0.72rem;\n\t\t\tcolor: #8A7F72;\n\t\t\ttext-align: center;\n\t\t}\n\t\t.content-editor-confirm-kbd\n\t\t{\n\t\t\tdisplay: inline-block;\n\t\t\tpadding: 1px 5px;\n\t\t\tfont-size: 0.68rem;\n\t\t\tfont-family: monospace;\n\t\t\tbackground: #F0EDE8;\n\t\t\tborder: 1px solid #DDD6CA;\n\t\t\tborder-radius: 3px;\n\t\t\tcolor: #5E5549;\n\t\t}\n\n\t\t/* ============================================\n\t\t RESPONSIVE: Tablet / Phone (max-width: 768px)\n\t\t ============================================ */\n\t\t@media (max-width: 768px)\n\t\t{\n\t\t\t.content-editor-topbar\n\t\t\t{\n\t\t\t\theight: auto;\n\t\t\t\tmin-height: 44px;\n\t\t\t\tflex-wrap: wrap;\n\t\t\t\tpadding: 4px 0;\n\t\t\t}\n\n\t\t\t/* Brand text: shrink */\n\t\t\t.content-editor-topbar-brand\n\t\t\t{\n\t\t\t\tpadding: 0 8px;\n\t\t\t\tfont-size: 0.85rem;\n\t\t\t}\n\n\t\t\t/* File name: switch from absolute centering to flow layout */\n\t\t\t.content-editor-topbar-file\n\t\t\t{\n\t\t\t\tposition: static;\n\t\t\t\ttransform: none;\n\t\t\t\tmax-width: none;\n\t\t\t\tflex: 1;\n\t\t\t\tmin-width: 0;\n\t\t\t\tpadding: 0 4px;\n\t\t\t}\n\n\t\t\t/* Hide the spacer (not needed when file is in-flow) */\n\t\t\t.content-editor-topbar-spacer\n\t\t\t{\n\t\t\t\tdisplay: none;\n\t\t\t}\n\n\t\t\t/* Hide word/line count stats on mobile to save space */\n\t\t\t.content-editor-topbar-stats\n\t\t\t{\n\t\t\t\tdisplay: none;\n\t\t\t}\n\n\t\t\t/* Compact action buttons */\n\t\t\t.content-editor-topbar-actions\n\t\t\t{\n\t\t\t\tgap: 4px;\n\t\t\t\tpadding: 0 6px;\n\t\t\t}\n\n\t\t\t.content-editor-topbar-btn\n\t\t\t{\n\t\t\t\tpadding: 5px 10px;\n\t\t\t\tfont-size: 0.75rem;\n\t\t\t}\n\n\t\t\t/* Status text */\n\t\t\t.content-editor-topbar-status\n\t\t\t{\n\t\t\t\tpadding: 0 6px;\n\t\t\t\tfont-size: 0.72rem;\n\t\t\t}\n\n\t\t\t/* Confirm dialog: tighter for mobile */\n\t\t\t.content-editor-confirm-panel\n\t\t\t{\n\t\t\t\twidth: 95vw;\n\t\t\t\tmax-width: 95vw;\n\t\t\t}\n\t\t}\n\n\t\t/* ============================================\n\t\t RESPONSIVE: Small phone (max-width: 480px)\n\t\t ============================================ */\n\t\t@media (max-width: 480px)\n\t\t{\n\t\t\t/* Hide brand text entirely on very small screens */\n\t\t\t.content-editor-topbar-brand\n\t\t\t{\n\t\t\t\tdisplay: none;\n\t\t\t}\n\n\t\t\t.content-editor-topbar-filename\n\t\t\t{\n\t\t\t\tfont-size: 0.8rem;\n\t\t\t}\n\n\t\t\t.content-editor-topbar-actions\n\t\t\t{\n\t\t\t\tpadding: 0 4px;\n\t\t\t}\n\t\t}\n\t",Templates:[{Hash:"ContentEditor-TopBar-Template",Template:'\n<div class="content-editor-topbar">\n\t<div class="content-editor-topbar-brand">Content Editor</div>\n\t<div class="content-editor-topbar-file">\n\t\t<span class="content-editor-topbar-filename">{~D:AppData.ContentEditor.CurrentFile~}</span>{~D:AppData.ContentEditor.DirtyIndicatorHTML~}\n\t</div>\n\t<div class="content-editor-topbar-spacer"></div>\n\t<div class="content-editor-topbar-status {~D:AppData.ContentEditor.SaveStatusClass~}">\n\t\t{~D:AppData.ContentEditor.SaveStatus~}\n\t</div>\n\t<span class="content-editor-topbar-stats" id="ContentEditor-Stats"></span>\n\t<div class="content-editor-topbar-actions">\n\t\t<button class="content-editor-topbar-btn content-editor-topbar-btn-save"\n\t\t\tonclick="{~P~}.PictApplication.saveCurrentFile()"\n\t\t\t{~D:AppData.ContentEditor.SaveDisabledAttr~} {~D:AppData.ContentEditor.SaveVisibilityAttr~}>Save</button>\n\t\t<button class="content-editor-topbar-btn content-editor-topbar-btn-close"\n\t\t\tonclick="{~P~}.PictApplication.closeCurrentFile()"\n\t\t\t{~D:AppData.ContentEditor.CloseVisibilityAttr~}>Close</button>\n\t\t<div id="ContentEditor-SettingsPanel-Container"></div>\n\t</div>\n</div>\n<div class="content-editor-confirm-overlay" id="ContentEditor-ConfirmOverlay"\n\tonclick="{~P~}.PictApplication.cancelCloseFile()">\n\t<div class="content-editor-confirm-panel" onclick="event.stopPropagation()">\n\t\t<div class="content-editor-confirm-body">\n\t\t\t<div class="content-editor-confirm-icon">⚠</div>\n\t\t\t<div class="content-editor-confirm-title">Unsaved Changes</div>\n\t\t\t<div class="content-editor-confirm-message">\n\t\t\t\tThis file has unsaved changes.<br>Close without saving?\n\t\t\t</div>\n\t\t\t<div class="content-editor-confirm-actions">\n\t\t\t\t<button class="content-editor-confirm-btn content-editor-confirm-btn-discard"\n\t\t\t\t\tonclick="{~P~}.PictApplication.confirmCloseFile()">Discard & Close</button>\n\t\t\t\t<button class="content-editor-confirm-btn content-editor-confirm-btn-cancel"\n\t\t\t\t\tonclick="{~P~}.PictApplication.cancelCloseFile()">Cancel</button>\n\t\t\t</div>\n\t\t</div>\n\t\t<div class="content-editor-confirm-footer">\n\t\t\t<span class="content-editor-confirm-kbd">Y</span> to discard ·\n\t\t\t<span class="content-editor-confirm-kbd">N</span> or\n\t\t\t<span class="content-editor-confirm-kbd">Esc</span> to cancel\n\t\t</div>\n\t</div>\n</div>\n'}],Renderables:[{RenderableHash:"ContentEditor-TopBar-Display",TemplateHash:"ContentEditor-TopBar-Template",DestinationAddress:"#ContentEditor-TopBar-Container",RenderMethod:"replace"}]}},{"pict-view":88}],113:[function(t,e,n){const i=t("pict-view");e.exports=class extends i{constructor(t,e,n){super(t,e,n),this._topics={},this._topicsFilePath="",this._hasRendered=!1,this._editingTopicCode=null}onAfterRender(){this._hasRendered=!0,this.pict.CSSMap.injectCSS(),this._topicsFilePath?(this._updateHeaderTitle(),this.renderTopicList()):this._showEmptyState()}loadTopicsFile(t,e){let n="function"==typeof e?e:()=>{},i=this;if(!t)return n("No path specified");let o=this.pict.providers["ContentEditor-Provider"];if(!o)return n("Provider not available");o.loadFile(t,(e,o)=>{if(e)return i._topics={},i._topicsFilePath="",i._hasRendered&&i._showEmptyState(),n(e);try{let t=JSON.parse(o);"object"!=typeof t||null===t||Array.isArray(t)?i._topics={}:i._topics=t}catch(t){i._topics={},i.log.warn("ContentEditor-Topics: Failed to parse topics JSON: "+t.message)}return i._topicsFilePath=t,i.pict.AppData.ContentEditor.TopicsFilePath=t,i.pict.PictApplication.saveSettings(),i._hasRendered&&(i._updateHeaderTitle(),i.renderTopicList(),i._showFooter(!0)),n(null)})}saveTopicsFile(t){let e="function"==typeof t?t:()=>{};if(!this._topicsFilePath)return e("No topics file loaded");let n=this.pict.providers["ContentEditor-Provider"];if(!n)return e("Provider not available");let i=JSON.stringify(this._topics,null,"\t");n.saveFile(this._topicsFilePath,i,e)}closeTopicsFile(){this._topics={},this._topicsFilePath="",this._editingTopicCode=null,this.pict.AppData.ContentEditor.TopicsFilePath="",this.pict.PictApplication.saveSettings(),this._hasRendered&&this._showEmptyState()}addTopic(t){if(!this._topicsFilePath)return void this._createDefaultTopicsFile(()=>{this.addTopic(t)});let e=t||{},n=e.TopicCode||this._generateUniqueCode("New-Topic"),i={TopicCode:n,TopicHelpFilePath:e.TopicHelpFilePath||"",TopicTitle:e.TopicTitle||""};"number"==typeof e.RelevantMarkdownLine&&(i.RelevantMarkdownLine=e.RelevantMarkdownLine),this._topics[n]=i;let o=this;this.saveTopicsFile(()=>{o.renderTopicList(),o.startEditTopic(n)})}removeTopic(t){if(!t||!this._topics[t])return;if(!confirm('Remove topic "'+t+'"?'))return;delete this._topics[t],this._editingTopicCode=null;let e=this;this.saveTopicsFile(()=>{e.renderTopicList()})}startEditTopic(t){if(!t||!this._topics[t])return;this._editingTopicCode=t,this.renderTopicList();let e=document.getElementById("topics-edit-code");e&&(e.focus(),e.select())}saveEditTopic(t){if(!t||!this._topics[t])return;let e=document.getElementById("topics-edit-code"),n=document.getElementById("topics-edit-title"),i=document.getElementById("topics-edit-path"),o=document.getElementById("topics-edit-line");if(!e)return;let r=e.value.trim(),s=n?n.value.trim():"",a=i?i.value.trim():"",c=o?parseInt(o.value,10):NaN;if(!r)return void(e.style.borderColor="#D9534F");if(r!==t&&this._topics[r])return e.style.borderColor="#D9534F",void alert('A topic with code "'+r+'" already exists.');r!==t&&delete this._topics[t];let l={TopicCode:r,TopicHelpFilePath:a,TopicTitle:s};!isNaN(c)&&c>0&&(l.RelevantMarkdownLine=c),this._topics[r]=l,this._editingTopicCode=null;let d=this;this.saveTopicsFile(()=>{d.renderTopicList()})}cancelEditTopic(){this._editingTopicCode=null,this.renderTopicList()}navigateToTopic(t){if(!t||!this._topics[t])return;let e=this._topics[t],n=e.TopicHelpFilePath;if(n&&(this.pict.PictApplication.navigateToFile(n),"number"==typeof e.RelevantMarkdownLine&&e.RelevantMarkdownLine>0)){let t=e.RelevantMarkdownLine;setTimeout(()=>{let e=this.pict.views["ContentEditor-MarkdownEditor"];if(e&&e._segmentEditors){let n=0;for(let i in e._segmentEditors){let o=e._segmentEditors[i];if(o&&o.state&&o.state.doc){let e=o.state.doc.lines;if(n+e>=t){let i=t-n;i<1&&(i=1),i>e&&(i=e);let r=o.state.doc.line(i);o.dispatch({selection:{anchor:r.from},scrollIntoView:!0}),o.focus();break}n+=e}}}},500)}}renderTopicList(){let t=document.getElementById("ContentEditor-Topics-List");if(!t)return;let e=Object.keys(this._topics);if(0===e.length)return void(t.innerHTML='<div style="padding:16px;text-align:center;color:#8A7F72;font-size:0.78rem;">No topics yet. Click "+ Add Topic" to create one.</div>');let n="";for(let t=0;t<e.length;t++){let i=e[t],o=this._topics[i];this._editingTopicCode===i?n+=this._buildEditFormHTML(o):n+=this._buildTopicRowHTML(o)}t.innerHTML=n}_buildTopicRowHTML(t){let e=this._escapeHTML(t.TopicCode||""),n=this._escapeHTML(t.TopicTitle||""),i=this._escapeHTML(t.TopicHelpFilePath||""),o="number"==typeof t.RelevantMarkdownLine?" :"+t.RelevantMarkdownLine:"",r=this._escapeAttr(t.TopicCode||""),s="<div class=\"topics-row\" ondblclick=\"pict.views['ContentEditor-Topics'].startEditTopic('"+r+"')\">";return s+='<div class="topics-row-info">',s+='<div class="topics-row-code">'+e+"</div>",n&&(s+='<div class="topics-row-title">'+n+"</div>"),i&&(s+='<div class="topics-row-path">'+i+o+"</div>"),s+="</div>",s+='<div class="topics-row-actions">',s+='<button class="topics-row-btn" title="Edit" onclick="event.stopPropagation();pict.views[\'ContentEditor-Topics\'].startEditTopic(\''+r+"')\">✎</button>",s+='<button class="topics-row-btn topics-row-btn-delete" title="Delete" onclick="event.stopPropagation();pict.views[\'ContentEditor-Topics\'].removeTopic(\''+r+"')\">✖</button>",i&&(s+='<button class="topics-row-btn" title="Go to file" onclick="event.stopPropagation();pict.views[\'ContentEditor-Topics\'].navigateToTopic(\''+r+"')\">→</button>"),s+="</div>",s+="</div>",s}_buildEditFormHTML(t){let e='<div class="topics-edit">';return e+='<div class="topics-edit-field">',e+='<label class="topics-edit-label">Topic Code</label>',e+='<input class="topics-edit-input" id="topics-edit-code" type="text" value="'+this._escapeAttr(t.TopicCode||"")+'" placeholder="My-Topic-Code">',e+="</div>",e+='<div class="topics-edit-field">',e+='<label class="topics-edit-label">Title</label>',e+='<input class="topics-edit-input" id="topics-edit-title" type="text" value="'+this._escapeAttr(t.TopicTitle||"")+'" placeholder="Topic title">',e+="</div>",e+='<div class="topics-edit-field">',e+='<label class="topics-edit-label">Help File Path</label>',e+='<input class="topics-edit-input" id="topics-edit-path" type="text" value="'+this._escapeAttr(t.TopicHelpFilePath||"")+'" placeholder="path/to/file.md">',e+="</div>",e+='<div class="topics-edit-field">',e+='<label class="topics-edit-label">Line Number (optional)</label>',e+='<input class="topics-edit-input" id="topics-edit-line" type="number" value="'+("number"==typeof t.RelevantMarkdownLine?t.RelevantMarkdownLine:"")+'" placeholder="e.g. 23" min="1">',e+="</div>",e+='<div class="topics-edit-actions">',e+="<button class=\"topics-edit-save\" onclick=\"pict.views['ContentEditor-Topics'].saveEditTopic('"+this._escapeAttr(t.TopicCode||"")+"')\">Save</button>",e+='<button class="topics-edit-cancel" onclick="pict.views[\'ContentEditor-Topics\'].cancelEditTopic()">Cancel</button>',e+="</div>",e+="</div>",e}_showEmptyState(){let t=document.getElementById("ContentEditor-Topics-Container");if(!t){let t=document.getElementById("ContentEditor-SidebarTopics-Container");return void(t&&(t.innerHTML=this._buildEmptyStateHTML()))}t.innerHTML=this._buildEmptyStateHTML()}_buildEmptyStateHTML(){let t='<div class="topics-empty">';return t+='<div class="topics-empty-icon">📑</div>',t+="<div>No topics file loaded</div>",t+='<button class="topics-empty-btn" onclick="pict.views[\'ContentEditor-Topics\'].loadDefaultTopicsFile()">Load .pict_documentation_topics.json</button>',t+='<button class="topics-empty-btn topics-empty-btn-secondary" onclick="pict.views[\'ContentEditor-Topics\'].promptSelectTopicsFile()">Select file...</button>',t+="</div>",'<div class="topics-empty"><div class="topics-empty-icon">📑</div><div>No topics file loaded</div><button class="topics-empty-btn" onclick="pict.views[\'ContentEditor-Topics\'].loadDefaultTopicsFile()">Load .pict_documentation_topics.json</button><button class="topics-empty-btn topics-empty-btn-secondary" onclick="pict.views[\'ContentEditor-Topics\'].promptSelectTopicsFile()">Select file...</button></div>'}loadDefaultTopicsFile(){let t=this;this.loadTopicsFile(".pict_documentation_topics.json",e=>{e&&t._createDefaultTopicsFile()})}promptSelectTopicsFile(){let t=prompt("Enter the path to a topics JSON file:",".pict_documentation_topics.json");if(t&&t.trim()){let e=this;this.loadTopicsFile(t.trim(),n=>{n&&confirm('File not found. Create "'+t.trim()+'"?')&&(e._topicsFilePath=t.trim(),e._topics={},e.pict.AppData.ContentEditor.TopicsFilePath=t.trim(),e.pict.PictApplication.saveSettings(),e.saveTopicsFile(()=>{e._hasRendered&&e.render()}))})}}_createDefaultTopicsFile(t){let e="function"==typeof t?t:()=>{},n=this,i=".pict_documentation_topics.json";this._topicsFilePath=i,this._topics={},this.pict.AppData.ContentEditor.TopicsFilePath=i,this.pict.PictApplication.saveSettings(),this.saveTopicsFile(()=>{n._hasRendered&&n.render(),e()})}_updateHeaderTitle(){let t=document.getElementById("ContentEditor-Topics-HeaderTitle");if(t){let e=this._topicsFilePath.replace(/^.*\//,"");t.textContent=e||"Topics",t.title=this._topicsFilePath}}_showFooter(t){let e=document.getElementById("ContentEditor-Topics-Footer");e&&(e.style.display=t?"":"none")}_generateUniqueCode(t){if(!this._topics[t])return t;let e=2;for(;this._topics[t+"-"+e];)e++;return t+"-"+e}_escapeHTML(t){return String(t).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}_escapeAttr(t){return String(t).replace(/&/g,"&").replace(/'/g,"'").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}},e.exports.default_configuration={ViewIdentifier:"ContentEditor-Topics",DefaultRenderable:"Topics-Wrap",DefaultDestinationAddress:"#ContentEditor-SidebarTopics-Container",AutoRender:!1,CSS:"\n\t\t.topics-container\n\t\t{\n\t\t\tdisplay: flex;\n\t\t\tflex-direction: column;\n\t\t\theight: 100%;\n\t\t\tfont-size: 0.82rem;\n\t\t\tcolor: #3D3229;\n\t\t}\n\t\t.topics-header\n\t\t{\n\t\t\tdisplay: flex;\n\t\t\talign-items: center;\n\t\t\tgap: 6px;\n\t\t\tpadding: 8px 10px;\n\t\t\tborder-bottom: 1px solid #EDE9E3;\n\t\t\tbackground: #FAF8F4;\n\t\t\tflex-shrink: 0;\n\t\t}\n\t\t.topics-header-title\n\t\t{\n\t\t\tflex: 1;\n\t\t\tfont-weight: 600;\n\t\t\tfont-size: 0.78rem;\n\t\t\tcolor: #5E5549;\n\t\t\twhite-space: nowrap;\n\t\t\toverflow: hidden;\n\t\t\ttext-overflow: ellipsis;\n\t\t}\n\t\t.topics-header-btn\n\t\t{\n\t\t\tbackground: transparent;\n\t\t\tborder: none;\n\t\t\tcursor: pointer;\n\t\t\tfont-size: 0.82rem;\n\t\t\tcolor: #8A7F72;\n\t\t\tpadding: 2px 6px;\n\t\t\tborder-radius: 3px;\n\t\t\tline-height: 1;\n\t\t}\n\t\t.topics-header-btn:hover\n\t\t{\n\t\t\tcolor: #3D3229;\n\t\t\tbackground: #EDE9E3;\n\t\t}\n\t\t.topics-list\n\t\t{\n\t\t\tflex: 1;\n\t\t\toverflow-y: auto;\n\t\t\toverflow-x: hidden;\n\t\t}\n\t\t.topics-row\n\t\t{\n\t\t\tdisplay: flex;\n\t\t\talign-items: flex-start;\n\t\t\tgap: 6px;\n\t\t\tpadding: 8px 10px;\n\t\t\tborder-bottom: 1px solid #F0EDE8;\n\t\t\tcursor: pointer;\n\t\t\ttransition: background 0.1s;\n\t\t}\n\t\t.topics-row:hover\n\t\t{\n\t\t\tbackground: #F5F0EA;\n\t\t}\n\t\t.topics-row-info\n\t\t{\n\t\t\tflex: 1;\n\t\t\tmin-width: 0;\n\t\t}\n\t\t.topics-row-code\n\t\t{\n\t\t\tfont-weight: 600;\n\t\t\tfont-size: 0.78rem;\n\t\t\tcolor: #2E7D74;\n\t\t\twhite-space: nowrap;\n\t\t\toverflow: hidden;\n\t\t\ttext-overflow: ellipsis;\n\t\t}\n\t\t.topics-row-title\n\t\t{\n\t\t\tfont-size: 0.72rem;\n\t\t\tcolor: #5E5549;\n\t\t\twhite-space: nowrap;\n\t\t\toverflow: hidden;\n\t\t\ttext-overflow: ellipsis;\n\t\t\tmargin-top: 1px;\n\t\t}\n\t\t.topics-row-path\n\t\t{\n\t\t\tfont-size: 0.68rem;\n\t\t\tcolor: #8A7F72;\n\t\t\twhite-space: nowrap;\n\t\t\toverflow: hidden;\n\t\t\ttext-overflow: ellipsis;\n\t\t\tmargin-top: 1px;\n\t\t}\n\t\t.topics-row-actions\n\t\t{\n\t\t\tflex-shrink: 0;\n\t\t\tdisplay: flex;\n\t\t\tgap: 2px;\n\t\t\tpadding-top: 1px;\n\t\t}\n\t\t.topics-row-btn\n\t\t{\n\t\t\tbackground: transparent;\n\t\t\tborder: none;\n\t\t\tcursor: pointer;\n\t\t\tfont-size: 0.72rem;\n\t\t\tcolor: #8A7F72;\n\t\t\tpadding: 2px 4px;\n\t\t\tborder-radius: 3px;\n\t\t\tline-height: 1;\n\t\t}\n\t\t.topics-row-btn:hover\n\t\t{\n\t\t\tcolor: #3D3229;\n\t\t\tbackground: #EDE9E3;\n\t\t}\n\t\t.topics-row-btn-delete:hover\n\t\t{\n\t\t\tcolor: #D9534F;\n\t\t\tbackground: #FDF0EF;\n\t\t}\n\t\t/* Inline edit form */\n\t\t.topics-edit\n\t\t{\n\t\t\tpadding: 8px 10px;\n\t\t\tborder-bottom: 1px solid #DDD6CA;\n\t\t\tbackground: #FFF9F0;\n\t\t}\n\t\t.topics-edit-field\n\t\t{\n\t\t\tmargin-bottom: 6px;\n\t\t}\n\t\t.topics-edit-label\n\t\t{\n\t\t\tdisplay: block;\n\t\t\tfont-size: 0.68rem;\n\t\t\tfont-weight: 600;\n\t\t\tcolor: #8A7F72;\n\t\t\tmargin-bottom: 2px;\n\t\t}\n\t\t.topics-edit-input\n\t\t{\n\t\t\tdisplay: block;\n\t\t\twidth: 100%;\n\t\t\tbox-sizing: border-box;\n\t\t\tpadding: 4px 6px;\n\t\t\tfont-size: 0.78rem;\n\t\t\tborder: 1px solid #DDD6CA;\n\t\t\tborder-radius: 3px;\n\t\t\tbackground: #FFF;\n\t\t\tcolor: #3D3229;\n\t\t\tfont-family: inherit;\n\t\t}\n\t\t.topics-edit-input:focus\n\t\t{\n\t\t\toutline: none;\n\t\t\tborder-color: #2E7D74;\n\t\t}\n\t\t.topics-edit-actions\n\t\t{\n\t\t\tdisplay: flex;\n\t\t\tgap: 6px;\n\t\t\tmargin-top: 8px;\n\t\t}\n\t\t.topics-edit-save\n\t\t{\n\t\t\tbackground: #2E7D74;\n\t\t\tcolor: #FFF;\n\t\t\tborder: none;\n\t\t\tborder-radius: 3px;\n\t\t\tpadding: 4px 12px;\n\t\t\tfont-size: 0.72rem;\n\t\t\tfont-weight: 600;\n\t\t\tcursor: pointer;\n\t\t}\n\t\t.topics-edit-save:hover\n\t\t{\n\t\t\tbackground: #3A9E92;\n\t\t}\n\t\t.topics-edit-cancel\n\t\t{\n\t\t\tbackground: transparent;\n\t\t\tcolor: #5E5549;\n\t\t\tborder: 1px solid #DDD6CA;\n\t\t\tborder-radius: 3px;\n\t\t\tpadding: 4px 12px;\n\t\t\tfont-size: 0.72rem;\n\t\t\tfont-weight: 600;\n\t\t\tcursor: pointer;\n\t\t}\n\t\t.topics-edit-cancel:hover\n\t\t{\n\t\t\tbackground: #F0EDE8;\n\t\t}\n\t\t/* Footer add button */\n\t\t.topics-footer\n\t\t{\n\t\t\tflex-shrink: 0;\n\t\t\tpadding: 8px 10px;\n\t\t\tborder-top: 1px solid #EDE9E3;\n\t\t\tbackground: #FAF8F4;\n\t\t}\n\t\t.topics-add-btn\n\t\t{\n\t\t\tdisplay: block;\n\t\t\twidth: 100%;\n\t\t\tpadding: 6px 0;\n\t\t\tbackground: #2E7D74;\n\t\t\tcolor: #FFF;\n\t\t\tborder: none;\n\t\t\tborder-radius: 4px;\n\t\t\tfont-size: 0.78rem;\n\t\t\tfont-weight: 600;\n\t\t\tcursor: pointer;\n\t\t\ttext-align: center;\n\t\t}\n\t\t.topics-add-btn:hover\n\t\t{\n\t\t\tbackground: #3A9E92;\n\t\t}\n\t\t/* Empty state */\n\t\t.topics-empty\n\t\t{\n\t\t\tdisplay: flex;\n\t\t\tflex-direction: column;\n\t\t\talign-items: center;\n\t\t\tjustify-content: center;\n\t\t\tgap: 12px;\n\t\t\tpadding: 32px 16px;\n\t\t\ttext-align: center;\n\t\t\tcolor: #8A7F72;\n\t\t\tfont-size: 0.82rem;\n\t\t}\n\t\t.topics-empty-icon\n\t\t{\n\t\t\tfont-size: 2rem;\n\t\t\tcolor: #C4BDB3;\n\t\t}\n\t\t.topics-empty-btn\n\t\t{\n\t\t\tdisplay: inline-block;\n\t\t\tpadding: 6px 14px;\n\t\t\tbackground: #2E7D74;\n\t\t\tcolor: #FFF;\n\t\t\tborder: none;\n\t\t\tborder-radius: 4px;\n\t\t\tfont-size: 0.78rem;\n\t\t\tfont-weight: 600;\n\t\t\tcursor: pointer;\n\t\t}\n\t\t.topics-empty-btn:hover\n\t\t{\n\t\t\tbackground: #3A9E92;\n\t\t}\n\t\t.topics-empty-btn-secondary\n\t\t{\n\t\t\tbackground: transparent;\n\t\t\tcolor: #5E5549;\n\t\t\tborder: 1px solid #DDD6CA;\n\t\t}\n\t\t.topics-empty-btn-secondary:hover\n\t\t{\n\t\t\tbackground: #F0EDE8;\n\t\t\tborder-color: #8A7F72;\n\t\t}\n\t",Templates:[{Hash:"Topics-Container-Template",Template:'\n<div class="topics-container" id="ContentEditor-Topics-Container">\n\t<div class="topics-header">\n\t\t<span class="topics-header-title" id="ContentEditor-Topics-HeaderTitle">Topics</span>\n\t\t<button class="topics-header-btn" title="Close topics file"\n\t\t\tonclick="pict.views[\'ContentEditor-Topics\'].closeTopicsFile()">×</button>\n\t</div>\n\t<div class="topics-list" id="ContentEditor-Topics-List"></div>\n\t<div class="topics-footer" id="ContentEditor-Topics-Footer">\n\t\t<button class="topics-add-btn"\n\t\t\tonclick="pict.views[\'ContentEditor-Topics\'].addTopic()">+ Add Topic</button>\n\t</div>\n</div>\n'}],Renderables:[{RenderableHash:"Topics-Wrap",TemplateHash:"Topics-Container-Template",DestinationAddress:"#ContentEditor-SidebarTopics-Container"}]}},{"pict-view":88}]},{},[105])(105)});
|
|
89
89
|
//# sourceMappingURL=retold-content-system.min.js.map
|