You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
2 lines
17 KiB
2 lines
17 KiB
import{N as L}from"./index-3c234266.js";function q(t,e){if(t.match(/^[a-z]+:\/\//i))return t;if(t.match(/^\/\//))return window.location.protocol+t;if(t.match(/^[a-z]+:/i))return t;const r=document.implementation.createHTMLDocument(),n=r.createElement("base"),i=r.createElement("a");return r.head.appendChild(n),r.body.appendChild(i),e&&(n.href=e),i.href=t,i.href}const z=(()=>{let t=0;const e=()=>`0000${(Math.random()*36**4<<0).toString(36)}`.slice(-4);return()=>(t+=1,`u${e()}${t}`)})();function g(t){const e=[];for(let r=0,n=t.length;r<n;r++)e.push(t[r]);return e}function p(t,e){const n=(t.ownerDocument.defaultView||window).getComputedStyle(t).getPropertyValue(e);return n?parseFloat(n.replace("px","")):0}function G(t){const e=p(t,"border-left-width"),r=p(t,"border-right-width");return t.clientWidth+e+r}function J(t){const e=p(t,"border-top-width"),r=p(t,"border-bottom-width");return t.clientHeight+e+r}function D(t,e={}){const r=e.width||G(t),n=e.height||J(t);return{width:r,height:n}}function X(){let t,e;try{e=process}catch{}const r=e&&e.env?e.env.devicePixelRatio:null;return r&&(t=parseInt(r,10),Number.isNaN(t)&&(t=1)),t||window.devicePixelRatio||1}const h=16384;function Z(t){(t.width>h||t.height>h)&&(t.width>h&&t.height>h?t.width>t.height?(t.height*=h/t.width,t.width=h):(t.width*=h/t.height,t.height=h):t.width>h?(t.height*=h/t.width,t.width=h):(t.width*=h/t.height,t.height=h))}function y(t){return new Promise((e,r)=>{const n=new Image;n.decode=()=>e(n),n.onload=()=>e(n),n.onerror=r,n.crossOrigin="anonymous",n.decoding="async",n.src=t})}async function K(t){return Promise.resolve().then(()=>new XMLSerializer().serializeToString(t)).then(encodeURIComponent).then(e=>`data:image/svg+xml;charset=utf-8,${e}`)}async function Q(t,e,r){const n="http://www.w3.org/2000/svg",i=document.createElementNS(n,"svg"),s=document.createElementNS(n,"foreignObject");return i.setAttribute("width",`${e}`),i.setAttribute("height",`${r}`),i.setAttribute("viewBox",`0 0 ${e} ${r}`),s.setAttribute("width","100%"),s.setAttribute("height","100%"),s.setAttribute("x","0"),s.setAttribute("y","0"),s.setAttribute("externalResourcesRequired","true"),i.appendChild(s),s.appendChild(t),K(i)}const u=(t,e)=>{if(t instanceof e)return!0;const r=Object.getPrototypeOf(t);return r===null?!1:r.constructor.name===e.name||u(r,e)};function Y(t){const e=t.getPropertyValue("content");return`${t.cssText} content: '${e.replace(/'|"/g,"")}';`}function N(t){return g(t).map(e=>{const r=t.getPropertyValue(e),n=t.getPropertyPriority(e);return`${e}: ${r}${n?" !important":""};`}).join(" ")}function tt(t,e,r){const n=`.${t}:${e}`,i=r.cssText?Y(r):N(r);return document.createTextNode(`${n}{${i}}`)}function v(t,e,r){const n=window.getComputedStyle(t,r),i=n.getPropertyValue("content");if(i===""||i==="none")return;const s=z();try{e.className=`${e.className} ${s}`}catch{return}const o=document.createElement("style");o.appendChild(tt(s,r,n)),e.appendChild(o)}function et(t,e){v(t,e,":before"),v(t,e,":after")}const M="application/font-woff",T="image/jpeg",nt={woff:M,woff2:M,ttf:"application/font-truetype",eot:"application/vnd.ms-fontobject",png:"image/png",jpg:T,jpeg:T,gif:"image/gif",tiff:"image/tiff",svg:"image/svg+xml",webp:"image/webp"};function rt(t){const e=/\.([^./]*?)$/g.exec(t);return e?e[1]:""}function R(t){const e=rt(t).toLowerCase();return nt[e]||""}function it(t){return t.split(/,/)[1]}function E(t){return t.search(/^(data:)/)!==-1}function O(t,e){return`data:${e};base64,${t}`}async function U(t,e,r){const n=await fetch(t,e);if(n.status===404)throw new Error(`Resource "${n.url}" not found`);const i=await n.blob();return new Promise((s,o)=>{const c=new FileReader;c.onerror=o,c.onloadend=()=>{try{s(r({res:n,result:c.result}))}catch(a){o(a)}},c.readAsDataURL(i)})}const x={};function st(t,e,r){let n=t.replace(/\?.*/,"");return r&&(n=t),/ttf|otf|eot|woff2?/i.test(n)&&(n=n.replace(/.*\//,"")),e?`[${e}]${n}`:n}async function C(t,e,r){const n=st(t,e,r.includeQueryParams);if(x[n]!=null)return x[n];r.cacheBust&&(t+=(/\?/.test(t)?"&":"?")+new Date().getTime());let i;try{const s=await U(t,r.fetchRequestInit,({res:o,result:c})=>(e||(e=o.headers.get("Content-Type")||""),it(c)));i=O(s,e)}catch(s){i=r.imagePlaceholder||"";let o=`Failed to fetch resource: ${t}`;s&&(o=typeof s=="string"?s:s.message),o&&console.warn(o)}return x[n]=i,i}async function ot(t){const e=t.toDataURL();return e==="data:,"?t.cloneNode(!1):y(e)}async function ct(t,e){if(t.currentSrc){const s=document.createElement("canvas"),o=s.getContext("2d");s.width=t.clientWidth,s.height=t.clientHeight,o==null||o.drawImage(t,0,0,s.width,s.height);const c=s.toDataURL();return y(c)}const r=t.poster,n=R(r),i=await C(r,n,e);return y(i)}async function at(t){var e;try{if(!((e=t==null?void 0:t.contentDocument)===null||e===void 0)&&e.body)return await w(t.contentDocument.body,{},!0)}catch{}return t.cloneNode(!1)}async function lt(t,e){return u(t,HTMLCanvasElement)?ot(t):u(t,HTMLVideoElement)?ct(t,e):u(t,HTMLIFrameElement)?at(t):t.cloneNode(!1)}const ut=t=>t.tagName!=null&&t.tagName.toUpperCase()==="SLOT";async function ht(t,e,r){var n,i;let s=[];return ut(t)&&t.assignedNodes?s=g(t.assignedNodes()):u(t,HTMLIFrameElement)&&(!((n=t.contentDocument)===null||n===void 0)&&n.body)?s=g(t.contentDocument.body.childNodes):s=g(((i=t.shadowRoot)!==null&&i!==void 0?i:t).childNodes),s.length===0||u(t,HTMLVideoElement)||await s.reduce((o,c)=>o.then(()=>w(c,r)).then(a=>{a&&e.appendChild(a)}),Promise.resolve()),e}function ft(t,e){const r=e.style;if(!r)return;const n=window.getComputedStyle(t);n.cssText?(r.cssText=n.cssText,r.transformOrigin=n.transformOrigin):g(n).forEach(i=>{let s=n.getPropertyValue(i);i==="font-size"&&s.endsWith("px")&&(s=`${Math.floor(parseFloat(s.substring(0,s.length-2)))-.1}px`),u(t,HTMLIFrameElement)&&i==="display"&&s==="inline"&&(s="block"),i==="d"&&e.getAttribute("d")&&(s=`path(${e.getAttribute("d")})`),r.setProperty(i,s,n.getPropertyPriority(i))})}function gt(t,e){u(t,HTMLTextAreaElement)&&(e.innerHTML=t.value),u(t,HTMLInputElement)&&e.setAttribute("value",t.value)}function dt(t,e){if(u(t,HTMLSelectElement)){const r=e,n=Array.from(r.children).find(i=>t.value===i.getAttribute("value"));n&&n.setAttribute("selected","")}}function mt(t,e){return u(e,Element)&&(ft(t,e),et(t,e),gt(t,e),dt(t,e)),e}async function pt(t,e){const r=t.querySelectorAll?t.querySelectorAll("use"):[];if(r.length===0)return t;const n={};for(let s=0;s<r.length;s++){const c=r[s].getAttribute("xlink:href");if(c){const a=t.querySelector(c),l=document.querySelector(c);!a&&l&&!n[c]&&(n[c]=await w(l,e,!0))}}const i=Object.values(n);if(i.length){const s="http://www.w3.org/1999/xhtml",o=document.createElementNS(s,"svg");o.setAttribute("xmlns",s),o.style.position="absolute",o.style.width="0",o.style.height="0",o.style.overflow="hidden",o.style.display="none";const c=document.createElementNS(s,"defs");o.appendChild(c);for(let a=0;a<i.length;a++)c.appendChild(i[a]);t.appendChild(o)}return t}async function w(t,e,r){return!r&&e.filter&&!e.filter(t)?null:Promise.resolve(t).then(n=>lt(n,e)).then(n=>ht(t,n,e)).then(n=>mt(t,n)).then(n=>pt(n,e))}const F=/url\((['"]?)([^'"]+?)\1\)/g,yt=/url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g,wt=/src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;function bt(t){const e=t.replace(/([.*+?^${}()|\[\]\/\\])/g,"\\$1");return new RegExp(`(url\\(['"]?)(${e})(['"]?\\))`,"g")}function xt(t){const e=[];return t.replace(F,(r,n,i)=>(e.push(i),r)),e.filter(r=>!E(r))}async function St(t,e,r,n,i){try{const s=r?q(e,r):e,o=R(e);let c;if(i){const a=await i(s);c=O(a,o)}else c=await C(s,o,n);return t.replace(bt(e),`$1${c}$3`)}catch{}return t}function Et(t,{preferredFontFormat:e}){return e?t.replace(wt,r=>{for(;;){const[n,,i]=yt.exec(r)||[];if(!i)return"";if(i===e)return`src: ${n};`}}):t}function H(t){return t.search(F)!==-1}async function j(t,e,r){if(!H(t))return t;const n=Et(t,r);return xt(n).reduce((s,o)=>s.then(c=>St(c,o,e,r)),Promise.resolve(n))}async function m(t,e,r){var n;const i=(n=e.style)===null||n===void 0?void 0:n.getPropertyValue(t);if(i){const s=await j(i,null,r);return e.style.setProperty(t,s,e.style.getPropertyPriority(t)),!0}return!1}async function Rt(t,e){await m("background",t,e)||await m("background-image",t,e),await m("mask",t,e)||await m("mask-image",t,e)}async function Ct(t,e){const r=u(t,HTMLImageElement);if(!(r&&!E(t.src))&&!(u(t,SVGImageElement)&&!E(t.href.baseVal)))return;const n=r?t.src:t.href.baseVal,i=await C(n,R(n),e);await new Promise((s,o)=>{t.onload=s,t.onerror=o;const c=t;c.decode&&(c.decode=s),c.loading==="lazy"&&(c.loading="eager"),r?(t.srcset="",t.src=i):t.href.baseVal=i})}async function Lt(t,e){const n=g(t.childNodes).map(i=>W(i,e));await Promise.all(n).then(()=>t)}async function W(t,e){u(t,Element)&&(await Rt(t,e),await Ct(t,e),await Lt(t,e))}function vt(t,e){const{style:r}=t;e.backgroundColor&&(r.backgroundColor=e.backgroundColor),e.width&&(r.width=`${e.width}px`),e.height&&(r.height=`${e.height}px`);const n=e.style;return n!=null&&Object.keys(n).forEach(i=>{r[i]=n[i]}),t}const P={};async function $(t){let e=P[t];if(e!=null)return e;const n=await(await fetch(t)).text();return e={url:t,cssText:n},P[t]=e,e}async function I(t,e){let r=t.cssText;const n=/url\(["']?([^"')]+)["']?\)/g,s=(r.match(/url\([^)]+\)/g)||[]).map(async o=>{let c=o.replace(n,"$1");return c.startsWith("https://")||(c=new URL(c,t.url).href),U(c,e.fetchRequestInit,({result:a})=>(r=r.replace(o,`url(${a})`),[o,a]))});return Promise.all(s).then(()=>r)}function A(t){if(t==null)return[];const e=[],r=/(\/\*[\s\S]*?\*\/)/gi;let n=t.replace(r,"");const i=new RegExp("((@.*?keyframes [\\s\\S]*?){([\\s\\S]*?}\\s*?)})","gi");for(;;){const a=i.exec(n);if(a===null)break;e.push(a[0])}n=n.replace(i,"");const s=/@import[\s\S]*?url\([^)]*\)[\s\S]*?;/gi,o="((\\s*?(?:\\/\\*[\\s\\S]*?\\*\\/)?\\s*?@media[\\s\\S]*?){([\\s\\S]*?)}\\s*?})|(([\\s\\S]*?){([\\s\\S]*?)})",c=new RegExp(o,"gi");for(;;){let a=s.exec(n);if(a===null){if(a=c.exec(n),a===null)break;s.lastIndex=c.lastIndex}else c.lastIndex=s.lastIndex;e.push(a[0])}return e}async function Mt(t,e){const r=[],n=[];return t.forEach(i=>{if("cssRules"in i)try{g(i.cssRules||[]).forEach((s,o)=>{if(s.type===CSSRule.IMPORT_RULE){let c=o+1;const a=s.href,l=$(a).then(f=>I(f,e)).then(f=>A(f).forEach(d=>{try{i.insertRule(d,d.startsWith("@import")?c+=1:i.cssRules.length)}catch(b){console.error("Error inserting rule from remote css",{rule:d,error:b})}})).catch(f=>{console.error("Error loading remote css",f.toString())});n.push(l)}})}catch(s){const o=t.find(c=>c.href==null)||document.styleSheets[0];i.href!=null&&n.push($(i.href).then(c=>I(c,e)).then(c=>A(c).forEach(a=>{o.insertRule(a,i.cssRules.length)})).catch(c=>{console.error("Error loading remote stylesheet",c)})),console.error("Error inlining remote css file",s)}}),Promise.all(n).then(()=>(t.forEach(i=>{if("cssRules"in i)try{g(i.cssRules||[]).forEach(s=>{r.push(s)})}catch(s){console.error(`Error while reading CSS rules from ${i.href}`,s)}}),r))}function Tt(t){return t.filter(e=>e.type===CSSRule.FONT_FACE_RULE).filter(e=>H(e.style.getPropertyValue("src")))}async function Pt(t,e){if(t.ownerDocument==null)throw new Error("Provided element is not within a Document");const r=g(t.ownerDocument.styleSheets),n=await Mt(r,e);return Tt(n)}async function $t(t,e){const r=await Pt(t,e);return(await Promise.all(r.map(i=>{const s=i.parentStyleSheet?i.parentStyleSheet.href:null;return j(i.cssText,s,e)}))).join(`
|
|
`)}async function It(t,e){const r=e.fontEmbedCSS!=null?e.fontEmbedCSS:e.skipFonts?null:await $t(t,e);if(r){const n=document.createElement("style"),i=document.createTextNode(r);n.appendChild(i),t.firstChild?t.insertBefore(n,t.firstChild):t.appendChild(n)}}async function At(t,e={}){const{width:r,height:n}=D(t,e),i=await w(t,e,!0);return await It(i,e),await W(i,e),vt(i,e),await Q(i,r,n)}async function Bt(t,e={}){const{width:r,height:n}=D(t,e),i=await At(t,e),s=await y(i),o=document.createElement("canvas"),c=o.getContext("2d"),a=e.pixelRatio||X(),l=e.canvasWidth||r,f=e.canvasHeight||n;return o.width=l*a,o.height=f*a,e.skipAutoScale||Z(o),o.style.width=`${l}`,o.style.height=`${f}`,e.backgroundColor&&(c.fillStyle=e.backgroundColor,c.fillRect(0,0,o.width,o.height)),c.drawImage(s,0,0,o.width,o.height),o}async function kt(t,e={}){return(await Bt(t,e)).toDataURL()}function Ht(){const t=[],e="0123456789abcdef";for(let n=0;n<36;n++)t[n]=e.substr(Math.floor(Math.random()*16),1);return t[14]="4",t[19]=e.substr(t[19]&3|8,1),t[8]=t[13]=t[18]=t[23]="-",t.join("")}function jt(t){const e=document.querySelector(t);return kt(e).then(r=>r).catch(r=>{console.error("oops, something went wrong!",r)})}function Wt(t,e,r,n){let i=`<svg xmlns="http://www.w3.org/2000/svg" width="${r}" height="${n}">`;i+="<g>";const s=document.createElement("div"),o=document.createElement("image");o.setAttribute("width","100%"),o.setAttribute("height","100%"),o.setAttribute("href",e),s.appendChild(o),i+=s.innerHTML,i+="</g>";const a=document.querySelector(".lf-canvas-overlay g").cloneNode(!0);a.setAttribute("transform","");const l=document.createElement("div");return l.appendChild(a),i+=l.innerHTML,i+="</svg>",i}function B(t,e){const r=new MouseEvent("click",{view:window,bubbles:!1,cancelable:!0}),n=document.createElement("a");n.setAttribute("download",e),n.setAttribute("href",t),n.setAttribute("target","_blank"),n.dispatchEvent(r)}const Vt=(t="",e,r,n,i,s)=>{const o=document.createElement("canvas");o.width=n*2,o.height=i*2;const c=o.getContext("2d");r&&(c.fillStyle=r,c.fillRect(0,0,o.width,o.height));const a=document.createElement("img");if(a.width=n,a.height=i,e)a.src=e,a.setAttribute("crossOrigin","Anonymous"),a.onload=function(){c.drawImage(a,0,0,n*2,i*2);const l=document.createElement("img");l.width=n,l.height=i,l.src=t,l.setAttribute("crossOrigin","Anonymous"),l.onload=function(){c.drawImage(l,0,0,n*2,i*2),B(o.toDataURL(),s),L.success("下载成功!")}};else{const l=document.createElement("img");l.width=n,l.height=i,l.src=t,l.onload=function(){c.drawImage(l,0,0,n*2,i*2),B(o.toDataURL(),s),L.success("下载成功!")}}},_t=(t,e)=>{const r=new Blob([t],{type:"application/json;charset=utf-8"}),n=URL.createObjectURL(r),i=document.createElement("a");i.style.display="none",i.download=e,i.href=n,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(n)},qt=(t,e)=>{const r=new Blob([t],{type:"application/svg+xml;charset=utf-8"}),n=URL.createObjectURL(r),i=document.createElement("a");i.style.display="none",i.download=e,i.href=n,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(n)},zt=t=>{if(typeof t=="string")try{const e=JSON.parse(t);return!!(typeof e=="object"&&e)}catch{return!1}return!1};function V(t){const e=t.x,r=t.x+t.width||t.properties.width,n=t.y,i=t.y+t.height||t.properties.height;return{boundingBoxLeft:e,boundingBoxRight:r,boundingBoxTop:n,boundingBoxBottom:i}}function Gt(t,e){const r=t.x,n=t.x+t.width,i=t.y,s=t.y+t.height,{boundingBoxLeft:o,boundingBoxRight:c,boundingBoxBottom:a,boundingBoxTop:l}=V(e);return!(n<o||r>c||i>a||s<l)}function Dt(t,e){const r=t.x,n=t.x+t.width,i=t.y,s=t.y+t.height,{boundingBoxLeft:o,boundingBoxRight:c,boundingBoxBottom:a,boundingBoxTop:l}=V(e);return r>=o&&r<c&&n<=c&&n>o&&i>=l&&i<a&&s<=a&&s>l}function k(t){if(!t)return;let e={x:0,y:0},r={x:0,y:0};t.modelType==="line-edge"?(e=t.startPoint,r=t.endPoint):(e=t.pointsList[0],r=t.pointsList[t.pointsList.length-1]);const n=Math.abs(r.x-e.x),i=Math.abs(r.y-e.y);return{x:e.x<r.x?e.x:r.x,y:e.y<r.y?e.y:r.y,width:n,height:i}}function Ot(t){const{nodes:e,edges:r}=t;let n=e[0],i=k(r[0]);if(e.length>0&&e.forEach((s,o)=>{if(s.type==="helper-circle-point")return;const c=s.properties.width*s.properties.height,a=n.properties.width*n.properties.height;c>a&&(n=s)}),n){const s=n.width||n.properties.width,o=n.height||n.properties.height;n={x:n.x-s/2,y:n.y-o/2,width:s,height:o}}if(r.length>0&&r.forEach((s,o)=>{const c=k(s);if(c){const{width:a,height:l}=c,f=a*l;if(i){const{width:d,height:b}=i,_=d*b;f>_&&(i=s)}}}),n&&!i)return n;if(!n&&i)return i;if(n&&i)return n.width*n.height>i.width*i.height?n:i}function Jt(t,e){const r=Math.max(...t.map(s=>s.zIndex)),n=Math.max(...e.map(s=>s.zIndex));return Math.max(r,n)}const Xt=(t,e)=>{const r=[],n=[],i=[],s=[];t.forEach(c=>{const a=e.getModelById(c);r.push(a.x),n.push(a.y),i.push(a.x+a.width),s.push(a.y+a.height)});const o={left:Math.min(...r),top:Math.min(...n),right:Math.max(...i),bottom:Math.max(...s)};return{minWidth:o.right-o.left,minHeight:o.bottom-o.top}},Zt=(t,e)=>{const r=[],n=Ot(e);if(n)return t.graphModel.nodes.forEach(i=>{if(i.type==="helper-circle-point")return;const s={x:i.x-i.width/2,y:i.y-i.height/2,width:i.width,height:i.height};Dt(s,n)&&r.push(i)}),r},S=t=>{const e=Object.prototype.toString.call(t);return e==="[object Object]"||e==="[object Array]"},Ut=(t,e)=>{if(S(t)&&S(e))for(const r in e)S(e[r])&&t[r]?Ut(t[r],e[r]):t[r]=e[r]};function Kt({extraHeight:t,id:e}){typeof t>"u"&&(t=74);let r=null;e?r=document.getElementById(e)?document.getElementById(e).getElementsByClassName("ant-table-thead")[0]:null:r=document.getElementsByClassName("ant-table-thead")[0];let n=0;return r&&(n=r.getBoundingClientRect().bottom),`calc(100vh - ${n+t}px)`}export{k as a,Gt as b,Zt as c,Ut as d,jt as e,Vt as f,Kt as g,Wt as h,zt as i,qt as j,Ot as k,Xt as l,Jt as m,Dt as n,_t as s,Ht as u};
|