omni-context-cli 0.0.74 → 0.0.77
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.md +68 -112
- package/README.zh-CN.md +68 -112
- package/dist/agents/explore.md +26 -19
- package/dist/agents/glance.md +7 -22
- package/dist/agents/{slice.md → search.md} +4 -4
- package/dist/assets/cone-bw-white.svg +24 -7
- package/dist/assets/cone-bw.svg +24 -7
- package/dist/assets/cone-mac@256.png +0 -0
- package/dist/assets/cone-mac@512.png +0 -0
- package/dist/assets/cone.svg +24 -2
- package/dist/assets/cone@128.png +0 -0
- package/dist/assets/cone@16.png +0 -0
- package/dist/assets/cone@24.png +0 -0
- package/dist/assets/cone@256.png +0 -0
- package/dist/assets/cone@32.png +0 -0
- package/dist/assets/cone@512.png +0 -0
- package/dist/assets/cone@64.png +0 -0
- package/dist/assets/icon.ico +0 -0
- package/dist/assets/omnicontext-cli-logo-white.svg +24 -7
- package/dist/assets/omnicontext-cli-logo.svg +24 -7
- package/dist/cli.js +7 -7
- package/dist/clients/extension.vsix +0 -0
- package/dist/clients/web/assets/{_baseUniq-CH4b0N5_.js → _baseUniq-BbAI5D6T.js} +1 -1
- package/dist/clients/web/assets/{arc-BQVP7-Bp.js → arc-C01cHi_J.js} +1 -1
- package/dist/clients/web/assets/{architectureDiagram-VXUJARFQ-CZtE2OyB.js → architectureDiagram-VXUJARFQ-C4SW9geU.js} +1 -1
- package/dist/clients/web/assets/{blockDiagram-VD42YOAC-CtSz7Vx1.js → blockDiagram-VD42YOAC-BJBjUKKm.js} +1 -1
- package/dist/clients/web/assets/{c4Diagram-YG6GDRKO-CeUU0lHA.js → c4Diagram-YG6GDRKO-DRMS2exe.js} +1 -1
- package/dist/clients/web/assets/channel-BFxt5Aug.js +1 -0
- package/dist/clients/web/assets/{chunk-4BX2VUAB-Df-kQvTf.js → chunk-4BX2VUAB-DdM_Xgvz.js} +1 -1
- package/dist/clients/web/assets/{chunk-55IACEB6-DR-uhhX0.js → chunk-55IACEB6-sCGtW4jw.js} +1 -1
- package/dist/clients/web/assets/{chunk-B4BG7PRW-DOrSo5dD.js → chunk-B4BG7PRW-CrTfpFlk.js} +1 -1
- package/dist/clients/web/assets/{chunk-DI55MBZ5-BbUWe3KA.js → chunk-DI55MBZ5-BJxcEBin.js} +1 -1
- package/dist/clients/web/assets/{chunk-FMBD7UC4-BnLGK1jf.js → chunk-FMBD7UC4-ZCzWQMnr.js} +1 -1
- package/dist/clients/web/assets/{chunk-QN33PNHL-VCJVvyMp.js → chunk-QN33PNHL-7lsjOUTT.js} +1 -1
- package/dist/clients/web/assets/{chunk-QZHKN3VN-CPfXJo_T.js → chunk-QZHKN3VN-DM6taDix.js} +1 -1
- package/dist/clients/web/assets/{chunk-TZMSLE5B-BkHNVsyH.js → chunk-TZMSLE5B-Dc2DN3ii.js} +1 -1
- package/dist/clients/web/assets/classDiagram-2ON5EDUG-CMfvUA3j.js +1 -0
- package/dist/clients/web/assets/classDiagram-v2-WZHVMYZB-CMfvUA3j.js +1 -0
- package/dist/clients/web/assets/clone-BWI7Baa7.js +1 -0
- package/dist/clients/web/assets/{cose-bilkent-S5V4N54A-C9Wxnne5.js → cose-bilkent-S5V4N54A-r8T3f5yK.js} +1 -1
- package/dist/clients/web/assets/{dagre-6UL2VRFP-B6-ozXSh.js → dagre-6UL2VRFP-UnxnSeQH.js} +1 -1
- package/dist/clients/web/assets/{diagram-PSM6KHXK-D2TK1Mkk.js → diagram-PSM6KHXK-D2ENZ6qS.js} +1 -1
- package/dist/clients/web/assets/{diagram-QEK2KX5R-C5OGEwzB.js → diagram-QEK2KX5R-Eye3JgZm.js} +1 -1
- package/dist/clients/web/assets/{diagram-S2PKOQOG-CjdFw3eQ.js → diagram-S2PKOQOG-Blf5P9RJ.js} +1 -1
- package/dist/clients/web/assets/{erDiagram-Q2GNP2WA-hQIEDub-.js → erDiagram-Q2GNP2WA-wyIeLoVZ.js} +1 -1
- package/dist/clients/web/assets/{flowDiagram-NV44I4VS-WDuMquGw.js → flowDiagram-NV44I4VS-D99ef0t0.js} +1 -1
- package/dist/clients/web/assets/{ganttDiagram-JELNMOA3-BT_k8mao.js → ganttDiagram-JELNMOA3-CvsjeBuE.js} +1 -1
- package/dist/clients/web/assets/{gitGraphDiagram-NY62KEGX-Dq5JUR6E.js → gitGraphDiagram-NY62KEGX-B2ylogok.js} +1 -1
- package/dist/clients/web/assets/{graph-EhiCIhKK.js → graph-BEwCLq4h.js} +1 -1
- package/dist/clients/web/assets/index-30onxp6I.js +2 -0
- package/dist/clients/web/assets/index-pGSHhaP9.css +1 -0
- package/dist/clients/web/assets/{infoDiagram-WHAUD3N6-BrkLiOdx.js → infoDiagram-WHAUD3N6-C9HLlPj3.js} +1 -1
- package/dist/clients/web/assets/{journeyDiagram-XKPGCS4Q-2iAEjN27.js → journeyDiagram-XKPGCS4Q-BGMoCoGu.js} +1 -1
- package/dist/clients/web/assets/{kanban-definition-3W4ZIXB7-C222cIK8.js → kanban-definition-3W4ZIXB7-Z1B1b4dY.js} +1 -1
- package/dist/clients/web/assets/{layout-DDV6LJLJ.js → layout-KBr90mM8.js} +1 -1
- package/dist/clients/web/assets/{linear-Cj0itOnY.js → linear-VOTetRqU.js} +1 -1
- package/dist/clients/web/assets/{min-DB8NGWI2.js → min-BcFr1Xgw.js} +1 -1
- package/dist/clients/web/assets/{mindmap-definition-VGOIOE7T-CCAhA60J.js → mindmap-definition-VGOIOE7T-Bf9fJD2v.js} +1 -1
- package/dist/clients/web/assets/{pieDiagram-ADFJNKIX-D-XXo3zP.js → pieDiagram-ADFJNKIX-DITjn_1i.js} +1 -1
- package/dist/clients/web/assets/{quadrantDiagram-AYHSOK5B-5IBnb1WQ.js → quadrantDiagram-AYHSOK5B-CG8qEQsc.js} +1 -1
- package/dist/clients/web/assets/{requirementDiagram-UZGBJVZJ-4woYoyhj.js → requirementDiagram-UZGBJVZJ-_fiifEP6.js} +1 -1
- package/dist/clients/web/assets/{sankeyDiagram-TZEHDZUN-CQITNuFm.js → sankeyDiagram-TZEHDZUN-dGOtogtu.js} +1 -1
- package/dist/clients/web/assets/{sequenceDiagram-WL72ISMW-BIUgU_on.js → sequenceDiagram-WL72ISMW-BPWg-aZ3.js} +1 -1
- package/dist/clients/web/assets/{stateDiagram-FKZM4ZOC-C3Wi-EZk.js → stateDiagram-FKZM4ZOC-XlU9RkKz.js} +1 -1
- package/dist/clients/web/assets/stateDiagram-v2-4FDKWEC3-Rsaa7fF9.js +1 -0
- package/dist/clients/web/assets/{timeline-definition-IT6M3QCI-CwRxrax-.js → timeline-definition-IT6M3QCI-CQGxtqhi.js} +1 -1
- package/dist/clients/web/assets/{treemap-KMMF4GRG-i_IDwp2d.js → treemap-KMMF4GRG-Do7kW41s.js} +1 -1
- package/dist/clients/web/assets/{xychartDiagram-PRI3JC2R-BIS0b9I9.js → xychartDiagram-PRI3JC2R-C_QymW0P.js} +1 -1
- package/dist/clients/web/favicon.png +0 -0
- package/dist/clients/web/index.html +2 -2
- package/dist/skills/simplify/SKILL.md +53 -0
- package/dist/workflows/general.md +19 -0
- package/dist/workflows/programming.md +33 -0
- package/package.json +2 -3
- package/scripts/bump-version.mjs +0 -3
- package/scripts/clean.mjs +17 -0
- package/scripts/release-build.mjs +8 -129
- package/dist/agents/pluck.md +0 -49
- package/dist/agents/quest.md +0 -47
- package/dist/agents/ripple.md +0 -58
- package/dist/agents/sculpt.md +0 -63
- package/dist/agents/spark.md +0 -53
- package/dist/agents/sweep.md +0 -44
- package/dist/agents/weave.md +0 -54
- package/dist/clients/web/assets/channel-D-ssYovj.js +0 -1
- package/dist/clients/web/assets/classDiagram-2ON5EDUG-W6DMTXK_.js +0 -1
- package/dist/clients/web/assets/classDiagram-v2-WZHVMYZB-W6DMTXK_.js +0 -1
- package/dist/clients/web/assets/clone-Dn7sFHUy.js +0 -1
- package/dist/clients/web/assets/index-B5OdXvjH.js +0 -27
- package/dist/clients/web/assets/index-BP79FsyI.css +0 -1
- package/dist/clients/web/assets/stateDiagram-v2-4FDKWEC3-BudH3yEK.js +0 -1
- package/dist/slash/ping.md +0 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
var t,n,i;import{p as s,q as e,s as r,g as o,b as u,a as c,_ as h,c as f,z as a,d as l,V as d,y as p,k as v}from"./index-B5OdXvjH.js";import{o as g}from"./ordinal-2upbOM02.js";import"./init-C9Lo50Hz.js";const k=function(t){for(var n=t.length/6|0,i=new Array(n),s=0;s<n;)i[s]="#"+t.slice(6*s,6*++s);return i}("4e79a7f28e2ce1575976b7b259a14fedc949af7aa1ff9da79c755fbab0ab");function y(t,n){let i;if(void 0===n)for(const s of t)null!=s&&(i<s||void 0===i&&s>=s)&&(i=s);else{let s=-1;for(let e of t)null!=(e=n(e,++s,t))&&(i<e||void 0===i&&e>=e)&&(i=e)}return i}function w(t,n){let i;if(void 0===n)for(const s of t)null!=s&&(i>s||void 0===i&&s>=s)&&(i=s);else{let s=-1;for(let e of t)null!=(e=n(e,++s,t))&&(i>e||void 0===i&&e>=e)&&(i=e)}return i}function b(t,n){let i=0;if(void 0===n)for(let s of t)(s=+s)&&(i+=s);else{let s=-1;for(let e of t)(e=+n(e,++s,t))&&(i+=e)}return i}function m(t){return t.target.depth}function _(t,n){return t.sourceLinks.length?t.depth:n-1}function E(t){return function(){return t}}function x(t,n){return S(t.source,n.source)||t.index-n.index}function M(t,n){return S(t.target,n.target)||t.index-n.index}function S(t,n){return t.y0-n.y0}function A(t){return t.value}function L(t){return t.index}function T(t){return t.nodes}function N(t){return t.links}function I(t,n){const i=t.get(n);if(!i)throw new Error("missing: "+n);return i}function C({nodes:t}){for(const n of t){let t=n.y0,i=t;for(const s of n.sourceLinks)s.y0=t+s.width/2,t+=s.width;for(const s of n.targetLinks)s.y1=i+s.width/2,i+=s.width}}function O(){let t,n,i,s=0,e=0,r=1,o=1,u=24,c=8,h=L,f=_,a=T,l=N,d=6;function p(){const p={nodes:a.apply(null,arguments),links:l.apply(null,arguments)};return function({nodes:t,links:n}){for(const[i,e]of t.entries())e.index=i,e.sourceLinks=[],e.targetLinks=[];const s=new Map(t.map((n,i)=>[h(n,i,t),n]));for(const[i,e]of n.entries()){e.index=i;let{source:t,target:n}=e;"object"!=typeof t&&(t=e.source=I(s,t)),"object"!=typeof n&&(n=e.target=I(s,n)),t.sourceLinks.push(e),n.targetLinks.push(e)}if(null!=i)for(const{sourceLinks:e,targetLinks:r}of t)e.sort(i),r.sort(i)}(p),function({nodes:t}){for(const n of t)n.value=void 0===n.fixedValue?Math.max(b(n.sourceLinks,A),b(n.targetLinks,A)):n.fixedValue}(p),function({nodes:t}){const n=t.length;let i=new Set(t),s=new Set,e=0;for(;i.size;){for(const t of i){t.depth=e;for(const{target:n}of t.sourceLinks)s.add(n)}if(++e>n)throw new Error("circular link");i=s,s=new Set}}(p),function({nodes:t}){const n=t.length;let i=new Set(t),s=new Set,e=0;for(;i.size;){for(const t of i){t.height=e;for(const{source:n}of t.targetLinks)s.add(n)}if(++e>n)throw new Error("circular link");i=s,s=new Set}}(p),function(i){const h=function({nodes:t}){const i=y(t,t=>t.depth)+1,e=(r-s-u)/(i-1),o=new Array(i);for(const n of t){const t=Math.max(0,Math.min(i-1,Math.floor(f.call(null,n,i))));n.layer=t,n.x0=s+t*e,n.x1=n.x0+u,o[t]?o[t].push(n):o[t]=[n]}if(n)for(const s of o)s.sort(n);return o}(i);t=Math.min(c,(o-e)/(y(h,t=>t.length)-1)),function(n){const i=w(n,n=>(o-e-(n.length-1)*t)/b(n,A));for(const s of n){let n=e;for(const e of s){e.y0=n,e.y1=n+e.value*i,n=e.y1+t;for(const t of e.sourceLinks)t.width=t.value*i}n=(o-n+t)/(s.length+1);for(let t=0;t<s.length;++t){const i=s[t];i.y0+=n*(t+1),i.y1+=n*(t+1)}j(s)}}(h);for(let t=0;t<d;++t){const n=Math.pow(.99,t),i=Math.max(1-n,(t+1)/d);g(h,n,i),v(h,n,i)}}(p),C(p),p}function v(t,i,s){for(let e=1,r=t.length;e<r;++e){const r=t[e];for(const t of r){let n=0,s=0;for(const{source:i,value:r}of t.targetLinks){let e=r*(t.layer-i.layer);n+=P(i,t)*e,s+=e}if(!(s>0))continue;let e=(n/s-t.y0)*i;t.y0+=e,t.y1+=e,D(t)}void 0===n&&r.sort(S),k(r,s)}}function g(t,i,s){for(let e=t.length-2;e>=0;--e){const r=t[e];for(const t of r){let n=0,s=0;for(const{target:i,value:r}of t.sourceLinks){let e=r*(i.layer-t.layer);n+=$(t,i)*e,s+=e}if(!(s>0))continue;let e=(n/s-t.y0)*i;t.y0+=e,t.y1+=e,D(t)}void 0===n&&r.sort(S),k(r,s)}}function k(n,i){const s=n.length>>1,r=n[s];O(n,r.y0-t,s-1,i),m(n,r.y1+t,s+1,i),O(n,o,n.length-1,i),m(n,e,0,i)}function m(n,i,s,e){for(;s<n.length;++s){const r=n[s],o=(i-r.y0)*e;o>1e-6&&(r.y0+=o,r.y1+=o),i=r.y1+t}}function O(n,i,s,e){for(;s>=0;--s){const r=n[s],o=(r.y1-i)*e;o>1e-6&&(r.y0-=o,r.y1-=o),i=r.y0-t}}function D({sourceLinks:t,targetLinks:n}){if(void 0===i){for(const{source:{sourceLinks:t}}of n)t.sort(M);for(const{target:{targetLinks:n}}of t)n.sort(x)}}function j(t){if(void 0===i)for(const{sourceLinks:n,targetLinks:i}of t)n.sort(M),i.sort(x)}function P(n,i){let s=n.y0-(n.sourceLinks.length-1)*t/2;for(const{target:e,width:r}of n.sourceLinks){if(e===i)break;s+=r+t}for(const{source:t,width:e}of i.targetLinks){if(t===n)break;s-=e}return s}function $(n,i){let s=i.y0-(i.targetLinks.length-1)*t/2;for(const{source:e,width:r}of i.targetLinks){if(e===n)break;s+=r+t}for(const{target:t,width:e}of n.sourceLinks){if(t===i)break;s-=e}return s}return p.update=function(t){return C(t),t},p.nodeId=function(t){return arguments.length?(h="function"==typeof t?t:E(t),p):h},p.nodeAlign=function(t){return arguments.length?(f="function"==typeof t?t:E(t),p):f},p.nodeSort=function(t){return arguments.length?(n=t,p):n},p.nodeWidth=function(t){return arguments.length?(u=+t,p):u},p.nodePadding=function(n){return arguments.length?(c=t=+n,p):c},p.nodes=function(t){return arguments.length?(a="function"==typeof t?t:E(t),p):a},p.links=function(t){return arguments.length?(l="function"==typeof t?t:E(t),p):l},p.linkSort=function(t){return arguments.length?(i=t,p):i},p.size=function(t){return arguments.length?(s=e=0,r=+t[0],o=+t[1],p):[r-s,o-e]},p.extent=function(t){return arguments.length?(s=+t[0][0],r=+t[1][0],e=+t[0][1],o=+t[1][1],p):[[s,e],[r,o]]},p.iterations=function(t){return arguments.length?(d=+t,p):d},p}var D=Math.PI,j=2*D,P=1e-6,$=j-P;function U(){this._x0=this._y0=this._x1=this._y1=null,this._=""}function z(){return new U}function F(t){return function(){return t}}function G(t){return t[0]}function X(t){return t[1]}U.prototype=z.prototype={constructor:U,moveTo:function(t,n){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+n)},closePath:function(){null!==this._x1&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")},lineTo:function(t,n){this._+="L"+(this._x1=+t)+","+(this._y1=+n)},quadraticCurveTo:function(t,n,i,s){this._+="Q"+ +t+","+ +n+","+(this._x1=+i)+","+(this._y1=+s)},bezierCurveTo:function(t,n,i,s,e,r){this._+="C"+ +t+","+ +n+","+ +i+","+ +s+","+(this._x1=+e)+","+(this._y1=+r)},arcTo:function(t,n,i,s,e){t=+t,n=+n,i=+i,s=+s,e=+e;var r=this._x1,o=this._y1,u=i-t,c=s-n,h=r-t,f=o-n,a=h*h+f*f;if(e<0)throw new Error("negative radius: "+e);if(null===this._x1)this._+="M"+(this._x1=t)+","+(this._y1=n);else if(a>P)if(Math.abs(f*u-c*h)>P&&e){var l=i-r,d=s-o,p=u*u+c*c,v=l*l+d*d,g=Math.sqrt(p),k=Math.sqrt(a),y=e*Math.tan((D-Math.acos((p+a-v)/(2*g*k)))/2),w=y/k,b=y/g;Math.abs(w-1)>P&&(this._+="L"+(t+w*h)+","+(n+w*f)),this._+="A"+e+","+e+",0,0,"+ +(f*l>h*d)+","+(this._x1=t+b*u)+","+(this._y1=n+b*c)}else this._+="L"+(this._x1=t)+","+(this._y1=n);else;},arc:function(t,n,i,s,e,r){t=+t,n=+n,r=!!r;var o=(i=+i)*Math.cos(s),u=i*Math.sin(s),c=t+o,h=n+u,f=1^r,a=r?s-e:e-s;if(i<0)throw new Error("negative radius: "+i);null===this._x1?this._+="M"+c+","+h:(Math.abs(this._x1-c)>P||Math.abs(this._y1-h)>P)&&(this._+="L"+c+","+h),i&&(a<0&&(a=a%j+j),a>$?this._+="A"+i+","+i+",0,1,"+f+","+(t-o)+","+(n-u)+"A"+i+","+i+",0,1,"+f+","+(this._x1=c)+","+(this._y1=h):a>P&&(this._+="A"+i+","+i+",0,"+ +(a>=D)+","+f+","+(this._x1=t+i*Math.cos(e))+","+(this._y1=n+i*Math.sin(e))))},rect:function(t,n,i,s){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+n)+"h"+ +i+"v"+ +s+"h"+-i+"Z"},toString:function(){return this._}};var Q=Array.prototype.slice;function Y(t){return t.source}function q(t){return t.target}function B(t,n,i,s,e){t.moveTo(n,i),t.bezierCurveTo(n=(n+s)/2,i,n,e,s,e)}function K(){return function(t){var n=Y,i=q,s=G,e=X,r=null;function o(){var o,u=Q.call(arguments),c=n.apply(this,u),h=i.apply(this,u);if(r||(r=o=z()),t(r,+s.apply(this,(u[0]=c,u)),+e.apply(this,u),+s.apply(this,(u[0]=h,u)),+e.apply(this,u)),o)return r=null,o+""||null}return o.source=function(t){return arguments.length?(n=t,o):n},o.target=function(t){return arguments.length?(i=t,o):i},o.x=function(t){return arguments.length?(s="function"==typeof t?t:F(+t),o):s},o.y=function(t){return arguments.length?(e="function"==typeof t?t:F(+t),o):e},o.context=function(t){return arguments.length?(r=null==t?null:t,o):r},o}(B)}function R(t){return[t.source.x1,t.y0]}function W(t){return[t.target.x0,t.y1]}var Z=function(){var t=h(function(t,n,i,s){for(i=i||{},s=t.length;s--;i[t[s]]=n);return i},"o"),n=[1,9],i=[1,10],s=[1,5,10,12],e={trace:h(function(){},"trace"),yy:{},symbols_:{error:2,start:3,SANKEY:4,NEWLINE:5,csv:6,opt_eof:7,record:8,csv_tail:9,EOF:10,"field[source]":11,COMMA:12,"field[target]":13,"field[value]":14,field:15,escaped:16,non_escaped:17,DQUOTE:18,ESCAPED_TEXT:19,NON_ESCAPED_TEXT:20,$accept:0,$end:1},terminals_:{2:"error",4:"SANKEY",5:"NEWLINE",10:"EOF",11:"field[source]",12:"COMMA",13:"field[target]",14:"field[value]",18:"DQUOTE",19:"ESCAPED_TEXT",20:"NON_ESCAPED_TEXT"},productions_:[0,[3,4],[6,2],[9,2],[9,0],[7,1],[7,0],[8,5],[15,1],[15,1],[16,3],[17,1]],performAction:h(function(t,n,i,s,e,r,o){var u=r.length-1;switch(e){case 7:const t=s.findOrCreateNode(r[u-4].trim().replaceAll('""','"')),n=s.findOrCreateNode(r[u-2].trim().replaceAll('""','"')),i=parseFloat(r[u].trim());s.addLink(t,n,i);break;case 8:case 9:case 11:this.$=r[u];break;case 10:this.$=r[u-1]}},"anonymous"),table:[{3:1,4:[1,2]},{1:[3]},{5:[1,3]},{6:4,8:5,15:6,16:7,17:8,18:n,20:i},{1:[2,6],7:11,10:[1,12]},t(i,[2,4],{9:13,5:[1,14]}),{12:[1,15]},t(s,[2,8]),t(s,[2,9]),{19:[1,16]},t(s,[2,11]),{1:[2,1]},{1:[2,5]},t(i,[2,2]),{6:17,8:5,15:6,16:7,17:8,18:n,20:i},{15:18,16:7,17:8,18:n,20:i},{18:[1,19]},t(i,[2,3]),{12:[1,20]},t(s,[2,10]),{15:21,16:7,17:8,18:n,20:i},t([1,5,10],[2,7])],defaultActions:{11:[2,1],12:[2,5]},parseError:h(function(t,n){if(!n.recoverable){var i=new Error(t);throw i.hash=n,i}this.trace(t)},"parseError"),parse:h(function(t){var n=this,i=[0],s=[],e=[null],r=[],o=this.table,u="",c=0,f=0,a=r.slice.call(arguments,1),l=Object.create(this.lexer),d={yy:{}};for(var p in this.yy)Object.prototype.hasOwnProperty.call(this.yy,p)&&(d.yy[p]=this.yy[p]);l.setInput(t,d.yy),d.yy.lexer=l,d.yy.parser=this,void 0===l.yylloc&&(l.yylloc={});var v=l.yylloc;r.push(v);var g=l.options&&l.options.ranges;function k(){var t;return"number"!=typeof(t=s.pop()||l.lex()||1)&&(t instanceof Array&&(t=(s=t).pop()),t=n.symbols_[t]||t),t}"function"==typeof d.yy.parseError?this.parseError=d.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError,h(function(t){i.length=i.length-2*t,e.length=e.length-t,r.length=r.length-t},"popStack"),h(k,"lex");for(var y,w,b,m,_,E,x,M,S={};;){if(w=i[i.length-1],this.defaultActions[w]?b=this.defaultActions[w]:(null==y&&(y=k()),b=o[w]&&o[w][y]),void 0===b||!b.length||!b[0]){var A="";for(_ in M=[],o[w])this.terminals_[_]&&_>2&&M.push("'"+this.terminals_[_]+"'");A=l.showPosition?"Parse error on line "+(c+1)+":\n"+l.showPosition()+"\nExpecting "+M.join(", ")+", got '"+(this.terminals_[y]||y)+"'":"Parse error on line "+(c+1)+": Unexpected "+(1==y?"end of input":"'"+(this.terminals_[y]||y)+"'"),this.parseError(A,{text:l.match,token:this.terminals_[y]||y,line:l.yylineno,loc:v,expected:M})}if(b[0]instanceof Array&&b.length>1)throw new Error("Parse Error: multiple actions possible at state: "+w+", token: "+y);switch(b[0]){case 1:i.push(y),e.push(l.yytext),r.push(l.yylloc),i.push(b[1]),y=null,f=l.yyleng,u=l.yytext,c=l.yylineno,v=l.yylloc;break;case 2:if(E=this.productions_[b[1]][1],S.$=e[e.length-E],S._$={first_line:r[r.length-(E||1)].first_line,last_line:r[r.length-1].last_line,first_column:r[r.length-(E||1)].first_column,last_column:r[r.length-1].last_column},g&&(S._$.range=[r[r.length-(E||1)].range[0],r[r.length-1].range[1]]),void 0!==(m=this.performAction.apply(S,[u,f,c,d.yy,b[1],e,r].concat(a))))return m;E&&(i=i.slice(0,-1*E*2),e=e.slice(0,-1*E),r=r.slice(0,-1*E)),i.push(this.productions_[b[1]][0]),e.push(S.$),r.push(S._$),x=o[i[i.length-2]][i[i.length-1]],i.push(x);break;case 3:return!0}}return!0},"parse")},r=function(){return{EOF:1,parseError:h(function(t,n){if(!this.yy.parser)throw new Error(t);this.yy.parser.parseError(t,n)},"parseError"),setInput:h(function(t,n){return this.yy=n||this.yy||{},this._input=t,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:h(function(){var t=this._input[0];return this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t,t.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),t},"input"),unput:h(function(t){var n=t.length,i=t.split(/(?:\r\n?|\n)/g);this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-n),this.offset-=n;var s=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),i.length-1&&(this.yylineno-=i.length-1);var e=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:i?(i.length===s.length?this.yylloc.first_column:0)+s[s.length-i.length].length-i[0].length:this.yylloc.first_column-n},this.options.ranges&&(this.yylloc.range=[e[0],e[0]+this.yyleng-n]),this.yyleng=this.yytext.length,this},"unput"),more:h(function(){return this._more=!0,this},"more"),reject:h(function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):this.parseError("Lexical error on line "+(this.yylineno+1)+". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},"reject"),less:h(function(t){this.unput(this.match.slice(t))},"less"),pastInput:h(function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return(t.length>20?"...":"")+t.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:h(function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:h(function(){var t=this.pastInput(),n=new Array(t.length+1).join("-");return t+this.upcomingInput()+"\n"+n+"^"},"showPosition"),test_match:h(function(t,n){var i,s,e;if(this.options.backtrack_lexer&&(e={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(e.yylloc.range=this.yylloc.range.slice(0))),(s=t[0].match(/(?:\r\n?|\n).*/g))&&(this.yylineno+=s.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:s?s[s.length-1].length-s[s.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+t[0].length},this.yytext+=t[0],this.match+=t[0],this.matches=t,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(t[0].length),this.matched+=t[0],i=this.performAction.call(this,this.yy,this,n,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),i)return i;if(this._backtrack){for(var r in e)this[r]=e[r];return!1}return!1},"test_match"),next:h(function(){if(this.done)return this.EOF;var t,n,i,s;this._input||(this.done=!0),this._more||(this.yytext="",this.match="");for(var e=this._currentRules(),r=0;r<e.length;r++)if((i=this._input.match(this.rules[e[r]]))&&(!n||i[0].length>n[0].length)){if(n=i,s=r,this.options.backtrack_lexer){if(!1!==(t=this.test_match(i,e[r])))return t;if(this._backtrack){n=!1;continue}return!1}if(!this.options.flex)break}return n?!1!==(t=this.test_match(n,e[s]))&&t:""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:h(function(){var t=this.next();return t||this.lex()},"lex"),begin:h(function(t){this.conditionStack.push(t)},"begin"),popState:h(function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:h(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:h(function(t){return(t=this.conditionStack.length-1-Math.abs(t||0))>=0?this.conditionStack[t]:"INITIAL"},"topState"),pushState:h(function(t){this.begin(t)},"pushState"),stateStackSize:h(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:h(function(t,n,i,s){switch(i){case 0:case 1:return this.pushState("csv"),4;case 2:return 10;case 3:return 5;case 4:return 12;case 5:return this.pushState("escaped_text"),18;case 6:return 20;case 7:return this.popState("escaped_text"),18;case 8:return 19}},"anonymous"),rules:[/^(?:sankey-beta\b)/i,/^(?:sankey\b)/i,/^(?:$)/i,/^(?:((\u000D\u000A)|(\u000A)))/i,/^(?:(\u002C))/i,/^(?:(\u0022))/i,/^(?:([\u0020-\u0021\u0023-\u002B\u002D-\u007E])*)/i,/^(?:(\u0022)(?!(\u0022)))/i,/^(?:(([\u0020-\u0021\u0023-\u002B\u002D-\u007E])|(\u002C)|(\u000D)|(\u000A)|(\u0022)(\u0022))*)/i],conditions:{csv:{rules:[2,3,4,5,6,7,8],inclusive:!1},escaped_text:{rules:[7,8],inclusive:!1},INITIAL:{rules:[0,1,2,3,4,5,6,7,8],inclusive:!0}}}}();function o(){this.yy={}}return e.lexer=r,h(o,"Parser"),o.prototype=e,e.Parser=o,new o}();Z.parser=Z;var V=Z,H=[],J=[],tt=new Map,nt=h(()=>{H=[],J=[],tt=new Map,p()},"clear"),it=(h(t=class{constructor(t,n,i=0){this.source=t,this.target=n,this.value=i}},"SankeyLink"),t),st=h((t,n,i)=>{H.push(new it(t,n,i))},"addLink"),et=(h(n=class{constructor(t){this.ID=t}},"SankeyNode"),n),rt=h(t=>{t=v.sanitizeText(t,f());let n=tt.get(t);return void 0===n&&(n=new et(t),tt.set(t,n),J.push(n)),n},"findOrCreateNode"),ot=h(()=>J,"getNodes"),ut=h(()=>H,"getLinks"),ct=h(()=>({nodes:J.map(t=>({id:t.ID})),links:H.map(t=>({source:t.source.ID,target:t.target.ID,value:t.value}))}),"getGraph"),ht={nodesMap:tt,getConfig:h(()=>f().sankey,"getConfig"),getNodes:ot,getLinks:ut,getGraph:ct,addLink:st,findOrCreateNode:rt,getAccTitle:c,setAccTitle:u,getAccDescription:o,setAccDescription:r,getDiagramTitle:e,setDiagramTitle:s,clear:nt},ft=(h(i=class{static next(t){return new i(t+ ++i.count)}constructor(t){this.id=t,this.href=`#${t}`}toString(){return"url("+this.href+")"}},"Uid"),i.count=0,i),at={left:function(t){return t.depth},right:function(t,n){return n-1-t.height},center:function(t){return t.targetLinks.length?t.depth:t.sourceLinks.length?w(t.sourceLinks,m)-1:0},justify:_},lt={draw:h(function(t,n,i,s){const{securityLevel:e,sankey:r}=f(),o=a.sankey;let u;"sandbox"===e&&(u=l("#i"+n));const c=l("sandbox"===e?u.nodes()[0].contentDocument.body:"body"),p="sandbox"===e?c.select(`[id="${n}"]`):l(`[id="${n}"]`),v=(null==r?void 0:r.width)??o.width,y=(null==r?void 0:r.height)??o.width,w=(null==r?void 0:r.useMaxWidth)??o.useMaxWidth,b=(null==r?void 0:r.nodeAlignment)??o.nodeAlignment,m=(null==r?void 0:r.prefix)??o.prefix,_=(null==r?void 0:r.suffix)??o.suffix,E=(null==r?void 0:r.showValues)??o.showValues,x=s.db.getGraph(),M=at[b];O().nodeId(t=>t.id).nodeWidth(10).nodePadding(10+(E?15:0)).nodeAlign(M).extent([[0,0],[v,y]])(x);const S=g(k);p.append("g").attr("class","nodes").selectAll(".node").data(x.nodes).join("g").attr("class","node").attr("id",t=>(t.uid=ft.next("node-")).id).attr("transform",function(t){return"translate("+t.x0+","+t.y0+")"}).attr("x",t=>t.x0).attr("y",t=>t.y0).append("rect").attr("height",t=>t.y1-t.y0).attr("width",t=>t.x1-t.x0).attr("fill",t=>S(t.id));const A=h(({id:t,value:n})=>E?`${t}\n${m}${Math.round(100*n)/100}${_}`:t,"getText");p.append("g").attr("class","node-labels").attr("font-size",14).selectAll("text").data(x.nodes).join("text").attr("x",t=>t.x0<v/2?t.x1+6:t.x0-6).attr("y",t=>(t.y1+t.y0)/2).attr("dy",(E?"0":"0.35")+"em").attr("text-anchor",t=>t.x0<v/2?"start":"end").text(A);const L=p.append("g").attr("class","links").attr("fill","none").attr("stroke-opacity",.5).selectAll(".link").data(x.links).join("g").attr("class","link").style("mix-blend-mode","multiply"),T=(null==r?void 0:r.linkColor)??"gradient";if("gradient"===T){const t=L.append("linearGradient").attr("id",t=>(t.uid=ft.next("linearGradient-")).id).attr("gradientUnits","userSpaceOnUse").attr("x1",t=>t.source.x1).attr("x2",t=>t.target.x0);t.append("stop").attr("offset","0%").attr("stop-color",t=>S(t.source.id)),t.append("stop").attr("offset","100%").attr("stop-color",t=>S(t.target.id))}let N;switch(T){case"gradient":N=h(t=>t.uid,"coloring");break;case"source":N=h(t=>S(t.source.id),"coloring");break;case"target":N=h(t=>S(t.target.id),"coloring");break;default:N=T}L.append("path").attr("d",K().source(R).target(W)).attr("stroke",N).attr("stroke-width",t=>Math.max(1,t.width)),d(void 0,p,0,w)},"draw")},dt=h(t=>t.replaceAll(/^[^\S\n\r]+|[^\S\n\r]+$/g,"").replaceAll(/([\n\r])+/g,"\n").trim(),"prepareTextForParsing"),pt=h(t=>`.label {\n font-family: ${t.fontFamily};\n }`,"getStyles"),vt=V.parse.bind(V);V.parse=t=>vt(dt(t));var gt={styles:pt,parser:V,db:ht,renderer:lt};export{gt as diagram};
|
|
1
|
+
var t,n,i;import{p as s,q as e,s as r,g as o,b as u,a as c,_ as h,c as f,z as a,d as l,V as d,y as p,k as v}from"./index-30onxp6I.js";import{o as g}from"./ordinal-2upbOM02.js";import"./init-C9Lo50Hz.js";const k=function(t){for(var n=t.length/6|0,i=new Array(n),s=0;s<n;)i[s]="#"+t.slice(6*s,6*++s);return i}("4e79a7f28e2ce1575976b7b259a14fedc949af7aa1ff9da79c755fbab0ab");function y(t,n){let i;if(void 0===n)for(const s of t)null!=s&&(i<s||void 0===i&&s>=s)&&(i=s);else{let s=-1;for(let e of t)null!=(e=n(e,++s,t))&&(i<e||void 0===i&&e>=e)&&(i=e)}return i}function w(t,n){let i;if(void 0===n)for(const s of t)null!=s&&(i>s||void 0===i&&s>=s)&&(i=s);else{let s=-1;for(let e of t)null!=(e=n(e,++s,t))&&(i>e||void 0===i&&e>=e)&&(i=e)}return i}function b(t,n){let i=0;if(void 0===n)for(let s of t)(s=+s)&&(i+=s);else{let s=-1;for(let e of t)(e=+n(e,++s,t))&&(i+=e)}return i}function m(t){return t.target.depth}function _(t,n){return t.sourceLinks.length?t.depth:n-1}function E(t){return function(){return t}}function x(t,n){return S(t.source,n.source)||t.index-n.index}function M(t,n){return S(t.target,n.target)||t.index-n.index}function S(t,n){return t.y0-n.y0}function A(t){return t.value}function L(t){return t.index}function T(t){return t.nodes}function N(t){return t.links}function I(t,n){const i=t.get(n);if(!i)throw new Error("missing: "+n);return i}function C({nodes:t}){for(const n of t){let t=n.y0,i=t;for(const s of n.sourceLinks)s.y0=t+s.width/2,t+=s.width;for(const s of n.targetLinks)s.y1=i+s.width/2,i+=s.width}}function O(){let t,n,i,s=0,e=0,r=1,o=1,u=24,c=8,h=L,f=_,a=T,l=N,d=6;function p(){const p={nodes:a.apply(null,arguments),links:l.apply(null,arguments)};return function({nodes:t,links:n}){for(const[i,e]of t.entries())e.index=i,e.sourceLinks=[],e.targetLinks=[];const s=new Map(t.map((n,i)=>[h(n,i,t),n]));for(const[i,e]of n.entries()){e.index=i;let{source:t,target:n}=e;"object"!=typeof t&&(t=e.source=I(s,t)),"object"!=typeof n&&(n=e.target=I(s,n)),t.sourceLinks.push(e),n.targetLinks.push(e)}if(null!=i)for(const{sourceLinks:e,targetLinks:r}of t)e.sort(i),r.sort(i)}(p),function({nodes:t}){for(const n of t)n.value=void 0===n.fixedValue?Math.max(b(n.sourceLinks,A),b(n.targetLinks,A)):n.fixedValue}(p),function({nodes:t}){const n=t.length;let i=new Set(t),s=new Set,e=0;for(;i.size;){for(const t of i){t.depth=e;for(const{target:n}of t.sourceLinks)s.add(n)}if(++e>n)throw new Error("circular link");i=s,s=new Set}}(p),function({nodes:t}){const n=t.length;let i=new Set(t),s=new Set,e=0;for(;i.size;){for(const t of i){t.height=e;for(const{source:n}of t.targetLinks)s.add(n)}if(++e>n)throw new Error("circular link");i=s,s=new Set}}(p),function(i){const h=function({nodes:t}){const i=y(t,t=>t.depth)+1,e=(r-s-u)/(i-1),o=new Array(i);for(const n of t){const t=Math.max(0,Math.min(i-1,Math.floor(f.call(null,n,i))));n.layer=t,n.x0=s+t*e,n.x1=n.x0+u,o[t]?o[t].push(n):o[t]=[n]}if(n)for(const s of o)s.sort(n);return o}(i);t=Math.min(c,(o-e)/(y(h,t=>t.length)-1)),function(n){const i=w(n,n=>(o-e-(n.length-1)*t)/b(n,A));for(const s of n){let n=e;for(const e of s){e.y0=n,e.y1=n+e.value*i,n=e.y1+t;for(const t of e.sourceLinks)t.width=t.value*i}n=(o-n+t)/(s.length+1);for(let t=0;t<s.length;++t){const i=s[t];i.y0+=n*(t+1),i.y1+=n*(t+1)}j(s)}}(h);for(let t=0;t<d;++t){const n=Math.pow(.99,t),i=Math.max(1-n,(t+1)/d);g(h,n,i),v(h,n,i)}}(p),C(p),p}function v(t,i,s){for(let e=1,r=t.length;e<r;++e){const r=t[e];for(const t of r){let n=0,s=0;for(const{source:i,value:r}of t.targetLinks){let e=r*(t.layer-i.layer);n+=P(i,t)*e,s+=e}if(!(s>0))continue;let e=(n/s-t.y0)*i;t.y0+=e,t.y1+=e,D(t)}void 0===n&&r.sort(S),k(r,s)}}function g(t,i,s){for(let e=t.length-2;e>=0;--e){const r=t[e];for(const t of r){let n=0,s=0;for(const{target:i,value:r}of t.sourceLinks){let e=r*(i.layer-t.layer);n+=$(t,i)*e,s+=e}if(!(s>0))continue;let e=(n/s-t.y0)*i;t.y0+=e,t.y1+=e,D(t)}void 0===n&&r.sort(S),k(r,s)}}function k(n,i){const s=n.length>>1,r=n[s];O(n,r.y0-t,s-1,i),m(n,r.y1+t,s+1,i),O(n,o,n.length-1,i),m(n,e,0,i)}function m(n,i,s,e){for(;s<n.length;++s){const r=n[s],o=(i-r.y0)*e;o>1e-6&&(r.y0+=o,r.y1+=o),i=r.y1+t}}function O(n,i,s,e){for(;s>=0;--s){const r=n[s],o=(r.y1-i)*e;o>1e-6&&(r.y0-=o,r.y1-=o),i=r.y0-t}}function D({sourceLinks:t,targetLinks:n}){if(void 0===i){for(const{source:{sourceLinks:t}}of n)t.sort(M);for(const{target:{targetLinks:n}}of t)n.sort(x)}}function j(t){if(void 0===i)for(const{sourceLinks:n,targetLinks:i}of t)n.sort(M),i.sort(x)}function P(n,i){let s=n.y0-(n.sourceLinks.length-1)*t/2;for(const{target:e,width:r}of n.sourceLinks){if(e===i)break;s+=r+t}for(const{source:t,width:e}of i.targetLinks){if(t===n)break;s-=e}return s}function $(n,i){let s=i.y0-(i.targetLinks.length-1)*t/2;for(const{source:e,width:r}of i.targetLinks){if(e===n)break;s+=r+t}for(const{target:t,width:e}of n.sourceLinks){if(t===i)break;s-=e}return s}return p.update=function(t){return C(t),t},p.nodeId=function(t){return arguments.length?(h="function"==typeof t?t:E(t),p):h},p.nodeAlign=function(t){return arguments.length?(f="function"==typeof t?t:E(t),p):f},p.nodeSort=function(t){return arguments.length?(n=t,p):n},p.nodeWidth=function(t){return arguments.length?(u=+t,p):u},p.nodePadding=function(n){return arguments.length?(c=t=+n,p):c},p.nodes=function(t){return arguments.length?(a="function"==typeof t?t:E(t),p):a},p.links=function(t){return arguments.length?(l="function"==typeof t?t:E(t),p):l},p.linkSort=function(t){return arguments.length?(i=t,p):i},p.size=function(t){return arguments.length?(s=e=0,r=+t[0],o=+t[1],p):[r-s,o-e]},p.extent=function(t){return arguments.length?(s=+t[0][0],r=+t[1][0],e=+t[0][1],o=+t[1][1],p):[[s,e],[r,o]]},p.iterations=function(t){return arguments.length?(d=+t,p):d},p}var D=Math.PI,j=2*D,P=1e-6,$=j-P;function U(){this._x0=this._y0=this._x1=this._y1=null,this._=""}function z(){return new U}function F(t){return function(){return t}}function G(t){return t[0]}function X(t){return t[1]}U.prototype=z.prototype={constructor:U,moveTo:function(t,n){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+n)},closePath:function(){null!==this._x1&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")},lineTo:function(t,n){this._+="L"+(this._x1=+t)+","+(this._y1=+n)},quadraticCurveTo:function(t,n,i,s){this._+="Q"+ +t+","+ +n+","+(this._x1=+i)+","+(this._y1=+s)},bezierCurveTo:function(t,n,i,s,e,r){this._+="C"+ +t+","+ +n+","+ +i+","+ +s+","+(this._x1=+e)+","+(this._y1=+r)},arcTo:function(t,n,i,s,e){t=+t,n=+n,i=+i,s=+s,e=+e;var r=this._x1,o=this._y1,u=i-t,c=s-n,h=r-t,f=o-n,a=h*h+f*f;if(e<0)throw new Error("negative radius: "+e);if(null===this._x1)this._+="M"+(this._x1=t)+","+(this._y1=n);else if(a>P)if(Math.abs(f*u-c*h)>P&&e){var l=i-r,d=s-o,p=u*u+c*c,v=l*l+d*d,g=Math.sqrt(p),k=Math.sqrt(a),y=e*Math.tan((D-Math.acos((p+a-v)/(2*g*k)))/2),w=y/k,b=y/g;Math.abs(w-1)>P&&(this._+="L"+(t+w*h)+","+(n+w*f)),this._+="A"+e+","+e+",0,0,"+ +(f*l>h*d)+","+(this._x1=t+b*u)+","+(this._y1=n+b*c)}else this._+="L"+(this._x1=t)+","+(this._y1=n);else;},arc:function(t,n,i,s,e,r){t=+t,n=+n,r=!!r;var o=(i=+i)*Math.cos(s),u=i*Math.sin(s),c=t+o,h=n+u,f=1^r,a=r?s-e:e-s;if(i<0)throw new Error("negative radius: "+i);null===this._x1?this._+="M"+c+","+h:(Math.abs(this._x1-c)>P||Math.abs(this._y1-h)>P)&&(this._+="L"+c+","+h),i&&(a<0&&(a=a%j+j),a>$?this._+="A"+i+","+i+",0,1,"+f+","+(t-o)+","+(n-u)+"A"+i+","+i+",0,1,"+f+","+(this._x1=c)+","+(this._y1=h):a>P&&(this._+="A"+i+","+i+",0,"+ +(a>=D)+","+f+","+(this._x1=t+i*Math.cos(e))+","+(this._y1=n+i*Math.sin(e))))},rect:function(t,n,i,s){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+n)+"h"+ +i+"v"+ +s+"h"+-i+"Z"},toString:function(){return this._}};var Q=Array.prototype.slice;function Y(t){return t.source}function q(t){return t.target}function B(t,n,i,s,e){t.moveTo(n,i),t.bezierCurveTo(n=(n+s)/2,i,n,e,s,e)}function K(){return function(t){var n=Y,i=q,s=G,e=X,r=null;function o(){var o,u=Q.call(arguments),c=n.apply(this,u),h=i.apply(this,u);if(r||(r=o=z()),t(r,+s.apply(this,(u[0]=c,u)),+e.apply(this,u),+s.apply(this,(u[0]=h,u)),+e.apply(this,u)),o)return r=null,o+""||null}return o.source=function(t){return arguments.length?(n=t,o):n},o.target=function(t){return arguments.length?(i=t,o):i},o.x=function(t){return arguments.length?(s="function"==typeof t?t:F(+t),o):s},o.y=function(t){return arguments.length?(e="function"==typeof t?t:F(+t),o):e},o.context=function(t){return arguments.length?(r=null==t?null:t,o):r},o}(B)}function R(t){return[t.source.x1,t.y0]}function W(t){return[t.target.x0,t.y1]}var Z=function(){var t=h(function(t,n,i,s){for(i=i||{},s=t.length;s--;i[t[s]]=n);return i},"o"),n=[1,9],i=[1,10],s=[1,5,10,12],e={trace:h(function(){},"trace"),yy:{},symbols_:{error:2,start:3,SANKEY:4,NEWLINE:5,csv:6,opt_eof:7,record:8,csv_tail:9,EOF:10,"field[source]":11,COMMA:12,"field[target]":13,"field[value]":14,field:15,escaped:16,non_escaped:17,DQUOTE:18,ESCAPED_TEXT:19,NON_ESCAPED_TEXT:20,$accept:0,$end:1},terminals_:{2:"error",4:"SANKEY",5:"NEWLINE",10:"EOF",11:"field[source]",12:"COMMA",13:"field[target]",14:"field[value]",18:"DQUOTE",19:"ESCAPED_TEXT",20:"NON_ESCAPED_TEXT"},productions_:[0,[3,4],[6,2],[9,2],[9,0],[7,1],[7,0],[8,5],[15,1],[15,1],[16,3],[17,1]],performAction:h(function(t,n,i,s,e,r,o){var u=r.length-1;switch(e){case 7:const t=s.findOrCreateNode(r[u-4].trim().replaceAll('""','"')),n=s.findOrCreateNode(r[u-2].trim().replaceAll('""','"')),i=parseFloat(r[u].trim());s.addLink(t,n,i);break;case 8:case 9:case 11:this.$=r[u];break;case 10:this.$=r[u-1]}},"anonymous"),table:[{3:1,4:[1,2]},{1:[3]},{5:[1,3]},{6:4,8:5,15:6,16:7,17:8,18:n,20:i},{1:[2,6],7:11,10:[1,12]},t(i,[2,4],{9:13,5:[1,14]}),{12:[1,15]},t(s,[2,8]),t(s,[2,9]),{19:[1,16]},t(s,[2,11]),{1:[2,1]},{1:[2,5]},t(i,[2,2]),{6:17,8:5,15:6,16:7,17:8,18:n,20:i},{15:18,16:7,17:8,18:n,20:i},{18:[1,19]},t(i,[2,3]),{12:[1,20]},t(s,[2,10]),{15:21,16:7,17:8,18:n,20:i},t([1,5,10],[2,7])],defaultActions:{11:[2,1],12:[2,5]},parseError:h(function(t,n){if(!n.recoverable){var i=new Error(t);throw i.hash=n,i}this.trace(t)},"parseError"),parse:h(function(t){var n=this,i=[0],s=[],e=[null],r=[],o=this.table,u="",c=0,f=0,a=r.slice.call(arguments,1),l=Object.create(this.lexer),d={yy:{}};for(var p in this.yy)Object.prototype.hasOwnProperty.call(this.yy,p)&&(d.yy[p]=this.yy[p]);l.setInput(t,d.yy),d.yy.lexer=l,d.yy.parser=this,void 0===l.yylloc&&(l.yylloc={});var v=l.yylloc;r.push(v);var g=l.options&&l.options.ranges;function k(){var t;return"number"!=typeof(t=s.pop()||l.lex()||1)&&(t instanceof Array&&(t=(s=t).pop()),t=n.symbols_[t]||t),t}"function"==typeof d.yy.parseError?this.parseError=d.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError,h(function(t){i.length=i.length-2*t,e.length=e.length-t,r.length=r.length-t},"popStack"),h(k,"lex");for(var y,w,b,m,_,E,x,M,S={};;){if(w=i[i.length-1],this.defaultActions[w]?b=this.defaultActions[w]:(null==y&&(y=k()),b=o[w]&&o[w][y]),void 0===b||!b.length||!b[0]){var A="";for(_ in M=[],o[w])this.terminals_[_]&&_>2&&M.push("'"+this.terminals_[_]+"'");A=l.showPosition?"Parse error on line "+(c+1)+":\n"+l.showPosition()+"\nExpecting "+M.join(", ")+", got '"+(this.terminals_[y]||y)+"'":"Parse error on line "+(c+1)+": Unexpected "+(1==y?"end of input":"'"+(this.terminals_[y]||y)+"'"),this.parseError(A,{text:l.match,token:this.terminals_[y]||y,line:l.yylineno,loc:v,expected:M})}if(b[0]instanceof Array&&b.length>1)throw new Error("Parse Error: multiple actions possible at state: "+w+", token: "+y);switch(b[0]){case 1:i.push(y),e.push(l.yytext),r.push(l.yylloc),i.push(b[1]),y=null,f=l.yyleng,u=l.yytext,c=l.yylineno,v=l.yylloc;break;case 2:if(E=this.productions_[b[1]][1],S.$=e[e.length-E],S._$={first_line:r[r.length-(E||1)].first_line,last_line:r[r.length-1].last_line,first_column:r[r.length-(E||1)].first_column,last_column:r[r.length-1].last_column},g&&(S._$.range=[r[r.length-(E||1)].range[0],r[r.length-1].range[1]]),void 0!==(m=this.performAction.apply(S,[u,f,c,d.yy,b[1],e,r].concat(a))))return m;E&&(i=i.slice(0,-1*E*2),e=e.slice(0,-1*E),r=r.slice(0,-1*E)),i.push(this.productions_[b[1]][0]),e.push(S.$),r.push(S._$),x=o[i[i.length-2]][i[i.length-1]],i.push(x);break;case 3:return!0}}return!0},"parse")},r=function(){return{EOF:1,parseError:h(function(t,n){if(!this.yy.parser)throw new Error(t);this.yy.parser.parseError(t,n)},"parseError"),setInput:h(function(t,n){return this.yy=n||this.yy||{},this._input=t,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:h(function(){var t=this._input[0];return this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t,t.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),t},"input"),unput:h(function(t){var n=t.length,i=t.split(/(?:\r\n?|\n)/g);this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-n),this.offset-=n;var s=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),i.length-1&&(this.yylineno-=i.length-1);var e=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:i?(i.length===s.length?this.yylloc.first_column:0)+s[s.length-i.length].length-i[0].length:this.yylloc.first_column-n},this.options.ranges&&(this.yylloc.range=[e[0],e[0]+this.yyleng-n]),this.yyleng=this.yytext.length,this},"unput"),more:h(function(){return this._more=!0,this},"more"),reject:h(function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):this.parseError("Lexical error on line "+(this.yylineno+1)+". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},"reject"),less:h(function(t){this.unput(this.match.slice(t))},"less"),pastInput:h(function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return(t.length>20?"...":"")+t.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:h(function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:h(function(){var t=this.pastInput(),n=new Array(t.length+1).join("-");return t+this.upcomingInput()+"\n"+n+"^"},"showPosition"),test_match:h(function(t,n){var i,s,e;if(this.options.backtrack_lexer&&(e={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(e.yylloc.range=this.yylloc.range.slice(0))),(s=t[0].match(/(?:\r\n?|\n).*/g))&&(this.yylineno+=s.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:s?s[s.length-1].length-s[s.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+t[0].length},this.yytext+=t[0],this.match+=t[0],this.matches=t,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(t[0].length),this.matched+=t[0],i=this.performAction.call(this,this.yy,this,n,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),i)return i;if(this._backtrack){for(var r in e)this[r]=e[r];return!1}return!1},"test_match"),next:h(function(){if(this.done)return this.EOF;var t,n,i,s;this._input||(this.done=!0),this._more||(this.yytext="",this.match="");for(var e=this._currentRules(),r=0;r<e.length;r++)if((i=this._input.match(this.rules[e[r]]))&&(!n||i[0].length>n[0].length)){if(n=i,s=r,this.options.backtrack_lexer){if(!1!==(t=this.test_match(i,e[r])))return t;if(this._backtrack){n=!1;continue}return!1}if(!this.options.flex)break}return n?!1!==(t=this.test_match(n,e[s]))&&t:""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:h(function(){var t=this.next();return t||this.lex()},"lex"),begin:h(function(t){this.conditionStack.push(t)},"begin"),popState:h(function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:h(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:h(function(t){return(t=this.conditionStack.length-1-Math.abs(t||0))>=0?this.conditionStack[t]:"INITIAL"},"topState"),pushState:h(function(t){this.begin(t)},"pushState"),stateStackSize:h(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:h(function(t,n,i,s){switch(i){case 0:case 1:return this.pushState("csv"),4;case 2:return 10;case 3:return 5;case 4:return 12;case 5:return this.pushState("escaped_text"),18;case 6:return 20;case 7:return this.popState("escaped_text"),18;case 8:return 19}},"anonymous"),rules:[/^(?:sankey-beta\b)/i,/^(?:sankey\b)/i,/^(?:$)/i,/^(?:((\u000D\u000A)|(\u000A)))/i,/^(?:(\u002C))/i,/^(?:(\u0022))/i,/^(?:([\u0020-\u0021\u0023-\u002B\u002D-\u007E])*)/i,/^(?:(\u0022)(?!(\u0022)))/i,/^(?:(([\u0020-\u0021\u0023-\u002B\u002D-\u007E])|(\u002C)|(\u000D)|(\u000A)|(\u0022)(\u0022))*)/i],conditions:{csv:{rules:[2,3,4,5,6,7,8],inclusive:!1},escaped_text:{rules:[7,8],inclusive:!1},INITIAL:{rules:[0,1,2,3,4,5,6,7,8],inclusive:!0}}}}();function o(){this.yy={}}return e.lexer=r,h(o,"Parser"),o.prototype=e,e.Parser=o,new o}();Z.parser=Z;var V=Z,H=[],J=[],tt=new Map,nt=h(()=>{H=[],J=[],tt=new Map,p()},"clear"),it=(h(t=class{constructor(t,n,i=0){this.source=t,this.target=n,this.value=i}},"SankeyLink"),t),st=h((t,n,i)=>{H.push(new it(t,n,i))},"addLink"),et=(h(n=class{constructor(t){this.ID=t}},"SankeyNode"),n),rt=h(t=>{t=v.sanitizeText(t,f());let n=tt.get(t);return void 0===n&&(n=new et(t),tt.set(t,n),J.push(n)),n},"findOrCreateNode"),ot=h(()=>J,"getNodes"),ut=h(()=>H,"getLinks"),ct=h(()=>({nodes:J.map(t=>({id:t.ID})),links:H.map(t=>({source:t.source.ID,target:t.target.ID,value:t.value}))}),"getGraph"),ht={nodesMap:tt,getConfig:h(()=>f().sankey,"getConfig"),getNodes:ot,getLinks:ut,getGraph:ct,addLink:st,findOrCreateNode:rt,getAccTitle:c,setAccTitle:u,getAccDescription:o,setAccDescription:r,getDiagramTitle:e,setDiagramTitle:s,clear:nt},ft=(h(i=class{static next(t){return new i(t+ ++i.count)}constructor(t){this.id=t,this.href=`#${t}`}toString(){return"url("+this.href+")"}},"Uid"),i.count=0,i),at={left:function(t){return t.depth},right:function(t,n){return n-1-t.height},center:function(t){return t.targetLinks.length?t.depth:t.sourceLinks.length?w(t.sourceLinks,m)-1:0},justify:_},lt={draw:h(function(t,n,i,s){const{securityLevel:e,sankey:r}=f(),o=a.sankey;let u;"sandbox"===e&&(u=l("#i"+n));const c=l("sandbox"===e?u.nodes()[0].contentDocument.body:"body"),p="sandbox"===e?c.select(`[id="${n}"]`):l(`[id="${n}"]`),v=(null==r?void 0:r.width)??o.width,y=(null==r?void 0:r.height)??o.width,w=(null==r?void 0:r.useMaxWidth)??o.useMaxWidth,b=(null==r?void 0:r.nodeAlignment)??o.nodeAlignment,m=(null==r?void 0:r.prefix)??o.prefix,_=(null==r?void 0:r.suffix)??o.suffix,E=(null==r?void 0:r.showValues)??o.showValues,x=s.db.getGraph(),M=at[b];O().nodeId(t=>t.id).nodeWidth(10).nodePadding(10+(E?15:0)).nodeAlign(M).extent([[0,0],[v,y]])(x);const S=g(k);p.append("g").attr("class","nodes").selectAll(".node").data(x.nodes).join("g").attr("class","node").attr("id",t=>(t.uid=ft.next("node-")).id).attr("transform",function(t){return"translate("+t.x0+","+t.y0+")"}).attr("x",t=>t.x0).attr("y",t=>t.y0).append("rect").attr("height",t=>t.y1-t.y0).attr("width",t=>t.x1-t.x0).attr("fill",t=>S(t.id));const A=h(({id:t,value:n})=>E?`${t}\n${m}${Math.round(100*n)/100}${_}`:t,"getText");p.append("g").attr("class","node-labels").attr("font-size",14).selectAll("text").data(x.nodes).join("text").attr("x",t=>t.x0<v/2?t.x1+6:t.x0-6).attr("y",t=>(t.y1+t.y0)/2).attr("dy",(E?"0":"0.35")+"em").attr("text-anchor",t=>t.x0<v/2?"start":"end").text(A);const L=p.append("g").attr("class","links").attr("fill","none").attr("stroke-opacity",.5).selectAll(".link").data(x.links).join("g").attr("class","link").style("mix-blend-mode","multiply"),T=(null==r?void 0:r.linkColor)??"gradient";if("gradient"===T){const t=L.append("linearGradient").attr("id",t=>(t.uid=ft.next("linearGradient-")).id).attr("gradientUnits","userSpaceOnUse").attr("x1",t=>t.source.x1).attr("x2",t=>t.target.x0);t.append("stop").attr("offset","0%").attr("stop-color",t=>S(t.source.id)),t.append("stop").attr("offset","100%").attr("stop-color",t=>S(t.target.id))}let N;switch(T){case"gradient":N=h(t=>t.uid,"coloring");break;case"source":N=h(t=>S(t.source.id),"coloring");break;case"target":N=h(t=>S(t.target.id),"coloring");break;default:N=T}L.append("path").attr("d",K().source(R).target(W)).attr("stroke",N).attr("stroke-width",t=>Math.max(1,t.width)),d(void 0,p,0,w)},"draw")},dt=h(t=>t.replaceAll(/^[^\S\n\r]+|[^\S\n\r]+$/g,"").replaceAll(/([\n\r])+/g,"\n").trim(),"prepareTextForParsing"),pt=h(t=>`.label {\n font-family: ${t.fontFamily};\n }`,"getStyles"),vt=V.parse.bind(V);V.parse=t=>vt(dt(t));var gt={styles:pt,parser:V,db:ht,renderer:lt};export{gt as diagram};
|