kakidash 0.2.2 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.ja.md +41 -7
- package/README.md +39 -5
- package/dist/index.d.ts +715 -8
- package/dist/kakidash.cjs +19 -18
- package/dist/kakidash.es.js +4268 -3369
- package/dist/kakidash.umd.js +19 -18
- package/package.json +8 -4
package/dist/kakidash.umd.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
(function(mt,bt){typeof exports=="object"&&typeof module<"u"?bt(exports):typeof define=="function"&&define.amd?define(["exports"],bt):(mt=typeof globalThis<"u"?globalThis:mt||self,bt(mt.kakidash={}))})(this,(function(mt){"use strict";class bt{root;theme="default";constructor(t){this.root=t}findNode(t){return this.findNodeRecursive(this.root,t)}findNodeRecursive(t,e){if(t.id===e)return t;for(const i of t.children){const r=this.findNodeRecursive(i,e);if(r)return r}return null}moveNode(t,e){const i=this.findNode(t),r=this.findNode(e);if(!i||!r||i.isRoot||i.parentId===e||this.isDescendant(i,e))return!1;if(i.parentId){const n=this.findNode(i.parentId);n&&n.removeChild(t)}return r.addChild(i),!0}addSibling(t,e,i){const r=this.findNode(t);if(!r||!r.parentId)return!1;const n=this.findNode(r.parentId);if(!n)return!1;const o=n.children.findIndex(c=>c.id===t);if(o===-1)return!1;const s=i==="before"?o:o+1;return n.insertChild(e,s),!0}insertParent(t,e){const i=this.findNode(t);if(!i||!i.parentId)return!1;const r=this.findNode(i.parentId);if(!r)return!1;const n=r.children.findIndex(o=>o.id===t);return n===-1?!1:(r.removeChild(t),r.insertChild(e,n),e.addChild(i),!0)}isDescendant(t,e){if(t.id===e)return!0;for(const i of t.children)if(this.isDescendant(i,e))return!0;return!1}}class yt{id;topic;children;style;parentId;isRoot;image;imageSize;layoutSide;isFolded;icon;customWidth;constructor(t,e,i=null,r=!1,n,o,s=!1,c,g,f){this.id=t,this.topic=e,this.children=[],this.style={fontSize:r?"24px":"16px"},this.parentId=i,this.isRoot=r,this.image=n,this.imageSize=g,this.layoutSide=o,this.isFolded=s,this.icon=c,this.customWidth=f}addChild(t){t.parentId=this.id,this.children.push(t)}insertChild(t,e){t.parentId=this.id,e>=0&&e<=this.children.length?this.children.splice(e,0,t):this.children.push(t)}removeChild(t){this.children=this.children.filter(e=>e.id!==t)}updateTopic(t){this.topic=t}}class Ft{past=[];future=[];maxHistorySize;constructor(t=10){this.maxHistorySize=t}push(t){this.past.push(t),this.past.length>this.maxHistorySize&&this.past.shift(),this.future=[]}undo(t){if(this.past.length===0)return null;const e=this.past.pop();return e?(this.future.push(t),e):null}get canUndo(){return this.past.length>0}redo(t){if(this.future.length===0)return null;const e=this.future.pop();return e?(this.past.push(t),this.past.length>this.maxHistorySize&&this.past.shift(),e):null}get canRedo(){return this.future.length>0}clear(){this.past=[],this.future=[]}}class Wt{mindMap;historyManager;idGenerator;constructor(t,e){this.mindMap=t,this.historyManager=new Ft(10),this.idGenerator=e}saveState(){this.historyManager.push(this.exportData())}undo(){const t=this.historyManager.undo(this.exportData());return t?(this.importData(t),!0):!1}redo(){const t=this.historyManager.redo(this.exportData());return t?(this.importData(t),!0):!1}get canUndo(){return this.historyManager.canUndo}get canRedo(){return this.historyManager.canRedo}addNode(t,e="New topic",i){const r=this.mindMap.findNode(t);if(!r)return null;this.saveState();const n=this.idGenerator.generate(),o=new yt(n,e,null,!1,void 0,i,!1);return r.addChild(o),o}addImageNode(t,e,i,r){const n=this.mindMap.findNode(t);if(!n)return null;this.saveState();const o=this.idGenerator.generate(),s=i&&r?{width:i,height:r}:void 0,c=new yt(o,"",t,!1,e,void 0,!1,void 0,s);return n.addChild(c),c}removeNode(t,e=!0){const i=this.mindMap.findNode(t);if(!i||i.isRoot||!i.parentId)return!1;const r=this.mindMap.findNode(i.parentId);return r?(e&&this.saveState(),r.removeChild(t),!0):!1}updateNodeTopic(t,e){const i=this.mindMap.findNode(t);return i?(this.saveState(),i.updateTopic(e),!0):!1}updateNodeStyle(t,e){const i=this.mindMap.findNode(t);return i?(this.saveState(),i.style={...i.style,...e},!0):!1}toggleNodeFold(t){const e=this.mindMap.findNode(t);return e?e.children.length===0&&!e.isFolded?!1:(this.saveState(),e.isFolded=!e.isFolded,!0):!1}setTheme(t){this.mindMap.theme!==t&&(this.saveState(),this.mindMap.theme=t)}updateNodeCustomWidth(t,e){const i=this.mindMap.findNode(t);return i?(this.saveState(),i.customWidth=e,!0):!1}moveNode(t,e,i){const r=this.mindMap.findNode(t);if(r&&r.parentId===e)return i&&r.layoutSide!==i?(this.saveState(),r.layoutSide=i,!0):!1;if(!r)return!1;if(this.saveState(),this.mindMap.moveNode(t,e)){if(i){const n=this.mindMap.findNode(t);n&&(n.layoutSide=i)}return!0}return!1}addSibling(t,e,i="New topic"){const r=this.mindMap.findNode(t);if(!r||!r.parentId)return null;this.saveState();const n=this.idGenerator.generate(),o=new yt(n,i);return this.mindMap.addSibling(t,o,e)?o:null}reorderNode(t,e,i){const r=this.mindMap.findNode(t),n=this.mindMap.findNode(e);if(!r||!n||!n.parentId||r.id===n.id||r.isRoot)return!1;const o=this.mindMap.findNode(n.parentId);if(!o)return!1;if(this.saveState(),r.parentId!==o.id){let g=o;for(;g.parentId;){if(g.id===r.id)return!1;if(!g.parentId)break;const f=this.mindMap.findNode(g.parentId);if(!f)break;g=f}}if(r.parentId&&r.parentId!==o.id){const g=this.mindMap.findNode(r.parentId);g&&g.removeChild(r.id),r.parentId=o.id}else r.parentId===o.id&&o.removeChild(r.id);const s=o.children.findIndex(g=>g.id===e);if(s===-1)return o.addChild(r),!0;const c=i==="before"?s:s+1;return o.insertChild(r,c),o.isRoot&&n.layoutSide&&(r.layoutSide=n.layoutSide),!0}insertNodeAsParent(t,e){const i=this.mindMap.findNode(t),r=this.mindMap.findNode(e);if(!i||!r||!r.parentId||i.id===r.id)return!1;const n=this.mindMap.findNode(r.parentId);if(!n)return!1;let o=n;for(;o;){if(o.id===i.id)return!1;if(!o.parentId)break;o=this.mindMap.findNode(o.parentId)}if(this.saveState(),i.parentId){const c=this.mindMap.findNode(i.parentId);c&&c.removeChild(i.id)}const s=n.children.findIndex(c=>c.id===e);return s===-1?!1:(n.isRoot&&r.layoutSide&&(i.layoutSide=r.layoutSide),n.removeChild(e),n.insertChild(i,s),i.parentId=n.id,i.addChild(r),!0)}insertParent(t,e="New topic"){const i=this.mindMap.findNode(t);if(!i||!i.parentId)return null;this.saveState();const r=this.idGenerator.generate(),n=new yt(r,e);return this.mindMap.insertParent(t,n)?n:null}clipboard=null;copyNode(t){const e=this.mindMap.findNode(t);e&&(this.clipboard=this.deepCloneNode(e),navigator.clipboard&&navigator.clipboard.writeText(e.topic).catch(i=>{console.error("Failed to write to clipboard",i)}))}cutNode(t){const e=this.mindMap.findNode(t);e&&!e.isRoot&&e.parentId&&(this.copyNode(t),this.removeNode(t))}pasteNode(t){if(!this.clipboard)return null;const e=this.mindMap.findNode(t);if(!e)return null;this.saveState();const i=this.deepCloneNode(this.clipboard);return this.regenerateIds(i),e.addChild(i),i}deepCloneNode(t){const e=new yt(t.id,t.topic,null,!1,t.image,t.layoutSide,t.isFolded,t.icon,t.imageSize&&{...t.imageSize});return e.style={...t.style},e.children=t.children.map(i=>this.deepCloneNode(i)),e.children.forEach(i=>i.parentId=e.id),e}updateNodeIcon(t,e){const i=this.mindMap.findNode(t);return i?(this.saveState(),e==="delete"?i.icon=void 0:i.icon=e,!0):!1}regenerateIds(t){t.id=this.idGenerator.generate(),t.children.forEach(e=>{e.parentId=t.id,this.regenerateIds(e)})}exportData(){const t=e=>({id:e.id,topic:e.topic,root:e.isRoot||void 0,children:e.children.length>0?e.children.map(t):void 0,style:Object.keys(e.style).length>0?e.style:void 0,image:e.image,layoutSide:e.layoutSide,isFolded:e.isFolded,icon:e.icon,imageSize:e.imageSize,customWidth:e.customWidth});return{nodeData:t(this.mindMap.root),theme:this.mindMap.theme}}searchNodes(t){if(!t)return[];const e=[],i=t.toLowerCase(),r=n=>{n.topic.toLowerCase().includes(i)&&e.push(n),n.children.forEach(r)};return r(this.mindMap.root),e}importData(t){const e=(i,r=null)=>{const n=!!i.root,o=new yt(i.id,i.topic,r,n,i.image,i.layoutSide,i.isFolded||!1,i.icon,i.imageSize,i.customWidth);return i.style&&(o.style={...i.style}),i.children&&i.children.length>0&&i.children.forEach(s=>{const c=e(s,o.id);o.addChild(c)}),o};this.mindMap.root=e(t.nodeData),t.theme&&(this.mindMap.theme=t.theme)}}const Et={name:"default",isDark:!1,styles:{rootNode:{color:"var(--vscode-editor-foreground, black)",background:"var(--vscode-editorWidget-background, var(--vscode-editor-background, white))",border:"2px solid var(--vscode-editor-foreground, #333)",fontWeight:"bold",fontSize:"1.2em"},childNode:{color:"var(--vscode-editor-foreground, black)",background:"var(--vscode-editorWidget-background, var(--vscode-editor-background, white))",border:"1px solid var(--vscode-editorGroup-border, #ccc)"},connection:{color:"#ccc"},canvas:{background:"var(--vscode-editor-background, transparent)"}}},Ut={name:"simple",isDark:!1,styles:{rootNode:{color:"var(--vscode-editor-foreground, black)",background:"var(--vscode-editorWidget-background, var(--vscode-editor-background, white))",border:"2px solid var(--vscode-editor-foreground, #333)",fontWeight:"bold",fontSize:"1.2em"},childNode:{color:"var(--vscode-editor-foreground, black)",background:"var(--vscode-editorWidget-background, var(--vscode-editor-background, white))",border:"none"},connection:{color:"#ccc"},canvas:{background:"var(--vscode-editor-background, transparent)"}}},Dt=["#E74C3C","#3498DB","#2ECC71","#F1C40F","#9B59B6","#E67E22","#1ABC9C"],jt={name:"colorful",isDark:!1,styles:{rootNode:{color:"var(--vscode-editor-foreground, black)",background:"var(--vscode-editorWidget-background, var(--vscode-editor-background, white))",border:"2px solid var(--vscode-editor-foreground, #333)",fontWeight:"bold",fontSize:"1.2em"},childNode:{color:"var(--vscode-editor-foreground, black)",background:"var(--vscode-editorWidget-background, var(--vscode-editor-background, white))",border:"2px solid var(--node-color)"},connection:{color:"var(--node-color)"},canvas:{background:"var(--vscode-editor-background, transparent)"}},getColor:it=>Dt[it%Dt.length]},Ht={name:"dark",isDark:!0,styles:{rootNode:{color:"#eee",background:"#333",border:"2px solid #555",fontWeight:"bold",fontSize:"1.2em"},childNode:{color:"#ddd",background:"#222",border:"1px solid #444"},connection:{color:"#555"},canvas:{background:"#1e1e1e"}}};class ct{static instance;themes=new Map;currentTheme=Et;constructor(){this.registerTheme(Et),this.registerTheme(Ut),this.registerTheme(jt),this.registerTheme(Ht)}static getInstance(){return ct.instance||(ct.instance=new ct),ct.instance}registerTheme(t){this.themes.set(t.name,t)}getTheme(t){return this.themes.get(t)}getAvailableThemes(){return Array.from(this.themes.keys())}applyTheme(t,e){const i=this.getTheme(e);return i?(this.currentTheme=i,this.applyStyles(t,i),i):(console.warn(`Theme '${e}' not found. Falling back to default.`),this.currentTheme)}getCurrentTheme(){return this.currentTheme}setCustomTheme(t){const e=Et.styles,i={name:"custom",isDark:!1,styles:{rootNode:{color:t.rootNode?.color||e.rootNode.color,background:t.rootNode?.background||e.rootNode.background,border:t.rootNode?.border||e.rootNode.border,fontSize:e.rootNode.fontSize,fontWeight:e.rootNode.fontWeight},childNode:{color:t.childNode?.color||e.childNode.color,background:t.childNode?.background||e.childNode.background,border:t.childNode?.border||e.childNode.border,fontSize:e.childNode.fontSize},connection:{color:t.connection?.color||e.connection.color},canvas:{background:t.canvas?.background||e.canvas.background}}};this.registerTheme(i)}applyStyles(t,e){const i=e.styles;t.style.setProperty("--mindmap-root-color",i.rootNode.color),t.style.setProperty("--mindmap-root-background",i.rootNode.background),t.style.setProperty("--mindmap-root-border",i.rootNode.border),i.rootNode.fontSize&&t.style.setProperty("--mindmap-root-font-size",i.rootNode.fontSize),i.rootNode.fontWeight&&t.style.setProperty("--mindmap-root-font-weight",i.rootNode.fontWeight),t.style.setProperty("--mindmap-child-color",i.childNode.color),t.style.setProperty("--mindmap-child-background",i.childNode.background),t.style.setProperty("--mindmap-child-border",i.childNode.border),i.childNode.fontSize&&t.style.setProperty("--mindmap-child-font-size",i.childNode.fontSize),t.style.setProperty("--mindmap-connection-color",i.connection.color),t.style.setProperty("--mindmap-canvas-background",i.canvas.background)}}const It={blue_circle:{path:'<circle cx="12" cy="12" r="10" fill="#3498DB" />',color:"#3498DB",viewBox:"0 0 24 24"},red_circle:{path:'<circle cx="12" cy="12" r="10" fill="#E74C3C" />',color:"#E74C3C",viewBox:"0 0 24 24"},question:{path:'<path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 17h-2v-2h2v2zm2.07-7.75l-.9.92C13.45 12.9 13 13.5 13 15h-2v-.5c0-1.1.45-2.1 1.17-2.83l1.24-1.26c.37-.36.59-.86.59-1.41 0-1.1-.9-2-2-2s-2 .9-2 2H8c0-2.21 1.79-4 4-4s4 1.79 4 4c0 .88-.36 1.68-.93 2.25z" fill="#95A5A6" />',color:"#95A5A6",viewBox:"0 0 24 24"},important:{path:'<path d="M12 17.27L18.18 21l-1.64-7.03L22 9.24l-7.19-.61L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21z" fill="#F1C40F" />',color:"#F1C40F",viewBox:"0 0 24 24"},check:{path:'<path d="M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z" fill="#2ECC71" />',color:"#2ECC71",viewBox:"0 0 24 24"},cross:{path:'<path d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z" fill="#E74C3C" />',color:"#E74C3C",viewBox:"0 0 24 24"},flag:{path:'<path d="M14.4 6L14 4H5v17h2v-7h5.6l.4 2h7V6z" fill="#E67E22" />',color:"#E67E22",viewBox:"0 0 24 24"},idea:{path:'<path d="M9 21c0 .55.45 1 1 1h4c.55 0 1-.45 1-1v-1H9v1zm3-19C8.14 2 5 5.14 5 9c0 2.38 1.19 4.47 3 5.74V17c0 .55.45 1 1 1h6c.55 0 1-.45 1-1v-2.26c1.81-1.27 3-3.36 3-5.74 0-3.86-3.14-7-7-7zm2.85 11.1l-.85.6V16h-4v-2.3l-.85-.6C7.8 12.16 7 10.63 7 9c0-2.76 2.24-5 5-5s5 2.24 5 5c0 1.63-.8 3.16-2.15 4.1z" fill="#F39C12" />',color:"#F39C12",viewBox:"0 0 24 24"},warning:{path:'<path d="M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z" fill="#E67E22" />',color:"#E67E22",viewBox:"0 0 24 24"},schedule:{path:'<path d="M19 3h-1V1h-2v2H8V1H6v2H5c-1.11 0-1.99.9-1.99 2L3 19c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16H5V8h14v11zM7 10h5v5H7z" fill="#3498DB" />',color:"#3498DB",viewBox:"0 0 24 24"}};class Zt{container;svg;nodeContainer;options;maxWidth=-1;constructor(t,e={}){this.container=t,this.container.style.position="relative",this.container.style.width="100%",this.container.style.height="100%",this.container.style.overflow="hidden",this.container.style.backgroundColor="var(--vscode-editor-background, transparent)",this.svg=document.createElementNS("http://www.w3.org/2000/svg","svg"),this.svg.style.position="absolute",this.svg.style.top="0",this.svg.style.left="0",this.svg.style.width="100%",this.svg.style.height="100%",this.svg.style.zIndex="0",this.svg.style.pointerEvents="none",this.svg.style.overflow="visible",this.svg.style.transformOrigin="0 0",this.container.appendChild(this.svg),this.nodeContainer=document.createElement("div"),this.nodeContainer.style.position="absolute",this.nodeContainer.style.top="0",this.nodeContainer.style.left="0",this.nodeContainer.style.width="100%",this.nodeContainer.style.height="100%",this.nodeContainer.style.zIndex="1",this.nodeContainer.style.transformOrigin="0 0",this.container.appendChild(this.nodeContainer),this.options=e}render(t,e=null,i="Right"){this.svg.innerHTML="",this.nodeContainer.innerHTML="",this.renderNode(t.root,0,this.container.clientHeight/2,e,i,!0,void 0,t)}updateTransform(t,e,i=1){const r=`translate(${t}px, ${e}px) scale(${i})`;this.svg.style.transform=r,this.nodeContainer.style.transform=r}getThemeColor(t,e){const i=ct.getInstance().getCurrentTheme();if(i.getColor){if(t.isRoot)return"#333";let r=t;for(;r.parentId&&r.parentId!==e.root.id;){const s=e.findNode(r.parentId);if(!s)break;r=s}const o=e.root.children.findIndex(s=>s.id===r.id);if(o!==-1)return i.getColor(o,0)}return i.styles.connection.color}renderNode(t,e,i,r,n,o,s="right",c){const g=ct.getInstance().getCurrentTheme(),f=document.createElement("div");if(f.dataset.id=t.id,f.style.position="absolute",f.style.left=`${e}px`,f.style.top=`${i}px`,t.image){const m=document.createElement("img");m.src=t.image,t.imageSize?t.imageSize.width>150?(m.style.width="150px",m.style.height="auto"):(m.style.width=`${t.imageSize.width}px`,m.style.height=`${t.imageSize.height}px`):(m.style.maxWidth="150px",m.style.maxHeight="150px"),m.style.display="block",f.appendChild(m);const u=document.createElement("div");u.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="var(--vscode-icon-foreground, #333)" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="11" cy="11" r="8"></circle><line x1="21" y1="21" x2="16.65" y2="16.65"></line><line x1="11" y1="8" x2="11" y2="14"></line><line x1="8" y1="11" x2="14" y2="11"></line></svg>',u.style.position="absolute",u.style.bottom="5px",u.style.right="5px",u.style.backgroundColor="var(--vscode-editor-background, rgba(255, 255, 255, 0.9))",u.style.borderRadius="50%",u.style.width="24px",u.style.height="24px",u.style.display="flex",u.style.justifyContent="center",u.style.alignItems="center",u.style.cursor="pointer",u.title="Zoom Image",u.style.boxShadow="0 1px 3px rgba(0,0,0,0.2)",f.appendChild(u),u.addEventListener("click",v=>{v.stopPropagation(),this.showImageModal(t.image)}),f.style.padding="5px"}else{if(f.style.display="flex",f.style.alignItems="center",f.style.justifyContent=t.isRoot?"center":"flex-start",t.icon){const C=It[t.icon];if(C){const S=document.createElementNS("http://www.w3.org/2000/svg","svg");S.setAttribute("viewBox",C.viewBox),S.setAttribute("width","20"),S.setAttribute("height","20"),S.style.width="20px",S.style.height="20px",S.style.marginRight="8px",S.style.flexShrink="0",S.innerHTML=C.path,f.appendChild(S)}else{const S=document.createElement("span");S.textContent=t.icon,S.style.marginRight="6px",S.style.fontSize="1.2em",f.appendChild(S)}}const m=document.createElement("span"),u=/(https?:\/\/[^\s]+)/g;t.topic.split(u).forEach(C=>{if(C.match(u)){const S=document.createElement("a");S.href=C,S.target="_blank",S.rel="noopener noreferrer",S.textContent=C,S.style.color="#3498DB",S.style.textDecoration="underline",S.style.cursor="pointer",S.addEventListener("mousedown",M=>M.stopPropagation()),S.addEventListener("click",M=>M.stopPropagation()),m.appendChild(S)}else m.appendChild(document.createTextNode(C))}),f.appendChild(m);const k=t.customWidth??(this.maxWidth!==-1?this.maxWidth:void 0);k!==void 0?(m.style.whiteSpace="pre-wrap",m.style.wordWrap="break-word",m.style.overflowWrap="anywhere",m.style.minWidth="0",f.style.maxWidth=`${k}px`,f.style.width="max-content"):m.style.whiteSpace="pre"}f.className="mindmap-node",t.isRoot||(f.draggable=!0),f.style.position="absolute",f.style.padding="8px 12px",t.image&&(f.style.padding="5px"),g.name==="custom"?t.isRoot?f.style.color="var(--mindmap-root-color, var(--vscode-editor-foreground, black))":f.style.color="var(--mindmap-child-color, var(--vscode-editor-foreground, black))":t.isRoot?f.style.color="var(--mindmap-root-color)":f.style.color="var(--mindmap-child-color)";const y=this.getThemeColor(t,c);if(g.name==="colorful")f.style.border=`2px solid ${y}`;else if(g.name==="custom")if(t.isRoot){const m="2px solid var(--vscode-editor-foreground, #333)";f.style.border=`var(--mindmap-root-border, ${m})`}else f.style.border="var(--mindmap-child-border, 1px solid #ccc)";else t.isRoot?f.style.border="var(--mindmap-root-border)":f.style.border="var(--mindmap-child-border)";f.style.borderRadius="4px",t.isRoot&&(f.style.fontSize="1.2em",f.style.fontWeight="bold",g.name!=="custom"&&(f.style.border="2px solid var(--vscode-editor-foreground, #333)")),t.style.color&&(f.style.color=t.style.color),t.style.fontSize&&(f.style.fontSize=t.style.fontSize),t.style.fontWeight&&(f.style.fontWeight=t.style.fontWeight),t.style.fontStyle&&(f.style.fontStyle=t.style.fontStyle),t.style.background?f.style.backgroundColor=t.style.background:g.name==="custom"?t.isRoot?f.style.backgroundColor="var(--mindmap-root-background, var(--vscode-editor-background, white))":f.style.backgroundColor="var(--mindmap-child-background, var(--vscode-editor-background, white))":t.isRoot?f.style.backgroundColor="var(--mindmap-root-background)":f.style.backgroundColor="var(--mindmap-child-background)";const{width:p}=this.measureNode(t);let d=e;if(s==="left"&&!o?d=e-p:o&&(d=e-p/2),f.style.left=`${d}px`,f.style.top=`${i}px`,f.style.transform="translate(0, -50%)",f.style.zIndex="10",f.style.cursor="default",f.style.userSelect="none",t.id===r&&(f.style.outline="2px solid var(--vscode-focusBorder, #007bff)",f.style.boxShadow="0 0 5px var(--vscode-focusBorder, rgba(0, 123, 255, 0.5))"),this.nodeContainer.appendChild(f),t.children.length===0)return;if(this.options.onToggleFold){const m=[];if(o&&n==="Both")m.push(d+p),m.push(d);else{let u=s==="right";o&&(n==="Left"?u=!1:u=!0),m.push(u?d+p:d)}m.forEach(u=>{const v=document.createElement("div");v.className="mindmap-toggle-btn",v.innerHTML=t.isFolded?"+":"-",v.style.position="absolute",v.style.width="16px",v.style.height="16px",v.style.fontSize="12px",v.style.lineHeight="14px",v.style.textAlign="center",v.style.borderRadius="50%",v.style.border="1px solid var(--vscode-widget-border, #999)",v.style.backgroundColor="var(--vscode-editor-background, #fff)",v.style.color="var(--vscode-editor-foreground, #000)",v.style.cursor="pointer",v.style.zIndex="11",v.style.userSelect="none";const k=0;v.style.left=`${u+k}px`,v.style.top=`${i}px`,v.style.transform="translate(-50%, -50%)",v.addEventListener("click",C=>{C.stopPropagation(),this.options.onToggleFold?.(t.id)}),this.nodeContainer.appendChild(v)})}if(t.isFolded)return;let w=[],h=[];o&&n==="Both"?t.children.forEach((m,u)=>{(m.layoutSide||(u%2===0?"right":"left"))==="right"?w.push(m):h.push(m)}):n==="Left"?h=t.children:n==="Right"?w=t.children:s==="left"?h=t.children:w=t.children,w.length>0&&this.renderChildrenStack(t,w,e,i,r,n,"right",p,c),h.length>0&&this.renderChildrenStack(t,h,e,i,r,n,"left",p,c)}renderChildrenStack(t,e,i,r,n,o,s,c,g){const f=e.reduce((w,h)=>w+this.getNodeHeight(h,g),0);let y=r-f/2;const p=80;let d=0;t.isRoot?d=s==="right"?i+c/2:i-c/2:s==="right"?d=i+c:(d=i,d=i-c),e.forEach(w=>{const h=this.getNodeHeight(w,g),m=y+h/2,u=s==="right"?d+p:d-p;this.renderNode(w,u,m,n,o,!1,s,g);const v=g?this.getThemeColor(w,g):"#ccc";this.drawConnection(d,r,u,m,v,g?.theme),y+=h})}getChildrenHeight(t,e){return t.children.reduce((i,r)=>i+this.getNodeHeight(r,e),0)}getNodeHeight(t,e){const{height:i}=this.measureNode(t,e),r=20;if(t.children.length===0||t.isFolded)return i+r;const n=this.getChildrenHeight(t,e);return Math.max(i+r,n)}measureNode(t,e){if(t.image)return t.imageSize?t.imageSize.width>150?{width:160,height:150*(t.imageSize.height/t.imageSize.width)+10}:{width:t.imageSize.width+10,height:t.imageSize.height+10}:{width:160,height:160};const i=document.createElement("div");if(i.className="mindmap-node",i.style.visibility="hidden",i.style.position="absolute",i.style.display="flex",i.style.alignItems="center",t.icon)if(It[t.icon]){const y=document.createElement("div");y.style.width="20px",y.style.height="20px",y.style.marginRight="8px",y.style.flexShrink="0",i.appendChild(y)}else{const y=document.createElement("span");y.textContent=t.icon,y.style.marginRight="6px",y.style.fontSize="1.2em",i.appendChild(y)}const r=document.createElement("span");r.textContent=t.topic,i.appendChild(r);const n=t.customWidth??(this.maxWidth!==-1?this.maxWidth:void 0);n!==void 0?(r.style.whiteSpace="pre-wrap",r.style.wordWrap="break-word",r.style.overflowWrap="anywhere",r.style.minWidth="0",i.style.maxWidth=`${n}px`,i.style.width="max-content"):r.style.whiteSpace="pre",i.style.padding="8px 12px";const o=ct.getInstance().getCurrentTheme(),s=e?this.getThemeColor(t,e):"#ccc";o.name==="colorful"?i.style.border=`2px solid ${s}`:o.name==="custom"?t.isRoot?i.style.border="var(--mindmap-root-border, 2px solid #333)":i.style.border="var(--mindmap-child-border, 1px solid #ccc)":t.isRoot?i.style.border="var(--mindmap-root-border)":i.style.border="var(--mindmap-child-border)",t.isRoot&&(i.style.fontSize="1.2em",i.style.fontWeight="bold",o.name!=="custom"&&(i.style.border="2px solid var(--vscode-editor-foreground, #333)")),t.style.color&&(i.style.color=t.style.color),t.style.fontSize&&(i.style.fontSize=t.style.fontSize),t.style.fontWeight&&(i.style.fontWeight=t.style.fontWeight),t.style.fontStyle&&(i.style.fontStyle=t.style.fontStyle),t.style.background&&(i.style.backgroundColor=t.style.background),this.nodeContainer.appendChild(i);const c=i.offsetWidth,g=i.offsetHeight;return this.nodeContainer.removeChild(i),{width:c||100,height:g||40}}drawConnection(t,e,i,r,n="#ccc",o="default"){const s=document.createElementNS("http://www.w3.org/2000/svg","path"),c=t+(i-t)/2,g=t+(i-t)/2,f=`M ${t} ${e} C ${c} ${e}, ${g} ${r}, ${i} ${r}`;s.setAttribute("d",f),o==="custom"?s.style.stroke=`var(--mindmap-connection-color, ${n})`:(s.style.stroke="var(--mindmap-connection-color, #ccc)",ct.getInstance().getCurrentTheme().name==="colorful"?s.style.stroke=n:s.style.stroke="var(--mindmap-connection-color)"),s.setAttribute("fill","none"),s.setAttribute("stroke-width","2"),this.svg.appendChild(s)}showImageModal(t){this.options.onImageZoom&&this.options.onImageZoom(!0);const e=document.createElement("div");e.style.position="fixed",e.style.top="0",e.style.left="0",e.style.width="100vw",e.style.height="100vh",e.style.backgroundColor="rgba(0,0,0,0.8)",e.style.zIndex="1000",e.style.display="flex",e.style.justifyContent="center",e.style.alignItems="center",e.style.cursor="zoom-out";const i=document.createElement("img");i.src=t,i.style.maxWidth="90%",i.style.maxHeight="90%",i.style.boxShadow="0 0 20px rgba(0,0,0,0.5)",e.appendChild(i),document.body.appendChild(e);let r;const n=()=>{document.body.contains(e)&&document.body.removeChild(e),r&&document.removeEventListener("keydown",r,!0),this.options.onImageZoom&&this.options.onImageZoom(!1),this.container.focus()};r=o=>{o.stopPropagation(),o.preventDefault(),n()},document.addEventListener("keydown",r,!0),e.addEventListener("click",()=>{n()})}}class vt{container;editorEl;currentNodeId=null;onUpdate;static FONT_SIZES=[{label:"12px",value:"12px"},{label:"14px",value:"14px"},{label:"16px",value:"16px"},{label:"18px",value:"18px"},{label:"24px",value:"24px"},{label:"32px",value:"32px"},{label:"48px",value:"48px"}];static PALETTE=["#000000","#E74C3C","#E67E22","#F1C40F","#2ECC71","#3498DB","#9B59B6"];constructor(t){this.container=t,this.editorEl=this.createEditor(),this.container.appendChild(this.editorEl),this.editorEl.addEventListener("mousedown",e=>e.stopPropagation()),this.editorEl.addEventListener("click",e=>e.stopPropagation()),this.editorEl.addEventListener("dblclick",e=>e.stopPropagation())}createEditor(){const t=document.createElement("div");t.className="style-editor",t.style.position="absolute",t.style.top="20px",t.style.right="20px",t.style.display="none",t.style.backgroundColor="white",t.style.border="1px solid #eee",t.style.borderRadius="8px",t.style.padding="8px",t.style.boxShadow="0 4px 12px rgba(0,0,0,0.1)",t.style.zIndex="2000",t.style.pointerEvents="auto",t.style.fontFamily="Arial, sans-serif",t.style.display="flex",t.style.flexDirection="column",t.style.gap="8px",t.style.margin="0",t.style.boxSizing="border-box",t.style.minWidth="220px";const e=document.createElement("div");e.style.display="flex",e.style.gap="8px",e.style.alignItems="center";const i=document.createElement("select");i.style.padding="4px 8px",i.style.borderRadius="4px",i.style.border="1px solid #ccc",i.style.fontSize="14px",i.style.flex="1",vt.FONT_SIZES.forEach(f=>{const y=document.createElement("option");y.value=f.value,y.textContent=f.label,i.appendChild(y)}),i.onchange=f=>{this.currentNodeId&&this.onUpdate&&this.onUpdate(this.currentNodeId,{fontSize:f.target.value})},e.appendChild(i);const n=(f,y,p)=>{const d=document.createElement("button");return d.textContent=f,d.style.width="32px",d.style.height="32px",d.style.padding="0",d.style.display="flex",d.style.justifyContent="center",d.style.alignItems="center",d.style.border="1px solid #ddd",d.style.backgroundColor="#f5f5f5",d.style.borderRadius="4px",d.style.cursor="pointer",d.style.fontSize="14px",y&&(d.style[y]=y==="fontWeight"?"bold":"italic"),d.onclick=p,d},o=n("B","fontWeight",()=>{if(this.currentNodeId&&this.onUpdate){const f=o.classList.contains("active"),y=f?"normal":"bold";this.onUpdate(this.currentNodeId,{fontWeight:y}),this.updateButtonState(o,!f)}}),s=n("I","fontStyle",()=>{if(this.currentNodeId&&this.onUpdate){const f=s.classList.contains("active"),y=f?"normal":"italic";this.onUpdate(this.currentNodeId,{fontStyle:y}),this.updateButtonState(s,!f)}});e.appendChild(o),e.appendChild(s),t.appendChild(e);const c=document.createElement("div");c.style.display="flex",c.style.gap="4px",c.style.alignItems="center",c.style.justifyContent="space-between";const g=document.createElement("input");return g.type="color",g.style.width="24px",g.style.height="24px",g.style.border="1px solid #ccc",g.style.padding="0",g.style.backgroundColor="transparent",g.style.cursor="pointer",g.style.appearance="none",g.onchange=f=>{this.currentNodeId&&this.onUpdate&&(this.onUpdate(this.currentNodeId,{color:f.target.value}),this.updateActivePaletteItem(f.target.value))},vt.PALETTE.forEach((f,y)=>{const p=document.createElement("div");p.className="color-swatch",p.dataset.color=f,p.textContent=(y+1).toString(),p.style.width="24px",p.style.height="24px",p.style.backgroundColor=f,p.style.borderRadius="4px",p.style.cursor="pointer",p.style.border="1px solid transparent",p.style.color=f==="#F1C40F"?"black":"white",p.style.fontSize="12px",p.style.fontWeight="bold",p.style.display="flex",p.style.justifyContent="center",p.style.alignItems="center",p.onclick=()=>{this.currentNodeId&&this.onUpdate&&(this.onUpdate(this.currentNodeId,{color:f}),g.value=f,this.updateActivePaletteItem(f))},c.appendChild(p)}),c.appendChild(g),t.appendChild(c),t}updateActivePaletteItem(t){this.editorEl.querySelectorAll(".color-swatch").forEach(i=>{const r=i;r.dataset.color?.toLowerCase()===t.toLowerCase()?(r.style.border="2px solid #ccc",r.style.transform="scale(1.1)"):(r.style.border="1px solid transparent",r.style.transform="scale(1)")})}updateButtonState(t,e){e?(t.classList.add("active"),t.style.backgroundColor="#e0e0e0",t.style.borderColor="#999"):(t.classList.remove("active"),t.style.backgroundColor="#f5f5f5",t.style.borderColor="#ddd")}show(t,e){this.currentNodeId=t,this.editorEl.style.display="flex";const i=this.editorEl.querySelector("select");i.value=e.fontSize||"";const r=this.editorEl.querySelector('input[type="color"]'),n=e.color||"#000000";r.value=n,this.updateActivePaletteItem(n);const o=this.editorEl.querySelectorAll("button")[0];this.updateButtonState(o,e.fontWeight==="bold");const s=this.editorEl.querySelectorAll("button")[1];this.updateButtonState(s,e.fontStyle==="italic")}hide(){this.editorEl.style.display="none",this.currentNodeId=null}}class Xt{container;element;options;currentMode="Right";currentTheme="default";layoutButtons=new Map;themeButtons=new Map;constructor(t,e){this.container=t,this.options=e,this.element=document.createElement("div"),this.render()}render(){this.element.style.position="absolute",this.element.style.top="20px",this.element.style.left="20px",this.element.style.display="flex",this.element.style.flexDirection="column",this.element.style.backgroundColor="white",this.element.style.borderRadius="8px",this.element.style.boxShadow="0 2px 10px rgba(0,0,0,0.1)",this.element.style.padding="5px",this.element.style.zIndex="2000",this.element.style.gap="5px",this.element.style.pointerEvents="auto",this.element.addEventListener("click",t=>t.stopPropagation()),this.element.addEventListener("mousedown",t=>t.stopPropagation()),this.createLayoutButton("Right",this.getRightIcon()),this.createLayoutButton("Left",this.getLeftIcon()),this.createLayoutButton("Both",this.getBothIcon()),this.addSeparator(),this.createThemeButton("default",this.getThemeDefaultIcon()),this.createThemeButton("simple",this.getThemeSimpleIcon()),this.createThemeButton("colorful",this.getThemeColorfulIcon()),this.createThemeButton("custom",this.getThemeCustomIcon()),this.addSeparator(),this.createIconActionButton("Reset Zoom",this.getZoomResetIcon(),()=>{this.options.onZoomReset&&this.options.onZoomReset()}),this.addSeparator(),this.createIconActionButton("Shortcuts Help",this.getHelpIcon(),()=>{this.options.onShowShortcuts&&this.options.onShowShortcuts()}),this.container.appendChild(this.element),this.updateActiveButtons()}addSeparator(){const t=document.createElement("div");t.style.height="1px",t.style.backgroundColor="#ccc",t.style.margin="5px 2px",this.element.appendChild(t)}createLayoutButton(t,e){const i=document.createElement("button");i.innerHTML=e,this.styleButton(i),i.title=`Layout: ${t}`,i.addEventListener("click",()=>{this.setMode(t)}),this.element.appendChild(i),this.layoutButtons.set(t,i)}createThemeButton(t,e){const i=document.createElement("button");i.innerHTML=e,this.styleButton(i),i.title=`Theme: ${t}`,i.addEventListener("click",()=>{this.setTheme(t)}),this.element.appendChild(i),this.themeButtons.set(t,i)}createIconActionButton(t,e,i){const r=document.createElement("button");r.innerHTML=e,this.styleButton(r),r.title=t,r.addEventListener("click",i),this.element.appendChild(r)}styleButton(t){t.style.width="32px",t.style.height="32px",t.style.border="none",t.style.background="transparent",t.style.cursor="pointer",t.style.borderRadius="4px",t.style.display="flex",t.style.alignItems="center",t.style.justifyContent="center",t.style.color="#555"}updateActiveButtons(){this.layoutButtons.forEach((t,e)=>{e===this.currentMode?(t.style.backgroundColor="#e6f7ff",t.style.color="#007bff"):(t.style.backgroundColor="transparent",t.style.color="#555")}),this.themeButtons.forEach((t,e)=>{e===this.currentTheme?(t.style.backgroundColor="#e6f7ff",t.style.color="#007bff"):(t.style.backgroundColor="transparent",t.style.color="#555")})}setMode(t){this.currentMode!==t&&(this.currentMode=t,this.updateActiveButtons(),this.options.onLayoutChange(t))}setTheme(t){this.currentTheme!==t&&(this.currentTheme=t,this.updateActiveButtons(),this.options.onThemeChange(t))}getRightIcon(){return`<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
|
1
|
+
(function(ft,bt){typeof exports=="object"&&typeof module<"u"?bt(exports):typeof define=="function"&&define.amd?define(["exports"],bt):(ft=typeof globalThis<"u"?globalThis:ft||self,bt(ft.kakidash={}))})(this,(function(ft){"use strict";class bt{root;theme="default";nodeIndex=new Map;constructor(t){this.root=t,this.rebuildIndex()}rebuildIndex(){this.nodeIndex.clear(),this.indexSubtree(this.root)}indexSubtree(t){this.nodeIndex.set(t.id,t);for(const e of t.children)this.indexSubtree(e)}registerNode(t){this.indexSubtree(t)}unregisterNode(t){this.removeFromIndex(t)}removeFromIndex(t){this.nodeIndex.delete(t.id);for(const e of t.children)this.removeFromIndex(e)}findNode(t){return this.nodeIndex.get(t)??null}moveNode(t,e){const i=this.findNode(t),n=this.findNode(e);if(!i||!n||i.isRoot||i.parentId===e||this.isDescendant(i,e))return!1;if(i.parentId){const r=this.findNode(i.parentId);r&&r.removeChild(t)}return n.addChild(i),!0}addSibling(t,e,i){const n=this.findNode(t);if(!n||!n.parentId)return!1;const r=this.findNode(n.parentId);if(!r)return!1;const s=r.children.findIndex(l=>l.id===t);if(s===-1)return!1;const o=i==="before"?s:s+1;return r.insertChild(e,o),this.registerNode(e),!0}insertParent(t,e){const i=this.findNode(t);if(!i||!i.parentId)return!1;const n=this.findNode(i.parentId);if(!n)return!1;const r=n.children.findIndex(s=>s.id===t);return r===-1?!1:(n.removeChild(t),n.insertChild(e,r),e.addChild(i),this.registerNode(e),!0)}isDescendant(t,e){if(t.id===e)return!0;for(const i of t.children)if(this.isDescendant(i,e))return!0;return!1}}class yt{id;topic;children;style;parentId;isRoot;image;imageSize;icon;presentation;constructor(t,e,i=null,n=!1,r,s,o=!1,l,g,b){this.id=t,this.topic=e,this.children=[],this.style={fontSize:n?"24px":"16px"},this.parentId=i,this.isRoot=n,this.image=r,this.imageSize=g,this.icon=l,this.presentation={isFolded:o,layoutSide:s,customWidth:b}}addChild(t){t.parentId=this.id,this.children.push(t)}insertChild(t,e){t.parentId=this.id,e>=0&&e<=this.children.length?this.children.splice(e,0,t):this.children.push(t)}removeChild(t){this.children=this.children.filter(e=>e.id!==t)}updateTopic(t){this.topic=t}}class Wt{mindMap;idGenerator;constructor(t,e){this.mindMap=t,this.idGenerator=e}addNode(t,e="New topic",i){const n=this.mindMap.findNode(t);if(!n)return null;const r=this.idGenerator.generate(),s=new yt(r,e,null,!1,void 0,i,!1);return n.addChild(s),this.mindMap.registerNode(s),s}addImageNode(t,e,i,n){const r=this.mindMap.findNode(t);if(!r)return null;const s=this.idGenerator.generate(),o=i&&n?{width:i,height:n}:void 0,l=new yt(s,"",t,!1,e,void 0,!1,void 0,o);return r.addChild(l),this.mindMap.registerNode(l),l}removeNode(t){const e=this.mindMap.findNode(t);if(!e||e.isRoot||!e.parentId)return!1;const i=this.mindMap.findNode(e.parentId);return i?(i.removeChild(t),this.mindMap.unregisterNode(e),!0):!1}removeNodes(t){if(t.length===0)return!1;for(const i of t){const n=this.mindMap.findNode(i);if(!n||n.isRoot)return!1}let e=!1;return t.forEach(i=>{this.removeNode(i)&&(e=!0)}),e}updateNodeTopic(t,e){const i=this.mindMap.findNode(t);return i?(i.updateTopic(e),!0):!1}updateNodeStyle(t,e){const i=this.mindMap.findNode(t);return i?(i.style={...i.style,...e},!0):!1}updateNodesStyle(t,e){if(t.length===0)return!1;let i=!1;return t.forEach(n=>{const r=this.mindMap.findNode(n);r&&(r.style={...r.style,...e},i=!0)}),i}toggleNodeFold(t){const e=this.mindMap.findNode(t);return e?e.children.length===0&&!e.presentation.isFolded?!1:(e.presentation.isFolded=!e.presentation.isFolded,!0):!1}setTheme(t){this.mindMap.theme!==t&&(this.mindMap.theme=t)}updateNodeCustomWidth(t,e){const i=this.mindMap.findNode(t);return i?(i.presentation.customWidth=e,!0):!1}moveNode(t,e,i){const n=this.mindMap.findNode(t);if(n&&n.parentId===e)return i&&n.presentation.layoutSide!==i?(n.presentation.layoutSide=i,!0):!1;if(!n)return!1;if(this.mindMap.moveNode(t,e)){if(i){const r=this.mindMap.findNode(t);r&&(r.presentation.layoutSide=i)}return!0}return!1}addSibling(t,e,i="New topic"){const n=this.mindMap.findNode(t);if(!n||!n.parentId)return null;const r=this.idGenerator.generate(),s=new yt(r,i);return this.mindMap.addSibling(t,s,e)?s:null}reorderNode(t,e,i){const n=this.mindMap.findNode(t),r=this.mindMap.findNode(e);if(!n||!r||!r.parentId||n.id===r.id||n.isRoot)return!1;const s=this.mindMap.findNode(r.parentId);if(!s)return!1;if(n.parentId!==s.id){let g=s;for(;g.parentId;){if(g.id===n.id)return!1;if(!g.parentId)break;const b=this.mindMap.findNode(g.parentId);if(!b)break;g=b}}if(n.parentId&&n.parentId!==s.id){const g=this.mindMap.findNode(n.parentId);g&&(g.removeChild(n.id),this.mindMap.unregisterNode(n)),n.parentId=s.id}else n.parentId===s.id&&(s.removeChild(n.id),this.mindMap.unregisterNode(n));const o=s.children.findIndex(g=>g.id===e);if(o===-1)return s.addChild(n),this.mindMap.registerNode(n),!0;const l=i==="before"?o:o+1;return s.insertChild(n,l),this.mindMap.registerNode(n),s.isRoot&&r.presentation.layoutSide&&(n.presentation.layoutSide=r.presentation.layoutSide),!0}insertNodeAsParent(t,e){const i=this.mindMap.findNode(t),n=this.mindMap.findNode(e);if(!i||!n||!n.parentId||i.id===n.id)return!1;const r=this.mindMap.findNode(n.parentId);if(!r)return!1;let s=r;for(;s;){if(s.id===i.id)return!1;if(!s.parentId)break;s=this.mindMap.findNode(s.parentId)}if(i.parentId){const l=this.mindMap.findNode(i.parentId);l&&(l.removeChild(i.id),this.mindMap.unregisterNode(i))}const o=r.children.findIndex(l=>l.id===e);return o===-1?!1:(r.isRoot&&n.presentation.layoutSide&&(i.presentation.layoutSide=n.presentation.layoutSide),r.removeChild(e),this.mindMap.unregisterNode(n),r.insertChild(i,o),this.mindMap.registerNode(i),i.parentId=r.id,i.addChild(n),this.mindMap.registerNode(n),!0)}insertParent(t,e="New topic"){const i=this.mindMap.findNode(t);if(!i||!i.parentId)return null;const n=this.idGenerator.generate(),r=new yt(n,e);return this.mindMap.insertParent(t,r)?r:null}updateNodeIcon(t,e){const i=this.mindMap.findNode(t);return i?(e==="delete"?i.icon=void 0:i.icon=e,!0):!1}addExistingNodes(t,e){const i=this.mindMap.findNode(t);return i?(e.forEach(n=>{i.addChild(n),this.mindMap.registerNode(n)}),!0):!1}exportData(){const t=i=>({id:i.id,topic:i.topic,root:i.isRoot||void 0,children:i.children.length>0?i.children.map(t):void 0,style:Object.keys(i.style).length>0?i.style:void 0,image:i.image,layoutSide:i.presentation.layoutSide,isFolded:i.presentation.isFolded,icon:i.icon,imageSize:i.imageSize,customWidth:i.presentation.customWidth});return{nodeData:t(this.mindMap.root),theme:this.mindMap.theme}}importData(t){const e=(i,n=null)=>{const r=!!i.root,s=new yt(i.id,i.topic,n,r,i.image,i.layoutSide,i.isFolded||!1,i.icon,i.imageSize,i.customWidth);return i.style&&(s.style={...i.style}),i.children&&i.children.length>0&&i.children.forEach(o=>{const l=e(o,s.id);s.addChild(l)}),s};this.mindMap.root=e(t.nodeData),this.mindMap.rebuildIndex(),t.theme&&(this.mindMap.theme=t.theme)}}class Ut{past=[];future=[];maxHistorySize;constructor(t=10){this.maxHistorySize=t}push(t){this.past.push(t),this.past.length>this.maxHistorySize&&this.past.shift(),this.future=[]}undo(t){if(this.past.length===0)return null;const e=this.past.pop();return e?(this.future.push(t),e):null}get canUndo(){return this.past.length>0}redo(t){if(this.future.length===0)return null;const e=this.future.pop();return e?(this.past.push(t),this.past.length>this.maxHistorySize&&this.past.shift(),e):null}get canRedo(){return this.future.length>0}clear(){this.past=[],this.future=[]}}class jt{historyManager;constructor(t=10){this.historyManager=new Ut(t)}saveState(t){this.historyManager.push(t)}undo(t){return this.historyManager.undo(t)}redo(t){return this.historyManager.redo(t)}get canUndo(){return this.historyManager.canUndo}get canRedo(){return this.historyManager.canRedo}}class Ht{constructor(t,e){this.mindMap=t,this.idGenerator=e}clipboard=[];copyNodes(t){this.clipboard=[];const e=[],i=new Set(t),n=[];t.forEach(r=>{let s=!1;const o=this.mindMap.findNode(r);if(o){let l=o.parentId?this.mindMap.findNode(o.parentId):null;for(;l;){if(i.has(l.id)){s=!0;break}l=l.parentId?this.mindMap.findNode(l.parentId):null}}s||n.push(r)}),n.forEach(r=>{const s=this.mindMap.findNode(r);s&&(this.clipboard.push(this.deepCloneNode(s)),e.push(s.topic))}),typeof navigator<"u"&&navigator.clipboard&&e.length>0&&navigator.clipboard.writeText(e.join(`
|
|
2
|
+
`)).catch(r=>{console.error("Failed to write to clipboard",r)})}getClipboardNodes(){return this.clipboard}createPastedNodes(t){if(this.clipboard.length===0)return[];if(!this.mindMap.findNode(t))return[];const i=[];return this.clipboard.forEach(n=>{const r=this.deepCloneNode(n);this.regenerateIds(r),i.push(r)}),i}deepCloneNode(t){const e=new yt(t.id,t.topic,null,!1,t.image,t.presentation.layoutSide,t.presentation.isFolded,t.icon,t.imageSize&&{...t.imageSize},t.presentation.customWidth);return e.style={...t.style},e.children=t.children.map(i=>this.deepCloneNode(i)),e.children.forEach(i=>i.parentId=e.id),e}regenerateIds(t){t.id=this.idGenerator.generate(),t.children.forEach(e=>{e.parentId=t.id,this.regenerateIds(e)})}}class Zt{constructor(t){this.mindMap=t}searchNodes(t){if(!t)return[];const e=[],i=t.toLowerCase(),n=r=>{r.topic.toLowerCase().includes(i)&&e.push(r),r.children.forEach(n)};return n(this.mindMap.root),e}}const Et={name:"default",isDark:!1,styles:{rootNode:{color:"var(--vscode-editor-foreground, black)",background:"var(--vscode-editorWidget-background, var(--vscode-editor-background, white))",border:"2px solid var(--vscode-editor-foreground, #333)",fontWeight:"bold",fontSize:"1.2em"},childNode:{color:"var(--vscode-editor-foreground, black)",background:"var(--vscode-editorWidget-background, var(--vscode-editor-background, white))",border:"1px solid var(--vscode-editorGroup-border, #ccc)"},connection:{color:"#ccc"},canvas:{background:"var(--vscode-editor-background, transparent)"}}},Kt={name:"simple",isDark:!1,styles:{rootNode:{color:"var(--vscode-editor-foreground, black)",background:"var(--vscode-editorWidget-background, var(--vscode-editor-background, white))",border:"2px solid var(--vscode-editor-foreground, #333)",fontWeight:"bold",fontSize:"1.2em"},childNode:{color:"var(--vscode-editor-foreground, black)",background:"var(--vscode-editorWidget-background, var(--vscode-editor-background, white))",border:"none"},connection:{color:"#ccc"},canvas:{background:"var(--vscode-editor-background, transparent)"}}},At=["#E74C3C","#3498DB","#2ECC71","#F1C40F","#9B59B6","#E67E22","#1ABC9C"],Xt={name:"colorful",isDark:!1,styles:{rootNode:{color:"var(--vscode-editor-foreground, black)",background:"var(--vscode-editorWidget-background, var(--vscode-editor-background, white))",border:"2px solid var(--vscode-editor-foreground, #333)",fontWeight:"bold",fontSize:"1.2em"},childNode:{color:"var(--vscode-editor-foreground, black)",background:"var(--vscode-editorWidget-background, var(--vscode-editor-background, white))",border:"2px solid var(--node-color)"},connection:{color:"var(--node-color)"},canvas:{background:"var(--vscode-editor-background, transparent)"}},getColor:Q=>At[Q%At.length]},Yt={name:"dark",isDark:!0,styles:{rootNode:{color:"#eee",background:"#333",border:"2px solid #555",fontWeight:"bold",fontSize:"1.2em"},childNode:{color:"#ddd",background:"#222",border:"1px solid #444"},connection:{color:"#555"},canvas:{background:"#1e1e1e"}}};class ct{static instance;themes=new Map;currentTheme=Et;constructor(){this.registerTheme(Et),this.registerTheme(Kt),this.registerTheme(Xt),this.registerTheme(Yt)}static getInstance(){return ct.instance||(ct.instance=new ct),ct.instance}registerTheme(t){this.themes.set(t.name,t)}getTheme(t){return this.themes.get(t)}getAvailableThemes(){return Array.from(this.themes.keys())}applyTheme(t,e){const i=this.getTheme(e);return i?(this.currentTheme=i,this.applyStyles(t,i),i):(console.warn(`Theme '${e}' not found. Falling back to default.`),this.currentTheme)}getCurrentTheme(){return this.currentTheme}setCustomTheme(t){const e=Et.styles,i={name:"custom",isDark:!1,styles:{rootNode:{color:t.rootNode?.color||e.rootNode.color,background:t.rootNode?.background||e.rootNode.background,border:t.rootNode?.border||e.rootNode.border,fontSize:e.rootNode.fontSize,fontWeight:e.rootNode.fontWeight},childNode:{color:t.childNode?.color||e.childNode.color,background:t.childNode?.background||e.childNode.background,border:t.childNode?.border||e.childNode.border,fontSize:e.childNode.fontSize},connection:{color:t.connection?.color||e.connection.color},canvas:{background:t.canvas?.background||e.canvas.background}}};this.registerTheme(i)}applyStyles(t,e){const i=e.styles;t.style.setProperty("--mindmap-root-color",i.rootNode.color),t.style.setProperty("--mindmap-root-background",i.rootNode.background),t.style.setProperty("--mindmap-root-border",i.rootNode.border),i.rootNode.fontSize&&t.style.setProperty("--mindmap-root-font-size",i.rootNode.fontSize),i.rootNode.fontWeight&&t.style.setProperty("--mindmap-root-font-weight",i.rootNode.fontWeight),t.style.setProperty("--mindmap-child-color",i.childNode.color),t.style.setProperty("--mindmap-child-background",i.childNode.background),t.style.setProperty("--mindmap-child-border",i.childNode.border),i.childNode.fontSize&&t.style.setProperty("--mindmap-child-font-size",i.childNode.fontSize),t.style.setProperty("--mindmap-connection-color",i.connection.color),t.style.setProperty("--mindmap-canvas-background",i.canvas.background)}}const It={blue_circle:{path:'<circle cx="12" cy="12" r="10" fill="#3498DB" />',color:"#3498DB",viewBox:"0 0 24 24"},red_circle:{path:'<circle cx="12" cy="12" r="10" fill="#E74C3C" />',color:"#E74C3C",viewBox:"0 0 24 24"},question:{path:'<path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 17h-2v-2h2v2zm2.07-7.75l-.9.92C13.45 12.9 13 13.5 13 15h-2v-.5c0-1.1.45-2.1 1.17-2.83l1.24-1.26c.37-.36.59-.86.59-1.41 0-1.1-.9-2-2-2s-2 .9-2 2H8c0-2.21 1.79-4 4-4s4 1.79 4 4c0 .88-.36 1.68-.93 2.25z" fill="#95A5A6" />',color:"#95A5A6",viewBox:"0 0 24 24"},important:{path:'<path d="M12 17.27L18.18 21l-1.64-7.03L22 9.24l-7.19-.61L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21z" fill="#F1C40F" />',color:"#F1C40F",viewBox:"0 0 24 24"},check:{path:'<path d="M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z" fill="#2ECC71" />',color:"#2ECC71",viewBox:"0 0 24 24"},cross:{path:'<path d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z" fill="#E74C3C" />',color:"#E74C3C",viewBox:"0 0 24 24"},flag:{path:'<path d="M14.4 6L14 4H5v17h2v-7h5.6l.4 2h7V6z" fill="#E67E22" />',color:"#E67E22",viewBox:"0 0 24 24"},idea:{path:'<path d="M9 21c0 .55.45 1 1 1h4c.55 0 1-.45 1-1v-1H9v1zm3-19C8.14 2 5 5.14 5 9c0 2.38 1.19 4.47 3 5.74V17c0 .55.45 1 1 1h6c.55 0 1-.45 1-1v-2.26c1.81-1.27 3-3.36 3-5.74 0-3.86-3.14-7-7-7zm2.85 11.1l-.85.6V16h-4v-2.3l-.85-.6C7.8 12.16 7 10.63 7 9c0-2.76 2.24-5 5-5s5 2.24 5 5c0 1.63-.8 3.16-2.15 4.1z" fill="#F39C12" />',color:"#F39C12",viewBox:"0 0 24 24"},warning:{path:'<path d="M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z" fill="#E67E22" />',color:"#E67E22",viewBox:"0 0 24 24"},schedule:{path:'<path d="M19 3h-1V1h-2v2H8V1H6v2H5c-1.11 0-1.99.9-1.99 2L3 19c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16H5V8h14v11zM7 10h5v5H7z" fill="#3498DB" />',color:"#3498DB",viewBox:"0 0 24 24"},num_0_blue:{path:'<rect x="2" y="2" width="20" height="20" rx="4" ry="4" fill="#3498DB" /><text x="12" y="16.5" font-family="sans-serif" font-size="14" font-weight="bold" fill="white" text-anchor="middle">0</text>',color:"#3498DB",viewBox:"0 0 24 24"},num_1_blue:{path:'<rect x="2" y="2" width="20" height="20" rx="4" ry="4" fill="#3498DB" /><text x="12" y="16.5" font-family="sans-serif" font-size="14" font-weight="bold" fill="white" text-anchor="middle">1</text>',color:"#3498DB",viewBox:"0 0 24 24"},num_2_blue:{path:'<rect x="2" y="2" width="20" height="20" rx="4" ry="4" fill="#3498DB" /><text x="12" y="16.5" font-family="sans-serif" font-size="14" font-weight="bold" fill="white" text-anchor="middle">2</text>',color:"#3498DB",viewBox:"0 0 24 24"},num_3_blue:{path:'<rect x="2" y="2" width="20" height="20" rx="4" ry="4" fill="#3498DB" /><text x="12" y="16.5" font-family="sans-serif" font-size="14" font-weight="bold" fill="white" text-anchor="middle">3</text>',color:"#3498DB",viewBox:"0 0 24 24"},num_4_blue:{path:'<rect x="2" y="2" width="20" height="20" rx="4" ry="4" fill="#3498DB" /><text x="12" y="16.5" font-family="sans-serif" font-size="14" font-weight="bold" fill="white" text-anchor="middle">4</text>',color:"#3498DB",viewBox:"0 0 24 24"},num_5_blue:{path:'<rect x="2" y="2" width="20" height="20" rx="4" ry="4" fill="#3498DB" /><text x="12" y="16.5" font-family="sans-serif" font-size="14" font-weight="bold" fill="white" text-anchor="middle">5</text>',color:"#3498DB",viewBox:"0 0 24 24"},num_6_blue:{path:'<rect x="2" y="2" width="20" height="20" rx="4" ry="4" fill="#3498DB" /><text x="12" y="16.5" font-family="sans-serif" font-size="14" font-weight="bold" fill="white" text-anchor="middle">6</text>',color:"#3498DB",viewBox:"0 0 24 24"},num_7_blue:{path:'<rect x="2" y="2" width="20" height="20" rx="4" ry="4" fill="#3498DB" /><text x="12" y="16.5" font-family="sans-serif" font-size="14" font-weight="bold" fill="white" text-anchor="middle">7</text>',color:"#3498DB",viewBox:"0 0 24 24"},num_8_blue:{path:'<rect x="2" y="2" width="20" height="20" rx="4" ry="4" fill="#3498DB" /><text x="12" y="16.5" font-family="sans-serif" font-size="14" font-weight="bold" fill="white" text-anchor="middle">8</text>',color:"#3498DB",viewBox:"0 0 24 24"},num_9_blue:{path:'<rect x="2" y="2" width="20" height="20" rx="4" ry="4" fill="#3498DB" /><text x="12" y="16.5" font-family="sans-serif" font-size="14" font-weight="bold" fill="white" text-anchor="middle">9</text>',color:"#3498DB",viewBox:"0 0 24 24"},num_0_red:{path:'<rect x="2" y="2" width="20" height="20" rx="4" ry="4" fill="#E74C3C" /><text x="12" y="16.5" font-family="sans-serif" font-size="14" font-weight="bold" fill="white" text-anchor="middle">0</text>',color:"#E74C3C",viewBox:"0 0 24 24"},num_1_red:{path:'<rect x="2" y="2" width="20" height="20" rx="4" ry="4" fill="#E74C3C" /><text x="12" y="16.5" font-family="sans-serif" font-size="14" font-weight="bold" fill="white" text-anchor="middle">1</text>',color:"#E74C3C",viewBox:"0 0 24 24"},num_2_red:{path:'<rect x="2" y="2" width="20" height="20" rx="4" ry="4" fill="#E74C3C" /><text x="12" y="16.5" font-family="sans-serif" font-size="14" font-weight="bold" fill="white" text-anchor="middle">2</text>',color:"#E74C3C",viewBox:"0 0 24 24"},num_3_red:{path:'<rect x="2" y="2" width="20" height="20" rx="4" ry="4" fill="#E74C3C" /><text x="12" y="16.5" font-family="sans-serif" font-size="14" font-weight="bold" fill="white" text-anchor="middle">3</text>',color:"#E74C3C",viewBox:"0 0 24 24"},num_4_red:{path:'<rect x="2" y="2" width="20" height="20" rx="4" ry="4" fill="#E74C3C" /><text x="12" y="16.5" font-family="sans-serif" font-size="14" font-weight="bold" fill="white" text-anchor="middle">4</text>',color:"#E74C3C",viewBox:"0 0 24 24"},num_5_red:{path:'<rect x="2" y="2" width="20" height="20" rx="4" ry="4" fill="#E74C3C" /><text x="12" y="16.5" font-family="sans-serif" font-size="14" font-weight="bold" fill="white" text-anchor="middle">5</text>',color:"#E74C3C",viewBox:"0 0 24 24"},num_6_red:{path:'<rect x="2" y="2" width="20" height="20" rx="4" ry="4" fill="#E74C3C" /><text x="12" y="16.5" font-family="sans-serif" font-size="14" font-weight="bold" fill="white" text-anchor="middle">6</text>',color:"#E74C3C",viewBox:"0 0 24 24"},num_7_red:{path:'<rect x="2" y="2" width="20" height="20" rx="4" ry="4" fill="#E74C3C" /><text x="12" y="16.5" font-family="sans-serif" font-size="14" font-weight="bold" fill="white" text-anchor="middle">7</text>',color:"#E74C3C",viewBox:"0 0 24 24"},num_8_red:{path:'<rect x="2" y="2" width="20" height="20" rx="4" ry="4" fill="#E74C3C" /><text x="12" y="16.5" font-family="sans-serif" font-size="14" font-weight="bold" fill="white" text-anchor="middle">8</text>',color:"#E74C3C",viewBox:"0 0 24 24"},num_9_red:{path:'<rect x="2" y="2" width="20" height="20" rx="4" ry="4" fill="#E74C3C" /><text x="12" y="16.5" font-family="sans-serif" font-size="14" font-weight="bold" fill="white" text-anchor="middle">9</text>',color:"#E74C3C",viewBox:"0 0 24 24"}};class Gt{container;svg;nodeContainer;options;maxWidth=-1;measureCache=new Map;nodeElementMap=new Map;previousSelectedIds=new Set;mindMap;constructor(t,e={}){this.container=t,this.container.style.position="relative",this.container.style.width="100%",this.container.style.height="100%",this.container.style.overflow="hidden",this.container.style.backgroundColor="var(--vscode-editor-background, transparent)",this.svg=document.createElementNS("http://www.w3.org/2000/svg","svg"),this.svg.style.position="absolute",this.svg.style.top="0",this.svg.style.left="0",this.svg.style.width="100%",this.svg.style.height="100%",this.svg.style.zIndex="0",this.svg.style.pointerEvents="none",this.svg.style.overflow="visible",this.svg.style.transformOrigin="0 0",this.container.appendChild(this.svg),this.nodeContainer=document.createElement("div"),this.nodeContainer.style.position="absolute",this.nodeContainer.style.top="0",this.nodeContainer.style.left="0",this.nodeContainer.style.width="100%",this.nodeContainer.style.height="100%",this.nodeContainer.style.zIndex="1",this.nodeContainer.style.transformOrigin="0 0",this.container.appendChild(this.nodeContainer),this.options=e}renderFromLayout(t,e,i,n="Right"){this.mindMap=e,this.svg.innerHTML="",this.nodeContainer.innerHTML="",this.measureCache.clear(),this.nodeElementMap.clear(),this.previousSelectedIds.clear(),t.connections.forEach(r=>{const s=e.findNode(r.toNodeId),o=s?this.getThemeColor(s,e):"#ccc";this.drawConnection(r.fromX,r.fromY,r.toX,r.toY,o,e.theme)}),t.nodes.forEach(r=>{const s=e.findNode(r.nodeId);s&&this.renderNodeElement(s,r.x,r.y,r.width,r.direction,i,n,e)}),this.previousSelectedIds=new Set(i)}updateTransform(t,e,i=1){const n=`translate(${t}px, ${e}px) scale(${i})`;this.svg.style.transform=n,this.nodeContainer.style.transform=n}getThemeColor(t,e){const i=ct.getInstance().getCurrentTheme();if(i.getColor){if(t.isRoot)return"#333";let n=t,r=0;for(;n.parentId&&n.parentId!==e.root.id;){const l=e.findNode(n.parentId);if(!l)break;n=l,r++}const o=e.root.children.findIndex(l=>l.id===n.id);if(o!==-1)return i.getColor(o,r)}return i.styles?.connection?.color||"#ccc"}renderNodeElement(t,e,i,n,r,s,o,l){const g=t.isRoot,b=ct.getInstance().getCurrentTheme(),u=document.createElement("div");if(u.dataset.id=t.id,u.style.position="absolute",u.style.left=`${e}px`,u.style.top=`${i}px`,t.image){const m=document.createElement("img");m.src=t.image,t.imageSize?t.imageSize.width>150?(m.style.width="150px",m.style.height="auto"):(m.style.width=`${t.imageSize.width}px`,m.style.height=`${t.imageSize.height}px`):(m.style.maxWidth="150px",m.style.maxHeight="150px"),m.style.display="block",u.appendChild(m);const h=document.createElement("div");h.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="var(--vscode-icon-foreground, #333)" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="11" cy="11" r="8"></circle><line x1="21" y1="21" x2="16.65" y2="16.65"></line><line x1="11" y1="8" x2="11" y2="14"></line><line x1="8" y1="11" x2="14" y2="11"></line></svg>',h.style.position="absolute",h.style.bottom="5px",h.style.right="5px",h.style.backgroundColor="var(--vscode-editor-background, rgba(255, 255, 255, 0.9))",h.style.borderRadius="50%",h.style.width="24px",h.style.height="24px",h.style.display="flex",h.style.justifyContent="center",h.style.alignItems="center",h.style.cursor="pointer",h.title="Zoom Image",h.style.boxShadow="0 1px 3px rgba(0,0,0,0.2)",u.appendChild(h),h.addEventListener("click",p=>{p.stopPropagation(),this.showImageModal(t.image)}),u.style.padding="5px"}else{if(u.style.display="flex",u.style.alignItems="center",u.style.justifyContent=t.isRoot?"center":"flex-start",t.icon){const w=It[t.icon];if(w){const _=document.createElementNS("http://www.w3.org/2000/svg","svg");_.setAttribute("viewBox",w.viewBox),_.setAttribute("width","20"),_.setAttribute("height","20"),_.style.width="20px",_.style.height="20px",_.style.marginRight="8px",_.style.flexShrink="0",_.innerHTML=w.path,u.appendChild(_)}else{const _=document.createElement("span");_.textContent=t.icon,_.style.marginRight="6px",_.style.fontSize="1.2em",u.appendChild(_)}}const m=document.createElement("span"),h=/(https?:\/\/[^\s]+)/g;t.topic.split(h).forEach(w=>{if(w.match(h)){const _=document.createElement("a");_.href=w,_.target="_blank",_.rel="noopener noreferrer",_.textContent=w,_.style.color="#3498DB",_.style.textDecoration="underline",_.style.cursor="pointer",_.addEventListener("mousedown",C=>C.stopPropagation()),_.addEventListener("click",C=>C.stopPropagation()),m.appendChild(_)}else m.appendChild(document.createTextNode(w))}),u.appendChild(m);const f=t.presentation.customWidth??(this.maxWidth!==-1?this.maxWidth:void 0);f!==void 0?(m.style.whiteSpace="pre-wrap",m.style.wordWrap="break-word",m.style.overflowWrap="anywhere",m.style.minWidth="0",u.style.maxWidth=`${f}px`,u.style.width="max-content"):m.style.whiteSpace="pre"}u.className="mindmap-node",u.style.position="absolute",u.style.touchAction="none",u.style.padding="8px 12px",t.image&&(u.style.padding="5px"),b.name==="custom"?t.isRoot?u.style.color="var(--mindmap-root-color, var(--vscode-editor-foreground, black))":u.style.color="var(--mindmap-child-color, var(--vscode-editor-foreground, black))":t.isRoot?u.style.color="var(--mindmap-root-color)":u.style.color="var(--mindmap-child-color)";const y=this.getThemeColor(t,l);if(u.style.setProperty("--node-color",y),b.name==="colorful")t.isRoot?u.style.border="2px solid var(--vscode-editor-foreground, #333)":u.style.border=`2px solid ${y}`;else if(b.name==="custom")if(t.isRoot){const m="2px solid var(--vscode-editor-foreground, #333)";u.style.border=`var(--mindmap-root-border, ${m})`}else u.style.border="var(--mindmap-child-border, 1px solid #ccc)";else t.isRoot?u.style.border="var(--mindmap-root-border)":u.style.border="var(--mindmap-child-border)";if(u.style.borderRadius="4px",t.isRoot&&(u.style.fontSize="1.2em",u.style.fontWeight="bold",b.name!=="custom"&&(u.style.border="2px solid var(--vscode-editor-foreground, #333)")),t.style.color&&(u.style.color=t.style.color),t.style.fontSize&&(u.style.fontSize=t.style.fontSize),t.style.fontWeight&&(u.style.fontWeight=t.style.fontWeight),t.style.fontStyle&&(u.style.fontStyle=t.style.fontStyle),t.style.textDecoration&&(u.style.textDecoration=t.style.textDecoration),t.style.background)u.style.backgroundColor=t.style.background;else if(b.name==="custom")t.isRoot?u.style.backgroundColor="var(--mindmap-root-background, var(--vscode-editor-background, white))":u.style.backgroundColor="var(--mindmap-child-background, var(--vscode-editor-background, white))";else if(t.isRoot)u.style.backgroundColor="var(--mindmap-root-background)";else{const m=b.name==="colorful"?"var(--vscode-editor-background, white)":"inherit";u.style.backgroundColor=`var(--mindmap-child-background, ${m})`}let c=e;if(r==="left"&&!g?c=e-n:g&&(c=e-n/2),u.style.left=`${c}px`,u.style.top=`${i}px`,u.style.transform="translate(0, -50%)",u.style.zIndex="10",u.style.cursor="default",u.style.userSelect="none",s.has(t.id)&&(u.style.outline="2px solid var(--vscode-focusBorder, #007bff)",u.style.boxShadow="0 0 5px var(--vscode-focusBorder, rgba(0, 123, 255, 0.5))",u.dataset.selected="true"),this.nodeContainer.appendChild(u),this.nodeElementMap.set(t.id,u),t.children.length!==0&&this.options.onToggleFold){const m=[];if(g&&o==="Both")m.push(c+n),m.push(c);else{let h=r==="right";g&&(o==="Left"?h=!1:h=!0),m.push(h?c+n:c)}m.forEach(h=>{const p=document.createElement("div");p.className="mindmap-toggle-btn",p.innerHTML=t.presentation.isFolded?"+":"-",p.style.position="absolute",p.style.width="16px",p.style.height="16px",p.style.fontSize="12px",p.style.lineHeight="14px",p.style.textAlign="center",p.style.borderRadius="50%",p.style.border="1px solid var(--vscode-widget-border, #999)",p.style.backgroundColor="var(--vscode-editor-background, #fff)",p.style.color="var(--vscode-editor-foreground, #000)",p.style.cursor="pointer",p.style.zIndex="11",p.style.userSelect="none";const f=0;p.style.left=`${h+f}px`,p.style.top=`${i}px`,p.style.transform="translate(-50%, -50%)",p.addEventListener("click",w=>{w.stopPropagation(),this.options.onToggleFold?.(t.id)}),this.nodeContainer.appendChild(p)})}}measureNode(t,e){if(this.measureCache.has(t.id))return this.measureCache.get(t.id);if(t.image){if(t.imageSize){if(t.imageSize.width>150){const m={width:160,height:150*(t.imageSize.height/t.imageSize.width)+10};return this.measureCache.set(t.id,m),m}const y={width:t.imageSize.width+10,height:t.imageSize.height+10};return this.measureCache.set(t.id,y),y}const u={width:160,height:160};return this.measureCache.set(t.id,u),u}const i=document.createElement("div");if(i.className="mindmap-node",i.style.visibility="hidden",i.style.position="absolute",i.style.display="flex",i.style.alignItems="center",t.icon)if(It[t.icon]){const y=document.createElement("div");y.style.width="20px",y.style.height="20px",y.style.marginRight="8px",y.style.flexShrink="0",i.appendChild(y)}else{const y=document.createElement("span");y.textContent=t.icon,y.style.marginRight="6px",y.style.fontSize="1.2em",i.appendChild(y)}const n=document.createElement("span");n.textContent=t.topic,i.appendChild(n);const r=t.presentation.customWidth??(this.maxWidth!==-1?this.maxWidth:void 0);r!==void 0?(n.style.whiteSpace="pre-wrap",n.style.wordWrap="break-word",n.style.overflowWrap="anywhere",n.style.minWidth="0",i.style.maxWidth=`${r}px`,i.style.width="max-content"):n.style.whiteSpace="pre",i.style.padding="8px 12px";const s=ct.getInstance().getCurrentTheme(),o=e?this.getThemeColor(t,e):"#ccc";i.style.setProperty("--node-color",o),s.name==="colorful"?t.isRoot?i.style.border="2px solid var(--vscode-editor-foreground, #333)":i.style.border=`2px solid ${o}`:s.name==="custom"?t.isRoot?i.style.border="var(--mindmap-root-border, 2px solid #333)":i.style.border="var(--mindmap-child-border, 1px solid #ccc)":t.isRoot?i.style.border="var(--mindmap-root-border)":i.style.border="var(--mindmap-child-border)",t.isRoot&&(i.style.fontSize="1.2em",i.style.fontWeight="bold",s.name!=="custom"&&(i.style.border="2px solid var(--vscode-editor-foreground, #333)")),t.style.color&&(i.style.color=t.style.color),t.style.fontSize&&(i.style.fontSize=t.style.fontSize),t.style.fontWeight&&(i.style.fontWeight=t.style.fontWeight),t.style.fontStyle&&(i.style.fontStyle=t.style.fontStyle),t.style.textDecoration&&(i.style.textDecoration=t.style.textDecoration),t.style.background&&(i.style.backgroundColor=t.style.background),this.nodeContainer.appendChild(i);const l=i.offsetWidth,g=i.offsetHeight;this.nodeContainer.removeChild(i);const b={width:l||100,height:g||40};return this.measureCache.set(t.id,b),b}drawConnection(t,e,i,n,r="#ccc",s="default"){const o=document.createElementNS("http://www.w3.org/2000/svg","path"),l=t+(i-t)/2,g=t+(i-t)/2,b=`M ${t} ${e} C ${l} ${e}, ${g} ${n}, ${i} ${n}`;if(o.setAttribute("d",b),s==="custom")o.style.stroke=`var(--mindmap-connection-color, ${r})`;else{o.style.stroke="var(--mindmap-connection-color, #ccc)";const u=ct.getInstance().getCurrentTheme();if(u.name==="colorful"||s==="colorful")o.setAttribute("stroke",r),o.style.stroke=r;else{o.style.stroke="var(--mindmap-connection-color)";const y=u.styles?.connection?.color||r;o.setAttribute("stroke",y)}}o.setAttribute("fill","none"),o.setAttribute("stroke-width","2"),this.svg.appendChild(o)}zoomNode(t){const e=this.mindMap?.findNode(t);e&&e.image&&this.showImageModal(e.image)}showImageModal(t){this.options.onImageZoom&&this.options.onImageZoom(!0);const e=document.createElement("div");e.style.position="fixed",e.style.top="0",e.style.left="0",e.style.width="100vw",e.style.height="100vh",e.style.backgroundColor="rgba(0,0,0,0.8)",e.style.zIndex="1000",e.style.display="flex",e.style.justifyContent="center",e.style.alignItems="center",e.style.cursor="zoom-out";const i=document.createElement("img");i.src=t,i.style.maxWidth="90%",i.style.maxHeight="90%",i.style.boxShadow="0 0 20px rgba(0,0,0,0.5)",e.appendChild(i),document.body.appendChild(e);let n;const r=()=>{document.body.contains(e)&&document.body.removeChild(e),n&&document.removeEventListener("keydown",n,!0),this.options.onImageZoom&&this.options.onImageZoom(!1),this.container.focus()};n=s=>{s.stopPropagation(),s.preventDefault(),r()},document.addEventListener("keydown",n,!0),e.addEventListener("click",()=>{r()})}getNodeElement(t){return this.nodeElementMap.get(t)}updateSelection(t){for(const e of this.previousSelectedIds)if(!t.has(e)){const i=this.nodeElementMap.get(e);i&&(i.style.outline="",i.style.boxShadow="",delete i.dataset.selected)}for(const e of t){const i=this.nodeElementMap.get(e);i&&(i.style.outline="2px solid var(--vscode-focusBorder, #007bff)",i.style.boxShadow="0 0 5px var(--vscode-focusBorder, rgba(0, 123, 255, 0.5))",i.dataset.selected="true")}this.previousSelectedIds=new Set(t)}}class vt{container;editorEl;currentNodeId=null;onUpdate;static FONT_SIZES=[{label:"12px",value:"12px"},{label:"14px",value:"14px"},{label:"16px",value:"16px"},{label:"18px",value:"18px"},{label:"24px",value:"24px"},{label:"32px",value:"32px"},{label:"48px",value:"48px"}];static PALETTE=["#000000","#E74C3C","#E67E22","#F1C40F","#2ECC71","#3498DB","#9B59B6"];constructor(t){this.container=t,this.editorEl=this.createEditor(),this.container.appendChild(this.editorEl),this.editorEl.addEventListener("mousedown",e=>e.stopPropagation()),this.editorEl.addEventListener("click",e=>e.stopPropagation()),this.editorEl.addEventListener("dblclick",e=>e.stopPropagation())}createEditor(){const t=document.createElement("div");t.className="style-editor",t.style.position="absolute",t.style.top="20px",t.style.right="20px",t.style.display="none",t.style.backgroundColor="white",t.style.border="1px solid #eee",t.style.borderRadius="8px",t.style.padding="8px",t.style.boxShadow="0 4px 12px rgba(0,0,0,0.1)",t.style.zIndex="2000",t.style.pointerEvents="auto",t.style.fontFamily="Arial, sans-serif",t.style.display="flex",t.style.flexDirection="column",t.style.gap="8px",t.style.margin="0",t.style.boxSizing="border-box",t.style.minWidth="220px";const e=document.createElement("div");e.style.display="flex",e.style.gap="8px",e.style.alignItems="center";const i=document.createElement("select");i.style.padding="4px 8px",i.style.borderRadius="4px",i.style.border="1px solid #ccc",i.style.fontSize="14px",i.style.flex="1",vt.FONT_SIZES.forEach(u=>{const y=document.createElement("option");y.value=u.value,y.textContent=u.label,i.appendChild(y)}),i.onchange=u=>{this.currentNodeId&&this.onUpdate&&this.onUpdate(this.currentNodeId,{fontSize:u.target.value})},e.appendChild(i);const r=(u,y,c)=>{const m=document.createElement("button");return m.textContent=u,m.style.width="32px",m.style.height="32px",m.style.padding="0",m.style.display="flex",m.style.justifyContent="center",m.style.alignItems="center",m.style.border="1px solid #ddd",m.style.backgroundColor="#f5f5f5",m.style.borderRadius="4px",m.style.cursor="pointer",m.style.fontSize="14px",y&&(m.style[y]=y==="fontWeight"?"bold":y==="fontStyle"?"italic":"line-through"),m.onclick=c,m},s=r("B","fontWeight",()=>{if(this.currentNodeId&&this.onUpdate){const u=s.classList.contains("active"),y=u?"normal":"bold";this.onUpdate(this.currentNodeId,{fontWeight:y}),this.updateButtonState(s,!u)}}),o=r("I","fontStyle",()=>{if(this.currentNodeId&&this.onUpdate){const u=o.classList.contains("active"),y=u?"normal":"italic";this.onUpdate(this.currentNodeId,{fontStyle:y}),this.updateButtonState(o,!u)}}),l=r("S","textDecoration",()=>{if(this.currentNodeId&&this.onUpdate){const u=l.classList.contains("active"),y=u?"none":"line-through";this.onUpdate(this.currentNodeId,{textDecoration:y}),this.updateButtonState(l,!u)}});e.appendChild(s),e.appendChild(o),e.appendChild(l),t.appendChild(e);const g=document.createElement("div");g.style.display="flex",g.style.gap="4px",g.style.alignItems="center",g.style.justifyContent="space-between";const b=document.createElement("input");return b.type="color",b.style.width="24px",b.style.height="24px",b.style.border="1px solid #ccc",b.style.padding="0",b.style.backgroundColor="transparent",b.style.cursor="pointer",b.style.appearance="none",b.onchange=u=>{this.currentNodeId&&this.onUpdate&&(this.onUpdate(this.currentNodeId,{color:u.target.value}),this.updateActivePaletteItem(u.target.value))},vt.PALETTE.forEach((u,y)=>{const c=document.createElement("div");c.className="color-swatch",c.dataset.color=u,c.textContent=(y+1).toString(),c.style.width="24px",c.style.height="24px",c.style.backgroundColor=u,c.style.borderRadius="4px",c.style.cursor="pointer",c.style.border="1px solid transparent",c.style.color=u==="#F1C40F"?"black":"white",c.style.fontSize="12px",c.style.fontWeight="bold",c.style.display="flex",c.style.justifyContent="center",c.style.alignItems="center",c.onclick=()=>{this.currentNodeId&&this.onUpdate&&(this.onUpdate(this.currentNodeId,{color:u}),b.value=u,this.updateActivePaletteItem(u))},g.appendChild(c)}),g.appendChild(b),t.appendChild(g),t}updateActivePaletteItem(t){this.editorEl.querySelectorAll(".color-swatch").forEach(i=>{const n=i;n.dataset.color?.toLowerCase()===t.toLowerCase()?(n.style.border="2px solid #ccc",n.style.transform="scale(1.1)"):(n.style.border="1px solid transparent",n.style.transform="scale(1)")})}updateButtonState(t,e){e?(t.classList.add("active"),t.style.backgroundColor="#e0e0e0",t.style.borderColor="#999"):(t.classList.remove("active"),t.style.backgroundColor="#f5f5f5",t.style.borderColor="#ddd")}show(t,e){this.currentNodeId=t,this.editorEl.style.display="flex";const i=this.editorEl.querySelector("select");i.value=e.fontSize||"";const n=this.editorEl.querySelector('input[type="color"]'),r=e.color||"#000000";n.value=r,this.updateActivePaletteItem(r);const s=this.editorEl.querySelectorAll("button")[0];s&&this.updateButtonState(s,e.fontWeight==="bold");const o=this.editorEl.querySelectorAll("button")[1];o&&this.updateButtonState(o,e.fontStyle==="italic");const l=this.editorEl.querySelectorAll("button")[2];l&&this.updateButtonState(l,e.textDecoration==="line-through")}hide(){this.editorEl.style.display="none",this.currentNodeId=null}}class $t{container;element;options;currentMode="Right";currentTheme="default";layoutButtons=new Map;themeButtons=new Map;constructor(t,e){this.container=t,this.options=e,this.element=document.createElement("div"),this.render()}render(){this.element.style.position="absolute",this.element.style.top="20px",this.element.style.left="20px",this.element.style.display="flex",this.element.style.flexDirection="column",this.element.style.backgroundColor="white",this.element.style.borderRadius="8px",this.element.style.boxShadow="0 2px 10px rgba(0,0,0,0.1)",this.element.style.padding="5px",this.element.style.zIndex="2000",this.element.style.gap="5px",this.element.style.pointerEvents="auto",this.element.addEventListener("click",t=>t.stopPropagation()),this.element.addEventListener("mousedown",t=>t.stopPropagation()),this.createLayoutButton("Right",this.getRightIcon()),this.createLayoutButton("Left",this.getLeftIcon()),this.createLayoutButton("Both",this.getBothIcon()),this.addSeparator(),this.createThemeButton("default",this.getThemeDefaultIcon()),this.createThemeButton("simple",this.getThemeSimpleIcon()),this.createThemeButton("colorful",this.getThemeColorfulIcon()),this.createThemeButton("custom",this.getThemeCustomIcon()),this.addSeparator(),this.createIconActionButton("Reset Zoom",this.getZoomResetIcon(),()=>{this.options.onZoomReset&&this.options.onZoomReset()}),this.addSeparator(),this.createIconActionButton("Help",this.getHelpIcon(),()=>{this.options.onShowHelp&&this.options.onShowHelp()}),this.container.appendChild(this.element),this.updateActiveButtons()}addSeparator(){const t=document.createElement("div");t.style.height="1px",t.style.backgroundColor="#ccc",t.style.margin="5px 2px",this.element.appendChild(t)}createLayoutButton(t,e){const i=document.createElement("button");i.innerHTML=e,this.styleButton(i),i.title=`Layout: ${t}`,i.addEventListener("click",()=>{this.setMode(t)}),this.element.appendChild(i),this.layoutButtons.set(t,i)}createThemeButton(t,e){const i=document.createElement("button");i.innerHTML=e,this.styleButton(i),i.title=`Theme: ${t}`,i.addEventListener("click",()=>{this.setTheme(t)}),this.element.appendChild(i),this.themeButtons.set(t,i)}createIconActionButton(t,e,i){const n=document.createElement("button");n.innerHTML=e,this.styleButton(n),n.title=t,n.addEventListener("click",i),this.element.appendChild(n)}styleButton(t){t.style.width="32px",t.style.height="32px",t.style.border="none",t.style.background="transparent",t.style.cursor="pointer",t.style.borderRadius="4px",t.style.display="flex",t.style.alignItems="center",t.style.justifyContent="center",t.style.color="#555"}updateActiveButtons(){this.layoutButtons.forEach((t,e)=>{e===this.currentMode?(t.style.backgroundColor="#e6f7ff",t.style.color="#007bff"):(t.style.backgroundColor="transparent",t.style.color="#555")}),this.themeButtons.forEach((t,e)=>{e===this.currentTheme?(t.style.backgroundColor="#e6f7ff",t.style.color="#007bff"):(t.style.backgroundColor="transparent",t.style.color="#555")})}setMode(t){this.currentMode!==t&&(this.currentMode=t,this.updateActiveButtons(),this.options.onLayoutChange(t))}setTheme(t){this.currentTheme!==t&&(this.currentTheme=t,this.updateActiveButtons(),this.options.onThemeChange(t))}getIconDescriptions(t){return t==="ja"?[{id:"right",desc:"右配置: すべてのノードをルートの右側に配置します。"},{id:"left",desc:"左配置: すべてのノードをルートの左側に配置します。"},{id:"both",desc:"左右配置: ノードをルートの両側にバランスよく配置します。"},{id:"default",desc:"デフォルトテーマ: 枠線のある標準的なデザインです。"},{id:"simple",desc:"シンプルテーマ: 枠線のない、箇条書きのようなシンプルなスタイルです。"},{id:"colorful",desc:"カラフルテーマ: 枝ごとに色分けしたデザインです。"},{id:"custom",desc:"カスタムテーマ: カスタムスタイルを適用します。"},{id:"resetZoom",desc:"ズームリセット: ズームをリセットして中央に移動します。"},{id:"help",desc:"ヘルプ: このヘルプ画面を表示します。"}]:[{id:"right",desc:"Right: All nodes are placed on the right side of the root."},{id:"left",desc:"Left: All nodes are placed on the left side of the root."},{id:"both",desc:"Both: Nodes are balanced on both sides of the root."},{id:"default",desc:"Default Theme: Standard design with borders."},{id:"simple",desc:"Simple Theme: Minimal style without borders, like bullet points."},{id:"colorful",desc:"Colorful Theme: Color-coded design for each branch."},{id:"custom",desc:"Custom Theme: Your custom styles are applied."},{id:"resetZoom",desc:"Reset Zoom: Resets zoom and centers the view."},{id:"help",desc:"Help: Shows this help screen."}]}getRightIcon(){return`<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
|
2
3
|
<circle cx="5" cy="12" r="3"></circle>
|
|
3
4
|
<path d="M8 12h8"></path>
|
|
4
5
|
<path d="M8 12 L16 5"></path>
|
|
@@ -37,20 +38,20 @@
|
|
|
37
38
|
<circle cx="12" cy="12" r="10"></circle>
|
|
38
39
|
<path d="M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"></path>
|
|
39
40
|
<line x1="12" y1="17" x2="12.01" y2="17"></line>
|
|
40
|
-
</svg>`}}const
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
`,document.head.appendChild(t)}handleDragStart(t){const e=t;if(this.isReadOnly){e.preventDefault();return}const r=e.target.closest(".mindmap-node");r&&r.dataset.id&&(this.draggedNodeId=r.dataset.id,e.dataTransfer?.setData("text/plain",r.dataset.id),e.dataTransfer&&(e.dataTransfer.effectAllowed="move"))}handleDragOver(t){const e=t;if(this.isReadOnly)return;e.preventDefault();const r=e.target.closest(".mindmap-node");if(r&&r.dataset.id&&this.draggedNodeId&&r.dataset.id!==this.draggedNodeId){const n=this.getDropPosition(e,r);r.classList.remove("drag-over-top","drag-over-bottom","drag-over-left","drag-over-right"),r.classList.add(`drag-over-${n}`),e.dataTransfer&&(e.dataTransfer.dropEffect="move")}}handleDragLeave(t){const i=t.target.closest(".mindmap-node");i&&i.classList.remove("drag-over-top","drag-over-bottom","drag-over-left","drag-over-right")}handleDrop(t){const e=t;e.preventDefault();const r=e.target.closest(".mindmap-node");if(this.container.querySelectorAll(".mindmap-node").forEach(n=>{n.classList.remove("drag-over-top","drag-over-bottom","drag-over-left","drag-over-right")}),!this.isReadOnly){if(r&&r.dataset.id&&this.draggedNodeId){const n=r.dataset.id;if(this.draggedNodeId!==n){const o=this.getDropPosition(e,r);this.options.onDropNode(this.draggedNodeId,n,o)}}this.draggedNodeId=null}}handleDragEnd(){this.draggedNodeId=null,this.container.querySelectorAll(".mindmap-node").forEach(t=>{t.classList.remove("drag-over-top","drag-over-bottom","drag-over-left","drag-over-right")})}getDropPosition(t,e){const i=e.getBoundingClientRect(),r=t.clientX-i.left,n=t.clientY-i.top,o=i.width,s=i.height;return n<s*.25?"top":n>s*.75?"bottom":r<o*.25?"left":(r>o*.75,"right")}}class $t{shortcuts;constructor(t){this.shortcuts=t}matches(t,e){const i=this.shortcuts[e];return i?i.some(r=>{const n=r.ctrlKey??!1,o=r.metaKey??!1,s=r.altKey??!1,c=r.shiftKey??!1;return t.ctrlKey!==n||t.metaKey!==o||t.altKey!==s||t.shiftKey!==c?!1:r.key.toLowerCase()===t.key.toLowerCase()}):!1}getAction(t){const e=Object.keys(this.shortcuts);for(const i of e)if(this.matches(t,i))return i}}class Jt{container;options;maxWidth=-1;selectedNodeId=null;isPanning=!1;lastMouseX=0;lastMouseY=0;isReadOnly=!1;shortcuts;nodeEditor;nodeDragger;shortcutManager;cleanupFns=[];constructor(t,e){this.container=t,this.container.tabIndex=0,this.container.style.outline="none",this.container.style.cursor="default",this.options=e,this.shortcuts={...Kt,...e.shortcuts},this.nodeEditor=new Yt(t,this.maxWidth,e),this.nodeDragger=new Gt(t,e),this.shortcutManager=new $t(this.shortcuts),this.isReadOnly=!!e.allowReadOnly,this.nodeDragger.setReadOnly(this.isReadOnly),this.attachEvents()}getShortcuts(){return this.shortcuts}setReadOnly(t){this.isReadOnly=t,this.nodeDragger&&this.nodeDragger.setReadOnly(t),t&&this.nodeDragger&&this.nodeDragger.draggedNodeId&&(this.nodeDragger.draggedNodeId=null)}destroy(){this.cleanupFns.forEach(t=>t()),this.cleanupFns=[]}updateSelection(t){this.selectedNodeId=t}attachEvents(){const t=(r,n,o,s)=>{r.addEventListener(n,o,s),this.cleanupFns.push(()=>{typeof r.removeEventListener=="function"&&r.removeEventListener(n,o,s)})};t(this.container,"focus",()=>{}),t(this.container,"blur",()=>{}),t(this.container,"scroll",()=>{(this.container.scrollTop!==0||this.container.scrollLeft!==0)&&(this.container.scrollTop=0,this.container.scrollLeft=0)}),t(this.container,"click",r=>{const o=r.target.closest(".mindmap-node");o&&o.dataset.id?this.options.onNodeClick(o.dataset.id):this.options.onNodeClick(""),this.container.focus()}),t(this.container,"mousedown",r=>{const n=r,o=n.target;!o.closest(".mindmap-node")&&o.tagName!=="INPUT"&&(this.isPanning=!0,this.lastMouseX=n.clientX,this.lastMouseY=n.clientY,this.container.style.cursor="all-scroll")}),t(window,"mousemove",r=>{const n=r;if(this.isPanning){const o=n.clientX-this.lastMouseX,s=n.clientY-this.lastMouseY;this.lastMouseX=n.clientX,this.lastMouseY=n.clientY,this.options.onPan&&this.options.onPan(o,s)}});const e=()=>{this.isPanning&&(this.isPanning=!1,this.container.style.cursor="default")};t(window,"mouseup",e),t(window,"mouseleave",e),t(this.container,"wheel",r=>{const n=r;if(n.preventDefault(),n.ctrlKey||n.metaKey){this.options.onZoom&&this.options.onZoom(n.deltaY,n.clientX,n.clientY);return}let o=1;n.deltaMode===1?o=33:n.deltaMode===2&&(o=window.innerHeight);const s=-n.deltaX*o,c=-n.deltaY*o;this.options.onPan&&this.options.onPan(s,c)},{passive:!1}),t(document,"keydown",r=>{const n=r,o=n.target;if(o.tagName==="INPUT"||o.tagName==="TEXTAREA"||o.isContentEditable)return;if(this.shortcutManager.matches(n,"resetZoom")){n.preventDefault(),this.options.onZoomReset?.();return}if(this.shortcutManager.getAction(n)==="openCommandPalette"){n.preventDefault(),this.options.onToggleCommandPalette?.();return}if(!this.selectedNodeId){if(this.shortcutManager.matches(n,"navUp")||this.shortcutManager.matches(n,"navDown")||this.shortcutManager.matches(n,"navLeft")||this.shortcutManager.matches(n,"navRight")){n.preventDefault();let g=null,f=1/0;this.container.querySelectorAll(".mindmap-node").forEach(p=>{const d=p;if(!d.dataset.id)return;const w=d.getBoundingClientRect(),h=w.left+w.width/2,m=w.top+w.height/2,u=this.container.getBoundingClientRect(),v=u.left+u.width/2,k=u.top+u.height/2,C=Math.pow(h-v,2)+Math.pow(m-k,2);C<f&&(f=C,g=d.dataset.id)}),g&&this.options.onNodeClick(g)}return}const c=this.shortcutManager.getAction(n);c&&this.handleAction(c,n)}),t(document,"paste",r=>{const n=r;if(this.isReadOnly||!this.selectedNodeId)return;const o=n.clipboardData?.items;if(!o||o.length===0){this.options.onPasteNode?.(this.selectedNodeId);return}let s=!1;for(const c of o)if(c.type.startsWith("image/")){const g=c.getAsFile();if(g){const f=new FileReader;f.onload=y=>{if(y.target?.result&&this.options.onPasteImage&&this.selectedNodeId){const p=y.target.result,d=new Image;d.onload=()=>{this.selectedNodeId&&this.options.onPasteImage&&this.options.onPasteImage(this.selectedNodeId,p,d.naturalWidth,d.naturalHeight)},d.src=p}},f.readAsDataURL(g)}n.preventDefault(),s=!0;break}s||this.options.onPasteNode?.(this.selectedNodeId)});const i=(r,n,o)=>t(r,n,o);i(this.container,"dragstart",this.nodeDragger.handleDragStart.bind(this.nodeDragger)),i(this.container,"dragover",this.nodeDragger.handleDragOver.bind(this.nodeDragger)),i(this.container,"dragleave",this.nodeDragger.handleDragLeave.bind(this.nodeDragger)),i(this.container,"drop",this.nodeDragger.handleDrop.bind(this.nodeDragger)),i(this.container,"dragend",this.nodeDragger.handleDragEnd.bind(this.nodeDragger)),t(this.container,"dblclick",r=>{if(this.isReadOnly)return;const o=r.target.closest(".mindmap-node");o&&o.dataset.id&&this.startEditing(o,o.dataset.id)})}editNode(t){const e=this.container.querySelector(`.mindmap-node[data-id="${t}"]`);e&&this.startEditing(e,t)}get draggedNodeId(){return this.nodeDragger?this.nodeDragger.draggedNodeId:null}set draggedNodeId(t){this.nodeDragger&&(this.nodeDragger.draggedNodeId=t)}startEditing(t,e){this.nodeEditor.setMaxWidth(this.maxWidth),this.nodeEditor.startEditing(t,e)}handleAction(t,e){if(this.selectedNodeId){switch(t){case"copy":e.preventDefault(),this.options.onCopyNode?.(this.selectedNodeId);return;case"navUp":e.preventDefault(),this.options.onNavigate?.(this.selectedNodeId,"Up");return;case"navDown":e.preventDefault(),this.options.onNavigate?.(this.selectedNodeId,"Down");return;case"navRight":e.preventDefault(),this.options.onNavigate?.(this.selectedNodeId,"Right");return;case"navLeft":e.preventDefault(),this.options.onNavigate?.(this.selectedNodeId,"Left");return}if(!this.isReadOnly)switch(t){case"addChild":e.preventDefault(),this.options.onAddChild(this.selectedNodeId);break;case"insertParent":e.preventDefault(),this.options.onInsertParent?.(this.selectedNodeId);break;case"addSibling":e.preventDefault(),this.options.onAddSibling(this.selectedNodeId,"after");break;case"addSiblingBefore":e.preventDefault(),this.options.onAddSibling(this.selectedNodeId,"before");break;case"deleteNode":e.preventDefault(),this.options.onDeleteNode(this.selectedNodeId);break;case"beginEdit":e.preventDefault(),this.handleBeginEdit();break;case"zoomIn":if(e.preventDefault(),this.options.onZoom){const i=this.container.getBoundingClientRect();this.options.onZoom(-100,i.left+i.width/2,i.top+i.height/2)}break;case"zoomOut":if(e.preventDefault(),this.options.onZoom){const i=this.container.getBoundingClientRect();this.options.onZoom(100,i.left+i.width/2,i.top+i.height/2)}break;case"cut":e.preventDefault(),this.options.onCutNode?.(this.selectedNodeId);break;case"undo":e.preventDefault(),this.options.onUndo?.();break;case"redo":e.preventDefault(),this.options.onRedo?.();break;case"bold":e.preventDefault(),this.options.onStyleAction?.(this.selectedNodeId,{type:"bold"});break;case"italic":e.preventDefault(),this.options.onStyleAction?.(this.selectedNodeId,{type:"italic"});break;case"increaseFontSize":e.preventDefault(),this.options.onStyleAction?.(this.selectedNodeId,{type:"increaseSize"});break;case"decreaseFontSize":e.preventDefault(),this.options.onStyleAction?.(this.selectedNodeId,{type:"decreaseSize"});break;case"toggleFold":e.preventDefault(),this.options.onToggleFold?.(this.selectedNodeId);break;case"openCommandPalette":e.preventDefault(),this.options.onToggleCommandPalette?.();break;case"increaseNodeWidth":e.preventDefault(),this.options.onUpdateNodeWidth?.(this.selectedNodeId,20);break;case"decreaseNodeWidth":e.preventDefault(),this.options.onUpdateNodeWidth?.(this.selectedNodeId,-20);break;default:if(t.startsWith("selectColor")){const i=parseInt(t.replace("selectColor",""),10)-1;isNaN(i)||(e.preventDefault(),this.options.onStyleAction?.(this.selectedNodeId,{type:"color",index:i}))}break}}}handleBeginEdit(){if(!this.selectedNodeId)return;const t=this.container.querySelector(`.mindmap-node[data-id="${this.selectedNodeId}"]`);if(t){const e=t.querySelector('[title="Zoom Image"]');if(e){e.click();return}if(t.querySelector("img"))return;this.startEditing(t,this.selectedNodeId)}}}class Vt{container;overlay;paletteEl;inputEl;resultListEl;options;results=[];selectedIndex=-1;mode="menu";MENU_COMMANDS=[{id:"icon",topic:"> Icon",type:"command"},{id:"search-nodes",topic:"> Search Nodes",type:"command"},{id:"import",topic:"> Import",type:"command"},{id:"export",topic:"> Export",type:"command"}];IMPORT_COMMANDS=[{id:"import-xmind",topic:"> XMind (.xmind)",type:"command"}];EXPORT_COMMANDS=[{id:"export-png",topic:"> PNG Image (.png)",type:"command"},{id:"export-svg",topic:"> SVG Image (.svg)",type:"command"},{id:"export-markdown",topic:"> Markdown (.md)",type:"command"}];ICON_LIST=[{id:"delete",topic:"🗑️ Delete",type:"icon"},{id:"blue_circle",topic:"Good",type:"icon"},{id:"red_circle",topic:"Bad",type:"icon"},{id:"question",topic:"Question",type:"icon"},{id:"important",topic:"Important",type:"icon"},{id:"check",topic:"Check",type:"icon"},{id:"cross",topic:"Cross",type:"icon"},{id:"flag",topic:"Flag",type:"icon"},{id:"idea",topic:"Idea",type:"icon"},{id:"warning",topic:"Warning",type:"icon"},{id:"schedule",topic:"Schedule",type:"icon"}];constructor(t,e){this.container=t,this.options=e,this.overlay=this.createOverlay(),this.paletteEl=this.createPalette(),this.inputEl=this.paletteEl.querySelector("input"),this.resultListEl=this.paletteEl.querySelector("ul"),this.container.appendChild(this.overlay),this.container.appendChild(this.paletteEl)}createOverlay(){const t=document.createElement("div");return t.style.position="absolute",t.style.top="0",t.style.left="0",t.style.width="100%",t.style.height="100%",t.style.backgroundColor="rgba(0, 0, 0, 0.1)",t.style.zIndex="1999",t.style.display="none",t.addEventListener("click",()=>{this.close()}),t}createPalette(){const t=document.createElement("div");t.className="command-palette",t.style.position="absolute",t.style.top="20px",t.style.left="50%",t.style.transform="translateX(-50%)",t.style.width="400px",t.style.backgroundColor="white",t.style.borderRadius="8px",t.style.boxShadow="0 4px 12px rgba(0,0,0,0.1)",t.style.border="1px solid #eee",t.style.zIndex="2000",t.style.display="none",t.style.flexDirection="column",t.style.overflow="hidden",t.style.padding="8px",t.style.boxSizing="border-box",t.style.fontFamily="Arial, sans-serif";const e=document.createElement("input");e.type="text",e.placeholder="Type > to search commands...",e.style.width="100%",e.style.boxSizing="border-box",e.style.padding="4px 8px",e.style.height="32px",e.style.border="1px solid #ccc",e.style.borderRadius="4px",e.style.fontSize="14px",e.style.outline="none",e.style.marginBottom="0",e.addEventListener("input",r=>{const n=r.target.value;if(this.mode==="menu"){const o=this.MENU_COMMANDS.filter(s=>s.topic.toLowerCase().includes(n.toLowerCase()));this.renderList(o)}else if(this.mode==="import"){const o=this.IMPORT_COMMANDS.filter(s=>s.topic.toLowerCase().includes(n.toLowerCase()));this.renderList(o)}else if(this.mode==="export"){const o=this.EXPORT_COMMANDS.filter(s=>s.topic.toLowerCase().includes(n.toLowerCase()));this.renderList(o)}else if(this.mode==="icon"){const o=this.ICON_LIST.filter(s=>s.topic.toLowerCase().includes(n.toLowerCase()));this.renderList(o)}else this.options.onInput(n)}),e.addEventListener("keydown",r=>{r.key==="ArrowDown"?(r.preventDefault(),this.moveSelection(1)):r.key==="ArrowUp"?(r.preventDefault(),this.moveSelection(-1)):r.key==="Enter"?(r.preventDefault(),this.confirmSelection()):r.key==="Escape"?(r.preventDefault(),this.close()):r.key==="Backspace"&&this.inputEl.value===""&&(this.mode==="search"||this.mode==="icon"||this.mode==="import"||this.mode==="export")&&(this.mode="menu",this.inputEl.placeholder="Type to filter commands...",this.renderList(this.MENU_COMMANDS))});const i=document.createElement("ul");return i.style.listStyle="none",i.style.margin="8px 0 0 0",i.style.padding="0",i.style.maxHeight="300px",i.style.overflowY="auto",i.style.display="none",i.style.borderTop="1px solid #eee",t.appendChild(e),t.appendChild(i),t}show(){this.mode="menu",this.overlay.style.display="block",this.paletteEl.style.display="flex",this.inputEl.value="",this.inputEl.placeholder="Type to filter commands...",this.inputEl.focus(),this.renderList(this.MENU_COMMANDS)}close(){this.overlay.style.display="none",this.paletteEl.style.display="none",this.options.onClose(),this.mode="menu"}toggle(){this.paletteEl.style.display==="none"?this.show():this.close()}setResults(t){this.mode==="search"&&this.renderList(t.map(e=>({...e,type:"node"})))}renderList(t){if(this.results=t,this.resultListEl.innerHTML="",this.selectedIndex=-1,t.length===0){if(this.inputEl.value.trim()!==""&&(this.mode==="search"||this.mode==="icon"||this.mode==="import"||this.mode==="export")){const e=document.createElement("li");e.textContent="No results found",e.style.padding="8px",e.style.color="#999",e.style.fontSize="12px",e.style.textAlign="center",this.resultListEl.appendChild(e),this.resultListEl.style.display="block"}else this.mode==="menu"&&t.length===0?this.resultListEl.style.display="none":this.resultListEl.style.display="none";return}this.resultListEl.style.display="block",t.forEach((e,i)=>{const r=document.createElement("li");if(r.style.borderBottom="1px solid #f9f9f9",e.type==="icon"&&e.id!=="delete"){r.style.display="flex",r.style.alignItems="center";const n=It[e.id];if(n){const s=document.createElement("div");s.style.width="20px",s.style.height="20px",s.style.marginRight="8px",s.style.flexShrink="0",s.innerHTML=`<svg viewBox="${n.viewBox}" width="20" height="20">${n.path}</svg>`,r.appendChild(s)}const o=document.createElement("span");o.textContent=e.topic,r.appendChild(o)}else r.textContent=e.topic;r.addEventListener("mouseenter",()=>{this.setSelectedIndex(i)}),r.addEventListener("click",()=>{this.selectItem(e)}),this.resultListEl.appendChild(r)}),t.length>0&&this.setSelectedIndex(0)}selectItem(t){t.type==="command"?t.id==="search-nodes"?this.switchToSearchMode():t.id==="icon"?this.switchToIconMode():t.id==="import"?this.switchToImportMode():t.id==="export"?this.switchToExportMode():t.id==="import-xmind"?(this.options.onCommandSelect("import-xmind"),this.close()):t.id==="export-png"?(this.options.onCommandSelect("export-png"),this.close()):t.id==="export-svg"?(this.options.onCommandSelect("export-svg"),this.close()):t.id==="export-markdown"&&(this.options.onCommandSelect("export-markdown"),this.close()):t.type==="icon"?(this.options.onIconSelect(t.id),this.close()):(this.options.onSelect(t.id),this.close())}switchToSearchMode(){this.mode="search",this.inputEl.value="",this.inputEl.placeholder="Search nodes...",this.renderList([]),this.resultListEl.style.display="none",this.inputEl.focus()}switchToIconMode(){this.mode="icon",this.inputEl.value="",this.inputEl.placeholder="Select icon...",this.renderList(this.ICON_LIST),this.inputEl.focus()}switchToImportMode(){this.mode="import",this.inputEl.value="",this.inputEl.placeholder="Select format...",this.renderList(this.IMPORT_COMMANDS),this.inputEl.focus()}switchToExportMode(){this.mode="export",this.inputEl.value="",this.inputEl.placeholder="Select format...",this.renderList(this.EXPORT_COMMANDS),this.inputEl.focus()}moveSelection(t){if(this.results.length===0)return;const e=Math.max(0,Math.min(this.results.length-1,this.selectedIndex+t));this.setSelectedIndex(e),this.scrollToSelected()}setSelectedIndex(t){this.selectedIndex=t;const e=this.resultListEl.children;for(let i=0;i<e.length;i++){const r=e[i];i===t?(r.style.backgroundColor="#007acc",r.style.color="white"):(r.style.backgroundColor="transparent",r.style.color="black")}}scrollToSelected(){const t=this.resultListEl.children;this.selectedIndex>=0&&this.selectedIndex<t.length&&t[this.selectedIndex].scrollIntoView({block:"nearest"})}confirmSelection(){this.selectedIndex>=0&&this.selectedIndex<this.results.length&&this.selectItem(this.results[this.selectedIndex])}}var kt=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function qt(it){return it&&it.__esModule&&Object.prototype.hasOwnProperty.call(it,"default")?it.default:it}function St(it){throw new Error('Could not dynamically require "'+it+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var zt={exports:{}};var Mt;function Qt(){return Mt||(Mt=1,(function(it,t){(function(e){it.exports=e()})(function(){return(function e(i,r,n){function o(g,f){if(!r[g]){if(!i[g]){var y=typeof St=="function"&&St;if(!f&&y)return y(g,!0);if(s)return s(g,!0);var p=new Error("Cannot find module '"+g+"'");throw p.code="MODULE_NOT_FOUND",p}var d=r[g]={exports:{}};i[g][0].call(d.exports,function(w){var h=i[g][1][w];return o(h||w)},d,d.exports,e,i,r,n)}return r[g].exports}for(var s=typeof St=="function"&&St,c=0;c<n.length;c++)o(n[c]);return o})({1:[function(e,i,r){var n=e("./utils"),o=e("./support"),s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";r.encode=function(c){for(var g,f,y,p,d,w,h,m=[],u=0,v=c.length,k=v,C=n.getTypeOf(c)!=="string";u<c.length;)k=v-u,y=C?(g=c[u++],f=u<v?c[u++]:0,u<v?c[u++]:0):(g=c.charCodeAt(u++),f=u<v?c.charCodeAt(u++):0,u<v?c.charCodeAt(u++):0),p=g>>2,d=(3&g)<<4|f>>4,w=1<k?(15&f)<<2|y>>6:64,h=2<k?63&y:64,m.push(s.charAt(p)+s.charAt(d)+s.charAt(w)+s.charAt(h));return m.join("")},r.decode=function(c){var g,f,y,p,d,w,h=0,m=0,u="data:";if(c.substr(0,u.length)===u)throw new Error("Invalid base64 input, it looks like a data url.");var v,k=3*(c=c.replace(/[^A-Za-z0-9+/=]/g,"")).length/4;if(c.charAt(c.length-1)===s.charAt(64)&&k--,c.charAt(c.length-2)===s.charAt(64)&&k--,k%1!=0)throw new Error("Invalid base64 input, bad content length.");for(v=o.uint8array?new Uint8Array(0|k):new Array(0|k);h<c.length;)g=s.indexOf(c.charAt(h++))<<2|(p=s.indexOf(c.charAt(h++)))>>4,f=(15&p)<<4|(d=s.indexOf(c.charAt(h++)))>>2,y=(3&d)<<6|(w=s.indexOf(c.charAt(h++))),v[m++]=g,d!==64&&(v[m++]=f),w!==64&&(v[m++]=y);return v}},{"./support":30,"./utils":32}],2:[function(e,i,r){var n=e("./external"),o=e("./stream/DataWorker"),s=e("./stream/Crc32Probe"),c=e("./stream/DataLengthProbe");function g(f,y,p,d,w){this.compressedSize=f,this.uncompressedSize=y,this.crc32=p,this.compression=d,this.compressedContent=w}g.prototype={getContentWorker:function(){var f=new o(n.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new c("data_length")),y=this;return f.on("end",function(){if(this.streamInfo.data_length!==y.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),f},getCompressedWorker:function(){return new o(n.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},g.createWorkerFrom=function(f,y,p){return f.pipe(new s).pipe(new c("uncompressedSize")).pipe(y.compressWorker(p)).pipe(new c("compressedSize")).withStreamInfo("compression",y)},i.exports=g},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(e,i,r){var n=e("./stream/GenericWorker");r.STORE={magic:"\0\0",compressWorker:function(){return new n("STORE compression")},uncompressWorker:function(){return new n("STORE decompression")}},r.DEFLATE=e("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(e,i,r){var n=e("./utils"),o=(function(){for(var s,c=[],g=0;g<256;g++){s=g;for(var f=0;f<8;f++)s=1&s?3988292384^s>>>1:s>>>1;c[g]=s}return c})();i.exports=function(s,c){return s!==void 0&&s.length?n.getTypeOf(s)!=="string"?(function(g,f,y,p){var d=o,w=p+y;g^=-1;for(var h=p;h<w;h++)g=g>>>8^d[255&(g^f[h])];return-1^g})(0|c,s,s.length,0):(function(g,f,y,p){var d=o,w=p+y;g^=-1;for(var h=p;h<w;h++)g=g>>>8^d[255&(g^f.charCodeAt(h))];return-1^g})(0|c,s,s.length,0):0}},{"./utils":32}],5:[function(e,i,r){r.base64=!1,r.binary=!1,r.dir=!1,r.createFolders=!0,r.date=null,r.compression=null,r.compressionOptions=null,r.comment=null,r.unixPermissions=null,r.dosPermissions=null},{}],6:[function(e,i,r){var n=null;n=typeof Promise<"u"?Promise:e("lie"),i.exports={Promise:n}},{lie:37}],7:[function(e,i,r){var n=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",o=e("pako"),s=e("./utils"),c=e("./stream/GenericWorker"),g=n?"uint8array":"array";function f(y,p){c.call(this,"FlateWorker/"+y),this._pako=null,this._pakoAction=y,this._pakoOptions=p,this.meta={}}r.magic="\b\0",s.inherits(f,c),f.prototype.processChunk=function(y){this.meta=y.meta,this._pako===null&&this._createPako(),this._pako.push(s.transformTo(g,y.data),!1)},f.prototype.flush=function(){c.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},f.prototype.cleanUp=function(){c.prototype.cleanUp.call(this),this._pako=null},f.prototype._createPako=function(){this._pako=new o[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var y=this;this._pako.onData=function(p){y.push({data:p,meta:y.meta})}},r.compressWorker=function(y){return new f("Deflate",y)},r.uncompressWorker=function(){return new f("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(e,i,r){function n(d,w){var h,m="";for(h=0;h<w;h++)m+=String.fromCharCode(255&d),d>>>=8;return m}function o(d,w,h,m,u,v){var k,C,S=d.file,M=d.compression,A=v!==g.utf8encode,F=s.transformTo("string",v(S.name)),T=s.transformTo("string",g.utf8encode(S.name)),H=S.comment,K=s.transformTo("string",v(H)),x=s.transformTo("string",g.utf8encode(H)),D=T.length!==S.name.length,l=x.length!==H.length,R="",V="",W="",Q=S.dir,U=S.date,q={crc32:0,compressedSize:0,uncompressedSize:0};w&&!h||(q.crc32=d.crc32,q.compressedSize=d.compressedSize,q.uncompressedSize=d.uncompressedSize);var z=0;w&&(z|=8),A||!D&&!l||(z|=2048);var I=0,J=0;Q&&(I|=16),u==="UNIX"?(J=798,I|=(function(X,ot){var dt=X;return X||(dt=ot?16893:33204),(65535&dt)<<16})(S.unixPermissions,Q)):(J=20,I|=(function(X){return 63&(X||0)})(S.dosPermissions)),k=U.getUTCHours(),k<<=6,k|=U.getUTCMinutes(),k<<=5,k|=U.getUTCSeconds()/2,C=U.getUTCFullYear()-1980,C<<=4,C|=U.getUTCMonth()+1,C<<=5,C|=U.getUTCDate(),D&&(V=n(1,1)+n(f(F),4)+T,R+="up"+n(V.length,2)+V),l&&(W=n(1,1)+n(f(K),4)+x,R+="uc"+n(W.length,2)+W);var Y="";return Y+=`
|
|
55
|
-
\0`,Y+=n(z,2),Y+=M.magic,Y+=n(k,2),Y+=n(C,2),Y+=n(q.crc32,4),Y+=n(q.compressedSize,4),Y+=n(q.uncompressedSize,4),Y+=n(F.length,2),Y+=n(R.length,2),{fileRecord:y.LOCAL_FILE_HEADER+Y+F+R,dirRecord:y.CENTRAL_FILE_HEADER+n(J,2)+Y+n(K.length,2)+"\0\0\0\0"+n(I,4)+n(m,4)+F+R+K}}var s=e("../utils"),c=e("../stream/GenericWorker"),g=e("../utf8"),f=e("../crc32"),y=e("../signature");function p(d,w,h,m){c.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=w,this.zipPlatform=h,this.encodeFileName=m,this.streamFiles=d,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}s.inherits(p,c),p.prototype.push=function(d){var w=d.meta.percent||0,h=this.entriesCount,m=this._sources.length;this.accumulate?this.contentBuffer.push(d):(this.bytesWritten+=d.data.length,c.prototype.push.call(this,{data:d.data,meta:{currentFile:this.currentFile,percent:h?(w+100*(h-m-1))/h:100}}))},p.prototype.openedSource=function(d){this.currentSourceOffset=this.bytesWritten,this.currentFile=d.file.name;var w=this.streamFiles&&!d.file.dir;if(w){var h=o(d,w,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:h.fileRecord,meta:{percent:0}})}else this.accumulate=!0},p.prototype.closedSource=function(d){this.accumulate=!1;var w=this.streamFiles&&!d.file.dir,h=o(d,w,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(h.dirRecord),w)this.push({data:(function(m){return y.DATA_DESCRIPTOR+n(m.crc32,4)+n(m.compressedSize,4)+n(m.uncompressedSize,4)})(d),meta:{percent:100}});else for(this.push({data:h.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},p.prototype.flush=function(){for(var d=this.bytesWritten,w=0;w<this.dirRecords.length;w++)this.push({data:this.dirRecords[w],meta:{percent:100}});var h=this.bytesWritten-d,m=(function(u,v,k,C,S){var M=s.transformTo("string",S(C));return y.CENTRAL_DIRECTORY_END+"\0\0\0\0"+n(u,2)+n(u,2)+n(v,4)+n(k,4)+n(M.length,2)+M})(this.dirRecords.length,h,d,this.zipComment,this.encodeFileName);this.push({data:m,meta:{percent:100}})},p.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()},p.prototype.registerPrevious=function(d){this._sources.push(d);var w=this;return d.on("data",function(h){w.processChunk(h)}),d.on("end",function(){w.closedSource(w.previous.streamInfo),w._sources.length?w.prepareNextSource():w.end()}),d.on("error",function(h){w.error(h)}),this},p.prototype.resume=function(){return!!c.prototype.resume.call(this)&&(!this.previous&&this._sources.length?(this.prepareNextSource(),!0):this.previous||this._sources.length||this.generatedError?void 0:(this.end(),!0))},p.prototype.error=function(d){var w=this._sources;if(!c.prototype.error.call(this,d))return!1;for(var h=0;h<w.length;h++)try{w[h].error(d)}catch{}return!0},p.prototype.lock=function(){c.prototype.lock.call(this);for(var d=this._sources,w=0;w<d.length;w++)d[w].lock()},i.exports=p},{"../crc32":4,"../signature":23,"../stream/GenericWorker":28,"../utf8":31,"../utils":32}],9:[function(e,i,r){var n=e("../compressions"),o=e("./ZipFileWorker");r.generateWorker=function(s,c,g){var f=new o(c.streamFiles,g,c.platform,c.encodeFileName),y=0;try{s.forEach(function(p,d){y++;var w=(function(v,k){var C=v||k,S=n[C];if(!S)throw new Error(C+" is not a valid compression method !");return S})(d.options.compression,c.compression),h=d.options.compressionOptions||c.compressionOptions||{},m=d.dir,u=d.date;d._compressWorker(w,h).withStreamInfo("file",{name:p,dir:m,date:u,comment:d.comment||"",unixPermissions:d.unixPermissions,dosPermissions:d.dosPermissions}).pipe(f)}),f.entriesCount=y}catch(p){f.error(p)}return f}},{"../compressions":3,"./ZipFileWorker":8}],10:[function(e,i,r){function n(){if(!(this instanceof n))return new n;if(arguments.length)throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");this.files=Object.create(null),this.comment=null,this.root="",this.clone=function(){var o=new n;for(var s in this)typeof this[s]!="function"&&(o[s]=this[s]);return o}}(n.prototype=e("./object")).loadAsync=e("./load"),n.support=e("./support"),n.defaults=e("./defaults"),n.version="3.10.1",n.loadAsync=function(o,s){return new n().loadAsync(o,s)},n.external=e("./external"),i.exports=n},{"./defaults":5,"./external":6,"./load":11,"./object":15,"./support":30}],11:[function(e,i,r){var n=e("./utils"),o=e("./external"),s=e("./utf8"),c=e("./zipEntries"),g=e("./stream/Crc32Probe"),f=e("./nodejsUtils");function y(p){return new o.Promise(function(d,w){var h=p.decompressed.getContentWorker().pipe(new g);h.on("error",function(m){w(m)}).on("end",function(){h.streamInfo.crc32!==p.decompressed.crc32?w(new Error("Corrupted zip : CRC32 mismatch")):d()}).resume()})}i.exports=function(p,d){var w=this;return d=n.extend(d||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:s.utf8decode}),f.isNode&&f.isStream(p)?o.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):n.prepareContent("the loaded zip file",p,!0,d.optimizedBinaryString,d.base64).then(function(h){var m=new c(d);return m.load(h),m}).then(function(h){var m=[o.Promise.resolve(h)],u=h.files;if(d.checkCRC32)for(var v=0;v<u.length;v++)m.push(y(u[v]));return o.Promise.all(m)}).then(function(h){for(var m=h.shift(),u=m.files,v=0;v<u.length;v++){var k=u[v],C=k.fileNameStr,S=n.resolve(k.fileNameStr);w.file(S,k.decompressed,{binary:!0,optimizedBinaryString:!0,date:k.date,dir:k.dir,comment:k.fileCommentStr.length?k.fileCommentStr:null,unixPermissions:k.unixPermissions,dosPermissions:k.dosPermissions,createFolders:d.createFolders}),k.dir||(w.file(S).unsafeOriginalName=C)}return m.zipComment.length&&(w.comment=m.zipComment),w})}},{"./external":6,"./nodejsUtils":14,"./stream/Crc32Probe":25,"./utf8":31,"./utils":32,"./zipEntries":33}],12:[function(e,i,r){var n=e("../utils"),o=e("../stream/GenericWorker");function s(c,g){o.call(this,"Nodejs stream input adapter for "+c),this._upstreamEnded=!1,this._bindStream(g)}n.inherits(s,o),s.prototype._bindStream=function(c){var g=this;(this._stream=c).pause(),c.on("data",function(f){g.push({data:f,meta:{percent:0}})}).on("error",function(f){g.isPaused?this.generatedError=f:g.error(f)}).on("end",function(){g.isPaused?g._upstreamEnded=!0:g.end()})},s.prototype.pause=function(){return!!o.prototype.pause.call(this)&&(this._stream.pause(),!0)},s.prototype.resume=function(){return!!o.prototype.resume.call(this)&&(this._upstreamEnded?this.end():this._stream.resume(),!0)},i.exports=s},{"../stream/GenericWorker":28,"../utils":32}],13:[function(e,i,r){var n=e("readable-stream").Readable;function o(s,c,g){n.call(this,c),this._helper=s;var f=this;s.on("data",function(y,p){f.push(y)||f._helper.pause(),g&&g(p)}).on("error",function(y){f.emit("error",y)}).on("end",function(){f.push(null)})}e("../utils").inherits(o,n),o.prototype._read=function(){this._helper.resume()},i.exports=o},{"../utils":32,"readable-stream":16}],14:[function(e,i,r){i.exports={isNode:typeof Buffer<"u",newBufferFrom:function(n,o){if(Buffer.from&&Buffer.from!==Uint8Array.from)return Buffer.from(n,o);if(typeof n=="number")throw new Error('The "data" argument must not be a number');return new Buffer(n,o)},allocBuffer:function(n){if(Buffer.alloc)return Buffer.alloc(n);var o=new Buffer(n);return o.fill(0),o},isBuffer:function(n){return Buffer.isBuffer(n)},isStream:function(n){return n&&typeof n.on=="function"&&typeof n.pause=="function"&&typeof n.resume=="function"}}},{}],15:[function(e,i,r){function n(S,M,A){var F,T=s.getTypeOf(M),H=s.extend(A||{},f);H.date=H.date||new Date,H.compression!==null&&(H.compression=H.compression.toUpperCase()),typeof H.unixPermissions=="string"&&(H.unixPermissions=parseInt(H.unixPermissions,8)),H.unixPermissions&&16384&H.unixPermissions&&(H.dir=!0),H.dosPermissions&&16&H.dosPermissions&&(H.dir=!0),H.dir&&(S=u(S)),H.createFolders&&(F=m(S))&&v.call(this,F,!0);var K=T==="string"&&H.binary===!1&&H.base64===!1;A&&A.binary!==void 0||(H.binary=!K),(M instanceof y&&M.uncompressedSize===0||H.dir||!M||M.length===0)&&(H.base64=!1,H.binary=!0,M="",H.compression="STORE",T="string");var x=null;x=M instanceof y||M instanceof c?M:w.isNode&&w.isStream(M)?new h(S,M):s.prepareContent(S,M,H.binary,H.optimizedBinaryString,H.base64);var D=new p(S,x,H);this.files[S]=D}var o=e("./utf8"),s=e("./utils"),c=e("./stream/GenericWorker"),g=e("./stream/StreamHelper"),f=e("./defaults"),y=e("./compressedObject"),p=e("./zipObject"),d=e("./generate"),w=e("./nodejsUtils"),h=e("./nodejs/NodejsStreamInputAdapter"),m=function(S){S.slice(-1)==="/"&&(S=S.substring(0,S.length-1));var M=S.lastIndexOf("/");return 0<M?S.substring(0,M):""},u=function(S){return S.slice(-1)!=="/"&&(S+="/"),S},v=function(S,M){return M=M!==void 0?M:f.createFolders,S=u(S),this.files[S]||n.call(this,S,null,{dir:!0,createFolders:M}),this.files[S]};function k(S){return Object.prototype.toString.call(S)==="[object RegExp]"}var C={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(S){var M,A,F;for(M in this.files)F=this.files[M],(A=M.slice(this.root.length,M.length))&&M.slice(0,this.root.length)===this.root&&S(A,F)},filter:function(S){var M=[];return this.forEach(function(A,F){S(A,F)&&M.push(F)}),M},file:function(S,M,A){if(arguments.length!==1)return S=this.root+S,n.call(this,S,M,A),this;if(k(S)){var F=S;return this.filter(function(H,K){return!K.dir&&F.test(H)})}var T=this.files[this.root+S];return T&&!T.dir?T:null},folder:function(S){if(!S)return this;if(k(S))return this.filter(function(T,H){return H.dir&&S.test(T)});var M=this.root+S,A=v.call(this,M),F=this.clone();return F.root=A.name,F},remove:function(S){S=this.root+S;var M=this.files[S];if(M||(S.slice(-1)!=="/"&&(S+="/"),M=this.files[S]),M&&!M.dir)delete this.files[S];else for(var A=this.filter(function(T,H){return H.name.slice(0,S.length)===S}),F=0;F<A.length;F++)delete this.files[A[F].name];return this},generate:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(S){var M,A={};try{if((A=s.extend(S||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:o.utf8encode})).type=A.type.toLowerCase(),A.compression=A.compression.toUpperCase(),A.type==="binarystring"&&(A.type="string"),!A.type)throw new Error("No output type specified.");s.checkSupport(A.type),A.platform!=="darwin"&&A.platform!=="freebsd"&&A.platform!=="linux"&&A.platform!=="sunos"||(A.platform="UNIX"),A.platform==="win32"&&(A.platform="DOS");var F=A.comment||this.comment||"";M=d.generateWorker(this,A,F)}catch(T){(M=new c("error")).error(T)}return new g(M,A.type||"string",A.mimeType)},generateAsync:function(S,M){return this.generateInternalStream(S).accumulate(M)},generateNodeStream:function(S,M){return(S=S||{}).type||(S.type="nodebuffer"),this.generateInternalStream(S).toNodejsStream(M)}};i.exports=C},{"./compressedObject":2,"./defaults":5,"./generate":9,"./nodejs/NodejsStreamInputAdapter":12,"./nodejsUtils":14,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31,"./utils":32,"./zipObject":35}],16:[function(e,i,r){i.exports=e("stream")},{stream:void 0}],17:[function(e,i,r){var n=e("./DataReader");function o(s){n.call(this,s);for(var c=0;c<this.data.length;c++)s[c]=255&s[c]}e("../utils").inherits(o,n),o.prototype.byteAt=function(s){return this.data[this.zero+s]},o.prototype.lastIndexOfSignature=function(s){for(var c=s.charCodeAt(0),g=s.charCodeAt(1),f=s.charCodeAt(2),y=s.charCodeAt(3),p=this.length-4;0<=p;--p)if(this.data[p]===c&&this.data[p+1]===g&&this.data[p+2]===f&&this.data[p+3]===y)return p-this.zero;return-1},o.prototype.readAndCheckSignature=function(s){var c=s.charCodeAt(0),g=s.charCodeAt(1),f=s.charCodeAt(2),y=s.charCodeAt(3),p=this.readData(4);return c===p[0]&&g===p[1]&&f===p[2]&&y===p[3]},o.prototype.readData=function(s){if(this.checkOffset(s),s===0)return[];var c=this.data.slice(this.zero+this.index,this.zero+this.index+s);return this.index+=s,c},i.exports=o},{"../utils":32,"./DataReader":18}],18:[function(e,i,r){var n=e("../utils");function o(s){this.data=s,this.length=s.length,this.index=0,this.zero=0}o.prototype={checkOffset:function(s){this.checkIndex(this.index+s)},checkIndex:function(s){if(this.length<this.zero+s||s<0)throw new Error("End of data reached (data length = "+this.length+", asked index = "+s+"). Corrupted zip ?")},setIndex:function(s){this.checkIndex(s),this.index=s},skip:function(s){this.setIndex(this.index+s)},byteAt:function(){},readInt:function(s){var c,g=0;for(this.checkOffset(s),c=this.index+s-1;c>=this.index;c--)g=(g<<8)+this.byteAt(c);return this.index+=s,g},readString:function(s){return n.transformTo("string",this.readData(s))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var s=this.readInt(4);return new Date(Date.UTC(1980+(s>>25&127),(s>>21&15)-1,s>>16&31,s>>11&31,s>>5&63,(31&s)<<1))}},i.exports=o},{"../utils":32}],19:[function(e,i,r){var n=e("./Uint8ArrayReader");function o(s){n.call(this,s)}e("../utils").inherits(o,n),o.prototype.readData=function(s){this.checkOffset(s);var c=this.data.slice(this.zero+this.index,this.zero+this.index+s);return this.index+=s,c},i.exports=o},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(e,i,r){var n=e("./DataReader");function o(s){n.call(this,s)}e("../utils").inherits(o,n),o.prototype.byteAt=function(s){return this.data.charCodeAt(this.zero+s)},o.prototype.lastIndexOfSignature=function(s){return this.data.lastIndexOf(s)-this.zero},o.prototype.readAndCheckSignature=function(s){return s===this.readData(4)},o.prototype.readData=function(s){this.checkOffset(s);var c=this.data.slice(this.zero+this.index,this.zero+this.index+s);return this.index+=s,c},i.exports=o},{"../utils":32,"./DataReader":18}],21:[function(e,i,r){var n=e("./ArrayReader");function o(s){n.call(this,s)}e("../utils").inherits(o,n),o.prototype.readData=function(s){if(this.checkOffset(s),s===0)return new Uint8Array(0);var c=this.data.subarray(this.zero+this.index,this.zero+this.index+s);return this.index+=s,c},i.exports=o},{"../utils":32,"./ArrayReader":17}],22:[function(e,i,r){var n=e("../utils"),o=e("../support"),s=e("./ArrayReader"),c=e("./StringReader"),g=e("./NodeBufferReader"),f=e("./Uint8ArrayReader");i.exports=function(y){var p=n.getTypeOf(y);return n.checkSupport(p),p!=="string"||o.uint8array?p==="nodebuffer"?new g(y):o.uint8array?new f(n.transformTo("uint8array",y)):new s(n.transformTo("array",y)):new c(y)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(e,i,r){r.LOCAL_FILE_HEADER="PK",r.CENTRAL_FILE_HEADER="PK",r.CENTRAL_DIRECTORY_END="PK",r.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",r.ZIP64_CENTRAL_DIRECTORY_END="PK",r.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(e,i,r){var n=e("./GenericWorker"),o=e("../utils");function s(c){n.call(this,"ConvertWorker to "+c),this.destType=c}o.inherits(s,n),s.prototype.processChunk=function(c){this.push({data:o.transformTo(this.destType,c.data),meta:c.meta})},i.exports=s},{"../utils":32,"./GenericWorker":28}],25:[function(e,i,r){var n=e("./GenericWorker"),o=e("../crc32");function s(){n.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}e("../utils").inherits(s,n),s.prototype.processChunk=function(c){this.streamInfo.crc32=o(c.data,this.streamInfo.crc32||0),this.push(c)},i.exports=s},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(e,i,r){var n=e("../utils"),o=e("./GenericWorker");function s(c){o.call(this,"DataLengthProbe for "+c),this.propName=c,this.withStreamInfo(c,0)}n.inherits(s,o),s.prototype.processChunk=function(c){if(c){var g=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=g+c.data.length}o.prototype.processChunk.call(this,c)},i.exports=s},{"../utils":32,"./GenericWorker":28}],27:[function(e,i,r){var n=e("../utils"),o=e("./GenericWorker");function s(c){o.call(this,"DataWorker");var g=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,c.then(function(f){g.dataIsReady=!0,g.data=f,g.max=f&&f.length||0,g.type=n.getTypeOf(f),g.isPaused||g._tickAndRepeat()},function(f){g.error(f)})}n.inherits(s,o),s.prototype.cleanUp=function(){o.prototype.cleanUp.call(this),this.data=null},s.prototype.resume=function(){return!!o.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,n.delay(this._tickAndRepeat,[],this)),!0)},s.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(n.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},s.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var c=null,g=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":c=this.data.substring(this.index,g);break;case"uint8array":c=this.data.subarray(this.index,g);break;case"array":case"nodebuffer":c=this.data.slice(this.index,g)}return this.index=g,this.push({data:c,meta:{percent:this.max?this.index/this.max*100:0}})},i.exports=s},{"../utils":32,"./GenericWorker":28}],28:[function(e,i,r){function n(o){this.name=o||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}n.prototype={push:function(o){this.emit("data",o)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(o){this.emit("error",o)}return!0},error:function(o){return!this.isFinished&&(this.isPaused?this.generatedError=o:(this.isFinished=!0,this.emit("error",o),this.previous&&this.previous.error(o),this.cleanUp()),!0)},on:function(o,s){return this._listeners[o].push(s),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(o,s){if(this._listeners[o])for(var c=0;c<this._listeners[o].length;c++)this._listeners[o][c].call(this,s)},pipe:function(o){return o.registerPrevious(this)},registerPrevious:function(o){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.streamInfo=o.streamInfo,this.mergeStreamInfo(),this.previous=o;var s=this;return o.on("data",function(c){s.processChunk(c)}),o.on("end",function(){s.end()}),o.on("error",function(c){s.error(c)}),this},pause:function(){return!this.isPaused&&!this.isFinished&&(this.isPaused=!0,this.previous&&this.previous.pause(),!0)},resume:function(){if(!this.isPaused||this.isFinished)return!1;var o=this.isPaused=!1;return this.generatedError&&(this.error(this.generatedError),o=!0),this.previous&&this.previous.resume(),!o},flush:function(){},processChunk:function(o){this.push(o)},withStreamInfo:function(o,s){return this.extraStreamInfo[o]=s,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var o in this.extraStreamInfo)Object.prototype.hasOwnProperty.call(this.extraStreamInfo,o)&&(this.streamInfo[o]=this.extraStreamInfo[o])},lock:function(){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.isLocked=!0,this.previous&&this.previous.lock()},toString:function(){var o="Worker "+this.name;return this.previous?this.previous+" -> "+o:o}},i.exports=n},{}],29:[function(e,i,r){var n=e("../utils"),o=e("./ConvertWorker"),s=e("./GenericWorker"),c=e("../base64"),g=e("../support"),f=e("../external"),y=null;if(g.nodestream)try{y=e("../nodejs/NodejsStreamOutputAdapter")}catch{}function p(w,h){return new f.Promise(function(m,u){var v=[],k=w._internalType,C=w._outputType,S=w._mimeType;w.on("data",function(M,A){v.push(M),h&&h(A)}).on("error",function(M){v=[],u(M)}).on("end",function(){try{var M=(function(A,F,T){switch(A){case"blob":return n.newBlob(n.transformTo("arraybuffer",F),T);case"base64":return c.encode(F);default:return n.transformTo(A,F)}})(C,(function(A,F){var T,H=0,K=null,x=0;for(T=0;T<F.length;T++)x+=F[T].length;switch(A){case"string":return F.join("");case"array":return Array.prototype.concat.apply([],F);case"uint8array":for(K=new Uint8Array(x),T=0;T<F.length;T++)K.set(F[T],H),H+=F[T].length;return K;case"nodebuffer":return Buffer.concat(F);default:throw new Error("concat : unsupported type '"+A+"'")}})(k,v),S);m(M)}catch(A){u(A)}v=[]}).resume()})}function d(w,h,m){var u=h;switch(h){case"blob":case"arraybuffer":u="uint8array";break;case"base64":u="string"}try{this._internalType=u,this._outputType=h,this._mimeType=m,n.checkSupport(u),this._worker=w.pipe(new o(u)),w.lock()}catch(v){this._worker=new s("error"),this._worker.error(v)}}d.prototype={accumulate:function(w){return p(this,w)},on:function(w,h){var m=this;return w==="data"?this._worker.on(w,function(u){h.call(m,u.data,u.meta)}):this._worker.on(w,function(){n.delay(h,arguments,m)}),this},resume:function(){return n.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(w){if(n.checkSupport("nodestream"),this._outputType!=="nodebuffer")throw new Error(this._outputType+" is not supported by this method");return new y(this,{objectMode:this._outputType!=="nodebuffer"},w)}},i.exports=d},{"../base64":1,"../external":6,"../nodejs/NodejsStreamOutputAdapter":13,"../support":30,"../utils":32,"./ConvertWorker":24,"./GenericWorker":28}],30:[function(e,i,r){if(r.base64=!0,r.array=!0,r.string=!0,r.arraybuffer=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u",r.nodebuffer=typeof Buffer<"u",r.uint8array=typeof Uint8Array<"u",typeof ArrayBuffer>"u")r.blob=!1;else{var n=new ArrayBuffer(0);try{r.blob=new Blob([n],{type:"application/zip"}).size===0}catch{try{var o=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);o.append(n),r.blob=o.getBlob("application/zip").size===0}catch{r.blob=!1}}}try{r.nodestream=!!e("readable-stream").Readable}catch{r.nodestream=!1}},{"readable-stream":16}],31:[function(e,i,r){for(var n=e("./utils"),o=e("./support"),s=e("./nodejsUtils"),c=e("./stream/GenericWorker"),g=new Array(256),f=0;f<256;f++)g[f]=252<=f?6:248<=f?5:240<=f?4:224<=f?3:192<=f?2:1;g[254]=g[254]=1;function y(){c.call(this,"utf-8 decode"),this.leftOver=null}function p(){c.call(this,"utf-8 encode")}r.utf8encode=function(d){return o.nodebuffer?s.newBufferFrom(d,"utf-8"):(function(w){var h,m,u,v,k,C=w.length,S=0;for(v=0;v<C;v++)(64512&(m=w.charCodeAt(v)))==55296&&v+1<C&&(64512&(u=w.charCodeAt(v+1)))==56320&&(m=65536+(m-55296<<10)+(u-56320),v++),S+=m<128?1:m<2048?2:m<65536?3:4;for(h=o.uint8array?new Uint8Array(S):new Array(S),v=k=0;k<S;v++)(64512&(m=w.charCodeAt(v)))==55296&&v+1<C&&(64512&(u=w.charCodeAt(v+1)))==56320&&(m=65536+(m-55296<<10)+(u-56320),v++),m<128?h[k++]=m:(m<2048?h[k++]=192|m>>>6:(m<65536?h[k++]=224|m>>>12:(h[k++]=240|m>>>18,h[k++]=128|m>>>12&63),h[k++]=128|m>>>6&63),h[k++]=128|63&m);return h})(d)},r.utf8decode=function(d){return o.nodebuffer?n.transformTo("nodebuffer",d).toString("utf-8"):(function(w){var h,m,u,v,k=w.length,C=new Array(2*k);for(h=m=0;h<k;)if((u=w[h++])<128)C[m++]=u;else if(4<(v=g[u]))C[m++]=65533,h+=v-1;else{for(u&=v===2?31:v===3?15:7;1<v&&h<k;)u=u<<6|63&w[h++],v--;1<v?C[m++]=65533:u<65536?C[m++]=u:(u-=65536,C[m++]=55296|u>>10&1023,C[m++]=56320|1023&u)}return C.length!==m&&(C.subarray?C=C.subarray(0,m):C.length=m),n.applyFromCharCode(C)})(d=n.transformTo(o.uint8array?"uint8array":"array",d))},n.inherits(y,c),y.prototype.processChunk=function(d){var w=n.transformTo(o.uint8array?"uint8array":"array",d.data);if(this.leftOver&&this.leftOver.length){if(o.uint8array){var h=w;(w=new Uint8Array(h.length+this.leftOver.length)).set(this.leftOver,0),w.set(h,this.leftOver.length)}else w=this.leftOver.concat(w);this.leftOver=null}var m=(function(v,k){var C;for((k=k||v.length)>v.length&&(k=v.length),C=k-1;0<=C&&(192&v[C])==128;)C--;return C<0||C===0?k:C+g[v[C]]>k?C:k})(w),u=w;m!==w.length&&(o.uint8array?(u=w.subarray(0,m),this.leftOver=w.subarray(m,w.length)):(u=w.slice(0,m),this.leftOver=w.slice(m,w.length))),this.push({data:r.utf8decode(u),meta:d.meta})},y.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:r.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},r.Utf8DecodeWorker=y,n.inherits(p,c),p.prototype.processChunk=function(d){this.push({data:r.utf8encode(d.data),meta:d.meta})},r.Utf8EncodeWorker=p},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(e,i,r){var n=e("./support"),o=e("./base64"),s=e("./nodejsUtils"),c=e("./external");function g(h){return h}function f(h,m){for(var u=0;u<h.length;++u)m[u]=255&h.charCodeAt(u);return m}e("setimmediate"),r.newBlob=function(h,m){r.checkSupport("blob");try{return new Blob([h],{type:m})}catch{try{var u=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);return u.append(h),u.getBlob(m)}catch{throw new Error("Bug : can't construct the Blob.")}}};var y={stringifyByChunk:function(h,m,u){var v=[],k=0,C=h.length;if(C<=u)return String.fromCharCode.apply(null,h);for(;k<C;)m==="array"||m==="nodebuffer"?v.push(String.fromCharCode.apply(null,h.slice(k,Math.min(k+u,C)))):v.push(String.fromCharCode.apply(null,h.subarray(k,Math.min(k+u,C)))),k+=u;return v.join("")},stringifyByChar:function(h){for(var m="",u=0;u<h.length;u++)m+=String.fromCharCode(h[u]);return m},applyCanBeUsed:{uint8array:(function(){try{return n.uint8array&&String.fromCharCode.apply(null,new Uint8Array(1)).length===1}catch{return!1}})(),nodebuffer:(function(){try{return n.nodebuffer&&String.fromCharCode.apply(null,s.allocBuffer(1)).length===1}catch{return!1}})()}};function p(h){var m=65536,u=r.getTypeOf(h),v=!0;if(u==="uint8array"?v=y.applyCanBeUsed.uint8array:u==="nodebuffer"&&(v=y.applyCanBeUsed.nodebuffer),v)for(;1<m;)try{return y.stringifyByChunk(h,u,m)}catch{m=Math.floor(m/2)}return y.stringifyByChar(h)}function d(h,m){for(var u=0;u<h.length;u++)m[u]=h[u];return m}r.applyFromCharCode=p;var w={};w.string={string:g,array:function(h){return f(h,new Array(h.length))},arraybuffer:function(h){return w.string.uint8array(h).buffer},uint8array:function(h){return f(h,new Uint8Array(h.length))},nodebuffer:function(h){return f(h,s.allocBuffer(h.length))}},w.array={string:p,array:g,arraybuffer:function(h){return new Uint8Array(h).buffer},uint8array:function(h){return new Uint8Array(h)},nodebuffer:function(h){return s.newBufferFrom(h)}},w.arraybuffer={string:function(h){return p(new Uint8Array(h))},array:function(h){return d(new Uint8Array(h),new Array(h.byteLength))},arraybuffer:g,uint8array:function(h){return new Uint8Array(h)},nodebuffer:function(h){return s.newBufferFrom(new Uint8Array(h))}},w.uint8array={string:p,array:function(h){return d(h,new Array(h.length))},arraybuffer:function(h){return h.buffer},uint8array:g,nodebuffer:function(h){return s.newBufferFrom(h)}},w.nodebuffer={string:p,array:function(h){return d(h,new Array(h.length))},arraybuffer:function(h){return w.nodebuffer.uint8array(h).buffer},uint8array:function(h){return d(h,new Uint8Array(h.length))},nodebuffer:g},r.transformTo=function(h,m){if(m=m||"",!h)return m;r.checkSupport(h);var u=r.getTypeOf(m);return w[u][h](m)},r.resolve=function(h){for(var m=h.split("/"),u=[],v=0;v<m.length;v++){var k=m[v];k==="."||k===""&&v!==0&&v!==m.length-1||(k===".."?u.pop():u.push(k))}return u.join("/")},r.getTypeOf=function(h){return typeof h=="string"?"string":Object.prototype.toString.call(h)==="[object Array]"?"array":n.nodebuffer&&s.isBuffer(h)?"nodebuffer":n.uint8array&&h instanceof Uint8Array?"uint8array":n.arraybuffer&&h instanceof ArrayBuffer?"arraybuffer":void 0},r.checkSupport=function(h){if(!n[h.toLowerCase()])throw new Error(h+" is not supported by this platform")},r.MAX_VALUE_16BITS=65535,r.MAX_VALUE_32BITS=-1,r.pretty=function(h){var m,u,v="";for(u=0;u<(h||"").length;u++)v+="\\x"+((m=h.charCodeAt(u))<16?"0":"")+m.toString(16).toUpperCase();return v},r.delay=function(h,m,u){setImmediate(function(){h.apply(u||null,m||[])})},r.inherits=function(h,m){function u(){}u.prototype=m.prototype,h.prototype=new u},r.extend=function(){var h,m,u={};for(h=0;h<arguments.length;h++)for(m in arguments[h])Object.prototype.hasOwnProperty.call(arguments[h],m)&&u[m]===void 0&&(u[m]=arguments[h][m]);return u},r.prepareContent=function(h,m,u,v,k){return c.Promise.resolve(m).then(function(C){return n.blob&&(C instanceof Blob||["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(C))!==-1)&&typeof FileReader<"u"?new c.Promise(function(S,M){var A=new FileReader;A.onload=function(F){S(F.target.result)},A.onerror=function(F){M(F.target.error)},A.readAsArrayBuffer(C)}):C}).then(function(C){var S=r.getTypeOf(C);return S?(S==="arraybuffer"?C=r.transformTo("uint8array",C):S==="string"&&(k?C=o.decode(C):u&&v!==!0&&(C=(function(M){return f(M,n.uint8array?new Uint8Array(M.length):new Array(M.length))})(C))),C):c.Promise.reject(new Error("Can't read the data of '"+h+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))})}},{"./base64":1,"./external":6,"./nodejsUtils":14,"./support":30,setimmediate:54}],33:[function(e,i,r){var n=e("./reader/readerFor"),o=e("./utils"),s=e("./signature"),c=e("./zipEntry"),g=e("./support");function f(y){this.files=[],this.loadOptions=y}f.prototype={checkSignature:function(y){if(!this.reader.readAndCheckSignature(y)){this.reader.index-=4;var p=this.reader.readString(4);throw new Error("Corrupted zip or bug: unexpected signature ("+o.pretty(p)+", expected "+o.pretty(y)+")")}},isSignature:function(y,p){var d=this.reader.index;this.reader.setIndex(y);var w=this.reader.readString(4)===p;return this.reader.setIndex(d),w},readBlockEndOfCentral:function(){this.diskNumber=this.reader.readInt(2),this.diskWithCentralDirStart=this.reader.readInt(2),this.centralDirRecordsOnThisDisk=this.reader.readInt(2),this.centralDirRecords=this.reader.readInt(2),this.centralDirSize=this.reader.readInt(4),this.centralDirOffset=this.reader.readInt(4),this.zipCommentLength=this.reader.readInt(2);var y=this.reader.readData(this.zipCommentLength),p=g.uint8array?"uint8array":"array",d=o.transformTo(p,y);this.zipComment=this.loadOptions.decodeFileName(d)},readBlockZip64EndOfCentral:function(){this.zip64EndOfCentralSize=this.reader.readInt(8),this.reader.skip(4),this.diskNumber=this.reader.readInt(4),this.diskWithCentralDirStart=this.reader.readInt(4),this.centralDirRecordsOnThisDisk=this.reader.readInt(8),this.centralDirRecords=this.reader.readInt(8),this.centralDirSize=this.reader.readInt(8),this.centralDirOffset=this.reader.readInt(8),this.zip64ExtensibleData={};for(var y,p,d,w=this.zip64EndOfCentralSize-44;0<w;)y=this.reader.readInt(2),p=this.reader.readInt(4),d=this.reader.readData(p),this.zip64ExtensibleData[y]={id:y,length:p,value:d}},readBlockZip64EndOfCentralLocator:function(){if(this.diskWithZip64CentralDirStart=this.reader.readInt(4),this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8),this.disksCount=this.reader.readInt(4),1<this.disksCount)throw new Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var y,p;for(y=0;y<this.files.length;y++)p=this.files[y],this.reader.setIndex(p.localHeaderOffset),this.checkSignature(s.LOCAL_FILE_HEADER),p.readLocalPart(this.reader),p.handleUTF8(),p.processAttributes()},readCentralDir:function(){var y;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(s.CENTRAL_FILE_HEADER);)(y=new c({zip64:this.zip64},this.loadOptions)).readCentralPart(this.reader),this.files.push(y);if(this.centralDirRecords!==this.files.length&&this.centralDirRecords!==0&&this.files.length===0)throw new Error("Corrupted zip or bug: expected "+this.centralDirRecords+" records in central dir, got "+this.files.length)},readEndOfCentral:function(){var y=this.reader.lastIndexOfSignature(s.CENTRAL_DIRECTORY_END);if(y<0)throw this.isSignature(0,s.LOCAL_FILE_HEADER)?new Error("Corrupted zip: can't find end of central directory"):new Error("Can't find end of central directory : is this a zip file ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html");this.reader.setIndex(y);var p=y;if(this.checkSignature(s.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===o.MAX_VALUE_16BITS||this.diskWithCentralDirStart===o.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===o.MAX_VALUE_16BITS||this.centralDirRecords===o.MAX_VALUE_16BITS||this.centralDirSize===o.MAX_VALUE_32BITS||this.centralDirOffset===o.MAX_VALUE_32BITS){if(this.zip64=!0,(y=this.reader.lastIndexOfSignature(s.ZIP64_CENTRAL_DIRECTORY_LOCATOR))<0)throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex(y),this.checkSignature(s.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,s.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(s.ZIP64_CENTRAL_DIRECTORY_END),this.relativeOffsetEndOfZip64CentralDir<0))throw new Error("Corrupted zip: can't find the ZIP64 end of central directory");this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir),this.checkSignature(s.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var d=this.centralDirOffset+this.centralDirSize;this.zip64&&(d+=20,d+=12+this.zip64EndOfCentralSize);var w=p-d;if(0<w)this.isSignature(p,s.CENTRAL_FILE_HEADER)||(this.reader.zero=w);else if(w<0)throw new Error("Corrupted zip: missing "+Math.abs(w)+" bytes.")},prepareReader:function(y){this.reader=n(y)},load:function(y){this.prepareReader(y),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}},i.exports=f},{"./reader/readerFor":22,"./signature":23,"./support":30,"./utils":32,"./zipEntry":34}],34:[function(e,i,r){var n=e("./reader/readerFor"),o=e("./utils"),s=e("./compressedObject"),c=e("./crc32"),g=e("./utf8"),f=e("./compressions"),y=e("./support");function p(d,w){this.options=d,this.loadOptions=w}p.prototype={isEncrypted:function(){return(1&this.bitFlag)==1},useUTF8:function(){return(2048&this.bitFlag)==2048},readLocalPart:function(d){var w,h;if(d.skip(22),this.fileNameLength=d.readInt(2),h=d.readInt(2),this.fileName=d.readData(this.fileNameLength),d.skip(h),this.compressedSize===-1||this.uncompressedSize===-1)throw new Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)");if((w=(function(m){for(var u in f)if(Object.prototype.hasOwnProperty.call(f,u)&&f[u].magic===m)return f[u];return null})(this.compressionMethod))===null)throw new Error("Corrupted zip : compression "+o.pretty(this.compressionMethod)+" unknown (inner file : "+o.transformTo("string",this.fileName)+")");this.decompressed=new s(this.compressedSize,this.uncompressedSize,this.crc32,w,d.readData(this.compressedSize))},readCentralPart:function(d){this.versionMadeBy=d.readInt(2),d.skip(2),this.bitFlag=d.readInt(2),this.compressionMethod=d.readString(2),this.date=d.readDate(),this.crc32=d.readInt(4),this.compressedSize=d.readInt(4),this.uncompressedSize=d.readInt(4);var w=d.readInt(2);if(this.extraFieldsLength=d.readInt(2),this.fileCommentLength=d.readInt(2),this.diskNumberStart=d.readInt(2),this.internalFileAttributes=d.readInt(2),this.externalFileAttributes=d.readInt(4),this.localHeaderOffset=d.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");d.skip(w),this.readExtraFields(d),this.parseZIP64ExtraField(d),this.fileComment=d.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var d=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),d==0&&(this.dosPermissions=63&this.externalFileAttributes),d==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var d=n(this.extraFields[1].value);this.uncompressedSize===o.MAX_VALUE_32BITS&&(this.uncompressedSize=d.readInt(8)),this.compressedSize===o.MAX_VALUE_32BITS&&(this.compressedSize=d.readInt(8)),this.localHeaderOffset===o.MAX_VALUE_32BITS&&(this.localHeaderOffset=d.readInt(8)),this.diskNumberStart===o.MAX_VALUE_32BITS&&(this.diskNumberStart=d.readInt(4))}},readExtraFields:function(d){var w,h,m,u=d.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});d.index+4<u;)w=d.readInt(2),h=d.readInt(2),m=d.readData(h),this.extraFields[w]={id:w,length:h,value:m};d.setIndex(u)},handleUTF8:function(){var d=y.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=g.utf8decode(this.fileName),this.fileCommentStr=g.utf8decode(this.fileComment);else{var w=this.findExtraFieldUnicodePath();if(w!==null)this.fileNameStr=w;else{var h=o.transformTo(d,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(h)}var m=this.findExtraFieldUnicodeComment();if(m!==null)this.fileCommentStr=m;else{var u=o.transformTo(d,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(u)}}},findExtraFieldUnicodePath:function(){var d=this.extraFields[28789];if(d){var w=n(d.value);return w.readInt(1)!==1||c(this.fileName)!==w.readInt(4)?null:g.utf8decode(w.readData(d.length-5))}return null},findExtraFieldUnicodeComment:function(){var d=this.extraFields[25461];if(d){var w=n(d.value);return w.readInt(1)!==1||c(this.fileComment)!==w.readInt(4)?null:g.utf8decode(w.readData(d.length-5))}return null}},i.exports=p},{"./compressedObject":2,"./compressions":3,"./crc32":4,"./reader/readerFor":22,"./support":30,"./utf8":31,"./utils":32}],35:[function(e,i,r){function n(w,h,m){this.name=w,this.dir=m.dir,this.date=m.date,this.comment=m.comment,this.unixPermissions=m.unixPermissions,this.dosPermissions=m.dosPermissions,this._data=h,this._dataBinary=m.binary,this.options={compression:m.compression,compressionOptions:m.compressionOptions}}var o=e("./stream/StreamHelper"),s=e("./stream/DataWorker"),c=e("./utf8"),g=e("./compressedObject"),f=e("./stream/GenericWorker");n.prototype={internalStream:function(w){var h=null,m="string";try{if(!w)throw new Error("No output type specified.");var u=(m=w.toLowerCase())==="string"||m==="text";m!=="binarystring"&&m!=="text"||(m="string"),h=this._decompressWorker();var v=!this._dataBinary;v&&!u&&(h=h.pipe(new c.Utf8EncodeWorker)),!v&&u&&(h=h.pipe(new c.Utf8DecodeWorker))}catch(k){(h=new f("error")).error(k)}return new o(h,m,"")},async:function(w,h){return this.internalStream(w).accumulate(h)},nodeStream:function(w,h){return this.internalStream(w||"nodebuffer").toNodejsStream(h)},_compressWorker:function(w,h){if(this._data instanceof g&&this._data.compression.magic===w.magic)return this._data.getCompressedWorker();var m=this._decompressWorker();return this._dataBinary||(m=m.pipe(new c.Utf8EncodeWorker)),g.createWorkerFrom(m,w,h)},_decompressWorker:function(){return this._data instanceof g?this._data.getContentWorker():this._data instanceof f?this._data:new s(this._data)}};for(var y=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],p=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},d=0;d<y.length;d++)n.prototype[y[d]]=p;i.exports=n},{"./compressedObject":2,"./stream/DataWorker":27,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31}],36:[function(e,i,r){(function(n){var o,s,c=n.MutationObserver||n.WebKitMutationObserver;if(c){var g=0,f=new c(w),y=n.document.createTextNode("");f.observe(y,{characterData:!0}),o=function(){y.data=g=++g%2}}else if(n.setImmediate||n.MessageChannel===void 0)o="document"in n&&"onreadystatechange"in n.document.createElement("script")?function(){var h=n.document.createElement("script");h.onreadystatechange=function(){w(),h.onreadystatechange=null,h.parentNode.removeChild(h),h=null},n.document.documentElement.appendChild(h)}:function(){setTimeout(w,0)};else{var p=new n.MessageChannel;p.port1.onmessage=w,o=function(){p.port2.postMessage(0)}}var d=[];function w(){var h,m;s=!0;for(var u=d.length;u;){for(m=d,d=[],h=-1;++h<u;)m[h]();u=d.length}s=!1}i.exports=function(h){d.push(h)!==1||s||o()}}).call(this,typeof kt<"u"?kt:typeof self<"u"?self:typeof window<"u"?window:{})},{}],37:[function(e,i,r){var n=e("immediate");function o(){}var s={},c=["REJECTED"],g=["FULFILLED"],f=["PENDING"];function y(u){if(typeof u!="function")throw new TypeError("resolver must be a function");this.state=f,this.queue=[],this.outcome=void 0,u!==o&&h(this,u)}function p(u,v,k){this.promise=u,typeof v=="function"&&(this.onFulfilled=v,this.callFulfilled=this.otherCallFulfilled),typeof k=="function"&&(this.onRejected=k,this.callRejected=this.otherCallRejected)}function d(u,v,k){n(function(){var C;try{C=v(k)}catch(S){return s.reject(u,S)}C===u?s.reject(u,new TypeError("Cannot resolve promise with itself")):s.resolve(u,C)})}function w(u){var v=u&&u.then;if(u&&(typeof u=="object"||typeof u=="function")&&typeof v=="function")return function(){v.apply(u,arguments)}}function h(u,v){var k=!1;function C(A){k||(k=!0,s.reject(u,A))}function S(A){k||(k=!0,s.resolve(u,A))}var M=m(function(){v(S,C)});M.status==="error"&&C(M.value)}function m(u,v){var k={};try{k.value=u(v),k.status="success"}catch(C){k.status="error",k.value=C}return k}(i.exports=y).prototype.finally=function(u){if(typeof u!="function")return this;var v=this.constructor;return this.then(function(k){return v.resolve(u()).then(function(){return k})},function(k){return v.resolve(u()).then(function(){throw k})})},y.prototype.catch=function(u){return this.then(null,u)},y.prototype.then=function(u,v){if(typeof u!="function"&&this.state===g||typeof v!="function"&&this.state===c)return this;var k=new this.constructor(o);return this.state!==f?d(k,this.state===g?u:v,this.outcome):this.queue.push(new p(k,u,v)),k},p.prototype.callFulfilled=function(u){s.resolve(this.promise,u)},p.prototype.otherCallFulfilled=function(u){d(this.promise,this.onFulfilled,u)},p.prototype.callRejected=function(u){s.reject(this.promise,u)},p.prototype.otherCallRejected=function(u){d(this.promise,this.onRejected,u)},s.resolve=function(u,v){var k=m(w,v);if(k.status==="error")return s.reject(u,k.value);var C=k.value;if(C)h(u,C);else{u.state=g,u.outcome=v;for(var S=-1,M=u.queue.length;++S<M;)u.queue[S].callFulfilled(v)}return u},s.reject=function(u,v){u.state=c,u.outcome=v;for(var k=-1,C=u.queue.length;++k<C;)u.queue[k].callRejected(v);return u},y.resolve=function(u){return u instanceof this?u:s.resolve(new this(o),u)},y.reject=function(u){var v=new this(o);return s.reject(v,u)},y.all=function(u){var v=this;if(Object.prototype.toString.call(u)!=="[object Array]")return this.reject(new TypeError("must be an array"));var k=u.length,C=!1;if(!k)return this.resolve([]);for(var S=new Array(k),M=0,A=-1,F=new this(o);++A<k;)T(u[A],A);return F;function T(H,K){v.resolve(H).then(function(x){S[K]=x,++M!==k||C||(C=!0,s.resolve(F,S))},function(x){C||(C=!0,s.reject(F,x))})}},y.race=function(u){var v=this;if(Object.prototype.toString.call(u)!=="[object Array]")return this.reject(new TypeError("must be an array"));var k=u.length,C=!1;if(!k)return this.resolve([]);for(var S=-1,M=new this(o);++S<k;)A=u[S],v.resolve(A).then(function(F){C||(C=!0,s.resolve(M,F))},function(F){C||(C=!0,s.reject(M,F))});var A;return M}},{immediate:36}],38:[function(e,i,r){var n={};(0,e("./lib/utils/common").assign)(n,e("./lib/deflate"),e("./lib/inflate"),e("./lib/zlib/constants")),i.exports=n},{"./lib/deflate":39,"./lib/inflate":40,"./lib/utils/common":41,"./lib/zlib/constants":44}],39:[function(e,i,r){var n=e("./zlib/deflate"),o=e("./utils/common"),s=e("./utils/strings"),c=e("./zlib/messages"),g=e("./zlib/zstream"),f=Object.prototype.toString,y=0,p=-1,d=0,w=8;function h(u){if(!(this instanceof h))return new h(u);this.options=o.assign({level:p,method:w,chunkSize:16384,windowBits:15,memLevel:8,strategy:d,to:""},u||{});var v=this.options;v.raw&&0<v.windowBits?v.windowBits=-v.windowBits:v.gzip&&0<v.windowBits&&v.windowBits<16&&(v.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new g,this.strm.avail_out=0;var k=n.deflateInit2(this.strm,v.level,v.method,v.windowBits,v.memLevel,v.strategy);if(k!==y)throw new Error(c[k]);if(v.header&&n.deflateSetHeader(this.strm,v.header),v.dictionary){var C;if(C=typeof v.dictionary=="string"?s.string2buf(v.dictionary):f.call(v.dictionary)==="[object ArrayBuffer]"?new Uint8Array(v.dictionary):v.dictionary,(k=n.deflateSetDictionary(this.strm,C))!==y)throw new Error(c[k]);this._dict_set=!0}}function m(u,v){var k=new h(v);if(k.push(u,!0),k.err)throw k.msg||c[k.err];return k.result}h.prototype.push=function(u,v){var k,C,S=this.strm,M=this.options.chunkSize;if(this.ended)return!1;C=v===~~v?v:v===!0?4:0,typeof u=="string"?S.input=s.string2buf(u):f.call(u)==="[object ArrayBuffer]"?S.input=new Uint8Array(u):S.input=u,S.next_in=0,S.avail_in=S.input.length;do{if(S.avail_out===0&&(S.output=new o.Buf8(M),S.next_out=0,S.avail_out=M),(k=n.deflate(S,C))!==1&&k!==y)return this.onEnd(k),!(this.ended=!0);S.avail_out!==0&&(S.avail_in!==0||C!==4&&C!==2)||(this.options.to==="string"?this.onData(s.buf2binstring(o.shrinkBuf(S.output,S.next_out))):this.onData(o.shrinkBuf(S.output,S.next_out)))}while((0<S.avail_in||S.avail_out===0)&&k!==1);return C===4?(k=n.deflateEnd(this.strm),this.onEnd(k),this.ended=!0,k===y):C!==2||(this.onEnd(y),!(S.avail_out=0))},h.prototype.onData=function(u){this.chunks.push(u)},h.prototype.onEnd=function(u){u===y&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=o.flattenChunks(this.chunks)),this.chunks=[],this.err=u,this.msg=this.strm.msg},r.Deflate=h,r.deflate=m,r.deflateRaw=function(u,v){return(v=v||{}).raw=!0,m(u,v)},r.gzip=function(u,v){return(v=v||{}).gzip=!0,m(u,v)}},{"./utils/common":41,"./utils/strings":42,"./zlib/deflate":46,"./zlib/messages":51,"./zlib/zstream":53}],40:[function(e,i,r){var n=e("./zlib/inflate"),o=e("./utils/common"),s=e("./utils/strings"),c=e("./zlib/constants"),g=e("./zlib/messages"),f=e("./zlib/zstream"),y=e("./zlib/gzheader"),p=Object.prototype.toString;function d(h){if(!(this instanceof d))return new d(h);this.options=o.assign({chunkSize:16384,windowBits:0,to:""},h||{});var m=this.options;m.raw&&0<=m.windowBits&&m.windowBits<16&&(m.windowBits=-m.windowBits,m.windowBits===0&&(m.windowBits=-15)),!(0<=m.windowBits&&m.windowBits<16)||h&&h.windowBits||(m.windowBits+=32),15<m.windowBits&&m.windowBits<48&&(15&m.windowBits)==0&&(m.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new f,this.strm.avail_out=0;var u=n.inflateInit2(this.strm,m.windowBits);if(u!==c.Z_OK)throw new Error(g[u]);this.header=new y,n.inflateGetHeader(this.strm,this.header)}function w(h,m){var u=new d(m);if(u.push(h,!0),u.err)throw u.msg||g[u.err];return u.result}d.prototype.push=function(h,m){var u,v,k,C,S,M,A=this.strm,F=this.options.chunkSize,T=this.options.dictionary,H=!1;if(this.ended)return!1;v=m===~~m?m:m===!0?c.Z_FINISH:c.Z_NO_FLUSH,typeof h=="string"?A.input=s.binstring2buf(h):p.call(h)==="[object ArrayBuffer]"?A.input=new Uint8Array(h):A.input=h,A.next_in=0,A.avail_in=A.input.length;do{if(A.avail_out===0&&(A.output=new o.Buf8(F),A.next_out=0,A.avail_out=F),(u=n.inflate(A,c.Z_NO_FLUSH))===c.Z_NEED_DICT&&T&&(M=typeof T=="string"?s.string2buf(T):p.call(T)==="[object ArrayBuffer]"?new Uint8Array(T):T,u=n.inflateSetDictionary(this.strm,M)),u===c.Z_BUF_ERROR&&H===!0&&(u=c.Z_OK,H=!1),u!==c.Z_STREAM_END&&u!==c.Z_OK)return this.onEnd(u),!(this.ended=!0);A.next_out&&(A.avail_out!==0&&u!==c.Z_STREAM_END&&(A.avail_in!==0||v!==c.Z_FINISH&&v!==c.Z_SYNC_FLUSH)||(this.options.to==="string"?(k=s.utf8border(A.output,A.next_out),C=A.next_out-k,S=s.buf2string(A.output,k),A.next_out=C,A.avail_out=F-C,C&&o.arraySet(A.output,A.output,k,C,0),this.onData(S)):this.onData(o.shrinkBuf(A.output,A.next_out)))),A.avail_in===0&&A.avail_out===0&&(H=!0)}while((0<A.avail_in||A.avail_out===0)&&u!==c.Z_STREAM_END);return u===c.Z_STREAM_END&&(v=c.Z_FINISH),v===c.Z_FINISH?(u=n.inflateEnd(this.strm),this.onEnd(u),this.ended=!0,u===c.Z_OK):v!==c.Z_SYNC_FLUSH||(this.onEnd(c.Z_OK),!(A.avail_out=0))},d.prototype.onData=function(h){this.chunks.push(h)},d.prototype.onEnd=function(h){h===c.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=o.flattenChunks(this.chunks)),this.chunks=[],this.err=h,this.msg=this.strm.msg},r.Inflate=d,r.inflate=w,r.inflateRaw=function(h,m){return(m=m||{}).raw=!0,w(h,m)},r.ungzip=w},{"./utils/common":41,"./utils/strings":42,"./zlib/constants":44,"./zlib/gzheader":47,"./zlib/inflate":49,"./zlib/messages":51,"./zlib/zstream":53}],41:[function(e,i,r){var n=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";r.assign=function(c){for(var g=Array.prototype.slice.call(arguments,1);g.length;){var f=g.shift();if(f){if(typeof f!="object")throw new TypeError(f+"must be non-object");for(var y in f)f.hasOwnProperty(y)&&(c[y]=f[y])}}return c},r.shrinkBuf=function(c,g){return c.length===g?c:c.subarray?c.subarray(0,g):(c.length=g,c)};var o={arraySet:function(c,g,f,y,p){if(g.subarray&&c.subarray)c.set(g.subarray(f,f+y),p);else for(var d=0;d<y;d++)c[p+d]=g[f+d]},flattenChunks:function(c){var g,f,y,p,d,w;for(g=y=0,f=c.length;g<f;g++)y+=c[g].length;for(w=new Uint8Array(y),g=p=0,f=c.length;g<f;g++)d=c[g],w.set(d,p),p+=d.length;return w}},s={arraySet:function(c,g,f,y,p){for(var d=0;d<y;d++)c[p+d]=g[f+d]},flattenChunks:function(c){return[].concat.apply([],c)}};r.setTyped=function(c){c?(r.Buf8=Uint8Array,r.Buf16=Uint16Array,r.Buf32=Int32Array,r.assign(r,o)):(r.Buf8=Array,r.Buf16=Array,r.Buf32=Array,r.assign(r,s))},r.setTyped(n)},{}],42:[function(e,i,r){var n=e("./common"),o=!0,s=!0;try{String.fromCharCode.apply(null,[0])}catch{o=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{s=!1}for(var c=new n.Buf8(256),g=0;g<256;g++)c[g]=252<=g?6:248<=g?5:240<=g?4:224<=g?3:192<=g?2:1;function f(y,p){if(p<65537&&(y.subarray&&s||!y.subarray&&o))return String.fromCharCode.apply(null,n.shrinkBuf(y,p));for(var d="",w=0;w<p;w++)d+=String.fromCharCode(y[w]);return d}c[254]=c[254]=1,r.string2buf=function(y){var p,d,w,h,m,u=y.length,v=0;for(h=0;h<u;h++)(64512&(d=y.charCodeAt(h)))==55296&&h+1<u&&(64512&(w=y.charCodeAt(h+1)))==56320&&(d=65536+(d-55296<<10)+(w-56320),h++),v+=d<128?1:d<2048?2:d<65536?3:4;for(p=new n.Buf8(v),h=m=0;m<v;h++)(64512&(d=y.charCodeAt(h)))==55296&&h+1<u&&(64512&(w=y.charCodeAt(h+1)))==56320&&(d=65536+(d-55296<<10)+(w-56320),h++),d<128?p[m++]=d:(d<2048?p[m++]=192|d>>>6:(d<65536?p[m++]=224|d>>>12:(p[m++]=240|d>>>18,p[m++]=128|d>>>12&63),p[m++]=128|d>>>6&63),p[m++]=128|63&d);return p},r.buf2binstring=function(y){return f(y,y.length)},r.binstring2buf=function(y){for(var p=new n.Buf8(y.length),d=0,w=p.length;d<w;d++)p[d]=y.charCodeAt(d);return p},r.buf2string=function(y,p){var d,w,h,m,u=p||y.length,v=new Array(2*u);for(d=w=0;d<u;)if((h=y[d++])<128)v[w++]=h;else if(4<(m=c[h]))v[w++]=65533,d+=m-1;else{for(h&=m===2?31:m===3?15:7;1<m&&d<u;)h=h<<6|63&y[d++],m--;1<m?v[w++]=65533:h<65536?v[w++]=h:(h-=65536,v[w++]=55296|h>>10&1023,v[w++]=56320|1023&h)}return f(v,w)},r.utf8border=function(y,p){var d;for((p=p||y.length)>y.length&&(p=y.length),d=p-1;0<=d&&(192&y[d])==128;)d--;return d<0||d===0?p:d+c[y[d]]>p?d:p}},{"./common":41}],43:[function(e,i,r){i.exports=function(n,o,s,c){for(var g=65535&n|0,f=n>>>16&65535|0,y=0;s!==0;){for(s-=y=2e3<s?2e3:s;f=f+(g=g+o[c++]|0)|0,--y;);g%=65521,f%=65521}return g|f<<16|0}},{}],44:[function(e,i,r){i.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},{}],45:[function(e,i,r){var n=(function(){for(var o,s=[],c=0;c<256;c++){o=c;for(var g=0;g<8;g++)o=1&o?3988292384^o>>>1:o>>>1;s[c]=o}return s})();i.exports=function(o,s,c,g){var f=n,y=g+c;o^=-1;for(var p=g;p<y;p++)o=o>>>8^f[255&(o^s[p])];return-1^o}},{}],46:[function(e,i,r){var n,o=e("../utils/common"),s=e("./trees"),c=e("./adler32"),g=e("./crc32"),f=e("./messages"),y=0,p=4,d=0,w=-2,h=-1,m=4,u=2,v=8,k=9,C=286,S=30,M=19,A=2*C+1,F=15,T=3,H=258,K=H+T+1,x=42,D=113,l=1,R=2,V=3,W=4;function Q(a,L){return a.msg=f[L],L}function U(a){return(a<<1)-(4<a?9:0)}function q(a){for(var L=a.length;0<=--L;)a[L]=0}function z(a){var L=a.state,B=L.pending;B>a.avail_out&&(B=a.avail_out),B!==0&&(o.arraySet(a.output,L.pending_buf,L.pending_out,B,a.next_out),a.next_out+=B,L.pending_out+=B,a.total_out+=B,a.avail_out-=B,L.pending-=B,L.pending===0&&(L.pending_out=0))}function I(a,L){s._tr_flush_block(a,0<=a.block_start?a.block_start:-1,a.strstart-a.block_start,L),a.block_start=a.strstart,z(a.strm)}function J(a,L){a.pending_buf[a.pending++]=L}function Y(a,L){a.pending_buf[a.pending++]=L>>>8&255,a.pending_buf[a.pending++]=255&L}function X(a,L){var B,_,b=a.max_chain_length,N=a.strstart,O=a.prev_length,P=a.nice_match,E=a.strstart>a.w_size-K?a.strstart-(a.w_size-K):0,j=a.window,G=a.w_mask,Z=a.prev,$=a.strstart+H,nt=j[N+O-1],et=j[N+O];a.prev_length>=a.good_match&&(b>>=2),P>a.lookahead&&(P=a.lookahead);do if(j[(B=L)+O]===et&&j[B+O-1]===nt&&j[B]===j[N]&&j[++B]===j[N+1]){N+=2,B++;do;while(j[++N]===j[++B]&&j[++N]===j[++B]&&j[++N]===j[++B]&&j[++N]===j[++B]&&j[++N]===j[++B]&&j[++N]===j[++B]&&j[++N]===j[++B]&&j[++N]===j[++B]&&N<$);if(_=H-($-N),N=$-H,O<_){if(a.match_start=L,P<=(O=_))break;nt=j[N+O-1],et=j[N+O]}}while((L=Z[L&G])>E&&--b!=0);return O<=a.lookahead?O:a.lookahead}function ot(a){var L,B,_,b,N,O,P,E,j,G,Z=a.w_size;do{if(b=a.window_size-a.lookahead-a.strstart,a.strstart>=Z+(Z-K)){for(o.arraySet(a.window,a.window,Z,Z,0),a.match_start-=Z,a.strstart-=Z,a.block_start-=Z,L=B=a.hash_size;_=a.head[--L],a.head[L]=Z<=_?_-Z:0,--B;);for(L=B=Z;_=a.prev[--L],a.prev[L]=Z<=_?_-Z:0,--B;);b+=Z}if(a.strm.avail_in===0)break;if(O=a.strm,P=a.window,E=a.strstart+a.lookahead,j=b,G=void 0,G=O.avail_in,j<G&&(G=j),B=G===0?0:(O.avail_in-=G,o.arraySet(P,O.input,O.next_in,G,E),O.state.wrap===1?O.adler=c(O.adler,P,G,E):O.state.wrap===2&&(O.adler=g(O.adler,P,G,E)),O.next_in+=G,O.total_in+=G,G),a.lookahead+=B,a.lookahead+a.insert>=T)for(N=a.strstart-a.insert,a.ins_h=a.window[N],a.ins_h=(a.ins_h<<a.hash_shift^a.window[N+1])&a.hash_mask;a.insert&&(a.ins_h=(a.ins_h<<a.hash_shift^a.window[N+T-1])&a.hash_mask,a.prev[N&a.w_mask]=a.head[a.ins_h],a.head[a.ins_h]=N,N++,a.insert--,!(a.lookahead+a.insert<T)););}while(a.lookahead<K&&a.strm.avail_in!==0)}function dt(a,L){for(var B,_;;){if(a.lookahead<K){if(ot(a),a.lookahead<K&&L===y)return l;if(a.lookahead===0)break}if(B=0,a.lookahead>=T&&(a.ins_h=(a.ins_h<<a.hash_shift^a.window[a.strstart+T-1])&a.hash_mask,B=a.prev[a.strstart&a.w_mask]=a.head[a.ins_h],a.head[a.ins_h]=a.strstart),B!==0&&a.strstart-B<=a.w_size-K&&(a.match_length=X(a,B)),a.match_length>=T)if(_=s._tr_tally(a,a.strstart-a.match_start,a.match_length-T),a.lookahead-=a.match_length,a.match_length<=a.max_lazy_match&&a.lookahead>=T){for(a.match_length--;a.strstart++,a.ins_h=(a.ins_h<<a.hash_shift^a.window[a.strstart+T-1])&a.hash_mask,B=a.prev[a.strstart&a.w_mask]=a.head[a.ins_h],a.head[a.ins_h]=a.strstart,--a.match_length!=0;);a.strstart++}else a.strstart+=a.match_length,a.match_length=0,a.ins_h=a.window[a.strstart],a.ins_h=(a.ins_h<<a.hash_shift^a.window[a.strstart+1])&a.hash_mask;else _=s._tr_tally(a,0,a.window[a.strstart]),a.lookahead--,a.strstart++;if(_&&(I(a,!1),a.strm.avail_out===0))return l}return a.insert=a.strstart<T-1?a.strstart:T-1,L===p?(I(a,!0),a.strm.avail_out===0?V:W):a.last_lit&&(I(a,!1),a.strm.avail_out===0)?l:R}function tt(a,L){for(var B,_,b;;){if(a.lookahead<K){if(ot(a),a.lookahead<K&&L===y)return l;if(a.lookahead===0)break}if(B=0,a.lookahead>=T&&(a.ins_h=(a.ins_h<<a.hash_shift^a.window[a.strstart+T-1])&a.hash_mask,B=a.prev[a.strstart&a.w_mask]=a.head[a.ins_h],a.head[a.ins_h]=a.strstart),a.prev_length=a.match_length,a.prev_match=a.match_start,a.match_length=T-1,B!==0&&a.prev_length<a.max_lazy_match&&a.strstart-B<=a.w_size-K&&(a.match_length=X(a,B),a.match_length<=5&&(a.strategy===1||a.match_length===T&&4096<a.strstart-a.match_start)&&(a.match_length=T-1)),a.prev_length>=T&&a.match_length<=a.prev_length){for(b=a.strstart+a.lookahead-T,_=s._tr_tally(a,a.strstart-1-a.prev_match,a.prev_length-T),a.lookahead-=a.prev_length-1,a.prev_length-=2;++a.strstart<=b&&(a.ins_h=(a.ins_h<<a.hash_shift^a.window[a.strstart+T-1])&a.hash_mask,B=a.prev[a.strstart&a.w_mask]=a.head[a.ins_h],a.head[a.ins_h]=a.strstart),--a.prev_length!=0;);if(a.match_available=0,a.match_length=T-1,a.strstart++,_&&(I(a,!1),a.strm.avail_out===0))return l}else if(a.match_available){if((_=s._tr_tally(a,0,a.window[a.strstart-1]))&&I(a,!1),a.strstart++,a.lookahead--,a.strm.avail_out===0)return l}else a.match_available=1,a.strstart++,a.lookahead--}return a.match_available&&(_=s._tr_tally(a,0,a.window[a.strstart-1]),a.match_available=0),a.insert=a.strstart<T-1?a.strstart:T-1,L===p?(I(a,!0),a.strm.avail_out===0?V:W):a.last_lit&&(I(a,!1),a.strm.avail_out===0)?l:R}function rt(a,L,B,_,b){this.good_length=a,this.max_lazy=L,this.nice_length=B,this.max_chain=_,this.func=b}function lt(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=v,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new o.Buf16(2*A),this.dyn_dtree=new o.Buf16(2*(2*S+1)),this.bl_tree=new o.Buf16(2*(2*M+1)),q(this.dyn_ltree),q(this.dyn_dtree),q(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new o.Buf16(F+1),this.heap=new o.Buf16(2*C+1),q(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new o.Buf16(2*C+1),q(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function st(a){var L;return a&&a.state?(a.total_in=a.total_out=0,a.data_type=u,(L=a.state).pending=0,L.pending_out=0,L.wrap<0&&(L.wrap=-L.wrap),L.status=L.wrap?x:D,a.adler=L.wrap===2?0:1,L.last_flush=y,s._tr_init(L),d):Q(a,w)}function ft(a){var L=st(a);return L===d&&(function(B){B.window_size=2*B.w_size,q(B.head),B.max_lazy_match=n[B.level].max_lazy,B.good_match=n[B.level].good_length,B.nice_match=n[B.level].nice_length,B.max_chain_length=n[B.level].max_chain,B.strstart=0,B.block_start=0,B.lookahead=0,B.insert=0,B.match_length=B.prev_length=T-1,B.match_available=0,B.ins_h=0})(a.state),L}function ut(a,L,B,_,b,N){if(!a)return w;var O=1;if(L===h&&(L=6),_<0?(O=0,_=-_):15<_&&(O=2,_-=16),b<1||k<b||B!==v||_<8||15<_||L<0||9<L||N<0||m<N)return Q(a,w);_===8&&(_=9);var P=new lt;return(a.state=P).strm=a,P.wrap=O,P.gzhead=null,P.w_bits=_,P.w_size=1<<P.w_bits,P.w_mask=P.w_size-1,P.hash_bits=b+7,P.hash_size=1<<P.hash_bits,P.hash_mask=P.hash_size-1,P.hash_shift=~~((P.hash_bits+T-1)/T),P.window=new o.Buf8(2*P.w_size),P.head=new o.Buf16(P.hash_size),P.prev=new o.Buf16(P.w_size),P.lit_bufsize=1<<b+6,P.pending_buf_size=4*P.lit_bufsize,P.pending_buf=new o.Buf8(P.pending_buf_size),P.d_buf=1*P.lit_bufsize,P.l_buf=3*P.lit_bufsize,P.level=L,P.strategy=N,P.method=B,ft(a)}n=[new rt(0,0,0,0,function(a,L){var B=65535;for(B>a.pending_buf_size-5&&(B=a.pending_buf_size-5);;){if(a.lookahead<=1){if(ot(a),a.lookahead===0&&L===y)return l;if(a.lookahead===0)break}a.strstart+=a.lookahead,a.lookahead=0;var _=a.block_start+B;if((a.strstart===0||a.strstart>=_)&&(a.lookahead=a.strstart-_,a.strstart=_,I(a,!1),a.strm.avail_out===0)||a.strstart-a.block_start>=a.w_size-K&&(I(a,!1),a.strm.avail_out===0))return l}return a.insert=0,L===p?(I(a,!0),a.strm.avail_out===0?V:W):(a.strstart>a.block_start&&(I(a,!1),a.strm.avail_out),l)}),new rt(4,4,8,4,dt),new rt(4,5,16,8,dt),new rt(4,6,32,32,dt),new rt(4,4,16,16,tt),new rt(8,16,32,32,tt),new rt(8,16,128,128,tt),new rt(8,32,128,256,tt),new rt(32,128,258,1024,tt),new rt(32,258,258,4096,tt)],r.deflateInit=function(a,L){return ut(a,L,v,15,8,0)},r.deflateInit2=ut,r.deflateReset=ft,r.deflateResetKeep=st,r.deflateSetHeader=function(a,L){return a&&a.state?a.state.wrap!==2?w:(a.state.gzhead=L,d):w},r.deflate=function(a,L){var B,_,b,N;if(!a||!a.state||5<L||L<0)return a?Q(a,w):w;if(_=a.state,!a.output||!a.input&&a.avail_in!==0||_.status===666&&L!==p)return Q(a,a.avail_out===0?-5:w);if(_.strm=a,B=_.last_flush,_.last_flush=L,_.status===x)if(_.wrap===2)a.adler=0,J(_,31),J(_,139),J(_,8),_.gzhead?(J(_,(_.gzhead.text?1:0)+(_.gzhead.hcrc?2:0)+(_.gzhead.extra?4:0)+(_.gzhead.name?8:0)+(_.gzhead.comment?16:0)),J(_,255&_.gzhead.time),J(_,_.gzhead.time>>8&255),J(_,_.gzhead.time>>16&255),J(_,_.gzhead.time>>24&255),J(_,_.level===9?2:2<=_.strategy||_.level<2?4:0),J(_,255&_.gzhead.os),_.gzhead.extra&&_.gzhead.extra.length&&(J(_,255&_.gzhead.extra.length),J(_,_.gzhead.extra.length>>8&255)),_.gzhead.hcrc&&(a.adler=g(a.adler,_.pending_buf,_.pending,0)),_.gzindex=0,_.status=69):(J(_,0),J(_,0),J(_,0),J(_,0),J(_,0),J(_,_.level===9?2:2<=_.strategy||_.level<2?4:0),J(_,3),_.status=D);else{var O=v+(_.w_bits-8<<4)<<8;O|=(2<=_.strategy||_.level<2?0:_.level<6?1:_.level===6?2:3)<<6,_.strstart!==0&&(O|=32),O+=31-O%31,_.status=D,Y(_,O),_.strstart!==0&&(Y(_,a.adler>>>16),Y(_,65535&a.adler)),a.adler=1}if(_.status===69)if(_.gzhead.extra){for(b=_.pending;_.gzindex<(65535&_.gzhead.extra.length)&&(_.pending!==_.pending_buf_size||(_.gzhead.hcrc&&_.pending>b&&(a.adler=g(a.adler,_.pending_buf,_.pending-b,b)),z(a),b=_.pending,_.pending!==_.pending_buf_size));)J(_,255&_.gzhead.extra[_.gzindex]),_.gzindex++;_.gzhead.hcrc&&_.pending>b&&(a.adler=g(a.adler,_.pending_buf,_.pending-b,b)),_.gzindex===_.gzhead.extra.length&&(_.gzindex=0,_.status=73)}else _.status=73;if(_.status===73)if(_.gzhead.name){b=_.pending;do{if(_.pending===_.pending_buf_size&&(_.gzhead.hcrc&&_.pending>b&&(a.adler=g(a.adler,_.pending_buf,_.pending-b,b)),z(a),b=_.pending,_.pending===_.pending_buf_size)){N=1;break}N=_.gzindex<_.gzhead.name.length?255&_.gzhead.name.charCodeAt(_.gzindex++):0,J(_,N)}while(N!==0);_.gzhead.hcrc&&_.pending>b&&(a.adler=g(a.adler,_.pending_buf,_.pending-b,b)),N===0&&(_.gzindex=0,_.status=91)}else _.status=91;if(_.status===91)if(_.gzhead.comment){b=_.pending;do{if(_.pending===_.pending_buf_size&&(_.gzhead.hcrc&&_.pending>b&&(a.adler=g(a.adler,_.pending_buf,_.pending-b,b)),z(a),b=_.pending,_.pending===_.pending_buf_size)){N=1;break}N=_.gzindex<_.gzhead.comment.length?255&_.gzhead.comment.charCodeAt(_.gzindex++):0,J(_,N)}while(N!==0);_.gzhead.hcrc&&_.pending>b&&(a.adler=g(a.adler,_.pending_buf,_.pending-b,b)),N===0&&(_.status=103)}else _.status=103;if(_.status===103&&(_.gzhead.hcrc?(_.pending+2>_.pending_buf_size&&z(a),_.pending+2<=_.pending_buf_size&&(J(_,255&a.adler),J(_,a.adler>>8&255),a.adler=0,_.status=D)):_.status=D),_.pending!==0){if(z(a),a.avail_out===0)return _.last_flush=-1,d}else if(a.avail_in===0&&U(L)<=U(B)&&L!==p)return Q(a,-5);if(_.status===666&&a.avail_in!==0)return Q(a,-5);if(a.avail_in!==0||_.lookahead!==0||L!==y&&_.status!==666){var P=_.strategy===2?(function(E,j){for(var G;;){if(E.lookahead===0&&(ot(E),E.lookahead===0)){if(j===y)return l;break}if(E.match_length=0,G=s._tr_tally(E,0,E.window[E.strstart]),E.lookahead--,E.strstart++,G&&(I(E,!1),E.strm.avail_out===0))return l}return E.insert=0,j===p?(I(E,!0),E.strm.avail_out===0?V:W):E.last_lit&&(I(E,!1),E.strm.avail_out===0)?l:R})(_,L):_.strategy===3?(function(E,j){for(var G,Z,$,nt,et=E.window;;){if(E.lookahead<=H){if(ot(E),E.lookahead<=H&&j===y)return l;if(E.lookahead===0)break}if(E.match_length=0,E.lookahead>=T&&0<E.strstart&&(Z=et[$=E.strstart-1])===et[++$]&&Z===et[++$]&&Z===et[++$]){nt=E.strstart+H;do;while(Z===et[++$]&&Z===et[++$]&&Z===et[++$]&&Z===et[++$]&&Z===et[++$]&&Z===et[++$]&&Z===et[++$]&&Z===et[++$]&&$<nt);E.match_length=H-(nt-$),E.match_length>E.lookahead&&(E.match_length=E.lookahead)}if(E.match_length>=T?(G=s._tr_tally(E,1,E.match_length-T),E.lookahead-=E.match_length,E.strstart+=E.match_length,E.match_length=0):(G=s._tr_tally(E,0,E.window[E.strstart]),E.lookahead--,E.strstart++),G&&(I(E,!1),E.strm.avail_out===0))return l}return E.insert=0,j===p?(I(E,!0),E.strm.avail_out===0?V:W):E.last_lit&&(I(E,!1),E.strm.avail_out===0)?l:R})(_,L):n[_.level].func(_,L);if(P!==V&&P!==W||(_.status=666),P===l||P===V)return a.avail_out===0&&(_.last_flush=-1),d;if(P===R&&(L===1?s._tr_align(_):L!==5&&(s._tr_stored_block(_,0,0,!1),L===3&&(q(_.head),_.lookahead===0&&(_.strstart=0,_.block_start=0,_.insert=0))),z(a),a.avail_out===0))return _.last_flush=-1,d}return L!==p?d:_.wrap<=0?1:(_.wrap===2?(J(_,255&a.adler),J(_,a.adler>>8&255),J(_,a.adler>>16&255),J(_,a.adler>>24&255),J(_,255&a.total_in),J(_,a.total_in>>8&255),J(_,a.total_in>>16&255),J(_,a.total_in>>24&255)):(Y(_,a.adler>>>16),Y(_,65535&a.adler)),z(a),0<_.wrap&&(_.wrap=-_.wrap),_.pending!==0?d:1)},r.deflateEnd=function(a){var L;return a&&a.state?(L=a.state.status)!==x&&L!==69&&L!==73&&L!==91&&L!==103&&L!==D&&L!==666?Q(a,w):(a.state=null,L===D?Q(a,-3):d):w},r.deflateSetDictionary=function(a,L){var B,_,b,N,O,P,E,j,G=L.length;if(!a||!a.state||(N=(B=a.state).wrap)===2||N===1&&B.status!==x||B.lookahead)return w;for(N===1&&(a.adler=c(a.adler,L,G,0)),B.wrap=0,G>=B.w_size&&(N===0&&(q(B.head),B.strstart=0,B.block_start=0,B.insert=0),j=new o.Buf8(B.w_size),o.arraySet(j,L,G-B.w_size,B.w_size,0),L=j,G=B.w_size),O=a.avail_in,P=a.next_in,E=a.input,a.avail_in=G,a.next_in=0,a.input=L,ot(B);B.lookahead>=T;){for(_=B.strstart,b=B.lookahead-(T-1);B.ins_h=(B.ins_h<<B.hash_shift^B.window[_+T-1])&B.hash_mask,B.prev[_&B.w_mask]=B.head[B.ins_h],B.head[B.ins_h]=_,_++,--b;);B.strstart=_,B.lookahead=T-1,ot(B)}return B.strstart+=B.lookahead,B.block_start=B.strstart,B.insert=B.lookahead,B.lookahead=0,B.match_length=B.prev_length=T-1,B.match_available=0,a.next_in=P,a.input=E,a.avail_in=O,B.wrap=N,d},r.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./messages":51,"./trees":52}],47:[function(e,i,r){i.exports=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}},{}],48:[function(e,i,r){i.exports=function(n,o){var s,c,g,f,y,p,d,w,h,m,u,v,k,C,S,M,A,F,T,H,K,x,D,l,R;s=n.state,c=n.next_in,l=n.input,g=c+(n.avail_in-5),f=n.next_out,R=n.output,y=f-(o-n.avail_out),p=f+(n.avail_out-257),d=s.dmax,w=s.wsize,h=s.whave,m=s.wnext,u=s.window,v=s.hold,k=s.bits,C=s.lencode,S=s.distcode,M=(1<<s.lenbits)-1,A=(1<<s.distbits)-1;t:do{k<15&&(v+=l[c++]<<k,k+=8,v+=l[c++]<<k,k+=8),F=C[v&M];e:for(;;){if(v>>>=T=F>>>24,k-=T,(T=F>>>16&255)===0)R[f++]=65535&F;else{if(!(16&T)){if((64&T)==0){F=C[(65535&F)+(v&(1<<T)-1)];continue e}if(32&T){s.mode=12;break t}n.msg="invalid literal/length code",s.mode=30;break t}H=65535&F,(T&=15)&&(k<T&&(v+=l[c++]<<k,k+=8),H+=v&(1<<T)-1,v>>>=T,k-=T),k<15&&(v+=l[c++]<<k,k+=8,v+=l[c++]<<k,k+=8),F=S[v&A];i:for(;;){if(v>>>=T=F>>>24,k-=T,!(16&(T=F>>>16&255))){if((64&T)==0){F=S[(65535&F)+(v&(1<<T)-1)];continue i}n.msg="invalid distance code",s.mode=30;break t}if(K=65535&F,k<(T&=15)&&(v+=l[c++]<<k,(k+=8)<T&&(v+=l[c++]<<k,k+=8)),d<(K+=v&(1<<T)-1)){n.msg="invalid distance too far back",s.mode=30;break t}if(v>>>=T,k-=T,(T=f-y)<K){if(h<(T=K-T)&&s.sane){n.msg="invalid distance too far back",s.mode=30;break t}if(D=u,(x=0)===m){if(x+=w-T,T<H){for(H-=T;R[f++]=u[x++],--T;);x=f-K,D=R}}else if(m<T){if(x+=w+m-T,(T-=m)<H){for(H-=T;R[f++]=u[x++],--T;);if(x=0,m<H){for(H-=T=m;R[f++]=u[x++],--T;);x=f-K,D=R}}}else if(x+=m-T,T<H){for(H-=T;R[f++]=u[x++],--T;);x=f-K,D=R}for(;2<H;)R[f++]=D[x++],R[f++]=D[x++],R[f++]=D[x++],H-=3;H&&(R[f++]=D[x++],1<H&&(R[f++]=D[x++]))}else{for(x=f-K;R[f++]=R[x++],R[f++]=R[x++],R[f++]=R[x++],2<(H-=3););H&&(R[f++]=R[x++],1<H&&(R[f++]=R[x++]))}break}}break}}while(c<g&&f<p);c-=H=k>>3,v&=(1<<(k-=H<<3))-1,n.next_in=c,n.next_out=f,n.avail_in=c<g?g-c+5:5-(c-g),n.avail_out=f<p?p-f+257:257-(f-p),s.hold=v,s.bits=k}},{}],49:[function(e,i,r){var n=e("../utils/common"),o=e("./adler32"),s=e("./crc32"),c=e("./inffast"),g=e("./inftrees"),f=1,y=2,p=0,d=-2,w=1,h=852,m=592;function u(x){return(x>>>24&255)+(x>>>8&65280)+((65280&x)<<8)+((255&x)<<24)}function v(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new n.Buf16(320),this.work=new n.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function k(x){var D;return x&&x.state?(D=x.state,x.total_in=x.total_out=D.total=0,x.msg="",D.wrap&&(x.adler=1&D.wrap),D.mode=w,D.last=0,D.havedict=0,D.dmax=32768,D.head=null,D.hold=0,D.bits=0,D.lencode=D.lendyn=new n.Buf32(h),D.distcode=D.distdyn=new n.Buf32(m),D.sane=1,D.back=-1,p):d}function C(x){var D;return x&&x.state?((D=x.state).wsize=0,D.whave=0,D.wnext=0,k(x)):d}function S(x,D){var l,R;return x&&x.state?(R=x.state,D<0?(l=0,D=-D):(l=1+(D>>4),D<48&&(D&=15)),D&&(D<8||15<D)?d:(R.window!==null&&R.wbits!==D&&(R.window=null),R.wrap=l,R.wbits=D,C(x))):d}function M(x,D){var l,R;return x?(R=new v,(x.state=R).window=null,(l=S(x,D))!==p&&(x.state=null),l):d}var A,F,T=!0;function H(x){if(T){var D;for(A=new n.Buf32(512),F=new n.Buf32(32),D=0;D<144;)x.lens[D++]=8;for(;D<256;)x.lens[D++]=9;for(;D<280;)x.lens[D++]=7;for(;D<288;)x.lens[D++]=8;for(g(f,x.lens,0,288,A,0,x.work,{bits:9}),D=0;D<32;)x.lens[D++]=5;g(y,x.lens,0,32,F,0,x.work,{bits:5}),T=!1}x.lencode=A,x.lenbits=9,x.distcode=F,x.distbits=5}function K(x,D,l,R){var V,W=x.state;return W.window===null&&(W.wsize=1<<W.wbits,W.wnext=0,W.whave=0,W.window=new n.Buf8(W.wsize)),R>=W.wsize?(n.arraySet(W.window,D,l-W.wsize,W.wsize,0),W.wnext=0,W.whave=W.wsize):(R<(V=W.wsize-W.wnext)&&(V=R),n.arraySet(W.window,D,l-R,V,W.wnext),(R-=V)?(n.arraySet(W.window,D,l-R,R,0),W.wnext=R,W.whave=W.wsize):(W.wnext+=V,W.wnext===W.wsize&&(W.wnext=0),W.whave<W.wsize&&(W.whave+=V))),0}r.inflateReset=C,r.inflateReset2=S,r.inflateResetKeep=k,r.inflateInit=function(x){return M(x,15)},r.inflateInit2=M,r.inflate=function(x,D){var l,R,V,W,Q,U,q,z,I,J,Y,X,ot,dt,tt,rt,lt,st,ft,ut,a,L,B,_,b=0,N=new n.Buf8(4),O=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!x||!x.state||!x.output||!x.input&&x.avail_in!==0)return d;(l=x.state).mode===12&&(l.mode=13),Q=x.next_out,V=x.output,q=x.avail_out,W=x.next_in,R=x.input,U=x.avail_in,z=l.hold,I=l.bits,J=U,Y=q,L=p;t:for(;;)switch(l.mode){case w:if(l.wrap===0){l.mode=13;break}for(;I<16;){if(U===0)break t;U--,z+=R[W++]<<I,I+=8}if(2&l.wrap&&z===35615){N[l.check=0]=255&z,N[1]=z>>>8&255,l.check=s(l.check,N,2,0),I=z=0,l.mode=2;break}if(l.flags=0,l.head&&(l.head.done=!1),!(1&l.wrap)||(((255&z)<<8)+(z>>8))%31){x.msg="incorrect header check",l.mode=30;break}if((15&z)!=8){x.msg="unknown compression method",l.mode=30;break}if(I-=4,a=8+(15&(z>>>=4)),l.wbits===0)l.wbits=a;else if(a>l.wbits){x.msg="invalid window size",l.mode=30;break}l.dmax=1<<a,x.adler=l.check=1,l.mode=512&z?10:12,I=z=0;break;case 2:for(;I<16;){if(U===0)break t;U--,z+=R[W++]<<I,I+=8}if(l.flags=z,(255&l.flags)!=8){x.msg="unknown compression method",l.mode=30;break}if(57344&l.flags){x.msg="unknown header flags set",l.mode=30;break}l.head&&(l.head.text=z>>8&1),512&l.flags&&(N[0]=255&z,N[1]=z>>>8&255,l.check=s(l.check,N,2,0)),I=z=0,l.mode=3;case 3:for(;I<32;){if(U===0)break t;U--,z+=R[W++]<<I,I+=8}l.head&&(l.head.time=z),512&l.flags&&(N[0]=255&z,N[1]=z>>>8&255,N[2]=z>>>16&255,N[3]=z>>>24&255,l.check=s(l.check,N,4,0)),I=z=0,l.mode=4;case 4:for(;I<16;){if(U===0)break t;U--,z+=R[W++]<<I,I+=8}l.head&&(l.head.xflags=255&z,l.head.os=z>>8),512&l.flags&&(N[0]=255&z,N[1]=z>>>8&255,l.check=s(l.check,N,2,0)),I=z=0,l.mode=5;case 5:if(1024&l.flags){for(;I<16;){if(U===0)break t;U--,z+=R[W++]<<I,I+=8}l.length=z,l.head&&(l.head.extra_len=z),512&l.flags&&(N[0]=255&z,N[1]=z>>>8&255,l.check=s(l.check,N,2,0)),I=z=0}else l.head&&(l.head.extra=null);l.mode=6;case 6:if(1024&l.flags&&(U<(X=l.length)&&(X=U),X&&(l.head&&(a=l.head.extra_len-l.length,l.head.extra||(l.head.extra=new Array(l.head.extra_len)),n.arraySet(l.head.extra,R,W,X,a)),512&l.flags&&(l.check=s(l.check,R,X,W)),U-=X,W+=X,l.length-=X),l.length))break t;l.length=0,l.mode=7;case 7:if(2048&l.flags){if(U===0)break t;for(X=0;a=R[W+X++],l.head&&a&&l.length<65536&&(l.head.name+=String.fromCharCode(a)),a&&X<U;);if(512&l.flags&&(l.check=s(l.check,R,X,W)),U-=X,W+=X,a)break t}else l.head&&(l.head.name=null);l.length=0,l.mode=8;case 8:if(4096&l.flags){if(U===0)break t;for(X=0;a=R[W+X++],l.head&&a&&l.length<65536&&(l.head.comment+=String.fromCharCode(a)),a&&X<U;);if(512&l.flags&&(l.check=s(l.check,R,X,W)),U-=X,W+=X,a)break t}else l.head&&(l.head.comment=null);l.mode=9;case 9:if(512&l.flags){for(;I<16;){if(U===0)break t;U--,z+=R[W++]<<I,I+=8}if(z!==(65535&l.check)){x.msg="header crc mismatch",l.mode=30;break}I=z=0}l.head&&(l.head.hcrc=l.flags>>9&1,l.head.done=!0),x.adler=l.check=0,l.mode=12;break;case 10:for(;I<32;){if(U===0)break t;U--,z+=R[W++]<<I,I+=8}x.adler=l.check=u(z),I=z=0,l.mode=11;case 11:if(l.havedict===0)return x.next_out=Q,x.avail_out=q,x.next_in=W,x.avail_in=U,l.hold=z,l.bits=I,2;x.adler=l.check=1,l.mode=12;case 12:if(D===5||D===6)break t;case 13:if(l.last){z>>>=7&I,I-=7&I,l.mode=27;break}for(;I<3;){if(U===0)break t;U--,z+=R[W++]<<I,I+=8}switch(l.last=1&z,I-=1,3&(z>>>=1)){case 0:l.mode=14;break;case 1:if(H(l),l.mode=20,D!==6)break;z>>>=2,I-=2;break t;case 2:l.mode=17;break;case 3:x.msg="invalid block type",l.mode=30}z>>>=2,I-=2;break;case 14:for(z>>>=7&I,I-=7&I;I<32;){if(U===0)break t;U--,z+=R[W++]<<I,I+=8}if((65535&z)!=(z>>>16^65535)){x.msg="invalid stored block lengths",l.mode=30;break}if(l.length=65535&z,I=z=0,l.mode=15,D===6)break t;case 15:l.mode=16;case 16:if(X=l.length){if(U<X&&(X=U),q<X&&(X=q),X===0)break t;n.arraySet(V,R,W,X,Q),U-=X,W+=X,q-=X,Q+=X,l.length-=X;break}l.mode=12;break;case 17:for(;I<14;){if(U===0)break t;U--,z+=R[W++]<<I,I+=8}if(l.nlen=257+(31&z),z>>>=5,I-=5,l.ndist=1+(31&z),z>>>=5,I-=5,l.ncode=4+(15&z),z>>>=4,I-=4,286<l.nlen||30<l.ndist){x.msg="too many length or distance symbols",l.mode=30;break}l.have=0,l.mode=18;case 18:for(;l.have<l.ncode;){for(;I<3;){if(U===0)break t;U--,z+=R[W++]<<I,I+=8}l.lens[O[l.have++]]=7&z,z>>>=3,I-=3}for(;l.have<19;)l.lens[O[l.have++]]=0;if(l.lencode=l.lendyn,l.lenbits=7,B={bits:l.lenbits},L=g(0,l.lens,0,19,l.lencode,0,l.work,B),l.lenbits=B.bits,L){x.msg="invalid code lengths set",l.mode=30;break}l.have=0,l.mode=19;case 19:for(;l.have<l.nlen+l.ndist;){for(;rt=(b=l.lencode[z&(1<<l.lenbits)-1])>>>16&255,lt=65535&b,!((tt=b>>>24)<=I);){if(U===0)break t;U--,z+=R[W++]<<I,I+=8}if(lt<16)z>>>=tt,I-=tt,l.lens[l.have++]=lt;else{if(lt===16){for(_=tt+2;I<_;){if(U===0)break t;U--,z+=R[W++]<<I,I+=8}if(z>>>=tt,I-=tt,l.have===0){x.msg="invalid bit length repeat",l.mode=30;break}a=l.lens[l.have-1],X=3+(3&z),z>>>=2,I-=2}else if(lt===17){for(_=tt+3;I<_;){if(U===0)break t;U--,z+=R[W++]<<I,I+=8}I-=tt,a=0,X=3+(7&(z>>>=tt)),z>>>=3,I-=3}else{for(_=tt+7;I<_;){if(U===0)break t;U--,z+=R[W++]<<I,I+=8}I-=tt,a=0,X=11+(127&(z>>>=tt)),z>>>=7,I-=7}if(l.have+X>l.nlen+l.ndist){x.msg="invalid bit length repeat",l.mode=30;break}for(;X--;)l.lens[l.have++]=a}}if(l.mode===30)break;if(l.lens[256]===0){x.msg="invalid code -- missing end-of-block",l.mode=30;break}if(l.lenbits=9,B={bits:l.lenbits},L=g(f,l.lens,0,l.nlen,l.lencode,0,l.work,B),l.lenbits=B.bits,L){x.msg="invalid literal/lengths set",l.mode=30;break}if(l.distbits=6,l.distcode=l.distdyn,B={bits:l.distbits},L=g(y,l.lens,l.nlen,l.ndist,l.distcode,0,l.work,B),l.distbits=B.bits,L){x.msg="invalid distances set",l.mode=30;break}if(l.mode=20,D===6)break t;case 20:l.mode=21;case 21:if(6<=U&&258<=q){x.next_out=Q,x.avail_out=q,x.next_in=W,x.avail_in=U,l.hold=z,l.bits=I,c(x,Y),Q=x.next_out,V=x.output,q=x.avail_out,W=x.next_in,R=x.input,U=x.avail_in,z=l.hold,I=l.bits,l.mode===12&&(l.back=-1);break}for(l.back=0;rt=(b=l.lencode[z&(1<<l.lenbits)-1])>>>16&255,lt=65535&b,!((tt=b>>>24)<=I);){if(U===0)break t;U--,z+=R[W++]<<I,I+=8}if(rt&&(240&rt)==0){for(st=tt,ft=rt,ut=lt;rt=(b=l.lencode[ut+((z&(1<<st+ft)-1)>>st)])>>>16&255,lt=65535&b,!(st+(tt=b>>>24)<=I);){if(U===0)break t;U--,z+=R[W++]<<I,I+=8}z>>>=st,I-=st,l.back+=st}if(z>>>=tt,I-=tt,l.back+=tt,l.length=lt,rt===0){l.mode=26;break}if(32&rt){l.back=-1,l.mode=12;break}if(64&rt){x.msg="invalid literal/length code",l.mode=30;break}l.extra=15&rt,l.mode=22;case 22:if(l.extra){for(_=l.extra;I<_;){if(U===0)break t;U--,z+=R[W++]<<I,I+=8}l.length+=z&(1<<l.extra)-1,z>>>=l.extra,I-=l.extra,l.back+=l.extra}l.was=l.length,l.mode=23;case 23:for(;rt=(b=l.distcode[z&(1<<l.distbits)-1])>>>16&255,lt=65535&b,!((tt=b>>>24)<=I);){if(U===0)break t;U--,z+=R[W++]<<I,I+=8}if((240&rt)==0){for(st=tt,ft=rt,ut=lt;rt=(b=l.distcode[ut+((z&(1<<st+ft)-1)>>st)])>>>16&255,lt=65535&b,!(st+(tt=b>>>24)<=I);){if(U===0)break t;U--,z+=R[W++]<<I,I+=8}z>>>=st,I-=st,l.back+=st}if(z>>>=tt,I-=tt,l.back+=tt,64&rt){x.msg="invalid distance code",l.mode=30;break}l.offset=lt,l.extra=15&rt,l.mode=24;case 24:if(l.extra){for(_=l.extra;I<_;){if(U===0)break t;U--,z+=R[W++]<<I,I+=8}l.offset+=z&(1<<l.extra)-1,z>>>=l.extra,I-=l.extra,l.back+=l.extra}if(l.offset>l.dmax){x.msg="invalid distance too far back",l.mode=30;break}l.mode=25;case 25:if(q===0)break t;if(X=Y-q,l.offset>X){if((X=l.offset-X)>l.whave&&l.sane){x.msg="invalid distance too far back",l.mode=30;break}ot=X>l.wnext?(X-=l.wnext,l.wsize-X):l.wnext-X,X>l.length&&(X=l.length),dt=l.window}else dt=V,ot=Q-l.offset,X=l.length;for(q<X&&(X=q),q-=X,l.length-=X;V[Q++]=dt[ot++],--X;);l.length===0&&(l.mode=21);break;case 26:if(q===0)break t;V[Q++]=l.length,q--,l.mode=21;break;case 27:if(l.wrap){for(;I<32;){if(U===0)break t;U--,z|=R[W++]<<I,I+=8}if(Y-=q,x.total_out+=Y,l.total+=Y,Y&&(x.adler=l.check=l.flags?s(l.check,V,Y,Q-Y):o(l.check,V,Y,Q-Y)),Y=q,(l.flags?z:u(z))!==l.check){x.msg="incorrect data check",l.mode=30;break}I=z=0}l.mode=28;case 28:if(l.wrap&&l.flags){for(;I<32;){if(U===0)break t;U--,z+=R[W++]<<I,I+=8}if(z!==(4294967295&l.total)){x.msg="incorrect length check",l.mode=30;break}I=z=0}l.mode=29;case 29:L=1;break t;case 30:L=-3;break t;case 31:return-4;default:return d}return x.next_out=Q,x.avail_out=q,x.next_in=W,x.avail_in=U,l.hold=z,l.bits=I,(l.wsize||Y!==x.avail_out&&l.mode<30&&(l.mode<27||D!==4))&&K(x,x.output,x.next_out,Y-x.avail_out)?(l.mode=31,-4):(J-=x.avail_in,Y-=x.avail_out,x.total_in+=J,x.total_out+=Y,l.total+=Y,l.wrap&&Y&&(x.adler=l.check=l.flags?s(l.check,V,Y,x.next_out-Y):o(l.check,V,Y,x.next_out-Y)),x.data_type=l.bits+(l.last?64:0)+(l.mode===12?128:0)+(l.mode===20||l.mode===15?256:0),(J==0&&Y===0||D===4)&&L===p&&(L=-5),L)},r.inflateEnd=function(x){if(!x||!x.state)return d;var D=x.state;return D.window&&(D.window=null),x.state=null,p},r.inflateGetHeader=function(x,D){var l;return x&&x.state?(2&(l=x.state).wrap)==0?d:((l.head=D).done=!1,p):d},r.inflateSetDictionary=function(x,D){var l,R=D.length;return x&&x.state?(l=x.state).wrap!==0&&l.mode!==11?d:l.mode===11&&o(1,D,R,0)!==l.check?-3:K(x,D,R,R)?(l.mode=31,-4):(l.havedict=1,p):d},r.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./inffast":48,"./inftrees":50}],50:[function(e,i,r){var n=e("../utils/common"),o=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],s=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],c=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],g=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];i.exports=function(f,y,p,d,w,h,m,u){var v,k,C,S,M,A,F,T,H,K=u.bits,x=0,D=0,l=0,R=0,V=0,W=0,Q=0,U=0,q=0,z=0,I=null,J=0,Y=new n.Buf16(16),X=new n.Buf16(16),ot=null,dt=0;for(x=0;x<=15;x++)Y[x]=0;for(D=0;D<d;D++)Y[y[p+D]]++;for(V=K,R=15;1<=R&&Y[R]===0;R--);if(R<V&&(V=R),R===0)return w[h++]=20971520,w[h++]=20971520,u.bits=1,0;for(l=1;l<R&&Y[l]===0;l++);for(V<l&&(V=l),x=U=1;x<=15;x++)if(U<<=1,(U-=Y[x])<0)return-1;if(0<U&&(f===0||R!==1))return-1;for(X[1]=0,x=1;x<15;x++)X[x+1]=X[x]+Y[x];for(D=0;D<d;D++)y[p+D]!==0&&(m[X[y[p+D]]++]=D);if(A=f===0?(I=ot=m,19):f===1?(I=o,J-=257,ot=s,dt-=257,256):(I=c,ot=g,-1),x=l,M=h,Q=D=z=0,C=-1,S=(q=1<<(W=V))-1,f===1&&852<q||f===2&&592<q)return 1;for(;;){for(F=x-Q,H=m[D]<A?(T=0,m[D]):m[D]>A?(T=ot[dt+m[D]],I[J+m[D]]):(T=96,0),v=1<<x-Q,l=k=1<<W;w[M+(z>>Q)+(k-=v)]=F<<24|T<<16|H|0,k!==0;);for(v=1<<x-1;z&v;)v>>=1;if(v!==0?(z&=v-1,z+=v):z=0,D++,--Y[x]==0){if(x===R)break;x=y[p+m[D]]}if(V<x&&(z&S)!==C){for(Q===0&&(Q=V),M+=l,U=1<<(W=x-Q);W+Q<R&&!((U-=Y[W+Q])<=0);)W++,U<<=1;if(q+=1<<W,f===1&&852<q||f===2&&592<q)return 1;w[C=z&S]=V<<24|W<<16|M-h|0}}return z!==0&&(w[M+z]=x-Q<<24|64<<16|0),u.bits=V,0}},{"../utils/common":41}],51:[function(e,i,r){i.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},{}],52:[function(e,i,r){var n=e("../utils/common"),o=0,s=1;function c(b){for(var N=b.length;0<=--N;)b[N]=0}var g=0,f=29,y=256,p=y+1+f,d=30,w=19,h=2*p+1,m=15,u=16,v=7,k=256,C=16,S=17,M=18,A=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],F=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],T=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],H=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],K=new Array(2*(p+2));c(K);var x=new Array(2*d);c(x);var D=new Array(512);c(D);var l=new Array(256);c(l);var R=new Array(f);c(R);var V,W,Q,U=new Array(d);function q(b,N,O,P,E){this.static_tree=b,this.extra_bits=N,this.extra_base=O,this.elems=P,this.max_length=E,this.has_stree=b&&b.length}function z(b,N){this.dyn_tree=b,this.max_code=0,this.stat_desc=N}function I(b){return b<256?D[b]:D[256+(b>>>7)]}function J(b,N){b.pending_buf[b.pending++]=255&N,b.pending_buf[b.pending++]=N>>>8&255}function Y(b,N,O){b.bi_valid>u-O?(b.bi_buf|=N<<b.bi_valid&65535,J(b,b.bi_buf),b.bi_buf=N>>u-b.bi_valid,b.bi_valid+=O-u):(b.bi_buf|=N<<b.bi_valid&65535,b.bi_valid+=O)}function X(b,N,O){Y(b,O[2*N],O[2*N+1])}function ot(b,N){for(var O=0;O|=1&b,b>>>=1,O<<=1,0<--N;);return O>>>1}function dt(b,N,O){var P,E,j=new Array(m+1),G=0;for(P=1;P<=m;P++)j[P]=G=G+O[P-1]<<1;for(E=0;E<=N;E++){var Z=b[2*E+1];Z!==0&&(b[2*E]=ot(j[Z]++,Z))}}function tt(b){var N;for(N=0;N<p;N++)b.dyn_ltree[2*N]=0;for(N=0;N<d;N++)b.dyn_dtree[2*N]=0;for(N=0;N<w;N++)b.bl_tree[2*N]=0;b.dyn_ltree[2*k]=1,b.opt_len=b.static_len=0,b.last_lit=b.matches=0}function rt(b){8<b.bi_valid?J(b,b.bi_buf):0<b.bi_valid&&(b.pending_buf[b.pending++]=b.bi_buf),b.bi_buf=0,b.bi_valid=0}function lt(b,N,O,P){var E=2*N,j=2*O;return b[E]<b[j]||b[E]===b[j]&&P[N]<=P[O]}function st(b,N,O){for(var P=b.heap[O],E=O<<1;E<=b.heap_len&&(E<b.heap_len&<(N,b.heap[E+1],b.heap[E],b.depth)&&E++,!lt(N,P,b.heap[E],b.depth));)b.heap[O]=b.heap[E],O=E,E<<=1;b.heap[O]=P}function ft(b,N,O){var P,E,j,G,Z=0;if(b.last_lit!==0)for(;P=b.pending_buf[b.d_buf+2*Z]<<8|b.pending_buf[b.d_buf+2*Z+1],E=b.pending_buf[b.l_buf+Z],Z++,P===0?X(b,E,N):(X(b,(j=l[E])+y+1,N),(G=A[j])!==0&&Y(b,E-=R[j],G),X(b,j=I(--P),O),(G=F[j])!==0&&Y(b,P-=U[j],G)),Z<b.last_lit;);X(b,k,N)}function ut(b,N){var O,P,E,j=N.dyn_tree,G=N.stat_desc.static_tree,Z=N.stat_desc.has_stree,$=N.stat_desc.elems,nt=-1;for(b.heap_len=0,b.heap_max=h,O=0;O<$;O++)j[2*O]!==0?(b.heap[++b.heap_len]=nt=O,b.depth[O]=0):j[2*O+1]=0;for(;b.heap_len<2;)j[2*(E=b.heap[++b.heap_len]=nt<2?++nt:0)]=1,b.depth[E]=0,b.opt_len--,Z&&(b.static_len-=G[2*E+1]);for(N.max_code=nt,O=b.heap_len>>1;1<=O;O--)st(b,j,O);for(E=$;O=b.heap[1],b.heap[1]=b.heap[b.heap_len--],st(b,j,1),P=b.heap[1],b.heap[--b.heap_max]=O,b.heap[--b.heap_max]=P,j[2*E]=j[2*O]+j[2*P],b.depth[E]=(b.depth[O]>=b.depth[P]?b.depth[O]:b.depth[P])+1,j[2*O+1]=j[2*P+1]=E,b.heap[1]=E++,st(b,j,1),2<=b.heap_len;);b.heap[--b.heap_max]=b.heap[1],(function(et,ht){var wt,pt,_t,at,Ct,Tt,gt=ht.dyn_tree,Ot=ht.max_code,se=ht.stat_desc.static_tree,ae=ht.stat_desc.has_stree,le=ht.stat_desc.extra_bits,Pt=ht.stat_desc.extra_base,xt=ht.stat_desc.max_length,Nt=0;for(at=0;at<=m;at++)et.bl_count[at]=0;for(gt[2*et.heap[et.heap_max]+1]=0,wt=et.heap_max+1;wt<h;wt++)xt<(at=gt[2*gt[2*(pt=et.heap[wt])+1]+1]+1)&&(at=xt,Nt++),gt[2*pt+1]=at,Ot<pt||(et.bl_count[at]++,Ct=0,Pt<=pt&&(Ct=le[pt-Pt]),Tt=gt[2*pt],et.opt_len+=Tt*(at+Ct),ae&&(et.static_len+=Tt*(se[2*pt+1]+Ct)));if(Nt!==0){do{for(at=xt-1;et.bl_count[at]===0;)at--;et.bl_count[at]--,et.bl_count[at+1]+=2,et.bl_count[xt]--,Nt-=2}while(0<Nt);for(at=xt;at!==0;at--)for(pt=et.bl_count[at];pt!==0;)Ot<(_t=et.heap[--wt])||(gt[2*_t+1]!==at&&(et.opt_len+=(at-gt[2*_t+1])*gt[2*_t],gt[2*_t+1]=at),pt--)}})(b,N),dt(j,nt,b.bl_count)}function a(b,N,O){var P,E,j=-1,G=N[1],Z=0,$=7,nt=4;for(G===0&&($=138,nt=3),N[2*(O+1)+1]=65535,P=0;P<=O;P++)E=G,G=N[2*(P+1)+1],++Z<$&&E===G||(Z<nt?b.bl_tree[2*E]+=Z:E!==0?(E!==j&&b.bl_tree[2*E]++,b.bl_tree[2*C]++):Z<=10?b.bl_tree[2*S]++:b.bl_tree[2*M]++,j=E,nt=(Z=0)===G?($=138,3):E===G?($=6,3):($=7,4))}function L(b,N,O){var P,E,j=-1,G=N[1],Z=0,$=7,nt=4;for(G===0&&($=138,nt=3),P=0;P<=O;P++)if(E=G,G=N[2*(P+1)+1],!(++Z<$&&E===G)){if(Z<nt)for(;X(b,E,b.bl_tree),--Z!=0;);else E!==0?(E!==j&&(X(b,E,b.bl_tree),Z--),X(b,C,b.bl_tree),Y(b,Z-3,2)):Z<=10?(X(b,S,b.bl_tree),Y(b,Z-3,3)):(X(b,M,b.bl_tree),Y(b,Z-11,7));j=E,nt=(Z=0)===G?($=138,3):E===G?($=6,3):($=7,4)}}c(U);var B=!1;function _(b,N,O,P){Y(b,(g<<1)+(P?1:0),3),(function(E,j,G,Z){rt(E),J(E,G),J(E,~G),n.arraySet(E.pending_buf,E.window,j,G,E.pending),E.pending+=G})(b,N,O)}r._tr_init=function(b){B||((function(){var N,O,P,E,j,G=new Array(m+1);for(E=P=0;E<f-1;E++)for(R[E]=P,N=0;N<1<<A[E];N++)l[P++]=E;for(l[P-1]=E,E=j=0;E<16;E++)for(U[E]=j,N=0;N<1<<F[E];N++)D[j++]=E;for(j>>=7;E<d;E++)for(U[E]=j<<7,N=0;N<1<<F[E]-7;N++)D[256+j++]=E;for(O=0;O<=m;O++)G[O]=0;for(N=0;N<=143;)K[2*N+1]=8,N++,G[8]++;for(;N<=255;)K[2*N+1]=9,N++,G[9]++;for(;N<=279;)K[2*N+1]=7,N++,G[7]++;for(;N<=287;)K[2*N+1]=8,N++,G[8]++;for(dt(K,p+1,G),N=0;N<d;N++)x[2*N+1]=5,x[2*N]=ot(N,5);V=new q(K,A,y+1,p,m),W=new q(x,F,0,d,m),Q=new q(new Array(0),T,0,w,v)})(),B=!0),b.l_desc=new z(b.dyn_ltree,V),b.d_desc=new z(b.dyn_dtree,W),b.bl_desc=new z(b.bl_tree,Q),b.bi_buf=0,b.bi_valid=0,tt(b)},r._tr_stored_block=_,r._tr_flush_block=function(b,N,O,P){var E,j,G=0;0<b.level?(b.strm.data_type===2&&(b.strm.data_type=(function(Z){var $,nt=4093624447;for($=0;$<=31;$++,nt>>>=1)if(1&nt&&Z.dyn_ltree[2*$]!==0)return o;if(Z.dyn_ltree[18]!==0||Z.dyn_ltree[20]!==0||Z.dyn_ltree[26]!==0)return s;for($=32;$<y;$++)if(Z.dyn_ltree[2*$]!==0)return s;return o})(b)),ut(b,b.l_desc),ut(b,b.d_desc),G=(function(Z){var $;for(a(Z,Z.dyn_ltree,Z.l_desc.max_code),a(Z,Z.dyn_dtree,Z.d_desc.max_code),ut(Z,Z.bl_desc),$=w-1;3<=$&&Z.bl_tree[2*H[$]+1]===0;$--);return Z.opt_len+=3*($+1)+5+5+4,$})(b),E=b.opt_len+3+7>>>3,(j=b.static_len+3+7>>>3)<=E&&(E=j)):E=j=O+5,O+4<=E&&N!==-1?_(b,N,O,P):b.strategy===4||j===E?(Y(b,2+(P?1:0),3),ft(b,K,x)):(Y(b,4+(P?1:0),3),(function(Z,$,nt,et){var ht;for(Y(Z,$-257,5),Y(Z,nt-1,5),Y(Z,et-4,4),ht=0;ht<et;ht++)Y(Z,Z.bl_tree[2*H[ht]+1],3);L(Z,Z.dyn_ltree,$-1),L(Z,Z.dyn_dtree,nt-1)})(b,b.l_desc.max_code+1,b.d_desc.max_code+1,G+1),ft(b,b.dyn_ltree,b.dyn_dtree)),tt(b),P&&rt(b)},r._tr_tally=function(b,N,O){return b.pending_buf[b.d_buf+2*b.last_lit]=N>>>8&255,b.pending_buf[b.d_buf+2*b.last_lit+1]=255&N,b.pending_buf[b.l_buf+b.last_lit]=255&O,b.last_lit++,N===0?b.dyn_ltree[2*O]++:(b.matches++,N--,b.dyn_ltree[2*(l[O]+y+1)]++,b.dyn_dtree[2*I(N)]++),b.last_lit===b.lit_bufsize-1},r._tr_align=function(b){Y(b,2,3),X(b,k,K),(function(N){N.bi_valid===16?(J(N,N.bi_buf),N.bi_buf=0,N.bi_valid=0):8<=N.bi_valid&&(N.pending_buf[N.pending++]=255&N.bi_buf,N.bi_buf>>=8,N.bi_valid-=8)})(b)}},{"../utils/common":41}],53:[function(e,i,r){i.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(e,i,r){(function(n){(function(o,s){if(!o.setImmediate){var c,g,f,y,p=1,d={},w=!1,h=o.document,m=Object.getPrototypeOf&&Object.getPrototypeOf(o);m=m&&m.setTimeout?m:o,c={}.toString.call(o.process)==="[object process]"?function(C){process.nextTick(function(){v(C)})}:(function(){if(o.postMessage&&!o.importScripts){var C=!0,S=o.onmessage;return o.onmessage=function(){C=!1},o.postMessage("","*"),o.onmessage=S,C}})()?(y="setImmediate$"+Math.random()+"$",o.addEventListener?o.addEventListener("message",k,!1):o.attachEvent("onmessage",k),function(C){o.postMessage(y+C,"*")}):o.MessageChannel?((f=new MessageChannel).port1.onmessage=function(C){v(C.data)},function(C){f.port2.postMessage(C)}):h&&"onreadystatechange"in h.createElement("script")?(g=h.documentElement,function(C){var S=h.createElement("script");S.onreadystatechange=function(){v(C),S.onreadystatechange=null,g.removeChild(S),S=null},g.appendChild(S)}):function(C){setTimeout(v,0,C)},m.setImmediate=function(C){typeof C!="function"&&(C=new Function(""+C));for(var S=new Array(arguments.length-1),M=0;M<S.length;M++)S[M]=arguments[M+1];var A={callback:C,args:S};return d[p]=A,c(p),p++},m.clearImmediate=u}function u(C){delete d[C]}function v(C){if(w)setTimeout(v,0,C);else{var S=d[C];if(S){w=!0;try{(function(M){var A=M.callback,F=M.args;switch(F.length){case 0:A();break;case 1:A(F[0]);break;case 2:A(F[0],F[1]);break;case 3:A(F[0],F[1],F[2]);break;default:A.apply(s,F)}})(S)}finally{u(C),w=!1}}}}function k(C){C.source===o&&typeof C.data=="string"&&C.data.indexOf(y)===0&&v(+C.data.slice(y.length))}})(typeof self>"u"?n===void 0?this:n:self)}).call(this,typeof kt<"u"?kt:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})(zt)),zt.exports}var te=Qt();const ee=qt(te);class Rt{generate(){return typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():Date.now().toString(36)+Math.random().toString(36).substr(2)}}class Bt{idGenerator;constructor(){this.idGenerator=new Rt}async extractMindMapData(t){const e=new ee;try{const r=(await e.loadAsync(t)).file("content.json");if(!r)throw new Error("Invalid XMind file: content.json not found");const n=await r.async("text"),o=JSON.parse(n);if(!Array.isArray(o)||o.length===0)throw new Error("Invalid XMind file: No content found");const s=o[0];return{nodeData:await this.transformTopic(s.rootTopic,e,!0),theme:"default",direction:1}}catch(i){throw console.error("Failed to parse XMind file",i),new Error("Failed to import XMind file",{cause:i})}}async transformTopic(t,e,i=!1){const r=this.idGenerator.generate(),n=[];if(t.children&&t.children.attached)for(const s of t.children.attached)n.push(await this.transformTopic(s,e,!1));let o;if(t.image&&t.image.src&&t.image.src.startsWith("xap:")){const s=t.image.src.substring(4),c=e.file(s);if(c){const g=await c.async("base64"),f=s.split(".").pop()?.toLowerCase();let y="image/png";f==="jpg"||f==="jpeg"?y="image/jpeg":f==="svg"?y="image/svg+xml":f==="gif"&&(y="image/gif"),o=`data:${y};base64,${g}`}}if(t.title&&o){const s={id:r,topic:t.title,root:i,children:n},g={id:this.idGenerator.generate(),topic:"",image:o,children:[]};return s.children?.push(g),s}else return o?{id:r,topic:"",image:o,root:i,children:n}:{id:r,topic:t.title||"",root:i,children:n}}}class At{generate(t){const e=t.querySelectorAll("svg");let i=null;for(let K=0;K<e.length;K++){const x=e[K];if(x.style.zIndex==="0"&&x.style.position==="absolute"){i=x;break}}!i&&e.length>0&&e[0].parentElement===t&&(i=e[0]);const r=t.querySelectorAll("div");let n=null;for(let K=0;K<r.length;K++){const x=r[K];if(x.style.zIndex==="1"&&x.style.position==="absolute"){n=x;break}}if(!i||!n)throw new Error("Could not find mind map content layers.");let o=1/0,s=1/0,c=-1/0,g=-1/0;const f=n.children;if(f.length===0)o=0,s=0,c=800,g=600;else for(let K=0;K<f.length;K++){const x=f[K],D=parseFloat(x.style.left||"0"),l=parseFloat(x.style.top||"0"),R=x.offsetWidth,V=x.offsetHeight,W=l-V/2,Q=l+V/2;D<o&&(o=D),W<s&&(s=W),D+R>c&&(c=D+R),Q>g&&(g=Q)}const y=50;o-=y,s-=y,c+=y,g+=y;const p=c-o,d=g-s,w=window.getComputedStyle(t),h=["--mindmap-connection-color","--mindmap-root-color","--mindmap-child-color","--mindmap-root-border","--mindmap-child-border","--mindmap-root-background","--mindmap-child-background","--vscode-editor-foreground","--vscode-editor-background","--vscode-widget-border","--vscode-focusBorder"],m=[];h.forEach(K=>{const x=w.getPropertyValue(K).trim();x&&m.push(`${K}: ${x};`)});const u=m.join(" "),v=w.fontFamily,k=document.createElementNS("http://www.w3.org/2000/svg","svg");k.setAttribute("xmlns","http://www.w3.org/2000/svg"),k.setAttribute("width",p.toString()),k.setAttribute("height",d.toString()),k.setAttribute("viewBox",`0 0 ${p} ${d}`),k.style.cssText=u;const C=document.createElementNS("http://www.w3.org/2000/svg","rect");C.setAttribute("x","0"),C.setAttribute("y","0"),C.setAttribute("width",p.toString()),C.setAttribute("height",d.toString()),C.setAttribute("fill",w.backgroundColor||"#ffffff"),k.appendChild(C);const S=document.createElementNS("http://www.w3.org/2000/svg","g");S.setAttribute("transform",`translate(${-o}, ${-s})`),i.querySelectorAll("path").forEach(K=>{const x=K.cloneNode(!0),D=window.getComputedStyle(K);let l=D.stroke;(!l||l==="none")&&(l=K.style.stroke),(!l||l==="none")&&(l="#cccccc"),x.style.stroke=l;let R=D.strokeWidth;(!R||R==="0px"||R==="auto")&&(R=K.getAttribute("stroke-width")||"2px"),x.style.strokeWidth=R,x.style.fill="none",S.appendChild(x)});const A=document.createElementNS("http://www.w3.org/2000/svg","foreignObject");A.setAttribute("x","0"),A.setAttribute("y","0"),A.setAttribute("width",(c+y).toString()),A.setAttribute("height",(g+y).toString()),A.style.overflow="visible";const F=document.createElement("div");F.setAttribute("xmlns","http://www.w3.org/1999/xhtml"),F.style.cssText=`position: relative; width: 100%; height: 100%; font-family: ${v}; ${u}`;const T=n.children;for(let K=0;K<T.length;K++){const x=T[K].cloneNode(!0);F.appendChild(x)}return A.appendChild(F),S.appendChild(A),k.appendChild(S),new XMLSerializer().serializeToString(k)}}class Lt{async exportToSvg(t,e){try{const r=new At().generate(t),n=new Blob([r],{type:"image/svg+xml;charset=utf-8"});await this.saveFile(n,"mindmap.svg",[{description:"SVG File",accept:{"image/svg+xml":[".svg"]}}],e)}catch(i){i.name!=="AbortError"&&(console.error("Failed to export SVG:",i),alert("Failed to export SVG."))}}async exportToPng(t,e){try{const r=new At().generate(t),o=`data:image/svg+xml;base64,${btoa(unescape(encodeURIComponent(r)))}`;await new Promise((s,c)=>{const g=new Image;g.onload=()=>{try{const f=document.createElement("canvas");f.width=g.width,f.height=g.height;const y=f.getContext("2d");if(!y)throw new Error("Could not get canvas context");y.drawImage(g,0,0),f.toBlob(p=>{p?this.saveFile(p,"mindmap.png",[{description:"PNG Image",accept:{"image/png":[".png"]}}],e).then(()=>s()).catch(d=>c(d instanceof Error?d:new Error(String(d)))):c(new Error("Failed to generate PNG blob."))},"image/png")}catch(f){c(f instanceof Error?f:new Error(String(f)))}},g.onerror=()=>{c(new Error("Failed to load SVG for PNG conversion"))},g.src=o})}catch(i){i.name!=="AbortError"&&(console.error("Failed to export PNG:",i),alert("Failed to export PNG."))}}async showSavePicker(t){return typeof window.showSaveFilePicker!="function"?(alert("Your browser does not support the File System Access API required for saving files."),null):window.showSaveFilePicker(t)}async saveFile(t,e,i,r){if(r){const s=e.split(".").pop();await r.onExportFile(t,e,s);return}const n=await this.showSavePicker({suggestedName:e,types:i});if(!n)return;const o=await n.createWritable();await o.write(t),await o.close()}}class ie{async export(t,e){const i=this.generateMarkdown(t),r=new Blob([i],{type:"text/markdown;charset=utf-8"});await this.saveFile(r,"mindmap.md",e)}generateMarkdown(t){const e=t.root;if(!e)return"";const i=[];return this.processNode(e,0,i),i.join(`
|
|
56
|
-
`)}processNode(t,e,i){const r=this.getNodeText(t);if(e===0)i.push(`# ${r}`);else if(e===1)i.push(`## ${r}`);else{const n=" ".repeat(e-2);i.push(`${n}- ${r}`)}for(const n of t.children)this.processNode(n,e+1,i)}getNodeText(t){return t.image?"[image node]":t.topic}async saveFile(t,e,i){try{if(i){await i.onExportFile(t,e,"md");return}if(typeof window.showSaveFilePicker=="function"){const n=await(await window.showSaveFilePicker({suggestedName:e,types:[{description:"Markdown File",accept:{"text/markdown":[".md"]}}]})).createWritable();await n.write(t),await n.close()}else{const r=URL.createObjectURL(t),n=document.createElement("a");n.href=r,n.download=e,document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(r)}}catch(r){r.name!=="AbortError"&&(console.error("Failed to save file:",r),alert("Failed to save file."))}}}class re{mindMap;service;renderer;eventBus;styleEditor;commandPalette;interactionHandler;layoutSwitcher;fileHandler;selectedNodeId=null;layoutMode="Right";panX=0;panY=0;targetPanX=0;targetPanY=0;scale=1;isBatching=!1;animationFrameId=null;maxWidth=-1;pendingNodeCreation=!1;savedCustomStyles={rootNode:{border:"2px solid #aeb6bf",background:"#ebf5fb",color:"#2e4053"},childNode:{border:"1px solid #d5d8dc",background:"#fdfefe",color:"#2c3e50"},connection:{color:"#abb2b9"}};constructor(t,e,i,r,n,o){this.mindMap=t,this.service=e,this.renderer=i,this.styleEditor=r,this.eventBus=n,this.fileHandler=o,this.commandPalette=new Vt(this.renderer.container,{onInput:s=>this.handleSearchInput(s),onSelect:s=>this.handleSearchResultSelect(s),onIconSelect:s=>this.handleIconSelect(s),onCommandSelect:s=>this.handleCommandSelect(s),onClose:()=>{this.interactionHandler&&this.interactionHandler.container.focus()}})}setInteractionHandler(t){this.interactionHandler=t}setLayoutSwitcher(t){this.layoutSwitcher=t}init(t){this.panX=t*.2,this.targetPanX=this.panX;const e=this.mindMap.theme;if(e==="custom"){const i=ct.getInstance();i.setCustomTheme(this.savedCustomStyles),i.applyTheme(this.renderer.container,"custom")}else ct.getInstance().applyTheme(this.renderer.container,e);this.startAnimationLoop(),this.render()}destroy(){this.animationFrameId!==null&&(cancelAnimationFrame(this.animationFrameId),this.animationFrameId=null)}getData(){const t=this.service.exportData();return t.selectedId=this.selectedNodeId||void 0,t}loadData(t){try{this.service.importData(t),t.selectedId?this.selectNode(t.selectedId):this.selectNode(null),this.render(),this.eventBus.emit("model:load",t),t.theme&&this.setTheme(t.theme),this.eventBus.emit("model:change",void 0)}catch(e){console.error("Failed to load data",e)}}batch(t){this.isBatching=!0;try{t()}finally{this.isBatching=!1,this.render()}}getSelectedNodeId(){return this.selectedNodeId}addNode(t,e,i,r={emitChange:!0}){this.eventBus.emit("command",{name:"addNode",args:{parentId:t,topic:e,layoutSide:i}});const n=this.service.addNode(t,e,i);return n&&(this.render(),this.eventBus.emit("node:add",{id:n.id,topic:n.topic}),r.emitChange&&this.eventBus.emit("model:change",void 0)),n}addSibling(t,e="after",i="New topic",r={emitChange:!0}){this.eventBus.emit("command",{name:"addSibling",args:{referenceId:t,position:e,topic:i}});const n=this.mindMap.findNode(t);if(!n||!n.parentId)return null;const o=this.mindMap.findNode(n.parentId);o&&o.isRoot&&this.layoutMode==="Both"&&this.ensureExplicitLayoutSides(o);const s=this.service.addSibling(t,e,i);if(s){if(o&&o.isRoot&&this.layoutMode==="Both"){const c=n.layoutSide||(o.children.indexOf(n)%2===0?"right":"left");s.layoutSide=c}this.render(),this.eventBus.emit("node:add",{id:s.id,topic:s.topic}),r.emitChange&&this.eventBus.emit("model:change",void 0)}return s}insertParent(t,e="New topic",i={emitChange:!0}){this.eventBus.emit("command",{name:"insertParent",args:{targetId:t,topic:e}});const r=this.service.insertParent(t,e);return r&&(this.render(),this.eventBus.emit("node:add",{id:r.id,topic:r.topic}),i.emitChange&&this.eventBus.emit("model:change",void 0)),r}deleteNode(t){this.eventBus.emit("command",{name:"deleteNode",args:{nodeId:t}}),this.service.removeNode(t)&&(this.render(),this.eventBus.emit("node:remove",t),this.eventBus.emit("model:change",void 0))}updateNode(t,e){this.eventBus.emit("command",{name:"updateNode",args:{nodeId:t,updates:e}});let i=!1;this.interactionHandler&&this.interactionHandler.isReadOnly||(e.topic!==void 0&&this.service.updateNodeTopic(t,e.topic)&&(i=!0),e.style!==void 0&&this.service.updateNodeStyle(t,e.style)&&(i=!0),e.icon!==void 0&&this.service.updateNodeIcon(t,e.icon)&&(i=!0),i&&(this.render(),e.topic!==void 0&&this.eventBus.emit("node:update",{id:t,topic:e.topic}),this.eventBus.emit("model:change",void 0),this.pendingNodeCreation&&(this.pendingNodeCreation=!1)))}updateNodeWidth(t,e){if(this.eventBus.emit("command",{name:"updateNodeWidth",args:{nodeId:t,increment:e}}),this.interactionHandler&&this.interactionHandler.isReadOnly)return;const i=this.mindMap.findNode(t);if(!i)return;let r=i.customWidth;r===void 0&&(r=this.renderer.measureNode(i,this.mindMap).width);let n=r+e;n<50&&(n=50),this.service.updateNodeCustomWidth(t,n)&&(this.render(),this.eventBus.emit("model:change",void 0))}addChildNode(t){const e=this.mindMap.findNode(t);e&&e.isRoot&&this.layoutMode==="Both"&&this.ensureExplicitLayoutSides(e);let i;if(this.layoutMode==="Both"&&e&&e.isRoot){let n=0,o=0;e.children.forEach((s,c)=>{(s.layoutSide||(c%2===0?"right":"left"))==="left"?n++:o++}),i=n<o?"left":"right"}this.pendingNodeCreation=!0;const r=this.addNode(t,"New topic",i,{emitChange:!1});r&&(this.selectNode(r.id),this.ensureNodeVisible(r.id,!1,!0),this.interactionHandler.editNode(r.id))}addSiblingNode(t,e="after"){this.pendingNodeCreation=!0;const i=this.addSibling(t,e,"New topic",{emitChange:!1});i&&(this.selectNode(i.id),this.ensureNodeVisible(i.id,!1,!0),this.interactionHandler.editNode(i.id))}insertParentNode(t){this.pendingNodeCreation=!0;const e=this.insertParent(t,"New topic",{emitChange:!1});e&&(this.selectNode(e.id),this.ensureNodeVisible(e.id,!1,!0),this.interactionHandler.editNode(e.id))}removeNode(t){const i=this.mindMap.findNode(t)?.parentId||null,r=this.selectedNodeId===t;this.deleteNode(t),r&&i&&this.selectNode(i)}selectNode(t){if(this.selectedNodeId!==t){if(this.selectedNodeId=t,this.interactionHandler&&this.interactionHandler.updateSelection(t),t){const e=this.mindMap.findNode(t);e&&(!e.image&&this.interactionHandler&&!this.interactionHandler.isReadOnly?this.styleEditor.show(t,e.style):this.styleEditor.hide())}else this.styleEditor.hide();this.render(),this.eventBus.emit("node:select",t)}}moveNode(t,e,i){this.eventBus.emit("command",{name:"moveNode",args:{nodeId:t,targetId:e,position:i}});const r=this.mindMap.findNode(e);if(r){if(i==="top"){if(r.isRoot)return;this.service.reorderNode(t,e,"before")}else if(i==="bottom"){if(r.isRoot)return;this.service.reorderNode(t,e,"after")}else if(r.isRoot){const n=i==="left"?"left":"right";this.service.moveNode(t,e,n)}else((this.getNodeDirection(r)==="right"?i==="right":i==="left")?"addChild":"insertParent")==="addChild"?this.service.moveNode(t,e):this.service.insertNodeAsParent(t,e);this.render(),this.eventBus.emit("node:move",{nodeId:t,newParentId:e,position:i}),this.eventBus.emit("model:change",void 0)}}updateNodeTopic(t,e){this.updateNode(t,{topic:e}),setTimeout(()=>this.ensureNodeVisible(t),0)}render(){this.isBatching||(this.renderer.render(this.mindMap,this.selectedNodeId,this.layoutMode),this.renderer.updateTransform(this.panX,this.panY,this.scale))}setLayoutMode(t){this.eventBus.emit("command",{name:"setLayoutMode",args:{mode:t}}),this.layoutMode=t,this.layoutSwitcher&&this.layoutSwitcher.setMode(t);const e=this.renderer.container.clientWidth;t==="Right"?this.panX=e*.2:t==="Left"?this.panX=e*.8:this.panX=e*.5,this.panY=0,this.targetPanX=this.panX,this.targetPanY=this.panY,this.render()}getLayoutMode(){return this.layoutMode}setMaxNodeWidth(t){this.maxWidth=t,this.renderer.maxWidth=t,this.interactionHandler&&(this.interactionHandler.maxWidth=t),this.render()}getMaxNodeWidth(){return this.maxWidth}updateGlobalStyles(t){if(this.eventBus.emit("command",{name:"updateGlobalStyles",args:{styles:t}}),t.rootNode&&(this.savedCustomStyles.rootNode={...this.savedCustomStyles.rootNode,...t.rootNode}),t.childNode&&(this.savedCustomStyles.childNode={...this.savedCustomStyles.childNode,...t.childNode}),t.connection&&(this.savedCustomStyles.connection={...this.savedCustomStyles.connection,...t.connection}),t.canvas&&(this.savedCustomStyles.canvas={...this.savedCustomStyles.canvas,...t.canvas}),this.mindMap.theme==="custom"){const e=ct.getInstance();e.setCustomTheme(this.savedCustomStyles),e.applyTheme(this.renderer.container,"custom")}}setTheme(t){this.eventBus.emit("command",{name:"setTheme",args:{theme:t}}),this.service.setTheme(t),this.layoutSwitcher&&this.layoutSwitcher.setTheme(t),t==="custom"&&ct.getInstance().setCustomTheme(this.savedCustomStyles),ct.getInstance().applyTheme(this.renderer.container,t),this.render(),this.eventBus.emit("model:change",void 0)}resetZoom(){const t=this.renderer.container.clientWidth/2,e=this.renderer.container.clientHeight/2,i=1;this.panX=t-(t-this.panX)*(i/this.scale),this.panY=e-(e-this.panY)*(i/this.scale),this.scale=i,this.targetPanX=this.panX,this.targetPanY=this.panY,this.render()}panBoard(t,e){this.targetPanX+=t,this.targetPanY+=e}zoomBoard(t,e,i){const s=this.renderer.container.getBoundingClientRect(),c=e-s.left,g=i-s.top,f=Math.min(Math.max(this.scale*(1-t*.001),.1),5),y=c-(c-this.panX)*(f/this.scale),p=g-(g-this.panY)*(f/this.scale);this.panX=y,this.panY=p,this.targetPanX=y,this.targetPanY=p,this.scale=f,this.renderer.updateTransform(this.panX,this.panY,this.scale)}setReadOnly(t){this.interactionHandler&&this.interactionHandler.setReadOnly(t),t&&this.styleEditor.hide()}undo(){this.service.undo()&&(this.eventBus.emit("command",{name:"undo"}),this.render(),this.eventBus.emit("model:change",void 0))}redo(){this.service.redo()&&(this.eventBus.emit("command",{name:"redo"}),this.render(),this.eventBus.emit("model:change",void 0))}toggleFold(t){this.service.toggleNodeFold(t)&&(this.eventBus.emit("command",{name:"toggleFold",args:{nodeId:t}}),this.render(),this.eventBus.emit("model:change",void 0))}navigateNode(t,e){const i=this.mindMap.findNode(t);if(!i)return;let r;switch(e){case"Left":r=this.navigateLeft(i);break;case"Right":r=this.navigateRight(i);break;case"Up":r=this.navigateUp(i);break;case"Down":r=this.navigateDown(i);break}r&&this.selectNode(r),this.selectedNodeId&&this.selectedNodeId!==t&&setTimeout(()=>this.ensureNodeVisible(this.selectedNodeId,!0),0)}copyNode(t){this.service.copyNode(t)}pasteNode(t){this.eventBus.emit("command",{name:"pasteNode",args:{parentId:t}});const e=this.service.pasteNode(t);e&&(this.render(),this.selectNode(e.id),this.eventBus.emit("node:add",{id:e.id,topic:e.topic}),this.eventBus.emit("model:change",void 0),setTimeout(()=>this.ensureNodeVisible(e.id,!0),0))}cutNode(t){this.eventBus.emit("command",{name:"cutNode",args:{nodeId:t}});const e=this.mindMap.findNode(t);if(e){const i=e.parentId;this.service.cutNode(t),i&&this.selectNode(i),this.render(),this.eventBus.emit("node:remove",t),this.eventBus.emit("model:change",void 0)}}pasteImage(t,e,i,r){this.eventBus.emit("command",{name:"pasteImage",args:{parentId:t,width:i,height:r}});const n=this.service.addImageNode(t,e,i,r);n&&(this.render(),this.selectNode(n.id),this.eventBus.emit("node:add",{id:n.id,topic:""}),this.eventBus.emit("model:change",void 0),setTimeout(()=>this.ensureNodeVisible(n.id,!0),0))}onEditEnd(){this.pendingNodeCreation&&(this.pendingNodeCreation=!1,this.eventBus.emit("model:change",void 0))}onStyleAction(t,e){if(this.interactionHandler&&this.interactionHandler.isReadOnly)return;const i=this.mindMap.findNode(t);if(!i)return;const r=i.style||{};let n=null;if(e.type==="bold")n={fontWeight:r.fontWeight==="bold"?"normal":"bold"};else if(e.type==="italic")n={fontStyle:r.fontStyle==="italic"?"normal":"italic"};else if(e.type==="color")e.index>=0&&e.index<vt.PALETTE.length&&(n={color:vt.PALETTE[e.index]});else if(e.type==="increaseSize"||e.type==="decreaseSize"){const o=vt.FONT_SIZES,s=r.fontSize||"";let c=o.findIndex(f=>f.value===s);c===-1&&(c=0);const g=e.type==="increaseSize"?Math.min(o.length-1,c+1):Math.max(0,c-1);g!==c&&(n={fontSize:o[g].value})}n&&this.service.updateNodeStyle(t,n)&&(this.render(),this.eventBus.emit("model:change",void 0),this.selectedNodeId===t&&this.styleEditor.show(t,{...r,...n}))}toggleCommandPalette(){this.interactionHandler&&this.interactionHandler.isReadOnly||this.commandPalette.toggle()}searchNodes(t){return this.service.searchNodes(t)}handleSearchInput(t){const e=this.service.searchNodes(t);this.commandPalette.setResults(e.map(i=>({id:i.id,topic:i.topic})))}handleSearchResultSelect(t){this.selectNode(t),setTimeout(()=>this.ensureNodeVisible(t,!0,!0),0)}handleIconSelect(t){this.selectedNodeId&&(this.service.updateNodeIcon(this.selectedNodeId,t),this.render(),this.eventBus.emit("model:change",void 0),setTimeout(()=>this.ensureNodeVisible(this.selectedNodeId,!0,!0),0))}handleCommandSelect(t){t==="import-xmind"?this.importXMind():t==="export-png"?this.exportPng():t==="export-svg"?this.exportSvg():t==="export-markdown"&&this.exportMarkdown()}async exportPng(){this.eventBus.emit("command",{name:"exportPng"}),await new Lt().exportToPng(this.renderer.container,this.fileHandler)}async exportSvg(){this.eventBus.emit("command",{name:"exportSvg"}),await new Lt().exportToSvg(this.renderer.container,this.fileHandler)}async exportMarkdown(){this.eventBus.emit("command",{name:"exportMarkdown"}),await new ie().export(this.mindMap,this.fileHandler)}async importXMind(){if(this.eventBus.emit("command",{name:"importXMind"}),this.mindMap.root.children.length>0&&!window.confirm("Current mind map will be replaced. Continue?"))return;if(this.fileHandler){const e=await this.fileHandler.onImportFile("xmind");if(e)try{const i=new Bt;let r;if(e instanceof ArrayBuffer)r=new File([e],"imported.xmind");else if(typeof e=="string")r=new File([e],"imported.xmind");else return;const n=await i.extractMindMapData(r);this.loadData(n)}catch(i){console.error(i),alert("Failed to import XMind file.")}return}const t=document.createElement("input");t.type="file",t.accept=".xmind",t.style.display="none",document.body.appendChild(t),t.onchange=async e=>{const r=e.target.files?.[0];if(r)try{const o=await new Bt().extractMindMapData(r);this.loadData(o)}catch(n){console.error(n),alert("Failed to import XMind file.")}document.body.removeChild(t)},t.click()}ensureExplicitLayoutSides(t){!t.isRoot||this.layoutMode!=="Both"||t.children.forEach((e,i)=>{e.layoutSide||(e.layoutSide=i%2===0?"right":"left")})}getNodeDirection(t){if(t.isRoot||this.layoutMode==="Right")return"right";if(this.layoutMode==="Left")return"left";let e=t;for(;e.parentId;){const i=this.mindMap.findNode(e.parentId);if(!i)break;if(i.isRoot)return e.layoutSide?e.layoutSide:i.children.findIndex(n=>n.id===e.id)%2===0?"right":"left";e=i}return"right"}startAnimationLoop(){let t=performance.now();const e=()=>{const i=performance.now(),r=(i-t)/1e3;t=i;const n=1-Math.exp(-8*r),o=this.targetPanX-this.panX,s=this.targetPanY-this.panY;Math.abs(o)>.1||Math.abs(s)>.1?(this.panX+=o*n,this.panY+=s*n,this.renderer.updateTransform(this.panX,this.panY,this.scale)):(this.panX!==this.targetPanX||this.panY!==this.targetPanY)&&(this.panX=this.targetPanX,this.panY=this.targetPanY,this.renderer.updateTransform(this.panX,this.panY,this.scale)),Number.isNaN(this.panX)&&(this.panX=0),Number.isNaN(this.panY)&&(this.panY=0),this.animationFrameId=requestAnimationFrame(e)};e()}ensureNodeVisible(t,e=!1,i=!1){const r=this.renderer.container.querySelector(`.mindmap-node[data-id="${t}"]`);if(!r)return;const n=r.getBoundingClientRect(),o=this.renderer.container.getBoundingClientRect(),s=50;let c=0,g=0;const f=n.left<o.left+s,y=n.right>o.right-s,p=n.top<o.top+s,d=n.bottom>o.bottom-s;if(e&&(f||y||p||d)){const w=n.left+n.width/2,h=n.top+n.height/2,m=o.left+o.width/2,u=o.top+o.height/2;c=m-w,g=u-h}else f?c=o.left+s-n.left:y&&(c=o.right-s-n.right),p?g=o.top+s-n.top:d&&(g=o.bottom-s-n.bottom);(c!==0||g!==0)&&(i?(this.panX+=c,this.panY+=g,this.targetPanX=this.panX,this.targetPanY=this.panY,this.renderer.updateTransform(this.panX,this.panY,this.scale)):this.panBoard(c,g))}navigateLeft(t){if(t.isRoot){if(this.layoutMode==="Left")return t.children.length>0?t.children[0].id:void 0;if(this.layoutMode==="Both"){const e=t.children.find((i,r)=>(i.layoutSide||(r%2!==0?"left":"right"))==="left");return e?e.id:void 0}}else if(t.parentId)return this.getNodeDirection(t)==="right"?t.parentId:t.children.length>0?t.children[0].id:void 0}navigateRight(t){if(t.isRoot){if(this.layoutMode==="Right")return t.children.length>0?t.children[0].id:void 0;if(this.layoutMode==="Both"){const e=t.children.find((i,r)=>(i.layoutSide||(r%2===0?"right":"left"))==="right");return e?e.id:void 0}}else if(t.parentId)return this.getNodeDirection(t)==="right"?t.children.length>0?t.children[0].id:void 0:t.parentId}navigateUp(t){if(t.parentId){const e=this.mindMap.findNode(t.parentId);if(e){const i=this.getNodeDirection(t),r=e.children.filter(o=>this.getNodeDirection(o)===i),n=r.findIndex(o=>o.id===t.id);if(n>0)return r[n-1].id}}}navigateDown(t){if(t.parentId){const e=this.mindMap.findNode(t.parentId);if(e){const i=this.getNodeDirection(t),r=e.children.filter(o=>this.getNodeDirection(o)===i),n=r.findIndex(o=>o.id===t.id);if(n!==-1&&n<r.length-1)return r[n+1].id}}}showShortcutModal(){if(!this.interactionHandler||typeof document>"u")return;const t=document.createElement("div");t.style.position="fixed",t.style.top="0",t.style.left="0",t.style.width="100vw",t.style.height="100vh",t.style.backgroundColor="rgba(0,0,0,0.5)",t.style.zIndex="3000",t.style.display="flex",t.style.justifyContent="center",t.style.alignItems="center",t.style.opacity="0",t.style.transition="opacity 0.2s";const e=document.createElement("div");e.style.backgroundColor="white",e.style.padding="20px",e.style.borderRadius="8px",e.style.boxShadow="0 4px 6px rgba(0,0,0,0.1)",e.style.maxWidth="600px",e.style.width="90%",e.style.maxHeight="90vh",e.style.overflowY="auto",e.style.position="relative";const i=document.createElement("h2");i.textContent="Keyboard Shortcuts",i.style.margin="0 0 15px 0",i.style.fontSize="1.5em",i.style.borderBottom="1px solid #eee",i.style.paddingBottom="10px",e.appendChild(i);const r=document.createElement("button");r.textContent="×",r.style.position="absolute",r.style.top="10px",r.style.right="15px",r.style.background="none",r.style.border="none",r.style.fontSize="24px",r.style.cursor="pointer",r.style.color="#999",r.addEventListener("click",()=>{s()}),e.appendChild(r);const n=this.interactionHandler.getShortcuts();[{title:"General",actions:[{action:"openCommandPalette",desc:"Open Command Palette",descJa:"コマンドパレットを開く"},{action:"navUp",desc:"Move Selection Up",descJa:"ノード間の移動 (上)"},{action:"navDown",desc:"Move Selection Down",descJa:"ノード間の移動 (下)"},{action:"navLeft",desc:"Move Selection Left",descJa:"ノード間の移動 (左)"},{action:"navRight",desc:"Move Selection Right",descJa:"ノード間の移動 (右)"},{action:"beginEdit",desc:"Start Editing (Zoom if Image)",descJa:"ノードの編集を開始 (画像の場合はズーム)"},{action:"addSibling",desc:"Add Sibling (Below)",descJa:"兄弟ノードを追加 (下)"},{action:"addSiblingBefore",desc:"Add Sibling (Above)",descJa:"兄弟ノードを追加 (上)"},{action:"addChild",desc:"Add Child",descJa:"子ノードを追加"},{action:"insertParent",desc:"Insert Parent",descJa:"親ノードを挿入"},{action:"deleteNode",desc:"Delete Node",descJa:"ノードを削除"},{action:"undo",desc:"Undo",descJa:"元に戻す (Undo)"},{action:"redo",desc:"Redo",descJa:"やり直し (Redo)"},{action:"copy",desc:"Copy",descJa:"コピー"},{action:"cut",desc:"Cut",descJa:"切り取り"},{action:"paste",desc:"Paste",descJa:"貼り付け (画像も可)"},{action:"toggleFold",desc:"Toggle Fold",descJa:"ノードの展開/折り畳み"},{action:"zoomIn",desc:"Canvas Zoom In",descJa:"キャンバス拡大"},{action:"zoomOut",desc:"Canvas Zoom Out",descJa:"キャンバス縮小"},{action:"resetZoom",desc:"Reset Zoom",descJa:"ズームリセット"},{key:"Drag (Canvas)",desc:"Pan Board",descJa:"画面のパン (移動)"},{key:"Wheel",desc:"Vertical Scroll",descJa:"上下スクロール (パン)"},{key:"Shift + Wheel",desc:"Horizontal Scroll",descJa:"左右スクロール (パン)"},{key:"Ctrl/Cmd + Wheel",desc:"Zoom",descJa:"ズームイン/アウト"}]},{title:"Editing (Text Input)",actions:[{key:"Enter",desc:"Confirm Edit",descJa:"編集を確定"},{key:"Shift + Enter",desc:"New Line",descJa:"改行"},{key:"Esc",desc:"Cancel Edit",descJa:"編集をキャンセル"}]},{title:"Styling (Selection)",actions:[{action:"bold",desc:"Toggle Bold",descJa:"太字 (Bold) 切り替え"},{action:"italic",desc:"Toggle Italic",descJa:"斜体 (Italic) 切り替え"},{action:"selectColor1",desc:"Color 1",descJa:"ノードの色を変更 (1)"},{action:"selectColor2",desc:"Color 2",descJa:"ノードの色を変更 (2)"},{action:"selectColor3",desc:"Color 3",descJa:"ノードの色を変更 (3)"},{action:"selectColor4",desc:"Color 4",descJa:"ノードの色を変更 (4)"},{action:"selectColor5",desc:"Color 5",descJa:"ノードの色を変更 (5)"},{action:"selectColor6",desc:"Color 6",descJa:"ノードの色を変更 (6)"},{action:"selectColor7",desc:"Color 7",descJa:"ノードの色を変更 (7)"},{action:"increaseFontSize",desc:"Increase Font Size",descJa:"フォントサイズ拡大"},{action:"decreaseFontSize",desc:"Decrease Font Size",descJa:"フォントサイズ縮小"}]}].forEach(g=>{const f=[];if(g.actions.forEach(m=>{let u="";const v=m;if(v.key)u=v.key;else if(v.action&&n[v.action]){const k=n[v.action];if(k&&k.length>0){const C=k.map(S=>{const M=[];return(S.ctrlKey||S.metaKey)&&M.push("Ctrl/Cmd"),S.altKey&&M.push("Alt"),S.shiftKey&&M.push("Shift"),S.key===" "?M.push("Space"):M.push(S.key),M.join(" + ")});u=[...new Set(C)].join(" / ")}}u&&f.push({key:u,desc:v.descJa||v.desc})}),f.length===0)return;const y=document.createElement("h3");y.textContent=g.title,y.style.marginTop="20px",y.style.marginBottom="10px",y.style.fontSize="1.2em",y.style.color="#333",y.style.borderBottom="1px solid #f0f0f0",e.appendChild(y);const p=document.createElement("table");p.style.width="100%",p.style.borderCollapse="collapse",p.style.fontSize="0.9em";const d=document.createElement("tr");d.style.borderBottom="2px solid #ddd";const w=document.createElement("th");w.textContent="Key",w.style.textAlign="center",w.style.padding="8px 0",w.style.width="40%",w.style.color="#666";const h=document.createElement("th");h.textContent="Description",h.style.textAlign="center",h.style.padding="8px 0",h.style.color="#666",d.appendChild(w),d.appendChild(h),p.appendChild(d),f.forEach(m=>{const u=document.createElement("tr");u.style.borderBottom="1px solid #f9f9f9";const v=document.createElement("td");v.textContent=m.key,v.style.padding="6px 0",v.style.fontWeight="bold",v.style.color="#555",v.style.minWidth="180px",v.style.textAlign="center";const k=document.createElement("td");k.textContent=m.desc,k.style.padding="6px 0",k.style.textAlign="left",k.style.color="#333",u.appendChild(v),u.appendChild(k),p.appendChild(u)}),e.appendChild(p)}),t.appendChild(e),document.body.appendChild(t),requestAnimationFrame(()=>{t.style.opacity="1"});const s=()=>{t.style.opacity="0",setTimeout(()=>{document.body.contains(t)&&document.body.removeChild(t)},200),document.removeEventListener("keydown",c)},c=g=>{g.key==="Escape"&&s()};document.addEventListener("keydown",c),t.addEventListener("click",g=>{g.target===t&&s()})}}class ne{listeners={};on(t,e){this.listeners[t]||(this.listeners[t]=[]),this.listeners[t]?.push(e)}addListener(t,e){this.on(t,e)}off(t,e){const i=this.listeners[t];i&&(this.listeners[t]=i.filter(r=>r!==e))}removeListener(t,e){this.off(t,e)}emit(t,e){this.listeners[t]?.forEach(i=>i(e))}}class oe extends ne{mindMap;controller;constructor(t,e={}){super();const i=new yt("root","Root Topic",null,!0);this.mindMap=new bt(i);const r=new Rt,n=new Wt(this.mindMap,r),o=document.createElement("div");o.style.position="absolute",o.style.top="0",o.style.left="0",o.style.width="100%",o.style.height="100%",o.style.pointerEvents="none",o.style.zIndex="2000",window.getComputedStyle(t).position==="static"&&(t.style.position="relative"),t.style.overscrollBehavior="none",t.style.touchAction="none",t.appendChild(o);const c=new vt(o),g=new Zt(t,{onImageZoom:p=>this.controller.setReadOnly(p),onToggleFold:p=>this.controller.toggleFold(p)});this.controller=new re(this.mindMap,n,g,c,{emit:(p,d)=>this.emit(p,d)},e.fileHandler),c.onUpdate=(p,d)=>{this.controller.updateNode(p,{style:d})};const f=new Jt(t,{onNodeClick:p=>this.controller.selectNode(p||null),onAddChild:p=>this.controller.addChildNode(p),onInsertParent:p=>this.controller.insertParentNode(p),onAddSibling:(p,d)=>this.controller.addSiblingNode(p,d),onDeleteNode:p=>this.controller.removeNode(p),onDropNode:(p,d,w)=>this.controller.moveNode(p,d,w),onUpdateNode:(p,d)=>this.controller.updateNodeTopic(p,d),onNavigate:(p,d)=>this.controller.navigateNode(p,d),onPan:(p,d)=>this.controller.panBoard(p,d),onCopyNode:p=>this.controller.copyNode(p),onPasteNode:p=>this.controller.pasteNode(p),onCutNode:p=>this.controller.cutNode(p),onPasteImage:(p,d,w,h)=>this.controller.pasteImage(p,d,w,h),onZoom:(p,d,w)=>this.controller.zoomBoard(p,d,w),onZoomReset:()=>this.controller.resetZoom(),onUndo:()=>this.controller.undo(),onRedo:()=>this.controller.redo(),onStyleAction:(p,d)=>this.controller.onStyleAction(p,d),onEditEnd:p=>this.controller.onEditEnd(),onToggleFold:p=>this.controller.toggleFold(p),onToggleCommandPalette:()=>this.controller.toggleCommandPalette(),onUpdateNodeWidth:(p,d)=>this.controller.updateNodeWidth(p,d),shortcuts:e.shortcuts});this.controller.setInteractionHandler(f);const y=new Xt(o,{onLayoutChange:p=>this.controller.setLayoutMode(p),onThemeChange:p=>this.controller.setTheme(p),onZoomReset:()=>this.controller.resetZoom(),onShowShortcuts:()=>this.controller.showShortcutModal()});this.controller.setLayoutSwitcher(y),e.maxNodeWidth!==void 0&&this.controller.setMaxNodeWidth(e.maxNodeWidth),e.customStyles&&this.controller.updateGlobalStyles(e.customStyles),this.controller.init(t.clientWidth)}addNode(t,e,i,r={emitChange:!0}){return this.controller.addNode(t,e,i,r)}addSibling(t,e="after",i="New topic",r={emitChange:!0}){return this.controller.addSibling(t,e,i,r)}insertParent(t,e="New topic",i={emitChange:!0}){return this.controller.insertParent(t,e,i)}deleteNode(t){this.controller.deleteNode(t)}updateNode(t,e){this.controller.updateNode(t,e)}undo(){this.controller.undo()}redo(){this.controller.redo()}toggleFold(t){this.controller.toggleFold(t)}toggleCommandPalette(){this.controller.toggleCommandPalette()}openCommandPalette(){this.controller.toggleCommandPalette()}searchNodes(t){return this.controller.searchNodes(t)}getSelectedNodeId(){return this.controller.selectedNodeId}updateNodeStyle(t,e){this.controller.updateNode(t,{style:e})}setTheme(t){this.controller.setTheme(t)}getMindMap(){return this.mindMap}getNode(t){return this.mindMap.findNode(t)||void 0}getRoot(){return this.mindMap.root}findNodes(t){const e=[],i=r=>{t(r)&&e.push(r),r.children.forEach(i)};return i(this.mindMap.root),e}setMaxNodeWidth(t){this.controller.setMaxNodeWidth(t)}getMaxNodeWidth(){return this.controller.getMaxNodeWidth()}updateGlobalStyles(t){this.controller.updateGlobalStyles(t)}setReadOnly(t){this.controller.setReadOnly(t)}destroy(){this.controller.destroy(),this.controller.interactionHandler?.destroy()}batch(t){this.controller.isBatching=!0;try{t()}finally{this.controller.isBatching=!1,this.controller.render()}}addChildNode(t){this.controller.addChildNode(t)}addSiblingNode(t,e="after"){this.controller.addSiblingNode(t,e)}insertParentNode(t){this.controller.insertParentNode(t)}removeNode(t){this.controller.removeNode(t)}moveNode(t,e,i){this.controller.moveNode(t,e,i)}updateNodeTopic(t,e){this.controller.updateNodeTopic(t,e)}selectNode(t){this.controller.selectNode(t)}panBoard(t,e){this.controller.panBoard(t,e)}zoomBoard(t,e,i){this.controller.zoomBoard(t,e,i)}resetZoom(){this.controller.resetZoom()}copyNode(t){this.controller.copyNode(t)}pasteNode(t){this.controller.pasteNode(t)}pasteImage(t,e,i,r){this.controller.pasteImage(t,e,i,r)}cutNode(t){this.controller.cutNode(t)}updateLayout(t){t==="Standard"?this.controller.setLayoutMode("Both"):this.controller.setLayoutMode(t)}setLayoutMode(t){this.controller.setLayoutMode(t)}getLayoutMode(){return this.controller.getLayoutMode()}navigateNode(t,e){this.controller.navigateNode(t,e)}getData(){return this.controller.getData()}loadData(t){this.controller.loadData(t)}getRootId(){return this.mindMap.root.id}}mt.Kakidash=oe,mt.Node=yt,mt.SvgGenerator=At,mt.XMindImporter=Bt,Object.defineProperty(mt,Symbol.toStringTag,{value:"Module"})}));
|
|
41
|
+
</svg>`}}const Vt={navUp:[{key:"ArrowUp"},{key:"k"},{key:"ArrowUp",shiftKey:!0},{key:"k",shiftKey:!0}],navDown:[{key:"ArrowDown"},{key:"j"},{key:"ArrowDown",shiftKey:!0},{key:"j",shiftKey:!0}],navLeft:[{key:"ArrowLeft"},{key:"h"},{key:"ArrowLeft",shiftKey:!0},{key:"h",shiftKey:!0}],navRight:[{key:"ArrowRight"},{key:"l"},{key:"ArrowRight",shiftKey:!0},{key:"l",shiftKey:!0}],addChild:[{key:"Tab"},{key:"a"}],insertParent:[{key:"Tab",shiftKey:!0},{key:"a",shiftKey:!0}],addSibling:[{key:"Enter"}],addSiblingBefore:[{key:"Enter",shiftKey:!0}],deleteNode:[{key:"Delete"},{key:"Backspace"},{key:"d"}],beginEdit:[{key:"i"},{key:" "},{key:"F2"}],copy:[{key:"c",ctrlKey:!0},{key:"c",metaKey:!0}],paste:[{key:"v",ctrlKey:!0},{key:"v",metaKey:!0}],cut:[{key:"x",ctrlKey:!0},{key:"x",metaKey:!0}],undo:[{key:"z",ctrlKey:!0},{key:"z",metaKey:!0}],redo:[{key:"Z",ctrlKey:!0,shiftKey:!0},{key:"Z",metaKey:!0,shiftKey:!0},{key:"y",ctrlKey:!0},{key:"y",metaKey:!0}],bold:[{key:"b",shiftKey:!0}],italic:[{key:"i",shiftKey:!0}],strikethrough:[{key:"x",shiftKey:!0}],increaseFontSize:[{key:">",shiftKey:!0},{key:"."}],decreaseFontSize:[{key:"<",shiftKey:!0},{key:","}],zoomIn:[{key:"["}],zoomOut:[{key:"]"}],resetZoom:[{key:":"}],toggleFold:[{key:"f",ctrlKey:!1,metaKey:!1,altKey:!1}],selectColor1:[{key:"1"}],selectColor2:[{key:"2"}],selectColor3:[{key:"3"}],selectColor4:[{key:"4"}],selectColor5:[{key:"5"}],selectColor6:[{key:"6"}],selectColor7:[{key:"7"}],openCommandPalette:[{key:"m"}],increaseNodeWidth:[{key:"ArrowRight",shiftKey:!0,altKey:!0}],decreaseNodeWidth:[{key:"ArrowLeft",shiftKey:!0,altKey:!0}]};class Jt{shortcuts;constructor(t){this.shortcuts=t}matches(t,e){const i=this.shortcuts[e];return i?i.some(n=>{const r=n.ctrlKey??!1,s=n.metaKey??!1,o=n.altKey??!1,l=n.shiftKey??!1;return t.ctrlKey!==r||t.metaKey!==s||t.altKey!==o||t.shiftKey!==l?!1:n.key.toLowerCase()===t.key.toLowerCase()}):!1}getAction(t){const e=Object.keys(this.shortcuts);for(const i of e)if(this.matches(t,i))return i}}class qt{commandBus;container;shortcutManager;isReadOnly=!1;shortcuts;getSelectedNodeId;cleanupFns=[];constructor(t,e){this.commandBus=t.commandBus,this.container=t.container,this.shortcuts={...Vt,...t.shortcuts},this.shortcutManager=new Jt(this.shortcuts),this.getSelectedNodeId=e,this.attachEvents()}getShortcuts(){return this.shortcuts}setReadOnly(t){this.isReadOnly=t}destroy(){this.cleanupFns.forEach(t=>t()),this.cleanupFns=[]}attachEvents(){const t=e=>{if(console.log(`[KeyboardShortcutHandler] RAW KEYDOWN: ${e.key}`),this.isReadOnly)return;const i=e,n=i.target;if(console.log(`[KeyboardShortcutHandler] Target: ${n?n.tagName:"unknown"}`),n&&(n.tagName==="INPUT"||n.tagName==="TEXTAREA"||n.isContentEditable))return;const r=this.getSelectedNodeId();if(console.log(`[KeyboardShortcutHandler] Selected ID: ${r}`),!r){if(this.shortcutManager.matches(i,"navUp")){i.preventDefault(),this.commandBus.dispatch({type:"navigate",nodeId:null,direction:"Up"});return}if(this.shortcutManager.matches(i,"navDown")){i.preventDefault(),this.commandBus.dispatch({type:"navigate",nodeId:null,direction:"Down"});return}if(this.shortcutManager.matches(i,"navLeft")){i.preventDefault(),this.commandBus.dispatch({type:"navigate",nodeId:null,direction:"Left"});return}if(this.shortcutManager.matches(i,"navRight")){i.preventDefault(),this.commandBus.dispatch({type:"navigate",nodeId:null,direction:"Right"});return}}const s=this.shortcutManager.getAction(i);s&&this.handleAction(s,i,r)};document.addEventListener("keydown",t),this.cleanupFns.push(()=>{document.removeEventListener("keydown",t)})}handleAction(t,e,i){switch(t){case"undo":e.preventDefault(),this.commandBus.dispatch({type:"undo"});return;case"redo":e.preventDefault(),this.commandBus.dispatch({type:"redo"});return;case"zoomIn":{e.preventDefault();const n=this.container.getBoundingClientRect();this.commandBus.dispatch({type:"zoom",delta:-100,x:n.left+n.width/2,y:n.top+n.height/2});return}case"zoomOut":{e.preventDefault();const n=this.container.getBoundingClientRect();this.commandBus.dispatch({type:"zoom",delta:100,x:n.left+n.width/2,y:n.top+n.height/2});return}case"resetZoom":e.preventDefault(),this.commandBus.dispatch({type:"zoomReset"});return;case"openCommandPalette":e.preventDefault(),this.commandBus.dispatch({type:"toggleCommandPalette"});return}if(i){switch(t){case"copy":e.preventDefault(),this.commandBus.dispatch({type:"copyNode",nodeId:i});return;case"paste":this.commandBus.dispatch({type:"pasteNode",parentId:i});return;case"navUp":e.preventDefault(),this.commandBus.dispatch({type:"navigate",nodeId:i,direction:"Up",extendSelection:e.shiftKey});return;case"navDown":e.preventDefault(),this.commandBus.dispatch({type:"navigate",nodeId:i,direction:"Down",extendSelection:e.shiftKey});return;case"navRight":e.preventDefault(),this.commandBus.dispatch({type:"navigate",nodeId:i,direction:"Right",extendSelection:e.shiftKey});return;case"navLeft":e.preventDefault(),this.commandBus.dispatch({type:"navigate",nodeId:i,direction:"Left",extendSelection:e.shiftKey});return}if(!this.isReadOnly)switch(t){case"addChild":e.preventDefault(),this.commandBus.dispatch({type:"addNode",parentId:i});break;case"insertParent":e.preventDefault(),this.commandBus.dispatch({type:"insertParent",nodeId:i});break;case"addSibling":e.preventDefault(),this.commandBus.dispatch({type:"addSibling",nodeId:i,position:"after"});break;case"addSiblingBefore":e.preventDefault(),this.commandBus.dispatch({type:"addSibling",nodeId:i,position:"before"});break;case"deleteNode":e.preventDefault(),this.commandBus.dispatch({type:"deleteNode",nodeId:i});break;case"beginEdit":e.preventDefault(),console.log(`[KeyboardShortcutHandler] beginEdit triggered for ${i}`),this.commandBus.dispatch({type:"editNode",nodeId:i});break;case"cut":e.preventDefault(),this.commandBus.dispatch({type:"cutNode",nodeId:i});break;case"bold":e.preventDefault(),this.commandBus.dispatch({type:"styleAction",nodeId:i,action:{type:"bold"}});break;case"italic":e.preventDefault(),this.commandBus.dispatch({type:"styleAction",nodeId:i,action:{type:"italic"}});break;case"strikethrough":e.preventDefault(),this.commandBus.dispatch({type:"styleAction",nodeId:i,action:{type:"strikethrough"}});break;case"increaseFontSize":e.preventDefault(),this.commandBus.dispatch({type:"styleAction",nodeId:i,action:{type:"increaseSize"}});break;case"decreaseFontSize":e.preventDefault(),this.commandBus.dispatch({type:"styleAction",nodeId:i,action:{type:"decreaseSize"}});break;case"toggleFold":e.preventDefault(),this.commandBus.dispatch({type:"toggleFold",nodeId:i});break;case"increaseNodeWidth":e.preventDefault(),this.commandBus.dispatch({type:"updateNodeWidth",nodeId:i,increment:20});break;case"decreaseNodeWidth":e.preventDefault(),this.commandBus.dispatch({type:"updateNodeWidth",nodeId:i,increment:-20});break;default:if(t.startsWith("selectColor")){const n=parseInt(t.replace("selectColor",""),10)-1;isNaN(n)||(e.preventDefault(),this.commandBus.dispatch({type:"styleAction",nodeId:i,action:{type:"color",index:n}}))}break}}}}class Qt{commandBus;container;isPanning=!1;lastMouseX=0;lastMouseY=0;cleanupFns=[];constructor(t){this.commandBus=t.commandBus,this.container=t.container,this.attachEvents()}destroy(){this.cleanupFns.forEach(t=>t()),this.cleanupFns=[]}attachEvents(){this.container.addEventListener("mousedown",this.handleMouseDown),this.cleanupFns.push(()=>{this.container.removeEventListener("mousedown",this.handleMouseDown)}),window.addEventListener("mousemove",this.handleMouseMove),this.cleanupFns.push(()=>{window.removeEventListener("mousemove",this.handleMouseMove)}),window.addEventListener("mouseup",this.stopPanning),this.cleanupFns.push(()=>{window.removeEventListener("mouseup",this.stopPanning)}),window.addEventListener("mouseleave",this.stopPanning),this.cleanupFns.push(()=>{window.removeEventListener("mouseleave",this.stopPanning)}),this.container.addEventListener("wheel",this.handleWheel,{passive:!1}),this.cleanupFns.push(()=>{this.container.removeEventListener("wheel",this.handleWheel)})}handleMouseDown=t=>{const e=t.target;!e.closest(".mindmap-node")&&e.tagName!=="INPUT"&&(this.isPanning=!0,this.lastMouseX=t.clientX,this.lastMouseY=t.clientY,this.container.style.cursor="all-scroll")};handleMouseMove=t=>{if(this.isPanning){const e=t.clientX-this.lastMouseX,i=t.clientY-this.lastMouseY;this.lastMouseX=t.clientX,this.lastMouseY=t.clientY,this.commandBus.dispatch({type:"pan",dx:e,dy:i})}};stopPanning=()=>{this.isPanning&&(this.isPanning=!1,this.container.style.cursor="default")};handleWheel=t=>{if(t.preventDefault(),t.ctrlKey||t.metaKey){this.commandBus.dispatch({type:"zoom",delta:t.deltaY,x:t.clientX,y:t.clientY});return}let e=1;t.deltaMode===1?e=33:t.deltaMode===2&&(e=window.innerHeight);const i=-t.deltaX*e,n=-t.deltaY*e;this.commandBus.dispatch({type:"pan",dx:i,dy:n})}}class te{commandBus;container;draggedNodeId=null;isReadOnly=!1;ghostElement=null;cleanupFns=[];constructor(t){this.commandBus=t.commandBus,this.container=t.container,this.injectDragStyles(),this.attachEvents()}setReadOnly(t){this.isReadOnly=t}destroy(){this.cleanupFns.forEach(t=>t()),this.cleanupFns=[]}injectDragStyles(){if(!document.getElementById("drag-drop-styles")){const t=document.createElement("style");t.id="drag-drop-styles",t.textContent=`
|
|
42
|
+
.mindmap-node.drag-over-top {
|
|
43
|
+
border-top: 4px solid #007bff !important;
|
|
44
|
+
}
|
|
45
|
+
.mindmap-node.drag-over-bottom {
|
|
46
|
+
border-bottom: 4px solid #007bff !important;
|
|
47
|
+
}
|
|
48
|
+
.mindmap-node.drag-over-left {
|
|
49
|
+
border-left: 4px solid #007bff !important;
|
|
50
|
+
}
|
|
51
|
+
.mindmap-node.drag-over-right {
|
|
52
|
+
border-right: 4px solid #007bff !important;
|
|
53
|
+
}
|
|
54
|
+
`,document.head.appendChild(t),this.cleanupFns.push(()=>{const e=document.getElementById("drag-drop-styles");e&&e.remove()})}}attachEvents(){const t=n=>this.handlePointerDown(n),e=n=>this.handlePointerMove(n),i=n=>this.handlePointerUp(n);this.container.addEventListener("pointerdown",t),this.cleanupFns.push(()=>this.container.removeEventListener("pointerdown",t)),this.container.addEventListener("pointermove",e),this.cleanupFns.push(()=>this.container.removeEventListener("pointermove",e)),this.container.addEventListener("pointerup",i),this.cleanupFns.push(()=>this.container.removeEventListener("pointerup",i)),this.container.addEventListener("pointercancel",i),this.cleanupFns.push(()=>this.container.removeEventListener("pointercancel",i))}handlePointerDown=t=>{const e=t;if(this.isReadOnly)return;const n=e.target.closest(".mindmap-node");n&&n.dataset.id&&(this.draggedNodeId=n.dataset.id,n.setPointerCapture(e.pointerId),this.ghostElement=n.cloneNode(!0),this.ghostElement.classList.add("kakidash-drag-ghost"),this.ghostElement.style.position="fixed",this.ghostElement.style.pointerEvents="none",this.ghostElement.style.opacity="0.7",this.ghostElement.style.zIndex="9999",this.ghostElement.style.margin="0",this.ghostElement.style.left=`${e.clientX}px`,this.ghostElement.style.top=`${e.clientY}px`,this.ghostElement.style.transform="translate(-50%, -50%)",document.body.appendChild(this.ghostElement))};handlePointerMove=t=>{const e=t;if(this.isReadOnly||!this.draggedNodeId)return;this.ghostElement&&(this.ghostElement.style.left=`${e.clientX}px`,this.ghostElement.style.top=`${e.clientY}px`);const i=document.elementFromPoint(e.clientX,e.clientY);if(!i)return;const n=i.closest(".mindmap-node");if(this.container.querySelectorAll(".mindmap-node").forEach(r=>{r.classList.remove("drag-over-top","drag-over-bottom","drag-over-left","drag-over-right")}),n&&n.dataset.id&&n.dataset.id!==this.draggedNodeId){const r=this.getDropPosition(e,n);n.classList.add(`drag-over-${r}`)}};handlePointerUp=t=>{const e=t;if(this.ghostElement&&(this.ghostElement.remove(),this.ghostElement=null),this.draggedNodeId){const n=e.target;n.hasPointerCapture&&n.hasPointerCapture(e.pointerId)&&n.releasePointerCapture(e.pointerId)}let i=null;if(this.draggedNodeId){const n=document.elementFromPoint(e.clientX,e.clientY);n&&(i=n.closest(".mindmap-node"))}if(this.container.querySelectorAll(".mindmap-node").forEach(n=>{n.classList.remove("drag-over-top","drag-over-bottom","drag-over-left","drag-over-right")}),this.isReadOnly){this.draggedNodeId=null;return}if(i&&i.dataset.id&&this.draggedNodeId){const n=i.dataset.id;if(this.draggedNodeId!==n){const r=this.getDropPosition(e,i);this.commandBus.dispatch({type:"dropNode",draggedId:this.draggedNodeId,targetId:n,position:r})}}this.draggedNodeId=null};getDropPosition(t,e){const i=e.getBoundingClientRect(),n=t.clientX-i.left,r=t.clientY-i.top,s=i.width,o=i.height;return r<o*.25?"top":r>o*.75?"bottom":n<s*.25?"left":(n>s*.75,"right")}}class ee{container;maxWidth;commandBus;constructor(t,e,i){this.container=t,this.maxWidth=e,this.commandBus=i}setMaxWidth(t){this.maxWidth=t}startEditing(t,e){console.log(`[NodeEditor] startEditing called for ${e}`);const i=t.textContent||"",n=this.createEditTextarea(t,i);let r=this.maxWidth;if(t.style.maxWidth){const b=parseInt(t.style.maxWidth,10);isNaN(b)||(r=b)}this.applyTextareaStyles(n,t,r);const s=t.style.outline,o=t.style.boxShadow;t.style.outline="none",t.style.boxShadow="none";const l=this.createSizeUpdater(n,t,r);l(),n.addEventListener("input",l);const g=this.createCleanupFunction(n,t,s,o);this.setupEditEventHandlers(n,e,i,g),t.parentElement?t.parentElement.appendChild(n):this.container.appendChild(n),n.focus({preventScroll:!0}),n.select()}createEditTextarea(t,e){const i=document.createElement("textarea");return i.value=e,i.style.position="absolute",i.style.top=t.style.top,i.style.left=t.style.left,i.style.transform=t.style.transform,this.container.scrollTop=0,this.container.scrollLeft=0,i.style.overflow="hidden",i.style.resize="none",i.style.minHeight="1em",i}applyTextareaStyles(t,e,i){const n=window.getComputedStyle(e);if(i!==-1){t.style.whiteSpace="pre-wrap",t.style.wordWrap="break-word",t.style.overflowWrap="anywhere";const r=(parseFloat(n.paddingLeft)||0)+(parseFloat(n.paddingRight)||0),s=(parseFloat(n.borderLeftWidth)||0)+(parseFloat(n.borderRightWidth)||0),o=i+r+s;t.style.maxWidth=`${o}px`,t.style.width="max-content"}else t.style.whiteSpace="pre";t.style.font=n.font,t.style.padding=n.padding,t.style.boxSizing="border-box",t.style.backgroundColor=n.backgroundColor,t.style.border="none",t.style.outline="none",t.style.boxShadow="none",t.style.borderTop=n.borderTop,t.style.borderRight=n.borderRight,t.style.borderBottom=n.borderBottom,t.style.borderLeft=n.borderLeft,t.style.borderRadius=n.borderRadius,t.style.zIndex="100"}createSizeUpdater(t,e,i){const n=window.getComputedStyle(e);return()=>{const r=document.createElement("span");r.style.font=n.font,r.style.padding=n.padding,i!==-1?(r.style.whiteSpace="pre-wrap",r.style.wordWrap="break-word",r.style.overflowWrap="anywhere",r.style.maxWidth=`${i}px`,r.style.width="max-content"):r.style.whiteSpace="pre",r.style.visibility="hidden",r.style.position="absolute",r.textContent=t.value||"",(t.value.endsWith(`
|
|
55
|
+
`)||t.value==="")&&(r.textContent+=""),document.body&&document.body.appendChild(r);const s=r.offsetWidth+4,o=r.offsetHeight;t.style.width=Math.max(s,e.offsetWidth)+"px",t.style.height=Math.max(o,e.offsetHeight)+"px",r.parentNode&&r.parentNode.removeChild(r)}}createCleanupFunction(t,e,i,n){return()=>{t.parentNode&&t.parentNode.contains(t)&&t.parentNode.removeChild(t),e.style.outline=i,e.style.boxShadow=n}}setupEditEventHandlers(t,e,i,n){let r=!1;const s=()=>{if(r)return;r=!0;const l=t.value;l!==i&&this.commandBus.dispatch({type:"updateNode",nodeId:e,topic:l}),n(),this.commandBus.dispatch({type:"editEnd",nodeId:e})},o=()=>{r||(r=!0,n(),this.commandBus.dispatch({type:"editEnd",nodeId:e}))};t.addEventListener("blur",()=>{r||s()}),t.addEventListener("keydown",l=>{if(l.stopPropagation(),!l.isComposing)if(l.key==="Enter"){if(l.shiftKey)return;l.preventDefault(),s()}else l.key==="Escape"&&(l.preventDefault(),o())})}}class ie{container;commandBus;mindMap;options;keyboardHandler;zoomPanHandler;dragDropHandler;nodeEditor;cleanupFns=[];isReadOnly=!1;_maxWidth=-1;_getNodeElement;_zoomNode;getSelectedNodeId;constructor(t){this.container=t.container,this.commandBus=t.commandBus,this.mindMap=t.mindMap,this.options=t.options,this._getNodeElement=t.getNodeElement,this._zoomNode=t.zoomNode,this.getSelectedNodeId=t.getSelectedNodeId,this.container.tabIndex=0,this.container.style.outline="none",this.container.style.cursor="default",this.isReadOnly=!!t.options.allowReadOnly,this.keyboardHandler=new qt({commandBus:this.commandBus,container:this.container,shortcuts:this.options.shortcuts},t.getSelectedNodeId),this.zoomPanHandler=new Qt({commandBus:this.commandBus,container:this.container}),this.dragDropHandler=new te({commandBus:this.commandBus,container:this.container}),this.dragDropHandler.setReadOnly(this.isReadOnly),this.nodeEditor=new ee(this.container,this._maxWidth,this.commandBus),this.attachEvents()}get isReadOnlyState(){return this.isReadOnly}getShortcuts(){return this.keyboardHandler.getShortcuts()}setReadOnly(t){this.isReadOnly=t,this.dragDropHandler.setReadOnly(t)}focus(){this.container.focus()}set maxWidth(t){this._maxWidth=t,this.nodeEditor.setMaxWidth(t)}get maxWidth(){return this._maxWidth}editNode(t){const e=this.getNodeElement(t);e&&this.startEditing(e,t)}getNodeElement(t){return this._getNodeElement(t)}zoomNode(t){this._zoomNode(t)}updateSelection(t){}destroy(){this.keyboardHandler.destroy(),this.zoomPanHandler.destroy(),this.dragDropHandler.destroy(),this.cleanupFns.forEach(t=>t()),this.cleanupFns=[]}attachEvents(){const t=(e,i,n,r)=>{e.addEventListener(i,n,r),this.cleanupFns.push(()=>{e.removeEventListener(i,n,r)})};t(this.container,"scroll",()=>{(this.container.scrollTop!==0||this.container.scrollLeft!==0)&&(this.container.scrollTop=0,this.container.scrollLeft=0)}),t(this.container,"click",e=>{const n=e.target.closest(".mindmap-node");n&&n.dataset.id?this.commandBus.dispatch({type:"selectNode",nodeId:n.dataset.id,extendSelection:e.shiftKey}):this.commandBus.dispatch({type:"selectNode",nodeId:null}),this.container.focus()}),t(this.container,"dblclick",e=>{if(this.isReadOnly)return;const n=e.target.closest(".mindmap-node");n&&n.dataset.id&&this.startEditing(n,n.dataset.id)}),t(this.container,"contextmenu",e=>{}),t(this.container,"paste",e=>{if(this.isReadOnly)return;const i=this.getSelectedNodeId();if(!i)return;const n=e.clipboardData;if(!n)return;const r=n.items;for(const s of Array.from(r))if(s.type.startsWith("image/")){e.preventDefault();const o=s.getAsFile();if(o){const l=new FileReader;l.onload=g=>{const b=g.target?.result,u=new Image;u.onload=()=>{this.commandBus.dispatch({type:"pasteImage",parentId:i,imageData:b,width:u.width,height:u.height})},u.src=b},l.readAsDataURL(o)}}}),this.commandBus.on("editNode",e=>{this.editNode(e.nodeId)})}startEditing(t,e){const i=this.mindMap?.findNode(e);if(i&&i.image){this.zoomNode(e);return}this.nodeEditor.startEditing(t,e)}}class ne{handlers=new Map;on(t,e){this.handlers.has(t)||this.handlers.set(t,new Set),this.handlers.get(t).add(e)}off(t,e){const i=this.handlers.get(t);i&&(i.delete(e),i.size===0&&this.handlers.delete(t))}dispatch(t){const e=this.handlers.get(t.type);e&&e.forEach(i=>i(t))}destroy(){this.handlers.clear()}}class re{measureFn;heightCache=new Map;constructor(t){this.measureFn=t}calculate(t,e){this.heightCache.clear();const i={nodes:[],connections:[]},{width:n,height:r}=this.measureNode(t);if(i.nodes.push({nodeId:t.id,x:0,y:0,width:n,height:r,direction:"right",isRoot:!0}),t.presentation?.isFolded||t.children.length===0)return i;let s=[],o=[];return e==="Both"?t.children.forEach((l,g)=>{(l.presentation?.layoutSide||(g%2===0?"right":"left"))==="right"?s.push(l):o.push(l)}):e==="Left"?o=t.children:s=t.children,s.length>0&&this.calculateChildrenStack(t,s,0,0,e,"right",n,i),o.length>0&&this.calculateChildrenStack(t,o,0,0,e,"left",n,i),i}calculateChildrenStack(t,e,i,n,r,s,o,l){const g=e.reduce((c,m)=>c+this.getNodeHeight(m),0);let b=n-g/2;const u=80;let y=0;t.isRoot?y=s==="right"?i+o/2:i-o/2:s==="right"?y=i+o:y=i-o,e.forEach(c=>{const m=this.getNodeHeight(c),h=b+m/2,p=s==="right"?y+u:y-u,{width:f,height:w}=this.measureNode(c);if(l.nodes.push({nodeId:c.id,x:p,y:h,width:f,height:w,direction:s,isRoot:!1}),l.connections.push({fromX:y,fromY:n,toX:p,toY:h,toNodeId:c.id}),!c.presentation?.isFolded&&c.children.length>0){const _=s;let C=[],S=[];_==="left"?S=c.children:C=c.children,C.length>0&&this.calculateChildrenStack(c,C,p,h,r,"right",f,l),S.length>0&&this.calculateChildrenStack(c,S,p,h,r,"left",f,l)}b+=m})}getChildrenHeight(t){return t.children.reduce((e,i)=>e+this.getNodeHeight(i),0)}getNodeHeight(t){if(this.heightCache.has(t.id))return this.heightCache.get(t.id);const{height:e}=this.measureNode(t),i=20;if(t.children.length===0||t.presentation?.isFolded){const s=e+i;return this.heightCache.set(t.id,s),s}const n=this.getChildrenHeight(t),r=Math.max(e+i,n);return this.heightCache.set(t.id,r),r}measureNode(t){return this.measureFn(t)}}class se{container;overlay;paletteEl;inputEl;resultListEl;options;customCommands=[];results=[];selectedIndex=-1;mode="menu";menuCommands=[];ALL_MENU_COMMANDS=[{id:"icon",topic:"> Icon",type:"command"},{id:"search-nodes",topic:"> Search Nodes",type:"command"},{id:"import",topic:"> Import",type:"command"},{id:"export",topic:"> Export",type:"command"}];IMPORT_COMMANDS=[{id:"import-xmind",topic:"> XMind (.xmind)",type:"command"}];EXPORT_COMMANDS=[{id:"export-png",topic:"> PNG Image (.png)",type:"command"},{id:"export-svg",topic:"> SVG Image (.svg)",type:"command"},{id:"export-markdown",topic:"> Markdown (.md)",type:"command"}];ICON_LIST=[{id:"delete",topic:"🗑️ Delete",type:"icon"},{id:"blue_circle",topic:"Good",type:"icon"},{id:"red_circle",topic:"Bad",type:"icon"},{id:"question",topic:"Question",type:"icon"},{id:"important",topic:"Important",type:"icon"},{id:"check",topic:"Check",type:"icon"},{id:"cross",topic:"Cross",type:"icon"},{id:"flag",topic:"Flag",type:"icon"},{id:"idea",topic:"Idea",type:"icon"},{id:"warning",topic:"Warning",type:"icon"},{id:"schedule",topic:"Schedule",type:"icon"},{id:"num_0_blue",topic:"0-blue",type:"icon"},{id:"num_1_blue",topic:"1-blue",type:"icon"},{id:"num_2_blue",topic:"2-blue",type:"icon"},{id:"num_3_blue",topic:"3-blue",type:"icon"},{id:"num_4_blue",topic:"4-blue",type:"icon"},{id:"num_5_blue",topic:"5-blue",type:"icon"},{id:"num_6_blue",topic:"6-blue",type:"icon"},{id:"num_7_blue",topic:"7-blue",type:"icon"},{id:"num_8_blue",topic:"8-blue",type:"icon"},{id:"num_9_blue",topic:"9-blue",type:"icon"},{id:"num_0_red",topic:"0-red",type:"icon"},{id:"num_1_red",topic:"1-red",type:"icon"},{id:"num_2_red",topic:"2-red",type:"icon"},{id:"num_3_red",topic:"3-red",type:"icon"},{id:"num_4_red",topic:"4-red",type:"icon"},{id:"num_5_red",topic:"5-red",type:"icon"},{id:"num_6_red",topic:"6-red",type:"icon"},{id:"num_7_red",topic:"7-red",type:"icon"},{id:"num_8_red",topic:"8-red",type:"icon"},{id:"num_9_red",topic:"9-red",type:"icon"}];constructor(t,e){this.container=t,this.options=e;const i=e.disabledFeatures||[];this.menuCommands=this.ALL_MENU_COMMANDS.filter(n=>!(n.id==="icon"&&i.includes("icon")||n.id==="search-nodes"&&i.includes("search")||n.id==="import"&&i.includes("import")||n.id==="export"&&i.includes("export"))),this.overlay=this.createOverlay(),this.paletteEl=this.createPalette(),this.inputEl=this.paletteEl.querySelector("input"),this.resultListEl=this.paletteEl.querySelector("ul"),this.container.appendChild(this.overlay),this.container.appendChild(this.paletteEl)}createOverlay(){const t=document.createElement("div");return t.style.position="absolute",t.style.top="0",t.style.left="0",t.style.width="100%",t.style.height="100%",t.style.backgroundColor="rgba(0, 0, 0, 0.1)",t.style.zIndex="1999",t.style.display="none",t.addEventListener("click",()=>{this.close()}),t}createPalette(){const t=document.createElement("div");t.className="command-palette",t.style.position="absolute",t.style.top="20px",t.style.left="50%",t.style.transform="translateX(-50%)",t.style.width="400px",t.style.backgroundColor="white",t.style.borderRadius="8px",t.style.boxShadow="0 4px 12px rgba(0,0,0,0.1)",t.style.border="1px solid #eee",t.style.zIndex="2000",t.style.display="none",t.style.flexDirection="column",t.style.overflow="hidden",t.style.padding="8px",t.style.boxSizing="border-box",t.style.fontFamily="Arial, sans-serif";const e=document.createElement("input");e.type="text",e.placeholder="Type > to search commands...",e.style.width="100%",e.style.boxSizing="border-box",e.style.padding="4px 8px",e.style.height="32px",e.style.border="1px solid #ccc",e.style.borderRadius="4px",e.style.fontSize="14px",e.style.outline="none",e.style.marginBottom="0",e.addEventListener("input",n=>{const r=n.target.value;if(this.mode==="menu")this.renderList(this.getMenuResults(r));else if(this.mode==="import"){const s=this.IMPORT_COMMANDS.filter(o=>o.topic.toLowerCase().includes(r.toLowerCase()));this.renderList(s)}else if(this.mode==="export"){const s=this.EXPORT_COMMANDS.filter(o=>o.topic.toLowerCase().includes(r.toLowerCase()));this.renderList(s)}else if(this.mode==="icon"){const s=this.ICON_LIST.filter(o=>o.topic.toLowerCase().includes(r.toLowerCase()));this.renderList(s)}else this.options.onInput(r)}),e.addEventListener("keydown",n=>{n.key==="ArrowDown"?(n.preventDefault(),this.moveSelection(1)):n.key==="ArrowUp"?(n.preventDefault(),this.moveSelection(-1)):n.key==="Enter"?(n.preventDefault(),this.confirmSelection()):n.key==="Escape"?(n.preventDefault(),this.close()):n.key==="Backspace"&&this.inputEl.value===""&&(this.mode==="search"||this.mode==="icon"||this.mode==="import"||this.mode==="export")&&(this.mode="menu",this.inputEl.placeholder="Type to filter commands...",this.renderList(this.getMenuResults()))});const i=document.createElement("ul");return i.style.listStyle="none",i.style.margin="8px 0 0 0",i.style.padding="0",i.style.maxHeight="300px",i.style.overflowY="auto",i.style.display="none",i.style.borderTop="1px solid #eee",t.appendChild(e),t.appendChild(i),t}show(){this.mode="menu",this.overlay.style.display="block",this.paletteEl.style.display="flex",this.inputEl.value="",this.inputEl.placeholder="Type to filter commands...",this.inputEl.focus(),this.renderList(this.getMenuResults())}addCustomCommand(t){this.customCommands.push(t)}close(){this.overlay.style.display="none",this.paletteEl.style.display="none",this.options.onClose(),this.mode="menu"}toggle(){this.paletteEl.style.display==="none"?this.show():this.close()}setResults(t){this.mode==="search"&&this.renderList(t.map(e=>({...e,type:"node"})))}getMenuResults(t=""){const e=t.toLowerCase().trim(),i=this.menuCommands.filter(r=>r.topic.toLowerCase().includes(e)),n=this.customCommands.filter(r=>r.topic.toLowerCase().includes(e));return[...i,...n.map(r=>({...r,type:"custom"}))]}renderList(t){if(this.results=t,this.resultListEl.innerHTML="",this.selectedIndex=-1,t.length===0){if(this.inputEl.value.trim()!==""&&(this.mode==="search"||this.mode==="icon"||this.mode==="import"||this.mode==="export")){const e=document.createElement("li");e.textContent="No results found",e.style.padding="8px",e.style.color="#999",e.style.fontSize="12px",e.style.textAlign="center",this.resultListEl.appendChild(e),this.resultListEl.style.display="block"}else this.mode==="menu"&&t.length===0?this.resultListEl.style.display="none":this.resultListEl.style.display="none";return}this.resultListEl.style.display="block",t.forEach((e,i)=>{const n=document.createElement("li");if(n.style.borderBottom="1px solid #f9f9f9",e.type==="icon"&&e.id!=="delete"){n.style.display="flex",n.style.alignItems="center";const r=It[e.id];if(r){const o=document.createElement("div");o.style.width="20px",o.style.height="20px",o.style.marginRight="8px",o.style.flexShrink="0",o.innerHTML=`<svg viewBox="${r.viewBox}" width="20" height="20">${r.path}</svg>`,n.appendChild(o)}const s=document.createElement("span");s.textContent=e.topic,n.appendChild(s)}else n.textContent=e.topic;n.addEventListener("mouseenter",()=>{this.setSelectedIndex(i)}),n.addEventListener("click",()=>{this.selectItem(e)}),this.resultListEl.appendChild(n)}),t.length>0&&this.setSelectedIndex(0)}selectItem(t){if(t.type==="command")t.id==="search-nodes"?this.switchToSearchMode():t.id==="icon"?this.switchToIconMode():t.id==="import"?this.switchToImportMode():t.id==="export"?this.switchToExportMode():t.id==="import-xmind"?(this.options.onCommandSelect("import-xmind"),this.close()):t.id==="export-png"?(this.options.onCommandSelect("export-png"),this.close()):t.id==="export-svg"?(this.options.onCommandSelect("export-svg"),this.close()):t.id==="export-markdown"&&(this.options.onCommandSelect("export-markdown"),this.close());else if(t.type==="custom"){const e=this.customCommands.find(i=>i.id===t.id);if(e){const i=this.options.getSelectedNodeId?this.options.getSelectedNodeId():null;e.execute(i)}this.close()}else t.type==="icon"?(this.options.onIconSelect(t.id),this.close()):(this.options.onSelect(t.id),this.close())}switchToSearchMode(){this.mode="search",this.inputEl.value="",this.inputEl.placeholder="Search nodes...",this.renderList([]),this.resultListEl.style.display="none",this.inputEl.focus()}switchToIconMode(){this.mode="icon",this.inputEl.value="",this.inputEl.placeholder="Select icon...",this.renderList(this.ICON_LIST),this.inputEl.focus()}switchToImportMode(){this.mode="import",this.inputEl.value="",this.inputEl.placeholder="Select format...",this.renderList(this.IMPORT_COMMANDS),this.inputEl.focus()}switchToExportMode(){this.mode="export",this.inputEl.value="",this.inputEl.placeholder="Select format...",this.renderList(this.EXPORT_COMMANDS),this.inputEl.focus()}moveSelection(t){if(this.results.length===0)return;const e=Math.max(0,Math.min(this.results.length-1,this.selectedIndex+t));this.setSelectedIndex(e),this.scrollToSelected()}setSelectedIndex(t){this.selectedIndex=t;const e=this.resultListEl.children;for(let i=0;i<e.length;i++){const n=e[i];i===t?(n.style.backgroundColor="#007acc",n.style.color="white"):(n.style.backgroundColor="transparent",n.style.color="black")}}scrollToSelected(){const t=this.resultListEl.children;this.selectedIndex>=0&&this.selectedIndex<t.length&&t[this.selectedIndex].scrollIntoView({block:"nearest"})}confirmSelection(){this.selectedIndex>=0&&this.selectedIndex<this.results.length&&this.selectItem(this.results[this.selectedIndex])}}class oe{constructor(){}show(t,e,i){if(typeof document>"u")return;const n=document.createElement("div");n.style.position="fixed",n.style.top="0",n.style.left="0",n.style.width="100vw",n.style.height="100vh",n.style.backgroundColor="rgba(0,0,0,0.5)",n.style.zIndex="3000",n.style.display="flex",n.style.justifyContent="center",n.style.alignItems="center",n.style.opacity="0",n.style.transition="opacity 0.2s";const r=document.createElement("div");r.style.backgroundColor="white",r.style.padding="20px",r.style.borderRadius="8px",r.style.boxShadow="0 4px 6px rgba(0,0,0,0.1)",r.style.maxWidth="600px",r.style.width="90%",r.style.maxHeight="90vh",r.style.overflowY="auto",r.style.position="relative";const s=document.createElement("h2");s.textContent=e==="ja"?"ヘルプ":"Help",s.style.margin="0 0 15px 0",s.style.fontSize="1.5em",s.style.borderBottom="1px solid #eee",s.style.paddingBottom="10px",r.appendChild(s);const o=document.createElement("button");if(o.textContent="×",o.style.position="absolute",o.style.top="10px",o.style.right="15px",o.style.background="none",o.style.border="none",o.style.fontSize="24px",o.style.cursor="pointer",o.style.color="#999",o.addEventListener("click",()=>{g()}),r.appendChild(o),i){const u=document.createElement("h3");u.textContent=e==="ja"?"ツールバーアイコン":"Toolbar Icons",u.style.marginTop="10px",u.style.marginBottom="10px",u.style.fontSize="1.2em",u.style.color="#333",u.style.borderBottom="1px solid #f0f0f0",r.appendChild(u);const y=document.createElement("table");y.style.width="100%",y.style.borderCollapse="collapse",y.style.fontSize="0.9em",y.style.marginBottom="20px",i.getIconDescriptions(e).forEach(m=>{const h=document.createElement("tr");h.style.borderBottom="1px solid #f9f9f9";const p=document.createElement("td");p.style.padding="8px",p.style.width="40px",p.style.textAlign="center";let f="";switch(m.id){case"right":f=i.getRightIcon();break;case"left":f=i.getLeftIcon();break;case"both":f=i.getBothIcon();break;case"default":f=i.getThemeDefaultIcon();break;case"simple":f=i.getThemeSimpleIcon();break;case"colorful":f=i.getThemeColorfulIcon();break;case"custom":f=i.getThemeCustomIcon();break;case"resetZoom":f=i.getZoomResetIcon();break;case"help":f=i.getHelpIcon();break}const w=document.createElement("div");w.style.width="24px",w.style.height="24px",w.style.display="flex",w.style.alignItems="center",w.style.justifyContent="center",w.style.color="#555",w.innerHTML=f,p.appendChild(w);const _=document.createElement("td");_.textContent=m.desc,_.style.padding="8px",_.style.textAlign="left",_.style.color="#333",h.appendChild(p),h.appendChild(_),y.appendChild(h)}),r.appendChild(y)}[{title:e==="ja"?"一般":"General",actions:[{action:"openCommandPalette",desc:"Open Command Palette",descJa:"コマンドパレットを開く"},{action:"navUp",desc:"Move Selection Up",descJa:"ノード間の移動 (上)"},{action:"navDown",desc:"Move Selection Down",descJa:"ノード間の移動 (下)"},{action:"navLeft",desc:"Move Selection Left",descJa:"ノード間の移動 (左)"},{action:"navRight",desc:"Move Selection Right",descJa:"ノード間の移動 (右)"},{action:"beginEdit",desc:"Start Editing (Zoom if Image)",descJa:"ノードの編集を開始 (画像の場合はズーム)"},{action:"addSibling",desc:"Add Sibling (Below)",descJa:"兄弟ノードを追加 (下)"},{action:"addSiblingBefore",desc:"Add Sibling (Above)",descJa:"兄弟ノードを追加 (上)"},{action:"addChild",desc:"Add Child",descJa:"子ノードを追加"},{action:"insertParent",desc:"Insert Parent",descJa:"親ノードを挿入"},{action:"deleteNode",desc:"Delete Node",descJa:"ノードを削除"},{action:"undo",desc:"Undo",descJa:"元に戻す (Undo)"},{action:"redo",desc:"Redo",descJa:"やり直し (Redo)"},{action:"copy",desc:"Copy",descJa:"コピー"},{action:"cut",desc:"Cut",descJa:"切り取り"},{action:"paste",desc:"Paste",descJa:"貼り付け (画像も可)"},{action:"toggleFold",desc:"Toggle Fold",descJa:"ノードの展開/折り畳み"},{action:"zoomIn",desc:"Canvas Zoom In",descJa:"キャンバス拡大"},{action:"zoomOut",desc:"Canvas Zoom Out",descJa:"キャンバス縮小"},{action:"resetZoom",desc:"Reset Zoom",descJa:"ズームリセット"},{key:"Drag (Canvas)",desc:"Pan Board",descJa:"画面のパン (移動)"},{key:"Wheel",desc:"Vertical Scroll",descJa:"上下スクロール (パン)"},{key:"Shift + Wheel",desc:"Horizontal Scroll",descJa:"左右スクロール (パン)"},{key:"Ctrl/Cmd + Wheel",desc:"Zoom",descJa:"ズームイン/アウト"}]},{title:e==="ja"?"編集 (テキスト入力)":"Editing (Text Input)",actions:[{key:"Enter",desc:"Confirm Edit",descJa:"編集を確定"},{key:"Shift + Enter",desc:"New Line",descJa:"改行"},{key:"Esc",desc:"Cancel Edit",descJa:"編集をキャンセル"}]},{title:e==="ja"?"スタイリング (選択中)":"Styling (Selection)",actions:[{action:"bold",desc:"Toggle Bold",descJa:"太字 (Bold) 切り替え"},{action:"italic",desc:"Toggle Italic",descJa:"斜体 (Italic) 切り替え"},{action:"strikethrough",desc:"Toggle Strikethrough",descJa:"取り消し線 (Strikethrough) 切り替え"},{action:"selectColor1",desc:"Color 1",descJa:"ノードの色を変更 (1)"},{action:"selectColor2",desc:"Color 2",descJa:"ノードの色を変更 (2)"},{action:"selectColor3",desc:"Color 3",descJa:"ノードの色を変更 (3)"},{action:"selectColor4",desc:"Color 4",descJa:"ノードの色を変更 (4)"},{action:"selectColor5",desc:"Color 5",descJa:"ノードの色を変更 (5)"},{action:"selectColor6",desc:"Color 6",descJa:"ノードの色を変更 (6)"},{action:"selectColor7",desc:"Color 7",descJa:"ノードの色を変更 (7)"},{action:"increaseFontSize",desc:"Increase Font Size",descJa:"フォントサイズ拡大"},{action:"decreaseFontSize",desc:"Decrease Font Size",descJa:"フォントサイズ縮小"}]}].forEach(u=>{const y=[];if(u.actions.forEach(w=>{let _="";const C=w;if(C.key)_=C.key;else if(C.action&&t[C.action]){const S=t[C.action];if(S&&S.length>0){const z=S.map(B=>{const O=[];return(B.ctrlKey||B.metaKey)&&O.push("Ctrl/Cmd"),B.altKey&&O.push("Alt"),B.shiftKey&&O.push("Shift"),B.key===" "?O.push("Space"):O.push(B.key),O.join(" + ")});_=[...new Set(z)].join(" / ")}}_&&y.push({key:_,desc:e==="ja"&&C.descJa||C.desc})}),y.length===0)return;const c=document.createElement("h3");c.textContent=u.title,c.style.marginTop="20px",c.style.marginBottom="10px",c.style.fontSize="1.2em",c.style.color="#333",c.style.borderBottom="1px solid #f0f0f0",r.appendChild(c);const m=document.createElement("table");m.style.width="100%",m.style.borderCollapse="collapse",m.style.fontSize="0.9em";const h=document.createElement("tr");h.style.borderBottom="2px solid #ddd";const p=document.createElement("th");p.textContent=e==="ja"?"キー":"Key",p.style.textAlign="center",p.style.padding="8px 0",p.style.width="40%",p.style.color="#666";const f=document.createElement("th");f.textContent=e==="ja"?"説明":"Description",f.style.textAlign="center",f.style.padding="8px 0",f.style.color="#666",h.appendChild(p),h.appendChild(f),m.appendChild(h),y.forEach(w=>{const _=document.createElement("tr");_.style.borderBottom="1px solid #f9f9f9";const C=document.createElement("td");C.textContent=w.key,C.style.padding="6px 0",C.style.fontWeight="bold",C.style.color="#555",C.style.minWidth="180px",C.style.textAlign="center";const S=document.createElement("td");S.textContent=w.desc,S.style.padding="6px 0",S.style.textAlign="left",S.style.color="#333",_.appendChild(C),_.appendChild(S),m.appendChild(_)}),r.appendChild(m)}),n.appendChild(r),document.body.appendChild(n),requestAnimationFrame(()=>{n.style.opacity="1"});const g=()=>{n.style.opacity="0",setTimeout(()=>{document.body.contains(n)&&document.body.removeChild(n)},200),document.removeEventListener("keydown",b)},b=u=>{u.key==="Escape"&&g()};document.addEventListener("keydown",b),n.addEventListener("click",u=>{u.target===n&&g()})}}class ae{mindMap;service;renderer;eventBus;styleEditor;commandPalette;locale;interactionOrchestrator;layoutSwitcher;fileIOService;themeService;commandBus;historyService;clipboardService;searchService;viewportService;navigationService;anchorNodeId=null;selectedNodeId=null;selectedNodeIds=new Set;layoutMode="Right";isBatching=!1;maxWidth=-1;pendingNodeCreation=!1;constructor(t){this.mindMap=t.mindMap,this.service=t.service,this.renderer=t.renderer,this.styleEditor=t.styleEditor,this.eventBus=t.eventBus,this.fileIOService=t.fileIOService,this.themeService=t.themeService,this.historyService=t.historyService,this.clipboardService=t.clipboardService,this.searchService=t.searchService,this.viewportService=t.viewportService,this.navigationService=t.navigationService,this.locale=t.locale??"en",this.commandBus=t.commandBus,this.commandPalette=new se(this.renderer.container,{onInput:e=>this.handleSearchInput(e),onSelect:e=>this.handleSearchResultSelect(e),onIconSelect:e=>this.handleIconSelect(e),onCommandSelect:e=>this.handleCommandSelect(e),onClose:()=>{this.interactionOrchestrator&&this.interactionOrchestrator.focus()},getSelectedNodeId:()=>this.selectedNodeId,disabledFeatures:t.commandPaletteFeatures}),this.subscribeToCommands(),this.subscribeToModel()}subscribeToModel(){this.eventBus.on("model:change",()=>{this.render()})}subscribeToCommands(){const t=this.commandBus;t.on("addNode",e=>this.addChildNode(e.parentId)),t.on("addSibling",e=>this.addSiblingNode(e.nodeId,e.position)),t.on("deleteNode",e=>this.removeNode(e.nodeId)),t.on("insertParent",e=>this.insertParentNode(e.nodeId)),t.on("dropNode",e=>this.moveNode(e.draggedId,e.targetId,e.position)),t.on("updateNode",e=>this.updateNodeTopic(e.nodeId,e.topic)),t.on("navigate",e=>this.navigateNode(e.nodeId,e.direction,e.extendSelection)),t.on("pan",e=>this.panBoard(e.dx,e.dy)),t.on("zoom",e=>this.zoomBoard(e.delta,e.x,e.y)),t.on("zoomReset",()=>this.resetZoom()),t.on("copyNode",e=>this.copyNode(e.nodeId)),t.on("pasteNode",e=>this.pasteNode(e.parentId)),t.on("cutNode",e=>this.cutNode(e.nodeId)),t.on("pasteImage",e=>this.pasteImage(e.parentId,e.imageData,e.width,e.height)),t.on("undo",()=>this.undo()),t.on("redo",()=>this.redo()),t.on("styleAction",e=>this.onStyleAction(e.nodeId,e.action)),t.on("toggleFold",e=>this.toggleFold(e.nodeId)),t.on("toggleCommandPalette",()=>this.toggleCommandPalette()),t.on("updateNodeWidth",e=>this.updateNodeWidth(e.nodeId,e.increment)),t.on("setTheme",e=>this.setTheme(e.theme)),t.on("setLayoutMode",e=>this.setLayoutMode(e.mode)),t.on("editEnd",()=>this.onEditEnd()),t.on("selectNode",e=>{e.extendSelection&&e.nodeId?this.selectRangeTo(e.nodeId):this.selectNode(e.nodeId)})}setInteractionOrchestrator(t){this.interactionOrchestrator=t}setLayoutSwitcher(t){this.layoutSwitcher=t,this.themeService.setLayoutSwitcher(t)}init(t,e){this.viewportService.setInitialPan(t*.2,e/2),this.themeService.applyInitialTheme(),this.viewportService.startAnimationLoop(),this.render()}destroy(){this.viewportService.destroy()}getData(){const t=this.service.exportData();return t.selectedId=this.selectedNodeId||void 0,t.selectedIds=Array.from(this.selectedNodeIds),t}loadData(t){try{this.service.importData(t),this.render(),this.restoreSelection(t),this.eventBus.emit("model:load",t),t.theme&&this.setTheme(t.theme,{saveState:!1,emitChange:!1}),this.eventBus.emit("model:change",void 0)}catch(e){console.error("Failed to load data",e)}}batch(t){this.isBatching=!0;try{t()}finally{this.isBatching=!1,this.render()}}getSelectedNodeId(){return this.selectedNodeId}getSelectedNodeIds(){return Array.from(this.selectedNodeIds)}getIdsToActOn(t){return this.selectedNodeIds.has(t)?Array.from(this.selectedNodeIds):[t]}saveState(){if(this.isBatching)return;const t=this.getData();this.historyService.saveState(t)}addNode(t,e,i,n={emitChange:!0}){n.emitChange&&this.saveState(),this.eventBus.emit("command",{name:"addNode",args:{parentId:t,topic:e,layoutSide:i}});const r=this.service.addNode(t,e,i);return r&&(this.render(),this.eventBus.emit("node:add",{id:r.id,topic:r.topic}),n.emitChange&&this.eventBus.emit("model:change",void 0)),r}addSibling(t,e="after",i="New topic",n={emitChange:!0}){n.emitChange&&this.saveState(),this.eventBus.emit("command",{name:"addSibling",args:{referenceId:t,position:e,topic:i}});const r=this.mindMap.findNode(t);if(!r||!r.parentId)return null;const s=this.mindMap.findNode(r.parentId);s&&s.isRoot&&this.layoutMode==="Both"&&this.navigationService.ensureExplicitLayoutSides(s);const o=this.service.addSibling(t,e,i);if(o){if(s&&s.isRoot&&this.layoutMode==="Both"){const l=r.presentation.layoutSide||(s.children.indexOf(r)%2===0?"right":"left");o.presentation.layoutSide=l}this.render(),this.eventBus.emit("node:add",{id:o.id,topic:o.topic}),n.emitChange&&this.eventBus.emit("model:change",void 0)}return o}insertParent(t,e="New topic",i={emitChange:!0}){i.emitChange&&this.saveState(),this.eventBus.emit("command",{name:"insertParent",args:{targetId:t,topic:e}});const n=this.service.insertParent(t,e);return n&&(this.render(),this.eventBus.emit("node:add",{id:n.id,topic:n.topic}),i.emitChange&&this.eventBus.emit("model:change",void 0)),n}deleteNode(t){this.saveState(),this.eventBus.emit("command",{name:"deleteNode",args:{nodeId:t}});const e=this.getIdsToActOn(t);e.length>1?this.service.removeNodes(e)&&(this.render(),e.forEach(i=>this.eventBus.emit("node:remove",i)),this.eventBus.emit("model:change",void 0)):this.service.removeNode(t)&&(this.render(),this.eventBus.emit("node:remove",t),this.eventBus.emit("model:change",void 0))}updateNode(t,e){if(this.saveState(),this.eventBus.emit("command",{name:"updateNode",args:{nodeId:t,updates:e}}),this.interactionOrchestrator&&this.interactionOrchestrator.isReadOnlyState)return;let i=!1;const n=this.getIdsToActOn(t);if(e.topic!==void 0&&this.service.updateNodeTopic(t,e.topic)&&(i=!0),e.style!==void 0&&this.service.updateNodesStyle(n,e.style)&&(i=!0),e.icon!==void 0){let r=!1;n.forEach(s=>{this.service.updateNodeIcon(s,e.icon)&&(r=!0)}),r&&(i=!0)}i&&(this.render(),e.topic!==void 0&&this.eventBus.emit("node:update",{id:t,topic:e.topic}),this.eventBus.emit("model:change",void 0),this.pendingNodeCreation&&(this.pendingNodeCreation=!1))}updateNodeWidth(t,e){if(this.saveState(),this.eventBus.emit("command",{name:"updateNodeWidth",args:{nodeId:t,increment:e}}),this.interactionOrchestrator&&this.interactionOrchestrator.isReadOnlyState)return;const i=this.mindMap.findNode(t);if(!i)return;let n=i.presentation.customWidth;n===void 0&&(n=this.renderer.measureNode(i,this.mindMap).width);let r=n+e;r<50&&(r=50),this.service.updateNodeCustomWidth(t,r)&&(this.render(),this.eventBus.emit("model:change",void 0))}addChildNode(t){const e=this.mindMap.findNode(t);e&&e.isRoot&&this.layoutMode==="Both"&&this.navigationService.ensureExplicitLayoutSides(e);let i;if(this.layoutMode==="Both"&&e&&e.isRoot){let r=0,s=0;e.children.forEach((o,l)=>{(o.presentation.layoutSide||(l%2===0?"right":"left"))==="left"?r++:s++}),i=r<s?"left":"right"}this.pendingNodeCreation=!0;const n=this.addNode(t,"New topic",i,{emitChange:!1});n&&(this.selectNode(n.id),this.ensureNodeVisible(n.id,!1,!0),this.interactionOrchestrator.editNode(n.id))}addSiblingNode(t,e="after"){this.pendingNodeCreation=!0;const i=this.addSibling(t,e,"New topic",{emitChange:!1});i&&(this.selectNode(i.id),this.ensureNodeVisible(i.id,!1,!0),this.interactionOrchestrator.editNode(i.id))}insertParentNode(t){this.pendingNodeCreation=!0;const e=this.insertParent(t,"New topic",{emitChange:!1});e&&(this.selectNode(e.id),this.ensureNodeVisible(e.id,!1,!0),this.interactionOrchestrator.editNode(e.id))}removeNode(t){const e=this.getIdsToActOn(t),i=this.findTargetIdAfterRemoval(t,e);this.deleteNode(t),this.selectNode(i)}selectNode(t){this.anchorNodeId=null,!(this.selectedNodeId===t&&this.selectedNodeIds.size===1&&t&&this.selectedNodeIds.has(t))&&(t===null&&this.selectedNodeId===null&&this.selectedNodeIds.size===0||(this.selectedNodeId=t,this.selectedNodeIds.clear(),t&&this.selectedNodeIds.add(t),this.updateSelectionState()))}selectNodes(t){this.selectedNodeIds=new Set(t),this.selectedNodeId=t.length>0?t[t.length-1]:null,this.updateSelectionState()}updateSelectionState(){const t=this.selectedNodeId;if(this.interactionOrchestrator&&this.interactionOrchestrator.updateSelection(t),t){const e=this.mindMap.findNode(t);e&&(!e.image&&this.interactionOrchestrator&&!this.interactionOrchestrator.isReadOnlyState?this.styleEditor.show(t,e.style):this.styleEditor.hide())}else this.styleEditor.hide();this.renderSelection(),this.eventBus.emit("node:select",t),this.eventBus.emit("selection:change",Array.from(this.selectedNodeIds))}restoreSelection(t){t.selectedIds&&t.selectedIds.length>0?(this.selectNodes(t.selectedIds),this.ensureNodeVisible(t.selectedIds[0],!0,!0)):t.selectedId?(this.selectNode(t.selectedId),this.ensureNodeVisible(t.selectedId,!0,!0)):(this.selectNode(null),this.ensureNodeVisible(this.mindMap.root.id,!0,!0))}findTargetIdAfterRemoval(t,e){const i=this.mindMap.findNode(t);if(i){let n=i;for(;n&&n.parentId;){if(!e.includes(n.parentId))return n.parentId;n=this.mindMap.findNode(n.parentId)}}return this.mindMap.root.id}moveNode(t,e,i){this.saveState(),this.eventBus.emit("command",{name:"moveNode",args:{nodeId:t,targetId:e,position:i}});const n=this.mindMap.findNode(e);if(n){if(i==="top"){if(n.isRoot)return;this.service.reorderNode(t,e,"before")}else if(i==="bottom"){if(n.isRoot)return;this.service.reorderNode(t,e,"after")}else if(n.isRoot){const r=i==="left"?"left":"right";this.service.moveNode(t,e,r)}else((this.navigationService.getNodeDirection(n)==="right"?i==="right":i==="left")?"addChild":"insertParent")==="addChild"?this.service.moveNode(t,e):this.service.insertNodeAsParent(t,e);this.render(),this.eventBus.emit("node:move",{nodeId:t,newParentId:e,position:i}),this.eventBus.emit("model:change",void 0)}}updateNodeTopic(t,e){this.updateNode(t,{topic:e}),setTimeout(()=>this.ensureNodeVisible(t),0)}render(){if(this.isBatching)return;const e=new re(n=>this.renderer.measureNode(n,this.mindMap)).calculate(this.mindMap.root,this.layoutMode);let i;this.selectedNodeIds instanceof Set?i=this.selectedNodeIds:Array.isArray(this.selectedNodeIds)?i=new Set(this.selectedNodeIds):typeof this.selectedNodeIds=="string"?i=new Set([this.selectedNodeIds]):i=new Set,this.renderer.renderFromLayout(e,this.mindMap,i,this.layoutMode),this.viewportService.applyTransform()}renderSelection(){this.isBatching||(this.renderer.updateSelection(this.selectedNodeIds),this.viewportService.applyTransform())}setLayoutMode(t){this.eventBus.emit("command",{name:"setLayoutMode",args:{mode:t}}),this.layoutMode=t,this.navigationService.setLayoutMode(t),this.layoutSwitcher&&this.layoutSwitcher.setMode(t);const e=this.renderer.container.clientWidth,i=this.renderer.container.clientHeight;t==="Right"?this.viewportService.setInitialPan(e*.2,i/2):t==="Left"?this.viewportService.setInitialPan(e*.8,i/2):this.viewportService.setInitialPan(e*.5,i/2),this.render(),this.selectedNodeId?this.ensureNodeVisible(this.selectedNodeId,!0,!0):this.ensureNodeVisible(this.mindMap.root.id,!0,!0)}getLayoutMode(){return this.layoutMode}setMaxNodeWidth(t){this.maxWidth=t,this.renderer.maxWidth=t,this.interactionOrchestrator&&(this.interactionOrchestrator.maxWidth=t),this.render()}getMaxNodeWidth(){return this.maxWidth}updateGlobalStyles(t){this.themeService.updateGlobalStyles(t)}setTheme(t,e={saveState:!0,emitChange:!0}){this.themeService.setTheme(t,e)}resetZoom(){this.viewportService.resetZoom(),this.render()}panBoard(t,e){this.viewportService.pan(t,e)}zoomBoard(t,e,i){this.viewportService.zoom(t,e,i)}setReadOnly(t){this.interactionOrchestrator&&this.interactionOrchestrator.setReadOnly(t),t&&this.styleEditor.hide()}undo(){const t=this.getData(),e=this.historyService.undo(t);e&&(this.eventBus.emit("command",{name:"undo"}),this.loadData(e),this.render(),this.eventBus.emit("model:change",void 0))}redo(){const t=this.getData(),e=this.historyService.redo(t);e&&(this.eventBus.emit("command",{name:"redo"}),this.loadData(e),this.render(),this.eventBus.emit("model:change",void 0))}toggleFold(t){this.saveState(),this.service.toggleNodeFold(t)&&(this.eventBus.emit("command",{name:"toggleFold",args:{nodeId:t}}),this.render(),this.eventBus.emit("model:change",void 0))}navigateNode(t,e,i=!1){if(!t){this.selectNode(this.mindMap.root.id);return}if(!this.mindMap.findNode(t))return;const r=this.navigationService.navigate(t,e);r&&(i?this.selectRange(t,r):this.selectNode(r)),this.selectedNodeId&&this.selectedNodeId!==t&&setTimeout(()=>this.ensureNodeVisible(this.selectedNodeId,!0),0)}selectRangeTo(t){this.selectedNodeId?this.selectRange(this.selectedNodeId,t):this.selectNode(t)}selectRange(t,e){this.anchorNodeId||(this.anchorNodeId=t);const i=this.mindMap.findNode(this.anchorNodeId),n=this.mindMap.findNode(e);if(!i||!n)return;if(i.parentId&&i.parentId===n.parentId){const s=this.mindMap.findNode(i.parentId);if(s){const o=s.children.findIndex(g=>g.id===i.id),l=s.children.findIndex(g=>g.id===n.id);if(o!==-1&&l!==-1){const g=Math.min(o,l),b=Math.max(o,l),u=s.children.slice(g,b+1).map(y=>y.id);this.selectNodes(u),this.selectedNodeId=e,this.updateSelectionState();return}}}const r=new Set(this.selectedNodeIds);r.add(e),this.selectNodes(Array.from(r)),this.selectedNodeId=e,this.updateSelectionState()}copyNode(t){const e=this.getIdsToActOn(t);e.length>1?this.clipboardService.copyNodes(e):this.clipboardService.copyNodes([t])}pasteNode(t){this.saveState(),this.eventBus.emit("command",{name:"pasteNode",args:{parentId:t}});const e=this.clipboardService.createPastedNodes(t),i=e.length>0?e[0]:null;e.length>0&&this.service.addExistingNodes(t,e),i&&(this.render(),this.selectNode(i.id),this.eventBus.emit("node:add",{id:i.id,topic:i.topic}),this.eventBus.emit("model:change",void 0),setTimeout(()=>this.ensureNodeVisible(i.id,!0),0))}cutNode(t){this.saveState(),this.eventBus.emit("command",{name:"cutNode",args:{nodeId:t}});const e=this.getIdsToActOn(t),i=this.findTargetIdAfterRemoval(t,e);e.length>1?(this.clipboardService.copyNodes(e),this.service.removeNodes(e)):(this.clipboardService.copyNodes([t]),this.service.removeNode(t)),this.selectNode(i),this.render(),e.forEach(n=>this.eventBus.emit("node:remove",n)),this.eventBus.emit("model:change",void 0)}pasteImage(t,e,i,n){this.saveState(),this.eventBus.emit("command",{name:"pasteImage",args:{parentId:t,width:i,height:n}});const r=this.service.addImageNode(t,e,i,n);r&&(this.render(),this.selectNode(r.id),this.eventBus.emit("node:add",{id:r.id,topic:""}),this.eventBus.emit("model:change",void 0),setTimeout(()=>this.ensureNodeVisible(r.id,!0),0))}onEditEnd(){this.pendingNodeCreation&&(this.pendingNodeCreation=!1,this.eventBus.emit("model:change",void 0))}onStyleAction(t,e){if(this.saveState(),this.interactionOrchestrator&&this.interactionOrchestrator.isReadOnlyState)return;const i=this.mindMap.findNode(t);if(!i)return;const n=i.style||{};let r=null;if(e.type==="bold")r={fontWeight:n.fontWeight==="bold"?"normal":"bold"};else if(e.type==="italic")r={fontStyle:n.fontStyle==="italic"?"normal":"italic"};else if(e.type==="strikethrough")r={textDecoration:n.textDecoration==="line-through"?"none":"line-through"};else if(e.type==="color")e.index>=0&&e.index<vt.PALETTE.length&&(r={color:vt.PALETTE[e.index]});else if(e.type==="increaseSize"||e.type==="decreaseSize"){const s=vt.FONT_SIZES,o=n.fontSize||"";let l=s.findIndex(b=>b.value===o);l===-1&&(l=0);const g=e.type==="increaseSize"?Math.min(s.length-1,l+1):Math.max(0,l-1);g!==l&&(r={fontSize:s[g].value})}if(r){const s=this.getIdsToActOn(t);this.service.updateNodesStyle(s,r)&&(this.render(),this.eventBus.emit("model:change",void 0),this.selectedNodeId===t&&this.styleEditor.show(t,{...n,...r}))}}toggleCommandPalette(){this.interactionOrchestrator&&this.interactionOrchestrator.isReadOnlyState||this.commandPalette.toggle()}registerCommand(t){this.commandPalette.addCustomCommand(t)}searchNodes(t){return this.searchService.searchNodes(t)}handleSearchInput(t){const e=this.searchService.searchNodes(t);this.commandPalette.setResults(e.map(i=>({id:i.id,topic:i.topic})))}handleSearchResultSelect(t){this.selectNode(t),setTimeout(()=>this.ensureNodeVisible(t,!0,!0),0)}handleIconSelect(t){this.selectedNodeId&&(this.service.updateNodeIcon(this.selectedNodeId,t),this.render(),this.eventBus.emit("model:change",void 0),setTimeout(()=>this.ensureNodeVisible(this.selectedNodeId,!0,!0),0))}handleCommandSelect(t){t==="import-xmind"?this.fileIOService.importXMind().then(e=>{e&&this.loadData(e)}):t==="export-png"?this.fileIOService.exportPng():t==="export-svg"?this.fileIOService.exportSvg():t==="export-markdown"&&this.fileIOService.exportMarkdown()}ensureNodeVisible(t,e=!1,i=!1){this.viewportService.ensureNodeVisible(t,e,i)}showHelpModal(){if(!this.interactionOrchestrator||typeof document>"u")return;new oe().show(this.interactionOrchestrator.getShortcuts(),this.locale,this.layoutSwitcher)}}class de{panX=0;panY=0;targetPanX=0;targetPanY=0;scale=1;animationFrameId=null;renderer;constructor(t){this.renderer=t}getScale(){return this.scale}getPan(){return{x:this.panX,y:this.panY}}getTargetPan(){return{x:this.targetPanX,y:this.targetPanY}}setInitialPan(t,e){this.panX=t,this.panY=e,this.targetPanX=t,this.targetPanY=e}pan(t,e){this.targetPanX+=t,this.targetPanY+=e}zoom(t,e,i){const o=this.renderer.container.getBoundingClientRect(),l=e-o.left,g=i-o.top,b=Math.min(Math.max(this.scale*(1-t*.001),.1),5),u=l-(l-this.panX)*(b/this.scale),y=g-(g-this.panY)*(b/this.scale);this.panX=u,this.panY=y,this.targetPanX=u,this.targetPanY=y,this.scale=b,this.renderer.updateTransform(this.panX,this.panY,this.scale)}resetZoom(){const t=this.renderer.container.clientWidth/2,e=this.renderer.container.clientHeight/2,i=1;this.panX=t-(t-this.panX)*(i/this.scale),this.panY=e-(e-this.panY)*(i/this.scale),this.scale=i,this.targetPanX=this.panX,this.targetPanY=this.panY}applyTransform(){this.renderer.updateTransform(this.panX,this.panY,this.scale)}ensureNodeVisible(t,e=!1,i=!1){const n=this.renderer.container.querySelector(`.mindmap-node[data-id="${t}"]`);if(!n)return;const r=n.getBoundingClientRect(),s=this.renderer.container.getBoundingClientRect(),o=50;let l=0,g=0;const b=r.left<s.left+o,u=r.right>s.right-o,y=r.top<s.top+o,c=r.bottom>s.bottom-o;if(e&&(b||u||y||c)){const m=r.left+r.width/2,h=r.top+r.height/2,p=s.left+s.width/2,f=s.top+s.height/2;l=p-m,g=f-h}else b?l=s.left+o-r.left:u&&(l=s.right-o-r.right),y?g=s.top+o-r.top:c&&(g=s.bottom-o-r.bottom);(l!==0||g!==0)&&(i?(this.panX+=l,this.panY+=g,this.targetPanX=this.panX,this.targetPanY=this.panY,this.renderer.updateTransform(this.panX,this.panY,this.scale)):this.pan(l,g))}startAnimationLoop(){let t=performance.now();const e=()=>{const i=performance.now(),n=(i-t)/1e3;t=i;const r=1-Math.exp(-8*n),s=this.targetPanX-this.panX,o=this.targetPanY-this.panY;Math.abs(s)>.1||Math.abs(o)>.1?(this.panX+=s*r,this.panY+=o*r,this.renderer.updateTransform(this.panX,this.panY,this.scale)):(this.panX!==this.targetPanX||this.panY!==this.targetPanY)&&(this.panX=this.targetPanX,this.panY=this.targetPanY,this.renderer.updateTransform(this.panX,this.panY,this.scale)),Number.isNaN(this.panX)&&(this.panX=0),Number.isNaN(this.panY)&&(this.panY=0),this.animationFrameId=requestAnimationFrame(e)};e()}destroy(){this.animationFrameId!==null&&(cancelAnimationFrame(this.animationFrameId),this.animationFrameId=null)}}class le{mindMap;layoutMode="Right";constructor(t){this.mindMap=t}setLayoutMode(t){this.layoutMode=t}getLayoutMode(){return this.layoutMode}navigate(t,e){const i=this.mindMap.findNode(t);if(i)switch(e){case"Left":return this.navigateLeft(i);case"Right":return this.navigateRight(i);case"Up":return this.navigateUp(i);case"Down":return this.navigateDown(i)}}getNodeDirection(t){if(t.isRoot||this.layoutMode==="Right")return"right";if(this.layoutMode==="Left")return"left";let e=t;for(;e.parentId;){const i=this.mindMap.findNode(e.parentId);if(!i)break;if(i.isRoot)return e.presentation.layoutSide?e.presentation.layoutSide:i.children.findIndex(r=>r.id===e.id)%2===0?"right":"left";e=i}return"right"}ensureExplicitLayoutSides(t){!t.isRoot||this.layoutMode!=="Both"||t.children.forEach((e,i)=>{e.presentation.layoutSide||(e.presentation.layoutSide=i%2===0?"right":"left")})}navigateLeft(t){if(t.isRoot){if(this.layoutMode==="Left")return t.children.length>0?t.children[0].id:void 0;if(this.layoutMode==="Both"){const e=t.children.find((i,n)=>(i.presentation.layoutSide||(n%2!==0?"left":"right"))==="left");return e?e.id:void 0}}else if(t.parentId)return this.getNodeDirection(t)==="right"?t.parentId:t.children.length>0?t.children[0].id:void 0}navigateRight(t){if(t.isRoot){if(this.layoutMode==="Right")return t.children.length>0?t.children[0].id:void 0;if(this.layoutMode==="Both"){const e=t.children.find((i,n)=>(i.presentation.layoutSide||(n%2===0?"right":"left"))==="right");return e?e.id:void 0}}else if(t.parentId)return this.getNodeDirection(t)==="right"?t.children.length>0?t.children[0].id:void 0:t.parentId}navigateUp(t){if(t.parentId){const e=this.mindMap.findNode(t.parentId);if(e){const i=this.getNodeDirection(t),n=e.children.filter(s=>this.getNodeDirection(s)===i),r=n.findIndex(s=>s.id===t.id);if(r>0)return n[r-1].id}}}navigateDown(t){if(t.parentId){const e=this.mindMap.findNode(t.parentId);if(e){const i=this.getNodeDirection(t),n=e.children.filter(s=>this.getNodeDirection(s)===i),r=n.findIndex(s=>s.id===t.id);if(r!==-1&&r<n.length-1)return n[r+1].id}}}}class Bt{generate(t){const e=t.querySelectorAll("svg");let i=null;for(let X=0;X<e.length;X++){const k=e[X];if(k.style.zIndex==="0"&&k.style.position==="absolute"){i=k;break}}!i&&e.length>0&&e[0].parentElement===t&&(i=e[0]);const n=t.querySelectorAll("div");let r=null;for(let X=0;X<n.length;X++){const k=n[X];if(k.style.zIndex==="1"&&k.style.position==="absolute"){r=k;break}}if(!i||!r)throw new Error("Could not find mind map content layers.");let s=1/0,o=1/0,l=-1/0,g=-1/0;const b=r.children;if(b.length===0)s=0,o=0,l=800,g=600;else for(let X=0;X<b.length;X++){const k=b[X],D=parseFloat(k.style.left||"0"),d=parseFloat(k.style.top||"0"),R=k.offsetWidth,J=k.offsetHeight,W=d-J/2,tt=d+J/2;D<s&&(s=D),W<o&&(o=W),D+R>l&&(l=D+R),tt>g&&(g=tt)}const u=50;s-=u,o-=u,l+=u,g+=u;const y=l-s,c=g-o,m=window.getComputedStyle(t),h=["--mindmap-connection-color","--mindmap-root-color","--mindmap-child-color","--mindmap-root-border","--mindmap-child-border","--mindmap-root-background","--mindmap-child-background","--vscode-editor-foreground","--vscode-editor-background","--vscode-widget-border","--vscode-focusBorder"],p=[];h.forEach(X=>{const k=m.getPropertyValue(X).trim();k&&p.push(`${X}: ${k};`)});const f=p.join(" "),w=m.fontFamily,_=document.createElementNS("http://www.w3.org/2000/svg","svg");_.setAttribute("xmlns","http://www.w3.org/2000/svg"),_.setAttribute("width",y.toString()),_.setAttribute("height",c.toString()),_.setAttribute("viewBox",`0 0 ${y} ${c}`),_.style.cssText=f;const C=document.createElementNS("http://www.w3.org/2000/svg","rect");C.setAttribute("x","0"),C.setAttribute("y","0"),C.setAttribute("width",y.toString()),C.setAttribute("height",c.toString()),C.setAttribute("fill",m.backgroundColor||"#ffffff"),_.appendChild(C);const S=document.createElementNS("http://www.w3.org/2000/svg","g");S.setAttribute("transform",`translate(${-s}, ${-o})`),i.querySelectorAll("path").forEach(X=>{const k=X.cloneNode(!0),D=window.getComputedStyle(X);let d=D.stroke;(!d||d==="none")&&(d=X.style.stroke),(!d||d==="none")&&(d="#cccccc"),k.style.stroke=d;let R=D.strokeWidth;(!R||R==="0px"||R==="auto")&&(R=X.getAttribute("stroke-width")||"2px"),k.style.strokeWidth=R,k.style.fill="none",S.appendChild(k)});const B=document.createElementNS("http://www.w3.org/2000/svg","foreignObject");B.setAttribute("x","0"),B.setAttribute("y","0"),B.setAttribute("width",(l+u).toString()),B.setAttribute("height",(g+u).toString()),B.style.overflow="visible";const O=document.createElement("div");O.setAttribute("xmlns","http://www.w3.org/1999/xhtml"),O.style.cssText=`position: relative; width: 100%; height: 100%; font-family: ${w}; ${f}`;const A=r.children;for(let X=0;X<A.length;X++){const k=A[X].cloneNode(!0);O.appendChild(k)}return B.appendChild(O),S.appendChild(B),_.appendChild(S),new XMLSerializer().serializeToString(_)}}class Dt{async exportToSvg(t,e){try{const n=new Bt().generate(t),r=new Blob([n],{type:"image/svg+xml;charset=utf-8"});await this.saveFile(r,"mindmap.svg",[{description:"SVG File",accept:{"image/svg+xml":[".svg"]}}],e)}catch(i){i.name!=="AbortError"&&(console.error("Failed to export SVG:",i),alert("Failed to export SVG."))}}async exportToPng(t,e){try{const n=new Bt().generate(t),s=`data:image/svg+xml;base64,${btoa(unescape(encodeURIComponent(n)))}`;await new Promise((o,l)=>{const g=new Image;g.onload=()=>{try{const b=document.createElement("canvas");b.width=g.width,b.height=g.height;const u=b.getContext("2d");if(!u)throw new Error("Could not get canvas context");u.drawImage(g,0,0),b.toBlob(y=>{y?this.saveFile(y,"mindmap.png",[{description:"PNG Image",accept:{"image/png":[".png"]}}],e).then(()=>o()).catch(c=>l(c instanceof Error?c:new Error(String(c)))):l(new Error("Failed to generate PNG blob."))},"image/png")}catch(b){l(b instanceof Error?b:new Error(String(b)))}},g.onerror=()=>{l(new Error("Failed to load SVG for PNG conversion"))},g.src=s})}catch(i){i.name!=="AbortError"&&(console.error("Failed to export PNG:",i),alert("Failed to export PNG."))}}async showSavePicker(t){return typeof window.showSaveFilePicker!="function"?(alert("Your browser does not support the File System Access API required for saving files."),null):window.showSaveFilePicker(t)}async saveFile(t,e,i,n){if(n){const o=e.split(".").pop();await n.onExportFile(t,e,o);return}const r=await this.showSavePicker({suggestedName:e,types:i});if(!r)return;const s=await r.createWritable();await s.write(t),await s.close()}}class ce{async export(t,e){const i=this.generateMarkdown(t),n=new Blob([i],{type:"text/markdown;charset=utf-8"});await this.saveFile(n,"mindmap.md",e)}generateMarkdown(t){const e=t.root;if(!e)return"";const i=[];return this.processNode(e,0,i),i.join(`
|
|
56
|
+
`)}processNode(t,e,i){const n=this.getNodeText(t);if(e===0)i.push(`# ${n}`);else if(e===1)i.push(`## ${n}`);else{const r=" ".repeat(e-2);i.push(`${r}- ${n}`)}for(const r of t.children)this.processNode(r,e+1,i)}getNodeText(t){return t.image?"[image node]":t.topic}async saveFile(t,e,i){try{if(i){await i.onExportFile(t,e,"md");return}if(typeof window.showSaveFilePicker=="function"){const r=await(await window.showSaveFilePicker({suggestedName:e,types:[{description:"Markdown File",accept:{"text/markdown":[".md"]}}]})).createWritable();await r.write(t),await r.close()}else{const n=URL.createObjectURL(t),r=document.createElement("a");r.href=n,r.download=e,document.body.appendChild(r),r.click(),document.body.removeChild(r),URL.revokeObjectURL(n)}}catch(n){n.name!=="AbortError"&&(console.error("Failed to save file:",n),alert("Failed to save file."))}}}var St=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function he(Q){return Q&&Q.__esModule&&Object.prototype.hasOwnProperty.call(Q,"default")?Q.default:Q}function kt(Q){throw new Error('Could not dynamically require "'+Q+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var zt={exports:{}};var Rt;function ue(){return Rt||(Rt=1,(function(Q,t){(function(e){Q.exports=e()})(function(){return(function e(i,n,r){function s(g,b){if(!n[g]){if(!i[g]){var u=typeof kt=="function"&&kt;if(!b&&u)return u(g,!0);if(o)return o(g,!0);var y=new Error("Cannot find module '"+g+"'");throw y.code="MODULE_NOT_FOUND",y}var c=n[g]={exports:{}};i[g][0].call(c.exports,function(m){var h=i[g][1][m];return s(h||m)},c,c.exports,e,i,n,r)}return n[g].exports}for(var o=typeof kt=="function"&&kt,l=0;l<r.length;l++)s(r[l]);return s})({1:[function(e,i,n){var r=e("./utils"),s=e("./support"),o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";n.encode=function(l){for(var g,b,u,y,c,m,h,p=[],f=0,w=l.length,_=w,C=r.getTypeOf(l)!=="string";f<l.length;)_=w-f,u=C?(g=l[f++],b=f<w?l[f++]:0,f<w?l[f++]:0):(g=l.charCodeAt(f++),b=f<w?l.charCodeAt(f++):0,f<w?l.charCodeAt(f++):0),y=g>>2,c=(3&g)<<4|b>>4,m=1<_?(15&b)<<2|u>>6:64,h=2<_?63&u:64,p.push(o.charAt(y)+o.charAt(c)+o.charAt(m)+o.charAt(h));return p.join("")},n.decode=function(l){var g,b,u,y,c,m,h=0,p=0,f="data:";if(l.substr(0,f.length)===f)throw new Error("Invalid base64 input, it looks like a data url.");var w,_=3*(l=l.replace(/[^A-Za-z0-9+/=]/g,"")).length/4;if(l.charAt(l.length-1)===o.charAt(64)&&_--,l.charAt(l.length-2)===o.charAt(64)&&_--,_%1!=0)throw new Error("Invalid base64 input, bad content length.");for(w=s.uint8array?new Uint8Array(0|_):new Array(0|_);h<l.length;)g=o.indexOf(l.charAt(h++))<<2|(y=o.indexOf(l.charAt(h++)))>>4,b=(15&y)<<4|(c=o.indexOf(l.charAt(h++)))>>2,u=(3&c)<<6|(m=o.indexOf(l.charAt(h++))),w[p++]=g,c!==64&&(w[p++]=b),m!==64&&(w[p++]=u);return w}},{"./support":30,"./utils":32}],2:[function(e,i,n){var r=e("./external"),s=e("./stream/DataWorker"),o=e("./stream/Crc32Probe"),l=e("./stream/DataLengthProbe");function g(b,u,y,c,m){this.compressedSize=b,this.uncompressedSize=u,this.crc32=y,this.compression=c,this.compressedContent=m}g.prototype={getContentWorker:function(){var b=new s(r.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new l("data_length")),u=this;return b.on("end",function(){if(this.streamInfo.data_length!==u.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),b},getCompressedWorker:function(){return new s(r.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},g.createWorkerFrom=function(b,u,y){return b.pipe(new o).pipe(new l("uncompressedSize")).pipe(u.compressWorker(y)).pipe(new l("compressedSize")).withStreamInfo("compression",u)},i.exports=g},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(e,i,n){var r=e("./stream/GenericWorker");n.STORE={magic:"\0\0",compressWorker:function(){return new r("STORE compression")},uncompressWorker:function(){return new r("STORE decompression")}},n.DEFLATE=e("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(e,i,n){var r=e("./utils"),s=(function(){for(var o,l=[],g=0;g<256;g++){o=g;for(var b=0;b<8;b++)o=1&o?3988292384^o>>>1:o>>>1;l[g]=o}return l})();i.exports=function(o,l){return o!==void 0&&o.length?r.getTypeOf(o)!=="string"?(function(g,b,u,y){var c=s,m=y+u;g^=-1;for(var h=y;h<m;h++)g=g>>>8^c[255&(g^b[h])];return-1^g})(0|l,o,o.length,0):(function(g,b,u,y){var c=s,m=y+u;g^=-1;for(var h=y;h<m;h++)g=g>>>8^c[255&(g^b.charCodeAt(h))];return-1^g})(0|l,o,o.length,0):0}},{"./utils":32}],5:[function(e,i,n){n.base64=!1,n.binary=!1,n.dir=!1,n.createFolders=!0,n.date=null,n.compression=null,n.compressionOptions=null,n.comment=null,n.unixPermissions=null,n.dosPermissions=null},{}],6:[function(e,i,n){var r=null;r=typeof Promise<"u"?Promise:e("lie"),i.exports={Promise:r}},{lie:37}],7:[function(e,i,n){var r=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",s=e("pako"),o=e("./utils"),l=e("./stream/GenericWorker"),g=r?"uint8array":"array";function b(u,y){l.call(this,"FlateWorker/"+u),this._pako=null,this._pakoAction=u,this._pakoOptions=y,this.meta={}}n.magic="\b\0",o.inherits(b,l),b.prototype.processChunk=function(u){this.meta=u.meta,this._pako===null&&this._createPako(),this._pako.push(o.transformTo(g,u.data),!1)},b.prototype.flush=function(){l.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},b.prototype.cleanUp=function(){l.prototype.cleanUp.call(this),this._pako=null},b.prototype._createPako=function(){this._pako=new s[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var u=this;this._pako.onData=function(y){u.push({data:y,meta:u.meta})}},n.compressWorker=function(u){return new b("Deflate",u)},n.uncompressWorker=function(){return new b("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(e,i,n){function r(c,m){var h,p="";for(h=0;h<m;h++)p+=String.fromCharCode(255&c),c>>>=8;return p}function s(c,m,h,p,f,w){var _,C,S=c.file,z=c.compression,B=w!==g.utf8encode,O=o.transformTo("string",w(S.name)),A=o.transformTo("string",g.utf8encode(S.name)),H=S.comment,X=o.transformTo("string",w(H)),k=o.transformTo("string",g.utf8encode(H)),D=A.length!==S.name.length,d=k.length!==H.length,R="",J="",W="",tt=S.dir,U=S.date,q={crc32:0,compressedSize:0,uncompressedSize:0};m&&!h||(q.crc32=c.crc32,q.compressedSize=c.compressedSize,q.uncompressedSize=c.uncompressedSize);var M=0;m&&(M|=8),B||!D&&!d||(M|=2048);var I=0,V=0;tt&&(I|=16),f==="UNIX"?(V=798,I|=(function(K,st){var lt=K;return K||(lt=st?16893:33204),(65535<)<<16})(S.unixPermissions,tt)):(V=20,I|=(function(K){return 63&(K||0)})(S.dosPermissions)),_=U.getUTCHours(),_<<=6,_|=U.getUTCMinutes(),_<<=5,_|=U.getUTCSeconds()/2,C=U.getUTCFullYear()-1980,C<<=4,C|=U.getUTCMonth()+1,C<<=5,C|=U.getUTCDate(),D&&(J=r(1,1)+r(b(O),4)+A,R+="up"+r(J.length,2)+J),d&&(W=r(1,1)+r(b(X),4)+k,R+="uc"+r(W.length,2)+W);var Y="";return Y+=`
|
|
57
|
+
\0`,Y+=r(M,2),Y+=z.magic,Y+=r(_,2),Y+=r(C,2),Y+=r(q.crc32,4),Y+=r(q.compressedSize,4),Y+=r(q.uncompressedSize,4),Y+=r(O.length,2),Y+=r(R.length,2),{fileRecord:u.LOCAL_FILE_HEADER+Y+O+R,dirRecord:u.CENTRAL_FILE_HEADER+r(V,2)+Y+r(X.length,2)+"\0\0\0\0"+r(I,4)+r(p,4)+O+R+X}}var o=e("../utils"),l=e("../stream/GenericWorker"),g=e("../utf8"),b=e("../crc32"),u=e("../signature");function y(c,m,h,p){l.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=m,this.zipPlatform=h,this.encodeFileName=p,this.streamFiles=c,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}o.inherits(y,l),y.prototype.push=function(c){var m=c.meta.percent||0,h=this.entriesCount,p=this._sources.length;this.accumulate?this.contentBuffer.push(c):(this.bytesWritten+=c.data.length,l.prototype.push.call(this,{data:c.data,meta:{currentFile:this.currentFile,percent:h?(m+100*(h-p-1))/h:100}}))},y.prototype.openedSource=function(c){this.currentSourceOffset=this.bytesWritten,this.currentFile=c.file.name;var m=this.streamFiles&&!c.file.dir;if(m){var h=s(c,m,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:h.fileRecord,meta:{percent:0}})}else this.accumulate=!0},y.prototype.closedSource=function(c){this.accumulate=!1;var m=this.streamFiles&&!c.file.dir,h=s(c,m,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(h.dirRecord),m)this.push({data:(function(p){return u.DATA_DESCRIPTOR+r(p.crc32,4)+r(p.compressedSize,4)+r(p.uncompressedSize,4)})(c),meta:{percent:100}});else for(this.push({data:h.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},y.prototype.flush=function(){for(var c=this.bytesWritten,m=0;m<this.dirRecords.length;m++)this.push({data:this.dirRecords[m],meta:{percent:100}});var h=this.bytesWritten-c,p=(function(f,w,_,C,S){var z=o.transformTo("string",S(C));return u.CENTRAL_DIRECTORY_END+"\0\0\0\0"+r(f,2)+r(f,2)+r(w,4)+r(_,4)+r(z.length,2)+z})(this.dirRecords.length,h,c,this.zipComment,this.encodeFileName);this.push({data:p,meta:{percent:100}})},y.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()},y.prototype.registerPrevious=function(c){this._sources.push(c);var m=this;return c.on("data",function(h){m.processChunk(h)}),c.on("end",function(){m.closedSource(m.previous.streamInfo),m._sources.length?m.prepareNextSource():m.end()}),c.on("error",function(h){m.error(h)}),this},y.prototype.resume=function(){return!!l.prototype.resume.call(this)&&(!this.previous&&this._sources.length?(this.prepareNextSource(),!0):this.previous||this._sources.length||this.generatedError?void 0:(this.end(),!0))},y.prototype.error=function(c){var m=this._sources;if(!l.prototype.error.call(this,c))return!1;for(var h=0;h<m.length;h++)try{m[h].error(c)}catch{}return!0},y.prototype.lock=function(){l.prototype.lock.call(this);for(var c=this._sources,m=0;m<c.length;m++)c[m].lock()},i.exports=y},{"../crc32":4,"../signature":23,"../stream/GenericWorker":28,"../utf8":31,"../utils":32}],9:[function(e,i,n){var r=e("../compressions"),s=e("./ZipFileWorker");n.generateWorker=function(o,l,g){var b=new s(l.streamFiles,g,l.platform,l.encodeFileName),u=0;try{o.forEach(function(y,c){u++;var m=(function(w,_){var C=w||_,S=r[C];if(!S)throw new Error(C+" is not a valid compression method !");return S})(c.options.compression,l.compression),h=c.options.compressionOptions||l.compressionOptions||{},p=c.dir,f=c.date;c._compressWorker(m,h).withStreamInfo("file",{name:y,dir:p,date:f,comment:c.comment||"",unixPermissions:c.unixPermissions,dosPermissions:c.dosPermissions}).pipe(b)}),b.entriesCount=u}catch(y){b.error(y)}return b}},{"../compressions":3,"./ZipFileWorker":8}],10:[function(e,i,n){function r(){if(!(this instanceof r))return new r;if(arguments.length)throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");this.files=Object.create(null),this.comment=null,this.root="",this.clone=function(){var s=new r;for(var o in this)typeof this[o]!="function"&&(s[o]=this[o]);return s}}(r.prototype=e("./object")).loadAsync=e("./load"),r.support=e("./support"),r.defaults=e("./defaults"),r.version="3.10.1",r.loadAsync=function(s,o){return new r().loadAsync(s,o)},r.external=e("./external"),i.exports=r},{"./defaults":5,"./external":6,"./load":11,"./object":15,"./support":30}],11:[function(e,i,n){var r=e("./utils"),s=e("./external"),o=e("./utf8"),l=e("./zipEntries"),g=e("./stream/Crc32Probe"),b=e("./nodejsUtils");function u(y){return new s.Promise(function(c,m){var h=y.decompressed.getContentWorker().pipe(new g);h.on("error",function(p){m(p)}).on("end",function(){h.streamInfo.crc32!==y.decompressed.crc32?m(new Error("Corrupted zip : CRC32 mismatch")):c()}).resume()})}i.exports=function(y,c){var m=this;return c=r.extend(c||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:o.utf8decode}),b.isNode&&b.isStream(y)?s.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):r.prepareContent("the loaded zip file",y,!0,c.optimizedBinaryString,c.base64).then(function(h){var p=new l(c);return p.load(h),p}).then(function(h){var p=[s.Promise.resolve(h)],f=h.files;if(c.checkCRC32)for(var w=0;w<f.length;w++)p.push(u(f[w]));return s.Promise.all(p)}).then(function(h){for(var p=h.shift(),f=p.files,w=0;w<f.length;w++){var _=f[w],C=_.fileNameStr,S=r.resolve(_.fileNameStr);m.file(S,_.decompressed,{binary:!0,optimizedBinaryString:!0,date:_.date,dir:_.dir,comment:_.fileCommentStr.length?_.fileCommentStr:null,unixPermissions:_.unixPermissions,dosPermissions:_.dosPermissions,createFolders:c.createFolders}),_.dir||(m.file(S).unsafeOriginalName=C)}return p.zipComment.length&&(m.comment=p.zipComment),m})}},{"./external":6,"./nodejsUtils":14,"./stream/Crc32Probe":25,"./utf8":31,"./utils":32,"./zipEntries":33}],12:[function(e,i,n){var r=e("../utils"),s=e("../stream/GenericWorker");function o(l,g){s.call(this,"Nodejs stream input adapter for "+l),this._upstreamEnded=!1,this._bindStream(g)}r.inherits(o,s),o.prototype._bindStream=function(l){var g=this;(this._stream=l).pause(),l.on("data",function(b){g.push({data:b,meta:{percent:0}})}).on("error",function(b){g.isPaused?this.generatedError=b:g.error(b)}).on("end",function(){g.isPaused?g._upstreamEnded=!0:g.end()})},o.prototype.pause=function(){return!!s.prototype.pause.call(this)&&(this._stream.pause(),!0)},o.prototype.resume=function(){return!!s.prototype.resume.call(this)&&(this._upstreamEnded?this.end():this._stream.resume(),!0)},i.exports=o},{"../stream/GenericWorker":28,"../utils":32}],13:[function(e,i,n){var r=e("readable-stream").Readable;function s(o,l,g){r.call(this,l),this._helper=o;var b=this;o.on("data",function(u,y){b.push(u)||b._helper.pause(),g&&g(y)}).on("error",function(u){b.emit("error",u)}).on("end",function(){b.push(null)})}e("../utils").inherits(s,r),s.prototype._read=function(){this._helper.resume()},i.exports=s},{"../utils":32,"readable-stream":16}],14:[function(e,i,n){i.exports={isNode:typeof Buffer<"u",newBufferFrom:function(r,s){if(Buffer.from&&Buffer.from!==Uint8Array.from)return Buffer.from(r,s);if(typeof r=="number")throw new Error('The "data" argument must not be a number');return new Buffer(r,s)},allocBuffer:function(r){if(Buffer.alloc)return Buffer.alloc(r);var s=new Buffer(r);return s.fill(0),s},isBuffer:function(r){return Buffer.isBuffer(r)},isStream:function(r){return r&&typeof r.on=="function"&&typeof r.pause=="function"&&typeof r.resume=="function"}}},{}],15:[function(e,i,n){function r(S,z,B){var O,A=o.getTypeOf(z),H=o.extend(B||{},b);H.date=H.date||new Date,H.compression!==null&&(H.compression=H.compression.toUpperCase()),typeof H.unixPermissions=="string"&&(H.unixPermissions=parseInt(H.unixPermissions,8)),H.unixPermissions&&16384&H.unixPermissions&&(H.dir=!0),H.dosPermissions&&16&H.dosPermissions&&(H.dir=!0),H.dir&&(S=f(S)),H.createFolders&&(O=p(S))&&w.call(this,O,!0);var X=A==="string"&&H.binary===!1&&H.base64===!1;B&&B.binary!==void 0||(H.binary=!X),(z instanceof u&&z.uncompressedSize===0||H.dir||!z||z.length===0)&&(H.base64=!1,H.binary=!0,z="",H.compression="STORE",A="string");var k=null;k=z instanceof u||z instanceof l?z:m.isNode&&m.isStream(z)?new h(S,z):o.prepareContent(S,z,H.binary,H.optimizedBinaryString,H.base64);var D=new y(S,k,H);this.files[S]=D}var s=e("./utf8"),o=e("./utils"),l=e("./stream/GenericWorker"),g=e("./stream/StreamHelper"),b=e("./defaults"),u=e("./compressedObject"),y=e("./zipObject"),c=e("./generate"),m=e("./nodejsUtils"),h=e("./nodejs/NodejsStreamInputAdapter"),p=function(S){S.slice(-1)==="/"&&(S=S.substring(0,S.length-1));var z=S.lastIndexOf("/");return 0<z?S.substring(0,z):""},f=function(S){return S.slice(-1)!=="/"&&(S+="/"),S},w=function(S,z){return z=z!==void 0?z:b.createFolders,S=f(S),this.files[S]||r.call(this,S,null,{dir:!0,createFolders:z}),this.files[S]};function _(S){return Object.prototype.toString.call(S)==="[object RegExp]"}var C={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(S){var z,B,O;for(z in this.files)O=this.files[z],(B=z.slice(this.root.length,z.length))&&z.slice(0,this.root.length)===this.root&&S(B,O)},filter:function(S){var z=[];return this.forEach(function(B,O){S(B,O)&&z.push(O)}),z},file:function(S,z,B){if(arguments.length!==1)return S=this.root+S,r.call(this,S,z,B),this;if(_(S)){var O=S;return this.filter(function(H,X){return!X.dir&&O.test(H)})}var A=this.files[this.root+S];return A&&!A.dir?A:null},folder:function(S){if(!S)return this;if(_(S))return this.filter(function(A,H){return H.dir&&S.test(A)});var z=this.root+S,B=w.call(this,z),O=this.clone();return O.root=B.name,O},remove:function(S){S=this.root+S;var z=this.files[S];if(z||(S.slice(-1)!=="/"&&(S+="/"),z=this.files[S]),z&&!z.dir)delete this.files[S];else for(var B=this.filter(function(A,H){return H.name.slice(0,S.length)===S}),O=0;O<B.length;O++)delete this.files[B[O].name];return this},generate:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(S){var z,B={};try{if((B=o.extend(S||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:s.utf8encode})).type=B.type.toLowerCase(),B.compression=B.compression.toUpperCase(),B.type==="binarystring"&&(B.type="string"),!B.type)throw new Error("No output type specified.");o.checkSupport(B.type),B.platform!=="darwin"&&B.platform!=="freebsd"&&B.platform!=="linux"&&B.platform!=="sunos"||(B.platform="UNIX"),B.platform==="win32"&&(B.platform="DOS");var O=B.comment||this.comment||"";z=c.generateWorker(this,B,O)}catch(A){(z=new l("error")).error(A)}return new g(z,B.type||"string",B.mimeType)},generateAsync:function(S,z){return this.generateInternalStream(S).accumulate(z)},generateNodeStream:function(S,z){return(S=S||{}).type||(S.type="nodebuffer"),this.generateInternalStream(S).toNodejsStream(z)}};i.exports=C},{"./compressedObject":2,"./defaults":5,"./generate":9,"./nodejs/NodejsStreamInputAdapter":12,"./nodejsUtils":14,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31,"./utils":32,"./zipObject":35}],16:[function(e,i,n){i.exports=e("stream")},{stream:void 0}],17:[function(e,i,n){var r=e("./DataReader");function s(o){r.call(this,o);for(var l=0;l<this.data.length;l++)o[l]=255&o[l]}e("../utils").inherits(s,r),s.prototype.byteAt=function(o){return this.data[this.zero+o]},s.prototype.lastIndexOfSignature=function(o){for(var l=o.charCodeAt(0),g=o.charCodeAt(1),b=o.charCodeAt(2),u=o.charCodeAt(3),y=this.length-4;0<=y;--y)if(this.data[y]===l&&this.data[y+1]===g&&this.data[y+2]===b&&this.data[y+3]===u)return y-this.zero;return-1},s.prototype.readAndCheckSignature=function(o){var l=o.charCodeAt(0),g=o.charCodeAt(1),b=o.charCodeAt(2),u=o.charCodeAt(3),y=this.readData(4);return l===y[0]&&g===y[1]&&b===y[2]&&u===y[3]},s.prototype.readData=function(o){if(this.checkOffset(o),o===0)return[];var l=this.data.slice(this.zero+this.index,this.zero+this.index+o);return this.index+=o,l},i.exports=s},{"../utils":32,"./DataReader":18}],18:[function(e,i,n){var r=e("../utils");function s(o){this.data=o,this.length=o.length,this.index=0,this.zero=0}s.prototype={checkOffset:function(o){this.checkIndex(this.index+o)},checkIndex:function(o){if(this.length<this.zero+o||o<0)throw new Error("End of data reached (data length = "+this.length+", asked index = "+o+"). Corrupted zip ?")},setIndex:function(o){this.checkIndex(o),this.index=o},skip:function(o){this.setIndex(this.index+o)},byteAt:function(){},readInt:function(o){var l,g=0;for(this.checkOffset(o),l=this.index+o-1;l>=this.index;l--)g=(g<<8)+this.byteAt(l);return this.index+=o,g},readString:function(o){return r.transformTo("string",this.readData(o))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var o=this.readInt(4);return new Date(Date.UTC(1980+(o>>25&127),(o>>21&15)-1,o>>16&31,o>>11&31,o>>5&63,(31&o)<<1))}},i.exports=s},{"../utils":32}],19:[function(e,i,n){var r=e("./Uint8ArrayReader");function s(o){r.call(this,o)}e("../utils").inherits(s,r),s.prototype.readData=function(o){this.checkOffset(o);var l=this.data.slice(this.zero+this.index,this.zero+this.index+o);return this.index+=o,l},i.exports=s},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(e,i,n){var r=e("./DataReader");function s(o){r.call(this,o)}e("../utils").inherits(s,r),s.prototype.byteAt=function(o){return this.data.charCodeAt(this.zero+o)},s.prototype.lastIndexOfSignature=function(o){return this.data.lastIndexOf(o)-this.zero},s.prototype.readAndCheckSignature=function(o){return o===this.readData(4)},s.prototype.readData=function(o){this.checkOffset(o);var l=this.data.slice(this.zero+this.index,this.zero+this.index+o);return this.index+=o,l},i.exports=s},{"../utils":32,"./DataReader":18}],21:[function(e,i,n){var r=e("./ArrayReader");function s(o){r.call(this,o)}e("../utils").inherits(s,r),s.prototype.readData=function(o){if(this.checkOffset(o),o===0)return new Uint8Array(0);var l=this.data.subarray(this.zero+this.index,this.zero+this.index+o);return this.index+=o,l},i.exports=s},{"../utils":32,"./ArrayReader":17}],22:[function(e,i,n){var r=e("../utils"),s=e("../support"),o=e("./ArrayReader"),l=e("./StringReader"),g=e("./NodeBufferReader"),b=e("./Uint8ArrayReader");i.exports=function(u){var y=r.getTypeOf(u);return r.checkSupport(y),y!=="string"||s.uint8array?y==="nodebuffer"?new g(u):s.uint8array?new b(r.transformTo("uint8array",u)):new o(r.transformTo("array",u)):new l(u)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(e,i,n){n.LOCAL_FILE_HEADER="PK",n.CENTRAL_FILE_HEADER="PK",n.CENTRAL_DIRECTORY_END="PK",n.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",n.ZIP64_CENTRAL_DIRECTORY_END="PK",n.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(e,i,n){var r=e("./GenericWorker"),s=e("../utils");function o(l){r.call(this,"ConvertWorker to "+l),this.destType=l}s.inherits(o,r),o.prototype.processChunk=function(l){this.push({data:s.transformTo(this.destType,l.data),meta:l.meta})},i.exports=o},{"../utils":32,"./GenericWorker":28}],25:[function(e,i,n){var r=e("./GenericWorker"),s=e("../crc32");function o(){r.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}e("../utils").inherits(o,r),o.prototype.processChunk=function(l){this.streamInfo.crc32=s(l.data,this.streamInfo.crc32||0),this.push(l)},i.exports=o},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(e,i,n){var r=e("../utils"),s=e("./GenericWorker");function o(l){s.call(this,"DataLengthProbe for "+l),this.propName=l,this.withStreamInfo(l,0)}r.inherits(o,s),o.prototype.processChunk=function(l){if(l){var g=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=g+l.data.length}s.prototype.processChunk.call(this,l)},i.exports=o},{"../utils":32,"./GenericWorker":28}],27:[function(e,i,n){var r=e("../utils"),s=e("./GenericWorker");function o(l){s.call(this,"DataWorker");var g=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,l.then(function(b){g.dataIsReady=!0,g.data=b,g.max=b&&b.length||0,g.type=r.getTypeOf(b),g.isPaused||g._tickAndRepeat()},function(b){g.error(b)})}r.inherits(o,s),o.prototype.cleanUp=function(){s.prototype.cleanUp.call(this),this.data=null},o.prototype.resume=function(){return!!s.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,r.delay(this._tickAndRepeat,[],this)),!0)},o.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(r.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},o.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var l=null,g=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":l=this.data.substring(this.index,g);break;case"uint8array":l=this.data.subarray(this.index,g);break;case"array":case"nodebuffer":l=this.data.slice(this.index,g)}return this.index=g,this.push({data:l,meta:{percent:this.max?this.index/this.max*100:0}})},i.exports=o},{"../utils":32,"./GenericWorker":28}],28:[function(e,i,n){function r(s){this.name=s||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}r.prototype={push:function(s){this.emit("data",s)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(s){this.emit("error",s)}return!0},error:function(s){return!this.isFinished&&(this.isPaused?this.generatedError=s:(this.isFinished=!0,this.emit("error",s),this.previous&&this.previous.error(s),this.cleanUp()),!0)},on:function(s,o){return this._listeners[s].push(o),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(s,o){if(this._listeners[s])for(var l=0;l<this._listeners[s].length;l++)this._listeners[s][l].call(this,o)},pipe:function(s){return s.registerPrevious(this)},registerPrevious:function(s){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.streamInfo=s.streamInfo,this.mergeStreamInfo(),this.previous=s;var o=this;return s.on("data",function(l){o.processChunk(l)}),s.on("end",function(){o.end()}),s.on("error",function(l){o.error(l)}),this},pause:function(){return!this.isPaused&&!this.isFinished&&(this.isPaused=!0,this.previous&&this.previous.pause(),!0)},resume:function(){if(!this.isPaused||this.isFinished)return!1;var s=this.isPaused=!1;return this.generatedError&&(this.error(this.generatedError),s=!0),this.previous&&this.previous.resume(),!s},flush:function(){},processChunk:function(s){this.push(s)},withStreamInfo:function(s,o){return this.extraStreamInfo[s]=o,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var s in this.extraStreamInfo)Object.prototype.hasOwnProperty.call(this.extraStreamInfo,s)&&(this.streamInfo[s]=this.extraStreamInfo[s])},lock:function(){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.isLocked=!0,this.previous&&this.previous.lock()},toString:function(){var s="Worker "+this.name;return this.previous?this.previous+" -> "+s:s}},i.exports=r},{}],29:[function(e,i,n){var r=e("../utils"),s=e("./ConvertWorker"),o=e("./GenericWorker"),l=e("../base64"),g=e("../support"),b=e("../external"),u=null;if(g.nodestream)try{u=e("../nodejs/NodejsStreamOutputAdapter")}catch{}function y(m,h){return new b.Promise(function(p,f){var w=[],_=m._internalType,C=m._outputType,S=m._mimeType;m.on("data",function(z,B){w.push(z),h&&h(B)}).on("error",function(z){w=[],f(z)}).on("end",function(){try{var z=(function(B,O,A){switch(B){case"blob":return r.newBlob(r.transformTo("arraybuffer",O),A);case"base64":return l.encode(O);default:return r.transformTo(B,O)}})(C,(function(B,O){var A,H=0,X=null,k=0;for(A=0;A<O.length;A++)k+=O[A].length;switch(B){case"string":return O.join("");case"array":return Array.prototype.concat.apply([],O);case"uint8array":for(X=new Uint8Array(k),A=0;A<O.length;A++)X.set(O[A],H),H+=O[A].length;return X;case"nodebuffer":return Buffer.concat(O);default:throw new Error("concat : unsupported type '"+B+"'")}})(_,w),S);p(z)}catch(B){f(B)}w=[]}).resume()})}function c(m,h,p){var f=h;switch(h){case"blob":case"arraybuffer":f="uint8array";break;case"base64":f="string"}try{this._internalType=f,this._outputType=h,this._mimeType=p,r.checkSupport(f),this._worker=m.pipe(new s(f)),m.lock()}catch(w){this._worker=new o("error"),this._worker.error(w)}}c.prototype={accumulate:function(m){return y(this,m)},on:function(m,h){var p=this;return m==="data"?this._worker.on(m,function(f){h.call(p,f.data,f.meta)}):this._worker.on(m,function(){r.delay(h,arguments,p)}),this},resume:function(){return r.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(m){if(r.checkSupport("nodestream"),this._outputType!=="nodebuffer")throw new Error(this._outputType+" is not supported by this method");return new u(this,{objectMode:this._outputType!=="nodebuffer"},m)}},i.exports=c},{"../base64":1,"../external":6,"../nodejs/NodejsStreamOutputAdapter":13,"../support":30,"../utils":32,"./ConvertWorker":24,"./GenericWorker":28}],30:[function(e,i,n){if(n.base64=!0,n.array=!0,n.string=!0,n.arraybuffer=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u",n.nodebuffer=typeof Buffer<"u",n.uint8array=typeof Uint8Array<"u",typeof ArrayBuffer>"u")n.blob=!1;else{var r=new ArrayBuffer(0);try{n.blob=new Blob([r],{type:"application/zip"}).size===0}catch{try{var s=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);s.append(r),n.blob=s.getBlob("application/zip").size===0}catch{n.blob=!1}}}try{n.nodestream=!!e("readable-stream").Readable}catch{n.nodestream=!1}},{"readable-stream":16}],31:[function(e,i,n){for(var r=e("./utils"),s=e("./support"),o=e("./nodejsUtils"),l=e("./stream/GenericWorker"),g=new Array(256),b=0;b<256;b++)g[b]=252<=b?6:248<=b?5:240<=b?4:224<=b?3:192<=b?2:1;g[254]=g[254]=1;function u(){l.call(this,"utf-8 decode"),this.leftOver=null}function y(){l.call(this,"utf-8 encode")}n.utf8encode=function(c){return s.nodebuffer?o.newBufferFrom(c,"utf-8"):(function(m){var h,p,f,w,_,C=m.length,S=0;for(w=0;w<C;w++)(64512&(p=m.charCodeAt(w)))==55296&&w+1<C&&(64512&(f=m.charCodeAt(w+1)))==56320&&(p=65536+(p-55296<<10)+(f-56320),w++),S+=p<128?1:p<2048?2:p<65536?3:4;for(h=s.uint8array?new Uint8Array(S):new Array(S),w=_=0;_<S;w++)(64512&(p=m.charCodeAt(w)))==55296&&w+1<C&&(64512&(f=m.charCodeAt(w+1)))==56320&&(p=65536+(p-55296<<10)+(f-56320),w++),p<128?h[_++]=p:(p<2048?h[_++]=192|p>>>6:(p<65536?h[_++]=224|p>>>12:(h[_++]=240|p>>>18,h[_++]=128|p>>>12&63),h[_++]=128|p>>>6&63),h[_++]=128|63&p);return h})(c)},n.utf8decode=function(c){return s.nodebuffer?r.transformTo("nodebuffer",c).toString("utf-8"):(function(m){var h,p,f,w,_=m.length,C=new Array(2*_);for(h=p=0;h<_;)if((f=m[h++])<128)C[p++]=f;else if(4<(w=g[f]))C[p++]=65533,h+=w-1;else{for(f&=w===2?31:w===3?15:7;1<w&&h<_;)f=f<<6|63&m[h++],w--;1<w?C[p++]=65533:f<65536?C[p++]=f:(f-=65536,C[p++]=55296|f>>10&1023,C[p++]=56320|1023&f)}return C.length!==p&&(C.subarray?C=C.subarray(0,p):C.length=p),r.applyFromCharCode(C)})(c=r.transformTo(s.uint8array?"uint8array":"array",c))},r.inherits(u,l),u.prototype.processChunk=function(c){var m=r.transformTo(s.uint8array?"uint8array":"array",c.data);if(this.leftOver&&this.leftOver.length){if(s.uint8array){var h=m;(m=new Uint8Array(h.length+this.leftOver.length)).set(this.leftOver,0),m.set(h,this.leftOver.length)}else m=this.leftOver.concat(m);this.leftOver=null}var p=(function(w,_){var C;for((_=_||w.length)>w.length&&(_=w.length),C=_-1;0<=C&&(192&w[C])==128;)C--;return C<0||C===0?_:C+g[w[C]]>_?C:_})(m),f=m;p!==m.length&&(s.uint8array?(f=m.subarray(0,p),this.leftOver=m.subarray(p,m.length)):(f=m.slice(0,p),this.leftOver=m.slice(p,m.length))),this.push({data:n.utf8decode(f),meta:c.meta})},u.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:n.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},n.Utf8DecodeWorker=u,r.inherits(y,l),y.prototype.processChunk=function(c){this.push({data:n.utf8encode(c.data),meta:c.meta})},n.Utf8EncodeWorker=y},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(e,i,n){var r=e("./support"),s=e("./base64"),o=e("./nodejsUtils"),l=e("./external");function g(h){return h}function b(h,p){for(var f=0;f<h.length;++f)p[f]=255&h.charCodeAt(f);return p}e("setimmediate"),n.newBlob=function(h,p){n.checkSupport("blob");try{return new Blob([h],{type:p})}catch{try{var f=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);return f.append(h),f.getBlob(p)}catch{throw new Error("Bug : can't construct the Blob.")}}};var u={stringifyByChunk:function(h,p,f){var w=[],_=0,C=h.length;if(C<=f)return String.fromCharCode.apply(null,h);for(;_<C;)p==="array"||p==="nodebuffer"?w.push(String.fromCharCode.apply(null,h.slice(_,Math.min(_+f,C)))):w.push(String.fromCharCode.apply(null,h.subarray(_,Math.min(_+f,C)))),_+=f;return w.join("")},stringifyByChar:function(h){for(var p="",f=0;f<h.length;f++)p+=String.fromCharCode(h[f]);return p},applyCanBeUsed:{uint8array:(function(){try{return r.uint8array&&String.fromCharCode.apply(null,new Uint8Array(1)).length===1}catch{return!1}})(),nodebuffer:(function(){try{return r.nodebuffer&&String.fromCharCode.apply(null,o.allocBuffer(1)).length===1}catch{return!1}})()}};function y(h){var p=65536,f=n.getTypeOf(h),w=!0;if(f==="uint8array"?w=u.applyCanBeUsed.uint8array:f==="nodebuffer"&&(w=u.applyCanBeUsed.nodebuffer),w)for(;1<p;)try{return u.stringifyByChunk(h,f,p)}catch{p=Math.floor(p/2)}return u.stringifyByChar(h)}function c(h,p){for(var f=0;f<h.length;f++)p[f]=h[f];return p}n.applyFromCharCode=y;var m={};m.string={string:g,array:function(h){return b(h,new Array(h.length))},arraybuffer:function(h){return m.string.uint8array(h).buffer},uint8array:function(h){return b(h,new Uint8Array(h.length))},nodebuffer:function(h){return b(h,o.allocBuffer(h.length))}},m.array={string:y,array:g,arraybuffer:function(h){return new Uint8Array(h).buffer},uint8array:function(h){return new Uint8Array(h)},nodebuffer:function(h){return o.newBufferFrom(h)}},m.arraybuffer={string:function(h){return y(new Uint8Array(h))},array:function(h){return c(new Uint8Array(h),new Array(h.byteLength))},arraybuffer:g,uint8array:function(h){return new Uint8Array(h)},nodebuffer:function(h){return o.newBufferFrom(new Uint8Array(h))}},m.uint8array={string:y,array:function(h){return c(h,new Array(h.length))},arraybuffer:function(h){return h.buffer},uint8array:g,nodebuffer:function(h){return o.newBufferFrom(h)}},m.nodebuffer={string:y,array:function(h){return c(h,new Array(h.length))},arraybuffer:function(h){return m.nodebuffer.uint8array(h).buffer},uint8array:function(h){return c(h,new Uint8Array(h.length))},nodebuffer:g},n.transformTo=function(h,p){if(p=p||"",!h)return p;n.checkSupport(h);var f=n.getTypeOf(p);return m[f][h](p)},n.resolve=function(h){for(var p=h.split("/"),f=[],w=0;w<p.length;w++){var _=p[w];_==="."||_===""&&w!==0&&w!==p.length-1||(_===".."?f.pop():f.push(_))}return f.join("/")},n.getTypeOf=function(h){return typeof h=="string"?"string":Object.prototype.toString.call(h)==="[object Array]"?"array":r.nodebuffer&&o.isBuffer(h)?"nodebuffer":r.uint8array&&h instanceof Uint8Array?"uint8array":r.arraybuffer&&h instanceof ArrayBuffer?"arraybuffer":void 0},n.checkSupport=function(h){if(!r[h.toLowerCase()])throw new Error(h+" is not supported by this platform")},n.MAX_VALUE_16BITS=65535,n.MAX_VALUE_32BITS=-1,n.pretty=function(h){var p,f,w="";for(f=0;f<(h||"").length;f++)w+="\\x"+((p=h.charCodeAt(f))<16?"0":"")+p.toString(16).toUpperCase();return w},n.delay=function(h,p,f){setImmediate(function(){h.apply(f||null,p||[])})},n.inherits=function(h,p){function f(){}f.prototype=p.prototype,h.prototype=new f},n.extend=function(){var h,p,f={};for(h=0;h<arguments.length;h++)for(p in arguments[h])Object.prototype.hasOwnProperty.call(arguments[h],p)&&f[p]===void 0&&(f[p]=arguments[h][p]);return f},n.prepareContent=function(h,p,f,w,_){return l.Promise.resolve(p).then(function(C){return r.blob&&(C instanceof Blob||["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(C))!==-1)&&typeof FileReader<"u"?new l.Promise(function(S,z){var B=new FileReader;B.onload=function(O){S(O.target.result)},B.onerror=function(O){z(O.target.error)},B.readAsArrayBuffer(C)}):C}).then(function(C){var S=n.getTypeOf(C);return S?(S==="arraybuffer"?C=n.transformTo("uint8array",C):S==="string"&&(_?C=s.decode(C):f&&w!==!0&&(C=(function(z){return b(z,r.uint8array?new Uint8Array(z.length):new Array(z.length))})(C))),C):l.Promise.reject(new Error("Can't read the data of '"+h+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))})}},{"./base64":1,"./external":6,"./nodejsUtils":14,"./support":30,setimmediate:54}],33:[function(e,i,n){var r=e("./reader/readerFor"),s=e("./utils"),o=e("./signature"),l=e("./zipEntry"),g=e("./support");function b(u){this.files=[],this.loadOptions=u}b.prototype={checkSignature:function(u){if(!this.reader.readAndCheckSignature(u)){this.reader.index-=4;var y=this.reader.readString(4);throw new Error("Corrupted zip or bug: unexpected signature ("+s.pretty(y)+", expected "+s.pretty(u)+")")}},isSignature:function(u,y){var c=this.reader.index;this.reader.setIndex(u);var m=this.reader.readString(4)===y;return this.reader.setIndex(c),m},readBlockEndOfCentral:function(){this.diskNumber=this.reader.readInt(2),this.diskWithCentralDirStart=this.reader.readInt(2),this.centralDirRecordsOnThisDisk=this.reader.readInt(2),this.centralDirRecords=this.reader.readInt(2),this.centralDirSize=this.reader.readInt(4),this.centralDirOffset=this.reader.readInt(4),this.zipCommentLength=this.reader.readInt(2);var u=this.reader.readData(this.zipCommentLength),y=g.uint8array?"uint8array":"array",c=s.transformTo(y,u);this.zipComment=this.loadOptions.decodeFileName(c)},readBlockZip64EndOfCentral:function(){this.zip64EndOfCentralSize=this.reader.readInt(8),this.reader.skip(4),this.diskNumber=this.reader.readInt(4),this.diskWithCentralDirStart=this.reader.readInt(4),this.centralDirRecordsOnThisDisk=this.reader.readInt(8),this.centralDirRecords=this.reader.readInt(8),this.centralDirSize=this.reader.readInt(8),this.centralDirOffset=this.reader.readInt(8),this.zip64ExtensibleData={};for(var u,y,c,m=this.zip64EndOfCentralSize-44;0<m;)u=this.reader.readInt(2),y=this.reader.readInt(4),c=this.reader.readData(y),this.zip64ExtensibleData[u]={id:u,length:y,value:c}},readBlockZip64EndOfCentralLocator:function(){if(this.diskWithZip64CentralDirStart=this.reader.readInt(4),this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8),this.disksCount=this.reader.readInt(4),1<this.disksCount)throw new Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var u,y;for(u=0;u<this.files.length;u++)y=this.files[u],this.reader.setIndex(y.localHeaderOffset),this.checkSignature(o.LOCAL_FILE_HEADER),y.readLocalPart(this.reader),y.handleUTF8(),y.processAttributes()},readCentralDir:function(){var u;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(o.CENTRAL_FILE_HEADER);)(u=new l({zip64:this.zip64},this.loadOptions)).readCentralPart(this.reader),this.files.push(u);if(this.centralDirRecords!==this.files.length&&this.centralDirRecords!==0&&this.files.length===0)throw new Error("Corrupted zip or bug: expected "+this.centralDirRecords+" records in central dir, got "+this.files.length)},readEndOfCentral:function(){var u=this.reader.lastIndexOfSignature(o.CENTRAL_DIRECTORY_END);if(u<0)throw this.isSignature(0,o.LOCAL_FILE_HEADER)?new Error("Corrupted zip: can't find end of central directory"):new Error("Can't find end of central directory : is this a zip file ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html");this.reader.setIndex(u);var y=u;if(this.checkSignature(o.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===s.MAX_VALUE_16BITS||this.diskWithCentralDirStart===s.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===s.MAX_VALUE_16BITS||this.centralDirRecords===s.MAX_VALUE_16BITS||this.centralDirSize===s.MAX_VALUE_32BITS||this.centralDirOffset===s.MAX_VALUE_32BITS){if(this.zip64=!0,(u=this.reader.lastIndexOfSignature(o.ZIP64_CENTRAL_DIRECTORY_LOCATOR))<0)throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex(u),this.checkSignature(o.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,o.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(o.ZIP64_CENTRAL_DIRECTORY_END),this.relativeOffsetEndOfZip64CentralDir<0))throw new Error("Corrupted zip: can't find the ZIP64 end of central directory");this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir),this.checkSignature(o.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var c=this.centralDirOffset+this.centralDirSize;this.zip64&&(c+=20,c+=12+this.zip64EndOfCentralSize);var m=y-c;if(0<m)this.isSignature(y,o.CENTRAL_FILE_HEADER)||(this.reader.zero=m);else if(m<0)throw new Error("Corrupted zip: missing "+Math.abs(m)+" bytes.")},prepareReader:function(u){this.reader=r(u)},load:function(u){this.prepareReader(u),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}},i.exports=b},{"./reader/readerFor":22,"./signature":23,"./support":30,"./utils":32,"./zipEntry":34}],34:[function(e,i,n){var r=e("./reader/readerFor"),s=e("./utils"),o=e("./compressedObject"),l=e("./crc32"),g=e("./utf8"),b=e("./compressions"),u=e("./support");function y(c,m){this.options=c,this.loadOptions=m}y.prototype={isEncrypted:function(){return(1&this.bitFlag)==1},useUTF8:function(){return(2048&this.bitFlag)==2048},readLocalPart:function(c){var m,h;if(c.skip(22),this.fileNameLength=c.readInt(2),h=c.readInt(2),this.fileName=c.readData(this.fileNameLength),c.skip(h),this.compressedSize===-1||this.uncompressedSize===-1)throw new Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)");if((m=(function(p){for(var f in b)if(Object.prototype.hasOwnProperty.call(b,f)&&b[f].magic===p)return b[f];return null})(this.compressionMethod))===null)throw new Error("Corrupted zip : compression "+s.pretty(this.compressionMethod)+" unknown (inner file : "+s.transformTo("string",this.fileName)+")");this.decompressed=new o(this.compressedSize,this.uncompressedSize,this.crc32,m,c.readData(this.compressedSize))},readCentralPart:function(c){this.versionMadeBy=c.readInt(2),c.skip(2),this.bitFlag=c.readInt(2),this.compressionMethod=c.readString(2),this.date=c.readDate(),this.crc32=c.readInt(4),this.compressedSize=c.readInt(4),this.uncompressedSize=c.readInt(4);var m=c.readInt(2);if(this.extraFieldsLength=c.readInt(2),this.fileCommentLength=c.readInt(2),this.diskNumberStart=c.readInt(2),this.internalFileAttributes=c.readInt(2),this.externalFileAttributes=c.readInt(4),this.localHeaderOffset=c.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");c.skip(m),this.readExtraFields(c),this.parseZIP64ExtraField(c),this.fileComment=c.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var c=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),c==0&&(this.dosPermissions=63&this.externalFileAttributes),c==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var c=r(this.extraFields[1].value);this.uncompressedSize===s.MAX_VALUE_32BITS&&(this.uncompressedSize=c.readInt(8)),this.compressedSize===s.MAX_VALUE_32BITS&&(this.compressedSize=c.readInt(8)),this.localHeaderOffset===s.MAX_VALUE_32BITS&&(this.localHeaderOffset=c.readInt(8)),this.diskNumberStart===s.MAX_VALUE_32BITS&&(this.diskNumberStart=c.readInt(4))}},readExtraFields:function(c){var m,h,p,f=c.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});c.index+4<f;)m=c.readInt(2),h=c.readInt(2),p=c.readData(h),this.extraFields[m]={id:m,length:h,value:p};c.setIndex(f)},handleUTF8:function(){var c=u.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=g.utf8decode(this.fileName),this.fileCommentStr=g.utf8decode(this.fileComment);else{var m=this.findExtraFieldUnicodePath();if(m!==null)this.fileNameStr=m;else{var h=s.transformTo(c,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(h)}var p=this.findExtraFieldUnicodeComment();if(p!==null)this.fileCommentStr=p;else{var f=s.transformTo(c,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(f)}}},findExtraFieldUnicodePath:function(){var c=this.extraFields[28789];if(c){var m=r(c.value);return m.readInt(1)!==1||l(this.fileName)!==m.readInt(4)?null:g.utf8decode(m.readData(c.length-5))}return null},findExtraFieldUnicodeComment:function(){var c=this.extraFields[25461];if(c){var m=r(c.value);return m.readInt(1)!==1||l(this.fileComment)!==m.readInt(4)?null:g.utf8decode(m.readData(c.length-5))}return null}},i.exports=y},{"./compressedObject":2,"./compressions":3,"./crc32":4,"./reader/readerFor":22,"./support":30,"./utf8":31,"./utils":32}],35:[function(e,i,n){function r(m,h,p){this.name=m,this.dir=p.dir,this.date=p.date,this.comment=p.comment,this.unixPermissions=p.unixPermissions,this.dosPermissions=p.dosPermissions,this._data=h,this._dataBinary=p.binary,this.options={compression:p.compression,compressionOptions:p.compressionOptions}}var s=e("./stream/StreamHelper"),o=e("./stream/DataWorker"),l=e("./utf8"),g=e("./compressedObject"),b=e("./stream/GenericWorker");r.prototype={internalStream:function(m){var h=null,p="string";try{if(!m)throw new Error("No output type specified.");var f=(p=m.toLowerCase())==="string"||p==="text";p!=="binarystring"&&p!=="text"||(p="string"),h=this._decompressWorker();var w=!this._dataBinary;w&&!f&&(h=h.pipe(new l.Utf8EncodeWorker)),!w&&f&&(h=h.pipe(new l.Utf8DecodeWorker))}catch(_){(h=new b("error")).error(_)}return new s(h,p,"")},async:function(m,h){return this.internalStream(m).accumulate(h)},nodeStream:function(m,h){return this.internalStream(m||"nodebuffer").toNodejsStream(h)},_compressWorker:function(m,h){if(this._data instanceof g&&this._data.compression.magic===m.magic)return this._data.getCompressedWorker();var p=this._decompressWorker();return this._dataBinary||(p=p.pipe(new l.Utf8EncodeWorker)),g.createWorkerFrom(p,m,h)},_decompressWorker:function(){return this._data instanceof g?this._data.getContentWorker():this._data instanceof b?this._data:new o(this._data)}};for(var u=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],y=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},c=0;c<u.length;c++)r.prototype[u[c]]=y;i.exports=r},{"./compressedObject":2,"./stream/DataWorker":27,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31}],36:[function(e,i,n){(function(r){var s,o,l=r.MutationObserver||r.WebKitMutationObserver;if(l){var g=0,b=new l(m),u=r.document.createTextNode("");b.observe(u,{characterData:!0}),s=function(){u.data=g=++g%2}}else if(r.setImmediate||r.MessageChannel===void 0)s="document"in r&&"onreadystatechange"in r.document.createElement("script")?function(){var h=r.document.createElement("script");h.onreadystatechange=function(){m(),h.onreadystatechange=null,h.parentNode.removeChild(h),h=null},r.document.documentElement.appendChild(h)}:function(){setTimeout(m,0)};else{var y=new r.MessageChannel;y.port1.onmessage=m,s=function(){y.port2.postMessage(0)}}var c=[];function m(){var h,p;o=!0;for(var f=c.length;f;){for(p=c,c=[],h=-1;++h<f;)p[h]();f=c.length}o=!1}i.exports=function(h){c.push(h)!==1||o||s()}}).call(this,typeof St<"u"?St:typeof self<"u"?self:typeof window<"u"?window:{})},{}],37:[function(e,i,n){var r=e("immediate");function s(){}var o={},l=["REJECTED"],g=["FULFILLED"],b=["PENDING"];function u(f){if(typeof f!="function")throw new TypeError("resolver must be a function");this.state=b,this.queue=[],this.outcome=void 0,f!==s&&h(this,f)}function y(f,w,_){this.promise=f,typeof w=="function"&&(this.onFulfilled=w,this.callFulfilled=this.otherCallFulfilled),typeof _=="function"&&(this.onRejected=_,this.callRejected=this.otherCallRejected)}function c(f,w,_){r(function(){var C;try{C=w(_)}catch(S){return o.reject(f,S)}C===f?o.reject(f,new TypeError("Cannot resolve promise with itself")):o.resolve(f,C)})}function m(f){var w=f&&f.then;if(f&&(typeof f=="object"||typeof f=="function")&&typeof w=="function")return function(){w.apply(f,arguments)}}function h(f,w){var _=!1;function C(B){_||(_=!0,o.reject(f,B))}function S(B){_||(_=!0,o.resolve(f,B))}var z=p(function(){w(S,C)});z.status==="error"&&C(z.value)}function p(f,w){var _={};try{_.value=f(w),_.status="success"}catch(C){_.status="error",_.value=C}return _}(i.exports=u).prototype.finally=function(f){if(typeof f!="function")return this;var w=this.constructor;return this.then(function(_){return w.resolve(f()).then(function(){return _})},function(_){return w.resolve(f()).then(function(){throw _})})},u.prototype.catch=function(f){return this.then(null,f)},u.prototype.then=function(f,w){if(typeof f!="function"&&this.state===g||typeof w!="function"&&this.state===l)return this;var _=new this.constructor(s);return this.state!==b?c(_,this.state===g?f:w,this.outcome):this.queue.push(new y(_,f,w)),_},y.prototype.callFulfilled=function(f){o.resolve(this.promise,f)},y.prototype.otherCallFulfilled=function(f){c(this.promise,this.onFulfilled,f)},y.prototype.callRejected=function(f){o.reject(this.promise,f)},y.prototype.otherCallRejected=function(f){c(this.promise,this.onRejected,f)},o.resolve=function(f,w){var _=p(m,w);if(_.status==="error")return o.reject(f,_.value);var C=_.value;if(C)h(f,C);else{f.state=g,f.outcome=w;for(var S=-1,z=f.queue.length;++S<z;)f.queue[S].callFulfilled(w)}return f},o.reject=function(f,w){f.state=l,f.outcome=w;for(var _=-1,C=f.queue.length;++_<C;)f.queue[_].callRejected(w);return f},u.resolve=function(f){return f instanceof this?f:o.resolve(new this(s),f)},u.reject=function(f){var w=new this(s);return o.reject(w,f)},u.all=function(f){var w=this;if(Object.prototype.toString.call(f)!=="[object Array]")return this.reject(new TypeError("must be an array"));var _=f.length,C=!1;if(!_)return this.resolve([]);for(var S=new Array(_),z=0,B=-1,O=new this(s);++B<_;)A(f[B],B);return O;function A(H,X){w.resolve(H).then(function(k){S[X]=k,++z!==_||C||(C=!0,o.resolve(O,S))},function(k){C||(C=!0,o.reject(O,k))})}},u.race=function(f){var w=this;if(Object.prototype.toString.call(f)!=="[object Array]")return this.reject(new TypeError("must be an array"));var _=f.length,C=!1;if(!_)return this.resolve([]);for(var S=-1,z=new this(s);++S<_;)B=f[S],w.resolve(B).then(function(O){C||(C=!0,o.resolve(z,O))},function(O){C||(C=!0,o.reject(z,O))});var B;return z}},{immediate:36}],38:[function(e,i,n){var r={};(0,e("./lib/utils/common").assign)(r,e("./lib/deflate"),e("./lib/inflate"),e("./lib/zlib/constants")),i.exports=r},{"./lib/deflate":39,"./lib/inflate":40,"./lib/utils/common":41,"./lib/zlib/constants":44}],39:[function(e,i,n){var r=e("./zlib/deflate"),s=e("./utils/common"),o=e("./utils/strings"),l=e("./zlib/messages"),g=e("./zlib/zstream"),b=Object.prototype.toString,u=0,y=-1,c=0,m=8;function h(f){if(!(this instanceof h))return new h(f);this.options=s.assign({level:y,method:m,chunkSize:16384,windowBits:15,memLevel:8,strategy:c,to:""},f||{});var w=this.options;w.raw&&0<w.windowBits?w.windowBits=-w.windowBits:w.gzip&&0<w.windowBits&&w.windowBits<16&&(w.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new g,this.strm.avail_out=0;var _=r.deflateInit2(this.strm,w.level,w.method,w.windowBits,w.memLevel,w.strategy);if(_!==u)throw new Error(l[_]);if(w.header&&r.deflateSetHeader(this.strm,w.header),w.dictionary){var C;if(C=typeof w.dictionary=="string"?o.string2buf(w.dictionary):b.call(w.dictionary)==="[object ArrayBuffer]"?new Uint8Array(w.dictionary):w.dictionary,(_=r.deflateSetDictionary(this.strm,C))!==u)throw new Error(l[_]);this._dict_set=!0}}function p(f,w){var _=new h(w);if(_.push(f,!0),_.err)throw _.msg||l[_.err];return _.result}h.prototype.push=function(f,w){var _,C,S=this.strm,z=this.options.chunkSize;if(this.ended)return!1;C=w===~~w?w:w===!0?4:0,typeof f=="string"?S.input=o.string2buf(f):b.call(f)==="[object ArrayBuffer]"?S.input=new Uint8Array(f):S.input=f,S.next_in=0,S.avail_in=S.input.length;do{if(S.avail_out===0&&(S.output=new s.Buf8(z),S.next_out=0,S.avail_out=z),(_=r.deflate(S,C))!==1&&_!==u)return this.onEnd(_),!(this.ended=!0);S.avail_out!==0&&(S.avail_in!==0||C!==4&&C!==2)||(this.options.to==="string"?this.onData(o.buf2binstring(s.shrinkBuf(S.output,S.next_out))):this.onData(s.shrinkBuf(S.output,S.next_out)))}while((0<S.avail_in||S.avail_out===0)&&_!==1);return C===4?(_=r.deflateEnd(this.strm),this.onEnd(_),this.ended=!0,_===u):C!==2||(this.onEnd(u),!(S.avail_out=0))},h.prototype.onData=function(f){this.chunks.push(f)},h.prototype.onEnd=function(f){f===u&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=s.flattenChunks(this.chunks)),this.chunks=[],this.err=f,this.msg=this.strm.msg},n.Deflate=h,n.deflate=p,n.deflateRaw=function(f,w){return(w=w||{}).raw=!0,p(f,w)},n.gzip=function(f,w){return(w=w||{}).gzip=!0,p(f,w)}},{"./utils/common":41,"./utils/strings":42,"./zlib/deflate":46,"./zlib/messages":51,"./zlib/zstream":53}],40:[function(e,i,n){var r=e("./zlib/inflate"),s=e("./utils/common"),o=e("./utils/strings"),l=e("./zlib/constants"),g=e("./zlib/messages"),b=e("./zlib/zstream"),u=e("./zlib/gzheader"),y=Object.prototype.toString;function c(h){if(!(this instanceof c))return new c(h);this.options=s.assign({chunkSize:16384,windowBits:0,to:""},h||{});var p=this.options;p.raw&&0<=p.windowBits&&p.windowBits<16&&(p.windowBits=-p.windowBits,p.windowBits===0&&(p.windowBits=-15)),!(0<=p.windowBits&&p.windowBits<16)||h&&h.windowBits||(p.windowBits+=32),15<p.windowBits&&p.windowBits<48&&(15&p.windowBits)==0&&(p.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new b,this.strm.avail_out=0;var f=r.inflateInit2(this.strm,p.windowBits);if(f!==l.Z_OK)throw new Error(g[f]);this.header=new u,r.inflateGetHeader(this.strm,this.header)}function m(h,p){var f=new c(p);if(f.push(h,!0),f.err)throw f.msg||g[f.err];return f.result}c.prototype.push=function(h,p){var f,w,_,C,S,z,B=this.strm,O=this.options.chunkSize,A=this.options.dictionary,H=!1;if(this.ended)return!1;w=p===~~p?p:p===!0?l.Z_FINISH:l.Z_NO_FLUSH,typeof h=="string"?B.input=o.binstring2buf(h):y.call(h)==="[object ArrayBuffer]"?B.input=new Uint8Array(h):B.input=h,B.next_in=0,B.avail_in=B.input.length;do{if(B.avail_out===0&&(B.output=new s.Buf8(O),B.next_out=0,B.avail_out=O),(f=r.inflate(B,l.Z_NO_FLUSH))===l.Z_NEED_DICT&&A&&(z=typeof A=="string"?o.string2buf(A):y.call(A)==="[object ArrayBuffer]"?new Uint8Array(A):A,f=r.inflateSetDictionary(this.strm,z)),f===l.Z_BUF_ERROR&&H===!0&&(f=l.Z_OK,H=!1),f!==l.Z_STREAM_END&&f!==l.Z_OK)return this.onEnd(f),!(this.ended=!0);B.next_out&&(B.avail_out!==0&&f!==l.Z_STREAM_END&&(B.avail_in!==0||w!==l.Z_FINISH&&w!==l.Z_SYNC_FLUSH)||(this.options.to==="string"?(_=o.utf8border(B.output,B.next_out),C=B.next_out-_,S=o.buf2string(B.output,_),B.next_out=C,B.avail_out=O-C,C&&s.arraySet(B.output,B.output,_,C,0),this.onData(S)):this.onData(s.shrinkBuf(B.output,B.next_out)))),B.avail_in===0&&B.avail_out===0&&(H=!0)}while((0<B.avail_in||B.avail_out===0)&&f!==l.Z_STREAM_END);return f===l.Z_STREAM_END&&(w=l.Z_FINISH),w===l.Z_FINISH?(f=r.inflateEnd(this.strm),this.onEnd(f),this.ended=!0,f===l.Z_OK):w!==l.Z_SYNC_FLUSH||(this.onEnd(l.Z_OK),!(B.avail_out=0))},c.prototype.onData=function(h){this.chunks.push(h)},c.prototype.onEnd=function(h){h===l.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=s.flattenChunks(this.chunks)),this.chunks=[],this.err=h,this.msg=this.strm.msg},n.Inflate=c,n.inflate=m,n.inflateRaw=function(h,p){return(p=p||{}).raw=!0,m(h,p)},n.ungzip=m},{"./utils/common":41,"./utils/strings":42,"./zlib/constants":44,"./zlib/gzheader":47,"./zlib/inflate":49,"./zlib/messages":51,"./zlib/zstream":53}],41:[function(e,i,n){var r=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";n.assign=function(l){for(var g=Array.prototype.slice.call(arguments,1);g.length;){var b=g.shift();if(b){if(typeof b!="object")throw new TypeError(b+"must be non-object");for(var u in b)b.hasOwnProperty(u)&&(l[u]=b[u])}}return l},n.shrinkBuf=function(l,g){return l.length===g?l:l.subarray?l.subarray(0,g):(l.length=g,l)};var s={arraySet:function(l,g,b,u,y){if(g.subarray&&l.subarray)l.set(g.subarray(b,b+u),y);else for(var c=0;c<u;c++)l[y+c]=g[b+c]},flattenChunks:function(l){var g,b,u,y,c,m;for(g=u=0,b=l.length;g<b;g++)u+=l[g].length;for(m=new Uint8Array(u),g=y=0,b=l.length;g<b;g++)c=l[g],m.set(c,y),y+=c.length;return m}},o={arraySet:function(l,g,b,u,y){for(var c=0;c<u;c++)l[y+c]=g[b+c]},flattenChunks:function(l){return[].concat.apply([],l)}};n.setTyped=function(l){l?(n.Buf8=Uint8Array,n.Buf16=Uint16Array,n.Buf32=Int32Array,n.assign(n,s)):(n.Buf8=Array,n.Buf16=Array,n.Buf32=Array,n.assign(n,o))},n.setTyped(r)},{}],42:[function(e,i,n){var r=e("./common"),s=!0,o=!0;try{String.fromCharCode.apply(null,[0])}catch{s=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{o=!1}for(var l=new r.Buf8(256),g=0;g<256;g++)l[g]=252<=g?6:248<=g?5:240<=g?4:224<=g?3:192<=g?2:1;function b(u,y){if(y<65537&&(u.subarray&&o||!u.subarray&&s))return String.fromCharCode.apply(null,r.shrinkBuf(u,y));for(var c="",m=0;m<y;m++)c+=String.fromCharCode(u[m]);return c}l[254]=l[254]=1,n.string2buf=function(u){var y,c,m,h,p,f=u.length,w=0;for(h=0;h<f;h++)(64512&(c=u.charCodeAt(h)))==55296&&h+1<f&&(64512&(m=u.charCodeAt(h+1)))==56320&&(c=65536+(c-55296<<10)+(m-56320),h++),w+=c<128?1:c<2048?2:c<65536?3:4;for(y=new r.Buf8(w),h=p=0;p<w;h++)(64512&(c=u.charCodeAt(h)))==55296&&h+1<f&&(64512&(m=u.charCodeAt(h+1)))==56320&&(c=65536+(c-55296<<10)+(m-56320),h++),c<128?y[p++]=c:(c<2048?y[p++]=192|c>>>6:(c<65536?y[p++]=224|c>>>12:(y[p++]=240|c>>>18,y[p++]=128|c>>>12&63),y[p++]=128|c>>>6&63),y[p++]=128|63&c);return y},n.buf2binstring=function(u){return b(u,u.length)},n.binstring2buf=function(u){for(var y=new r.Buf8(u.length),c=0,m=y.length;c<m;c++)y[c]=u.charCodeAt(c);return y},n.buf2string=function(u,y){var c,m,h,p,f=y||u.length,w=new Array(2*f);for(c=m=0;c<f;)if((h=u[c++])<128)w[m++]=h;else if(4<(p=l[h]))w[m++]=65533,c+=p-1;else{for(h&=p===2?31:p===3?15:7;1<p&&c<f;)h=h<<6|63&u[c++],p--;1<p?w[m++]=65533:h<65536?w[m++]=h:(h-=65536,w[m++]=55296|h>>10&1023,w[m++]=56320|1023&h)}return b(w,m)},n.utf8border=function(u,y){var c;for((y=y||u.length)>u.length&&(y=u.length),c=y-1;0<=c&&(192&u[c])==128;)c--;return c<0||c===0?y:c+l[u[c]]>y?c:y}},{"./common":41}],43:[function(e,i,n){i.exports=function(r,s,o,l){for(var g=65535&r|0,b=r>>>16&65535|0,u=0;o!==0;){for(o-=u=2e3<o?2e3:o;b=b+(g=g+s[l++]|0)|0,--u;);g%=65521,b%=65521}return g|b<<16|0}},{}],44:[function(e,i,n){i.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},{}],45:[function(e,i,n){var r=(function(){for(var s,o=[],l=0;l<256;l++){s=l;for(var g=0;g<8;g++)s=1&s?3988292384^s>>>1:s>>>1;o[l]=s}return o})();i.exports=function(s,o,l,g){var b=r,u=g+l;s^=-1;for(var y=g;y<u;y++)s=s>>>8^b[255&(s^o[y])];return-1^s}},{}],46:[function(e,i,n){var r,s=e("../utils/common"),o=e("./trees"),l=e("./adler32"),g=e("./crc32"),b=e("./messages"),u=0,y=4,c=0,m=-2,h=-1,p=4,f=2,w=8,_=9,C=286,S=30,z=19,B=2*C+1,O=15,A=3,H=258,X=H+A+1,k=42,D=113,d=1,R=2,J=3,W=4;function tt(a,L){return a.msg=b[L],L}function U(a){return(a<<1)-(4<a?9:0)}function q(a){for(var L=a.length;0<=--L;)a[L]=0}function M(a){var L=a.state,T=L.pending;T>a.avail_out&&(T=a.avail_out),T!==0&&(s.arraySet(a.output,L.pending_buf,L.pending_out,T,a.next_out),a.next_out+=T,L.pending_out+=T,a.total_out+=T,a.avail_out-=T,L.pending-=T,L.pending===0&&(L.pending_out=0))}function I(a,L){o._tr_flush_block(a,0<=a.block_start?a.block_start:-1,a.strstart-a.block_start,L),a.block_start=a.strstart,M(a.strm)}function V(a,L){a.pending_buf[a.pending++]=L}function Y(a,L){a.pending_buf[a.pending++]=L>>>8&255,a.pending_buf[a.pending++]=255&L}function K(a,L){var T,x,v=a.max_chain_length,N=a.strstart,P=a.prev_length,F=a.nice_match,E=a.strstart>a.w_size-X?a.strstart-(a.w_size-X):0,j=a.window,G=a.w_mask,Z=a.prev,$=a.strstart+H,rt=j[N+P-1],it=j[N+P];a.prev_length>=a.good_match&&(v>>=2),F>a.lookahead&&(F=a.lookahead);do if(j[(T=L)+P]===it&&j[T+P-1]===rt&&j[T]===j[N]&&j[++T]===j[N+1]){N+=2,T++;do;while(j[++N]===j[++T]&&j[++N]===j[++T]&&j[++N]===j[++T]&&j[++N]===j[++T]&&j[++N]===j[++T]&&j[++N]===j[++T]&&j[++N]===j[++T]&&j[++N]===j[++T]&&N<$);if(x=H-($-N),N=$-H,P<x){if(a.match_start=L,F<=(P=x))break;rt=j[N+P-1],it=j[N+P]}}while((L=Z[L&G])>E&&--v!=0);return P<=a.lookahead?P:a.lookahead}function st(a){var L,T,x,v,N,P,F,E,j,G,Z=a.w_size;do{if(v=a.window_size-a.lookahead-a.strstart,a.strstart>=Z+(Z-X)){for(s.arraySet(a.window,a.window,Z,Z,0),a.match_start-=Z,a.strstart-=Z,a.block_start-=Z,L=T=a.hash_size;x=a.head[--L],a.head[L]=Z<=x?x-Z:0,--T;);for(L=T=Z;x=a.prev[--L],a.prev[L]=Z<=x?x-Z:0,--T;);v+=Z}if(a.strm.avail_in===0)break;if(P=a.strm,F=a.window,E=a.strstart+a.lookahead,j=v,G=void 0,G=P.avail_in,j<G&&(G=j),T=G===0?0:(P.avail_in-=G,s.arraySet(F,P.input,P.next_in,G,E),P.state.wrap===1?P.adler=l(P.adler,F,G,E):P.state.wrap===2&&(P.adler=g(P.adler,F,G,E)),P.next_in+=G,P.total_in+=G,G),a.lookahead+=T,a.lookahead+a.insert>=A)for(N=a.strstart-a.insert,a.ins_h=a.window[N],a.ins_h=(a.ins_h<<a.hash_shift^a.window[N+1])&a.hash_mask;a.insert&&(a.ins_h=(a.ins_h<<a.hash_shift^a.window[N+A-1])&a.hash_mask,a.prev[N&a.w_mask]=a.head[a.ins_h],a.head[a.ins_h]=N,N++,a.insert--,!(a.lookahead+a.insert<A)););}while(a.lookahead<X&&a.strm.avail_in!==0)}function lt(a,L){for(var T,x;;){if(a.lookahead<X){if(st(a),a.lookahead<X&&L===u)return d;if(a.lookahead===0)break}if(T=0,a.lookahead>=A&&(a.ins_h=(a.ins_h<<a.hash_shift^a.window[a.strstart+A-1])&a.hash_mask,T=a.prev[a.strstart&a.w_mask]=a.head[a.ins_h],a.head[a.ins_h]=a.strstart),T!==0&&a.strstart-T<=a.w_size-X&&(a.match_length=K(a,T)),a.match_length>=A)if(x=o._tr_tally(a,a.strstart-a.match_start,a.match_length-A),a.lookahead-=a.match_length,a.match_length<=a.max_lazy_match&&a.lookahead>=A){for(a.match_length--;a.strstart++,a.ins_h=(a.ins_h<<a.hash_shift^a.window[a.strstart+A-1])&a.hash_mask,T=a.prev[a.strstart&a.w_mask]=a.head[a.ins_h],a.head[a.ins_h]=a.strstart,--a.match_length!=0;);a.strstart++}else a.strstart+=a.match_length,a.match_length=0,a.ins_h=a.window[a.strstart],a.ins_h=(a.ins_h<<a.hash_shift^a.window[a.strstart+1])&a.hash_mask;else x=o._tr_tally(a,0,a.window[a.strstart]),a.lookahead--,a.strstart++;if(x&&(I(a,!1),a.strm.avail_out===0))return d}return a.insert=a.strstart<A-1?a.strstart:A-1,L===y?(I(a,!0),a.strm.avail_out===0?J:W):a.last_lit&&(I(a,!1),a.strm.avail_out===0)?d:R}function et(a,L){for(var T,x,v;;){if(a.lookahead<X){if(st(a),a.lookahead<X&&L===u)return d;if(a.lookahead===0)break}if(T=0,a.lookahead>=A&&(a.ins_h=(a.ins_h<<a.hash_shift^a.window[a.strstart+A-1])&a.hash_mask,T=a.prev[a.strstart&a.w_mask]=a.head[a.ins_h],a.head[a.ins_h]=a.strstart),a.prev_length=a.match_length,a.prev_match=a.match_start,a.match_length=A-1,T!==0&&a.prev_length<a.max_lazy_match&&a.strstart-T<=a.w_size-X&&(a.match_length=K(a,T),a.match_length<=5&&(a.strategy===1||a.match_length===A&&4096<a.strstart-a.match_start)&&(a.match_length=A-1)),a.prev_length>=A&&a.match_length<=a.prev_length){for(v=a.strstart+a.lookahead-A,x=o._tr_tally(a,a.strstart-1-a.prev_match,a.prev_length-A),a.lookahead-=a.prev_length-1,a.prev_length-=2;++a.strstart<=v&&(a.ins_h=(a.ins_h<<a.hash_shift^a.window[a.strstart+A-1])&a.hash_mask,T=a.prev[a.strstart&a.w_mask]=a.head[a.ins_h],a.head[a.ins_h]=a.strstart),--a.prev_length!=0;);if(a.match_available=0,a.match_length=A-1,a.strstart++,x&&(I(a,!1),a.strm.avail_out===0))return d}else if(a.match_available){if((x=o._tr_tally(a,0,a.window[a.strstart-1]))&&I(a,!1),a.strstart++,a.lookahead--,a.strm.avail_out===0)return d}else a.match_available=1,a.strstart++,a.lookahead--}return a.match_available&&(x=o._tr_tally(a,0,a.window[a.strstart-1]),a.match_available=0),a.insert=a.strstart<A-1?a.strstart:A-1,L===y?(I(a,!0),a.strm.avail_out===0?J:W):a.last_lit&&(I(a,!1),a.strm.avail_out===0)?d:R}function nt(a,L,T,x,v){this.good_length=a,this.max_lazy=L,this.nice_length=T,this.max_chain=x,this.func=v}function dt(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=w,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new s.Buf16(2*B),this.dyn_dtree=new s.Buf16(2*(2*S+1)),this.bl_tree=new s.Buf16(2*(2*z+1)),q(this.dyn_ltree),q(this.dyn_dtree),q(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new s.Buf16(O+1),this.heap=new s.Buf16(2*C+1),q(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new s.Buf16(2*C+1),q(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function ot(a){var L;return a&&a.state?(a.total_in=a.total_out=0,a.data_type=f,(L=a.state).pending=0,L.pending_out=0,L.wrap<0&&(L.wrap=-L.wrap),L.status=L.wrap?k:D,a.adler=L.wrap===2?0:1,L.last_flush=u,o._tr_init(L),c):tt(a,m)}function pt(a){var L=ot(a);return L===c&&(function(T){T.window_size=2*T.w_size,q(T.head),T.max_lazy_match=r[T.level].max_lazy,T.good_match=r[T.level].good_length,T.nice_match=r[T.level].nice_length,T.max_chain_length=r[T.level].max_chain,T.strstart=0,T.block_start=0,T.lookahead=0,T.insert=0,T.match_length=T.prev_length=A-1,T.match_available=0,T.ins_h=0})(a.state),L}function ut(a,L,T,x,v,N){if(!a)return m;var P=1;if(L===h&&(L=6),x<0?(P=0,x=-x):15<x&&(P=2,x-=16),v<1||_<v||T!==w||x<8||15<x||L<0||9<L||N<0||p<N)return tt(a,m);x===8&&(x=9);var F=new dt;return(a.state=F).strm=a,F.wrap=P,F.gzhead=null,F.w_bits=x,F.w_size=1<<F.w_bits,F.w_mask=F.w_size-1,F.hash_bits=v+7,F.hash_size=1<<F.hash_bits,F.hash_mask=F.hash_size-1,F.hash_shift=~~((F.hash_bits+A-1)/A),F.window=new s.Buf8(2*F.w_size),F.head=new s.Buf16(F.hash_size),F.prev=new s.Buf16(F.w_size),F.lit_bufsize=1<<v+6,F.pending_buf_size=4*F.lit_bufsize,F.pending_buf=new s.Buf8(F.pending_buf_size),F.d_buf=1*F.lit_bufsize,F.l_buf=3*F.lit_bufsize,F.level=L,F.strategy=N,F.method=T,pt(a)}r=[new nt(0,0,0,0,function(a,L){var T=65535;for(T>a.pending_buf_size-5&&(T=a.pending_buf_size-5);;){if(a.lookahead<=1){if(st(a),a.lookahead===0&&L===u)return d;if(a.lookahead===0)break}a.strstart+=a.lookahead,a.lookahead=0;var x=a.block_start+T;if((a.strstart===0||a.strstart>=x)&&(a.lookahead=a.strstart-x,a.strstart=x,I(a,!1),a.strm.avail_out===0)||a.strstart-a.block_start>=a.w_size-X&&(I(a,!1),a.strm.avail_out===0))return d}return a.insert=0,L===y?(I(a,!0),a.strm.avail_out===0?J:W):(a.strstart>a.block_start&&(I(a,!1),a.strm.avail_out),d)}),new nt(4,4,8,4,lt),new nt(4,5,16,8,lt),new nt(4,6,32,32,lt),new nt(4,4,16,16,et),new nt(8,16,32,32,et),new nt(8,16,128,128,et),new nt(8,32,128,256,et),new nt(32,128,258,1024,et),new nt(32,258,258,4096,et)],n.deflateInit=function(a,L){return ut(a,L,w,15,8,0)},n.deflateInit2=ut,n.deflateReset=pt,n.deflateResetKeep=ot,n.deflateSetHeader=function(a,L){return a&&a.state?a.state.wrap!==2?m:(a.state.gzhead=L,c):m},n.deflate=function(a,L){var T,x,v,N;if(!a||!a.state||5<L||L<0)return a?tt(a,m):m;if(x=a.state,!a.output||!a.input&&a.avail_in!==0||x.status===666&&L!==y)return tt(a,a.avail_out===0?-5:m);if(x.strm=a,T=x.last_flush,x.last_flush=L,x.status===k)if(x.wrap===2)a.adler=0,V(x,31),V(x,139),V(x,8),x.gzhead?(V(x,(x.gzhead.text?1:0)+(x.gzhead.hcrc?2:0)+(x.gzhead.extra?4:0)+(x.gzhead.name?8:0)+(x.gzhead.comment?16:0)),V(x,255&x.gzhead.time),V(x,x.gzhead.time>>8&255),V(x,x.gzhead.time>>16&255),V(x,x.gzhead.time>>24&255),V(x,x.level===9?2:2<=x.strategy||x.level<2?4:0),V(x,255&x.gzhead.os),x.gzhead.extra&&x.gzhead.extra.length&&(V(x,255&x.gzhead.extra.length),V(x,x.gzhead.extra.length>>8&255)),x.gzhead.hcrc&&(a.adler=g(a.adler,x.pending_buf,x.pending,0)),x.gzindex=0,x.status=69):(V(x,0),V(x,0),V(x,0),V(x,0),V(x,0),V(x,x.level===9?2:2<=x.strategy||x.level<2?4:0),V(x,3),x.status=D);else{var P=w+(x.w_bits-8<<4)<<8;P|=(2<=x.strategy||x.level<2?0:x.level<6?1:x.level===6?2:3)<<6,x.strstart!==0&&(P|=32),P+=31-P%31,x.status=D,Y(x,P),x.strstart!==0&&(Y(x,a.adler>>>16),Y(x,65535&a.adler)),a.adler=1}if(x.status===69)if(x.gzhead.extra){for(v=x.pending;x.gzindex<(65535&x.gzhead.extra.length)&&(x.pending!==x.pending_buf_size||(x.gzhead.hcrc&&x.pending>v&&(a.adler=g(a.adler,x.pending_buf,x.pending-v,v)),M(a),v=x.pending,x.pending!==x.pending_buf_size));)V(x,255&x.gzhead.extra[x.gzindex]),x.gzindex++;x.gzhead.hcrc&&x.pending>v&&(a.adler=g(a.adler,x.pending_buf,x.pending-v,v)),x.gzindex===x.gzhead.extra.length&&(x.gzindex=0,x.status=73)}else x.status=73;if(x.status===73)if(x.gzhead.name){v=x.pending;do{if(x.pending===x.pending_buf_size&&(x.gzhead.hcrc&&x.pending>v&&(a.adler=g(a.adler,x.pending_buf,x.pending-v,v)),M(a),v=x.pending,x.pending===x.pending_buf_size)){N=1;break}N=x.gzindex<x.gzhead.name.length?255&x.gzhead.name.charCodeAt(x.gzindex++):0,V(x,N)}while(N!==0);x.gzhead.hcrc&&x.pending>v&&(a.adler=g(a.adler,x.pending_buf,x.pending-v,v)),N===0&&(x.gzindex=0,x.status=91)}else x.status=91;if(x.status===91)if(x.gzhead.comment){v=x.pending;do{if(x.pending===x.pending_buf_size&&(x.gzhead.hcrc&&x.pending>v&&(a.adler=g(a.adler,x.pending_buf,x.pending-v,v)),M(a),v=x.pending,x.pending===x.pending_buf_size)){N=1;break}N=x.gzindex<x.gzhead.comment.length?255&x.gzhead.comment.charCodeAt(x.gzindex++):0,V(x,N)}while(N!==0);x.gzhead.hcrc&&x.pending>v&&(a.adler=g(a.adler,x.pending_buf,x.pending-v,v)),N===0&&(x.status=103)}else x.status=103;if(x.status===103&&(x.gzhead.hcrc?(x.pending+2>x.pending_buf_size&&M(a),x.pending+2<=x.pending_buf_size&&(V(x,255&a.adler),V(x,a.adler>>8&255),a.adler=0,x.status=D)):x.status=D),x.pending!==0){if(M(a),a.avail_out===0)return x.last_flush=-1,c}else if(a.avail_in===0&&U(L)<=U(T)&&L!==y)return tt(a,-5);if(x.status===666&&a.avail_in!==0)return tt(a,-5);if(a.avail_in!==0||x.lookahead!==0||L!==u&&x.status!==666){var F=x.strategy===2?(function(E,j){for(var G;;){if(E.lookahead===0&&(st(E),E.lookahead===0)){if(j===u)return d;break}if(E.match_length=0,G=o._tr_tally(E,0,E.window[E.strstart]),E.lookahead--,E.strstart++,G&&(I(E,!1),E.strm.avail_out===0))return d}return E.insert=0,j===y?(I(E,!0),E.strm.avail_out===0?J:W):E.last_lit&&(I(E,!1),E.strm.avail_out===0)?d:R})(x,L):x.strategy===3?(function(E,j){for(var G,Z,$,rt,it=E.window;;){if(E.lookahead<=H){if(st(E),E.lookahead<=H&&j===u)return d;if(E.lookahead===0)break}if(E.match_length=0,E.lookahead>=A&&0<E.strstart&&(Z=it[$=E.strstart-1])===it[++$]&&Z===it[++$]&&Z===it[++$]){rt=E.strstart+H;do;while(Z===it[++$]&&Z===it[++$]&&Z===it[++$]&&Z===it[++$]&&Z===it[++$]&&Z===it[++$]&&Z===it[++$]&&Z===it[++$]&&$<rt);E.match_length=H-(rt-$),E.match_length>E.lookahead&&(E.match_length=E.lookahead)}if(E.match_length>=A?(G=o._tr_tally(E,1,E.match_length-A),E.lookahead-=E.match_length,E.strstart+=E.match_length,E.match_length=0):(G=o._tr_tally(E,0,E.window[E.strstart]),E.lookahead--,E.strstart++),G&&(I(E,!1),E.strm.avail_out===0))return d}return E.insert=0,j===y?(I(E,!0),E.strm.avail_out===0?J:W):E.last_lit&&(I(E,!1),E.strm.avail_out===0)?d:R})(x,L):r[x.level].func(x,L);if(F!==J&&F!==W||(x.status=666),F===d||F===J)return a.avail_out===0&&(x.last_flush=-1),c;if(F===R&&(L===1?o._tr_align(x):L!==5&&(o._tr_stored_block(x,0,0,!1),L===3&&(q(x.head),x.lookahead===0&&(x.strstart=0,x.block_start=0,x.insert=0))),M(a),a.avail_out===0))return x.last_flush=-1,c}return L!==y?c:x.wrap<=0?1:(x.wrap===2?(V(x,255&a.adler),V(x,a.adler>>8&255),V(x,a.adler>>16&255),V(x,a.adler>>24&255),V(x,255&a.total_in),V(x,a.total_in>>8&255),V(x,a.total_in>>16&255),V(x,a.total_in>>24&255)):(Y(x,a.adler>>>16),Y(x,65535&a.adler)),M(a),0<x.wrap&&(x.wrap=-x.wrap),x.pending!==0?c:1)},n.deflateEnd=function(a){var L;return a&&a.state?(L=a.state.status)!==k&&L!==69&&L!==73&&L!==91&&L!==103&&L!==D&&L!==666?tt(a,m):(a.state=null,L===D?tt(a,-3):c):m},n.deflateSetDictionary=function(a,L){var T,x,v,N,P,F,E,j,G=L.length;if(!a||!a.state||(N=(T=a.state).wrap)===2||N===1&&T.status!==k||T.lookahead)return m;for(N===1&&(a.adler=l(a.adler,L,G,0)),T.wrap=0,G>=T.w_size&&(N===0&&(q(T.head),T.strstart=0,T.block_start=0,T.insert=0),j=new s.Buf8(T.w_size),s.arraySet(j,L,G-T.w_size,T.w_size,0),L=j,G=T.w_size),P=a.avail_in,F=a.next_in,E=a.input,a.avail_in=G,a.next_in=0,a.input=L,st(T);T.lookahead>=A;){for(x=T.strstart,v=T.lookahead-(A-1);T.ins_h=(T.ins_h<<T.hash_shift^T.window[x+A-1])&T.hash_mask,T.prev[x&T.w_mask]=T.head[T.ins_h],T.head[T.ins_h]=x,x++,--v;);T.strstart=x,T.lookahead=A-1,st(T)}return T.strstart+=T.lookahead,T.block_start=T.strstart,T.insert=T.lookahead,T.lookahead=0,T.match_length=T.prev_length=A-1,T.match_available=0,a.next_in=F,a.input=E,a.avail_in=P,T.wrap=N,c},n.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./messages":51,"./trees":52}],47:[function(e,i,n){i.exports=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}},{}],48:[function(e,i,n){i.exports=function(r,s){var o,l,g,b,u,y,c,m,h,p,f,w,_,C,S,z,B,O,A,H,X,k,D,d,R;o=r.state,l=r.next_in,d=r.input,g=l+(r.avail_in-5),b=r.next_out,R=r.output,u=b-(s-r.avail_out),y=b+(r.avail_out-257),c=o.dmax,m=o.wsize,h=o.whave,p=o.wnext,f=o.window,w=o.hold,_=o.bits,C=o.lencode,S=o.distcode,z=(1<<o.lenbits)-1,B=(1<<o.distbits)-1;t:do{_<15&&(w+=d[l++]<<_,_+=8,w+=d[l++]<<_,_+=8),O=C[w&z];e:for(;;){if(w>>>=A=O>>>24,_-=A,(A=O>>>16&255)===0)R[b++]=65535&O;else{if(!(16&A)){if((64&A)==0){O=C[(65535&O)+(w&(1<<A)-1)];continue e}if(32&A){o.mode=12;break t}r.msg="invalid literal/length code",o.mode=30;break t}H=65535&O,(A&=15)&&(_<A&&(w+=d[l++]<<_,_+=8),H+=w&(1<<A)-1,w>>>=A,_-=A),_<15&&(w+=d[l++]<<_,_+=8,w+=d[l++]<<_,_+=8),O=S[w&B];i:for(;;){if(w>>>=A=O>>>24,_-=A,!(16&(A=O>>>16&255))){if((64&A)==0){O=S[(65535&O)+(w&(1<<A)-1)];continue i}r.msg="invalid distance code",o.mode=30;break t}if(X=65535&O,_<(A&=15)&&(w+=d[l++]<<_,(_+=8)<A&&(w+=d[l++]<<_,_+=8)),c<(X+=w&(1<<A)-1)){r.msg="invalid distance too far back",o.mode=30;break t}if(w>>>=A,_-=A,(A=b-u)<X){if(h<(A=X-A)&&o.sane){r.msg="invalid distance too far back",o.mode=30;break t}if(D=f,(k=0)===p){if(k+=m-A,A<H){for(H-=A;R[b++]=f[k++],--A;);k=b-X,D=R}}else if(p<A){if(k+=m+p-A,(A-=p)<H){for(H-=A;R[b++]=f[k++],--A;);if(k=0,p<H){for(H-=A=p;R[b++]=f[k++],--A;);k=b-X,D=R}}}else if(k+=p-A,A<H){for(H-=A;R[b++]=f[k++],--A;);k=b-X,D=R}for(;2<H;)R[b++]=D[k++],R[b++]=D[k++],R[b++]=D[k++],H-=3;H&&(R[b++]=D[k++],1<H&&(R[b++]=D[k++]))}else{for(k=b-X;R[b++]=R[k++],R[b++]=R[k++],R[b++]=R[k++],2<(H-=3););H&&(R[b++]=R[k++],1<H&&(R[b++]=R[k++]))}break}}break}}while(l<g&&b<y);l-=H=_>>3,w&=(1<<(_-=H<<3))-1,r.next_in=l,r.next_out=b,r.avail_in=l<g?g-l+5:5-(l-g),r.avail_out=b<y?y-b+257:257-(b-y),o.hold=w,o.bits=_}},{}],49:[function(e,i,n){var r=e("../utils/common"),s=e("./adler32"),o=e("./crc32"),l=e("./inffast"),g=e("./inftrees"),b=1,u=2,y=0,c=-2,m=1,h=852,p=592;function f(k){return(k>>>24&255)+(k>>>8&65280)+((65280&k)<<8)+((255&k)<<24)}function w(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new r.Buf16(320),this.work=new r.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function _(k){var D;return k&&k.state?(D=k.state,k.total_in=k.total_out=D.total=0,k.msg="",D.wrap&&(k.adler=1&D.wrap),D.mode=m,D.last=0,D.havedict=0,D.dmax=32768,D.head=null,D.hold=0,D.bits=0,D.lencode=D.lendyn=new r.Buf32(h),D.distcode=D.distdyn=new r.Buf32(p),D.sane=1,D.back=-1,y):c}function C(k){var D;return k&&k.state?((D=k.state).wsize=0,D.whave=0,D.wnext=0,_(k)):c}function S(k,D){var d,R;return k&&k.state?(R=k.state,D<0?(d=0,D=-D):(d=1+(D>>4),D<48&&(D&=15)),D&&(D<8||15<D)?c:(R.window!==null&&R.wbits!==D&&(R.window=null),R.wrap=d,R.wbits=D,C(k))):c}function z(k,D){var d,R;return k?(R=new w,(k.state=R).window=null,(d=S(k,D))!==y&&(k.state=null),d):c}var B,O,A=!0;function H(k){if(A){var D;for(B=new r.Buf32(512),O=new r.Buf32(32),D=0;D<144;)k.lens[D++]=8;for(;D<256;)k.lens[D++]=9;for(;D<280;)k.lens[D++]=7;for(;D<288;)k.lens[D++]=8;for(g(b,k.lens,0,288,B,0,k.work,{bits:9}),D=0;D<32;)k.lens[D++]=5;g(u,k.lens,0,32,O,0,k.work,{bits:5}),A=!1}k.lencode=B,k.lenbits=9,k.distcode=O,k.distbits=5}function X(k,D,d,R){var J,W=k.state;return W.window===null&&(W.wsize=1<<W.wbits,W.wnext=0,W.whave=0,W.window=new r.Buf8(W.wsize)),R>=W.wsize?(r.arraySet(W.window,D,d-W.wsize,W.wsize,0),W.wnext=0,W.whave=W.wsize):(R<(J=W.wsize-W.wnext)&&(J=R),r.arraySet(W.window,D,d-R,J,W.wnext),(R-=J)?(r.arraySet(W.window,D,d-R,R,0),W.wnext=R,W.whave=W.wsize):(W.wnext+=J,W.wnext===W.wsize&&(W.wnext=0),W.whave<W.wsize&&(W.whave+=J))),0}n.inflateReset=C,n.inflateReset2=S,n.inflateResetKeep=_,n.inflateInit=function(k){return z(k,15)},n.inflateInit2=z,n.inflate=function(k,D){var d,R,J,W,tt,U,q,M,I,V,Y,K,st,lt,et,nt,dt,ot,pt,ut,a,L,T,x,v=0,N=new r.Buf8(4),P=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!k||!k.state||!k.output||!k.input&&k.avail_in!==0)return c;(d=k.state).mode===12&&(d.mode=13),tt=k.next_out,J=k.output,q=k.avail_out,W=k.next_in,R=k.input,U=k.avail_in,M=d.hold,I=d.bits,V=U,Y=q,L=y;t:for(;;)switch(d.mode){case m:if(d.wrap===0){d.mode=13;break}for(;I<16;){if(U===0)break t;U--,M+=R[W++]<<I,I+=8}if(2&d.wrap&&M===35615){N[d.check=0]=255&M,N[1]=M>>>8&255,d.check=o(d.check,N,2,0),I=M=0,d.mode=2;break}if(d.flags=0,d.head&&(d.head.done=!1),!(1&d.wrap)||(((255&M)<<8)+(M>>8))%31){k.msg="incorrect header check",d.mode=30;break}if((15&M)!=8){k.msg="unknown compression method",d.mode=30;break}if(I-=4,a=8+(15&(M>>>=4)),d.wbits===0)d.wbits=a;else if(a>d.wbits){k.msg="invalid window size",d.mode=30;break}d.dmax=1<<a,k.adler=d.check=1,d.mode=512&M?10:12,I=M=0;break;case 2:for(;I<16;){if(U===0)break t;U--,M+=R[W++]<<I,I+=8}if(d.flags=M,(255&d.flags)!=8){k.msg="unknown compression method",d.mode=30;break}if(57344&d.flags){k.msg="unknown header flags set",d.mode=30;break}d.head&&(d.head.text=M>>8&1),512&d.flags&&(N[0]=255&M,N[1]=M>>>8&255,d.check=o(d.check,N,2,0)),I=M=0,d.mode=3;case 3:for(;I<32;){if(U===0)break t;U--,M+=R[W++]<<I,I+=8}d.head&&(d.head.time=M),512&d.flags&&(N[0]=255&M,N[1]=M>>>8&255,N[2]=M>>>16&255,N[3]=M>>>24&255,d.check=o(d.check,N,4,0)),I=M=0,d.mode=4;case 4:for(;I<16;){if(U===0)break t;U--,M+=R[W++]<<I,I+=8}d.head&&(d.head.xflags=255&M,d.head.os=M>>8),512&d.flags&&(N[0]=255&M,N[1]=M>>>8&255,d.check=o(d.check,N,2,0)),I=M=0,d.mode=5;case 5:if(1024&d.flags){for(;I<16;){if(U===0)break t;U--,M+=R[W++]<<I,I+=8}d.length=M,d.head&&(d.head.extra_len=M),512&d.flags&&(N[0]=255&M,N[1]=M>>>8&255,d.check=o(d.check,N,2,0)),I=M=0}else d.head&&(d.head.extra=null);d.mode=6;case 6:if(1024&d.flags&&(U<(K=d.length)&&(K=U),K&&(d.head&&(a=d.head.extra_len-d.length,d.head.extra||(d.head.extra=new Array(d.head.extra_len)),r.arraySet(d.head.extra,R,W,K,a)),512&d.flags&&(d.check=o(d.check,R,K,W)),U-=K,W+=K,d.length-=K),d.length))break t;d.length=0,d.mode=7;case 7:if(2048&d.flags){if(U===0)break t;for(K=0;a=R[W+K++],d.head&&a&&d.length<65536&&(d.head.name+=String.fromCharCode(a)),a&&K<U;);if(512&d.flags&&(d.check=o(d.check,R,K,W)),U-=K,W+=K,a)break t}else d.head&&(d.head.name=null);d.length=0,d.mode=8;case 8:if(4096&d.flags){if(U===0)break t;for(K=0;a=R[W+K++],d.head&&a&&d.length<65536&&(d.head.comment+=String.fromCharCode(a)),a&&K<U;);if(512&d.flags&&(d.check=o(d.check,R,K,W)),U-=K,W+=K,a)break t}else d.head&&(d.head.comment=null);d.mode=9;case 9:if(512&d.flags){for(;I<16;){if(U===0)break t;U--,M+=R[W++]<<I,I+=8}if(M!==(65535&d.check)){k.msg="header crc mismatch",d.mode=30;break}I=M=0}d.head&&(d.head.hcrc=d.flags>>9&1,d.head.done=!0),k.adler=d.check=0,d.mode=12;break;case 10:for(;I<32;){if(U===0)break t;U--,M+=R[W++]<<I,I+=8}k.adler=d.check=f(M),I=M=0,d.mode=11;case 11:if(d.havedict===0)return k.next_out=tt,k.avail_out=q,k.next_in=W,k.avail_in=U,d.hold=M,d.bits=I,2;k.adler=d.check=1,d.mode=12;case 12:if(D===5||D===6)break t;case 13:if(d.last){M>>>=7&I,I-=7&I,d.mode=27;break}for(;I<3;){if(U===0)break t;U--,M+=R[W++]<<I,I+=8}switch(d.last=1&M,I-=1,3&(M>>>=1)){case 0:d.mode=14;break;case 1:if(H(d),d.mode=20,D!==6)break;M>>>=2,I-=2;break t;case 2:d.mode=17;break;case 3:k.msg="invalid block type",d.mode=30}M>>>=2,I-=2;break;case 14:for(M>>>=7&I,I-=7&I;I<32;){if(U===0)break t;U--,M+=R[W++]<<I,I+=8}if((65535&M)!=(M>>>16^65535)){k.msg="invalid stored block lengths",d.mode=30;break}if(d.length=65535&M,I=M=0,d.mode=15,D===6)break t;case 15:d.mode=16;case 16:if(K=d.length){if(U<K&&(K=U),q<K&&(K=q),K===0)break t;r.arraySet(J,R,W,K,tt),U-=K,W+=K,q-=K,tt+=K,d.length-=K;break}d.mode=12;break;case 17:for(;I<14;){if(U===0)break t;U--,M+=R[W++]<<I,I+=8}if(d.nlen=257+(31&M),M>>>=5,I-=5,d.ndist=1+(31&M),M>>>=5,I-=5,d.ncode=4+(15&M),M>>>=4,I-=4,286<d.nlen||30<d.ndist){k.msg="too many length or distance symbols",d.mode=30;break}d.have=0,d.mode=18;case 18:for(;d.have<d.ncode;){for(;I<3;){if(U===0)break t;U--,M+=R[W++]<<I,I+=8}d.lens[P[d.have++]]=7&M,M>>>=3,I-=3}for(;d.have<19;)d.lens[P[d.have++]]=0;if(d.lencode=d.lendyn,d.lenbits=7,T={bits:d.lenbits},L=g(0,d.lens,0,19,d.lencode,0,d.work,T),d.lenbits=T.bits,L){k.msg="invalid code lengths set",d.mode=30;break}d.have=0,d.mode=19;case 19:for(;d.have<d.nlen+d.ndist;){for(;nt=(v=d.lencode[M&(1<<d.lenbits)-1])>>>16&255,dt=65535&v,!((et=v>>>24)<=I);){if(U===0)break t;U--,M+=R[W++]<<I,I+=8}if(dt<16)M>>>=et,I-=et,d.lens[d.have++]=dt;else{if(dt===16){for(x=et+2;I<x;){if(U===0)break t;U--,M+=R[W++]<<I,I+=8}if(M>>>=et,I-=et,d.have===0){k.msg="invalid bit length repeat",d.mode=30;break}a=d.lens[d.have-1],K=3+(3&M),M>>>=2,I-=2}else if(dt===17){for(x=et+3;I<x;){if(U===0)break t;U--,M+=R[W++]<<I,I+=8}I-=et,a=0,K=3+(7&(M>>>=et)),M>>>=3,I-=3}else{for(x=et+7;I<x;){if(U===0)break t;U--,M+=R[W++]<<I,I+=8}I-=et,a=0,K=11+(127&(M>>>=et)),M>>>=7,I-=7}if(d.have+K>d.nlen+d.ndist){k.msg="invalid bit length repeat",d.mode=30;break}for(;K--;)d.lens[d.have++]=a}}if(d.mode===30)break;if(d.lens[256]===0){k.msg="invalid code -- missing end-of-block",d.mode=30;break}if(d.lenbits=9,T={bits:d.lenbits},L=g(b,d.lens,0,d.nlen,d.lencode,0,d.work,T),d.lenbits=T.bits,L){k.msg="invalid literal/lengths set",d.mode=30;break}if(d.distbits=6,d.distcode=d.distdyn,T={bits:d.distbits},L=g(u,d.lens,d.nlen,d.ndist,d.distcode,0,d.work,T),d.distbits=T.bits,L){k.msg="invalid distances set",d.mode=30;break}if(d.mode=20,D===6)break t;case 20:d.mode=21;case 21:if(6<=U&&258<=q){k.next_out=tt,k.avail_out=q,k.next_in=W,k.avail_in=U,d.hold=M,d.bits=I,l(k,Y),tt=k.next_out,J=k.output,q=k.avail_out,W=k.next_in,R=k.input,U=k.avail_in,M=d.hold,I=d.bits,d.mode===12&&(d.back=-1);break}for(d.back=0;nt=(v=d.lencode[M&(1<<d.lenbits)-1])>>>16&255,dt=65535&v,!((et=v>>>24)<=I);){if(U===0)break t;U--,M+=R[W++]<<I,I+=8}if(nt&&(240&nt)==0){for(ot=et,pt=nt,ut=dt;nt=(v=d.lencode[ut+((M&(1<<ot+pt)-1)>>ot)])>>>16&255,dt=65535&v,!(ot+(et=v>>>24)<=I);){if(U===0)break t;U--,M+=R[W++]<<I,I+=8}M>>>=ot,I-=ot,d.back+=ot}if(M>>>=et,I-=et,d.back+=et,d.length=dt,nt===0){d.mode=26;break}if(32&nt){d.back=-1,d.mode=12;break}if(64&nt){k.msg="invalid literal/length code",d.mode=30;break}d.extra=15&nt,d.mode=22;case 22:if(d.extra){for(x=d.extra;I<x;){if(U===0)break t;U--,M+=R[W++]<<I,I+=8}d.length+=M&(1<<d.extra)-1,M>>>=d.extra,I-=d.extra,d.back+=d.extra}d.was=d.length,d.mode=23;case 23:for(;nt=(v=d.distcode[M&(1<<d.distbits)-1])>>>16&255,dt=65535&v,!((et=v>>>24)<=I);){if(U===0)break t;U--,M+=R[W++]<<I,I+=8}if((240&nt)==0){for(ot=et,pt=nt,ut=dt;nt=(v=d.distcode[ut+((M&(1<<ot+pt)-1)>>ot)])>>>16&255,dt=65535&v,!(ot+(et=v>>>24)<=I);){if(U===0)break t;U--,M+=R[W++]<<I,I+=8}M>>>=ot,I-=ot,d.back+=ot}if(M>>>=et,I-=et,d.back+=et,64&nt){k.msg="invalid distance code",d.mode=30;break}d.offset=dt,d.extra=15&nt,d.mode=24;case 24:if(d.extra){for(x=d.extra;I<x;){if(U===0)break t;U--,M+=R[W++]<<I,I+=8}d.offset+=M&(1<<d.extra)-1,M>>>=d.extra,I-=d.extra,d.back+=d.extra}if(d.offset>d.dmax){k.msg="invalid distance too far back",d.mode=30;break}d.mode=25;case 25:if(q===0)break t;if(K=Y-q,d.offset>K){if((K=d.offset-K)>d.whave&&d.sane){k.msg="invalid distance too far back",d.mode=30;break}st=K>d.wnext?(K-=d.wnext,d.wsize-K):d.wnext-K,K>d.length&&(K=d.length),lt=d.window}else lt=J,st=tt-d.offset,K=d.length;for(q<K&&(K=q),q-=K,d.length-=K;J[tt++]=lt[st++],--K;);d.length===0&&(d.mode=21);break;case 26:if(q===0)break t;J[tt++]=d.length,q--,d.mode=21;break;case 27:if(d.wrap){for(;I<32;){if(U===0)break t;U--,M|=R[W++]<<I,I+=8}if(Y-=q,k.total_out+=Y,d.total+=Y,Y&&(k.adler=d.check=d.flags?o(d.check,J,Y,tt-Y):s(d.check,J,Y,tt-Y)),Y=q,(d.flags?M:f(M))!==d.check){k.msg="incorrect data check",d.mode=30;break}I=M=0}d.mode=28;case 28:if(d.wrap&&d.flags){for(;I<32;){if(U===0)break t;U--,M+=R[W++]<<I,I+=8}if(M!==(4294967295&d.total)){k.msg="incorrect length check",d.mode=30;break}I=M=0}d.mode=29;case 29:L=1;break t;case 30:L=-3;break t;case 31:return-4;default:return c}return k.next_out=tt,k.avail_out=q,k.next_in=W,k.avail_in=U,d.hold=M,d.bits=I,(d.wsize||Y!==k.avail_out&&d.mode<30&&(d.mode<27||D!==4))&&X(k,k.output,k.next_out,Y-k.avail_out)?(d.mode=31,-4):(V-=k.avail_in,Y-=k.avail_out,k.total_in+=V,k.total_out+=Y,d.total+=Y,d.wrap&&Y&&(k.adler=d.check=d.flags?o(d.check,J,Y,k.next_out-Y):s(d.check,J,Y,k.next_out-Y)),k.data_type=d.bits+(d.last?64:0)+(d.mode===12?128:0)+(d.mode===20||d.mode===15?256:0),(V==0&&Y===0||D===4)&&L===y&&(L=-5),L)},n.inflateEnd=function(k){if(!k||!k.state)return c;var D=k.state;return D.window&&(D.window=null),k.state=null,y},n.inflateGetHeader=function(k,D){var d;return k&&k.state?(2&(d=k.state).wrap)==0?c:((d.head=D).done=!1,y):c},n.inflateSetDictionary=function(k,D){var d,R=D.length;return k&&k.state?(d=k.state).wrap!==0&&d.mode!==11?c:d.mode===11&&s(1,D,R,0)!==d.check?-3:X(k,D,R,R)?(d.mode=31,-4):(d.havedict=1,y):c},n.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./inffast":48,"./inftrees":50}],50:[function(e,i,n){var r=e("../utils/common"),s=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],o=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],l=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],g=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];i.exports=function(b,u,y,c,m,h,p,f){var w,_,C,S,z,B,O,A,H,X=f.bits,k=0,D=0,d=0,R=0,J=0,W=0,tt=0,U=0,q=0,M=0,I=null,V=0,Y=new r.Buf16(16),K=new r.Buf16(16),st=null,lt=0;for(k=0;k<=15;k++)Y[k]=0;for(D=0;D<c;D++)Y[u[y+D]]++;for(J=X,R=15;1<=R&&Y[R]===0;R--);if(R<J&&(J=R),R===0)return m[h++]=20971520,m[h++]=20971520,f.bits=1,0;for(d=1;d<R&&Y[d]===0;d++);for(J<d&&(J=d),k=U=1;k<=15;k++)if(U<<=1,(U-=Y[k])<0)return-1;if(0<U&&(b===0||R!==1))return-1;for(K[1]=0,k=1;k<15;k++)K[k+1]=K[k]+Y[k];for(D=0;D<c;D++)u[y+D]!==0&&(p[K[u[y+D]]++]=D);if(B=b===0?(I=st=p,19):b===1?(I=s,V-=257,st=o,lt-=257,256):(I=l,st=g,-1),k=d,z=h,tt=D=M=0,C=-1,S=(q=1<<(W=J))-1,b===1&&852<q||b===2&&592<q)return 1;for(;;){for(O=k-tt,H=p[D]<B?(A=0,p[D]):p[D]>B?(A=st[lt+p[D]],I[V+p[D]]):(A=96,0),w=1<<k-tt,d=_=1<<W;m[z+(M>>tt)+(_-=w)]=O<<24|A<<16|H|0,_!==0;);for(w=1<<k-1;M&w;)w>>=1;if(w!==0?(M&=w-1,M+=w):M=0,D++,--Y[k]==0){if(k===R)break;k=u[y+p[D]]}if(J<k&&(M&S)!==C){for(tt===0&&(tt=J),z+=d,U=1<<(W=k-tt);W+tt<R&&!((U-=Y[W+tt])<=0);)W++,U<<=1;if(q+=1<<W,b===1&&852<q||b===2&&592<q)return 1;m[C=M&S]=J<<24|W<<16|z-h|0}}return M!==0&&(m[z+M]=k-tt<<24|64<<16|0),f.bits=J,0}},{"../utils/common":41}],51:[function(e,i,n){i.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},{}],52:[function(e,i,n){var r=e("../utils/common"),s=0,o=1;function l(v){for(var N=v.length;0<=--N;)v[N]=0}var g=0,b=29,u=256,y=u+1+b,c=30,m=19,h=2*y+1,p=15,f=16,w=7,_=256,C=16,S=17,z=18,B=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],O=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],A=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],H=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],X=new Array(2*(y+2));l(X);var k=new Array(2*c);l(k);var D=new Array(512);l(D);var d=new Array(256);l(d);var R=new Array(b);l(R);var J,W,tt,U=new Array(c);function q(v,N,P,F,E){this.static_tree=v,this.extra_bits=N,this.extra_base=P,this.elems=F,this.max_length=E,this.has_stree=v&&v.length}function M(v,N){this.dyn_tree=v,this.max_code=0,this.stat_desc=N}function I(v){return v<256?D[v]:D[256+(v>>>7)]}function V(v,N){v.pending_buf[v.pending++]=255&N,v.pending_buf[v.pending++]=N>>>8&255}function Y(v,N,P){v.bi_valid>f-P?(v.bi_buf|=N<<v.bi_valid&65535,V(v,v.bi_buf),v.bi_buf=N>>f-v.bi_valid,v.bi_valid+=P-f):(v.bi_buf|=N<<v.bi_valid&65535,v.bi_valid+=P)}function K(v,N,P){Y(v,P[2*N],P[2*N+1])}function st(v,N){for(var P=0;P|=1&v,v>>>=1,P<<=1,0<--N;);return P>>>1}function lt(v,N,P){var F,E,j=new Array(p+1),G=0;for(F=1;F<=p;F++)j[F]=G=G+P[F-1]<<1;for(E=0;E<=N;E++){var Z=v[2*E+1];Z!==0&&(v[2*E]=st(j[Z]++,Z))}}function et(v){var N;for(N=0;N<y;N++)v.dyn_ltree[2*N]=0;for(N=0;N<c;N++)v.dyn_dtree[2*N]=0;for(N=0;N<m;N++)v.bl_tree[2*N]=0;v.dyn_ltree[2*_]=1,v.opt_len=v.static_len=0,v.last_lit=v.matches=0}function nt(v){8<v.bi_valid?V(v,v.bi_buf):0<v.bi_valid&&(v.pending_buf[v.pending++]=v.bi_buf),v.bi_buf=0,v.bi_valid=0}function dt(v,N,P,F){var E=2*N,j=2*P;return v[E]<v[j]||v[E]===v[j]&&F[N]<=F[P]}function ot(v,N,P){for(var F=v.heap[P],E=P<<1;E<=v.heap_len&&(E<v.heap_len&&dt(N,v.heap[E+1],v.heap[E],v.depth)&&E++,!dt(N,F,v.heap[E],v.depth));)v.heap[P]=v.heap[E],P=E,E<<=1;v.heap[P]=F}function pt(v,N,P){var F,E,j,G,Z=0;if(v.last_lit!==0)for(;F=v.pending_buf[v.d_buf+2*Z]<<8|v.pending_buf[v.d_buf+2*Z+1],E=v.pending_buf[v.l_buf+Z],Z++,F===0?K(v,E,N):(K(v,(j=d[E])+u+1,N),(G=B[j])!==0&&Y(v,E-=R[j],G),K(v,j=I(--F),P),(G=O[j])!==0&&Y(v,F-=U[j],G)),Z<v.last_lit;);K(v,_,N)}function ut(v,N){var P,F,E,j=N.dyn_tree,G=N.stat_desc.static_tree,Z=N.stat_desc.has_stree,$=N.stat_desc.elems,rt=-1;for(v.heap_len=0,v.heap_max=h,P=0;P<$;P++)j[2*P]!==0?(v.heap[++v.heap_len]=rt=P,v.depth[P]=0):j[2*P+1]=0;for(;v.heap_len<2;)j[2*(E=v.heap[++v.heap_len]=rt<2?++rt:0)]=1,v.depth[E]=0,v.opt_len--,Z&&(v.static_len-=G[2*E+1]);for(N.max_code=rt,P=v.heap_len>>1;1<=P;P--)ot(v,j,P);for(E=$;P=v.heap[1],v.heap[1]=v.heap[v.heap_len--],ot(v,j,1),F=v.heap[1],v.heap[--v.heap_max]=P,v.heap[--v.heap_max]=F,j[2*E]=j[2*P]+j[2*F],v.depth[E]=(v.depth[P]>=v.depth[F]?v.depth[P]:v.depth[F])+1,j[2*P+1]=j[2*F+1]=E,v.heap[1]=E++,ot(v,j,1),2<=v.heap_len;);v.heap[--v.heap_max]=v.heap[1],(function(it,ht){var wt,mt,xt,at,Ct,Tt,gt=ht.dyn_tree,Pt=ht.max_code,ve=ht.stat_desc.static_tree,be=ht.stat_desc.has_stree,we=ht.stat_desc.extra_bits,Ft=ht.stat_desc.extra_base,_t=ht.stat_desc.max_length,Nt=0;for(at=0;at<=p;at++)it.bl_count[at]=0;for(gt[2*it.heap[it.heap_max]+1]=0,wt=it.heap_max+1;wt<h;wt++)_t<(at=gt[2*gt[2*(mt=it.heap[wt])+1]+1]+1)&&(at=_t,Nt++),gt[2*mt+1]=at,Pt<mt||(it.bl_count[at]++,Ct=0,Ft<=mt&&(Ct=we[mt-Ft]),Tt=gt[2*mt],it.opt_len+=Tt*(at+Ct),be&&(it.static_len+=Tt*(ve[2*mt+1]+Ct)));if(Nt!==0){do{for(at=_t-1;it.bl_count[at]===0;)at--;it.bl_count[at]--,it.bl_count[at+1]+=2,it.bl_count[_t]--,Nt-=2}while(0<Nt);for(at=_t;at!==0;at--)for(mt=it.bl_count[at];mt!==0;)Pt<(xt=it.heap[--wt])||(gt[2*xt+1]!==at&&(it.opt_len+=(at-gt[2*xt+1])*gt[2*xt],gt[2*xt+1]=at),mt--)}})(v,N),lt(j,rt,v.bl_count)}function a(v,N,P){var F,E,j=-1,G=N[1],Z=0,$=7,rt=4;for(G===0&&($=138,rt=3),N[2*(P+1)+1]=65535,F=0;F<=P;F++)E=G,G=N[2*(F+1)+1],++Z<$&&E===G||(Z<rt?v.bl_tree[2*E]+=Z:E!==0?(E!==j&&v.bl_tree[2*E]++,v.bl_tree[2*C]++):Z<=10?v.bl_tree[2*S]++:v.bl_tree[2*z]++,j=E,rt=(Z=0)===G?($=138,3):E===G?($=6,3):($=7,4))}function L(v,N,P){var F,E,j=-1,G=N[1],Z=0,$=7,rt=4;for(G===0&&($=138,rt=3),F=0;F<=P;F++)if(E=G,G=N[2*(F+1)+1],!(++Z<$&&E===G)){if(Z<rt)for(;K(v,E,v.bl_tree),--Z!=0;);else E!==0?(E!==j&&(K(v,E,v.bl_tree),Z--),K(v,C,v.bl_tree),Y(v,Z-3,2)):Z<=10?(K(v,S,v.bl_tree),Y(v,Z-3,3)):(K(v,z,v.bl_tree),Y(v,Z-11,7));j=E,rt=(Z=0)===G?($=138,3):E===G?($=6,3):($=7,4)}}l(U);var T=!1;function x(v,N,P,F){Y(v,(g<<1)+(F?1:0),3),(function(E,j,G,Z){nt(E),V(E,G),V(E,~G),r.arraySet(E.pending_buf,E.window,j,G,E.pending),E.pending+=G})(v,N,P)}n._tr_init=function(v){T||((function(){var N,P,F,E,j,G=new Array(p+1);for(E=F=0;E<b-1;E++)for(R[E]=F,N=0;N<1<<B[E];N++)d[F++]=E;for(d[F-1]=E,E=j=0;E<16;E++)for(U[E]=j,N=0;N<1<<O[E];N++)D[j++]=E;for(j>>=7;E<c;E++)for(U[E]=j<<7,N=0;N<1<<O[E]-7;N++)D[256+j++]=E;for(P=0;P<=p;P++)G[P]=0;for(N=0;N<=143;)X[2*N+1]=8,N++,G[8]++;for(;N<=255;)X[2*N+1]=9,N++,G[9]++;for(;N<=279;)X[2*N+1]=7,N++,G[7]++;for(;N<=287;)X[2*N+1]=8,N++,G[8]++;for(lt(X,y+1,G),N=0;N<c;N++)k[2*N+1]=5,k[2*N]=st(N,5);J=new q(X,B,u+1,y,p),W=new q(k,O,0,c,p),tt=new q(new Array(0),A,0,m,w)})(),T=!0),v.l_desc=new M(v.dyn_ltree,J),v.d_desc=new M(v.dyn_dtree,W),v.bl_desc=new M(v.bl_tree,tt),v.bi_buf=0,v.bi_valid=0,et(v)},n._tr_stored_block=x,n._tr_flush_block=function(v,N,P,F){var E,j,G=0;0<v.level?(v.strm.data_type===2&&(v.strm.data_type=(function(Z){var $,rt=4093624447;for($=0;$<=31;$++,rt>>>=1)if(1&rt&&Z.dyn_ltree[2*$]!==0)return s;if(Z.dyn_ltree[18]!==0||Z.dyn_ltree[20]!==0||Z.dyn_ltree[26]!==0)return o;for($=32;$<u;$++)if(Z.dyn_ltree[2*$]!==0)return o;return s})(v)),ut(v,v.l_desc),ut(v,v.d_desc),G=(function(Z){var $;for(a(Z,Z.dyn_ltree,Z.l_desc.max_code),a(Z,Z.dyn_dtree,Z.d_desc.max_code),ut(Z,Z.bl_desc),$=m-1;3<=$&&Z.bl_tree[2*H[$]+1]===0;$--);return Z.opt_len+=3*($+1)+5+5+4,$})(v),E=v.opt_len+3+7>>>3,(j=v.static_len+3+7>>>3)<=E&&(E=j)):E=j=P+5,P+4<=E&&N!==-1?x(v,N,P,F):v.strategy===4||j===E?(Y(v,2+(F?1:0),3),pt(v,X,k)):(Y(v,4+(F?1:0),3),(function(Z,$,rt,it){var ht;for(Y(Z,$-257,5),Y(Z,rt-1,5),Y(Z,it-4,4),ht=0;ht<it;ht++)Y(Z,Z.bl_tree[2*H[ht]+1],3);L(Z,Z.dyn_ltree,$-1),L(Z,Z.dyn_dtree,rt-1)})(v,v.l_desc.max_code+1,v.d_desc.max_code+1,G+1),pt(v,v.dyn_ltree,v.dyn_dtree)),et(v),F&&nt(v)},n._tr_tally=function(v,N,P){return v.pending_buf[v.d_buf+2*v.last_lit]=N>>>8&255,v.pending_buf[v.d_buf+2*v.last_lit+1]=255&N,v.pending_buf[v.l_buf+v.last_lit]=255&P,v.last_lit++,N===0?v.dyn_ltree[2*P]++:(v.matches++,N--,v.dyn_ltree[2*(d[P]+u+1)]++,v.dyn_dtree[2*I(N)]++),v.last_lit===v.lit_bufsize-1},n._tr_align=function(v){Y(v,2,3),K(v,_,X),(function(N){N.bi_valid===16?(V(N,N.bi_buf),N.bi_buf=0,N.bi_valid=0):8<=N.bi_valid&&(N.pending_buf[N.pending++]=255&N.bi_buf,N.bi_buf>>=8,N.bi_valid-=8)})(v)}},{"../utils/common":41}],53:[function(e,i,n){i.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(e,i,n){(function(r){(function(s,o){if(!s.setImmediate){var l,g,b,u,y=1,c={},m=!1,h=s.document,p=Object.getPrototypeOf&&Object.getPrototypeOf(s);p=p&&p.setTimeout?p:s,l={}.toString.call(s.process)==="[object process]"?function(C){process.nextTick(function(){w(C)})}:(function(){if(s.postMessage&&!s.importScripts){var C=!0,S=s.onmessage;return s.onmessage=function(){C=!1},s.postMessage("","*"),s.onmessage=S,C}})()?(u="setImmediate$"+Math.random()+"$",s.addEventListener?s.addEventListener("message",_,!1):s.attachEvent("onmessage",_),function(C){s.postMessage(u+C,"*")}):s.MessageChannel?((b=new MessageChannel).port1.onmessage=function(C){w(C.data)},function(C){b.port2.postMessage(C)}):h&&"onreadystatechange"in h.createElement("script")?(g=h.documentElement,function(C){var S=h.createElement("script");S.onreadystatechange=function(){w(C),S.onreadystatechange=null,g.removeChild(S),S=null},g.appendChild(S)}):function(C){setTimeout(w,0,C)},p.setImmediate=function(C){typeof C!="function"&&(C=new Function(""+C));for(var S=new Array(arguments.length-1),z=0;z<S.length;z++)S[z]=arguments[z+1];var B={callback:C,args:S};return c[y]=B,l(y),y++},p.clearImmediate=f}function f(C){delete c[C]}function w(C){if(m)setTimeout(w,0,C);else{var S=c[C];if(S){m=!0;try{(function(z){var B=z.callback,O=z.args;switch(O.length){case 0:B();break;case 1:B(O[0]);break;case 2:B(O[0],O[1]);break;case 3:B(O[0],O[1],O[2]);break;default:B.apply(o,O)}})(S)}finally{f(C),m=!1}}}}function _(C){C.source===s&&typeof C.data=="string"&&C.data.indexOf(u)===0&&w(+C.data.slice(u.length))}})(typeof self>"u"?r===void 0?this:r:self)}).call(this,typeof St<"u"?St:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})(zt)),zt.exports}var fe=ue();const pe=he(fe);class Lt{generate(){return typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():Date.now().toString(36)+Math.random().toString(36).substr(2)}}class Mt{idGenerator;constructor(){this.idGenerator=new Lt}async extractMindMapData(t){const e=new pe;try{const n=(await e.loadAsync(t)).file("content.json");if(!n)throw new Error("Invalid XMind file: content.json not found");const r=await n.async("text"),s=JSON.parse(r);if(!Array.isArray(s)||s.length===0)throw new Error("Invalid XMind file: No content found");const o=s[0];return{nodeData:await this.transformTopic(o.rootTopic,e,!0),theme:"default",direction:1}}catch(i){throw console.error("Failed to parse XMind file",i),new Error("Failed to import XMind file",{cause:i})}}async transformTopic(t,e,i=!1){const n=this.idGenerator.generate(),r=[];if(t.children&&t.children.attached)for(const o of t.children.attached)r.push(await this.transformTopic(o,e,!1));let s;if(t.image&&t.image.src&&t.image.src.startsWith("xap:")){const o=t.image.src.substring(4),l=e.file(o);if(l){const g=await l.async("base64"),b=o.split(".").pop()?.toLowerCase();let u="image/png";b==="jpg"||b==="jpeg"?u="image/jpeg":b==="svg"?u="image/svg+xml":b==="gif"&&(u="image/gif"),s=`data:${u};base64,${g}`}}if(t.title&&s){const o={id:n,topic:t.title,root:i,children:r},g={id:this.idGenerator.generate(),topic:"",image:s,children:[]};return o.children?.push(g),o}else return s?{id:n,topic:"",image:s,root:i,children:r}:{id:n,topic:t.title||"",root:i,children:r}}}class me{mindMap;renderer;eventBus;fileHandler;constructor(t){this.mindMap=t.mindMap,this.renderer=t.renderer,this.eventBus=t.eventBus,this.fileHandler=t.fileHandler}async exportPng(){this.eventBus.emit("command",{name:"exportPng"}),await new Dt().exportToPng(this.renderer.container,this.fileHandler)}async exportSvg(){this.eventBus.emit("command",{name:"exportSvg"}),await new Dt().exportToSvg(this.renderer.container,this.fileHandler)}async exportMarkdown(){this.eventBus.emit("command",{name:"exportMarkdown"}),await new ce().export(this.mindMap,this.fileHandler)}async importXMind(){if(this.eventBus.emit("command",{name:"importXMind"}),this.mindMap.root.children.length>0&&!window.confirm("Current mind map will be replaced. Continue?"))return null;if(this.fileHandler){const t=await this.fileHandler.onImportFile("xmind");if(t)try{const e=new Mt;let i;if(t instanceof ArrayBuffer)i=new File([t],"imported.xmind");else if(typeof t=="string")i=new File([t],"imported.xmind");else return null;return await e.extractMindMapData(i)}catch(e){return console.error(e),alert("Failed to import XMind file."),null}return null}return new Promise(t=>{const e=document.createElement("input");e.type="file",e.accept=".xmind",e.style.display="none",document.body.appendChild(e),e.onchange=async i=>{const r=i.target.files?.[0];if(r)try{const o=await new Mt().extractMindMapData(r);t(o)}catch(s){console.error(s),alert("Failed to import XMind file."),t(null)}else t(null);document.body.removeChild(e)},e.click()})}}class ge{mindMap;service;renderer;eventBus;layoutSwitcher;savedCustomStyles={rootNode:{border:"2px solid #aeb6bf",background:"#ebf5fb",color:"#2e4053"},childNode:{border:"1px solid #d5d8dc",background:"#fdfefe",color:"#2c3e50"},canvas:{background:"#ffffff"},connection:{color:"#abb2b9"}};constructor(t){this.mindMap=t.mindMap,this.service=t.service,this.renderer=t.renderer,this.eventBus=t.eventBus}setLayoutSwitcher(t){this.layoutSwitcher=t}applyInitialTheme(){const t=this.mindMap.theme;if(t==="custom"){const e=ct.getInstance();e.setCustomTheme(this.savedCustomStyles),e.applyTheme(this.renderer.container,"custom")}else ct.getInstance().applyTheme(this.renderer.container,t)}updateGlobalStyles(t){if(this.eventBus.emit("command",{name:"updateGlobalStyles",args:{styles:t}}),t.rootNode&&(this.savedCustomStyles.rootNode={...this.savedCustomStyles.rootNode,...t.rootNode}),t.childNode&&(this.savedCustomStyles.childNode={...this.savedCustomStyles.childNode,...t.childNode}),t.connection&&(this.savedCustomStyles.connection={...this.savedCustomStyles.connection,...t.connection}),t.canvas&&(this.savedCustomStyles.canvas={...this.savedCustomStyles.canvas,...t.canvas}),this.mindMap.theme==="custom"){const e=ct.getInstance();e.setCustomTheme(this.savedCustomStyles),e.applyTheme(this.renderer.container,"custom")}this.eventBus.emit("theme:changed",this.mindMap.theme),this.eventBus.emit("model:change","updateGlobalStyles")}setTheme(t,e={}){const{saveState:i=!0,emitChange:n=!0}=e;if(n&&this.eventBus.emit("command",{name:"setTheme",args:{theme:t}}),this.service.setTheme(t),this.layoutSwitcher&&this.layoutSwitcher.setTheme(t),t==="custom"){const r=ct.getInstance();r.setCustomTheme(this.savedCustomStyles),r.applyTheme(this.renderer.container,"custom")}else ct.getInstance().applyTheme(this.renderer.container,t);this.eventBus.emit("theme:changed",t),i&&this.eventBus.emit("model:change","setTheme")}getSavedCustomStyles(){return this.savedCustomStyles}}class Ot{listeners={};on(t,e){this.listeners[t]||(this.listeners[t]=[]),this.listeners[t]?.push(e)}addListener(t,e){this.on(t,e)}off(t,e){const i=this.listeners[t];i&&(this.listeners[t]=i.filter(n=>n!==e))}removeListener(t,e){this.off(t,e)}emit(t,e){this.listeners[t]?.forEach(i=>i(e))}}class ye extends Ot{mindMap;controller;interactionOrchestrator;commandBus;constructor(t,e={}){super();const i=new yt("root","Root Topic",null,!0);this.mindMap=new bt(i);const n=new Lt,r=new Wt(this.mindMap,n),s=new jt(10),o=new Ht(this.mindMap,n),l=new Zt(this.mindMap),g=document.createElement("div");g.style.position="absolute",g.style.top="0",g.style.left="0",g.style.width="100%",g.style.height="100%",g.style.pointerEvents="none",g.style.zIndex="2000",window.getComputedStyle(t).position==="static"&&(t.style.position="relative"),t.style.overscrollBehavior="none",t.style.touchAction="none",t.appendChild(g);const u=new vt(g),y=new Gt(t,{onImageZoom:S=>this.controller.setReadOnly(S),onToggleFold:S=>this.controller.toggleFold(S)});let c="en";typeof navigator<"u"&&navigator.language&&navigator.language.startsWith("ja")&&(c="ja");const m=new de(y),h=new le(this.mindMap),p={emit:(S,z)=>this.emit(S,z),on:(S,z)=>this.on(S,z),off:(S,z)=>this.off(S,z)},f=new me({mindMap:this.mindMap,renderer:y,eventBus:p,fileHandler:e.fileHandler}),w=new ge({mindMap:this.mindMap,service:r,renderer:y,eventBus:p}),_=new ne;this.controller=new ae({mindMap:this.mindMap,service:r,renderer:y,styleEditor:u,eventBus:p,historyService:s,clipboardService:o,searchService:l,viewportService:m,navigationService:h,fileIOService:f,themeService:w,commandBus:_,locale:e.locale||c,commandPaletteFeatures:e.disabledCommandPaletteFeatures}),u.onUpdate=(S,z)=>{this.controller.updateNode(S,{style:z})},this.interactionOrchestrator=new ie({container:t,commandBus:_,mindMap:this.mindMap,getSelectedNodeId:()=>this.controller.getSelectedNodeId(),getNodeElement:S=>y.getNodeElement(S),zoomNode:S=>y.zoomNode(S),options:{...e,onNodeClick:(S,z)=>{z&&S?this.controller.selectRangeTo(S):this.controller.selectNode(S||null)},onAddChild:S=>this.controller.addChildNode(S),onInsertParent:S=>this.controller.insertParentNode(S),onAddSibling:(S,z)=>this.controller.addSiblingNode(S,z),onDeleteNode:S=>this.controller.removeNode(S),onDropNode:(S,z,B)=>this.controller.moveNode(S,z,B),onUpdateNode:(S,z)=>this.controller.updateNodeTopic(S,z),onNavigate:(S,z,B)=>this.controller.navigateNode(S,z,B),onPan:(S,z)=>this.controller.panBoard(S,z),onCopyNode:S=>this.controller.copyNode(S),onPasteNode:S=>this.controller.pasteNode(S),onCutNode:S=>this.controller.cutNode(S),onPasteImage:(S,z,B,O)=>this.controller.pasteImage(S,z,B,O),onZoom:(S,z,B)=>this.controller.zoomBoard(S,z,B),onZoomReset:()=>this.controller.resetZoom(),onUndo:()=>this.controller.undo(),onRedo:()=>this.controller.redo(),onStyleAction:(S,z)=>this.controller.onStyleAction(S,z),onEditEnd:S=>this.controller.onEditEnd(),onToggleFold:S=>this.controller.toggleFold(S),onToggleCommandPalette:()=>this.controller.toggleCommandPalette(),onUpdateNodeWidth:(S,z)=>this.controller.updateNodeWidth(S,z)}}),this.commandBus=_,this.controller.setInteractionOrchestrator(this.interactionOrchestrator);const C=new $t(g,{onLayoutChange:S=>this.controller.setLayoutMode(S),onThemeChange:S=>this.controller.setTheme(S),onZoomReset:()=>this.controller.resetZoom(),onShowHelp:()=>this.controller.showHelpModal()});this.controller.setLayoutSwitcher(C),e.maxNodeWidth!==void 0&&this.controller.setMaxNodeWidth(e.maxNodeWidth),e.customStyles&&this.controller.updateGlobalStyles(e.customStyles),this.controller.init(t.clientWidth,t.clientHeight)}addNode(t,e,i,n={emitChange:!0}){return this.controller.addNode(t,e,i,n)}addSibling(t,e="after",i="New topic",n={emitChange:!0}){return this.controller.addSibling(t,e,i,n)}insertParent(t,e="New topic",i={emitChange:!0}){return this.controller.insertParent(t,e,i)}deleteNode(t){this.controller.deleteNode(t)}updateNode(t,e){this.controller.updateNode(t,e)}undo(){this.controller.undo()}redo(){this.controller.redo()}toggleFold(t){this.controller.toggleFold(t)}toggleCommandPalette(){this.controller.toggleCommandPalette()}registerCommand(t){this.controller.registerCommand(t)}openCommandPalette(){this.controller.toggleCommandPalette()}searchNodes(t){return this.controller.searchNodes(t)}getSelectedNodeId(){return this.controller.selectedNodeId}updateNodeStyle(t,e){this.controller.updateNode(t,{style:e})}setTheme(t){this.controller.setTheme(t)}getMindMap(){return this.mindMap}getNode(t){return this.mindMap.findNode(t)||void 0}getRoot(){return this.mindMap.root}findNodes(t){const e=[],i=n=>{t(n)&&e.push(n),n.children.forEach(i)};return i(this.mindMap.root),e}setMaxNodeWidth(t){this.controller.setMaxNodeWidth(t)}getMaxNodeWidth(){return this.controller.getMaxNodeWidth()}updateGlobalStyles(t){this.controller.updateGlobalStyles(t)}setReadOnly(t){this.controller.setReadOnly(t)}destroy(){this.controller.destroy(),this.controller.interactionHandler?.destroy()}batch(t){this.controller.isBatching=!0;try{t()}finally{this.controller.isBatching=!1,this.controller.render()}}addChildNode(t){this.controller.addChildNode(t)}addSiblingNode(t,e="after"){this.controller.addSiblingNode(t,e)}insertParentNode(t){this.controller.insertParentNode(t)}removeNode(t){this.controller.removeNode(t)}moveNode(t,e,i){this.controller.moveNode(t,e,i)}updateNodeTopic(t,e){this.controller.updateNodeTopic(t,e)}selectNode(t){this.controller.selectNode(t)}panBoard(t,e){this.controller.panBoard(t,e)}zoomBoard(t,e,i){this.controller.zoomBoard(t,e,i)}resetZoom(){this.controller.resetZoom()}copyNode(t){this.controller.copyNode(t)}pasteNode(t){this.controller.pasteNode(t)}pasteImage(t,e,i,n){this.controller.pasteImage(t,e,i,n)}cutNode(t){this.controller.cutNode(t)}updateLayout(t){t==="Standard"?this.controller.setLayoutMode("Both"):this.controller.setLayoutMode(t)}setLayoutMode(t){this.controller.setLayoutMode(t)}getLayoutMode(){return this.controller.getLayoutMode()}navigateNode(t,e){this.controller.navigateNode(t,e)}getData(){return this.controller.getData()}loadData(t){this.controller.loadData(t)}getRootId(){return this.mindMap.root.id}}ft.Kakidash=ye,ft.Node=yt,ft.SvgGenerator=Bt,ft.TypedEventEmitter=Ot,ft.XMindImporter=Mt,Object.defineProperty(ft,Symbol.toStringTag,{value:"Module"})}));
|