mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-07-21 15:55:36 +08:00
62 lines
9.7 KiB
JavaScript
62 lines
9.7 KiB
JavaScript
|
|
import{m as e}from"./src.OgxTg4hg.js";import{n as t}from"./mermaid-parser.core.N9eEiD5y.js";import{n}from"./chunk-Y2CYZVJY.DsF7k-Jl.js";import{D as r,H as i,K as a,U as o,a as s,b as c,c as l,f as u,v as d,w as f,y as p}from"./chunk-WYO6CB5R.Bq018eTN.js";import{i as m}from"./chunk-ICXQ74PX.CHLqHIum.js";import{t as h}from"./chunk-VAUOI2AC.B8koBSma.js";import{t as g}from"./chunk-JWPE2WC7.A3RzWITa.js";var _=n(()=>({domains:new Map,transitions:[]}),`createDefaultData`),v=_(),y={getDomains:n(()=>v.domains,`getDomains`),getTransitions:n(()=>v.transitions,`getTransitions`),setDomains:n(e=>{if(e)for(let t of e){let e=t.domain,n=(t.items??[]).map(e=>({label:e.label}));v.domains.set(e,{name:e,items:n})}},`setDomains`),setTransitions:n(t=>{t&&(v.transitions=t.filter(t=>t.from===t.to?(e.warn(`Cynefin: self-loop transition on domain "${t.from}" is not meaningful and will be skipped.`),!1):!0).map(e=>({from:e.from,to:e.to,label:e.label||void 0})))},`setTransitions`),getConfig:n(()=>m({...u.cynefin,...c().cynefin}),`getConfig`),clear:n(()=>{s(),v=_()},`clear`),setAccTitle:o,getAccTitle:p,setDiagramTitle:a,getDiagramTitle:f,getAccDescription:d,setAccDescription:i},b=n(e=>{g(e,y),y.setDomains(e.domains),y.setTransitions(e.transitions)},`populate`),x={parse:n(async n=>{let r=await t(`cynefin`,n);e.debug(r),b(r)},`parse`)};function S(e){let t=e+1831565813|0;return t=Math.imul(t^t>>>15,t|1),t^=t+Math.imul(t^t>>>7,t|61),((t^t>>>14)>>>0)/4294967296}n(S,`seededRandom`);function C(e){let t=0;for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);t=(t<<5)-t+r,t|=0}return t}n(C,`hashString`);function w(e,t){return typeof e==`number`&&Number.isFinite(e)&&e!==0?e:C(t)}n(w,`resolveSeed`);function T(e,t,n,r){let i=e/2,a=r??e*.015,o=t/7,s=[];for(let e=0;e<=7;e++){let t=S(n+e*17)*a*2-a;s.push({x:i+t,y:e*o})}let c=`M${s[0].x},${s[0].y}`;for(let e=0;e<s.length-1;e++){let t=s[e],r=s[e+1],i=(t.y+r.y)/2,o=e%2==0?1:-1,l=a*1.5*o*S(n+e*31+7),u=t.x+l,d=i,f=r.x-l;c+=` C${u},${d} ${f},${i} ${r.x},${r.y}`}return c}n(T,`generateFoldPath`);function E(e,t,n,r){let i=t/2,a=r??t*.015,o=e/7,s=[];for(let e=0;e<=7;e++){let t=S(n+e*23)*a*2-a;s.push({x:e*o,y:i+t})}let c=`M${s[0].x},${s[0].y}`;for(let e=0;e<s.length-1;e++){let t=s[e],r=s[e+1],i=(t.x+r.x)/2,o=e%2==0?1:-1,l=a*1.5*o*S(n+e*37+11),u=i,d=t.y+l,f=i,p=r.y-l;c+=` C${u},${d} ${f},${p} ${r.x},${r.y}`}return c}n(E,`generateHorizontalBoundary`);function D(e,t){let n=e/2,r=t*.5,i=t,a=e*.03;return[`M${n},${r}`,`C${n+a},${r+(i-r)*.2}`,`${n-a*1.5},${r+(i-r)*.55}`,`${n+a*.5},${r+(i-r)*.75}`,`C${n-a},${r+(i-r)*.85}`,`${n+a*.3},${r+(i-r)*.95}`,`${n},${i}`].join(` `)}n(D,`generateCliffPath`);function O(e,t,n,r){return[`M${e-n},${t}`,`A${n},${r} 0 1,1 ${e+n},${t}`,`A${n},${r} 0 1,1 ${e-n},${t}`,`Z`].join(` `)}n(O,`generateConfusionPath`);var k={complex:{model:`Probe → Sense → Respond`,practice:`Emergent Practices`},complicated:{model:`Sense → Analyse → Respond`,practice:`Good Practices`},clear:{model:`Sense → Categorise → Respond`,practice:`Best Practices`},chaotic:{model:`Act → Sense → Respond`,practice:`Novel Practices`},confusion:{model:``,practice:`Disorder`}},A=n((e,t)=>{let n=e/2,r=t/2;return{complex:{cx:n/2,cy:r/2,x:0,y:0,w:n,h:r},complicated:{cx:n+n/2,cy:r/2,x:n,y:0,w:n,h:r},chaotic:{cx:n/2,cy:r+r/2,x:0,y:r,w:n,h:r},clear:{cx:n+n/2,cy:r+r/2,x:n,y:r,w:n,h:r},confusion:{cx:n,cy:r,x:n*.7,y:r*.7,w:n*.6,h:r*.6}}},`getDomainLayouts`),j=n(()=>m(r(),c().themeVariables).cynefin,`getCynefinDomainColors`),M=3,N={draw:n((t,n,r,i)=>{let a=i.db,o=a.getDomains(),s=a.getTransitions(),c=a.getDiagramTitle(),u=a.getAccTitle(),d=a.getAccDescription(),f=a.getConfig(),p=j();e.debug(`Rendering Cynefin diagram`);let m=f.width,g=f.height,_=f.padding,v=f.showDomainDescriptions,y=f.boundaryAmplitude,b=m+_*2,x=g+_*2,S={complex:p.complexBg,complicated:p.complicatedBg,clear:p.clearBg,chaotic:p.chaoticBg,confusion:p.confusionBg},C=h(n);l(C,x,b,f.useMaxWidth??!0),C.attr(`viewBox`,`0 0 ${b} ${x}`),u&&C.append(`title`).text(u),d&&C.append(`desc`).text(d);let N=C.append(`g`).attr(`transform`,`translate(${_}, ${_})`),P=A(m,g),F=w(f.seed,n),I=N.a
|
||
|
|
.cynefinDomain {
|
||
|
|
stroke: none;
|
||
|
|
}
|
||
|
|
.cynefinDomainLabel {
|
||
|
|
font-size: ${e.domainFontSize}px;
|
||
|
|
font-weight: bold;
|
||
|
|
fill: ${e.labelColor};
|
||
|
|
}
|
||
|
|
.cynefinSubtitle {
|
||
|
|
font-size: ${e.itemFontSize-1}px;
|
||
|
|
fill: ${e.textColor};
|
||
|
|
font-style: italic;
|
||
|
|
}
|
||
|
|
.cynefinItem {
|
||
|
|
fill-opacity: 0.95;
|
||
|
|
stroke: ${e.boundaryColor};
|
||
|
|
stroke-width: 1;
|
||
|
|
}
|
||
|
|
.cynefinItemText {
|
||
|
|
font-size: ${e.itemFontSize}px;
|
||
|
|
fill: ${e.textColor};
|
||
|
|
}
|
||
|
|
.cynefinItemOverflow {
|
||
|
|
fill-opacity: 0.6;
|
||
|
|
stroke: ${e.boundaryColor};
|
||
|
|
stroke-width: 1;
|
||
|
|
stroke-dasharray: 3 2;
|
||
|
|
}
|
||
|
|
.cynefinBoundary {
|
||
|
|
stroke: ${e.boundaryColor};
|
||
|
|
stroke-width: ${e.boundaryWidth};
|
||
|
|
stroke-dasharray: 6 3;
|
||
|
|
}
|
||
|
|
.cynefinCliff {
|
||
|
|
stroke: ${e.cliffColor};
|
||
|
|
stroke-width: ${e.cliffWidth};
|
||
|
|
}
|
||
|
|
.cynefinConfusion {
|
||
|
|
stroke: ${e.boundaryColor};
|
||
|
|
stroke-width: 1.5;
|
||
|
|
stroke-dasharray: 4 2;
|
||
|
|
}
|
||
|
|
.cynefinArrowLine {
|
||
|
|
stroke: ${e.arrowColor};
|
||
|
|
stroke-width: ${e.arrowWidth};
|
||
|
|
fill: none;
|
||
|
|
}
|
||
|
|
.cynefinArrowHead {
|
||
|
|
fill: ${e.arrowColor};
|
||
|
|
stroke: none;
|
||
|
|
}
|
||
|
|
.cynefinArrowLabel {
|
||
|
|
font-size: ${e.itemFontSize-1}px;
|
||
|
|
fill: ${e.textColor};
|
||
|
|
}
|
||
|
|
.cynefinTitle {
|
||
|
|
font-size: ${e.domainFontSize+2}px;
|
||
|
|
font-weight: bold;
|
||
|
|
fill: ${e.labelColor};
|
||
|
|
}
|
||
|
|
`},`styles`)};export{F as diagram};
|