kakidash 0.2.3 → 0.3.1
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 +5 -4
- package/README.md +3 -2
- package/dist/index.d.ts +675 -5
- package/dist/kakidash.cjs +21 -19
- package/dist/kakidash.es.js +4175 -3717
- package/dist/kakidash.umd.js +21 -19
- package/package.json +1 -1
package/dist/kakidash.cjs
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});class Ut{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),
|
|
2
|
-
`)).catch(n=>{console.error("Failed to write to clipboard",n)})}cutNode(t){this.cutNodes([t])}cutNodes(t){this.copyNodes(t),this.removeNodes(t)}pasteNode(t){const e=this.pasteNodes(t);return e.length>0?e[0]:null}pasteNodes(t){if(this.clipboard.length===0)return[];const e=this.mindMap.findNode(t);if(!e)return[];this.saveState();const i=[];return this.clipboard.forEach(r=>{const n=this.deepCloneNode(r);this.regenerateIds(n),e.addChild(n),this.mindMap.registerNode(n),i.push(n)}),i}deepCloneNode(t){const e=new gt(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=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.layoutSide,isFolded:i.isFolded,icon:i.icon,imageSize:i.imageSize,customWidth:i.customWidth}),e={nodeData:t(this.mindMap.root),theme:this.mindMap.theme};if(this.selectionProvider){const i=this.selectionProvider();i.selectedId&&(e.selectedId=i.selectedId),i.selectedIds&&(e.selectedIds=i.selectedIds)}return e}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,s=new gt(i.id,i.topic,r,n,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 c=e(o,s.id);s.addChild(c)}),s};this.mindMap.root=e(t.nodeData),this.mindMap.rebuildIndex(),t.theme&&(this.mindMap.theme=t.theme)}}const Nt={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)"}}},Zt={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"],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:it=>Dt[it%Dt.length]},Kt={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=Nt;constructor(){this.registerTheme(Nt),this.registerTheme(Zt),this.registerTheme(Xt),this.registerTheme(Kt)}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=Nt.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 Yt{container;svg;nodeContainer;options;maxWidth=-1;measureCache=new Map;heightCache=new Map;nodeElementMap=new Map;previousSelectedIds=new Set;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"){let r;e instanceof Set?r=e:Array.isArray(e)?r=new Set(e):typeof e=="string"?r=new Set([e]):r=new Set,this.svg.innerHTML="",this.nodeContainer.innerHTML="",this.measureCache.clear(),this.heightCache.clear(),this.nodeElementMap.clear(),this.previousSelectedIds.clear(),this.renderNode(t.root,0,this.container.clientHeight/2,r,i,!0,void 0,t),this.previousSelectedIds=new Set(r)}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 o=e.findNode(r.parentId);if(!o)break;r=o}const s=e.root.children.findIndex(o=>o.id===r.id);if(s!==-1)return i.getColor(s,0)}return i.styles.connection.color}renderNode(t,e,i,r,n,s,o="right",c){const m=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 p=document.createElement("img");p.src=t.image,t.imageSize?t.imageSize.width>150?(p.style.width="150px",p.style.height="auto"):(p.style.width=`${t.imageSize.width}px`,p.style.height=`${t.imageSize.height}px`):(p.style.maxWidth="150px",p.style.maxHeight="150px"),p.style.display="block",f.appendChild(p);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",b=>{b.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 S=It[t.icon];if(S){const C=document.createElementNS("http://www.w3.org/2000/svg","svg");C.setAttribute("viewBox",S.viewBox),C.setAttribute("width","20"),C.setAttribute("height","20"),C.style.width="20px",C.style.height="20px",C.style.marginRight="8px",C.style.flexShrink="0",C.innerHTML=S.path,f.appendChild(C)}else{const C=document.createElement("span");C.textContent=t.icon,C.style.marginRight="6px",C.style.fontSize="1.2em",f.appendChild(C)}}const p=document.createElement("span"),u=/(https?:\/\/[^\s]+)/g;t.topic.split(u).forEach(S=>{if(S.match(u)){const C=document.createElement("a");C.href=S,C.target="_blank",C.rel="noopener noreferrer",C.textContent=S,C.style.color="#3498DB",C.style.textDecoration="underline",C.style.cursor="pointer",C.addEventListener("mousedown",L=>L.stopPropagation()),C.addEventListener("click",L=>L.stopPropagation()),p.appendChild(C)}else p.appendChild(document.createTextNode(S))}),f.appendChild(p);const k=t.customWidth??(this.maxWidth!==-1?this.maxWidth:void 0);k!==void 0?(p.style.whiteSpace="pre-wrap",p.style.wordWrap="break-word",p.style.overflowWrap="anywhere",p.style.minWidth="0",f.style.maxWidth=`${k}px`,f.style.width="max-content"):p.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"),m.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(m.name==="colorful")f.style.border=`2px solid ${y}`;else if(m.name==="custom")if(t.isRoot){const p="2px solid var(--vscode-editor-foreground, #333)";f.style.border=`var(--mindmap-root-border, ${p})`}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",m.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:m.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:v}=this.measureNode(t);let l=e;if(o==="left"&&!s?l=e-v:s&&(l=e-v/2),f.style.left=`${l}px`,f.style.top=`${i}px`,f.style.transform="translate(0, -50%)",f.style.zIndex="10",f.style.cursor="default",f.style.userSelect="none",r.has(t.id)&&(f.style.outline="2px solid var(--vscode-focusBorder, #007bff)",f.style.boxShadow="0 0 5px var(--vscode-focusBorder, rgba(0, 123, 255, 0.5))",f.dataset.selected="true"),this.nodeContainer.appendChild(f),this.nodeElementMap.set(t.id,f),t.children.length===0)return;if(this.options.onToggleFold){const p=[];if(s&&n==="Both")p.push(l+v),p.push(l);else{let u=o==="right";s&&(n==="Left"?u=!1:u=!0),p.push(u?l+v:l)}p.forEach(u=>{const b=document.createElement("div");b.className="mindmap-toggle-btn",b.innerHTML=t.isFolded?"+":"-",b.style.position="absolute",b.style.width="16px",b.style.height="16px",b.style.fontSize="12px",b.style.lineHeight="14px",b.style.textAlign="center",b.style.borderRadius="50%",b.style.border="1px solid var(--vscode-widget-border, #999)",b.style.backgroundColor="var(--vscode-editor-background, #fff)",b.style.color="var(--vscode-editor-foreground, #000)",b.style.cursor="pointer",b.style.zIndex="11",b.style.userSelect="none";const k=0;b.style.left=`${u+k}px`,b.style.top=`${i}px`,b.style.transform="translate(-50%, -50%)",b.addEventListener("click",S=>{S.stopPropagation(),this.options.onToggleFold?.(t.id)}),this.nodeContainer.appendChild(b)})}if(t.isFolded)return;let g=[],h=[];s&&n==="Both"?t.children.forEach((p,u)=>{(p.layoutSide||(u%2===0?"right":"left"))==="right"?g.push(p):h.push(p)}):n==="Left"?h=t.children:n==="Right"?g=t.children:o==="left"?h=t.children:g=t.children,g.length>0&&this.renderChildrenStack(t,g,e,i,r,n,"right",v,c),h.length>0&&this.renderChildrenStack(t,h,e,i,r,n,"left",v,c)}renderChildrenStack(t,e,i,r,n,s,o,c,m){const f=e.reduce((g,h)=>g+this.getNodeHeight(h,m),0);let y=r-f/2;const v=80;let l=0;t.isRoot?l=o==="right"?i+c/2:i-c/2:o==="right"?l=i+c:(l=i,l=i-c),e.forEach(g=>{const h=this.getNodeHeight(g,m),p=y+h/2,u=o==="right"?l+v:l-v;this.renderNode(g,u,p,n,s,!1,o,m);const b=m?this.getThemeColor(g,m):"#ccc";this.drawConnection(l,r,u,p,b,m?.theme),y+=h})}getChildrenHeight(t,e){return t.children.reduce((i,r)=>i+this.getNodeHeight(r,e),0)}getNodeHeight(t,e){if(this.heightCache.has(t.id))return this.heightCache.get(t.id);const{height:i}=this.measureNode(t,e),r=20;if(t.children.length===0||t.isFolded){const o=i+r;return this.heightCache.set(t.id,o),o}const n=this.getChildrenHeight(t,e),s=Math.max(i+r,n);return this.heightCache.set(t.id,s),s}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 g={width:160,height:150*(t.imageSize.height/t.imageSize.width)+10};return this.measureCache.set(t.id,g),g}const v={width:t.imageSize.width+10,height:t.imageSize.height+10};return this.measureCache.set(t.id,v),v}const y={width:160,height:160};return this.measureCache.set(t.id,y),y}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 v=document.createElement("div");v.style.width="20px",v.style.height="20px",v.style.marginRight="8px",v.style.flexShrink="0",i.appendChild(v)}else{const v=document.createElement("span");v.textContent=t.icon,v.style.marginRight="6px",v.style.fontSize="1.2em",i.appendChild(v)}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 s=ct.getInstance().getCurrentTheme(),o=e?this.getThemeColor(t,e):"#ccc";s.name==="colorful"?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.background&&(i.style.backgroundColor=t.style.background),this.nodeContainer.appendChild(i);const c=i.offsetWidth,m=i.offsetHeight;this.nodeContainer.removeChild(i);const f={width:c||100,height:m||40};return this.measureCache.set(t.id,f),f}drawConnection(t,e,i,r,n="#ccc",s="default"){const o=document.createElementNS("http://www.w3.org/2000/svg","path"),c=t+(i-t)/2,m=t+(i-t)/2,f=`M ${t} ${e} C ${c} ${e}, ${m} ${r}, ${i} ${r}`;o.setAttribute("d",f),s==="custom"?o.style.stroke=`var(--mindmap-connection-color, ${n})`:(o.style.stroke="var(--mindmap-connection-color, #ccc)",ct.getInstance().getCurrentTheme().name==="colorful"?o.style.stroke=n:o.style.stroke="var(--mindmap-connection-color)"),o.setAttribute("fill","none"),o.setAttribute("stroke-width","2"),this.svg.appendChild(o)}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=s=>{s.stopPropagation(),s.preventDefault(),n()},document.addEventListener("keydown",r,!0),e.addEventListener("click",()=>{n()})}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 yt{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",yt.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,v)=>{const l=document.createElement("button");return l.textContent=f,l.style.width="32px",l.style.height="32px",l.style.padding="0",l.style.display="flex",l.style.justifyContent="center",l.style.alignItems="center",l.style.border="1px solid #ddd",l.style.backgroundColor="#f5f5f5",l.style.borderRadius="4px",l.style.cursor="pointer",l.style.fontSize="14px",y&&(l.style[y]=y==="fontWeight"?"bold":"italic"),l.onclick=v,l},s=n("B","fontWeight",()=>{if(this.currentNodeId&&this.onUpdate){const f=s.classList.contains("active"),y=f?"normal":"bold";this.onUpdate(this.currentNodeId,{fontWeight:y}),this.updateButtonState(s,!f)}}),o=n("I","fontStyle",()=>{if(this.currentNodeId&&this.onUpdate){const f=o.classList.contains("active"),y=f?"normal":"italic";this.onUpdate(this.currentNodeId,{fontStyle:y}),this.updateButtonState(o,!f)}});e.appendChild(s),e.appendChild(o),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 m=document.createElement("input");return m.type="color",m.style.width="24px",m.style.height="24px",m.style.border="1px solid #ccc",m.style.padding="0",m.style.backgroundColor="transparent",m.style.cursor="pointer",m.style.appearance="none",m.onchange=f=>{this.currentNodeId&&this.onUpdate&&(this.onUpdate(this.currentNodeId,{color:f.target.value}),this.updateActivePaletteItem(f.target.value))},yt.PALETTE.forEach((f,y)=>{const v=document.createElement("div");v.className="color-swatch",v.dataset.color=f,v.textContent=(y+1).toString(),v.style.width="24px",v.style.height="24px",v.style.backgroundColor=f,v.style.borderRadius="4px",v.style.cursor="pointer",v.style.border="1px solid transparent",v.style.color=f==="#F1C40F"?"black":"white",v.style.fontSize="12px",v.style.fontWeight="bold",v.style.display="flex",v.style.justifyContent="center",v.style.alignItems="center",v.onclick=()=>{this.currentNodeId&&this.onUpdate&&(this.onUpdate(this.currentNodeId,{color:f}),m.value=f,this.updateActivePaletteItem(f))},c.appendChild(v)}),c.appendChild(m),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 s=this.editorEl.querySelectorAll("button")[0];this.updateButtonState(s,e.fontWeight==="bold");const o=this.editorEl.querySelectorAll("button")[1];this.updateButtonState(o,e.fontStyle==="italic")}hide(){this.editorEl.style.display="none",this.currentNodeId=null}}class Gt{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 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))}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">
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});class Ut{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 gt{id;topic;children;style;parentId;isRoot;image;imageSize;icon;presentation;constructor(t,e,i=null,n=!1,r,s,o=!1,l,g,w){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:w}}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 jt{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 gt(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 gt(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 gt(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 w=this.mindMap.findNode(g.parentId);if(!w)break;g=w}}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 gt(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 gt(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 Ht{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 Zt{historyManager;constructor(t=10){this.historyManager=new Ht(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 Kt{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,e){if(!this.mindMap.findNode(t))return[];let n=!1;if(this.clipboard.length>0&&e!==void 0){const s=this.clipboard.map(l=>l.topic).join(`
|
|
3
|
+
`),o=e.replace(/\r\n/g,`
|
|
4
|
+
`);s===o&&(n=!0)}else this.clipboard.length>0&&e===void 0&&(n=!0);const r=[];if(!n&&e){const s=this.idGenerator.generate(),o=new gt(s,e);r.push(o)}else this.clipboard.length>0&&this.clipboard.forEach(s=>{const o=this.deepCloneNode(s);this.regenerateIds(o),r.push(o)});return r}deepCloneNode(t){const e=new gt(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 Xt{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 Nt={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)"}}},Yt={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)"}}},Tt=["#E74C3C","#3498DB","#2ECC71","#F1C40F","#9B59B6","#E67E22","#1ABC9C"],Gt={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=>Tt[Q%Tt.length]},$t={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=Nt;constructor(){this.registerTheme(Nt),this.registerTheme(Yt),this.registerTheme(Gt),this.registerTheme($t)}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=Nt.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 Vt{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,w=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 b=It[t.icon];if(b){const _=document.createElementNS("http://www.w3.org/2000/svg","svg");_.setAttribute("viewBox",b.viewBox),_.setAttribute("width","20"),_.setAttribute("height","20"),_.style.width="20px",_.style.height="20px",_.style.marginRight="8px",_.style.flexShrink="0",_.innerHTML=b.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(b=>{if(b.match(h)){const _=document.createElement("a");_.href=b,_.target="_blank",_.rel="noopener noreferrer",_.textContent=b,_.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(b))}),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"),w.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),w.name==="colorful")t.isRoot?u.style.border="2px solid var(--vscode-editor-foreground, #333)":u.style.border=`2px solid ${y}`;else if(w.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",w.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(w.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=w.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",b=>{b.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 w={width:l||100,height:g||40};return this.measureCache.set(t.id,w),w}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,w=`M ${t} ${e} C ${l} ${e}, ${g} ${n}, ${i} ${n}`;if(o.setAttribute("d",w),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 yt{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",yt.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 w=document.createElement("input");return w.type="color",w.style.width="24px",w.style.height="24px",w.style.border="1px solid #ccc",w.style.padding="0",w.style.backgroundColor="transparent",w.style.cursor="pointer",w.style.appearance="none",w.onchange=u=>{this.currentNodeId&&this.onUpdate&&(this.onUpdate(this.currentNodeId,{color:u.target.value}),this.updateActivePaletteItem(u.target.value))},yt.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}),w.value=u,this.updateActivePaletteItem(u))},g.appendChild(c)}),g.appendChild(w),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 Jt{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">
|
|
3
5
|
<circle cx="5" cy="12" r="3"></circle>
|
|
4
6
|
<path d="M8 12h8"></path>
|
|
5
7
|
<path d="M8 12 L16 5"></path>
|
|
@@ -38,20 +40,20 @@
|
|
|
38
40
|
<circle cx="12" cy="12" r="10"></circle>
|
|
39
41
|
<path d="M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"></path>
|
|
40
42
|
<line x1="12" y1="17" x2="12.01" y2="17"></line>
|
|
41
|
-
</svg>`}}const
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
`,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 s=this.getDropPosition(e,r);this.options.onDropNode(this.draggedNodeId,n,s)}}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,s=i.width,o=i.height;return n<o*.25?"top":n>o*.75?"bottom":r<s*.25?"left":(r>s*.75,"right")}}class qt{shortcuts;constructor(t){this.shortcuts=t}matches(t,e){const i=this.shortcuts[e];return i?i.some(r=>{const n=r.ctrlKey??!1,s=r.metaKey??!1,o=r.altKey??!1,c=r.shiftKey??!1;return t.ctrlKey!==n||t.metaKey!==s||t.altKey!==o||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 Qt{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={...$t,...e.shortcuts},this.nodeEditor=new Jt(t,this.maxWidth,e),this.nodeDragger=new Vt(t,e),this.shortcutManager=new qt(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,s,o)=>{r.addEventListener(n,s,o),this.cleanupFns.push(()=>{typeof r.removeEventListener=="function"&&r.removeEventListener(n,s,o)})};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 s=r.target.closest(".mindmap-node");s&&s.dataset.id?this.options.onNodeClick(s.dataset.id,r.shiftKey):this.options.onNodeClick(""),this.container.focus()}),t(this.container,"mousedown",r=>{const n=r,s=n.target;!s.closest(".mindmap-node")&&s.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 s=n.clientX-this.lastMouseX,o=n.clientY-this.lastMouseY;this.lastMouseX=n.clientX,this.lastMouseY=n.clientY,this.options.onPan&&this.options.onPan(s,o)}});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 s=1;n.deltaMode===1?s=33:n.deltaMode===2&&(s=window.innerHeight);const o=-n.deltaX*s,c=-n.deltaY*s;this.options.onPan&&this.options.onPan(o,c)},{passive:!1}),t(document,"keydown",r=>{const n=r,s=n.target;if(n.key==="z"&&(n.ctrlKey||n.metaKey)&&console.log("InteractionHandler: Ctrl+Z detected",{selectedNodeId:this.selectedNodeId,isReadOnly:this.isReadOnly,target:s.tagName}),s.tagName==="INPUT"||s.tagName==="TEXTAREA"||s.isContentEditable)return;if(!this.selectedNodeId){if(this.shortcutManager.matches(n,"navUp")){n.preventDefault(),this.options.onNavigate?.(null,"Up");return}if(this.shortcutManager.matches(n,"navDown")){n.preventDefault(),this.options.onNavigate?.(null,"Down");return}if(this.shortcutManager.matches(n,"navLeft")){n.preventDefault(),this.options.onNavigate?.(null,"Left");return}if(this.shortcutManager.matches(n,"navRight")){n.preventDefault(),this.options.onNavigate?.(null,"Right");return}}const o=this.shortcutManager.getAction(n);o&&(console.log("InteractionHandler: Action matched",o),this.handleAction(o,n))}),t(document,"paste",r=>{const n=r;if(this.isReadOnly||!this.selectedNodeId)return;const s=n.clipboardData?.items;if(!s||s.length===0){this.options.onPasteNode?.(this.selectedNodeId);return}let o=!1;for(const c of s)if(c.type.startsWith("image/")){const m=c.getAsFile();if(m){const f=new FileReader;f.onload=y=>{if(y.target?.result&&this.options.onPasteImage&&this.selectedNodeId){const v=y.target.result,l=new Image;l.onload=()=>{this.selectedNodeId&&this.options.onPasteImage&&this.options.onPasteImage(this.selectedNodeId,v,l.naturalWidth,l.naturalHeight)},l.src=v}},f.readAsDataURL(m)}n.preventDefault(),o=!0;break}o||this.options.onPasteNode?.(this.selectedNodeId)});const i=(r,n,s)=>t(r,n,s);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 s=r.target.closest(".mindmap-node");s&&s.dataset.id&&this.startEditing(s,s.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){switch(t){case"undo":e.preventDefault(),this.options.onUndo?.();return;case"redo":e.preventDefault(),this.options.onRedo?.();return;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)}return;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)}return;case"resetZoom":e.preventDefault(),this.options.onZoomReset?.();return;case"openCommandPalette":e.preventDefault(),this.options.onToggleCommandPalette?.();return}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",e.shiftKey);return;case"navDown":e.preventDefault(),this.options.onNavigate?.(this.selectedNodeId,"Down",e.shiftKey);return;case"navRight":e.preventDefault(),this.options.onNavigate?.(this.selectedNodeId,"Right",e.shiftKey);return;case"navLeft":e.preventDefault(),this.options.onNavigate?.(this.selectedNodeId,"Left",e.shiftKey);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"cut":e.preventDefault(),this.options.onCutNode?.(this.selectedNodeId);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"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 te{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(r=>!(r.id==="icon"&&i.includes("icon")||r.id==="search-nodes"&&i.includes("search")||r.id==="import"&&i.includes("import")||r.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",r=>{const n=r.target.value;if(this.mode==="menu")this.renderList(this.getMenuResults(n));else if(this.mode==="import"){const s=this.IMPORT_COMMANDS.filter(o=>o.topic.toLowerCase().includes(n.toLowerCase()));this.renderList(s)}else if(this.mode==="export"){const s=this.EXPORT_COMMANDS.filter(o=>o.topic.toLowerCase().includes(n.toLowerCase()));this.renderList(s)}else if(this.mode==="icon"){const s=this.ICON_LIST.filter(o=>o.topic.toLowerCase().includes(n.toLowerCase()));this.renderList(s)}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.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(n=>n.topic.toLowerCase().includes(e)),r=this.customCommands.filter(n=>n.topic.toLowerCase().includes(e));return[...i,...r.map(n=>({...n,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 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 o=document.createElement("div");o.style.width="20px",o.style.height="20px",o.style.marginRight="8px",o.style.flexShrink="0",o.innerHTML=`<svg viewBox="${n.viewBox}" width="20" height="20">${n.path}</svg>`,r.appendChild(o)}const s=document.createElement("span");s.textContent=e.topic,r.appendChild(s)}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){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 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 ee(it){return it&&it.__esModule&&Object.prototype.hasOwnProperty.call(it,"default")?it.default:it}function Ct(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 Et={exports:{}};var Mt;function ie(){return Mt||(Mt=1,(function(it,t){(function(e){it.exports=e()})(function(){return(function e(i,r,n){function s(m,f){if(!r[m]){if(!i[m]){var y=typeof Ct=="function"&&Ct;if(!f&&y)return y(m,!0);if(o)return o(m,!0);var v=new Error("Cannot find module '"+m+"'");throw v.code="MODULE_NOT_FOUND",v}var l=r[m]={exports:{}};i[m][0].call(l.exports,function(g){var h=i[m][1][g];return s(h||g)},l,l.exports,e,i,r,n)}return r[m].exports}for(var o=typeof Ct=="function"&&Ct,c=0;c<n.length;c++)s(n[c]);return s})({1:[function(e,i,r){var n=e("./utils"),s=e("./support"),o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";r.encode=function(c){for(var m,f,y,v,l,g,h,p=[],u=0,b=c.length,k=b,S=n.getTypeOf(c)!=="string";u<c.length;)k=b-u,y=S?(m=c[u++],f=u<b?c[u++]:0,u<b?c[u++]:0):(m=c.charCodeAt(u++),f=u<b?c.charCodeAt(u++):0,u<b?c.charCodeAt(u++):0),v=m>>2,l=(3&m)<<4|f>>4,g=1<k?(15&f)<<2|y>>6:64,h=2<k?63&y:64,p.push(o.charAt(v)+o.charAt(l)+o.charAt(g)+o.charAt(h));return p.join("")},r.decode=function(c){var m,f,y,v,l,g,h=0,p=0,u="data:";if(c.substr(0,u.length)===u)throw new Error("Invalid base64 input, it looks like a data url.");var b,k=3*(c=c.replace(/[^A-Za-z0-9+/=]/g,"")).length/4;if(c.charAt(c.length-1)===o.charAt(64)&&k--,c.charAt(c.length-2)===o.charAt(64)&&k--,k%1!=0)throw new Error("Invalid base64 input, bad content length.");for(b=s.uint8array?new Uint8Array(0|k):new Array(0|k);h<c.length;)m=o.indexOf(c.charAt(h++))<<2|(v=o.indexOf(c.charAt(h++)))>>4,f=(15&v)<<4|(l=o.indexOf(c.charAt(h++)))>>2,y=(3&l)<<6|(g=o.indexOf(c.charAt(h++))),b[p++]=m,l!==64&&(b[p++]=f),g!==64&&(b[p++]=y);return b}},{"./support":30,"./utils":32}],2:[function(e,i,r){var n=e("./external"),s=e("./stream/DataWorker"),o=e("./stream/Crc32Probe"),c=e("./stream/DataLengthProbe");function m(f,y,v,l,g){this.compressedSize=f,this.uncompressedSize=y,this.crc32=v,this.compression=l,this.compressedContent=g}m.prototype={getContentWorker:function(){var f=new s(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 s(n.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},m.createWorkerFrom=function(f,y,v){return f.pipe(new o).pipe(new c("uncompressedSize")).pipe(y.compressWorker(v)).pipe(new c("compressedSize")).withStreamInfo("compression",y)},i.exports=m},{"./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"),s=(function(){for(var o,c=[],m=0;m<256;m++){o=m;for(var f=0;f<8;f++)o=1&o?3988292384^o>>>1:o>>>1;c[m]=o}return c})();i.exports=function(o,c){return o!==void 0&&o.length?n.getTypeOf(o)!=="string"?(function(m,f,y,v){var l=s,g=v+y;m^=-1;for(var h=v;h<g;h++)m=m>>>8^l[255&(m^f[h])];return-1^m})(0|c,o,o.length,0):(function(m,f,y,v){var l=s,g=v+y;m^=-1;for(var h=v;h<g;h++)m=m>>>8^l[255&(m^f.charCodeAt(h))];return-1^m})(0|c,o,o.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",s=e("pako"),o=e("./utils"),c=e("./stream/GenericWorker"),m=n?"uint8array":"array";function f(y,v){c.call(this,"FlateWorker/"+y),this._pako=null,this._pakoAction=y,this._pakoOptions=v,this.meta={}}r.magic="\b\0",o.inherits(f,c),f.prototype.processChunk=function(y){this.meta=y.meta,this._pako===null&&this._createPako(),this._pako.push(o.transformTo(m,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 s[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var y=this;this._pako.onData=function(v){y.push({data:v,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(l,g){var h,p="";for(h=0;h<g;h++)p+=String.fromCharCode(255&l),l>>>=8;return p}function s(l,g,h,p,u,b){var k,S,C=l.file,L=l.compression,B=b!==m.utf8encode,P=o.transformTo("string",b(C.name)),T=o.transformTo("string",m.utf8encode(C.name)),H=C.comment,K=o.transformTo("string",b(H)),_=o.transformTo("string",m.utf8encode(H)),D=T.length!==C.name.length,d=_.length!==H.length,M="",V="",W="",Q=C.dir,U=C.date,q={crc32:0,compressedSize:0,uncompressedSize:0};g&&!h||(q.crc32=l.crc32,q.compressedSize=l.compressedSize,q.uncompressedSize=l.uncompressedSize);var z=0;g&&(z|=8),B||!D&&!d||(z|=2048);var I=0,J=0;Q&&(I|=16),u==="UNIX"?(J=798,I|=(function(X,st){var dt=X;return X||(dt=st?16893:33204),(65535&dt)<<16})(C.unixPermissions,Q)):(J=20,I|=(function(X){return 63&(X||0)})(C.dosPermissions)),k=U.getUTCHours(),k<<=6,k|=U.getUTCMinutes(),k<<=5,k|=U.getUTCSeconds()/2,S=U.getUTCFullYear()-1980,S<<=4,S|=U.getUTCMonth()+1,S<<=5,S|=U.getUTCDate(),D&&(V=n(1,1)+n(f(P),4)+T,M+="up"+n(V.length,2)+V),d&&(W=n(1,1)+n(f(K),4)+_,M+="uc"+n(W.length,2)+W);var Y="";return Y+=`
|
|
56
|
-
\0`,Y+=n(z,2),Y+=L.magic,Y+=n(k,2),Y+=n(S,2),Y+=n(q.crc32,4),Y+=n(q.compressedSize,4),Y+=n(q.uncompressedSize,4),Y+=n(P.length,2),Y+=n(M.length,2),{fileRecord:y.LOCAL_FILE_HEADER+Y+P+M,dirRecord:y.CENTRAL_FILE_HEADER+n(J,2)+Y+n(K.length,2)+"\0\0\0\0"+n(I,4)+n(p,4)+P+M+K}}var o=e("../utils"),c=e("../stream/GenericWorker"),m=e("../utf8"),f=e("../crc32"),y=e("../signature");function v(l,g,h,p){c.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=g,this.zipPlatform=h,this.encodeFileName=p,this.streamFiles=l,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}o.inherits(v,c),v.prototype.push=function(l){var g=l.meta.percent||0,h=this.entriesCount,p=this._sources.length;this.accumulate?this.contentBuffer.push(l):(this.bytesWritten+=l.data.length,c.prototype.push.call(this,{data:l.data,meta:{currentFile:this.currentFile,percent:h?(g+100*(h-p-1))/h:100}}))},v.prototype.openedSource=function(l){this.currentSourceOffset=this.bytesWritten,this.currentFile=l.file.name;var g=this.streamFiles&&!l.file.dir;if(g){var h=s(l,g,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:h.fileRecord,meta:{percent:0}})}else this.accumulate=!0},v.prototype.closedSource=function(l){this.accumulate=!1;var g=this.streamFiles&&!l.file.dir,h=s(l,g,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(h.dirRecord),g)this.push({data:(function(p){return y.DATA_DESCRIPTOR+n(p.crc32,4)+n(p.compressedSize,4)+n(p.uncompressedSize,4)})(l),meta:{percent:100}});else for(this.push({data:h.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},v.prototype.flush=function(){for(var l=this.bytesWritten,g=0;g<this.dirRecords.length;g++)this.push({data:this.dirRecords[g],meta:{percent:100}});var h=this.bytesWritten-l,p=(function(u,b,k,S,C){var L=o.transformTo("string",C(S));return y.CENTRAL_DIRECTORY_END+"\0\0\0\0"+n(u,2)+n(u,2)+n(b,4)+n(k,4)+n(L.length,2)+L})(this.dirRecords.length,h,l,this.zipComment,this.encodeFileName);this.push({data:p,meta:{percent:100}})},v.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()},v.prototype.registerPrevious=function(l){this._sources.push(l);var g=this;return l.on("data",function(h){g.processChunk(h)}),l.on("end",function(){g.closedSource(g.previous.streamInfo),g._sources.length?g.prepareNextSource():g.end()}),l.on("error",function(h){g.error(h)}),this},v.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))},v.prototype.error=function(l){var g=this._sources;if(!c.prototype.error.call(this,l))return!1;for(var h=0;h<g.length;h++)try{g[h].error(l)}catch{}return!0},v.prototype.lock=function(){c.prototype.lock.call(this);for(var l=this._sources,g=0;g<l.length;g++)l[g].lock()},i.exports=v},{"../crc32":4,"../signature":23,"../stream/GenericWorker":28,"../utf8":31,"../utils":32}],9:[function(e,i,r){var n=e("../compressions"),s=e("./ZipFileWorker");r.generateWorker=function(o,c,m){var f=new s(c.streamFiles,m,c.platform,c.encodeFileName),y=0;try{o.forEach(function(v,l){y++;var g=(function(b,k){var S=b||k,C=n[S];if(!C)throw new Error(S+" is not a valid compression method !");return C})(l.options.compression,c.compression),h=l.options.compressionOptions||c.compressionOptions||{},p=l.dir,u=l.date;l._compressWorker(g,h).withStreamInfo("file",{name:v,dir:p,date:u,comment:l.comment||"",unixPermissions:l.unixPermissions,dosPermissions:l.dosPermissions}).pipe(f)}),f.entriesCount=y}catch(v){f.error(v)}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 s=new n;for(var o in this)typeof this[o]!="function"&&(s[o]=this[o]);return s}}(n.prototype=e("./object")).loadAsync=e("./load"),n.support=e("./support"),n.defaults=e("./defaults"),n.version="3.10.1",n.loadAsync=function(s,o){return new n().loadAsync(s,o)},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"),s=e("./external"),o=e("./utf8"),c=e("./zipEntries"),m=e("./stream/Crc32Probe"),f=e("./nodejsUtils");function y(v){return new s.Promise(function(l,g){var h=v.decompressed.getContentWorker().pipe(new m);h.on("error",function(p){g(p)}).on("end",function(){h.streamInfo.crc32!==v.decompressed.crc32?g(new Error("Corrupted zip : CRC32 mismatch")):l()}).resume()})}i.exports=function(v,l){var g=this;return l=n.extend(l||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:o.utf8decode}),f.isNode&&f.isStream(v)?s.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):n.prepareContent("the loaded zip file",v,!0,l.optimizedBinaryString,l.base64).then(function(h){var p=new c(l);return p.load(h),p}).then(function(h){var p=[s.Promise.resolve(h)],u=h.files;if(l.checkCRC32)for(var b=0;b<u.length;b++)p.push(y(u[b]));return s.Promise.all(p)}).then(function(h){for(var p=h.shift(),u=p.files,b=0;b<u.length;b++){var k=u[b],S=k.fileNameStr,C=n.resolve(k.fileNameStr);g.file(C,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:l.createFolders}),k.dir||(g.file(C).unsafeOriginalName=S)}return p.zipComment.length&&(g.comment=p.zipComment),g})}},{"./external":6,"./nodejsUtils":14,"./stream/Crc32Probe":25,"./utf8":31,"./utils":32,"./zipEntries":33}],12:[function(e,i,r){var n=e("../utils"),s=e("../stream/GenericWorker");function o(c,m){s.call(this,"Nodejs stream input adapter for "+c),this._upstreamEnded=!1,this._bindStream(m)}n.inherits(o,s),o.prototype._bindStream=function(c){var m=this;(this._stream=c).pause(),c.on("data",function(f){m.push({data:f,meta:{percent:0}})}).on("error",function(f){m.isPaused?this.generatedError=f:m.error(f)}).on("end",function(){m.isPaused?m._upstreamEnded=!0:m.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,r){var n=e("readable-stream").Readable;function s(o,c,m){n.call(this,c),this._helper=o;var f=this;o.on("data",function(y,v){f.push(y)||f._helper.pause(),m&&m(v)}).on("error",function(y){f.emit("error",y)}).on("end",function(){f.push(null)})}e("../utils").inherits(s,n),s.prototype._read=function(){this._helper.resume()},i.exports=s},{"../utils":32,"readable-stream":16}],14:[function(e,i,r){i.exports={isNode:typeof Buffer<"u",newBufferFrom:function(n,s){if(Buffer.from&&Buffer.from!==Uint8Array.from)return Buffer.from(n,s);if(typeof n=="number")throw new Error('The "data" argument must not be a number');return new Buffer(n,s)},allocBuffer:function(n){if(Buffer.alloc)return Buffer.alloc(n);var s=new Buffer(n);return s.fill(0),s},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(C,L,B){var P,T=o.getTypeOf(L),H=o.extend(B||{},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&&(C=u(C)),H.createFolders&&(P=p(C))&&b.call(this,P,!0);var K=T==="string"&&H.binary===!1&&H.base64===!1;B&&B.binary!==void 0||(H.binary=!K),(L instanceof y&&L.uncompressedSize===0||H.dir||!L||L.length===0)&&(H.base64=!1,H.binary=!0,L="",H.compression="STORE",T="string");var _=null;_=L instanceof y||L instanceof c?L:g.isNode&&g.isStream(L)?new h(C,L):o.prepareContent(C,L,H.binary,H.optimizedBinaryString,H.base64);var D=new v(C,_,H);this.files[C]=D}var s=e("./utf8"),o=e("./utils"),c=e("./stream/GenericWorker"),m=e("./stream/StreamHelper"),f=e("./defaults"),y=e("./compressedObject"),v=e("./zipObject"),l=e("./generate"),g=e("./nodejsUtils"),h=e("./nodejs/NodejsStreamInputAdapter"),p=function(C){C.slice(-1)==="/"&&(C=C.substring(0,C.length-1));var L=C.lastIndexOf("/");return 0<L?C.substring(0,L):""},u=function(C){return C.slice(-1)!=="/"&&(C+="/"),C},b=function(C,L){return L=L!==void 0?L:f.createFolders,C=u(C),this.files[C]||n.call(this,C,null,{dir:!0,createFolders:L}),this.files[C]};function k(C){return Object.prototype.toString.call(C)==="[object RegExp]"}var S={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(C){var L,B,P;for(L in this.files)P=this.files[L],(B=L.slice(this.root.length,L.length))&&L.slice(0,this.root.length)===this.root&&C(B,P)},filter:function(C){var L=[];return this.forEach(function(B,P){C(B,P)&&L.push(P)}),L},file:function(C,L,B){if(arguments.length!==1)return C=this.root+C,n.call(this,C,L,B),this;if(k(C)){var P=C;return this.filter(function(H,K){return!K.dir&&P.test(H)})}var T=this.files[this.root+C];return T&&!T.dir?T:null},folder:function(C){if(!C)return this;if(k(C))return this.filter(function(T,H){return H.dir&&C.test(T)});var L=this.root+C,B=b.call(this,L),P=this.clone();return P.root=B.name,P},remove:function(C){C=this.root+C;var L=this.files[C];if(L||(C.slice(-1)!=="/"&&(C+="/"),L=this.files[C]),L&&!L.dir)delete this.files[C];else for(var B=this.filter(function(T,H){return H.name.slice(0,C.length)===C}),P=0;P<B.length;P++)delete this.files[B[P].name];return this},generate:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(C){var L,B={};try{if((B=o.extend(C||{},{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 P=B.comment||this.comment||"";L=l.generateWorker(this,B,P)}catch(T){(L=new c("error")).error(T)}return new m(L,B.type||"string",B.mimeType)},generateAsync:function(C,L){return this.generateInternalStream(C).accumulate(L)},generateNodeStream:function(C,L){return(C=C||{}).type||(C.type="nodebuffer"),this.generateInternalStream(C).toNodejsStream(L)}};i.exports=S},{"./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 s(o){n.call(this,o);for(var c=0;c<this.data.length;c++)o[c]=255&o[c]}e("../utils").inherits(s,n),s.prototype.byteAt=function(o){return this.data[this.zero+o]},s.prototype.lastIndexOfSignature=function(o){for(var c=o.charCodeAt(0),m=o.charCodeAt(1),f=o.charCodeAt(2),y=o.charCodeAt(3),v=this.length-4;0<=v;--v)if(this.data[v]===c&&this.data[v+1]===m&&this.data[v+2]===f&&this.data[v+3]===y)return v-this.zero;return-1},s.prototype.readAndCheckSignature=function(o){var c=o.charCodeAt(0),m=o.charCodeAt(1),f=o.charCodeAt(2),y=o.charCodeAt(3),v=this.readData(4);return c===v[0]&&m===v[1]&&f===v[2]&&y===v[3]},s.prototype.readData=function(o){if(this.checkOffset(o),o===0)return[];var c=this.data.slice(this.zero+this.index,this.zero+this.index+o);return this.index+=o,c},i.exports=s},{"../utils":32,"./DataReader":18}],18:[function(e,i,r){var n=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 c,m=0;for(this.checkOffset(o),c=this.index+o-1;c>=this.index;c--)m=(m<<8)+this.byteAt(c);return this.index+=o,m},readString:function(o){return n.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,r){var n=e("./Uint8ArrayReader");function s(o){n.call(this,o)}e("../utils").inherits(s,n),s.prototype.readData=function(o){this.checkOffset(o);var c=this.data.slice(this.zero+this.index,this.zero+this.index+o);return this.index+=o,c},i.exports=s},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(e,i,r){var n=e("./DataReader");function s(o){n.call(this,o)}e("../utils").inherits(s,n),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 c=this.data.slice(this.zero+this.index,this.zero+this.index+o);return this.index+=o,c},i.exports=s},{"../utils":32,"./DataReader":18}],21:[function(e,i,r){var n=e("./ArrayReader");function s(o){n.call(this,o)}e("../utils").inherits(s,n),s.prototype.readData=function(o){if(this.checkOffset(o),o===0)return new Uint8Array(0);var c=this.data.subarray(this.zero+this.index,this.zero+this.index+o);return this.index+=o,c},i.exports=s},{"../utils":32,"./ArrayReader":17}],22:[function(e,i,r){var n=e("../utils"),s=e("../support"),o=e("./ArrayReader"),c=e("./StringReader"),m=e("./NodeBufferReader"),f=e("./Uint8ArrayReader");i.exports=function(y){var v=n.getTypeOf(y);return n.checkSupport(v),v!=="string"||s.uint8array?v==="nodebuffer"?new m(y):s.uint8array?new f(n.transformTo("uint8array",y)):new o(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"),s=e("../utils");function o(c){n.call(this,"ConvertWorker to "+c),this.destType=c}s.inherits(o,n),o.prototype.processChunk=function(c){this.push({data:s.transformTo(this.destType,c.data),meta:c.meta})},i.exports=o},{"../utils":32,"./GenericWorker":28}],25:[function(e,i,r){var n=e("./GenericWorker"),s=e("../crc32");function o(){n.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}e("../utils").inherits(o,n),o.prototype.processChunk=function(c){this.streamInfo.crc32=s(c.data,this.streamInfo.crc32||0),this.push(c)},i.exports=o},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(e,i,r){var n=e("../utils"),s=e("./GenericWorker");function o(c){s.call(this,"DataLengthProbe for "+c),this.propName=c,this.withStreamInfo(c,0)}n.inherits(o,s),o.prototype.processChunk=function(c){if(c){var m=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=m+c.data.length}s.prototype.processChunk.call(this,c)},i.exports=o},{"../utils":32,"./GenericWorker":28}],27:[function(e,i,r){var n=e("../utils"),s=e("./GenericWorker");function o(c){s.call(this,"DataWorker");var m=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,c.then(function(f){m.dataIsReady=!0,m.data=f,m.max=f&&f.length||0,m.type=n.getTypeOf(f),m.isPaused||m._tickAndRepeat()},function(f){m.error(f)})}n.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,n.delay(this._tickAndRepeat,[],this)),!0)},o.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(n.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},o.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var c=null,m=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,m);break;case"uint8array":c=this.data.subarray(this.index,m);break;case"array":case"nodebuffer":c=this.data.slice(this.index,m)}return this.index=m,this.push({data:c,meta:{percent:this.max?this.index/this.max*100:0}})},i.exports=o},{"../utils":32,"./GenericWorker":28}],28:[function(e,i,r){function n(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}n.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 c=0;c<this._listeners[s].length;c++)this._listeners[s][c].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(c){o.processChunk(c)}),s.on("end",function(){o.end()}),s.on("error",function(c){o.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 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=n},{}],29:[function(e,i,r){var n=e("../utils"),s=e("./ConvertWorker"),o=e("./GenericWorker"),c=e("../base64"),m=e("../support"),f=e("../external"),y=null;if(m.nodestream)try{y=e("../nodejs/NodejsStreamOutputAdapter")}catch{}function v(g,h){return new f.Promise(function(p,u){var b=[],k=g._internalType,S=g._outputType,C=g._mimeType;g.on("data",function(L,B){b.push(L),h&&h(B)}).on("error",function(L){b=[],u(L)}).on("end",function(){try{var L=(function(B,P,T){switch(B){case"blob":return n.newBlob(n.transformTo("arraybuffer",P),T);case"base64":return c.encode(P);default:return n.transformTo(B,P)}})(S,(function(B,P){var T,H=0,K=null,_=0;for(T=0;T<P.length;T++)_+=P[T].length;switch(B){case"string":return P.join("");case"array":return Array.prototype.concat.apply([],P);case"uint8array":for(K=new Uint8Array(_),T=0;T<P.length;T++)K.set(P[T],H),H+=P[T].length;return K;case"nodebuffer":return Buffer.concat(P);default:throw new Error("concat : unsupported type '"+B+"'")}})(k,b),C);p(L)}catch(B){u(B)}b=[]}).resume()})}function l(g,h,p){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=p,n.checkSupport(u),this._worker=g.pipe(new s(u)),g.lock()}catch(b){this._worker=new o("error"),this._worker.error(b)}}l.prototype={accumulate:function(g){return v(this,g)},on:function(g,h){var p=this;return g==="data"?this._worker.on(g,function(u){h.call(p,u.data,u.meta)}):this._worker.on(g,function(){n.delay(h,arguments,p)}),this},resume:function(){return n.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(g){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"},g)}},i.exports=l},{"../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 s=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);s.append(n),r.blob=s.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"),s=e("./support"),o=e("./nodejsUtils"),c=e("./stream/GenericWorker"),m=new Array(256),f=0;f<256;f++)m[f]=252<=f?6:248<=f?5:240<=f?4:224<=f?3:192<=f?2:1;m[254]=m[254]=1;function y(){c.call(this,"utf-8 decode"),this.leftOver=null}function v(){c.call(this,"utf-8 encode")}r.utf8encode=function(l){return s.nodebuffer?o.newBufferFrom(l,"utf-8"):(function(g){var h,p,u,b,k,S=g.length,C=0;for(b=0;b<S;b++)(64512&(p=g.charCodeAt(b)))==55296&&b+1<S&&(64512&(u=g.charCodeAt(b+1)))==56320&&(p=65536+(p-55296<<10)+(u-56320),b++),C+=p<128?1:p<2048?2:p<65536?3:4;for(h=s.uint8array?new Uint8Array(C):new Array(C),b=k=0;k<C;b++)(64512&(p=g.charCodeAt(b)))==55296&&b+1<S&&(64512&(u=g.charCodeAt(b+1)))==56320&&(p=65536+(p-55296<<10)+(u-56320),b++),p<128?h[k++]=p:(p<2048?h[k++]=192|p>>>6:(p<65536?h[k++]=224|p>>>12:(h[k++]=240|p>>>18,h[k++]=128|p>>>12&63),h[k++]=128|p>>>6&63),h[k++]=128|63&p);return h})(l)},r.utf8decode=function(l){return s.nodebuffer?n.transformTo("nodebuffer",l).toString("utf-8"):(function(g){var h,p,u,b,k=g.length,S=new Array(2*k);for(h=p=0;h<k;)if((u=g[h++])<128)S[p++]=u;else if(4<(b=m[u]))S[p++]=65533,h+=b-1;else{for(u&=b===2?31:b===3?15:7;1<b&&h<k;)u=u<<6|63&g[h++],b--;1<b?S[p++]=65533:u<65536?S[p++]=u:(u-=65536,S[p++]=55296|u>>10&1023,S[p++]=56320|1023&u)}return S.length!==p&&(S.subarray?S=S.subarray(0,p):S.length=p),n.applyFromCharCode(S)})(l=n.transformTo(s.uint8array?"uint8array":"array",l))},n.inherits(y,c),y.prototype.processChunk=function(l){var g=n.transformTo(s.uint8array?"uint8array":"array",l.data);if(this.leftOver&&this.leftOver.length){if(s.uint8array){var h=g;(g=new Uint8Array(h.length+this.leftOver.length)).set(this.leftOver,0),g.set(h,this.leftOver.length)}else g=this.leftOver.concat(g);this.leftOver=null}var p=(function(b,k){var S;for((k=k||b.length)>b.length&&(k=b.length),S=k-1;0<=S&&(192&b[S])==128;)S--;return S<0||S===0?k:S+m[b[S]]>k?S:k})(g),u=g;p!==g.length&&(s.uint8array?(u=g.subarray(0,p),this.leftOver=g.subarray(p,g.length)):(u=g.slice(0,p),this.leftOver=g.slice(p,g.length))),this.push({data:r.utf8decode(u),meta:l.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(v,c),v.prototype.processChunk=function(l){this.push({data:r.utf8encode(l.data),meta:l.meta})},r.Utf8EncodeWorker=v},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(e,i,r){var n=e("./support"),s=e("./base64"),o=e("./nodejsUtils"),c=e("./external");function m(h){return h}function f(h,p){for(var u=0;u<h.length;++u)p[u]=255&h.charCodeAt(u);return p}e("setimmediate"),r.newBlob=function(h,p){r.checkSupport("blob");try{return new Blob([h],{type:p})}catch{try{var u=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);return u.append(h),u.getBlob(p)}catch{throw new Error("Bug : can't construct the Blob.")}}};var y={stringifyByChunk:function(h,p,u){var b=[],k=0,S=h.length;if(S<=u)return String.fromCharCode.apply(null,h);for(;k<S;)p==="array"||p==="nodebuffer"?b.push(String.fromCharCode.apply(null,h.slice(k,Math.min(k+u,S)))):b.push(String.fromCharCode.apply(null,h.subarray(k,Math.min(k+u,S)))),k+=u;return b.join("")},stringifyByChar:function(h){for(var p="",u=0;u<h.length;u++)p+=String.fromCharCode(h[u]);return p},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,o.allocBuffer(1)).length===1}catch{return!1}})()}};function v(h){var p=65536,u=r.getTypeOf(h),b=!0;if(u==="uint8array"?b=y.applyCanBeUsed.uint8array:u==="nodebuffer"&&(b=y.applyCanBeUsed.nodebuffer),b)for(;1<p;)try{return y.stringifyByChunk(h,u,p)}catch{p=Math.floor(p/2)}return y.stringifyByChar(h)}function l(h,p){for(var u=0;u<h.length;u++)p[u]=h[u];return p}r.applyFromCharCode=v;var g={};g.string={string:m,array:function(h){return f(h,new Array(h.length))},arraybuffer:function(h){return g.string.uint8array(h).buffer},uint8array:function(h){return f(h,new Uint8Array(h.length))},nodebuffer:function(h){return f(h,o.allocBuffer(h.length))}},g.array={string:v,array:m,arraybuffer:function(h){return new Uint8Array(h).buffer},uint8array:function(h){return new Uint8Array(h)},nodebuffer:function(h){return o.newBufferFrom(h)}},g.arraybuffer={string:function(h){return v(new Uint8Array(h))},array:function(h){return l(new Uint8Array(h),new Array(h.byteLength))},arraybuffer:m,uint8array:function(h){return new Uint8Array(h)},nodebuffer:function(h){return o.newBufferFrom(new Uint8Array(h))}},g.uint8array={string:v,array:function(h){return l(h,new Array(h.length))},arraybuffer:function(h){return h.buffer},uint8array:m,nodebuffer:function(h){return o.newBufferFrom(h)}},g.nodebuffer={string:v,array:function(h){return l(h,new Array(h.length))},arraybuffer:function(h){return g.nodebuffer.uint8array(h).buffer},uint8array:function(h){return l(h,new Uint8Array(h.length))},nodebuffer:m},r.transformTo=function(h,p){if(p=p||"",!h)return p;r.checkSupport(h);var u=r.getTypeOf(p);return g[u][h](p)},r.resolve=function(h){for(var p=h.split("/"),u=[],b=0;b<p.length;b++){var k=p[b];k==="."||k===""&&b!==0&&b!==p.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&&o.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 p,u,b="";for(u=0;u<(h||"").length;u++)b+="\\x"+((p=h.charCodeAt(u))<16?"0":"")+p.toString(16).toUpperCase();return b},r.delay=function(h,p,u){setImmediate(function(){h.apply(u||null,p||[])})},r.inherits=function(h,p){function u(){}u.prototype=p.prototype,h.prototype=new u},r.extend=function(){var h,p,u={};for(h=0;h<arguments.length;h++)for(p in arguments[h])Object.prototype.hasOwnProperty.call(arguments[h],p)&&u[p]===void 0&&(u[p]=arguments[h][p]);return u},r.prepareContent=function(h,p,u,b,k){return c.Promise.resolve(p).then(function(S){return n.blob&&(S instanceof Blob||["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(S))!==-1)&&typeof FileReader<"u"?new c.Promise(function(C,L){var B=new FileReader;B.onload=function(P){C(P.target.result)},B.onerror=function(P){L(P.target.error)},B.readAsArrayBuffer(S)}):S}).then(function(S){var C=r.getTypeOf(S);return C?(C==="arraybuffer"?S=r.transformTo("uint8array",S):C==="string"&&(k?S=s.decode(S):u&&b!==!0&&(S=(function(L){return f(L,n.uint8array?new Uint8Array(L.length):new Array(L.length))})(S))),S):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"),s=e("./utils"),o=e("./signature"),c=e("./zipEntry"),m=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 v=this.reader.readString(4);throw new Error("Corrupted zip or bug: unexpected signature ("+s.pretty(v)+", expected "+s.pretty(y)+")")}},isSignature:function(y,v){var l=this.reader.index;this.reader.setIndex(y);var g=this.reader.readString(4)===v;return this.reader.setIndex(l),g},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),v=m.uint8array?"uint8array":"array",l=s.transformTo(v,y);this.zipComment=this.loadOptions.decodeFileName(l)},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,v,l,g=this.zip64EndOfCentralSize-44;0<g;)y=this.reader.readInt(2),v=this.reader.readInt(4),l=this.reader.readData(v),this.zip64ExtensibleData[y]={id:y,length:v,value:l}},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,v;for(y=0;y<this.files.length;y++)v=this.files[y],this.reader.setIndex(v.localHeaderOffset),this.checkSignature(o.LOCAL_FILE_HEADER),v.readLocalPart(this.reader),v.handleUTF8(),v.processAttributes()},readCentralDir:function(){var y;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(o.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(o.CENTRAL_DIRECTORY_END);if(y<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(y);var v=y;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,(y=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(y),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 l=this.centralDirOffset+this.centralDirSize;this.zip64&&(l+=20,l+=12+this.zip64EndOfCentralSize);var g=v-l;if(0<g)this.isSignature(v,o.CENTRAL_FILE_HEADER)||(this.reader.zero=g);else if(g<0)throw new Error("Corrupted zip: missing "+Math.abs(g)+" 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"),s=e("./utils"),o=e("./compressedObject"),c=e("./crc32"),m=e("./utf8"),f=e("./compressions"),y=e("./support");function v(l,g){this.options=l,this.loadOptions=g}v.prototype={isEncrypted:function(){return(1&this.bitFlag)==1},useUTF8:function(){return(2048&this.bitFlag)==2048},readLocalPart:function(l){var g,h;if(l.skip(22),this.fileNameLength=l.readInt(2),h=l.readInt(2),this.fileName=l.readData(this.fileNameLength),l.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((g=(function(p){for(var u in f)if(Object.prototype.hasOwnProperty.call(f,u)&&f[u].magic===p)return f[u];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,g,l.readData(this.compressedSize))},readCentralPart:function(l){this.versionMadeBy=l.readInt(2),l.skip(2),this.bitFlag=l.readInt(2),this.compressionMethod=l.readString(2),this.date=l.readDate(),this.crc32=l.readInt(4),this.compressedSize=l.readInt(4),this.uncompressedSize=l.readInt(4);var g=l.readInt(2);if(this.extraFieldsLength=l.readInt(2),this.fileCommentLength=l.readInt(2),this.diskNumberStart=l.readInt(2),this.internalFileAttributes=l.readInt(2),this.externalFileAttributes=l.readInt(4),this.localHeaderOffset=l.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");l.skip(g),this.readExtraFields(l),this.parseZIP64ExtraField(l),this.fileComment=l.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var l=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),l==0&&(this.dosPermissions=63&this.externalFileAttributes),l==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var l=n(this.extraFields[1].value);this.uncompressedSize===s.MAX_VALUE_32BITS&&(this.uncompressedSize=l.readInt(8)),this.compressedSize===s.MAX_VALUE_32BITS&&(this.compressedSize=l.readInt(8)),this.localHeaderOffset===s.MAX_VALUE_32BITS&&(this.localHeaderOffset=l.readInt(8)),this.diskNumberStart===s.MAX_VALUE_32BITS&&(this.diskNumberStart=l.readInt(4))}},readExtraFields:function(l){var g,h,p,u=l.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});l.index+4<u;)g=l.readInt(2),h=l.readInt(2),p=l.readData(h),this.extraFields[g]={id:g,length:h,value:p};l.setIndex(u)},handleUTF8:function(){var l=y.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=m.utf8decode(this.fileName),this.fileCommentStr=m.utf8decode(this.fileComment);else{var g=this.findExtraFieldUnicodePath();if(g!==null)this.fileNameStr=g;else{var h=s.transformTo(l,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(h)}var p=this.findExtraFieldUnicodeComment();if(p!==null)this.fileCommentStr=p;else{var u=s.transformTo(l,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(u)}}},findExtraFieldUnicodePath:function(){var l=this.extraFields[28789];if(l){var g=n(l.value);return g.readInt(1)!==1||c(this.fileName)!==g.readInt(4)?null:m.utf8decode(g.readData(l.length-5))}return null},findExtraFieldUnicodeComment:function(){var l=this.extraFields[25461];if(l){var g=n(l.value);return g.readInt(1)!==1||c(this.fileComment)!==g.readInt(4)?null:m.utf8decode(g.readData(l.length-5))}return null}},i.exports=v},{"./compressedObject":2,"./compressions":3,"./crc32":4,"./reader/readerFor":22,"./support":30,"./utf8":31,"./utils":32}],35:[function(e,i,r){function n(g,h,p){this.name=g,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"),c=e("./utf8"),m=e("./compressedObject"),f=e("./stream/GenericWorker");n.prototype={internalStream:function(g){var h=null,p="string";try{if(!g)throw new Error("No output type specified.");var u=(p=g.toLowerCase())==="string"||p==="text";p!=="binarystring"&&p!=="text"||(p="string"),h=this._decompressWorker();var b=!this._dataBinary;b&&!u&&(h=h.pipe(new c.Utf8EncodeWorker)),!b&&u&&(h=h.pipe(new c.Utf8DecodeWorker))}catch(k){(h=new f("error")).error(k)}return new s(h,p,"")},async:function(g,h){return this.internalStream(g).accumulate(h)},nodeStream:function(g,h){return this.internalStream(g||"nodebuffer").toNodejsStream(h)},_compressWorker:function(g,h){if(this._data instanceof m&&this._data.compression.magic===g.magic)return this._data.getCompressedWorker();var p=this._decompressWorker();return this._dataBinary||(p=p.pipe(new c.Utf8EncodeWorker)),m.createWorkerFrom(p,g,h)},_decompressWorker:function(){return this._data instanceof m?this._data.getContentWorker():this._data instanceof f?this._data:new o(this._data)}};for(var y=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],v=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},l=0;l<y.length;l++)n.prototype[y[l]]=v;i.exports=n},{"./compressedObject":2,"./stream/DataWorker":27,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31}],36:[function(e,i,r){(function(n){var s,o,c=n.MutationObserver||n.WebKitMutationObserver;if(c){var m=0,f=new c(g),y=n.document.createTextNode("");f.observe(y,{characterData:!0}),s=function(){y.data=m=++m%2}}else if(n.setImmediate||n.MessageChannel===void 0)s="document"in n&&"onreadystatechange"in n.document.createElement("script")?function(){var h=n.document.createElement("script");h.onreadystatechange=function(){g(),h.onreadystatechange=null,h.parentNode.removeChild(h),h=null},n.document.documentElement.appendChild(h)}:function(){setTimeout(g,0)};else{var v=new n.MessageChannel;v.port1.onmessage=g,s=function(){v.port2.postMessage(0)}}var l=[];function g(){var h,p;o=!0;for(var u=l.length;u;){for(p=l,l=[],h=-1;++h<u;)p[h]();u=l.length}o=!1}i.exports=function(h){l.push(h)!==1||o||s()}}).call(this,typeof kt<"u"?kt:typeof self<"u"?self:typeof window<"u"?window:{})},{}],37:[function(e,i,r){var n=e("immediate");function s(){}var o={},c=["REJECTED"],m=["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!==s&&h(this,u)}function v(u,b,k){this.promise=u,typeof b=="function"&&(this.onFulfilled=b,this.callFulfilled=this.otherCallFulfilled),typeof k=="function"&&(this.onRejected=k,this.callRejected=this.otherCallRejected)}function l(u,b,k){n(function(){var S;try{S=b(k)}catch(C){return o.reject(u,C)}S===u?o.reject(u,new TypeError("Cannot resolve promise with itself")):o.resolve(u,S)})}function g(u){var b=u&&u.then;if(u&&(typeof u=="object"||typeof u=="function")&&typeof b=="function")return function(){b.apply(u,arguments)}}function h(u,b){var k=!1;function S(B){k||(k=!0,o.reject(u,B))}function C(B){k||(k=!0,o.resolve(u,B))}var L=p(function(){b(C,S)});L.status==="error"&&S(L.value)}function p(u,b){var k={};try{k.value=u(b),k.status="success"}catch(S){k.status="error",k.value=S}return k}(i.exports=y).prototype.finally=function(u){if(typeof u!="function")return this;var b=this.constructor;return this.then(function(k){return b.resolve(u()).then(function(){return k})},function(k){return b.resolve(u()).then(function(){throw k})})},y.prototype.catch=function(u){return this.then(null,u)},y.prototype.then=function(u,b){if(typeof u!="function"&&this.state===m||typeof b!="function"&&this.state===c)return this;var k=new this.constructor(s);return this.state!==f?l(k,this.state===m?u:b,this.outcome):this.queue.push(new v(k,u,b)),k},v.prototype.callFulfilled=function(u){o.resolve(this.promise,u)},v.prototype.otherCallFulfilled=function(u){l(this.promise,this.onFulfilled,u)},v.prototype.callRejected=function(u){o.reject(this.promise,u)},v.prototype.otherCallRejected=function(u){l(this.promise,this.onRejected,u)},o.resolve=function(u,b){var k=p(g,b);if(k.status==="error")return o.reject(u,k.value);var S=k.value;if(S)h(u,S);else{u.state=m,u.outcome=b;for(var C=-1,L=u.queue.length;++C<L;)u.queue[C].callFulfilled(b)}return u},o.reject=function(u,b){u.state=c,u.outcome=b;for(var k=-1,S=u.queue.length;++k<S;)u.queue[k].callRejected(b);return u},y.resolve=function(u){return u instanceof this?u:o.resolve(new this(s),u)},y.reject=function(u){var b=new this(s);return o.reject(b,u)},y.all=function(u){var b=this;if(Object.prototype.toString.call(u)!=="[object Array]")return this.reject(new TypeError("must be an array"));var k=u.length,S=!1;if(!k)return this.resolve([]);for(var C=new Array(k),L=0,B=-1,P=new this(s);++B<k;)T(u[B],B);return P;function T(H,K){b.resolve(H).then(function(_){C[K]=_,++L!==k||S||(S=!0,o.resolve(P,C))},function(_){S||(S=!0,o.reject(P,_))})}},y.race=function(u){var b=this;if(Object.prototype.toString.call(u)!=="[object Array]")return this.reject(new TypeError("must be an array"));var k=u.length,S=!1;if(!k)return this.resolve([]);for(var C=-1,L=new this(s);++C<k;)B=u[C],b.resolve(B).then(function(P){S||(S=!0,o.resolve(L,P))},function(P){S||(S=!0,o.reject(L,P))});var B;return L}},{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"),s=e("./utils/common"),o=e("./utils/strings"),c=e("./zlib/messages"),m=e("./zlib/zstream"),f=Object.prototype.toString,y=0,v=-1,l=0,g=8;function h(u){if(!(this instanceof h))return new h(u);this.options=s.assign({level:v,method:g,chunkSize:16384,windowBits:15,memLevel:8,strategy:l,to:""},u||{});var b=this.options;b.raw&&0<b.windowBits?b.windowBits=-b.windowBits:b.gzip&&0<b.windowBits&&b.windowBits<16&&(b.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new m,this.strm.avail_out=0;var k=n.deflateInit2(this.strm,b.level,b.method,b.windowBits,b.memLevel,b.strategy);if(k!==y)throw new Error(c[k]);if(b.header&&n.deflateSetHeader(this.strm,b.header),b.dictionary){var S;if(S=typeof b.dictionary=="string"?o.string2buf(b.dictionary):f.call(b.dictionary)==="[object ArrayBuffer]"?new Uint8Array(b.dictionary):b.dictionary,(k=n.deflateSetDictionary(this.strm,S))!==y)throw new Error(c[k]);this._dict_set=!0}}function p(u,b){var k=new h(b);if(k.push(u,!0),k.err)throw k.msg||c[k.err];return k.result}h.prototype.push=function(u,b){var k,S,C=this.strm,L=this.options.chunkSize;if(this.ended)return!1;S=b===~~b?b:b===!0?4:0,typeof u=="string"?C.input=o.string2buf(u):f.call(u)==="[object ArrayBuffer]"?C.input=new Uint8Array(u):C.input=u,C.next_in=0,C.avail_in=C.input.length;do{if(C.avail_out===0&&(C.output=new s.Buf8(L),C.next_out=0,C.avail_out=L),(k=n.deflate(C,S))!==1&&k!==y)return this.onEnd(k),!(this.ended=!0);C.avail_out!==0&&(C.avail_in!==0||S!==4&&S!==2)||(this.options.to==="string"?this.onData(o.buf2binstring(s.shrinkBuf(C.output,C.next_out))):this.onData(s.shrinkBuf(C.output,C.next_out)))}while((0<C.avail_in||C.avail_out===0)&&k!==1);return S===4?(k=n.deflateEnd(this.strm),this.onEnd(k),this.ended=!0,k===y):S!==2||(this.onEnd(y),!(C.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=s.flattenChunks(this.chunks)),this.chunks=[],this.err=u,this.msg=this.strm.msg},r.Deflate=h,r.deflate=p,r.deflateRaw=function(u,b){return(b=b||{}).raw=!0,p(u,b)},r.gzip=function(u,b){return(b=b||{}).gzip=!0,p(u,b)}},{"./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"),s=e("./utils/common"),o=e("./utils/strings"),c=e("./zlib/constants"),m=e("./zlib/messages"),f=e("./zlib/zstream"),y=e("./zlib/gzheader"),v=Object.prototype.toString;function l(h){if(!(this instanceof l))return new l(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 f,this.strm.avail_out=0;var u=n.inflateInit2(this.strm,p.windowBits);if(u!==c.Z_OK)throw new Error(m[u]);this.header=new y,n.inflateGetHeader(this.strm,this.header)}function g(h,p){var u=new l(p);if(u.push(h,!0),u.err)throw u.msg||m[u.err];return u.result}l.prototype.push=function(h,p){var u,b,k,S,C,L,B=this.strm,P=this.options.chunkSize,T=this.options.dictionary,H=!1;if(this.ended)return!1;b=p===~~p?p:p===!0?c.Z_FINISH:c.Z_NO_FLUSH,typeof h=="string"?B.input=o.binstring2buf(h):v.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(P),B.next_out=0,B.avail_out=P),(u=n.inflate(B,c.Z_NO_FLUSH))===c.Z_NEED_DICT&&T&&(L=typeof T=="string"?o.string2buf(T):v.call(T)==="[object ArrayBuffer]"?new Uint8Array(T):T,u=n.inflateSetDictionary(this.strm,L)),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);B.next_out&&(B.avail_out!==0&&u!==c.Z_STREAM_END&&(B.avail_in!==0||b!==c.Z_FINISH&&b!==c.Z_SYNC_FLUSH)||(this.options.to==="string"?(k=o.utf8border(B.output,B.next_out),S=B.next_out-k,C=o.buf2string(B.output,k),B.next_out=S,B.avail_out=P-S,S&&s.arraySet(B.output,B.output,k,S,0),this.onData(C)):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)&&u!==c.Z_STREAM_END);return u===c.Z_STREAM_END&&(b=c.Z_FINISH),b===c.Z_FINISH?(u=n.inflateEnd(this.strm),this.onEnd(u),this.ended=!0,u===c.Z_OK):b!==c.Z_SYNC_FLUSH||(this.onEnd(c.Z_OK),!(B.avail_out=0))},l.prototype.onData=function(h){this.chunks.push(h)},l.prototype.onEnd=function(h){h===c.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},r.Inflate=l,r.inflate=g,r.inflateRaw=function(h,p){return(p=p||{}).raw=!0,g(h,p)},r.ungzip=g},{"./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 m=Array.prototype.slice.call(arguments,1);m.length;){var f=m.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,m){return c.length===m?c:c.subarray?c.subarray(0,m):(c.length=m,c)};var s={arraySet:function(c,m,f,y,v){if(m.subarray&&c.subarray)c.set(m.subarray(f,f+y),v);else for(var l=0;l<y;l++)c[v+l]=m[f+l]},flattenChunks:function(c){var m,f,y,v,l,g;for(m=y=0,f=c.length;m<f;m++)y+=c[m].length;for(g=new Uint8Array(y),m=v=0,f=c.length;m<f;m++)l=c[m],g.set(l,v),v+=l.length;return g}},o={arraySet:function(c,m,f,y,v){for(var l=0;l<y;l++)c[v+l]=m[f+l]},flattenChunks:function(c){return[].concat.apply([],c)}};r.setTyped=function(c){c?(r.Buf8=Uint8Array,r.Buf16=Uint16Array,r.Buf32=Int32Array,r.assign(r,s)):(r.Buf8=Array,r.Buf16=Array,r.Buf32=Array,r.assign(r,o))},r.setTyped(n)},{}],42:[function(e,i,r){var n=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 c=new n.Buf8(256),m=0;m<256;m++)c[m]=252<=m?6:248<=m?5:240<=m?4:224<=m?3:192<=m?2:1;function f(y,v){if(v<65537&&(y.subarray&&o||!y.subarray&&s))return String.fromCharCode.apply(null,n.shrinkBuf(y,v));for(var l="",g=0;g<v;g++)l+=String.fromCharCode(y[g]);return l}c[254]=c[254]=1,r.string2buf=function(y){var v,l,g,h,p,u=y.length,b=0;for(h=0;h<u;h++)(64512&(l=y.charCodeAt(h)))==55296&&h+1<u&&(64512&(g=y.charCodeAt(h+1)))==56320&&(l=65536+(l-55296<<10)+(g-56320),h++),b+=l<128?1:l<2048?2:l<65536?3:4;for(v=new n.Buf8(b),h=p=0;p<b;h++)(64512&(l=y.charCodeAt(h)))==55296&&h+1<u&&(64512&(g=y.charCodeAt(h+1)))==56320&&(l=65536+(l-55296<<10)+(g-56320),h++),l<128?v[p++]=l:(l<2048?v[p++]=192|l>>>6:(l<65536?v[p++]=224|l>>>12:(v[p++]=240|l>>>18,v[p++]=128|l>>>12&63),v[p++]=128|l>>>6&63),v[p++]=128|63&l);return v},r.buf2binstring=function(y){return f(y,y.length)},r.binstring2buf=function(y){for(var v=new n.Buf8(y.length),l=0,g=v.length;l<g;l++)v[l]=y.charCodeAt(l);return v},r.buf2string=function(y,v){var l,g,h,p,u=v||y.length,b=new Array(2*u);for(l=g=0;l<u;)if((h=y[l++])<128)b[g++]=h;else if(4<(p=c[h]))b[g++]=65533,l+=p-1;else{for(h&=p===2?31:p===3?15:7;1<p&&l<u;)h=h<<6|63&y[l++],p--;1<p?b[g++]=65533:h<65536?b[g++]=h:(h-=65536,b[g++]=55296|h>>10&1023,b[g++]=56320|1023&h)}return f(b,g)},r.utf8border=function(y,v){var l;for((v=v||y.length)>y.length&&(v=y.length),l=v-1;0<=l&&(192&y[l])==128;)l--;return l<0||l===0?v:l+c[y[l]]>v?l:v}},{"./common":41}],43:[function(e,i,r){i.exports=function(n,s,o,c){for(var m=65535&n|0,f=n>>>16&65535|0,y=0;o!==0;){for(o-=y=2e3<o?2e3:o;f=f+(m=m+s[c++]|0)|0,--y;);m%=65521,f%=65521}return m|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 s,o=[],c=0;c<256;c++){s=c;for(var m=0;m<8;m++)s=1&s?3988292384^s>>>1:s>>>1;o[c]=s}return o})();i.exports=function(s,o,c,m){var f=n,y=m+c;s^=-1;for(var v=m;v<y;v++)s=s>>>8^f[255&(s^o[v])];return-1^s}},{}],46:[function(e,i,r){var n,s=e("../utils/common"),o=e("./trees"),c=e("./adler32"),m=e("./crc32"),f=e("./messages"),y=0,v=4,l=0,g=-2,h=-1,p=4,u=2,b=8,k=9,S=286,C=30,L=19,B=2*S+1,P=15,T=3,H=258,K=H+T+1,_=42,D=113,d=1,M=2,V=3,W=4;function Q(a,R){return a.msg=f[R],R}function U(a){return(a<<1)-(4<a?9:0)}function q(a){for(var R=a.length;0<=--R;)a[R]=0}function z(a){var R=a.state,A=R.pending;A>a.avail_out&&(A=a.avail_out),A!==0&&(s.arraySet(a.output,R.pending_buf,R.pending_out,A,a.next_out),a.next_out+=A,R.pending_out+=A,a.total_out+=A,a.avail_out-=A,R.pending-=A,R.pending===0&&(R.pending_out=0))}function I(a,R){o._tr_flush_block(a,0<=a.block_start?a.block_start:-1,a.strstart-a.block_start,R),a.block_start=a.strstart,z(a.strm)}function J(a,R){a.pending_buf[a.pending++]=R}function Y(a,R){a.pending_buf[a.pending++]=R>>>8&255,a.pending_buf[a.pending++]=255&R}function X(a,R){var A,x,w=a.max_chain_length,N=a.strstart,O=a.prev_length,F=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&&(w>>=2),F>a.lookahead&&(F=a.lookahead);do if(j[(A=R)+O]===et&&j[A+O-1]===nt&&j[A]===j[N]&&j[++A]===j[N+1]){N+=2,A++;do;while(j[++N]===j[++A]&&j[++N]===j[++A]&&j[++N]===j[++A]&&j[++N]===j[++A]&&j[++N]===j[++A]&&j[++N]===j[++A]&&j[++N]===j[++A]&&j[++N]===j[++A]&&N<$);if(x=H-($-N),N=$-H,O<x){if(a.match_start=R,F<=(O=x))break;nt=j[N+O-1],et=j[N+O]}}while((R=Z[R&G])>E&&--w!=0);return O<=a.lookahead?O:a.lookahead}function st(a){var R,A,x,w,N,O,F,E,j,G,Z=a.w_size;do{if(w=a.window_size-a.lookahead-a.strstart,a.strstart>=Z+(Z-K)){for(s.arraySet(a.window,a.window,Z,Z,0),a.match_start-=Z,a.strstart-=Z,a.block_start-=Z,R=A=a.hash_size;x=a.head[--R],a.head[R]=Z<=x?x-Z:0,--A;);for(R=A=Z;x=a.prev[--R],a.prev[R]=Z<=x?x-Z:0,--A;);w+=Z}if(a.strm.avail_in===0)break;if(O=a.strm,F=a.window,E=a.strstart+a.lookahead,j=w,G=void 0,G=O.avail_in,j<G&&(G=j),A=G===0?0:(O.avail_in-=G,s.arraySet(F,O.input,O.next_in,G,E),O.state.wrap===1?O.adler=c(O.adler,F,G,E):O.state.wrap===2&&(O.adler=m(O.adler,F,G,E)),O.next_in+=G,O.total_in+=G,G),a.lookahead+=A,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,R){for(var A,x;;){if(a.lookahead<K){if(st(a),a.lookahead<K&&R===y)return d;if(a.lookahead===0)break}if(A=0,a.lookahead>=T&&(a.ins_h=(a.ins_h<<a.hash_shift^a.window[a.strstart+T-1])&a.hash_mask,A=a.prev[a.strstart&a.w_mask]=a.head[a.ins_h],a.head[a.ins_h]=a.strstart),A!==0&&a.strstart-A<=a.w_size-K&&(a.match_length=X(a,A)),a.match_length>=T)if(x=o._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,A=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<T-1?a.strstart:T-1,R===v?(I(a,!0),a.strm.avail_out===0?V:W):a.last_lit&&(I(a,!1),a.strm.avail_out===0)?d:M}function tt(a,R){for(var A,x,w;;){if(a.lookahead<K){if(st(a),a.lookahead<K&&R===y)return d;if(a.lookahead===0)break}if(A=0,a.lookahead>=T&&(a.ins_h=(a.ins_h<<a.hash_shift^a.window[a.strstart+T-1])&a.hash_mask,A=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,A!==0&&a.prev_length<a.max_lazy_match&&a.strstart-A<=a.w_size-K&&(a.match_length=X(a,A),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(w=a.strstart+a.lookahead-T,x=o._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<=w&&(a.ins_h=(a.ins_h<<a.hash_shift^a.window[a.strstart+T-1])&a.hash_mask,A=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++,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<T-1?a.strstart:T-1,R===v?(I(a,!0),a.strm.avail_out===0?V:W):a.last_lit&&(I(a,!1),a.strm.avail_out===0)?d:M}function rt(a,R,A,x,w){this.good_length=a,this.max_lazy=R,this.nice_length=A,this.max_chain=x,this.func=w}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=b,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*C+1)),this.bl_tree=new s.Buf16(2*(2*L+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(P+1),this.heap=new s.Buf16(2*S+1),q(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new s.Buf16(2*S+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 R;return a&&a.state?(a.total_in=a.total_out=0,a.data_type=u,(R=a.state).pending=0,R.pending_out=0,R.wrap<0&&(R.wrap=-R.wrap),R.status=R.wrap?_:D,a.adler=R.wrap===2?0:1,R.last_flush=y,o._tr_init(R),l):Q(a,g)}function ft(a){var R=ot(a);return R===l&&(function(A){A.window_size=2*A.w_size,q(A.head),A.max_lazy_match=n[A.level].max_lazy,A.good_match=n[A.level].good_length,A.nice_match=n[A.level].nice_length,A.max_chain_length=n[A.level].max_chain,A.strstart=0,A.block_start=0,A.lookahead=0,A.insert=0,A.match_length=A.prev_length=T-1,A.match_available=0,A.ins_h=0})(a.state),R}function ut(a,R,A,x,w,N){if(!a)return g;var O=1;if(R===h&&(R=6),x<0?(O=0,x=-x):15<x&&(O=2,x-=16),w<1||k<w||A!==b||x<8||15<x||R<0||9<R||N<0||p<N)return Q(a,g);x===8&&(x=9);var F=new lt;return(a.state=F).strm=a,F.wrap=O,F.gzhead=null,F.w_bits=x,F.w_size=1<<F.w_bits,F.w_mask=F.w_size-1,F.hash_bits=w+7,F.hash_size=1<<F.hash_bits,F.hash_mask=F.hash_size-1,F.hash_shift=~~((F.hash_bits+T-1)/T),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<<w+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=R,F.strategy=N,F.method=A,ft(a)}n=[new rt(0,0,0,0,function(a,R){var A=65535;for(A>a.pending_buf_size-5&&(A=a.pending_buf_size-5);;){if(a.lookahead<=1){if(st(a),a.lookahead===0&&R===y)return d;if(a.lookahead===0)break}a.strstart+=a.lookahead,a.lookahead=0;var x=a.block_start+A;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-K&&(I(a,!1),a.strm.avail_out===0))return d}return a.insert=0,R===v?(I(a,!0),a.strm.avail_out===0?V:W):(a.strstart>a.block_start&&(I(a,!1),a.strm.avail_out),d)}),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,R){return ut(a,R,b,15,8,0)},r.deflateInit2=ut,r.deflateReset=ft,r.deflateResetKeep=ot,r.deflateSetHeader=function(a,R){return a&&a.state?a.state.wrap!==2?g:(a.state.gzhead=R,l):g},r.deflate=function(a,R){var A,x,w,N;if(!a||!a.state||5<R||R<0)return a?Q(a,g):g;if(x=a.state,!a.output||!a.input&&a.avail_in!==0||x.status===666&&R!==v)return Q(a,a.avail_out===0?-5:g);if(x.strm=a,A=x.last_flush,x.last_flush=R,x.status===_)if(x.wrap===2)a.adler=0,J(x,31),J(x,139),J(x,8),x.gzhead?(J(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)),J(x,255&x.gzhead.time),J(x,x.gzhead.time>>8&255),J(x,x.gzhead.time>>16&255),J(x,x.gzhead.time>>24&255),J(x,x.level===9?2:2<=x.strategy||x.level<2?4:0),J(x,255&x.gzhead.os),x.gzhead.extra&&x.gzhead.extra.length&&(J(x,255&x.gzhead.extra.length),J(x,x.gzhead.extra.length>>8&255)),x.gzhead.hcrc&&(a.adler=m(a.adler,x.pending_buf,x.pending,0)),x.gzindex=0,x.status=69):(J(x,0),J(x,0),J(x,0),J(x,0),J(x,0),J(x,x.level===9?2:2<=x.strategy||x.level<2?4:0),J(x,3),x.status=D);else{var O=b+(x.w_bits-8<<4)<<8;O|=(2<=x.strategy||x.level<2?0:x.level<6?1:x.level===6?2:3)<<6,x.strstart!==0&&(O|=32),O+=31-O%31,x.status=D,Y(x,O),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(w=x.pending;x.gzindex<(65535&x.gzhead.extra.length)&&(x.pending!==x.pending_buf_size||(x.gzhead.hcrc&&x.pending>w&&(a.adler=m(a.adler,x.pending_buf,x.pending-w,w)),z(a),w=x.pending,x.pending!==x.pending_buf_size));)J(x,255&x.gzhead.extra[x.gzindex]),x.gzindex++;x.gzhead.hcrc&&x.pending>w&&(a.adler=m(a.adler,x.pending_buf,x.pending-w,w)),x.gzindex===x.gzhead.extra.length&&(x.gzindex=0,x.status=73)}else x.status=73;if(x.status===73)if(x.gzhead.name){w=x.pending;do{if(x.pending===x.pending_buf_size&&(x.gzhead.hcrc&&x.pending>w&&(a.adler=m(a.adler,x.pending_buf,x.pending-w,w)),z(a),w=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,J(x,N)}while(N!==0);x.gzhead.hcrc&&x.pending>w&&(a.adler=m(a.adler,x.pending_buf,x.pending-w,w)),N===0&&(x.gzindex=0,x.status=91)}else x.status=91;if(x.status===91)if(x.gzhead.comment){w=x.pending;do{if(x.pending===x.pending_buf_size&&(x.gzhead.hcrc&&x.pending>w&&(a.adler=m(a.adler,x.pending_buf,x.pending-w,w)),z(a),w=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,J(x,N)}while(N!==0);x.gzhead.hcrc&&x.pending>w&&(a.adler=m(a.adler,x.pending_buf,x.pending-w,w)),N===0&&(x.status=103)}else x.status=103;if(x.status===103&&(x.gzhead.hcrc?(x.pending+2>x.pending_buf_size&&z(a),x.pending+2<=x.pending_buf_size&&(J(x,255&a.adler),J(x,a.adler>>8&255),a.adler=0,x.status=D)):x.status=D),x.pending!==0){if(z(a),a.avail_out===0)return x.last_flush=-1,l}else if(a.avail_in===0&&U(R)<=U(A)&&R!==v)return Q(a,-5);if(x.status===666&&a.avail_in!==0)return Q(a,-5);if(a.avail_in!==0||x.lookahead!==0||R!==y&&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===y)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===v?(I(E,!0),E.strm.avail_out===0?V:W):E.last_lit&&(I(E,!1),E.strm.avail_out===0)?d:M})(x,R):x.strategy===3?(function(E,j){for(var G,Z,$,nt,et=E.window;;){if(E.lookahead<=H){if(st(E),E.lookahead<=H&&j===y)return d;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=o._tr_tally(E,1,E.match_length-T),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===v?(I(E,!0),E.strm.avail_out===0?V:W):E.last_lit&&(I(E,!1),E.strm.avail_out===0)?d:M})(x,R):n[x.level].func(x,R);if(F!==V&&F!==W||(x.status=666),F===d||F===V)return a.avail_out===0&&(x.last_flush=-1),l;if(F===M&&(R===1?o._tr_align(x):R!==5&&(o._tr_stored_block(x,0,0,!1),R===3&&(q(x.head),x.lookahead===0&&(x.strstart=0,x.block_start=0,x.insert=0))),z(a),a.avail_out===0))return x.last_flush=-1,l}return R!==v?l:x.wrap<=0?1:(x.wrap===2?(J(x,255&a.adler),J(x,a.adler>>8&255),J(x,a.adler>>16&255),J(x,a.adler>>24&255),J(x,255&a.total_in),J(x,a.total_in>>8&255),J(x,a.total_in>>16&255),J(x,a.total_in>>24&255)):(Y(x,a.adler>>>16),Y(x,65535&a.adler)),z(a),0<x.wrap&&(x.wrap=-x.wrap),x.pending!==0?l:1)},r.deflateEnd=function(a){var R;return a&&a.state?(R=a.state.status)!==_&&R!==69&&R!==73&&R!==91&&R!==103&&R!==D&&R!==666?Q(a,g):(a.state=null,R===D?Q(a,-3):l):g},r.deflateSetDictionary=function(a,R){var A,x,w,N,O,F,E,j,G=R.length;if(!a||!a.state||(N=(A=a.state).wrap)===2||N===1&&A.status!==_||A.lookahead)return g;for(N===1&&(a.adler=c(a.adler,R,G,0)),A.wrap=0,G>=A.w_size&&(N===0&&(q(A.head),A.strstart=0,A.block_start=0,A.insert=0),j=new s.Buf8(A.w_size),s.arraySet(j,R,G-A.w_size,A.w_size,0),R=j,G=A.w_size),O=a.avail_in,F=a.next_in,E=a.input,a.avail_in=G,a.next_in=0,a.input=R,st(A);A.lookahead>=T;){for(x=A.strstart,w=A.lookahead-(T-1);A.ins_h=(A.ins_h<<A.hash_shift^A.window[x+T-1])&A.hash_mask,A.prev[x&A.w_mask]=A.head[A.ins_h],A.head[A.ins_h]=x,x++,--w;);A.strstart=x,A.lookahead=T-1,st(A)}return A.strstart+=A.lookahead,A.block_start=A.strstart,A.insert=A.lookahead,A.lookahead=0,A.match_length=A.prev_length=T-1,A.match_available=0,a.next_in=F,a.input=E,a.avail_in=O,A.wrap=N,l},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,s){var o,c,m,f,y,v,l,g,h,p,u,b,k,S,C,L,B,P,T,H,K,_,D,d,M;o=n.state,c=n.next_in,d=n.input,m=c+(n.avail_in-5),f=n.next_out,M=n.output,y=f-(s-n.avail_out),v=f+(n.avail_out-257),l=o.dmax,g=o.wsize,h=o.whave,p=o.wnext,u=o.window,b=o.hold,k=o.bits,S=o.lencode,C=o.distcode,L=(1<<o.lenbits)-1,B=(1<<o.distbits)-1;t:do{k<15&&(b+=d[c++]<<k,k+=8,b+=d[c++]<<k,k+=8),P=S[b&L];e:for(;;){if(b>>>=T=P>>>24,k-=T,(T=P>>>16&255)===0)M[f++]=65535&P;else{if(!(16&T)){if((64&T)==0){P=S[(65535&P)+(b&(1<<T)-1)];continue e}if(32&T){o.mode=12;break t}n.msg="invalid literal/length code",o.mode=30;break t}H=65535&P,(T&=15)&&(k<T&&(b+=d[c++]<<k,k+=8),H+=b&(1<<T)-1,b>>>=T,k-=T),k<15&&(b+=d[c++]<<k,k+=8,b+=d[c++]<<k,k+=8),P=C[b&B];i:for(;;){if(b>>>=T=P>>>24,k-=T,!(16&(T=P>>>16&255))){if((64&T)==0){P=C[(65535&P)+(b&(1<<T)-1)];continue i}n.msg="invalid distance code",o.mode=30;break t}if(K=65535&P,k<(T&=15)&&(b+=d[c++]<<k,(k+=8)<T&&(b+=d[c++]<<k,k+=8)),l<(K+=b&(1<<T)-1)){n.msg="invalid distance too far back",o.mode=30;break t}if(b>>>=T,k-=T,(T=f-y)<K){if(h<(T=K-T)&&o.sane){n.msg="invalid distance too far back",o.mode=30;break t}if(D=u,(_=0)===p){if(_+=g-T,T<H){for(H-=T;M[f++]=u[_++],--T;);_=f-K,D=M}}else if(p<T){if(_+=g+p-T,(T-=p)<H){for(H-=T;M[f++]=u[_++],--T;);if(_=0,p<H){for(H-=T=p;M[f++]=u[_++],--T;);_=f-K,D=M}}}else if(_+=p-T,T<H){for(H-=T;M[f++]=u[_++],--T;);_=f-K,D=M}for(;2<H;)M[f++]=D[_++],M[f++]=D[_++],M[f++]=D[_++],H-=3;H&&(M[f++]=D[_++],1<H&&(M[f++]=D[_++]))}else{for(_=f-K;M[f++]=M[_++],M[f++]=M[_++],M[f++]=M[_++],2<(H-=3););H&&(M[f++]=M[_++],1<H&&(M[f++]=M[_++]))}break}}break}}while(c<m&&f<v);c-=H=k>>3,b&=(1<<(k-=H<<3))-1,n.next_in=c,n.next_out=f,n.avail_in=c<m?m-c+5:5-(c-m),n.avail_out=f<v?v-f+257:257-(f-v),o.hold=b,o.bits=k}},{}],49:[function(e,i,r){var n=e("../utils/common"),s=e("./adler32"),o=e("./crc32"),c=e("./inffast"),m=e("./inftrees"),f=1,y=2,v=0,l=-2,g=1,h=852,p=592;function u(_){return(_>>>24&255)+(_>>>8&65280)+((65280&_)<<8)+((255&_)<<24)}function b(){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(_){var D;return _&&_.state?(D=_.state,_.total_in=_.total_out=D.total=0,_.msg="",D.wrap&&(_.adler=1&D.wrap),D.mode=g,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(p),D.sane=1,D.back=-1,v):l}function S(_){var D;return _&&_.state?((D=_.state).wsize=0,D.whave=0,D.wnext=0,k(_)):l}function C(_,D){var d,M;return _&&_.state?(M=_.state,D<0?(d=0,D=-D):(d=1+(D>>4),D<48&&(D&=15)),D&&(D<8||15<D)?l:(M.window!==null&&M.wbits!==D&&(M.window=null),M.wrap=d,M.wbits=D,S(_))):l}function L(_,D){var d,M;return _?(M=new b,(_.state=M).window=null,(d=C(_,D))!==v&&(_.state=null),d):l}var B,P,T=!0;function H(_){if(T){var D;for(B=new n.Buf32(512),P=new n.Buf32(32),D=0;D<144;)_.lens[D++]=8;for(;D<256;)_.lens[D++]=9;for(;D<280;)_.lens[D++]=7;for(;D<288;)_.lens[D++]=8;for(m(f,_.lens,0,288,B,0,_.work,{bits:9}),D=0;D<32;)_.lens[D++]=5;m(y,_.lens,0,32,P,0,_.work,{bits:5}),T=!1}_.lencode=B,_.lenbits=9,_.distcode=P,_.distbits=5}function K(_,D,d,M){var V,W=_.state;return W.window===null&&(W.wsize=1<<W.wbits,W.wnext=0,W.whave=0,W.window=new n.Buf8(W.wsize)),M>=W.wsize?(n.arraySet(W.window,D,d-W.wsize,W.wsize,0),W.wnext=0,W.whave=W.wsize):(M<(V=W.wsize-W.wnext)&&(V=M),n.arraySet(W.window,D,d-M,V,W.wnext),(M-=V)?(n.arraySet(W.window,D,d-M,M,0),W.wnext=M,W.whave=W.wsize):(W.wnext+=V,W.wnext===W.wsize&&(W.wnext=0),W.whave<W.wsize&&(W.whave+=V))),0}r.inflateReset=S,r.inflateReset2=C,r.inflateResetKeep=k,r.inflateInit=function(_){return L(_,15)},r.inflateInit2=L,r.inflate=function(_,D){var d,M,V,W,Q,U,q,z,I,J,Y,X,st,dt,tt,rt,lt,ot,ft,ut,a,R,A,x,w=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(!_||!_.state||!_.output||!_.input&&_.avail_in!==0)return l;(d=_.state).mode===12&&(d.mode=13),Q=_.next_out,V=_.output,q=_.avail_out,W=_.next_in,M=_.input,U=_.avail_in,z=d.hold,I=d.bits,J=U,Y=q,R=v;t:for(;;)switch(d.mode){case g:if(d.wrap===0){d.mode=13;break}for(;I<16;){if(U===0)break t;U--,z+=M[W++]<<I,I+=8}if(2&d.wrap&&z===35615){N[d.check=0]=255&z,N[1]=z>>>8&255,d.check=o(d.check,N,2,0),I=z=0,d.mode=2;break}if(d.flags=0,d.head&&(d.head.done=!1),!(1&d.wrap)||(((255&z)<<8)+(z>>8))%31){_.msg="incorrect header check",d.mode=30;break}if((15&z)!=8){_.msg="unknown compression method",d.mode=30;break}if(I-=4,a=8+(15&(z>>>=4)),d.wbits===0)d.wbits=a;else if(a>d.wbits){_.msg="invalid window size",d.mode=30;break}d.dmax=1<<a,_.adler=d.check=1,d.mode=512&z?10:12,I=z=0;break;case 2:for(;I<16;){if(U===0)break t;U--,z+=M[W++]<<I,I+=8}if(d.flags=z,(255&d.flags)!=8){_.msg="unknown compression method",d.mode=30;break}if(57344&d.flags){_.msg="unknown header flags set",d.mode=30;break}d.head&&(d.head.text=z>>8&1),512&d.flags&&(N[0]=255&z,N[1]=z>>>8&255,d.check=o(d.check,N,2,0)),I=z=0,d.mode=3;case 3:for(;I<32;){if(U===0)break t;U--,z+=M[W++]<<I,I+=8}d.head&&(d.head.time=z),512&d.flags&&(N[0]=255&z,N[1]=z>>>8&255,N[2]=z>>>16&255,N[3]=z>>>24&255,d.check=o(d.check,N,4,0)),I=z=0,d.mode=4;case 4:for(;I<16;){if(U===0)break t;U--,z+=M[W++]<<I,I+=8}d.head&&(d.head.xflags=255&z,d.head.os=z>>8),512&d.flags&&(N[0]=255&z,N[1]=z>>>8&255,d.check=o(d.check,N,2,0)),I=z=0,d.mode=5;case 5:if(1024&d.flags){for(;I<16;){if(U===0)break t;U--,z+=M[W++]<<I,I+=8}d.length=z,d.head&&(d.head.extra_len=z),512&d.flags&&(N[0]=255&z,N[1]=z>>>8&255,d.check=o(d.check,N,2,0)),I=z=0}else d.head&&(d.head.extra=null);d.mode=6;case 6:if(1024&d.flags&&(U<(X=d.length)&&(X=U),X&&(d.head&&(a=d.head.extra_len-d.length,d.head.extra||(d.head.extra=new Array(d.head.extra_len)),n.arraySet(d.head.extra,M,W,X,a)),512&d.flags&&(d.check=o(d.check,M,X,W)),U-=X,W+=X,d.length-=X),d.length))break t;d.length=0,d.mode=7;case 7:if(2048&d.flags){if(U===0)break t;for(X=0;a=M[W+X++],d.head&&a&&d.length<65536&&(d.head.name+=String.fromCharCode(a)),a&&X<U;);if(512&d.flags&&(d.check=o(d.check,M,X,W)),U-=X,W+=X,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(X=0;a=M[W+X++],d.head&&a&&d.length<65536&&(d.head.comment+=String.fromCharCode(a)),a&&X<U;);if(512&d.flags&&(d.check=o(d.check,M,X,W)),U-=X,W+=X,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--,z+=M[W++]<<I,I+=8}if(z!==(65535&d.check)){_.msg="header crc mismatch",d.mode=30;break}I=z=0}d.head&&(d.head.hcrc=d.flags>>9&1,d.head.done=!0),_.adler=d.check=0,d.mode=12;break;case 10:for(;I<32;){if(U===0)break t;U--,z+=M[W++]<<I,I+=8}_.adler=d.check=u(z),I=z=0,d.mode=11;case 11:if(d.havedict===0)return _.next_out=Q,_.avail_out=q,_.next_in=W,_.avail_in=U,d.hold=z,d.bits=I,2;_.adler=d.check=1,d.mode=12;case 12:if(D===5||D===6)break t;case 13:if(d.last){z>>>=7&I,I-=7&I,d.mode=27;break}for(;I<3;){if(U===0)break t;U--,z+=M[W++]<<I,I+=8}switch(d.last=1&z,I-=1,3&(z>>>=1)){case 0:d.mode=14;break;case 1:if(H(d),d.mode=20,D!==6)break;z>>>=2,I-=2;break t;case 2:d.mode=17;break;case 3:_.msg="invalid block type",d.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+=M[W++]<<I,I+=8}if((65535&z)!=(z>>>16^65535)){_.msg="invalid stored block lengths",d.mode=30;break}if(d.length=65535&z,I=z=0,d.mode=15,D===6)break t;case 15:d.mode=16;case 16:if(X=d.length){if(U<X&&(X=U),q<X&&(X=q),X===0)break t;n.arraySet(V,M,W,X,Q),U-=X,W+=X,q-=X,Q+=X,d.length-=X;break}d.mode=12;break;case 17:for(;I<14;){if(U===0)break t;U--,z+=M[W++]<<I,I+=8}if(d.nlen=257+(31&z),z>>>=5,I-=5,d.ndist=1+(31&z),z>>>=5,I-=5,d.ncode=4+(15&z),z>>>=4,I-=4,286<d.nlen||30<d.ndist){_.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--,z+=M[W++]<<I,I+=8}d.lens[O[d.have++]]=7&z,z>>>=3,I-=3}for(;d.have<19;)d.lens[O[d.have++]]=0;if(d.lencode=d.lendyn,d.lenbits=7,A={bits:d.lenbits},R=m(0,d.lens,0,19,d.lencode,0,d.work,A),d.lenbits=A.bits,R){_.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(;rt=(w=d.lencode[z&(1<<d.lenbits)-1])>>>16&255,lt=65535&w,!((tt=w>>>24)<=I);){if(U===0)break t;U--,z+=M[W++]<<I,I+=8}if(lt<16)z>>>=tt,I-=tt,d.lens[d.have++]=lt;else{if(lt===16){for(x=tt+2;I<x;){if(U===0)break t;U--,z+=M[W++]<<I,I+=8}if(z>>>=tt,I-=tt,d.have===0){_.msg="invalid bit length repeat",d.mode=30;break}a=d.lens[d.have-1],X=3+(3&z),z>>>=2,I-=2}else if(lt===17){for(x=tt+3;I<x;){if(U===0)break t;U--,z+=M[W++]<<I,I+=8}I-=tt,a=0,X=3+(7&(z>>>=tt)),z>>>=3,I-=3}else{for(x=tt+7;I<x;){if(U===0)break t;U--,z+=M[W++]<<I,I+=8}I-=tt,a=0,X=11+(127&(z>>>=tt)),z>>>=7,I-=7}if(d.have+X>d.nlen+d.ndist){_.msg="invalid bit length repeat",d.mode=30;break}for(;X--;)d.lens[d.have++]=a}}if(d.mode===30)break;if(d.lens[256]===0){_.msg="invalid code -- missing end-of-block",d.mode=30;break}if(d.lenbits=9,A={bits:d.lenbits},R=m(f,d.lens,0,d.nlen,d.lencode,0,d.work,A),d.lenbits=A.bits,R){_.msg="invalid literal/lengths set",d.mode=30;break}if(d.distbits=6,d.distcode=d.distdyn,A={bits:d.distbits},R=m(y,d.lens,d.nlen,d.ndist,d.distcode,0,d.work,A),d.distbits=A.bits,R){_.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){_.next_out=Q,_.avail_out=q,_.next_in=W,_.avail_in=U,d.hold=z,d.bits=I,c(_,Y),Q=_.next_out,V=_.output,q=_.avail_out,W=_.next_in,M=_.input,U=_.avail_in,z=d.hold,I=d.bits,d.mode===12&&(d.back=-1);break}for(d.back=0;rt=(w=d.lencode[z&(1<<d.lenbits)-1])>>>16&255,lt=65535&w,!((tt=w>>>24)<=I);){if(U===0)break t;U--,z+=M[W++]<<I,I+=8}if(rt&&(240&rt)==0){for(ot=tt,ft=rt,ut=lt;rt=(w=d.lencode[ut+((z&(1<<ot+ft)-1)>>ot)])>>>16&255,lt=65535&w,!(ot+(tt=w>>>24)<=I);){if(U===0)break t;U--,z+=M[W++]<<I,I+=8}z>>>=ot,I-=ot,d.back+=ot}if(z>>>=tt,I-=tt,d.back+=tt,d.length=lt,rt===0){d.mode=26;break}if(32&rt){d.back=-1,d.mode=12;break}if(64&rt){_.msg="invalid literal/length code",d.mode=30;break}d.extra=15&rt,d.mode=22;case 22:if(d.extra){for(x=d.extra;I<x;){if(U===0)break t;U--,z+=M[W++]<<I,I+=8}d.length+=z&(1<<d.extra)-1,z>>>=d.extra,I-=d.extra,d.back+=d.extra}d.was=d.length,d.mode=23;case 23:for(;rt=(w=d.distcode[z&(1<<d.distbits)-1])>>>16&255,lt=65535&w,!((tt=w>>>24)<=I);){if(U===0)break t;U--,z+=M[W++]<<I,I+=8}if((240&rt)==0){for(ot=tt,ft=rt,ut=lt;rt=(w=d.distcode[ut+((z&(1<<ot+ft)-1)>>ot)])>>>16&255,lt=65535&w,!(ot+(tt=w>>>24)<=I);){if(U===0)break t;U--,z+=M[W++]<<I,I+=8}z>>>=ot,I-=ot,d.back+=ot}if(z>>>=tt,I-=tt,d.back+=tt,64&rt){_.msg="invalid distance code",d.mode=30;break}d.offset=lt,d.extra=15&rt,d.mode=24;case 24:if(d.extra){for(x=d.extra;I<x;){if(U===0)break t;U--,z+=M[W++]<<I,I+=8}d.offset+=z&(1<<d.extra)-1,z>>>=d.extra,I-=d.extra,d.back+=d.extra}if(d.offset>d.dmax){_.msg="invalid distance too far back",d.mode=30;break}d.mode=25;case 25:if(q===0)break t;if(X=Y-q,d.offset>X){if((X=d.offset-X)>d.whave&&d.sane){_.msg="invalid distance too far back",d.mode=30;break}st=X>d.wnext?(X-=d.wnext,d.wsize-X):d.wnext-X,X>d.length&&(X=d.length),dt=d.window}else dt=V,st=Q-d.offset,X=d.length;for(q<X&&(X=q),q-=X,d.length-=X;V[Q++]=dt[st++],--X;);d.length===0&&(d.mode=21);break;case 26:if(q===0)break t;V[Q++]=d.length,q--,d.mode=21;break;case 27:if(d.wrap){for(;I<32;){if(U===0)break t;U--,z|=M[W++]<<I,I+=8}if(Y-=q,_.total_out+=Y,d.total+=Y,Y&&(_.adler=d.check=d.flags?o(d.check,V,Y,Q-Y):s(d.check,V,Y,Q-Y)),Y=q,(d.flags?z:u(z))!==d.check){_.msg="incorrect data check",d.mode=30;break}I=z=0}d.mode=28;case 28:if(d.wrap&&d.flags){for(;I<32;){if(U===0)break t;U--,z+=M[W++]<<I,I+=8}if(z!==(4294967295&d.total)){_.msg="incorrect length check",d.mode=30;break}I=z=0}d.mode=29;case 29:R=1;break t;case 30:R=-3;break t;case 31:return-4;default:return l}return _.next_out=Q,_.avail_out=q,_.next_in=W,_.avail_in=U,d.hold=z,d.bits=I,(d.wsize||Y!==_.avail_out&&d.mode<30&&(d.mode<27||D!==4))&&K(_,_.output,_.next_out,Y-_.avail_out)?(d.mode=31,-4):(J-=_.avail_in,Y-=_.avail_out,_.total_in+=J,_.total_out+=Y,d.total+=Y,d.wrap&&Y&&(_.adler=d.check=d.flags?o(d.check,V,Y,_.next_out-Y):s(d.check,V,Y,_.next_out-Y)),_.data_type=d.bits+(d.last?64:0)+(d.mode===12?128:0)+(d.mode===20||d.mode===15?256:0),(J==0&&Y===0||D===4)&&R===v&&(R=-5),R)},r.inflateEnd=function(_){if(!_||!_.state)return l;var D=_.state;return D.window&&(D.window=null),_.state=null,v},r.inflateGetHeader=function(_,D){var d;return _&&_.state?(2&(d=_.state).wrap)==0?l:((d.head=D).done=!1,v):l},r.inflateSetDictionary=function(_,D){var d,M=D.length;return _&&_.state?(d=_.state).wrap!==0&&d.mode!==11?l:d.mode===11&&s(1,D,M,0)!==d.check?-3:K(_,D,M,M)?(d.mode=31,-4):(d.havedict=1,v):l},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"),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],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],m=[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,v,l,g,h,p,u){var b,k,S,C,L,B,P,T,H,K=u.bits,_=0,D=0,d=0,M=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),st=null,dt=0;for(_=0;_<=15;_++)Y[_]=0;for(D=0;D<l;D++)Y[y[v+D]]++;for(V=K,M=15;1<=M&&Y[M]===0;M--);if(M<V&&(V=M),M===0)return g[h++]=20971520,g[h++]=20971520,u.bits=1,0;for(d=1;d<M&&Y[d]===0;d++);for(V<d&&(V=d),_=U=1;_<=15;_++)if(U<<=1,(U-=Y[_])<0)return-1;if(0<U&&(f===0||M!==1))return-1;for(X[1]=0,_=1;_<15;_++)X[_+1]=X[_]+Y[_];for(D=0;D<l;D++)y[v+D]!==0&&(p[X[y[v+D]]++]=D);if(B=f===0?(I=st=p,19):f===1?(I=s,J-=257,st=o,dt-=257,256):(I=c,st=m,-1),_=d,L=h,Q=D=z=0,S=-1,C=(q=1<<(W=V))-1,f===1&&852<q||f===2&&592<q)return 1;for(;;){for(P=_-Q,H=p[D]<B?(T=0,p[D]):p[D]>B?(T=st[dt+p[D]],I[J+p[D]]):(T=96,0),b=1<<_-Q,d=k=1<<W;g[L+(z>>Q)+(k-=b)]=P<<24|T<<16|H|0,k!==0;);for(b=1<<_-1;z&b;)b>>=1;if(b!==0?(z&=b-1,z+=b):z=0,D++,--Y[_]==0){if(_===M)break;_=y[v+p[D]]}if(V<_&&(z&C)!==S){for(Q===0&&(Q=V),L+=d,U=1<<(W=_-Q);W+Q<M&&!((U-=Y[W+Q])<=0);)W++,U<<=1;if(q+=1<<W,f===1&&852<q||f===2&&592<q)return 1;g[S=z&C]=V<<24|W<<16|L-h|0}}return z!==0&&(g[L+z]=_-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"),s=0,o=1;function c(w){for(var N=w.length;0<=--N;)w[N]=0}var m=0,f=29,y=256,v=y+1+f,l=30,g=19,h=2*v+1,p=15,u=16,b=7,k=256,S=16,C=17,L=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],P=[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*(v+2));c(K);var _=new Array(2*l);c(_);var D=new Array(512);c(D);var d=new Array(256);c(d);var M=new Array(f);c(M);var V,W,Q,U=new Array(l);function q(w,N,O,F,E){this.static_tree=w,this.extra_bits=N,this.extra_base=O,this.elems=F,this.max_length=E,this.has_stree=w&&w.length}function z(w,N){this.dyn_tree=w,this.max_code=0,this.stat_desc=N}function I(w){return w<256?D[w]:D[256+(w>>>7)]}function J(w,N){w.pending_buf[w.pending++]=255&N,w.pending_buf[w.pending++]=N>>>8&255}function Y(w,N,O){w.bi_valid>u-O?(w.bi_buf|=N<<w.bi_valid&65535,J(w,w.bi_buf),w.bi_buf=N>>u-w.bi_valid,w.bi_valid+=O-u):(w.bi_buf|=N<<w.bi_valid&65535,w.bi_valid+=O)}function X(w,N,O){Y(w,O[2*N],O[2*N+1])}function st(w,N){for(var O=0;O|=1&w,w>>>=1,O<<=1,0<--N;);return O>>>1}function dt(w,N,O){var F,E,j=new Array(p+1),G=0;for(F=1;F<=p;F++)j[F]=G=G+O[F-1]<<1;for(E=0;E<=N;E++){var Z=w[2*E+1];Z!==0&&(w[2*E]=st(j[Z]++,Z))}}function tt(w){var N;for(N=0;N<v;N++)w.dyn_ltree[2*N]=0;for(N=0;N<l;N++)w.dyn_dtree[2*N]=0;for(N=0;N<g;N++)w.bl_tree[2*N]=0;w.dyn_ltree[2*k]=1,w.opt_len=w.static_len=0,w.last_lit=w.matches=0}function rt(w){8<w.bi_valid?J(w,w.bi_buf):0<w.bi_valid&&(w.pending_buf[w.pending++]=w.bi_buf),w.bi_buf=0,w.bi_valid=0}function lt(w,N,O,F){var E=2*N,j=2*O;return w[E]<w[j]||w[E]===w[j]&&F[N]<=F[O]}function ot(w,N,O){for(var F=w.heap[O],E=O<<1;E<=w.heap_len&&(E<w.heap_len&<(N,w.heap[E+1],w.heap[E],w.depth)&&E++,!lt(N,F,w.heap[E],w.depth));)w.heap[O]=w.heap[E],O=E,E<<=1;w.heap[O]=F}function ft(w,N,O){var F,E,j,G,Z=0;if(w.last_lit!==0)for(;F=w.pending_buf[w.d_buf+2*Z]<<8|w.pending_buf[w.d_buf+2*Z+1],E=w.pending_buf[w.l_buf+Z],Z++,F===0?X(w,E,N):(X(w,(j=d[E])+y+1,N),(G=B[j])!==0&&Y(w,E-=M[j],G),X(w,j=I(--F),O),(G=P[j])!==0&&Y(w,F-=U[j],G)),Z<w.last_lit;);X(w,k,N)}function ut(w,N){var O,F,E,j=N.dyn_tree,G=N.stat_desc.static_tree,Z=N.stat_desc.has_stree,$=N.stat_desc.elems,nt=-1;for(w.heap_len=0,w.heap_max=h,O=0;O<$;O++)j[2*O]!==0?(w.heap[++w.heap_len]=nt=O,w.depth[O]=0):j[2*O+1]=0;for(;w.heap_len<2;)j[2*(E=w.heap[++w.heap_len]=nt<2?++nt:0)]=1,w.depth[E]=0,w.opt_len--,Z&&(w.static_len-=G[2*E+1]);for(N.max_code=nt,O=w.heap_len>>1;1<=O;O--)ot(w,j,O);for(E=$;O=w.heap[1],w.heap[1]=w.heap[w.heap_len--],ot(w,j,1),F=w.heap[1],w.heap[--w.heap_max]=O,w.heap[--w.heap_max]=F,j[2*E]=j[2*O]+j[2*F],w.depth[E]=(w.depth[O]>=w.depth[F]?w.depth[O]:w.depth[F])+1,j[2*O+1]=j[2*F+1]=E,w.heap[1]=E++,ot(w,j,1),2<=w.heap_len;);w.heap[--w.heap_max]=w.heap[1],(function(et,ht){var vt,pt,bt,at,xt,St,mt=ht.dyn_tree,At=ht.max_code,Pt=ht.stat_desc.static_tree,Ft=ht.stat_desc.has_stree,Wt=ht.stat_desc.extra_bits,Tt=ht.stat_desc.extra_base,wt=ht.stat_desc.max_length,_t=0;for(at=0;at<=p;at++)et.bl_count[at]=0;for(mt[2*et.heap[et.heap_max]+1]=0,vt=et.heap_max+1;vt<h;vt++)wt<(at=mt[2*mt[2*(pt=et.heap[vt])+1]+1]+1)&&(at=wt,_t++),mt[2*pt+1]=at,At<pt||(et.bl_count[at]++,xt=0,Tt<=pt&&(xt=Wt[pt-Tt]),St=mt[2*pt],et.opt_len+=St*(at+xt),Ft&&(et.static_len+=St*(Pt[2*pt+1]+xt)));if(_t!==0){do{for(at=wt-1;et.bl_count[at]===0;)at--;et.bl_count[at]--,et.bl_count[at+1]+=2,et.bl_count[wt]--,_t-=2}while(0<_t);for(at=wt;at!==0;at--)for(pt=et.bl_count[at];pt!==0;)At<(bt=et.heap[--vt])||(mt[2*bt+1]!==at&&(et.opt_len+=(at-mt[2*bt+1])*mt[2*bt],mt[2*bt+1]=at),pt--)}})(w,N),dt(j,nt,w.bl_count)}function a(w,N,O){var F,E,j=-1,G=N[1],Z=0,$=7,nt=4;for(G===0&&($=138,nt=3),N[2*(O+1)+1]=65535,F=0;F<=O;F++)E=G,G=N[2*(F+1)+1],++Z<$&&E===G||(Z<nt?w.bl_tree[2*E]+=Z:E!==0?(E!==j&&w.bl_tree[2*E]++,w.bl_tree[2*S]++):Z<=10?w.bl_tree[2*C]++:w.bl_tree[2*L]++,j=E,nt=(Z=0)===G?($=138,3):E===G?($=6,3):($=7,4))}function R(w,N,O){var F,E,j=-1,G=N[1],Z=0,$=7,nt=4;for(G===0&&($=138,nt=3),F=0;F<=O;F++)if(E=G,G=N[2*(F+1)+1],!(++Z<$&&E===G)){if(Z<nt)for(;X(w,E,w.bl_tree),--Z!=0;);else E!==0?(E!==j&&(X(w,E,w.bl_tree),Z--),X(w,S,w.bl_tree),Y(w,Z-3,2)):Z<=10?(X(w,C,w.bl_tree),Y(w,Z-3,3)):(X(w,L,w.bl_tree),Y(w,Z-11,7));j=E,nt=(Z=0)===G?($=138,3):E===G?($=6,3):($=7,4)}}c(U);var A=!1;function x(w,N,O,F){Y(w,(m<<1)+(F?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})(w,N,O)}r._tr_init=function(w){A||((function(){var N,O,F,E,j,G=new Array(p+1);for(E=F=0;E<f-1;E++)for(M[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<<P[E];N++)D[j++]=E;for(j>>=7;E<l;E++)for(U[E]=j<<7,N=0;N<1<<P[E]-7;N++)D[256+j++]=E;for(O=0;O<=p;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,v+1,G),N=0;N<l;N++)_[2*N+1]=5,_[2*N]=st(N,5);V=new q(K,B,y+1,v,p),W=new q(_,P,0,l,p),Q=new q(new Array(0),T,0,g,b)})(),A=!0),w.l_desc=new z(w.dyn_ltree,V),w.d_desc=new z(w.dyn_dtree,W),w.bl_desc=new z(w.bl_tree,Q),w.bi_buf=0,w.bi_valid=0,tt(w)},r._tr_stored_block=x,r._tr_flush_block=function(w,N,O,F){var E,j,G=0;0<w.level?(w.strm.data_type===2&&(w.strm.data_type=(function(Z){var $,nt=4093624447;for($=0;$<=31;$++,nt>>>=1)if(1&nt&&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;$<y;$++)if(Z.dyn_ltree[2*$]!==0)return o;return s})(w)),ut(w,w.l_desc),ut(w,w.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),$=g-1;3<=$&&Z.bl_tree[2*H[$]+1]===0;$--);return Z.opt_len+=3*($+1)+5+5+4,$})(w),E=w.opt_len+3+7>>>3,(j=w.static_len+3+7>>>3)<=E&&(E=j)):E=j=O+5,O+4<=E&&N!==-1?x(w,N,O,F):w.strategy===4||j===E?(Y(w,2+(F?1:0),3),ft(w,K,_)):(Y(w,4+(F?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);R(Z,Z.dyn_ltree,$-1),R(Z,Z.dyn_dtree,nt-1)})(w,w.l_desc.max_code+1,w.d_desc.max_code+1,G+1),ft(w,w.dyn_ltree,w.dyn_dtree)),tt(w),F&&rt(w)},r._tr_tally=function(w,N,O){return w.pending_buf[w.d_buf+2*w.last_lit]=N>>>8&255,w.pending_buf[w.d_buf+2*w.last_lit+1]=255&N,w.pending_buf[w.l_buf+w.last_lit]=255&O,w.last_lit++,N===0?w.dyn_ltree[2*O]++:(w.matches++,N--,w.dyn_ltree[2*(d[O]+y+1)]++,w.dyn_dtree[2*I(N)]++),w.last_lit===w.lit_bufsize-1},r._tr_align=function(w){Y(w,2,3),X(w,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)})(w)}},{"../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(s,o){if(!s.setImmediate){var c,m,f,y,v=1,l={},g=!1,h=s.document,p=Object.getPrototypeOf&&Object.getPrototypeOf(s);p=p&&p.setTimeout?p:s,c={}.toString.call(s.process)==="[object process]"?function(S){process.nextTick(function(){b(S)})}:(function(){if(s.postMessage&&!s.importScripts){var S=!0,C=s.onmessage;return s.onmessage=function(){S=!1},s.postMessage("","*"),s.onmessage=C,S}})()?(y="setImmediate$"+Math.random()+"$",s.addEventListener?s.addEventListener("message",k,!1):s.attachEvent("onmessage",k),function(S){s.postMessage(y+S,"*")}):s.MessageChannel?((f=new MessageChannel).port1.onmessage=function(S){b(S.data)},function(S){f.port2.postMessage(S)}):h&&"onreadystatechange"in h.createElement("script")?(m=h.documentElement,function(S){var C=h.createElement("script");C.onreadystatechange=function(){b(S),C.onreadystatechange=null,m.removeChild(C),C=null},m.appendChild(C)}):function(S){setTimeout(b,0,S)},p.setImmediate=function(S){typeof S!="function"&&(S=new Function(""+S));for(var C=new Array(arguments.length-1),L=0;L<C.length;L++)C[L]=arguments[L+1];var B={callback:S,args:C};return l[v]=B,c(v),v++},p.clearImmediate=u}function u(S){delete l[S]}function b(S){if(g)setTimeout(b,0,S);else{var C=l[S];if(C){g=!0;try{(function(L){var B=L.callback,P=L.args;switch(P.length){case 0:B();break;case 1:B(P[0]);break;case 2:B(P[0],P[1]);break;case 3:B(P[0],P[1],P[2]);break;default:B.apply(o,P)}})(C)}finally{u(S),g=!1}}}}function k(S){S.source===s&&typeof S.data=="string"&&S.data.indexOf(y)===0&&b(+S.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)})})(Et)),Et.exports}var re=ie();const ne=ee(re);class Lt{generate(){return typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():Date.now().toString(36)+Math.random().toString(36).substr(2)}}class zt{idGenerator;constructor(){this.idGenerator=new Lt}async extractMindMapData(t){const e=new ne;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"),s=JSON.parse(n);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 r=this.idGenerator.generate(),n=[];if(t.children&&t.children.attached)for(const o of t.children.attached)n.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),c=e.file(o);if(c){const m=await c.async("base64"),f=o.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"),s=`data:${y};base64,${m}`}}if(t.title&&s){const o={id:r,topic:t.title,root:i,children:n},m={id:this.idGenerator.generate(),topic:"",image:s,children:[]};return o.children?.push(m),o}else return s?{id:r,topic:"",image:s,root:i,children:n}:{id:r,topic:t.title||"",root:i,children:n}}}class Bt{generate(t){const e=t.querySelectorAll("svg");let i=null;for(let K=0;K<e.length;K++){const _=e[K];if(_.style.zIndex==="0"&&_.style.position==="absolute"){i=_;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 _=r[K];if(_.style.zIndex==="1"&&_.style.position==="absolute"){n=_;break}}if(!i||!n)throw new Error("Could not find mind map content layers.");let s=1/0,o=1/0,c=-1/0,m=-1/0;const f=n.children;if(f.length===0)s=0,o=0,c=800,m=600;else for(let K=0;K<f.length;K++){const _=f[K],D=parseFloat(_.style.left||"0"),d=parseFloat(_.style.top||"0"),M=_.offsetWidth,V=_.offsetHeight,W=d-V/2,Q=d+V/2;D<s&&(s=D),W<o&&(o=W),D+M>c&&(c=D+M),Q>m&&(m=Q)}const y=50;s-=y,o-=y,c+=y,m+=y;const v=c-s,l=m-o,g=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(K=>{const _=g.getPropertyValue(K).trim();_&&p.push(`${K}: ${_};`)});const u=p.join(" "),b=g.fontFamily,k=document.createElementNS("http://www.w3.org/2000/svg","svg");k.setAttribute("xmlns","http://www.w3.org/2000/svg"),k.setAttribute("width",v.toString()),k.setAttribute("height",l.toString()),k.setAttribute("viewBox",`0 0 ${v} ${l}`),k.style.cssText=u;const S=document.createElementNS("http://www.w3.org/2000/svg","rect");S.setAttribute("x","0"),S.setAttribute("y","0"),S.setAttribute("width",v.toString()),S.setAttribute("height",l.toString()),S.setAttribute("fill",g.backgroundColor||"#ffffff"),k.appendChild(S);const C=document.createElementNS("http://www.w3.org/2000/svg","g");C.setAttribute("transform",`translate(${-s}, ${-o})`),i.querySelectorAll("path").forEach(K=>{const _=K.cloneNode(!0),D=window.getComputedStyle(K);let d=D.stroke;(!d||d==="none")&&(d=K.style.stroke),(!d||d==="none")&&(d="#cccccc"),_.style.stroke=d;let M=D.strokeWidth;(!M||M==="0px"||M==="auto")&&(M=K.getAttribute("stroke-width")||"2px"),_.style.strokeWidth=M,_.style.fill="none",C.appendChild(_)});const B=document.createElementNS("http://www.w3.org/2000/svg","foreignObject");B.setAttribute("x","0"),B.setAttribute("y","0"),B.setAttribute("width",(c+y).toString()),B.setAttribute("height",(m+y).toString()),B.style.overflow="visible";const P=document.createElement("div");P.setAttribute("xmlns","http://www.w3.org/1999/xhtml"),P.style.cssText=`position: relative; width: 100%; height: 100%; font-family: ${b}; ${u}`;const T=n.children;for(let K=0;K<T.length;K++){const _=T[K].cloneNode(!0);P.appendChild(_)}return B.appendChild(P),C.appendChild(B),k.appendChild(C),new XMLSerializer().serializeToString(k)}}class Rt{async exportToSvg(t,e){try{const r=new Bt().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 Bt().generate(t),s=`data:image/svg+xml;base64,${btoa(unescape(encodeURIComponent(r)))}`;await new Promise((o,c)=>{const m=new Image;m.onload=()=>{try{const f=document.createElement("canvas");f.width=m.width,f.height=m.height;const y=f.getContext("2d");if(!y)throw new Error("Could not get canvas context");y.drawImage(m,0,0),f.toBlob(v=>{v?this.saveFile(v,"mindmap.png",[{description:"PNG Image",accept:{"image/png":[".png"]}}],e).then(()=>o()).catch(l=>c(l instanceof Error?l:new Error(String(l)))):c(new Error("Failed to generate PNG blob."))},"image/png")}catch(f){c(f instanceof Error?f:new Error(String(f)))}},m.onerror=()=>{c(new Error("Failed to load SVG for PNG conversion"))},m.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,r){if(r){const o=e.split(".").pop();await r.onExportFile(t,e,o);return}const n=await this.showSavePicker({suggestedName:e,types:i});if(!n)return;const s=await n.createWritable();await s.write(t),await s.close()}}class se{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(`
|
|
57
|
-
`)}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 oe{constructor(){}show(t,e,i){if(typeof document>"u")return;const r=document.createElement("div");r.style.position="fixed",r.style.top="0",r.style.left="0",r.style.width="100vw",r.style.height="100vh",r.style.backgroundColor="rgba(0,0,0,0.5)",r.style.zIndex="3000",r.style.display="flex",r.style.justifyContent="center",r.style.alignItems="center",r.style.opacity="0",r.style.transition="opacity 0.2s";const n=document.createElement("div");n.style.backgroundColor="white",n.style.padding="20px",n.style.borderRadius="8px",n.style.boxShadow="0 4px 6px rgba(0,0,0,0.1)",n.style.maxWidth="600px",n.style.width="90%",n.style.maxHeight="90vh",n.style.overflowY="auto",n.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",n.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",()=>{m()}),n.appendChild(o),i){const y=document.createElement("h3");y.textContent=e==="ja"?"ツールバーアイコン":"Toolbar Icons",y.style.marginTop="10px",y.style.marginBottom="10px",y.style.fontSize="1.2em",y.style.color="#333",y.style.borderBottom="1px solid #f0f0f0",n.appendChild(y);const v=document.createElement("table");v.style.width="100%",v.style.borderCollapse="collapse",v.style.fontSize="0.9em",v.style.marginBottom="20px",i.getIconDescriptions(e).forEach(g=>{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 u="";switch(g.id){case"right":u=i.getRightIcon();break;case"left":u=i.getLeftIcon();break;case"both":u=i.getBothIcon();break;case"default":u=i.getThemeDefaultIcon();break;case"simple":u=i.getThemeSimpleIcon();break;case"colorful":u=i.getThemeColorfulIcon();break;case"custom":u=i.getThemeCustomIcon();break;case"resetZoom":u=i.getZoomResetIcon();break;case"help":u=i.getHelpIcon();break}const b=document.createElement("div");b.style.width="24px",b.style.height="24px",b.style.display="flex",b.style.alignItems="center",b.style.justifyContent="center",b.style.color="#555",b.innerHTML=u,p.appendChild(b);const k=document.createElement("td");k.textContent=g.desc,k.style.padding="8px",k.style.textAlign="left",k.style.color="#333",h.appendChild(p),h.appendChild(k),v.appendChild(h)}),n.appendChild(v)}[{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:"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(y=>{const v=[];if(y.actions.forEach(b=>{let k="";const S=b;if(S.key)k=S.key;else if(S.action&&t[S.action]){const C=t[S.action];if(C&&C.length>0){const L=C.map(B=>{const P=[];return(B.ctrlKey||B.metaKey)&&P.push("Ctrl/Cmd"),B.altKey&&P.push("Alt"),B.shiftKey&&P.push("Shift"),B.key===" "?P.push("Space"):P.push(B.key),P.join(" + ")});k=[...new Set(L)].join(" / ")}}k&&v.push({key:k,desc:e==="ja"&&S.descJa||S.desc})}),v.length===0)return;const l=document.createElement("h3");l.textContent=y.title,l.style.marginTop="20px",l.style.marginBottom="10px",l.style.fontSize="1.2em",l.style.color="#333",l.style.borderBottom="1px solid #f0f0f0",n.appendChild(l);const g=document.createElement("table");g.style.width="100%",g.style.borderCollapse="collapse",g.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 u=document.createElement("th");u.textContent=e==="ja"?"説明":"Description",u.style.textAlign="center",u.style.padding="8px 0",u.style.color="#666",h.appendChild(p),h.appendChild(u),g.appendChild(h),v.forEach(b=>{const k=document.createElement("tr");k.style.borderBottom="1px solid #f9f9f9";const S=document.createElement("td");S.textContent=b.key,S.style.padding="6px 0",S.style.fontWeight="bold",S.style.color="#555",S.style.minWidth="180px",S.style.textAlign="center";const C=document.createElement("td");C.textContent=b.desc,C.style.padding="6px 0",C.style.textAlign="left",C.style.color="#333",k.appendChild(S),k.appendChild(C),g.appendChild(k)}),n.appendChild(g)}),r.appendChild(n),document.body.appendChild(r),requestAnimationFrame(()=>{r.style.opacity="1"});const m=()=>{r.style.opacity="0",setTimeout(()=>{document.body.contains(r)&&document.body.removeChild(r)},200),document.removeEventListener("keydown",f)},f=y=>{y.key==="Escape"&&m()};document.addEventListener("keydown",f),r.addEventListener("click",y=>{y.target===r&&m()})}}class ae{mindMap;service;renderer;eventBus;styleEditor;commandPalette;locale;interactionHandler;layoutSwitcher;fileHandler;anchorNodeId=null;selectedNodeId=null;selectedNodeIds=new Set;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,s,o="en",c){this.mindMap=t,this.service=e,this.renderer=i,this.styleEditor=r,this.eventBus=n,this.fileHandler=s,this.locale=o,this.commandPalette=new te(this.renderer.container,{onInput:m=>this.handleSearchInput(m),onSelect:m=>this.handleSearchResultSelect(m),onIconSelect:m=>this.handleIconSelect(m),onCommandSelect:m=>this.handleCommandSelect(m),onClose:()=>{this.interactionHandler&&this.interactionHandler.container.focus()},getSelectedNodeId:()=>this.selectedNodeId,disabledFeatures:c}),this.service.setSelectionProvider(()=>({selectedId:this.selectedNodeId||void 0,selectedIds:Array.from(this.selectedNodeIds)}))}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.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),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]}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 s=this.mindMap.findNode(n.parentId);s&&s.isRoot&&this.layoutMode==="Both"&&this.ensureExplicitLayoutSides(s);const o=this.service.addSibling(t,e,i);if(o){if(s&&s.isRoot&&this.layoutMode==="Both"){const c=n.layoutSide||(s.children.indexOf(n)%2===0?"right":"left");o.layoutSide=c}this.render(),this.eventBus.emit("node:add",{id:o.id,topic:o.topic}),r.emitChange&&this.eventBus.emit("model:change",void 0)}return o}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}});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.eventBus.emit("command",{name:"updateNode",args:{nodeId:t,updates:e}}),this.interactionHandler&&this.interactionHandler.isReadOnly)return;let i=!1;const r=this.getIdsToActOn(t);if(e.topic!==void 0&&this.service.updateNodeTopic(t,e.topic)&&(i=!0),e.style!==void 0&&this.service.updateNodesStyle(r,e.style)&&(i=!0),e.icon!==void 0){let n=!1;r.forEach(s=>{this.service.updateNodeIcon(s,e.icon)&&(n=!0)}),n&&(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,s=0;e.children.forEach((o,c)=>{(o.layoutSide||(c%2===0?"right":"left"))==="left"?n++:s++}),i=n<s?"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 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.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.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):t.selectedId?this.selectNode(t.selectedId):this.selectNode(null)}findTargetIdAfterRemoval(t,e){const i=this.mindMap.findNode(t);if(i){let r=i;for(;r&&r.parentId;){if(!e.includes(r.parentId))return r.parentId;r=this.mindMap.findNode(r.parentId)}}return this.mindMap.root.id}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.selectedNodeIds,this.layoutMode),this.renderer.updateTransform(this.panX,this.panY,this.scale))}renderSelection(){this.isBatching||(this.renderer.updateSelection(this.selectedNodeIds),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 o=this.renderer.container.getBoundingClientRect(),c=e-o.left,m=i-o.top,f=Math.min(Math.max(this.scale*(1-t*.001),.1),5),y=c-(c-this.panX)*(f/this.scale),v=m-(m-this.panY)*(f/this.scale);this.panX=y,this.panY=v,this.targetPanX=y,this.targetPanY=v,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(){const t=this.service.undo();t&&(this.eventBus.emit("command",{name:"undo"}),this.render(),this.restoreSelection(t),this.eventBus.emit("model:change",void 0))}redo(){const t=this.service.redo();t&&(this.eventBus.emit("command",{name:"redo"}),this.render(),this.restoreSelection(t),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,i=!1){if(!t){this.selectNode(this.mindMap.root.id);return}const r=this.mindMap.findNode(t);if(!r)return;let n;switch(e){case"Left":n=this.navigateLeft(r);break;case"Right":n=this.navigateRight(r);break;case"Up":n=this.navigateUp(r);break;case"Down":n=this.navigateDown(r);break}n&&(i?this.selectRange(t,n):this.selectNode(n)),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),r=this.mindMap.findNode(e);if(!i||!r)return;if(i.parentId&&i.parentId===r.parentId){const s=this.mindMap.findNode(i.parentId);if(s){const o=s.children.findIndex(m=>m.id===i.id),c=s.children.findIndex(m=>m.id===r.id);if(o!==-1&&c!==-1){const m=Math.min(o,c),f=Math.max(o,c),y=s.children.slice(m,f+1).map(v=>v.id);this.selectNodes(y),this.selectedNodeId=e,this.updateSelectionState();return}}}const n=new Set(this.selectedNodeIds);n.add(e),this.selectNodes(Array.from(n)),this.selectedNodeId=e,this.updateSelectionState()}copyNode(t){const e=this.getIdsToActOn(t);e.length>1?this.service.copyNodes(e):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.getIdsToActOn(t),i=this.findTargetIdAfterRemoval(t,e);e.length>1?this.service.cutNodes(e):this.service.cutNode(t),this.selectNode(i),this.render(),e.forEach(r=>this.eventBus.emit("node:remove",r)),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<yt.PALETTE.length&&(n={color:yt.PALETTE[e.index]});else if(e.type==="increaseSize"||e.type==="decreaseSize"){const s=yt.FONT_SIZES,o=r.fontSize||"";let c=s.findIndex(f=>f.value===o);c===-1&&(c=0);const m=e.type==="increaseSize"?Math.min(s.length-1,c+1):Math.max(0,c-1);m!==c&&(n={fontSize:s[m].value})}if(n){const s=this.getIdsToActOn(t);this.service.updateNodesStyle(s,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()}registerCommand(t){this.commandPalette.addCustomCommand(t)}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 Rt().exportToPng(this.renderer.container,this.fileHandler)}async exportSvg(){this.eventBus.emit("command",{name:"exportSvg"}),await new Rt().exportToSvg(this.renderer.container,this.fileHandler)}async exportMarkdown(){this.eventBus.emit("command",{name:"exportMarkdown"}),await new se().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 zt;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 s=await new zt().extractMindMapData(r);this.loadData(s)}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),s=this.targetPanX-this.panX,o=this.targetPanY-this.panY;Math.abs(s)>.1||Math.abs(o)>.1?(this.panX+=s*n,this.panY+=o*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(),s=this.renderer.container.getBoundingClientRect(),o=50;let c=0,m=0;const f=n.left<s.left+o,y=n.right>s.right-o,v=n.top<s.top+o,l=n.bottom>s.bottom-o;if(e&&(f||y||v||l)){const g=n.left+n.width/2,h=n.top+n.height/2,p=s.left+s.width/2,u=s.top+s.height/2;c=p-g,m=u-h}else f?c=s.left+o-n.left:y&&(c=s.right-o-n.right),v?m=s.top+o-n.top:l&&(m=s.bottom-o-n.bottom);(c!==0||m!==0)&&(i?(this.panX+=c,this.panY+=m,this.targetPanX=this.panX,this.targetPanY=this.panY,this.renderer.updateTransform(this.panX,this.panY,this.scale)):this.panBoard(c,m))}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(s=>this.getNodeDirection(s)===i),n=r.findIndex(s=>s.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(s=>this.getNodeDirection(s)===i),n=r.findIndex(s=>s.id===t.id);if(n!==-1&&n<r.length-1)return r[n+1].id}}}showHelpModal(){if(!this.interactionHandler||typeof document>"u")return;new oe().show(this.interactionHandler.getShortcuts(),this.locale,this.layoutSwitcher)}}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(r=>r!==e))}removeListener(t,e){this.off(t,e)}emit(t,e){this.listeners[t]?.forEach(i=>i(e))}}class le extends Ot{mindMap;controller;constructor(t,e={}){super();const i=new gt("root","Root Topic",null,!0);this.mindMap=new Ut(i);const r=new Lt,n=new Ht(this.mindMap,r),s=document.createElement("div");s.style.position="absolute",s.style.top="0",s.style.left="0",s.style.width="100%",s.style.height="100%",s.style.pointerEvents="none",s.style.zIndex="2000",window.getComputedStyle(t).position==="static"&&(t.style.position="relative"),t.style.overscrollBehavior="none",t.style.touchAction="none",t.appendChild(s);const c=new yt(s),m=new Yt(t,{onImageZoom:l=>this.controller.setReadOnly(l),onToggleFold:l=>this.controller.toggleFold(l)});let f="en";typeof navigator<"u"&&navigator.language&&navigator.language.startsWith("ja")&&(f="ja"),this.controller=new ae(this.mindMap,n,m,c,{emit:(l,g)=>this.emit(l,g)},e.fileHandler,e.locale||f,e.disabledCommandPaletteFeatures),c.onUpdate=(l,g)=>{this.controller.updateNode(l,{style:g})};const y=new Qt(t,{onNodeClick:(l,g)=>{g&&l?this.controller.selectRangeTo(l):this.controller.selectNode(l||null)},onAddChild:l=>this.controller.addChildNode(l),onInsertParent:l=>this.controller.insertParentNode(l),onAddSibling:(l,g)=>this.controller.addSiblingNode(l,g),onDeleteNode:l=>this.controller.removeNode(l),onDropNode:(l,g,h)=>this.controller.moveNode(l,g,h),onUpdateNode:(l,g)=>this.controller.updateNodeTopic(l,g),onNavigate:(l,g,h)=>this.controller.navigateNode(l,g,h),onPan:(l,g)=>this.controller.panBoard(l,g),onCopyNode:l=>this.controller.copyNode(l),onPasteNode:l=>this.controller.pasteNode(l),onCutNode:l=>this.controller.cutNode(l),onPasteImage:(l,g,h,p)=>this.controller.pasteImage(l,g,h,p),onZoom:(l,g,h)=>this.controller.zoomBoard(l,g,h),onZoomReset:()=>this.controller.resetZoom(),onUndo:()=>this.controller.undo(),onRedo:()=>this.controller.redo(),onStyleAction:(l,g)=>this.controller.onStyleAction(l,g),onEditEnd:l=>this.controller.onEditEnd(),onToggleFold:l=>this.controller.toggleFold(l),onToggleCommandPalette:()=>this.controller.toggleCommandPalette(),onUpdateNodeWidth:(l,g)=>this.controller.updateNodeWidth(l,g),shortcuts:e.shortcuts});this.controller.setInteractionHandler(y);const v=new Gt(s,{onLayoutChange:l=>this.controller.setLayoutMode(l),onThemeChange:l=>this.controller.setTheme(l),onZoomReset:()=>this.controller.resetZoom(),onShowHelp:()=>this.controller.showHelpModal()});this.controller.setLayoutSwitcher(v),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()}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=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}}exports.Kakidash=le;exports.Node=gt;exports.SvgGenerator=Bt;exports.TypedEventEmitter=Ot;exports.XMindImporter=zt;
|
|
43
|
+
</svg>`}}const qt={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 Qt{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 te{commandBus;container;shortcutManager;isReadOnly=!1;shortcuts;getSelectedNodeId;cleanupFns=[];constructor(t,e){this.commandBus=t.commandBus,this.container=t.container,this.shortcuts={...qt,...t.shortcuts},this.shortcutManager=new Qt(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":if((e.ctrlKey||e.metaKey)&&!e.shiftKey&&!e.altKey&&e.key.toLowerCase()==="v")return;e.preventDefault(),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 ee{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 ie{commandBus;container;draggedNodeId=null;isReadOnly=!1;ghostElement=null;isDragging=!1;startPosition=null;DRAG_THRESHOLD=5;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=`
|
|
44
|
+
.mindmap-node.drag-over-top {
|
|
45
|
+
border-top: 4px solid #007bff !important;
|
|
46
|
+
}
|
|
47
|
+
.mindmap-node.drag-over-bottom {
|
|
48
|
+
border-bottom: 4px solid #007bff !important;
|
|
49
|
+
}
|
|
50
|
+
.mindmap-node.drag-over-left {
|
|
51
|
+
border-left: 4px solid #007bff !important;
|
|
52
|
+
}
|
|
53
|
+
.mindmap-node.drag-over-right {
|
|
54
|
+
border-right: 4px solid #007bff !important;
|
|
55
|
+
}
|
|
56
|
+
`,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,this.startPosition={x:e.clientX,y:e.clientY},this.isDragging=!1,n.setPointerCapture(e.pointerId))};handlePointerMove=t=>{const e=t;if(this.isReadOnly||!this.draggedNodeId)return;if(!this.isDragging&&this.startPosition){const r=e.clientX-this.startPosition.x,s=e.clientY-this.startPosition.y;if(Math.sqrt(r*r+s*s)>=this.DRAG_THRESHOLD)this.isDragging=!0,this.createGhostElement(e);else 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&&this.isDragging){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,this.isDragging=!1,this.startPosition=null;return}if(i&&i.dataset.id&&this.draggedNodeId&&this.isDragging){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,this.isDragging=!1,this.startPosition=null};createGhostElement(t){if(!this.draggedNodeId)return;const e=this.container.querySelector(`[data-id="${this.draggedNodeId}"]`);e&&(this.ghostElement=e.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=`${t.clientX}px`,this.ghostElement.style.top=`${t.clientY}px`,this.ghostElement.style.transform="translate(-50%, -50%)",document.body.appendChild(this.ghostElement))}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 ne{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 w=parseInt(t.style.maxWidth,10);isNaN(w)||(r=w)}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(`
|
|
57
|
+
`)||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 re{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 te({commandBus:this.commandBus,container:this.container,shortcuts:this.options.shortcuts},t.getSelectedNodeId),this.zoomPanHandler=new ee({commandBus:this.commandBus,container:this.container}),this.dragDropHandler=new ie({commandBus:this.commandBus,container:this.container}),this.dragDropHandler.setReadOnly(this.isReadOnly),this.nodeEditor=new ne(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;let s=!1;for(const o of Array.from(r))if(o.type.startsWith("image/")){s=!0,e.preventDefault();const l=o.getAsFile();if(l){const g=new FileReader;g.onload=w=>{const u=w.target?.result,y=new Image;y.onload=()=>{this.commandBus.dispatch({type:"pasteImage",parentId:i,imageData:u,width:y.width,height:y.height})},y.src=u},g.readAsDataURL(l)}}if(!s){const o=n.getData("text/plain");o?(e.preventDefault(),this.commandBus.dispatch({type:"pasteNode",parentId:i,text:o})):(e.preventDefault(),this.commandBus.dispatch({type:"pasteNode",parentId:i}))}}),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 se{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 oe{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 w=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=w+m/2,p=s==="right"?y+u:y-u,{width:f,height:b}=this.measureNode(c);if(l.nodes.push({nodeId:c.id,x:p,y:h,width:f,height:b,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)}w+=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 ae{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 de{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 b=document.createElement("div");b.style.width="24px",b.style.height="24px",b.style.display="flex",b.style.alignItems="center",b.style.justifyContent="center",b.style.color="#555",b.innerHTML=f,p.appendChild(b);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(b=>{let _="";const C=b;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(b=>{const _=document.createElement("tr");_.style.borderBottom="1px solid #f9f9f9";const C=document.createElement("td");C.textContent=b.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=b.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",w)},w=u=>{u.key==="Escape"&&g()};document.addEventListener("keydown",w),n.addEventListener("click",u=>{u.target===n&&g()})}}class le{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 ae(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,e.text)),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 oe(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),w=Math.max(o,l),u=s.children.slice(g,w+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,e){this.saveState(),this.eventBus.emit("command",{name:"pasteNode",args:{parentId:t,text:e}});const i=this.clipboardService.createPastedNodes(t,e),n=i.length>0?i[0]:null;i.length>0&&this.service.addExistingNodes(t,i),n&&(this.render(),this.selectNode(n.id),this.eventBus.emit("node:add",{id:n.id,topic:n.topic}),this.eventBus.emit("model:change",void 0),setTimeout(()=>this.ensureNodeVisible(n.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<yt.PALETTE.length&&(r={color:yt.PALETTE[e.index]});else if(e.type==="increaseSize"||e.type==="decreaseSize"){const s=yt.FONT_SIZES,o=n.fontSize||"";let l=s.findIndex(w=>w.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 de().show(this.interactionOrchestrator.getShortcuts(),this.locale,this.layoutSwitcher)}}class ce{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,w=Math.min(Math.max(this.scale*(1-t*.001),.1),5),u=l-(l-this.panX)*(w/this.scale),y=g-(g-this.panY)*(w/this.scale);this.panX=u,this.panY=y,this.targetPanX=u,this.targetPanY=y,this.scale=w,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 w=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&&(w||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 w?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 he{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 w=r.children;if(w.length===0)s=0,o=0,l=800,g=600;else for(let X=0;X<w.length;X++){const k=w[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(" "),b=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: ${b}; ${f}`;const T=r.children;for(let X=0;X<T.length;X++){const k=T[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 w=document.createElement("canvas");w.width=g.width,w.height=g.height;const u=w.getContext("2d");if(!u)throw new Error("Could not get canvas context");u.drawImage(g,0,0),w.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(w){l(w instanceof Error?w:new Error(String(w)))}},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 ue{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(`
|
|
58
|
+
`)}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 fe(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 Et={exports:{}};var Rt;function pe(){return Rt||(Rt=1,(function(Q,t){(function(e){Q.exports=e()})(function(){return(function e(i,n,r){function s(g,w){if(!n[g]){if(!i[g]){var u=typeof kt=="function"&&kt;if(!w&&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,w,u,y,c,m,h,p=[],f=0,b=l.length,_=b,C=r.getTypeOf(l)!=="string";f<l.length;)_=b-f,u=C?(g=l[f++],w=f<b?l[f++]:0,f<b?l[f++]:0):(g=l.charCodeAt(f++),w=f<b?l.charCodeAt(f++):0,f<b?l.charCodeAt(f++):0),y=g>>2,c=(3&g)<<4|w>>4,m=1<_?(15&w)<<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,w,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 b,_=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(b=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,w=(15&y)<<4|(c=o.indexOf(l.charAt(h++)))>>2,u=(3&c)<<6|(m=o.indexOf(l.charAt(h++))),b[p++]=g,c!==64&&(b[p++]=w),m!==64&&(b[p++]=u);return b}},{"./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(w,u,y,c,m){this.compressedSize=w,this.uncompressedSize=u,this.crc32=y,this.compression=c,this.compressedContent=m}g.prototype={getContentWorker:function(){var w=new s(r.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new l("data_length")),u=this;return w.on("end",function(){if(this.streamInfo.data_length!==u.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),w},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(w,u,y){return w.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 w=0;w<8;w++)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,w,u,y){var c=s,m=y+u;g^=-1;for(var h=y;h<m;h++)g=g>>>8^c[255&(g^w[h])];return-1^g})(0|l,o,o.length,0):(function(g,w,u,y){var c=s,m=y+u;g^=-1;for(var h=y;h<m;h++)g=g>>>8^c[255&(g^w.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 w(u,y){l.call(this,"FlateWorker/"+u),this._pako=null,this._pakoAction=u,this._pakoOptions=y,this.meta={}}n.magic="\b\0",o.inherits(w,l),w.prototype.processChunk=function(u){this.meta=u.meta,this._pako===null&&this._createPako(),this._pako.push(o.transformTo(g,u.data),!1)},w.prototype.flush=function(){l.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},w.prototype.cleanUp=function(){l.prototype.cleanUp.call(this),this._pako=null},w.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 w("Deflate",u)},n.uncompressWorker=function(){return new w("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,b){var _,C,S=c.file,z=c.compression,B=b!==g.utf8encode,O=o.transformTo("string",b(S.name)),T=o.transformTo("string",g.utf8encode(S.name)),H=S.comment,X=o.transformTo("string",b(H)),k=o.transformTo("string",g.utf8encode(H)),D=T.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(w(O),4)+T,R+="up"+r(J.length,2)+J),d&&(W=r(1,1)+r(w(X),4)+k,R+="uc"+r(W.length,2)+W);var Y="";return Y+=`
|
|
59
|
+
\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"),w=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,b,_,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(b,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 w=new s(l.streamFiles,g,l.platform,l.encodeFileName),u=0;try{o.forEach(function(y,c){u++;var m=(function(b,_){var C=b||_,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(w)}),w.entriesCount=u}catch(y){w.error(y)}return w}},{"../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"),w=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}),w.isNode&&w.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 b=0;b<f.length;b++)p.push(u(f[b]));return s.Promise.all(p)}).then(function(h){for(var p=h.shift(),f=p.files,b=0;b<f.length;b++){var _=f[b],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(w){g.push({data:w,meta:{percent:0}})}).on("error",function(w){g.isPaused?this.generatedError=w:g.error(w)}).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 w=this;o.on("data",function(u,y){w.push(u)||w._helper.pause(),g&&g(y)}).on("error",function(u){w.emit("error",u)}).on("end",function(){w.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,T=o.getTypeOf(z),H=o.extend(B||{},w);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))&&b.call(this,O,!0);var X=T==="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",T="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"),w=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},b=function(S,z){return z=z!==void 0?z:w.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 T=this.files[this.root+S];return T&&!T.dir?T:null},folder:function(S){if(!S)return this;if(_(S))return this.filter(function(T,H){return H.dir&&S.test(T)});var z=this.root+S,B=b.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(T,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(T){(z=new l("error")).error(T)}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),w=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]===w&&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),w=o.charCodeAt(2),u=o.charCodeAt(3),y=this.readData(4);return l===y[0]&&g===y[1]&&w===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"),w=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 w(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(w){g.dataIsReady=!0,g.data=w,g.max=w&&w.length||0,g.type=r.getTypeOf(w),g.isPaused||g._tickAndRepeat()},function(w){g.error(w)})}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"),w=e("../external"),u=null;if(g.nodestream)try{u=e("../nodejs/NodejsStreamOutputAdapter")}catch{}function y(m,h){return new w.Promise(function(p,f){var b=[],_=m._internalType,C=m._outputType,S=m._mimeType;m.on("data",function(z,B){b.push(z),h&&h(B)}).on("error",function(z){b=[],f(z)}).on("end",function(){try{var z=(function(B,O,T){switch(B){case"blob":return r.newBlob(r.transformTo("arraybuffer",O),T);case"base64":return l.encode(O);default:return r.transformTo(B,O)}})(C,(function(B,O){var T,H=0,X=null,k=0;for(T=0;T<O.length;T++)k+=O[T].length;switch(B){case"string":return O.join("");case"array":return Array.prototype.concat.apply([],O);case"uint8array":for(X=new Uint8Array(k),T=0;T<O.length;T++)X.set(O[T],H),H+=O[T].length;return X;case"nodebuffer":return Buffer.concat(O);default:throw new Error("concat : unsupported type '"+B+"'")}})(_,b),S);p(z)}catch(B){f(B)}b=[]}).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(b){this._worker=new o("error"),this._worker.error(b)}}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),w=0;w<256;w++)g[w]=252<=w?6:248<=w?5:240<=w?4:224<=w?3:192<=w?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,b,_,C=m.length,S=0;for(b=0;b<C;b++)(64512&(p=m.charCodeAt(b)))==55296&&b+1<C&&(64512&(f=m.charCodeAt(b+1)))==56320&&(p=65536+(p-55296<<10)+(f-56320),b++),S+=p<128?1:p<2048?2:p<65536?3:4;for(h=s.uint8array?new Uint8Array(S):new Array(S),b=_=0;_<S;b++)(64512&(p=m.charCodeAt(b)))==55296&&b+1<C&&(64512&(f=m.charCodeAt(b+1)))==56320&&(p=65536+(p-55296<<10)+(f-56320),b++),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,b,_=m.length,C=new Array(2*_);for(h=p=0;h<_;)if((f=m[h++])<128)C[p++]=f;else if(4<(b=g[f]))C[p++]=65533,h+=b-1;else{for(f&=b===2?31:b===3?15:7;1<b&&h<_;)f=f<<6|63&m[h++],b--;1<b?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(b,_){var C;for((_=_||b.length)>b.length&&(_=b.length),C=_-1;0<=C&&(192&b[C])==128;)C--;return C<0||C===0?_:C+g[b[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 w(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 b=[],_=0,C=h.length;if(C<=f)return String.fromCharCode.apply(null,h);for(;_<C;)p==="array"||p==="nodebuffer"?b.push(String.fromCharCode.apply(null,h.slice(_,Math.min(_+f,C)))):b.push(String.fromCharCode.apply(null,h.subarray(_,Math.min(_+f,C)))),_+=f;return b.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),b=!0;if(f==="uint8array"?b=u.applyCanBeUsed.uint8array:f==="nodebuffer"&&(b=u.applyCanBeUsed.nodebuffer),b)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 w(h,new Array(h.length))},arraybuffer:function(h){return m.string.uint8array(h).buffer},uint8array:function(h){return w(h,new Uint8Array(h.length))},nodebuffer:function(h){return w(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=[],b=0;b<p.length;b++){var _=p[b];_==="."||_===""&&b!==0&&b!==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,b="";for(f=0;f<(h||"").length;f++)b+="\\x"+((p=h.charCodeAt(f))<16?"0":"")+p.toString(16).toUpperCase();return b},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,b,_){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&&b!==!0&&(C=(function(z){return w(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 w(u){this.files=[],this.loadOptions=u}w.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=w},{"./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"),w=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 w)if(Object.prototype.hasOwnProperty.call(w,f)&&w[f].magic===p)return w[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"),w=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 b=!this._dataBinary;b&&!f&&(h=h.pipe(new l.Utf8EncodeWorker)),!b&&f&&(h=h.pipe(new l.Utf8DecodeWorker))}catch(_){(h=new w("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 w?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,w=new l(m),u=r.document.createTextNode("");w.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"],w=["PENDING"];function u(f){if(typeof f!="function")throw new TypeError("resolver must be a function");this.state=w,this.queue=[],this.outcome=void 0,f!==s&&h(this,f)}function y(f,b,_){this.promise=f,typeof b=="function"&&(this.onFulfilled=b,this.callFulfilled=this.otherCallFulfilled),typeof _=="function"&&(this.onRejected=_,this.callRejected=this.otherCallRejected)}function c(f,b,_){r(function(){var C;try{C=b(_)}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 b=f&&f.then;if(f&&(typeof f=="object"||typeof f=="function")&&typeof b=="function")return function(){b.apply(f,arguments)}}function h(f,b){var _=!1;function C(B){_||(_=!0,o.reject(f,B))}function S(B){_||(_=!0,o.resolve(f,B))}var z=p(function(){b(S,C)});z.status==="error"&&C(z.value)}function p(f,b){var _={};try{_.value=f(b),_.status="success"}catch(C){_.status="error",_.value=C}return _}(i.exports=u).prototype.finally=function(f){if(typeof f!="function")return this;var b=this.constructor;return this.then(function(_){return b.resolve(f()).then(function(){return _})},function(_){return b.resolve(f()).then(function(){throw _})})},u.prototype.catch=function(f){return this.then(null,f)},u.prototype.then=function(f,b){if(typeof f!="function"&&this.state===g||typeof b!="function"&&this.state===l)return this;var _=new this.constructor(s);return this.state!==w?c(_,this.state===g?f:b,this.outcome):this.queue.push(new y(_,f,b)),_},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,b){var _=p(m,b);if(_.status==="error")return o.reject(f,_.value);var C=_.value;if(C)h(f,C);else{f.state=g,f.outcome=b;for(var S=-1,z=f.queue.length;++S<z;)f.queue[S].callFulfilled(b)}return f},o.reject=function(f,b){f.state=l,f.outcome=b;for(var _=-1,C=f.queue.length;++_<C;)f.queue[_].callRejected(b);return f},u.resolve=function(f){return f instanceof this?f:o.resolve(new this(s),f)},u.reject=function(f){var b=new this(s);return o.reject(b,f)},u.all=function(f){var b=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<_;)T(f[B],B);return O;function T(H,X){b.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 b=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],b.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"),w=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 b=this.options;b.raw&&0<b.windowBits?b.windowBits=-b.windowBits:b.gzip&&0<b.windowBits&&b.windowBits<16&&(b.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,b.level,b.method,b.windowBits,b.memLevel,b.strategy);if(_!==u)throw new Error(l[_]);if(b.header&&r.deflateSetHeader(this.strm,b.header),b.dictionary){var C;if(C=typeof b.dictionary=="string"?o.string2buf(b.dictionary):w.call(b.dictionary)==="[object ArrayBuffer]"?new Uint8Array(b.dictionary):b.dictionary,(_=r.deflateSetDictionary(this.strm,C))!==u)throw new Error(l[_]);this._dict_set=!0}}function p(f,b){var _=new h(b);if(_.push(f,!0),_.err)throw _.msg||l[_.err];return _.result}h.prototype.push=function(f,b){var _,C,S=this.strm,z=this.options.chunkSize;if(this.ended)return!1;C=b===~~b?b:b===!0?4:0,typeof f=="string"?S.input=o.string2buf(f):w.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,b){return(b=b||{}).raw=!0,p(f,b)},n.gzip=function(f,b){return(b=b||{}).gzip=!0,p(f,b)}},{"./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"),w=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 w,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,b,_,C,S,z,B=this.strm,O=this.options.chunkSize,T=this.options.dictionary,H=!1;if(this.ended)return!1;b=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&&T&&(z=typeof T=="string"?o.string2buf(T):y.call(T)==="[object ArrayBuffer]"?new Uint8Array(T):T,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||b!==l.Z_FINISH&&b!==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&&(b=l.Z_FINISH),b===l.Z_FINISH?(f=r.inflateEnd(this.strm),this.onEnd(f),this.ended=!0,f===l.Z_OK):b!==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 w=g.shift();if(w){if(typeof w!="object")throw new TypeError(w+"must be non-object");for(var u in w)w.hasOwnProperty(u)&&(l[u]=w[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,w,u,y){if(g.subarray&&l.subarray)l.set(g.subarray(w,w+u),y);else for(var c=0;c<u;c++)l[y+c]=g[w+c]},flattenChunks:function(l){var g,w,u,y,c,m;for(g=u=0,w=l.length;g<w;g++)u+=l[g].length;for(m=new Uint8Array(u),g=y=0,w=l.length;g<w;g++)c=l[g],m.set(c,y),y+=c.length;return m}},o={arraySet:function(l,g,w,u,y){for(var c=0;c<u;c++)l[y+c]=g[w+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 w(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,b=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++),b+=c<128?1:c<2048?2:c<65536?3:4;for(y=new r.Buf8(b),h=p=0;p<b;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 w(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,b=new Array(2*f);for(c=m=0;c<f;)if((h=u[c++])<128)b[m++]=h;else if(4<(p=l[h]))b[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?b[m++]=65533:h<65536?b[m++]=h:(h-=65536,b[m++]=55296|h>>10&1023,b[m++]=56320|1023&h)}return w(b,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,w=r>>>16&65535|0,u=0;o!==0;){for(o-=u=2e3<o?2e3:o;w=w+(g=g+s[l++]|0)|0,--u;);g%=65521,w%=65521}return g|w<<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 w=r,u=g+l;s^=-1;for(var y=g;y<u;y++)s=s>>>8^w[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"),w=e("./messages"),u=0,y=4,c=0,m=-2,h=-1,p=4,f=2,b=8,_=9,C=286,S=30,z=19,B=2*C+1,O=15,T=3,H=258,X=H+T+1,k=42,D=113,d=1,R=2,J=3,W=4;function tt(a,L){return a.msg=w[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,A=L.pending;A>a.avail_out&&(A=a.avail_out),A!==0&&(s.arraySet(a.output,L.pending_buf,L.pending_out,A,a.next_out),a.next_out+=A,L.pending_out+=A,a.total_out+=A,a.avail_out-=A,L.pending-=A,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 A,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[(A=L)+P]===it&&j[A+P-1]===rt&&j[A]===j[N]&&j[++A]===j[N+1]){N+=2,A++;do;while(j[++N]===j[++A]&&j[++N]===j[++A]&&j[++N]===j[++A]&&j[++N]===j[++A]&&j[++N]===j[++A]&&j[++N]===j[++A]&&j[++N]===j[++A]&&j[++N]===j[++A]&&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,A,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=A=a.hash_size;x=a.head[--L],a.head[L]=Z<=x?x-Z:0,--A;);for(L=A=Z;x=a.prev[--L],a.prev[L]=Z<=x?x-Z:0,--A;);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),A=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+=A,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<X&&a.strm.avail_in!==0)}function lt(a,L){for(var A,x;;){if(a.lookahead<X){if(st(a),a.lookahead<X&&L===u)return d;if(a.lookahead===0)break}if(A=0,a.lookahead>=T&&(a.ins_h=(a.ins_h<<a.hash_shift^a.window[a.strstart+T-1])&a.hash_mask,A=a.prev[a.strstart&a.w_mask]=a.head[a.ins_h],a.head[a.ins_h]=a.strstart),A!==0&&a.strstart-A<=a.w_size-X&&(a.match_length=K(a,A)),a.match_length>=T)if(x=o._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,A=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<T-1?a.strstart:T-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 A,x,v;;){if(a.lookahead<X){if(st(a),a.lookahead<X&&L===u)return d;if(a.lookahead===0)break}if(A=0,a.lookahead>=T&&(a.ins_h=(a.ins_h<<a.hash_shift^a.window[a.strstart+T-1])&a.hash_mask,A=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,A!==0&&a.prev_length<a.max_lazy_match&&a.strstart-A<=a.w_size-X&&(a.match_length=K(a,A),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(v=a.strstart+a.lookahead-T,x=o._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<=v&&(a.ins_h=(a.ins_h<<a.hash_shift^a.window[a.strstart+T-1])&a.hash_mask,A=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++,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<T-1?a.strstart:T-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,A,x,v){this.good_length=a,this.max_lazy=L,this.nice_length=A,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=b,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 ft(a){var L=ot(a);return L===c&&(function(A){A.window_size=2*A.w_size,q(A.head),A.max_lazy_match=r[A.level].max_lazy,A.good_match=r[A.level].good_length,A.nice_match=r[A.level].nice_length,A.max_chain_length=r[A.level].max_chain,A.strstart=0,A.block_start=0,A.lookahead=0,A.insert=0,A.match_length=A.prev_length=T-1,A.match_available=0,A.ins_h=0})(a.state),L}function ut(a,L,A,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||A!==b||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+T-1)/T),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=A,ft(a)}r=[new nt(0,0,0,0,function(a,L){var A=65535;for(A>a.pending_buf_size-5&&(A=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+A;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,b,15,8,0)},n.deflateInit2=ut,n.deflateReset=ft,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 A,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,A=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=b+(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(A)&&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>=T&&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>=T?(G=o._tr_tally(E,1,E.match_length-T),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 A,x,v,N,P,F,E,j,G=L.length;if(!a||!a.state||(N=(A=a.state).wrap)===2||N===1&&A.status!==k||A.lookahead)return m;for(N===1&&(a.adler=l(a.adler,L,G,0)),A.wrap=0,G>=A.w_size&&(N===0&&(q(A.head),A.strstart=0,A.block_start=0,A.insert=0),j=new s.Buf8(A.w_size),s.arraySet(j,L,G-A.w_size,A.w_size,0),L=j,G=A.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(A);A.lookahead>=T;){for(x=A.strstart,v=A.lookahead-(T-1);A.ins_h=(A.ins_h<<A.hash_shift^A.window[x+T-1])&A.hash_mask,A.prev[x&A.w_mask]=A.head[A.ins_h],A.head[A.ins_h]=x,x++,--v;);A.strstart=x,A.lookahead=T-1,st(A)}return A.strstart+=A.lookahead,A.block_start=A.strstart,A.insert=A.lookahead,A.lookahead=0,A.match_length=A.prev_length=T-1,A.match_available=0,a.next_in=F,a.input=E,a.avail_in=P,A.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,w,u,y,c,m,h,p,f,b,_,C,S,z,B,O,T,H,X,k,D,d,R;o=r.state,l=r.next_in,d=r.input,g=l+(r.avail_in-5),w=r.next_out,R=r.output,u=w-(s-r.avail_out),y=w+(r.avail_out-257),c=o.dmax,m=o.wsize,h=o.whave,p=o.wnext,f=o.window,b=o.hold,_=o.bits,C=o.lencode,S=o.distcode,z=(1<<o.lenbits)-1,B=(1<<o.distbits)-1;t:do{_<15&&(b+=d[l++]<<_,_+=8,b+=d[l++]<<_,_+=8),O=C[b&z];e:for(;;){if(b>>>=T=O>>>24,_-=T,(T=O>>>16&255)===0)R[w++]=65535&O;else{if(!(16&T)){if((64&T)==0){O=C[(65535&O)+(b&(1<<T)-1)];continue e}if(32&T){o.mode=12;break t}r.msg="invalid literal/length code",o.mode=30;break t}H=65535&O,(T&=15)&&(_<T&&(b+=d[l++]<<_,_+=8),H+=b&(1<<T)-1,b>>>=T,_-=T),_<15&&(b+=d[l++]<<_,_+=8,b+=d[l++]<<_,_+=8),O=S[b&B];i:for(;;){if(b>>>=T=O>>>24,_-=T,!(16&(T=O>>>16&255))){if((64&T)==0){O=S[(65535&O)+(b&(1<<T)-1)];continue i}r.msg="invalid distance code",o.mode=30;break t}if(X=65535&O,_<(T&=15)&&(b+=d[l++]<<_,(_+=8)<T&&(b+=d[l++]<<_,_+=8)),c<(X+=b&(1<<T)-1)){r.msg="invalid distance too far back",o.mode=30;break t}if(b>>>=T,_-=T,(T=w-u)<X){if(h<(T=X-T)&&o.sane){r.msg="invalid distance too far back",o.mode=30;break t}if(D=f,(k=0)===p){if(k+=m-T,T<H){for(H-=T;R[w++]=f[k++],--T;);k=w-X,D=R}}else if(p<T){if(k+=m+p-T,(T-=p)<H){for(H-=T;R[w++]=f[k++],--T;);if(k=0,p<H){for(H-=T=p;R[w++]=f[k++],--T;);k=w-X,D=R}}}else if(k+=p-T,T<H){for(H-=T;R[w++]=f[k++],--T;);k=w-X,D=R}for(;2<H;)R[w++]=D[k++],R[w++]=D[k++],R[w++]=D[k++],H-=3;H&&(R[w++]=D[k++],1<H&&(R[w++]=D[k++]))}else{for(k=w-X;R[w++]=R[k++],R[w++]=R[k++],R[w++]=R[k++],2<(H-=3););H&&(R[w++]=R[k++],1<H&&(R[w++]=R[k++]))}break}}break}}while(l<g&&w<y);l-=H=_>>3,b&=(1<<(_-=H<<3))-1,r.next_in=l,r.next_out=w,r.avail_in=l<g?g-l+5:5-(l-g),r.avail_out=w<y?y-w+257:257-(w-y),o.hold=b,o.bits=_}},{}],49:[function(e,i,n){var r=e("../utils/common"),s=e("./adler32"),o=e("./crc32"),l=e("./inffast"),g=e("./inftrees"),w=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 b(){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 b,(k.state=R).window=null,(d=S(k,D))!==y&&(k.state=null),d):c}var B,O,T=!0;function H(k){if(T){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(w,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}),T=!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,ft,ut,a,L,A,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,A={bits:d.lenbits},L=g(0,d.lens,0,19,d.lencode,0,d.work,A),d.lenbits=A.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,A={bits:d.lenbits},L=g(w,d.lens,0,d.nlen,d.lencode,0,d.work,A),d.lenbits=A.bits,L){k.msg="invalid literal/lengths set",d.mode=30;break}if(d.distbits=6,d.distcode=d.distdyn,A={bits:d.distbits},L=g(u,d.lens,d.nlen,d.ndist,d.distcode,0,d.work,A),d.distbits=A.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,ft=nt,ut=dt;nt=(v=d.lencode[ut+((M&(1<<ot+ft)-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,ft=nt,ut=dt;nt=(v=d.distcode[ut+((M&(1<<ot+ft)-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(w,u,y,c,m,h,p,f){var b,_,C,S,z,B,O,T,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&&(w===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=w===0?(I=st=p,19):w===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,w===1&&852<q||w===2&&592<q)return 1;for(;;){for(O=k-tt,H=p[D]<B?(T=0,p[D]):p[D]>B?(T=st[lt+p[D]],I[V+p[D]]):(T=96,0),b=1<<k-tt,d=_=1<<W;m[z+(M>>tt)+(_-=b)]=O<<24|T<<16|H|0,_!==0;);for(b=1<<k-1;M&b;)b>>=1;if(b!==0?(M&=b-1,M+=b):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,w===1&&852<q||w===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,w=29,u=256,y=u+1+w,c=30,m=19,h=2*y+1,p=15,f=16,b=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],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],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(w);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 ft(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 vt,pt,bt,at,xt,Ct,mt=ht.dyn_tree,Mt=ht.max_code,Pt=ht.stat_desc.static_tree,Ft=ht.stat_desc.has_stree,Wt=ht.stat_desc.extra_bits,At=ht.stat_desc.extra_base,wt=ht.stat_desc.max_length,_t=0;for(at=0;at<=p;at++)it.bl_count[at]=0;for(mt[2*it.heap[it.heap_max]+1]=0,vt=it.heap_max+1;vt<h;vt++)wt<(at=mt[2*mt[2*(pt=it.heap[vt])+1]+1]+1)&&(at=wt,_t++),mt[2*pt+1]=at,Mt<pt||(it.bl_count[at]++,xt=0,At<=pt&&(xt=Wt[pt-At]),Ct=mt[2*pt],it.opt_len+=Ct*(at+xt),Ft&&(it.static_len+=Ct*(Pt[2*pt+1]+xt)));if(_t!==0){do{for(at=wt-1;it.bl_count[at]===0;)at--;it.bl_count[at]--,it.bl_count[at+1]+=2,it.bl_count[wt]--,_t-=2}while(0<_t);for(at=wt;at!==0;at--)for(pt=it.bl_count[at];pt!==0;)Mt<(bt=it.heap[--vt])||(mt[2*bt+1]!==at&&(it.opt_len+=(at-mt[2*bt+1])*mt[2*bt],mt[2*bt+1]=at),pt--)}})(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 A=!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){A||((function(){var N,P,F,E,j,G=new Array(p+1);for(E=F=0;E<w-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),T,0,m,b)})(),A=!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),ft(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),ft(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,w,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(){b(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?((w=new MessageChannel).port1.onmessage=function(C){b(C.data)},function(C){w.port2.postMessage(C)}):h&&"onreadystatechange"in h.createElement("script")?(g=h.documentElement,function(C){var S=h.createElement("script");S.onreadystatechange=function(){b(C),S.onreadystatechange=null,g.removeChild(S),S=null},g.appendChild(S)}):function(C){setTimeout(b,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 b(C){if(m)setTimeout(b,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&&b(+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)})})(Et)),Et.exports}var me=pe();const ge=fe(me);class Lt{generate(){return typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():Date.now().toString(36)+Math.random().toString(36).substr(2)}}class zt{idGenerator;constructor(){this.idGenerator=new Lt}async extractMindMapData(t){const e=new ge;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"),w=o.split(".").pop()?.toLowerCase();let u="image/png";w==="jpg"||w==="jpeg"?u="image/jpeg":w==="svg"?u="image/svg+xml":w==="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 ye{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 ue().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 zt;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 zt().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 ve{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 be extends Ot{mindMap;controller;interactionOrchestrator;commandBus;constructor(t,e={}){super();const i=new gt("root","Root Topic",null,!0);this.mindMap=new Ut(i);const n=new Lt,r=new jt(this.mindMap,n),s=new Zt(10),o=new Kt(this.mindMap,n),l=new Xt(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 yt(g),y=new Vt(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 ce(y),h=new he(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 ye({mindMap:this.mindMap,renderer:y,eventBus:p,fileHandler:e.fileHandler}),b=new ve({mindMap:this.mindMap,service:r,renderer:y,eventBus:p}),_=new se;this.controller=new le({mindMap:this.mindMap,service:r,renderer:y,styleEditor:u,eventBus:p,historyService:s,clipboardService:o,searchService:l,viewportService:m,navigationService:h,fileIOService:f,themeService:b,commandBus:_,locale:e.locale||c,commandPaletteFeatures:e.disabledCommandPaletteFeatures}),u.onUpdate=(S,z)=>{this.controller.updateNode(S,{style:z})},this.interactionOrchestrator=new re({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 Jt(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}}exports.Kakidash=be;exports.Node=gt;exports.SvgGenerator=Bt;exports.TypedEventEmitter=Ot;exports.XMindImporter=zt;
|