This commit is contained in:
sidharthv96
2021-10-02 08:23:10 +00:00
parent e355caed98
commit 395a0fb18b
19 changed files with 1321 additions and 18 deletions
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -1 +1 @@
let s="";function a(a){s=a.base,a.assets}export{s as b,a as s};
let e="";function a(s){e=s.base,s.assets}export{e as b,a as s};
+1 -1
View File
@@ -1 +1 @@
const e={},r=function(r,t){return t&&0!==t.length?Promise.all(t.map((r=>{if((r=`/mermaid-live-editor/_app/${r}`)in e)return;e[r]=!0;const t=r.endsWith(".css"),n=t?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${r}"]${n}`))return;const i=document.createElement("link");return i.rel=t?"stylesheet":"modulepreload",t||(i.as="script",i.crossOrigin=""),i.href=r,document.head.appendChild(i),t?new Promise(((e,r)=>{i.addEventListener("load",e),i.addEventListener("error",r)})):void 0}))).then((()=>r())):r()};export{r as _};
const a="modulepreload",i={},u="/mermaid-live-editor/_app/",d=function(s,n){return!n||n.length===0?s():Promise.all(n.map(e=>{if(e=`${u}${e}`,e in i)return;i[e]=!0;const r=e.endsWith(".css"),o=r?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${e}"]${o}`))return;const t=document.createElement("link");if(t.rel=r?"stylesheet":a,r||(t.as="script",t.crossOrigin=""),t.href=e,document.head.appendChild(t),r)return new Promise((l,c)=>{t.addEventListener("load",l),t.addEventListener("error",c)})})).then(()=>s())};export{d as _};
+1 -1
View File
@@ -1 +1 @@
let t;function a(a){t=a}export{a as i,t as r};
let i;function r(t){i=t}export{r as i,i as r};
+9
View File
@@ -0,0 +1,9 @@
var h=Object.defineProperty,v=Object.defineProperties;var b=Object.getOwnPropertyDescriptors;var d=Object.getOwnPropertySymbols;var _=Object.prototype.hasOwnProperty,C=Object.prototype.propertyIsEnumerable;var u=(t,e,a)=>e in t?h(t,e,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[e]=a,s=(t,e)=>{for(var a in e||(e={}))_.call(e,a)&&u(t,a,e[a]);if(d)for(var a of d(e))C.call(e,a)&&u(t,a,e[a]);return t},i=(t,e)=>v(t,b(e));import{C as m,J as L,K as O,L as T,M as k,N as l,O as A}from"./vendor-96614ef2.js";import{_ as f}from"./preload-helper-1db36302.js";const J={loading:!1},g=m(J),R=async(t,e)=>{g.set({loading:!0,message:t});const a=await e;return g.set({loading:!1}),a};let n;const $=async()=>{if(!n)try{const{Analytics:t}=await f(()=>import("./analytics.browser.es-b9bb2b82.js"),[]),e=await f(()=>import("./analytics-plugin-ga.browser.es-1cdb0512.js"),[]);n=t({app:"mermaid-live-editor",plugins:[e.init({trackingId:"UA-153180559-1"})]})}catch{console.info("Analytics blocked ;)")}},N=t=>t.replace(/^\s*%%.*\n/g,`
`).trimStart().split(" ")[0];let p;const E=t=>{n&&(clearTimeout(p),p=setTimeout(function(){const e=N(t);console.debug("ga:","send","event","render",e),n.track("render",{graphType:e})},5e3))},w={code:`graph TD
A[Christmas] -->|Get money| B(Go shopping)
B --> C{Let me think}
C -->|One| D[Laptop]
C -->|Two| E[iPhone]
C -->|Three| F[fa:fa-car Car]
`,mermaid:JSON.stringify({theme:"default"},null,2),updateEditor:!1,autoSync:!0,updateDiagram:!0},r=L(m(w),O(),"codeStore"),D=T([r],([t],e)=>{e(k(JSON.stringify(t),!0))}),B=t=>{let e;try{const a=A(t);console.log(`Trying to load state: ${a}`),e=JSON.parse(a);const o=typeof e.mermaid=="string"?JSON.parse(e.mermaid):e.mermaid;o.securityLevel&&o.securityLevel!=="strict"&&confirm(`Removing "securityLevel":"${o.securityLevel}" from the config for safety.
Click Cancel if you trust the source of this Diagram.`)&&delete o.securityLevel,e.mermaid=JSON.stringify(o,null,2)}catch(a){t&&console.error("Init error",a),e=l(r),console.log(e)}y(i(s({},e),{updateEditor:!0}))},y=t=>{r.update(e=>s(s({},e),t))};let S=!1;const G=(t,e,a=!1)=>{if(E(t),(t.match(/\n/g)||"").length+1>50&&!S&&l(r).autoSync){const c=confirm("Long diagram detected. Turn off Auto Sync? Click the sync logo to manually sync.");S=!0,c&&y({autoSync:!1})}r.update(c=>i(s({},c),{code:t,updateEditor:e,updateDiagram:a}))},U=(t,e)=>{r.update(a=>i(s({},a),{mermaid:t,updateEditor:e}))},V=t=>{r.update(e=>{const a=JSON.parse(e.mermaid);return(!a.theme||["dark","default"].includes(a.theme))&&(a.theme=t?"dark":"default"),i(s({},e),{mermaid:JSON.stringify(a,null,2),updateEditor:!0})})},x=()=>{D.subscribe(t=>{history.replaceState(void 0,void 0,`#${t}`)})},F=()=>JSON.stringify(l(r));export{n as a,D as b,r as c,U as d,w as e,y as f,F as g,x as h,R as i,$ as j,B as k,g as l,V as t,G as u};
+1 -1
View File
@@ -1 +1 @@
import{J as e,K as s,C as t}from"./vendor-96614ef2.js";const a=e(t({isDark:!1}),s(),"themeStore"),o=["dark","synthwave","halloween","aqua","forest","luxury","black","dracula"],r=e=>{e.includes(" ")&&(e=e.split(" ")[1].trim());const s=o.includes(e);console.log("Setting theme",e),a.set({theme:e,isDark:s})};export{r as s,a as t};
import{J as e,K as t,C as o}from"./vendor-96614ef2.js";const r=e(o({isDark:!1}),t(),"themeStore"),l=["dark","synthwave","halloween","aqua","forest","luxury","black","dracula"],n=s=>{s.includes(" ")&&(s=s.split(" ")[1].trim());const a=l.includes(s);console.log("Setting theme",s),r.set({theme:s,isDark:a})};export{n as s,r as t};
+1
View File
@@ -0,0 +1 @@
var K=Object.defineProperty,X=Object.defineProperties;var Y=Object.getOwnPropertyDescriptors;var L=Object.getOwnPropertySymbols;var Z=Object.prototype.hasOwnProperty,x=Object.prototype.propertyIsEnumerable;var O=(t,e,a)=>e in t?K(t,e,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[e]=a,_=(t,e)=>{for(var a in e||(e={}))Z.call(e,a)&&O(t,a,e[a]);if(L)for(var a of L(e))x.call(e,a)&&O(t,a,e[a]);return t},w=(t,e)=>X(t,Y(e));import{C as f,S as B,i as Q,s as W,e as j,c as T,a as U,d as S,b as p,Z as m,f as $,E as tt,P as F,I as et,A as at,ab as ot,ac as G,R as N,J as v,K as b,L as st,ad as rt,N as D}from"./vendor-96614ef2.js";import{c as H,e as I,f as R,i as it,h as nt,j as ct,a as lt,k as ut}from"./state-6b35c395.js";const dt=f(void 0);function ft(t){let e,a;return{c(){e=j("div"),a=j("div"),this.h()},l(s){e=T(s,"DIV",{id:!0,class:!0});var o=U(e);a=T(o,"DIV",{id:!0,class:!0}),U(a).forEach(S),o.forEach(S),this.h()},h(){p(a,"id","container"),p(a,"class","flex-1 overflow-auto"),p(e,"id","view"),p(e,"class","p-2 svelte-5ndy2s"),m(e,"error",t[2]),m(e,"outOfSync",t[3])},m(s,o){$(s,e,o),tt(e,a),t[4](a),t[5](e)},p(s,[o]){o&4&&m(e,"error",s[2]),o&8&&m(e,"outOfSync",s[3])},i:F,o:F,d(s){s&&S(e),t[4](null),t[5](null)}}}function pt(t,e,a){let s;et(t,H,i=>a(9,s=i));let o="",u="",r,c,n=!1,l=!1,d=!0;at(()=>{H.subscribe(i=>{try{if(r&&i&&(i.updateDiagram||i.autoSync)){if(i.autoSync||ot(H,s.updateDiagram=!1,s),a(3,l=!1),d=!0,o===i.code&&u===i.mermaid)return;o=i.code,u=i.mermaid;const y=c.parentElement.scrollTop;delete r.dataset.processed,G.initialize(Object.assign({},JSON.parse(i.mermaid))),G.render("graph-div",o,z=>{a(0,r.innerHTML=z,r)}),a(1,c.parentElement.scrollTop=y,c),a(2,n=!1)}else d?d=!1:a(3,l=!0)}catch(y){console.log("view fail",y),a(2,n=!0)}}),dt.subscribe(i=>{typeof i=="undefined"?a(2,n=!1):(a(2,n=!0),console.log("Error: ",i))})});function M(i){N[i?"unshift":"push"](()=>{r=i,a(0,r)})}function q(i){N[i?"unshift":"push"](()=>{c=i,a(1,c)})}return[r,c,n,l,M,q]}class It extends B{constructor(e){super();Q(this,e,pt,ft,W,{})}}const mt=30,E=v(f("manual"),b(),"autoHistoryMode"),g=v(f([]),b(),"autoHistoryStore"),h=v(f([]),b(),"manualHistoryStore"),V=f([]),Et=st([E,g,h,V],([t,e,a,s],o)=>{o(t==="auto"?e:t==="manual"?a:t==="loader"?s:e)}),gt=t=>{if(t.type==="loader"){V.update(e=>[t,...e]);return}if(t.name=rt(2),t.type!=="auto"){h.update(e=>[t,...e]);return}g.update(e=>(e.length===mt&&e.pop(),[t,...e]))},Lt=t=>{(D(E)==="auto"?g:h).update(e=>(D(E)!=="loader"&&(e=e.filter(a=>t&&a.time!=t)),e))},Ot=t=>{const e=D(t?g:h);return e.length>0?JSON.stringify(e[0].state):""},k="code.mmd",A="config.json",ht=t=>k in t,C=async t=>t.truncated?await(await fetch(t.raw_url)).text():t.content,yt=async t=>{const[e,a,s,o]=t.split("github.com").pop().split("/"),{html_url:u,files:r,history:c}=await(await fetch(`https://api.github.com/gists/${s}${o?"/"+o:""}`)).json();if(ht(r)){const n=await C(r[k]);let l;A in r&&(l=await C(r[A]));const d=c[0];return{url:`${u}/${d.version}`,code:n,config:l,author:d.user.login,time:new Date(d.committed_at).getTime(),version:d.version.slice(-7)}}else throw"Invalid gist provided"},P=(t,e=t.url)=>{const a=w(_({},I),{code:t.code,loader:{type:"gist",config:{url:e}}});return t.config&&(a.mermaid=t.config),a},_t=async t=>{try{const[e,a,s,o]=t.split("github.com").pop().split("/"),{history:u}=await(await fetch(`https://api.github.com/gists/${s}${o?"/"+o:""}`)).json(),r=[];for(const n of u){const l=await yt(n.url).catch(()=>{});l&&r.push(l)}if(r.length===0)throw"Invalid gist provided";r.reverse();const c=P(r.slice(-1).pop(),t);for(const n of r)gt({state:P(n),time:n.time,type:"loader",url:n.url,name:`${n.author} v${n.version}`});return c}catch(e){console.error(e)}},J={gist:_t},wt=async()=>{const t=new URLSearchParams(window.location.search);let e=I,a,s,o=!1;const u=t.get("code"),r=t.get("config");if(u&&(a=await(await fetch(u)).text(),o=!0),r?s=await(await fetch(r)).text():s=I.mermaid,a)e={code:a,mermaid:s,loader:{type:"files",config:{codeURL:u,configURL:r}}};else for(const[c,n]of t.entries())if(c in J)try{e=await J[c](n),o=!0;break}catch(l){console.error(l)}o&&R(w(_({},e),{autoSync:!0,updateDiagram:!0,updateEditor:!0}))},St=()=>{ut(window.location.hash.slice(1))},vt=()=>{R({updateDiagram:!0})},jt=async()=>{var t;St(),await it("Loading Gist...",wt().catch(console.error)),vt(),nt(),await ct(),(t=lt)==null||t.page()};export{It as V,Et as a,gt as b,Lt as c,dt as e,Ot as g,E as h,jt as i,V as l,vt as s};
File diff suppressed because one or more lines are too long
+1
View File
@@ -0,0 +1 @@
import{S as y,i as z,s as A,e as E,t as v,c as d,a as b,g as P,d as _,f as u,E as R,h as N,k as S,l as q,n as h,P as C}from"./chunks/vendor-96614ef2.js";function H(r){let f,t=r[1].frame+"",a;return{c(){f=E("pre"),a=v(t)},l(l){f=d(l,"PRE",{});var s=b(f);a=P(s,t),s.forEach(_)},m(l,s){u(l,f,s),R(f,a)},p(l,s){s&2&&t!==(t=l[1].frame+"")&&N(a,t)},d(l){l&&_(f)}}}function w(r){let f,t=r[1].stack+"",a;return{c(){f=E("pre"),a=v(t)},l(l){f=d(l,"PRE",{});var s=b(f);a=P(s,t),s.forEach(_)},m(l,s){u(l,f,s),R(f,a)},p(l,s){s&2&&t!==(t=l[1].stack+"")&&N(a,t)},d(l){l&&_(f)}}}function B(r){let f,t,a,l,s=r[1].message+"",c,k,m,p,i=r[1].frame&&H(r),n=r[1].stack&&w(r);return{c(){f=E("h1"),t=v(r[0]),a=S(),l=E("pre"),c=v(s),k=S(),i&&i.c(),m=S(),n&&n.c(),p=q()},l(e){f=d(e,"H1",{});var o=b(f);t=P(o,r[0]),o.forEach(_),a=h(e),l=d(e,"PRE",{});var j=b(l);c=P(j,s),j.forEach(_),k=h(e),i&&i.l(e),m=h(e),n&&n.l(e),p=q()},m(e,o){u(e,f,o),R(f,t),u(e,a,o),u(e,l,o),R(l,c),u(e,k,o),i&&i.m(e,o),u(e,m,o),n&&n.m(e,o),u(e,p,o)},p(e,[o]){o&1&&N(t,e[0]),o&2&&s!==(s=e[1].message+"")&&N(c,s),e[1].frame?i?i.p(e,o):(i=H(e),i.c(),i.m(m.parentNode,m)):i&&(i.d(1),i=null),e[1].stack?n?n.p(e,o):(n=w(e),n.c(),n.m(p.parentNode,p)):n&&(n.d(1),n=null)},i:C,o:C,d(e){e&&_(f),e&&_(a),e&&_(l),e&&_(k),i&&i.d(e),e&&_(m),n&&n.d(e),e&&_(p)}}}function G({error:r,status:f}){return{props:{error:r,status:f}}}function D(r,f,t){let{status:a}=f,{error:l}=f;return r.$$set=s=>{"status"in s&&t(0,a=s.status),"error"in s&&t(1,l=s.error)},[a,l]}class I extends y{constructor(f){super();z(this,f,D,B,A,{status:0,error:1})}}export{I as default,G as load};
+1
View File
@@ -0,0 +1 @@
import{S as I,i as w,s as M,D as V,e as u,k as b,t as $,c as m,a as d,d as f,n as k,g as A,b as p,f as v,E as _,h as N,l as y,F as T,G as W,H as q,x,u as z,I as S,A as B}from"../chunks/vendor-96614ef2.js";import{b as j}from"../chunks/paths-28a87002.js";import{l as C,t as F}from"../chunks/state-6b35c395.js";import{t as D,s as G}from"../chunks/theme-c12e07c0.js";import"../chunks/preload-helper-1db36302.js";function E(n){let o,i,l,r,c,s=n[0].message+"",t;return{c(){o=u("div"),i=u("div"),l=u("div"),r=b(),c=u("div"),t=$(s),this.h()},l(e){o=m(e,"DIV",{class:!0});var a=d(o);i=m(a,"DIV",{class:!0});var h=d(i);l=m(h,"DIV",{class:!0}),d(l).forEach(f),r=k(h),c=m(h,"DIV",{});var g=d(c);t=A(g,s),g.forEach(f),h.forEach(f),a.forEach(f),this.h()},h(){p(l,"class","loader mx-auto svelte-1ub1m40"),p(i,"class","text-indigo-100 text-4xl font-bold my-auto"),p(o,"class","w-screen h-screen z-50 absolute left-0 top-0 bg-gray-600 opacity-50 flex align-middle justify-center")},m(e,a){v(e,o,a),_(o,i),_(i,l),_(i,r),_(i,c),_(c,t)},p(e,a){a&1&&s!==(s=e[0].message+"")&&N(t,s)},d(e){e&&f(o)}}}function H(n){let o,i,l,r;const c=n[2].default,s=V(c,n,n[1],null);let t=n[0].loading&&E(n);return{c(){o=u("main"),s&&s.c(),i=b(),t&&t.c(),l=y(),this.h()},l(e){o=m(e,"MAIN",{class:!0});var a=d(o);s&&s.l(a),a.forEach(f),i=k(e),t&&t.l(e),l=y(),this.h()},h(){p(o,"class","h-screen text-primary-content")},m(e,a){v(e,o,a),s&&s.m(o,null),v(e,i,a),t&&t.m(e,a),v(e,l,a),r=!0},p(e,[a]){s&&s.p&&(!r||a&2)&&T(s,c,e,e[1],r?q(c,e[1],a,null):W(e[1]),null),e[0].loading?t?t.p(e,a):(t=E(e),t.c(),t.m(l.parentNode,l)):t&&(t.d(1),t=null)},i(e){r||(x(s,e),r=!0)},o(e){z(s,e),r=!1},d(e){e&&f(o),s&&s.d(e),e&&f(i),t&&t.d(e),e&&f(l)}}}function R(n,o,i){let l,r;S(n,D,t=>i(3,l=t)),S(n,C,t=>i(0,r=t));let{$$slots:c={},$$scope:s}=o;return B(()=>{"serviceWorker"in navigator&&navigator.serviceWorker.register(`${j}/service-worker.js`,{scope:`${j}/`}).then(function(e){console.log("Registration successful, scope is:",e.scope)}).catch(function(e){console.log("Service worker registration failed, error:",e)});const t=window.matchMedia("(prefers-color-scheme: dark)").matches;l.theme===void 0&&G(t?"dark":"light"),D.subscribe(({theme:e,isDark:a})=>{e&&(document.getElementsByTagName("html")[0].setAttribute("data-theme",e),F(a))})}),n.$$set=t=>{"$$scope"in t&&i(1,s=t.$$scope)},[r,s,c]}class Q extends I{constructor(o){super();w(this,o,R,H,M,{})}}export{Q as default};
File diff suppressed because one or more lines are too long
+1
View File
@@ -0,0 +1 @@
import{S as n,i as e,s as a,A as r}from"../chunks/vendor-96614ef2.js";import{r as i}from"../chunks/singletons-12a22614.js";import{b as u}from"../chunks/paths-28a87002.js";const c=i,l=f;async function f(s,t){return c.goto(s,t,[])}function h(s){return r(async()=>{const t=window.location.hash.split("/");let o="edit";t.length>2&&(o=`${t[1]}#${t[2]}`),await l(`${u}/${o}`,{replaceState:!0})}),[]}class d extends n{constructor(t){super();e(this,t,h,null,a,{})}}export{d as default};
+1
View File
@@ -0,0 +1 @@
import{S as r,i as a,s as i,j as c,m as u,o as m,P as f,x as p,u as l,v as _,A as $}from"../chunks/vendor-96614ef2.js";import{V as d,i as h}from"../chunks/util-eb46b741.js";import"../chunks/state-6b35c395.js";import"../chunks/preload-helper-1db36302.js";function g(s){let t,n;return t=new d({}),{c(){c(t.$$.fragment)},l(e){u(t.$$.fragment,e)},m(e,o){m(t,e,o),n=!0},p:f,i(e){n||(p(t.$$.fragment,e),n=!0)},o(e){l(t.$$.fragment,e),n=!1},d(e){_(t,e)}}}function j(s){return $(h),[]}class x extends r{constructor(t){super();a(this,t,j,g,i,{})}}export{x as default};
File diff suppressed because one or more lines are too long
+2 -2
View File
@@ -50,7 +50,7 @@
<link rel="modulepreload" href="/mermaid-live-editor/_app/start-2e82ecbe.js">
<link rel="modulepreload" href="/mermaid-live-editor/_app/start-661f5cf4.js">
<link rel="modulepreload" href="/mermaid-live-editor/_app/chunks/vendor-96614ef2.js">
<link rel="modulepreload" href="/mermaid-live-editor/_app/chunks/preload-helper-1db36302.js">
<link rel="modulepreload" href="/mermaid-live-editor/_app/chunks/singletons-12a22614.js">
@@ -58,7 +58,7 @@
<link rel="stylesheet" href="/mermaid-live-editor/_app/assets/start-464e9d0a.css">
<script type="module">
import { start } from "/mermaid-live-editor/_app/start-2e82ecbe.js";
import { start } from "/mermaid-live-editor/_app/start-661f5cf4.js";
start({
target: document.querySelector("#svelte"),
paths: {"base":"/mermaid-live-editor","assets":""},
+2 -2
View File
@@ -50,7 +50,7 @@
<link rel="modulepreload" href="/mermaid-live-editor/_app/start-2e82ecbe.js">
<link rel="modulepreload" href="/mermaid-live-editor/_app/start-661f5cf4.js">
<link rel="modulepreload" href="/mermaid-live-editor/_app/chunks/vendor-96614ef2.js">
<link rel="modulepreload" href="/mermaid-live-editor/_app/chunks/preload-helper-1db36302.js">
<link rel="modulepreload" href="/mermaid-live-editor/_app/chunks/singletons-12a22614.js">
@@ -58,7 +58,7 @@
<link rel="stylesheet" href="/mermaid-live-editor/_app/assets/start-464e9d0a.css">
<script type="module">
import { start } from "/mermaid-live-editor/_app/start-2e82ecbe.js";
import { start } from "/mermaid-live-editor/_app/start-661f5cf4.js";
start({
target: document.querySelector("#svelte"),
paths: {"base":"/mermaid-live-editor","assets":""},
+2 -2
View File
@@ -50,7 +50,7 @@
<link rel="modulepreload" href="/mermaid-live-editor/_app/start-2e82ecbe.js">
<link rel="modulepreload" href="/mermaid-live-editor/_app/start-661f5cf4.js">
<link rel="modulepreload" href="/mermaid-live-editor/_app/chunks/vendor-96614ef2.js">
<link rel="modulepreload" href="/mermaid-live-editor/_app/chunks/preload-helper-1db36302.js">
<link rel="modulepreload" href="/mermaid-live-editor/_app/chunks/singletons-12a22614.js">
@@ -58,7 +58,7 @@
<link rel="stylesheet" href="/mermaid-live-editor/_app/assets/start-464e9d0a.css">
<script type="module">
import { start } from "/mermaid-live-editor/_app/start-2e82ecbe.js";
import { start } from "/mermaid-live-editor/_app/start-661f5cf4.js";
start({
target: document.querySelector("#svelte"),
paths: {"base":"/mermaid-live-editor","assets":""},