1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2038],{2038:function(t,e,a){a.r(e),a.d(e,{default:function(){return d}});var i=a(69727),r=a(40029);let getNumberValueFromStr=t=>String(t).split(/\s+/).map(t=>{if(!/^[\d.]+/.test(t))return t;{let e=/^([\d.]+)(.*)$/.exec(t);return[Number(e[1]),e[2]]}}),zoomWidth=(t,e)=>t*e,zoomHeight=(t,e)=>e/t,n={left:0,top:0,center:50,bottom:100,right:100},handleBackgroundSize=({backgroundSize:t,drawOpt:e,imageRatio:a,canvasWidth:i,canvasHeight:r,canvasRatio:n})=>{if(t){let o=getNumberValueFromStr(t);if("auto"===o[0]&&"auto"===o[1])return;if("cover"===o[0]){a>n?(e.height=r,e.width=zoomWidth(a,r)):(e.width=i,e.height=zoomHeight(a,i));return}if("contain"===o[0]){a>n?(e.width=i,e.height=zoomHeight(a,i)):(e.height=r,e.width=zoomWidth(a,r));return}let d=-1;o[0]&&(Array.isArray(o[0])?"%"===o[0][1]?(e.width=o[0][0]/100*i,d=e.width):(e.width=o[0][0],d=o[0][0]):"auto"===o[0]&&o[1]&&("%"===o[1][1]?e.width=zoomWidth(a,o[1][0]/100*r):e.width=zoomWidth(a,o[1][0]))),o[1]&&Array.isArray(o[1])?"%"===o[1][1]?e.height=o[1][0]/100*r:e.height=o[1][0]:-1!==d&&(e.height=zoomHeight(a,d))}},handleBackgroundPosition=({backgroundPosition:t,drawOpt:e,imgWidth:a,imgHeight:i,canvasWidth:r,canvasHeight:o})=>{if(t){let d=getNumberValueFromStr(t);if(Array.isArray((d=d.map(t=>"string"==typeof t&&void 0!==n[t]?[n[t],"%"]:t))[0])){if(1===d.length&&d.push([50,"%"]),"%"===d[0][1]){let t=d[0][0]/100*r,i=d[0][0]/100*a;e.x=t-i}else e.x=d[0][0];if("%"===d[1][1]){let t=d[1][0]/100*o,a=d[1][0]/100*i;e.y=t-a}else e.y=d[1][0]}}},handleBackgroundRepeat=({ctx:t,image:e,backgroundRepeat:a,drawOpt:i,imgWidth:r,imgHeight:n,canvasWidth:o,canvasHeight:d})=>{if(a){let l=i.x,h=i.y,s=l-Math.ceil(l/r)*r,g=h-Math.ceil(h/n)*n,m=getNumberValueFromStr(a);if("no-repeat"!==m[0]&&(!(r>=o)||!(n>=d))){if("repeat-x"===m[0]&&o>r){let a=s;for(;a<o;)drawImage(t,e,{...i,x:a}),a+=r;return!0}if("repeat-y"===m[0]&&d>n){let a=g;for(;a<d;)drawImage(t,e,{...i,y:a}),a+=n;return!0}if("repeat"===m[0]){let a=s;for(;a<o;){if(d>n){let r=g;for(;r<d;)drawImage(t,e,{...i,x:a,y:r}),r+=n}a+=r}return!0}}}},drawImage=(t,e,a)=>{t.drawImage(e,a.sx,a.sy,a.swidth,a.sheight,a.x,a.y,a.width,a.height)};var simulateCSSBackgroundInCanvas=(t,e,a,i,{backgroundSize:r,backgroundPosition:n,backgroundRepeat:o},d=()=>{})=>{let l=e/a,h=new Image;h.src=i,h.onload=()=>{let i=h.width,s=h.height,g=i/s,m={sx:0,sy:0,swidth:i,sheight:s,x:0,y:0,width:i,height:s};handleBackgroundSize({backgroundSize:r,drawOpt:m,imageRatio:g,canvasWidth:e,canvasHeight:a,canvasRatio:l}),handleBackgroundPosition({backgroundPosition:n,drawOpt:m,imgWidth:m.width,imgHeight:m.height,imageRatio:g,canvasWidth:e,canvasHeight:a,canvasRatio:l}),handleBackgroundRepeat({ctx:t,image:h,backgroundRepeat:o,drawOpt:m,imgWidth:m.width,imgHeight:m.height,imageRatio:g,canvasWidth:e,canvasHeight:a,canvasRatio:l})||drawImage(t,h,m),d()},h.onerror=t=>{d(t)}};let getNodeText=t=>t.richText?(0,i.Vu)(t.text):t.text,getTitleMark=t=>Array(t).fill("#").join(""),getIndentMark=t=>Array(t-6).fill(" ").join("")+"*",transformToMarkdown=t=>{let e="";return(0,i._p)(t,null,(t,a,i,r)=>{let n=r+1;n<=6?e+=getTitleMark(n):e+=getIndentMark(n),e+=" "+getNodeText(t.data);let o=t.data.generalization;if(Array.isArray(o))e+=o.map(t=>` [${getNodeText(t)}]`);else if(o&&o.text){let t=getNodeText(o);e+=` [${t}]`}e+="\n\n",t.data.note&&(e+=t.data.note+"\n\n")},()=>{},!0),e};var o=a(68511);let toTxt_getNodeText=t=>t.richText?(0,i.Vu)(t.text):t.text,getIndent=t=>Array(t).fill(" ").join(""),transformToTxt=t=>{let e="";return(0,i._p)(t,null,(t,a,i,r)=>{e+=getIndent(r)+" "+toTxt_getNodeText(t.data);let n=t.data.generalization;Array.isArray(n)?e+=n.map(t=>` [${toTxt_getNodeText(t)}]`):n&&n.text&&(e+=` [${toTxt_getNodeText(n)}]`),e+="\n\n"},()=>{},!0),e};let Export=class Export{constructor(t){this.mindMap=t.mindMap}async export(t,e=!0,a="æç»´å¯¼å¾",...r){if(!this[t])return null;{let n=await this[t](a,...r);return e&&(0,i.Sv)(n,a+"."+t),n}}createTransformImgTaskList(t,e,a,r){let n=t.find(e);return n.map(async t=>{let e=r(t);if(/^data:/.test(e)||"none"===e)return;let n=await (0,i.j0)(e);t.attr(a,n)})}async getSvgData(t){let{exportPaddingX:e,exportPaddingY:a,errorHandler:n,resetCss:d,addContentToHeader:l,addContentToFooter:h,handleBeingE
1xportSvg:s}=this.mindMap.opt,{svg:g,svgHTML:m,clipData:u}=this.mindMap.getSvgData({paddingX:e,paddingY:a,addContentToHeader:l,addContentToFooter:h,node:t});u&&(u.paddingX=e,u.paddingY=a);let c=!1,f=this.createTransformImgTaskList(g,"image","href",t=>t.attr("href")||t.attr("xlink:href")),p=this.createTransformImgTaskList(g,"img","src",t=>t.attr("src")),w=[...f,...p];try{await Promise.all(w)}catch(t){n(o.iR.EXPORT_LOAD_IMAGE_ERROR,t)}if(this.mindMap.richText){let t=g.find("foreignObject");if(t.length>0&&(t[0].add((0,r.Wj)(`<style>${d}</style>`)),c=!0),this.mindMap.formula){let e=g.find(".ql-formula");if(e.length>0){let e=this.mindMap.formula.getStyleText();if(e){let a=document.createElement("style");a.innerHTML=e,(0,i.Nb)(a),t[0].add(a),c=!0}}}}return"function"==typeof s&&(c=!0,g=s(g)),(w.length>0||c)&&(m=g.svg()),{node:g,str:m,clipData:u}}svgToPng(t,e,a=null,r=!1,n="image/png"){let{maxCanvasSize:o,minExportImgCanvasScale:d}=this.mindMap.opt;return new Promise((l,h)=>{let s=new Image;s.setAttribute("crossOrigin","anonymous"),s.onload=async()=>{try{let t=document.createElement("canvas"),h=Math.max(window.devicePixelRatio,d),g=s.width,m=s.height,u=0,c=0;a&&(u=a.paddingX,c=a.paddingY,g=a.width+2*u,m=a.height+2*c);let f=0,p=0,{backgroundImage:w}=this.mindMap.themeConfig;if(r&&w&&!e){let t=await new Promise(t=>{let e=new Image;e.onload=()=>{t([e.width,e.height])},e.onerror=()=>{t(null)},e.src=w});if(t){let e=g/m,a=t[0]/t[1];e>a?(f=g,p=g/a):(p=m,f=m*a)}}let x=1,y=1,T=(f||g)*h,v=(p||m)*h;if(T>o||v>o){let t=null,e=null;T>o?t=o:v>o&&(e=o);let a=(0,i._j)(T,v,t,e);x=a[0]/T,y=a[1]/v,T=a[0],v=a[1]}t.width=T,t.height=v;let M=T/h,k=v/h;t.style.width=M+"px",t.style.height=k+"px";let S=t.getContext("2d");S.scale(h,h),e||await this.drawBackgroundToCanvas(S,M,k);let E=(f>0?(f-g)/2:0)*x,b=(p>0?(p-m)/2:0)*y;a?S.drawImage(s,a.left,a.top,a.width,a.height,u*x+E,c*y+b,a.width*x,a.height*y):S.drawImage(s,E,b,g*x,m*y),l(t.toDataURL(n))}catch(t){h(t)}},s.onerror=t=>{h(t)},s.src=t})}drawBackgroundToCanvas(t,e,a){return new Promise((i,r)=>{let{backgroundColor:n="#fff",backgroundImage:o,backgroundRepeat:d="no-repeat",backgroundPosition:l="center center",backgroundSize:h="cover"}=this.mindMap.themeConfig;t.save(),t.rect(0,0,e,a),t.fillStyle=n,t.fill(),t.restore(),o&&"none"!==o?(t.save(),simulateCSSBackgroundInCanvas(t,e,a,o,{backgroundRepeat:d,backgroundPosition:l,backgroundSize:h},e=>{e?r(e):i(),t.restore()})):i()})}drawBackgroundToSvg(t){return new Promise(async e=>{let{backgroundColor:a="#fff",backgroundImage:r,backgroundRepeat:n="repeat"}=this.mindMap.themeConfig;if(t.css("background-color",a),r&&"none"!==r){let a=await (0,i.j0)(r);t.css("background-image",`url(${a})`),t.css("background-repeat",n),e()}else e()})}async _image(t,e,a=!1,i=null,r=!1){this.mindMap.renderer.textEdit.hideEditTextBox(),this.handleNodeExport(i);let{str:n,clipData:o}
1=await this.getSvgData(i),d=await this.fixSvgStrAndToBlob(n),l=await this.svgToPng(d,a,o,r,t);return l}async png(...t){let e=await this._image("image/png",...t);return e}async jpg(...t){let e=await this._image("image/jpg",...t);return e}handleNodeExport(t){if(t&&t.getData("isActive")){t.deactivate();let{alwaysShowExpandBtn:e,notShowExpandBtn:a}=this.mindMap.opt;!e&&!a&&t.getData("expand")&&t.removeExpandBtn()}}async pdf(t,e=!1,a=!1){if(!this.mindMap.doExportPDF)throw Error("请注åExportPDFæä»¶");let i=await this.png(t,e,null,a),r=await this.mindMap.doExportPDF.pdf(i);return r}async xmind(t){if(!this.mindMap.doExportXMind)throw Error("请注åExportXMindæä»¶");let e=this.mindMap.getData(),a=await this.mindMap.doExportXMind.xmind(e,t),r=await (0,i.rZ)(a);return r}async svg(t){this.mindMap.renderer.textEdit.hideEditTextBox();let{node:e}=await this.getSvgData();e.first().before((0,r.Wj)(`<title>${t}</title>`)),await this.drawBackgroundToSvg(e);let a=e.svg(),i=await this.fixSvgStrAndToBlob(a);return i}async fixSvgStrAndToBlob(t){t=(0,i._5)(t),t=(0,i.uw)(t);let e=new Blob([t],{type:"image/svg+xml"}),a=await (0,i.rZ)(e);return a}async json(t,e=!0){let a=this.mindMap.getData(e),r=JSON.stringify(a),n=new Blob([r]),o=await (0,i.rZ)(n);return o}async smm(t,e){let a=await this.json(t,e);return a}async md(){let t=this.mindMap.getData(),e=transformToMarkdown(t),a=new Blob([e]),r=await (0,i.rZ)(a);return r}async txt(){let t=this.mindMap.getData(),e=transformToTxt(t),a=new Blob([e]),r=await (0,i.rZ)(a);return r}};Export.instanceName="doExport";var d=Export}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.