think/packages/client/public/diagram.min.js

4 lines
1.7 MiB
TypeScript
Raw Permalink Normal View History

window.urlParams=window.urlParams||{},window.MAX_REQUEST_SIZE=window.MAX_REQUEST_SIZE||10485760,window.MAX_AREA=window.MAX_AREA||225e6,window.mxBasePath="/diagram",window.RESOURCES_PATH="/diagram/resources",window.STENCIL_PATH="/diagram/stencils",window.IMAGE_PATH="/diagram/images",window.STYLE_PATH="/diagram/styles",window.CSS_PATH="/diagram/styles";var HoverIcons=function(){},mxCellEditorGetInitialValue=function(){},mxCellEditorGetCurrentValue=function(){},mxGraphHandlerIsValidDropTarget=function(){},Format=function(){},BaseFormatPanel=function(){},ArrangePanel=function(){},TextFormatPanel=function(){},StyleFormatPanel=function(){},DiagramStylePanel=function(){},DiagramFormatPanel=function(){},Menus=function(){},mxJSColor={dir:"",bindClass:"color",binding:!0,preloading:!0,install:function(){},init:function(){mxJSColor.preloading&&mxJSColor.preload()},getDir:function(){var t;return mxJSColor.dir||(t=mxJSColor.detectDir(),mxJSColor.dir=!1!==t?t:"jscolor/"),mxJSColor.dir},detectDir:function(){for(var t=location.href,e=document.getElementsByTagName("base"),n=0;n<e.length;n+=1)e[n].href&&(t=e[n].href);for(e=document.getElementsByTagName("script"),n=0;n<e.length;n+=1)if(e[n].src&&/(^|\/)jscolor\.js([?#].*)?$/i.test(e[n].src)){var i=new mxJSColor.URI(e[n].src).toAbsolute(t);return i.path=i.path.replace(/[^\/]+$/,""),i.query=null,i.fragment=null,i.toString()}return!1},preload:function(){for(var t in mxJSColor.imgRequire)mxJSColor.imgRequire.hasOwnProperty(t)&&mxJSColor.loadImage(t)},images:{pad:[181,101],sld:[16,101],cross:[15,15],arrow:[7,11]},imgRequire:{},imgLoaded:{},requireImage:function(t){mxJSColor.imgRequire[t]=!0},loadImage:function(t){mxJSColor.imgLoaded[t]||(mxJSColor.imgLoaded[t]=new Image,mxJSColor.imgLoaded[t].src=mxJSColor.getDir()+t)},fetchElement:function(t){return"string"==typeof t?document.getElementById(t):t},addEvent:function(t,e,n){t.addEventListener?t.addEventListener(e,n,!1):t.attachEvent&&t.attachEvent("on"+e,n)},fireEvent:function(t,e){var n;t&&(document.createEvent?((n=document.createEvent("HTMLEvents")).initEvent(e,!0,!0),t.dispatchEvent(n)):document.createEventObject?(n=document.createEventObject(),t.fireEvent("on"+e,n)):t["on"+e]&&t["on"+e]())},getElementPos:function(t){var e=t,n=t,i=0,l=0;if(e.offsetParent)for(;i+=e.offsetLeft,l+=e.offsetTop,e=e.offsetParent;);for(;(n=n.parentNode)&&"BODY"!==n.nodeName.toUpperCase();)i-=n.scrollLeft,l-=n.scrollTop;return[i,l]},getElementSize:function(t){return[t.offsetWidth,t.offsetHeight]},getRelMousePos:function(t){var e=0,n=0;return"number"==typeof(t=t||window.event).offsetX?(e=t.offsetX,n=t.offsetY):"number"==typeof t.layerX&&(e=t.layerX,n=t.layerY),{x:e,y:n}},getViewPos:function(){return"number"==typeof window.pageYOffset?[window.pageXOffset,window.pageYOffset]:document.body&&(document.body.scrollLeft||document.body.scrollTop)?[document.body.scrollLeft,document.body.scrollTop]:document.documentElement&&(document.documentElement.scrollLeft||document.documentElement.scrollTop)?[document.documentElement.scrollLeft,document.documentElement.scrollTop]:[0,0]},getViewSize:function(){return"number"==typeof window.innerWidth?[window.innerWidth,window.innerHeight]:document.body&&(document.body.clientWidth||document.body.clientHeight)?[document.body.clientWidth,document.body.clientHeight]:document.documentElement&&(document.documentElement.clientWidth||document.documentElement.clientHeight)?[document.documentElement.clientWidth,document.documentElement.clientHeight]:[0,0]},URI:function(t){function i(t){for(var e,n="";t;)"../"===t.substr(0,3)||"./"===t.substr(0,2)?t=t.replace(/^\.+/,"").substr(1):"/./"===t.substr(0,3)||"/."===t?t="/"+t.substr(3):"/../"===t.substr(0,4)||"/.."===t?(t="/"+t.substr(4),n=n.replace(/\/?[^\/]*$/,"")):"."===t||".."===t?t="":(e=t.match(/^\/?[^\/]*/)[0],t=t.substr(e.length),n+=e);return n}this.scheme=null,this.authority=null,this.path="",this.query=null,this.fragment=null,this.parse=function(t){t=t.match(/^(([A-Za-z][0-9A-Za-z+.-]*)(:))?((\/\/)([^\/?#]*))?([^?#]*)((\?)([^#]*))?((#)(.*))?/);return this.scheme=t[3]?t[2]:null,this.authority=t[5]?t[
2022-06-02 16:41:24 +00:00
(function(e){"function"==typeof define&&define.amd?define(e):e()})(function(){"use strict";var e=Math.atan,t=Math.ceil,s=Math.floor,a=Math.round,l=Math.abs,i=Math.min,n=Math.max,u=Math.sqrt,r=Math.pow,d=Math.sin,g=Math.cos,f=Math.PI;function c(e,t,s){if(e&&e.length){const[a,l]=t,h=f/180*s,o=g(h),i=d(h);e.forEach(e=>{const[t,s]=e;e[0]=(t-a)*o-(s-l)*i+a,e[1]=(t-a)*i+(s-l)*o+l})}}function y(e,t,s){const a=[];e.forEach(e=>a.push(...e)),c(a,t,s)}function k(e){const t=e[0],s=e[1];return u(r(t[0]-s[0],2)+r(t[1]-s[1],2))}function m(e,t){const s=t.hachureAngle+90;let a=t.hachureGap;0>a&&(a=4*t.strokeWidth),a=n(a,.1);const l=[0,0];if(s)for(const t of e)c(t,l,s);const h=S(e,a);if(s){for(const t of e)c(t,l,-s);y(h,l,-s)}return h}function S(e,t){const s=[];for(const a of e){const e=[...a];e[0].join(",")!==e[e.length-1].join(",")&&e.push([e[0][0],e[0][1]]),2<e.length&&s.push(e)}const h=[];t=n(t,.1);const o=[];for(const a of s)for(let e=0;e<a.length-1;e++){const t=a[e],s=a[e+1];if(t[1]!==s[1]){const e=i(t[1],s[1]);o.push({ymin:e,ymax:n(t[1],s[1]),x:e===t[1]?t[0]:s[0],islope:(s[0]-t[0])/(s[1]-t[1])})}}if(o.sort((e,t)=>e.ymin<t.ymin?-1:e.ymin>t.ymin?1:e.x<t.x?-1:e.x>t.x?1:e.ymax===t.ymax?0:(e.ymax-t.ymax)/l(e.ymax-t.ymax)),!o.length)return h;let p=[],u=o[0].ymin;for(;p.length||o.length;){if(o.length){let e=-1;for(let t=0;t<o.length&&!(o[t].ymin>u);t++)e=t;const t=o.splice(0,e+1);t.forEach(e=>{p.push({s:u,edge:e})})}if(p=p.filter(e=>!(e.edge.ymax<=u)),p.sort((e,t)=>e.edge.x===t.edge.x?0:(e.edge.x-t.edge.x)/l(e.edge.x-t.edge.x)),1<p.length)for(let e=0;e<p.length;e+=2){const t=e+1;if(t>=p.length)break;const s=p[e].edge,l=p[t].edge;h.push([[a(s.x),u],[a(l.x),u]])}u+=t,p.forEach(e=>{e.edge.x+=t*e.edge.islope})}return h}function T(e,t){let s=e.fillStyle||"hachure";if(!Oe[s])switch(s){case"zigzag":Oe[s]||(Oe[s]=new me(t));break;case"cross-hatch":Oe[s]||(Oe[s]=new Se(t));break;case"dots":Oe[s]||(Oe[s]=new Te(t));break;case"dashed":Oe[s]||(Oe[s]=new xe(t));break;case"zigzag-line":Oe[s]||(Oe[s]=new ve(t));break;case"hachure":default:s="hachure",Oe[s]||(Oe[s]=new ke(t));}return Oe[s]}function x(){return s(Math.random()*2147483648)}function v(e){const t=[];for(;""!==e;)if(e.match(/^([ \t\r\n,]+)/))e=e.substr(RegExp.$1.length);else if(e.match(/^([aAcChHlLmMqQsStTvVzZ])/))t[t.length]={type:_e,text:RegExp.$1},e=e.substr(RegExp.$1.length);else if(e.match(/^(([-+]?[0-9]+(\.[0-9]*)?|[-+]?\.[0-9]+)([eE][-+]?[0-9]+)?)/))t[t.length]={type:Ce,text:`${parseFloat(RegExp.$1)}`},e=e.substr(RegExp.$1.length);else return[];return t[t.length]={type:Ee,text:""},t}function O(e,t){return e.type===t}function b(e){const t=[],s=v(e);let a="BOD",l=0,h=s[l];for(;!O(h,Ee);){let o=0;const p=[];if(!("BOD"===a))O(h,Ce)?o=Ve[a]:(l++,o=Ve[h.text],a=h.text);else if("M"===h.text||"m"===h.text)l++,o=Ve[h.text],a=h.text;else return b("M0,0"+e);if(l+o<s.length){for(let e=l;e<l+o;e++){const t=s[e];if(O(t,Ce))p[p.length]=+t.text;else throw new Error("Param not a number: "+a+","+t.text)}if("number"==typeof Ve[a]){const e={key:a,data:p};t.push(e),l+=o,h=s[l],"M"===a&&(a="L"),"m"===a&&(a="l")}else throw new Error("Bad segment: "+a)}else throw new Error("Path data ended short")}return t}function _(e){let t=0,s=0,a=0,l=0;const h=[];for(const{key:o,data:i}of e)switch(o){case"M":h.push({key:"M",data:[...i]}),[t,s]=i,[a,l]=i;break;case"m":t+=i[0],s+=i[1],h.push({key:"M",data:[t,s]}),a=t,l=s;break;case"L":h.push({key:"L",data:[...i]}),[t,s]=i;break;case"l":t+=i[0],s+=i[1],h.push({key:"L",data:[t,s]});break;case"C":h.push({key:"C",data:[...i]}),t=i[4],s=i[5];break;case"c":{const e=i.map((e,a)=>a%2?e+s:e+t);h.push({key:"C",data:e}),t=e[4],s=e[5];break}case"Q":h.push({key:"Q",data:[...i]}),t=i[2],s=i[3];break;case"q":{const e=i.map((e,a)=>a%2?e+s:e+t);h.push({key:"Q",data:e}),t=e[2],s=e[3];break}case"A":h.push({key:"A",data:[...i]}),t=i[5],s=i[6];break;case"a":t+=i[5],s+=i[6],h.push({key:"A",data:[i[0],i[1],i[2],i[3],i[4],t,s]});break;case"H":h.push({key:"H",data:[...i]}),t=i[0];break;case"h":t+=i[0],h.push({key:"H",data:[t]});break;case"V":h.push({key:"V",data:[...i]}),s=i[0];break;case"v":s+=i[0