diff --git a/_app/pages/edit.svelte-7f5a1dd8.js b/_app/pages/edit.svelte-7f5a1dd8.js new file mode 100644 index 00000000..0b605b7c --- /dev/null +++ b/_app/pages/edit.svelte-7f5a1dd8.js @@ -0,0 +1 @@ +var e,t=Object.defineProperty,a=Object.defineProperties,n=Object.getOwnPropertyDescriptors,s=Object.getOwnPropertySymbols,r=Object.prototype.hasOwnProperty,i=Object.prototype.propertyIsEnumerable,o=(e,a,n)=>a in e?t(e,a,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[a]=n,l=(e,t)=>{for(var a in t||(t={}))r.call(t,a)&&o(e,a,t[a]);if(s)for(var a of s(t))i.call(t,a)&&o(e,a,t[a]);return e};import{S as c,i as d,s as m,e as u,c as h,a as f,d as p,b as g,f as b,P as v,I as y,Q as w,A as $,R as k,t as x,k as E,g as I,n as D,E as T,T as C,U as S,V as A,W as K,X as O,j as R,m as j,o as L,x as N,u as B,v as V,Y as M,Z as _,_ as P,h as G,$ as U,a0 as q,a1 as z,r as H,w as Z,a2 as Y,D as J,F,G as W,H as X,a3 as Q,a4 as ee,a5 as te,M as ae,a6 as ne,a7 as se,a8 as re,a9 as ie,l as oe,aa as le,ab as ce,ac as de}from"../chunks/vendor-58c10135.js";import{c as me,a as ue,u as he,b as fe,g as pe,d as ge}from"../chunks/state-192747cd.js";import{t as be,s as ve}from"../chunks/theme-32ab91e2.js";import{h as ye,a as we,l as $e,g as ke,b as xe,c as Ee,V as Ie,e as De,i as Te,s as Ce}from"../chunks/util-134b5ae1.js";import{b as Se}from"../chunks/paths-28a87002.js";import"../chunks/preload-helper-1db36302.js";const Ae=e=>{e.languages.register({id:"mermaid"});const t=["requirement","functionalRequirement","interfaceRequirement","performanceRequirement","physicalRequirement","designConstraint"],s={flowchart:{typeKeywords:["flowchart","flowchart-v2","graph"],blockKeywords:["subgraph","end"],keywords:["TB","TD","BT","RL","LR","click","call","href","_self","_blank","_parent","_top","linkStyle","style","classDef","class","direction","interpolate"]},sequenceDiagram:{typeKeywords:["sequenceDiagram"],blockKeywords:["alt","par","and","loop","else","end","rect","opt","alt","rect"],keywords:["participant","as","Note","note","right of","left of","over","activate","deactivate","autonumber","title"]},classDiagram:{typeKeywords:["classDiagram","classDiagram-v2"],blockKeywords:["class"],keywords:["link","click","callback","call","href","cssClass","direction","TB","BT","RL","LR"]},stateDiagram:{typeKeywords:["stateDiagram","stateDiagram-v2"],blockKeywords:["state","note","end"],keywords:["state","as","hide empty description","direction","TB","BT","RL","LR"]},erDiagram:{typeKeywords:["erDiagram"],blockKeywords:[],keywords:[]},journey:{typeKeywords:["journey"],blockKeywords:["section"],keywords:["title"]},info:{typeKeywords:["info"],blockKeywords:[],keywords:["showInfo"]},gantt:{typeKeywords:["gantt"],blockKeywords:[],keywords:["title","dateFormat","axisFormat","todayMarker","section","excludes","inclusiveEndDates"]},requirementDiagram:{typeKeywords:["requirement","requirementDiagram"],blockKeywords:t.concat("element"),keywords:[]},gitGraph:{typeKeywords:["gitGraph"],blockKeywords:[],keywords:["commit","branch","merge","reset","checkout","LR","BT"]},pie:{typeKeywords:["pie"],blockKeywords:[],keywords:["title","showData"]}};var r;e.languages.setMonarchTokensProvider("mermaid",(r=l({},Object.entries(s).map((e=>Object.fromEntries(Object.entries(e[1]).map((t=>[e[0]+t[0][0].toUpperCase()+t[0].slice(1),t[1]]))))).reduce(((e,t)=>l(l({},e),t)),{})),a(r,n({tokenizer:{root:[[/%%(?=.*%%$)/,{token:"string",nextEmbedded:"json"}],[/%%$/,{token:"string",nextEmbedded:"@pop"}],[/^\s*gitGraph/m,"typeKeyword","gitGraph"],[/^\s*info/m,"typeKeyword","info"],[/^\s*pie/m,"typeKeyword","pie"],[/^\s*(flowchart|flowchart-v2|graph)/m,"typeKeyword","flowchart"],[/^\s*sequenceDiagram/,"typeKeyword","sequenceDiagram"],[/^\s*classDiagram(-v2)?/,"typeKeyword","classDiagram"],[/^\s*journey/,"typeKeyword","journey"],[/^\s*gantt/,"typeKeyword","gantt"],[/^\s*stateDiagram(-v2)?/,"typeKeyword","stateDiagram"],[/^\s*erDiagram/,"typeKeyword","erDiagram"],[/^\s*requirement(Diagram)?/,"typeKeyword","requirementDiagram"],[/%%[^$]([^%]*(?!%%$)%?)*$/,"comment"]],gitGraph:[[/option(?=s)/,{token:"typeKeyword",next:"optionsGitGraph"}],[/(^\s*branch|reset|merge|checkout)(.*$)/,["keyword","variable"]],[/[a-zA-Z][\w$]*/,{cases:{"@gitGraphBlockKeywords":"typeKeyword","@gitGraphKeywords":"keyword"}}],[/%%[^$]([^%]*(?!%%$)%?)*$/,"comment"],[/".*?"/,"string"],[/\^/,"delimiter.bracket"]],optionsGitGraph:[[/s$/,{token:"typeKeyword",nextEmbedded:"json",matchOnlyAtLineStart:!1}],["end",{token:"typeKeyword",next:"@pop",nextEmbedded:"@pop"}]],info:[[/[a-zA-Z][\w$]*/,{cases:{"@infoBlockKeywords":"typeKeyword","@infoKeywords":"keyword"}}]],pie:[[/(title)(.*$)/,["keyword","string"]],[/[a-zA-Z][\w$]*/,{cases:{"@pieBlockKeywords":"typeKeyword","@pieKeywords":"keyword"}}],[/".*?"/,"string"],[/\s*\d+/,"number"],[/:/,"delimiter.bracket"],[/%%[^$]([^%]*(?!%%$)%?)*$/,"comment"]],flowchart:[[/[ox]?(--+|==+)[ox]/,"transition"],[/[a-zA-Z][\w$]*/,{cases:{"@flowchartBlockKeywords":"typeKeyword","@flowchartKeywords":"keyword","@default":"variable"}}],[/\|+.+?\|+/,"string"],[/\[+(\\.+?[\\/]|\/.+?[/\\])\]+/,"string"],[/[[>]+[^\]|[]+?\]+/,"string"],[/{+.+?}+/,"string"],[/\(+.+?\)+/,"string"],[/-\.+->?/,"transition"],[/(-[-.])([^->]+?)(-{3,}|-{2,}>|\.-+>)/,["transition","string","transition"]],[/(==+)([^=]+?)(={3,}|={2,}>)/,["transition","string","transition"]],[/|===+|---+/,"transition"],[/:::/,"transition"],[/[;&]/,"delimiter.bracket"],[/".*?"/,"string"],[/%%[^$]([^%]*(?!%%$)%?)*$/,"comment"]],sequenceDiagram:[[/[a-zA-Z][\w$]*/,{cases:{"@sequenceDiagramBlockKeywords":"typeKeyword","@sequenceDiagramKeywords":"keyword","@default":"variable"}}],[/(--?>?>|--?[)x])[+-]?/,"transition"],[/(:)([^:\n]*?$)/,["delimiter.bracket","string"]],[/%%[^$]([^%]*(?!%%$)%?)*$/,"comment"]],classDiagram:[[/(?!class\s)([a-zA-Z]+)(\s+[a-zA-Z]+)/,["type","variable"]],[/(\*|<\|?|o)?(--|\.\.)(\*|\|?>|o)?/,"transition"],[/^\s*class\s(?!.*\{)/,"keyword"],[/[a-zA-Z][\w$]*/,{cases:{"@classDiagramBlockKeywords":"typeKeyword","@classDiagramKeywords":"keyword","@default":"variable"}}],[/%%[^$]([^%]*(?!%%$)%?)*$/,"comment"],[/(<<)(.+?)(>>)/,["delimiter.bracket","annotation","delimiter.bracket"]],[/".*?"/,"string"],[/:::/,"transition"],[/:|\+|-|#|~|\*\s*$|\$\s*$|\(|\)|{|}/,"delimiter.bracket"]],journey:[[/(title)(.*)/,["keyword","string"]],[/(section)(.*)/,["typeKeyword","string"]],[/[a-zA-Z][\w$]*/,{cases:{"@journeyBlockKeywords":"typeKeyword","@journeyKeywords":"keyword","@default":"variable"}}],[/(^\s*.+?)(:)(.*?)(:)(.*?)([,$])/,["string","delimiter.bracket","number","delimiter.bracket","variable","delimiter.bracket"]],[/,/,"delimiter.bracket"],[/(^\s*.+?)(:)([^:]*?)$/,["string","delimiter.bracket","variable"]],[/%%[^$]([^%]*(?!%%$)%?)*$/,"comment"]],gantt:[[/(title)(.*)/,["keyword","string"]],[/(section)(.*)/,["typeKeyword","string"]],[/[a-zA-Z][\w$]*/,{cases:{"@ganttBlockKeywords":"typeKeyword","@ganttKeywords":"keyword"}}],[/(^\s*.*?)(:)/,["string","delimiter.bracket"]],[/%%[^$]([^%]*(?!%%$)%?)*$/,"comment"],[/:/,"delimiter.bracket"]],stateDiagram:[[/note[^:]*$/,{token:"typeKeyword",next:"stateDiagramNote"}],["hide empty description","keyword"],[/^\s*state\s(?!.*\{)/,"keyword"],[/(<<)(fork|join|choice)(>>)/,"annotation"],[/(\[\[)(fork|join|choice)(]])/,["delimiter.bracket","annotation","delimiter.bracket"]],[/[a-zA-Z][\w$]*/,{cases:{"@stateDiagramBlockKeywords":"typeKeyword","@stateDiagramKeywords":"keyword","@default":"variable"}}],[/".*?"/,"string"],[/(:)([^:\n]*?$)/,["delimiter.bracket","string"]],[/{|}/,"delimiter.bracket"],[/%%[^$]([^%]*(?!%%$)%?)*$/,"comment"],[/-->/,"transition"],[/\[.*?]/,"string"]],stateDiagramNote:[[/^\s*end note$/,{token:"typeKeyword",next:"@pop"}],[/.*/,"string"]],erDiagram:[[/[}|][o|](--|\.\.)[o|][{|]/,"transition"],[/".*?"/,"string"],[/(:)(.*?$)/,["delimiter.bracket","string"]],[/:|{|}/,"delimiter.bracket"],[/([a-zA-Z]+)(\s+[a-zA-Z]+)/,["type","variable"]],[/%%[^$]([^%]*(?!%%$)%?)*$/,"comment"],[/[a-zA-Z_-][\w$]*/,"variable"]],requirementDiagram:[[/->|<-|-/,"transition"],[/(\d+\.)*\d+/,"number"],[/[a-zA-Z_-][\w$]*/,{cases:{"@requirementDiagramBlockKeywords":"typeKeyword","@default":"variable"}}],[/:|{|}|\//,"delimiter.bracket"],[/%%[^$]([^%]*(?!%%$)%?)*$/,"comment"],[/".*?"/,"string"]]}})))),e.editor.defineTheme("mermaid-dark",{base:"vs-dark",inherit:!0,rules:[{token:"typeKeyword",foreground:"9650c8",fontStyle:"bold"},{token:"transition",foreground:"008800",fontStyle:"bold"}]}),e.editor.defineTheme("mermaid",{base:"vs",inherit:!0,rules:[{token:"typeKeyword",foreground:"9650c8",fontStyle:"bold"},{token:"keyword",foreground:"649696"},{token:"custom-error",foreground:"ff0000",fontStyle:"bold"},{token:"string",foreground:"AA8500"},{token:"transition",foreground:"008800",fontStyle:"bold"},{token:"delimiter.bracket",foreground:"000000",fontStyle:"bold"},{token:"annotation",foreground:"4b4b96"},{token:"number",foreground:"4b4b96"},{token:"comment",foreground:"888c89"},{token:"variable",foreground:"A22889"},{token:"type",foreground:"2BDEA8"}]}),e.languages.registerCompletionItemProvider("mermaid",{provideCompletionItems:()=>({suggestions:[{label:"loop",kind:e.languages.CompletionItemKind.Snippet,insertText:["loop ${1:Loop text}","\t$0","end"].join("\n"),insertTextRules:e.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"Sequence Diagram Loops"},{label:"alt",kind:e.languages.CompletionItemKind.Snippet,insertText:["alt ${1:Describing text}","\t$0","else","\t","end"].join("\n"),insertTextRules:e.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"Alternative Path"},{label:"opt",kind:e.languages.CompletionItemKind.Snippet,insertText:["opt ${1:Describing text}","\t$0","end"].join("\n"),insertTextRules:e.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"Optional Path"},{label:"par",kind:e.languages.CompletionItemKind.Snippet,insertText:["par ${1:[Action 1]}","\t$0","and ${2:[Action 2]}","\t","and ${3:[Action 3]}","\t","end"].join("\n"),insertTextRules:e.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"Parallel Actions"},{label:"rect",kind:e.languages.CompletionItemKind.Snippet,insertText:["rect ${1:rgb(0, 255, 0)}","\t$0","end"].join("\n"),insertTextRules:e.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"Background Color"},{label:"subgraph",kind:e.languages.CompletionItemKind.Snippet,insertText:["subgraph ${1:title}","\t$0","end"].join("\n"),insertTextRules:e.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"Subgraph"},{label:"class",kind:e.languages.CompletionItemKind.Snippet,insertText:["class ${1:className} {","\t$0","}"].join("\n"),insertTextRules:e.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"Class"},{label:"state",kind:e.languages.CompletionItemKind.Snippet,insertText:["state ${1:stateName} {","\t$0","}"].join("\n"),insertTextRules:e.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"State"},{label:"note",kind:e.languages.CompletionItemKind.Snippet,insertText:["note ${1:right of State1}","\t$0","end note"].join("\n"),insertTextRules:e.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"State"},{label:"section",kind:e.languages.CompletionItemKind.Snippet,insertText:["section ${1:Go to work}","\t$0"].join("\n"),insertTextRules:e.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"User-journey Section"},{label:"element",kind:e.languages.CompletionItemKind.Snippet,insertText:["element ${1:test_entity} {","\t$0","}"].join("\n"),insertTextRules:e.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"User-journey Section"},{label:"options",kind:e.languages.CompletionItemKind.Snippet,insertText:["options","{"," $0","}","end"].join("\n"),insertTextRules:e.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"Git Graph Options"},...t.map((t=>({label:t,kind:e.languages.CompletionItemKind.Snippet,insertText:[t+" ${1:test_req} {","\tid: 1","\ttext: the test text.","\trisk: high","\tverifyMethod: test","}"].join("\n"),insertTextRules:e.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:t.split(/(?=[A-Z])/).map((e=>e[0].toUpperCase()+e.slice(1))).join(" ")}))),...[...new Set(Object.values(s).map((e=>Object.entries(e).filter((e=>"annotations"!==e[0])).map((e=>e[1])))).flat(2))].map((t=>({label:t,kind:e.languages.CompletionItemKind.Keyword,insertText:t})))]})}),e.languages.setLanguageConfiguration("mermaid",{autoClosingPairs:[{open:"(",close:")"},{open:"{",close:"}"},{open:"[",close:"]"}],brackets:[["(",")"],["{","}"],["[","]"]]})};function Ke(e){let t;return{c(){t=u("div"),this.h()},l(e){t=h(e,"DIV",{id:!0,class:!0}),f(t).forEach(p),this.h()},h(){g(t,"id","editor"),g(t,"class","overflow-hidden")},m(a,n){b(a,t,n),e[9](t)},p:v,i:v,o:v,d(a){a&&p(t),e[9](null)}}}function Oe(e,t,a){let n,s;y(e,be,(e=>a(10,n=e))),y(e,me,(e=>a(8,s=e)));var r=this&&this.__awaiter||function(e,t,a,n){return new(a||(a=Promise))((function(s,r){function i(e){try{l(n.next(e))}catch(t){r(t)}}function o(e){try{l(n.throw(e))}catch(t){r(t)}}function l(e){var t;e.done?s(e.value):(t=e.value,t instanceof a?t:new a((function(e){e(t)}))).then(i,o)}l((n=n.apply(e,t||[])).next())}))};let i,o,l=null,{text:c}=t,{language:d}=t,{editorOptions:m={value:c,language:d,minimap:{enabled:!1},theme:"mermaid",overviewRulerLanes:0}}=t,{errorMarkers:u=[]}=t,h=c;be.subscribe((({isDark:e})=>{i&&(null==o||o.editor.setTheme(e?"mermaid-dark":"mermaid"))}));const f=w();return $((()=>r(void 0,void 0,void 0,(function*(){try{a(6,o=monaco)}catch(e){yield r(void 0,void 0,void 0,(function*(){let e=0;for(;e++<10;)try{return void a(6,o=monaco)}catch(t){yield new Promise((e=>setTimeout(e,500)))}alert("Loading Monaco Editor failed. Please try refreshing the page.")}))}Ae(o),a(5,i=o.editor.create(l,m)),i.onDidChangeModelContent((()=>{a(1,c=i.getValue()),f("update",{text:c})})),null==o||o.editor.setTheme(n.isDark?"mermaid-dark":"mermaid");return new ResizeObserver((e=>{i.layout({height:e[0].contentRect.height,width:e[0].contentRect.width})})).observe(l.parentElement),()=>{i.dispose()}})))),e.$$set=e=>{"text"in e&&a(1,c=e.text),"language"in e&&a(2,d=e.language),"editorOptions"in e&&a(3,m=e.editorOptions),"errorMarkers"in e&&a(4,u=e.errorMarkers)},e.$$.update=()=>{100&e.$$.dirty&&i&&(null==o||o.editor.setModelLanguage(i.getModel(),d)),498&e.$$.dirty&&(c!==h&&(s.updateEditor&&(null==i||i.setValue(c)),a(7,h=c)),i&&(null==o||o.editor.setModelMarkers(i.getModel(),"test",u)))},[l,c,d,m,u,i,o,h,s,function(e){k[e?"unshift":"push"]((()=>{l=e,a(0,l)}))}]}class Re extends c{constructor(e){super(),d(this,e,Oe,Ke,m,{text:1,language:2,editorOptions:3,errorMarkers:4})}}function je(e,t,a){const n=e.slice();return n[3]=t[a],n}function Le(e){let t,a,n,s,r,i,o,l=e[3]+"";function c(){return e[2](e[3])}return{c(){t=u("li"),a=u("span"),n=x(l),s=E(),this.h()},l(e){t=h(e,"LI",{class:!0});var r=f(t);a=h(r,"SPAN",{class:!0});var i=f(a);n=I(i,l),i.forEach(p),s=D(r),r.forEach(p),this.h()},h(){g(a,"class","btn btn-ghost justify-start"),g(t,"class",r=e[3].includes(e[0].theme)?"bordered":"")},m(e,r){b(e,t,r),T(t,a),T(a,n),T(t,s),i||(o=C(a,"click",c),i=!0)},p(a,n){e=a,1&n&&r!==(r=e[3].includes(e[0].theme)?"bordered":"")&&g(t,"class",r)},d(e){e&&p(t),i=!1,o()}}}function Ne(e){let t,a,n,s,r,i,o,l,c,d,m,y,w,$=e[1],k=[];for(let u=0;u<$.length;u+=1)k[u]=Le(je(e,$,u));return{c(){t=u("div"),a=u("div"),n=S("svg"),s=S("path"),r=E(),i=u("span"),o=x("Change Theme"),l=E(),c=S("svg"),d=S("path"),m=E(),y=u("div"),w=u("ul");for(let e=0;ea(0,n=e)));return[n,["🌝  light","🌚  dark","🧁  cupcake","🐝  bumblebee","✳️  emerald","🏢  corporate","🌃  synthwave","👴  retro","🤖  cyberpunk","🌸  valentine","🎃  halloween","🌷  garden","🌲  forest","🐟  aqua","👓  lofi","🖍  pastel","🧚‍♀️  fantasy","📝  wireframe","🏴  black","💎  luxury","🧛‍♂️  dracula"],e=>ve(e)]}class Ve extends c{constructor(e){super(),d(this,e,Be,Ne,m,{})}}function Me(e,t,a){const n=e.slice();return n[1]=t[a].title,n[2]=t[a].href,n[3]=t[a].icon,n}function _e(e){let t,a,n,s,r,i,o=e[1]+"",l=e[3]&&function(e){let t,a;return{c(){t=u("i"),this.h()},l(e){t=h(e,"I",{class:!0}),f(t).forEach(p),this.h()},h(){g(t,"class",a=M(e[3])+" svelte-1163kmr")},m(e,a){b(e,t,a)},p:v,d(e){e&&p(t)}}}(e);return{c(){t=u("li"),a=u("a"),l&&l.c(),n=E(),s=x(o),i=E(),this.h()},l(e){t=h(e,"LI",{});var r=f(t);a=h(r,"A",{class:!0,target:!0,href:!0});var c=f(a);l&&l.l(c),n=D(c),s=I(c,o),c.forEach(p),i=D(r),r.forEach(p),this.h()},h(){g(a,"class","btn btn-ghost"),g(a,"target","_blank"),g(a,"href",r=e[2])},m(e,r){b(e,t,r),T(t,a),l&&l.m(a,null),T(a,n),T(a,s),T(t,i)},p(e,t){e[3]&&l.p(e,t)},d(e){e&&p(t),l&&l.d()}}}function Pe(e){let t,a,n,s,r,i,o,l,c,d,m,v,y,w,$,k,C,M,_,P,G,U,q;_=new Ve({});let z=e[0],H=[];for(let u=0;u{a||(a=q(t,z,{},!0)),a.run(1)})),n=!0)},o(e){a||(a=q(t,z,{},!1)),a.run(0),n=!1},d(e){e&&p(t),K(r,e),e&&a&&a.end()}}}function Ze(e){let t,a,n,s,r,i,o,l,c,d=e[10].title+"";function m(){return e[8](e[10])}return{c(){t=u("div"),a=u("i"),s=E(),r=x(d),i=E(),this.h()},l(e){t=h(e,"DIV",{class:!0});var n=f(t);a=h(n,"I",{class:!0}),f(a).forEach(p),s=D(n),r=I(n,d),i=D(n),n.forEach(p),this.h()},h(){g(a,"class",n="mr-1 "+e[10].icon+" svelte-1qkpo3v"),g(t,"class",o="tab tab-lifted text-primary-content "+(e[4]===e[10].id?"tab-active":""))},m(e,n){b(e,t,n),T(t,a),T(t,s),T(t,r),T(t,i),l||(c=C(t,"click",P(m)),l=!0)},p(s,i){e=s,4&i&&n!==(n="mr-1 "+e[10].icon+" svelte-1qkpo3v")&&g(a,"class",n),4&i&&d!==(d=e[10].title+"")&&G(r,d),20&i&&o!==(o="tab tab-lifted text-primary-content "+(e[4]===e[10].id?"tab-active":""))&&g(t,"class",o)},d(e){e&&p(t),l=!1,c()}}}function Ye(e){let t,a,n,s,r,i,o,l,c=e[1]&&ze(e),d=e[0]&&e[2]&&He(e);return{c(){t=u("div"),a=u("span"),c&&c.c(),n=E(),s=x(e[3]),r=E(),d&&d.c(),this.h()},l(i){t=h(i,"DIV",{class:!0});var o=f(t);a=h(o,"SPAN",{class:!0});var l=f(a);c&&c.l(l),n=D(l),s=I(l,e[3]),l.forEach(p),r=D(o),d&&d.l(o),o.forEach(p),this.h()},h(){g(a,"class","mr-2 font-semibold"),g(t,"class","flex cursor-default")},m(m,u){b(m,t,u),T(t,a),c&&c.m(a,null),T(a,n),T(a,s),T(t,r),d&&d.m(t,null),i=!0,o||(l=C(a,"click",P(e[7])),o=!0)},p(e,[r]){e[1]?c?c.p(e,r):(c=ze(e),c.c(),c.m(a,n)):c&&(c.d(1),c=null),(!i||8&r)&&G(s,e[3]),e[0]&&e[2]?d?(d.p(e,r),5&r&&N(d,1)):(d=He(e),d.c(),N(d,1),d.m(t,null)):d&&(H(),B(d,1,1,(()=>{d=null})),Z())},i(e){i||(N(d),i=!0)},o(e){B(d),i=!1},d(e){e&&p(t),c&&c.d(),d&&d.d(),o=!1,l()}}}function Je(e,t,a){let n;var s;let{isCloseable:r=!0}=t,{tabs:i=[]}=t,{title:o}=t,{isOpen:l=!1}=t;const c=w(),d=e=>{a(4,n=e.id),c("select",e)};return e.$$set=e=>{"isCloseable"in e&&a(1,r=e.isCloseable),"tabs"in e&&a(2,i=e.tabs),"title"in e&&a(3,o=e.title),"isOpen"in e&&a(0,l=e.isOpen)},e.$$.update=()=>{68&e.$$.dirty&&a(4,n=null===a(6,s=i[0])||void 0===s?void 0:s.id)},[l,r,i,o,n,d,s,()=>a(0,l=!l),e=>d(e)]}class Fe extends c{constructor(e){super(),d(this,e,Je,Ye,m,{isCloseable:1,tabs:2,title:3,isOpen:0})}}const We=e=>({}),Xe=e=>({});function Qe(e){let t,a,n;const s=e[6].default,r=J(s,e,e[5],null);return{c(){t=u("div"),r&&r.c(),this.h()},l(e){t=h(e,"DIV",{class:!0});var a=f(t);r&&r.l(a),a.forEach(p),this.h()},h(){g(t,"class","card-body p-0 flex-grow overflow-auto text-base-content")},m(e,a){b(e,t,a),r&&r.m(t,null),n=!0},p(e,t){r&&r.p&&(!n||32&t)&&F(r,s,e,e[5],n?X(s,e[5],t,null):W(e[5]),null)},i(e){n||(N(r,e),U((()=>{a||(a=q(t,ee,{},!0)),a.run(1)})),n=!0)},o(e){B(r,e),a||(a=q(t,ee,{},!1)),a.run(0),n=!1},d(e){e&&p(t),r&&r.d(e),e&&a&&a.end()}}}function et(e){let t,a,n,s,r,i,o,l,c,d,m,v,y;function w(t){e[7](t)}let $={tabs:e[2],title:e[3],isCloseable:e[1]};void 0!==e[0]&&($.isOpen=e[0]),s=new Fe({props:$}),k.push((()=>Y(s,"isOpen",w))),s.$on("select",e[8]);const x=e[6].actions,I=J(x,e,e[5],Xe);let S=e[0]&&Qe(e);return{c(){t=u("div"),a=u("div"),n=u("div"),R(s.$$.fragment),i=E(),o=u("div"),I&&I.c(),d=E(),S&&S.c(),this.h()},l(e){t=h(e,"DIV",{class:!0});var r=f(t);a=h(r,"DIV",{class:!0});var l=f(a);n=h(l,"DIV",{class:!0});var c=f(n);j(s.$$.fragment,c),i=D(c),o=h(c,"DIV",{class:!0});var m=f(o);I&&I.l(m),m.forEach(p),c.forEach(p),l.forEach(p),d=D(r),S&&S.l(r),r.forEach(p),this.h()},h(){g(o,"class",l="flex gap-x-4 items-center "+(e[4]?"-mt-2":"")),g(n,"class","flex justify-between"),g(a,"class",c="bg-primary p-2 "+(e[4]?"pb-0":"")+" flex-none cursor-pointer"),g(t,"class","card rounded overflow-hidden m-2 flex-grow flex flex-col shadow-2xl")},m(r,l){b(r,t,l),T(t,a),T(a,n),L(s,n,null),T(n,i),T(n,o),I&&I.m(o,null),T(t,d),S&&S.m(t,null),m=!0,v||(y=C(a,"click",e[9]),v=!0)},p(e,[n]){const i={};4&n&&(i.tabs=e[2]),8&n&&(i.title=e[3]),2&n&&(i.isCloseable=e[1]),!r&&1&n&&(r=!0,i.isOpen=e[0],Q((()=>r=!1))),s.$set(i),I&&I.p&&(!m||32&n)&&F(I,x,e,e[5],m?X(x,e[5],n,We):W(e[5]),Xe),(!m||16&n&&l!==(l="flex gap-x-4 items-center "+(e[4]?"-mt-2":"")))&&g(o,"class",l),(!m||16&n&&c!==(c="bg-primary p-2 "+(e[4]?"pb-0":"")+" flex-none cursor-pointer"))&&g(a,"class",c),e[0]?S?(S.p(e,n),1&n&&N(S,1)):(S=Qe(e),S.c(),N(S,1),S.m(t,null)):S&&(H(),B(S,1,1,(()=>{S=null})),Z())},i(e){m||(N(s.$$.fragment,e),N(I,e),N(S),m=!0)},o(e){B(s.$$.fragment,e),B(I,e),B(S),m=!1},d(e){e&&p(t),V(s),I&&I.d(e),S&&S.d(),v=!1,y()}}}function tt(e,t,a){let n,{$$slots:s={},$$scope:r}=t,{isCloseable:i=!0}=t,{isOpen:o=!0}=t,{tabs:l=[]}=t,{title:c}=t;return e.$$set=e=>{"isCloseable"in e&&a(1,i=e.isCloseable),"isOpen"in e&&a(0,o=e.isOpen),"tabs"in e&&a(2,l=e.tabs),"title"in e&&a(3,c=e.title),"$$scope"in e&&a(5,r=e.$$scope)},e.$$.update=()=>{3&e.$$.dirty&&a(0,o=!i||o),5&e.$$.dirty&&a(4,n=o&&l.length>0)},[o,i,l,c,n,r,s,function(e){o=e,a(0,o),a(1,i)},function(t){te.call(this,e,t)},()=>a(0,o=!o)]}class at extends c{constructor(e){super(),d(this,e,tt,et,m,{isCloseable:1,isOpen:0,tabs:2,title:3})}}function nt(e,t,a){const n=e.slice();return n[3]=t[a],n}function st(e){let t,a,n,s,r=e[3]+"";function i(){return e[2](e[3])}return{c(){t=u("button"),a=x(r),this.h()},l(e){t=h(e,"BUTTON",{class:!0});var n=f(t);a=I(n,r),n.forEach(p),this.h()},h(){g(t,"class","btn btn-primary normal-case btn-sm")},m(e,r){b(e,t,r),T(t,a),n||(s=C(t,"click",i),n=!0)},p(t,a){e=t},d(e){e&&p(t),n=!1,s()}}}function rt(e){let t,a=Object.keys(e[0]),n=[];for(let s=0;s>+John: Hello John, how are you?\n Alice->>+John: John, can you hear me?\n John--\x3e>-Alice: Hi Alice, I can hear you!\n John--\x3e>-Alice: I feel great!\n ","Class Diagram":"classDiagram\n Animal <|-- Duck\n Animal <|-- Fish\n Animal <|-- Zebra\n Animal : +int age\n Animal : +String gender\n Animal: +isMammal()\n Animal: +mate()\n class Duck{\n +String beakColor\n +swim()\n +quack()\n }\n class Fish{\n -int sizeInFeet\n -canEat()\n }\n class Zebra{\n +bool is_wild\n +run()\n }\n ","State Diagram":"stateDiagram-v2\n [*] --\x3e Still\n Still --\x3e [*]\n Still --\x3e Moving\n Moving --\x3e Still\n Moving --\x3e Crash\n Crash --\x3e [*]\n ","Gantt Chart":"gantt\n title A Gantt Diagram\n dateFormat YYYY-MM-DD\n section Section\n A task :a1, 2014-01-01, 30d\n Another task :after a1 , 20d\n section Another\n Task in sec :2014-01-12 , 12d\n another task : 24d\n ","Pie Chart":'pie title Pets adopted by volunteers\n "Dogs" : 386\n "Cats" : 85\n "Rats" : 15\n ',"ER Diagram":'erDiagram\n CUSTOMER }|..|{ DELIVERY-ADDRESS : has\n CUSTOMER ||--o{ ORDER : places\n CUSTOMER ||--o{ INVOICE : "liable for"\n DELIVERY-ADDRESS ||--o{ ORDER : receives\n INVOICE ||--|{ ORDER : covers\n ORDER ||--|{ ORDER-ITEM : includes\n PRODUCT-CATEGORY ||--|{ PRODUCT : contains\n PRODUCT ||--o{ ORDER-ITEM : "ordered in"\n ',"Git Graph":'gitGraph:\noptions\n{\n "nodeSpacing": 150,\n "nodeRadius": 10\n}\nend\ncommit\nbranch newbranch\ncheckout newbranch\ncommit\ncommit\ncheckout master\ncommit\ncommit\nmerge newbranch\n\n ',"User Journey":" journey\n title My working day\n section Go to work\n Make tea: 5: Me\n Go upstairs: 3: Me\n Do work: 1: Me, Cat\n section Go home\n Go downstairs: 5: Me\n Sit down: 3: Me\n "},a=e=>{he(t[e],!0,!0)};return[t,a,e=>a(e)]}class lt extends c{constructor(e){super(),d(this,e,ot,it,m,{})}}function ct(e){let t,a,n;return{c(){t=u("input"),this.h()},l(e){t=h(e,"INPUT",{id:!0,class:!0,type:!0,min:!0,max:!0}),this.h()},h(){g(t,"id","height"),g(t,"class","input"),g(t,"type","number"),g(t,"min","3"),g(t,"max","10000")},m(s,r){b(s,t,r),ne(t,e[5]),a||(n=C(t,"input",e[17]),a=!0)},p(e,a){32&a&&se(t.value)!==e[5]&&ne(t,e[5])},d(e){e&&p(t),a=!1,n()}}}function dt(e){let t,a,n;return{c(){t=u("div"),a=u("a"),n=x("This site is powered by Netlify"),this.h()},l(e){t=h(e,"DIV",{class:!0});var s=f(t);a=h(s,"A",{class:!0,href:!0});var r=f(a);n=I(r,"This site is powered by Netlify"),r.forEach(p),s.forEach(p),this.h()},h(){g(a,"class","link underline text-gray-500 text-sm"),g(a,"href","https://netlify.com"),g(t,"class","w-full flex items-center justify-center")},m(e,s){b(e,t,s),T(t,a),T(a,n)},d(e){e&&p(t)}}}function mt(e){let t,a,n,s,r,i,o,l,c,d,m,y,w,$,k,S,A,K,O,R,j,L,N,B,V,M,_,P,G,U,q,z,H,Z,Y,J,F,W,X,Q,ee,te,ae,se,ie,oe,le,ce,de,me,ue,he=e[7](),fe=he&&function(e){let t,a,n,s,r;return{c(){t=u("button"),a=u("i"),n=x(" Copy Image to clipboard"),this.h()},l(e){t=h(e,"BUTTON",{class:!0});var s=f(t);a=h(s,"I",{class:!0}),f(a).forEach(p),n=I(s," Copy Image to clipboard"),s.forEach(p),this.h()},h(){g(a,"class","far fa-copy mr-2"),g(t,"class","action-btn w-full")},m(i,o){b(i,t,o),T(t,a),T(t,n),s||(r=C(t,"click",e[8]),s=!0)},p:v,d(e){e&&p(t),s=!1,r()}}}(e),pe="auto"!==e[4]&&ct(e),ge=e[6]&&dt();return{c(){t=u("div"),fe&&fe.c(),a=E(),n=u("button"),s=u("i"),r=x(" PNG"),i=E(),o=u("button"),l=u("i"),c=x(" SVG"),d=E(),m=u("button"),y=u("a"),w=u("i"),$=x(" PNG"),k=E(),S=u("button"),A=u("a"),K=u("i"),O=x(" SVG"),R=E(),j=u("div"),L=x("PNG size\n\t\t\t"),N=u("label"),B=u("input"),V=x(" Auto"),M=E(),_=u("label"),P=u("input"),G=x(" Width"),U=E(),q=u("label"),z=u("input"),H=x(" Height"),Z=E(),pe&&pe.c(),Y=E(),J=u("div"),F=u("input"),W=E(),X=u("label"),Q=u("button"),ee=x("Copy Markdown"),te=E(),ae=u("div"),se=u("input"),ie=E(),oe=u("label"),le=u("button"),ce=x("Load Gist"),de=E(),ge&&ge.c(),this.h()},l(e){t=h(e,"DIV",{class:!0});var u=f(t);fe&&fe.l(u),a=D(u),n=h(u,"BUTTON",{class:!0});var g=f(n);s=h(g,"I",{class:!0}),f(s).forEach(p),r=I(g," PNG"),g.forEach(p),i=D(u),o=h(u,"BUTTON",{class:!0});var b=f(o);l=h(b,"I",{class:!0}),f(l).forEach(p),c=I(b," SVG"),b.forEach(p),d=D(u),m=h(u,"BUTTON",{class:!0});var v=f(m);y=h(v,"A",{target:!0,href:!0});var x=f(y);w=h(x,"I",{class:!0}),f(w).forEach(p),$=I(x," PNG"),x.forEach(p),v.forEach(p),k=D(u),S=h(u,"BUTTON",{class:!0});var E=f(S);A=h(E,"A",{target:!0,href:!0});var T=f(A);K=h(T,"I",{class:!0}),f(K).forEach(p),O=I(T," SVG"),T.forEach(p),E.forEach(p),R=D(u),j=h(u,"DIV",{class:!0});var C=f(j);L=I(C,"PNG size\n\t\t\t"),N=h(C,"LABEL",{for:!0});var ne=f(N);B=h(ne,"INPUT",{type:!0,id:!0}),V=I(ne," Auto"),ne.forEach(p),M=D(C),_=h(C,"LABEL",{for:!0});var re=f(_);P=h(re,"INPUT",{type:!0,id:!0}),G=I(re," Width"),re.forEach(p),U=D(C),q=h(C,"LABEL",{for:!0});var me=f(q);z=h(me,"INPUT",{type:!0,id:!0}),H=I(me," Height"),me.forEach(p),Z=D(C),pe&&pe.l(C),C.forEach(p),Y=D(u),J=h(u,"DIV",{class:!0});var ue=f(J);F=h(ue,"INPUT",{class:!0,id:!0,type:!0}),W=D(ue),X=h(ue,"LABEL",{for:!0});var he=f(X);Q=h(he,"BUTTON",{class:!0});var be=f(Q);ee=I(be,"Copy Markdown"),be.forEach(p),he.forEach(p),ue.forEach(p),te=D(u),ae=h(u,"DIV",{class:!0});var ve=f(ae);se=h(ve,"INPUT",{class:!0,id:!0,type:!0,placeholder:!0}),ie=D(ve),oe=h(ve,"LABEL",{for:!0});var ye=f(oe);le=h(ye,"BUTTON",{class:!0});var we=f(le);ce=I(we,"Load Gist"),we.forEach(p),ye.forEach(p),ve.forEach(p),de=D(u),ge&&ge.l(u),u.forEach(p),this.h()},h(){g(s,"class","fas fa-download mr-2"),g(n,"class","action-btn flex-auto"),g(l,"class","fas fa-download mr-2"),g(o,"class","action-btn flex-auto"),g(w,"class","fas fa-external-link-alt mr-2"),g(y,"target","_blank"),g(y,"href",e[1]),g(m,"class","action-btn flex-auto"),g(K,"class","fas fa-external-link-alt mr-2"),g(A,"target","_blank"),g(A,"href",e[2]),g(S,"class","action-btn flex-auto"),g(B,"type","radio"),B.__value="auto",B.value=B.__value,g(B,"id","autosize"),e[14][0].push(B),g(N,"for","autosize"),g(P,"type","radio"),P.__value="width",P.value=P.__value,g(P,"id","width"),e[14][0].push(P),g(_,"for","width"),g(z,"type","radio"),z.__value="height",z.value=z.__value,g(z,"id","height"),e[14][0].push(z),g(q,"for","height"),g(j,"class","flex gap-2 items-center"),g(F,"class","input"),g(F,"id","markdown"),g(F,"type","text"),F.value=e[3],g(Q,"class","btn btn-primary btn-md flex-auto"),g(X,"for","markdown"),g(J,"class","w-full flex gap-2 items-center"),g(se,"class","input"),g(se,"id","gist"),g(se,"type","text"),g(se,"placeholder","Enter Gist URL"),g(le,"class","btn btn-primary btn-md flex-auto"),g(oe,"for","gist"),g(ae,"class","w-full flex gap-2 items-center"),g(t,"class","flex flex-wrap gap-2 m-2")},m(u,h){b(u,t,h),fe&&fe.m(t,null),T(t,a),T(t,n),T(n,s),T(n,r),T(t,i),T(t,o),T(o,l),T(o,c),T(t,d),T(t,m),T(m,y),T(y,w),T(y,$),T(t,k),T(t,S),T(S,A),T(A,K),T(A,O),T(t,R),T(t,j),T(j,L),T(j,N),T(N,B),B.checked=B.__value===e[4],T(N,V),T(j,M),T(j,_),T(_,P),P.checked=P.__value===e[4],T(_,G),T(j,U),T(j,q),T(q,z),z.checked=z.__value===e[4],T(q,H),T(j,Z),pe&&pe.m(j,null),T(t,Y),T(t,J),T(J,F),T(J,W),T(J,X),T(X,Q),T(Q,ee),T(t,te),T(t,ae),T(ae,se),ne(se,e[0]),T(ae,ie),T(ae,oe),T(oe,le),T(le,ce),T(t,de),ge&&ge.m(t,null),me||(ue=[C(n,"click",e[9]),C(o,"click",e[10]),C(B,"change",e[13]),C(P,"change",e[15]),C(z,"change",e[16]),C(F,"click",e[11]),C(Q,"click",e[11]),C(se,"input",e[18]),C(le,"click",e[12])],me=!0)},p(e,a){he&&fe.p(e,a),2&a&&g(y,"href",e[1]),4&a&&g(A,"href",e[2]),16&a&&(B.checked=B.__value===e[4]),16&a&&(P.checked=P.__value===e[4]),16&a&&(z.checked=z.__value===e[4]),"auto"!==e[4]?pe?pe.p(e,a):(pe=ct(e),pe.c(),pe.m(j,null)):pe&&(pe.d(1),pe=null),8&a&&F.value!==e[3]&&(F.value=e[3]),1&a&&se.value!==e[0]&&ne(se,e[0]),e[6]?ge||(ge=dt(),ge.c(),ge.m(t,null)):ge&&(ge.d(1),ge=null)},d(a){a&&p(t),fe&&fe.d(),e[14][0].splice(e[14][0].indexOf(B),1),e[14][0].splice(e[14][0].indexOf(P),1),e[14][0].splice(e[14][0].indexOf(z),1),pe&&pe.d(),ge&&ge.d(),me=!1,re(ue)}}}function ut(e){let t,a;return t=new at({props:{title:"Actions",isOpen:!0,$$slots:{default:[mt]},$$scope:{ctx:e}}}),{c(){R(t.$$.fragment)},l(e){j(t.$$.fragment,e)},m(e,n){L(t,e,n),a=!0},p(e,[a]){const n={};33554559&a&&(n.$$scope={dirty:a,ctx:e}),t.$set(n)},i(e){a||(N(t.$$.fragment,e),a=!0)},o(e){B(t.$$.fragment,e),a=!1},d(e){V(t,e)}}}function ht(e,t,a){let n;y(e,me,(e=>a(19,n=e)));const s=(e,t,a)=>{null==e||e.setAttribute("height",`${a}px`),null==e||e.setAttribute("width",`${t}px`),e||(e=document.querySelector("#container svg"));const n=e.outerHTML.replaceAll("
","
").replaceAll(/]*)>/g,((e,t)=>``));return ae(n)},r=(e,t)=>{const a=document.createElement("canvas"),n=document.querySelector("#container svg"),r=n.getBoundingClientRect();if(a.width=r.width,a.height=r.height,"width"===h){const e=r.height/r.width;a.width=f,a.height=f*e}else if("height"===h){const e=r.width/r.height;a.width=f*e,a.height=f}const i=a.getContext("2d");i.fillStyle="white",i.fillRect(0,0,a.width,a.height);const o=new Image;o.onload=t(i,o),o.src=`data:image/svg+xml;base64,${s(n,a.width,a.height)}`,e.stopPropagation(),e.preventDefault()},i=(e,t)=>{const a=document.createElement("a");a.download=e,a.href=t,a.click(),a.remove()},o=(e,t)=>()=>{const{canvas:a}=e;e.drawImage(t,0,0,a.width,a.height),i(`mermaid-diagram-${ie().format("YYYYMMDDHHmmss")}.png`,a.toDataURL("image/png").replace("image/png","image/octet-stream"))},l=(e,t)=>()=>{const{canvas:a}=e;e.drawImage(t,0,0,a.width,a.height),a.toBlob((e=>{try{navigator.clipboard.write([new ClipboardItem({[e.type]:e})])}catch(t){console.error(t)}}))};let c="";me.subscribe((e=>{var t;"gist"===(null===(t=e.loader)||void 0===t?void 0:t.type)&&a(0,c=e.loader.config.url)}));let d,m,u,h="auto",f=1080,p=!1;["mermaid.live","netlify"].some((e=>window.location.host.includes(e)))&&(p=!0),fe.subscribe((e=>{const t=JSON.parse(JSON.stringify(n));"string"==typeof t.mermaid&&(t.mermaid=JSON.parse(t.mermaid));const s=ae(JSON.stringify(t),!0);a(1,d=`https://mermaid.ink/img/${s}`),a(2,m=`https://mermaid.ink/svg/${s}`),a(3,u=`[![](${d})](${window.location.protocol}//${window.location.host}${window.location.pathname}#${e})`)}));return[c,d,m,u,h,f,p,()=>Object.prototype.hasOwnProperty.call(window,"ClipboardItem"),e=>{r(e,l)},e=>{r(e,o)},()=>{i(`mermaid-diagram-${ie().format("YYYYMMDDHHmmss")}.svg`,`data:image/svg+xml;base64,${s()}`)},()=>{document.getElementById("markdown").select(),document.execCommand("Copy")},()=>{c||alert("Please enter a Gist URL first"),window.location.href=`${window.location.pathname}?gist=${c}`},function(){h=this.__value,a(4,h)},[[]],function(){h=this.__value,a(4,h)},function(){h=this.__value,a(4,h)},function(){f=se(this.value),a(5,f)},function(){c=this.value,a(0,c)}]}class ft extends c{constructor(e){super(),d(this,e,ht,ut,m,{})}}function pt(e,t,a){const n=e.slice();return n[15]=t[a].state,n[16]=t[a].time,n[17]=t[a].name,n[18]=t[a].url,n[19]=t[a].type,n}function gt(e){let t,a,n,s,r,i;return{c(){t=u("div"),a=x("No items in History"),n=u("br"),s=x("\n\t\t\t\tClick the Save button to save current state and restore it later."),r=u("br"),i=x("\n\t\t\t\tTimeline will automatically be saved every minute."),this.h()},l(e){t=h(e,"DIV",{class:!0});var o=f(t);a=I(o,"No items in History"),n=h(o,"BR",{}),s=I(o,"\n\t\t\t\tClick the Save button to save current state and restore it later."),r=h(o,"BR",{}),i=I(o,"\n\t\t\t\tTimeline will automatically be saved every minute."),o.forEach(p),this.h()},h(){g(t,"class","m-2")},m(e,o){b(e,t,o),T(t,a),T(t,n),T(t,s),T(t,r),T(t,i)},p:v,d(e){e&&p(t)}}}function bt(e){let t,a=e[3],n=[];for(let s=0;s0?bt:gt}let n=a(e),s=n(e);return{c(){t=u("ul"),s.c(),this.h()},l(e){t=h(e,"UL",{class:!0,id:!0});var a=f(t);s.l(a),a.forEach(p),this.h()},h(){g(t,"class","p-2 space-y-2 overflow-auto h-56"),g(t,"id","historyList")},m(e,a){b(e,t,a),s.m(t,null)},p(e,r){n===(n=a(e))&&s?s.p(e,r):(s.d(1),s=n(e),s&&(s.c(),s.m(t,null)))},d(e){e&&p(t),s.d()}}}function xt(e){let t,a,n,s;return{c(){t=u("button"),a=u("i"),this.h()},l(e){t=h(e,"BUTTON",{id:!0,class:!0,title:!0});var n=f(t);a=h(n,"I",{class:!0}),f(a).forEach(p),n.forEach(p),this.h()},h(){g(a,"class","fas fa-trash-alt"),g(t,"id","clearHistory"),g(t,"class","btn btn-xs btn-error w-12"),g(t,"title","Delete all saved states")},m(r,i){b(r,t,i),T(t,a),n||(s=C(t,"click",P(e[10])),n=!0)},p:v,d(e){e&&p(t),n=!1,s()}}}function Et(e){let t,a,n,s,r,i,o="loader"!==e[2]&&xt(e);return{c(){t=u("div"),a=u("button"),n=u("i"),s=E(),o&&o.c(),this.h()},l(e){t=h(e,"DIV",{slot:!0});var r=f(t);a=h(r,"BUTTON",{id:!0,class:!0,title:!0});var i=f(a);n=h(i,"I",{class:!0}),f(n).forEach(p),i.forEach(p),s=D(r),o&&o.l(r),r.forEach(p),this.h()},h(){g(n,"class","far fa-save"),g(a,"id","saveHistory"),g(a,"class","btn btn-xs btn-success w-12"),g(a,"title","Save current state"),g(t,"slot","actions")},m(l,c){b(l,t,c),T(t,a),T(a,n),T(t,s),o&&o.m(t,null),r||(i=C(a,"click",P(e[9])),r=!0)},p(e,a){"loader"!==e[2]?o?o.p(e,a):(o=xt(e),o.c(),o.m(t,null)):o&&(o.d(1),o=null)},d(e){e&&p(t),o&&o.d(),r=!1,i()}}}function It(e){let t,a,n;function s(t){e[13](t)}let r={tabs:e[0],title:"History",$$slots:{actions:[Et],default:[kt]},$$scope:{ctx:e}};return void 0!==e[1]&&(r.isOpen=e[1]),t=new at({props:r}),k.push((()=>Y(t,"isOpen",s))),t.$on("select",e[4]),{c(){R(t.$$.fragment)},l(e){j(t.$$.fragment,e)},m(e,a){L(t,e,a),n=!0},p(e,[n]){const s={};1&n&&(s.tabs=e[0]),4194316&n&&(s.$$scope={dirty:n,ctx:e}),!a&&2&n&&(a=!0,s.isOpen=e[1],Q((()=>a=!1))),t.$set(s)},i(e){n||(N(t.$$.fragment,e),n=!0)},o(e){B(t.$$.fragment,e),n=!1},d(e){V(t,e)}}}function Dt(e,t,a){let n,s,r;y(e,me,(e=>a(14,n=e))),y(e,ye,(e=>a(2,s=e))),y(e,we,(e=>a(3,r=e)));let i=[{id:"manual",title:"Saved",icon:"far fa-bookmark"},{id:"auto",title:"Timeline",icon:"fas fa-history"}];const o=(e=!1)=>{const t=pe();ke(e)!==t?xe({state:n,time:Date.now(),type:e?"auto":"manual"}):e||alert("State already saved.")},l=e=>{(e||confirm("Clear all saved items?"))&&Ee(e)},c=e=>{me.set(Object.assign(Object.assign({},e),{updateEditor:!0,updateDiagram:!0}))};$((()=>{ye.set("manual"),setInterval((()=>{o(!0)}),6e4)})),$e.subscribe((e=>{e.length>0&&2===i.length&&(a(0,i=[{id:"loader",title:"Revisions",icon:"fab fa-git-alt"},...i]),ye.set("loader"))}));let d=!1;return[i,d,s,r,e=>{ye.set(e.detail.id)},o,l,c,e=>{const t=new Date(e);return`${new Date(t).toLocaleString()} (${ie(t).fromNow()})`},()=>o(),()=>l(),e=>c(e),e=>l(e),function(e){d=e,a(1,d)}]}class Tt extends c{constructor(e){super(),d(this,e,Dt,It,m,{})}}function Ct(e){let t,a,n;function s(t){e[10](t)}let r={language:e[2],errorMarkers:e[3]};return void 0!==e[1]&&(r.text=e[1]),t=new Re({props:r}),k.push((()=>Y(t,"text",s))),t.$on("update",e[6]),{c(){R(t.$$.fragment)},l(e){j(t.$$.fragment,e)},m(e,a){L(t,e,a),n=!0},p(e,n){const s={};4&n&&(s.language=e[2]),8&n&&(s.errorMarkers=e[3]),!a&&2&n&&(a=!0,s.text=e[1],Q((()=>a=!1))),t.$set(s)},i(e){n||(N(t.$$.fragment,e),n=!0)},o(e){B(t.$$.fragment,e),n=!1},d(e){V(t,e)}}}function St(e){let t,a,n,s;return{c(){t=u("button"),a=u("i"),this.h()},l(e){t=h(e,"BUTTON",{class:!0,title:!0,"data-cy":!0});var n=f(t);a=h(n,"I",{class:!0}),f(a).forEach(p),n.forEach(p),this.h()},h(){g(a,"class","fas fa-sync"),g(t,"class","btn btn-secondary btn-xs"),g(t,"title","Sync Diagram"),g(t,"data-cy","sync")},m(e,r){b(e,t,r),T(t,a),n||(s=C(t,"click",Ce),n=!0)},p:v,d(e){e&&p(t),n=!1,s()}}}function At(e){let t,a,n,s,r,i,o,l,c,d,m,v=!e[0].autoSync&&St();return{c(){t=u("div"),a=u("div"),v&&v.c(),n=E(),s=u("div"),r=u("label"),i=u("input"),o=E(),l=u("span"),c=x("Auto sync"),this.h()},l(e){t=h(e,"DIV",{slot:!0});var d=f(t);a=h(d,"DIV",{class:!0});var m=f(a);v&&v.l(m),n=D(m),s=h(m,"DIV",{class:!0});var u=f(s);r=h(u,"LABEL",{class:!0,for:!0});var g=f(r);i=h(g,"INPUT",{type:!0,class:!0,id:!0}),o=D(g),l=h(g,"SPAN",{});var b=f(l);c=I(b,"Auto sync"),b.forEach(p),g.forEach(p),u.forEach(p),m.forEach(p),d.forEach(p),this.h()},h(){g(i,"type","checkbox"),g(i,"class","toggle toggle-primary mr-1"),g(i,"id","autoSync"),g(r,"class","cursor-pointer label"),g(r,"for","autoSync"),g(s,"class","form-control"),g(a,"class","flex flex-row items-center"),g(t,"slot","actions")},m(u,h){b(u,t,h),T(t,a),v&&v.m(a,null),T(a,n),T(a,s),T(s,r),T(r,i),i.checked=e[0].autoSync,T(r,o),T(r,l),T(l,c),d||(m=C(i,"change",e[9]),d=!0)},p(e,t){e[0].autoSync?v&&(v.d(1),v=null):v?v.p(e,t):(v=St(),v.c(),v.m(a,n)),1&t&&(i.checked=e[0].autoSync)},d(e){e&&p(t),v&&v.d(),d=!1,m()}}}function Kt(e){let t,a,n;return a=new Ie({}),{c(){t=u("div"),R(a.$$.fragment),this.h()},l(e){t=h(e,"DIV",{class:!0});var n=f(t);j(a.$$.fragment,n),n.forEach(p),this.h()},h(){g(t,"class","flex-1 overflow-auto")},m(e,s){b(e,t,s),L(a,t,null),n=!0},i(e){n||(N(a.$$.fragment,e),n=!0)},o(e){B(a.$$.fragment,e),n=!1},d(e){e&&p(t),V(a)}}}function Ot(e){let t,a,n,s,r;return{c(){t=u("button"),a=u("i"),n=x(" View"),this.h()},l(e){t=h(e,"BUTTON",{slot:!0,class:!0,title:!0});var s=f(t);a=h(s,"I",{class:!0}),f(a).forEach(p),n=I(s," View"),s.forEach(p),this.h()},h(){g(a,"class","far fa-eye mr-2"),g(t,"slot","actions"),g(t,"class","btn btn-primary btn-xs shadow-lg"),g(t,"title","View diagram in new page")},m(i,o){b(i,t,o),T(t,a),T(t,n),s||(r=C(t,"click",P(e[11])),s=!0)},p:v,d(e){e&&p(t),s=!1,r()}}}function Rt(e){let t,a,n,s,r,i,o,l,c,d,m,v,y,w,$,k,C,S,A,K,O,M;return a=new Ue({}),i=new at({props:{tabs:e[5],isCloseable:!1,title:"Mermaid",$$slots:{actions:[At],default:[Ct]},$$scope:{ctx:e}}}),i.$on("select",e[4]),c=new lt({}),m=new Tt({}),y=new ft({}),S=new at({props:{title:"Diagram",isCloseable:!1,$$slots:{actions:[Ot],default:[Kt]},$$scope:{ctx:e}}}),{c(){t=u("div"),R(a.$$.fragment),n=E(),s=u("div"),r=u("div"),R(i.$$.fragment),o=E(),l=u("div"),R(c.$$.fragment),d=E(),R(m.$$.fragment),v=E(),R(y.$$.fragment),w=E(),$=u("div"),k=E(),C=u("div"),R(S.$$.fragment),A=E(),K=u("div"),O=x("Code editing not supported on mobile. Please use a desktop browser."),this.h()},l(e){t=h(e,"DIV",{class:!0});var u=f(t);j(a.$$.fragment,u),n=D(u),s=h(u,"DIV",{class:!0});var g=f(s);r=h(g,"DIV",{class:!0,id:!0,style:!0});var b=f(r);j(i.$$.fragment,b),o=D(b),l=h(b,"DIV",{class:!0});var x=f(l);j(c.$$.fragment,x),d=D(x),j(m.$$.fragment,x),v=D(x),j(y.$$.fragment,x),x.forEach(p),b.forEach(p),w=D(g),$=h(g,"DIV",{id:!0,class:!0}),f($).forEach(p),k=D(g),C=h(g,"DIV",{class:!0});var E=f(C);j(S.$$.fragment,E),A=D(E),K=h(E,"DIV",{class:!0});var T=f(K);O=I(T,"Code editing not supported on mobile. Please use a desktop browser."),T.forEach(p),E.forEach(p),g.forEach(p),u.forEach(p),this.h()},h(){g(l,"class","-mt-2"),g(r,"class","hidden md:flex flex-col"),g(r,"id","editorPane"),le(r,"width","40%"),g($,"id","resizeHandler"),g($,"class","hidden md:block svelte-1fge7im"),g(K,"class","md:hidden rounded shadow p-2 mx-2"),g(C,"class","flex-1 flex flex-col overflow-hidden"),g(s,"class","flex-1 flex overflow-hidden"),g(t,"class","h-full flex flex-col overflow-hidden")},m(e,u){b(e,t,u),L(a,t,null),T(t,n),T(t,s),T(s,r),L(i,r,null),T(r,o),T(r,l),L(c,l,null),T(l,d),L(m,l,null),T(l,v),L(y,l,null),T(s,w),T(s,$),T(s,k),T(s,C),L(S,C,null),T(C,A),T(C,K),T(K,O),M=!0},p(e,[t]){const a={};131087&t&&(a.$$scope={dirty:t,ctx:e}),i.$set(a);const n={};131072&t&&(n.$$scope={dirty:t,ctx:e}),S.$set(n)},i(e){M||(N(a.$$.fragment,e),N(i.$$.fragment,e),N(c.$$.fragment,e),N(m.$$.fragment,e),N(y.$$.fragment,e),N(S.$$.fragment,e),M=!0)},o(e){B(a.$$.fragment,e),B(i.$$.fragment,e),B(c.$$.fragment,e),B(m.$$.fragment,e),B(y.$$.fragment,e),B(S.$$.fragment,e),M=!1},d(e){e&&p(t),V(a),V(i),V(c),V(m),V(y),V(S)}}}function jt(e,t,a){let n,s;y(e,fe,(e=>a(12,n=e))),y(e,me,(e=>a(0,s=e)));var r=this&&this.__awaiter||function(e,t,a,n){return new(a||(a=Promise))((function(s,r){function i(e){try{l(n.next(e))}catch(t){r(t)}}function o(e){try{l(n.throw(e))}catch(t){r(t)}}function l(e){var t;e.done?s(e.value):(t=e.value,t instanceof a?t:new a((function(e){e(t)}))).then(i,o)}l((n=n.apply(e,t||[])).next())}))};let i="code";const o={code:"mermaid",config:"json"};let l="",c="mermaid",d=[];me.subscribe((e=>{e.updateEditor&&a(1,l="code"===i?e.code:e.mermaid)}));const m=()=>{window.open(`${Se}/view#${n}`,"_blank").focus()};$((()=>r(void 0,void 0,void 0,(function*(){yield Te();const e=document.getElementById("resizeHandler"),t=document.getElementById("editorPane"),a=e=>{const a=e.pageX-t.getBoundingClientRect().left;a>50&&(t.style.width=`${a}px`)},n=()=>{window.removeEventListener("mousemove",a)};e.addEventListener("mousedown",(e=>{e.preventDefault(),window.addEventListener("mousemove",a),window.addEventListener("mouseup",n)}))}))));return e.$$.update=()=>{256&e.$$.dirty&&a(2,c=o[i]),257&e.$$.dirty&&a(1,l="code"===i?s.code:s.mermaid)},[s,l,c,d,e=>{ce(me,s.updateEditor=!0,s),a(8,i=e.detail.id)},[{id:"code",title:"Code",icon:"fas fa-code"},{id:"config",title:"Config",icon:"fas fa-cogs"}],e=>{try{"code"===i?(n=e.detail.text,de.parse(n),he(n,!1)):(t=e.detail.text,JSON.parse(t),ge(t,!1)),De.set(void 0),a(3,d=[])}catch(s){if(De.set(s),s.hash){const e={severity:8,startLineNumber:s.hash.loc.first_line,startColumn:s.hash.loc.first_column,endLineNumber:s.hash.loc.last_line,endColumn:s.hash.loc.last_column+1,message:s.str};d.push(e),a(3,d=d.filter((t=>t.startLineNumber>=e.startLineNumber&&t.startColumn>=e.startColumn)))}console.error(s)}var t,n},m,i,function(){s.autoSync=this.checked,me.set(s)},function(e){l=e,a(1,l),a(8,i),a(0,s)},()=>m()]}class Lt extends c{constructor(e){super(),d(this,e,jt,Rt,m,{})}}export{Lt as default}; diff --git a/_app/start-4fcd08ce.js b/_app/start-4fcd08ce.js new file mode 100644 index 00000000..5b53c927 --- /dev/null +++ b/_app/start-4fcd08ce.js @@ -0,0 +1 @@ +var t=Object.defineProperty,e=Object.defineProperties,r=Object.getOwnPropertyDescriptors,s=Object.getOwnPropertySymbols,a=Object.prototype.hasOwnProperty,o=Object.prototype.propertyIsEnumerable,n=(e,r,s)=>r in e?t(e,r,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[r]=s,i=(t,e)=>{for(var r in e||(e={}))a.call(e,r)&&n(t,r,e[r]);if(s)for(var r of s(e))o.call(e,r)&&n(t,r,e[r]);return t};import{S as l,i as c,s as u,e as h,c as d,a as p,d as f,b as g,f as m,t as _,g as y,h as b,j as v,k as w,l as $,m as E,n as x,o as q,p as R,q as S,r as L,u as k,v as O,w as j,x as U,y as A,z as P,A as T,B as I,C as N}from"./chunks/vendor-58c10135.js";import{_ as V}from"./chunks/preload-helper-1db36302.js";import{i as D}from"./chunks/singletons-12a22614.js";import{s as C}from"./chunks/paths-28a87002.js";function B(t){let e,r,s;const a=[t[2]||{}];var o=t[0][1];function n(t){let e={$$slots:{default:[G]},$$scope:{ctx:t}};for(let r=0;r{O(t,1)})),j()}o?(e=new o(n(t)),v(e.$$.fragment),U(e.$$.fragment,1),q(e,r.parentNode,r)):e=null}else o&&e.$set(i)},i(t){s||(e&&U(e.$$.fragment,t),s=!0)},o(t){e&&k(e.$$.fragment,t),s=!1},d(t){t&&f(r),e&&O(e,t)}}}function K(t){let e,r,s;const a=[t[3]||{}];var o=t[0][2];function n(t){let e={};for(let r=0;r{O(t,1)})),j()}o?(e=new o(n()),v(e.$$.fragment),U(e.$$.fragment,1),q(e,r.parentNode,r)):e=null}else o&&e.$set(i)},i(t){s||(e&&U(e.$$.fragment,t),s=!0)},o(t){e&&k(e.$$.fragment,t),s=!1},d(t){t&&f(r),e&&O(e,t)}}}function G(t){let e,r,s=t[0][2]&&K(t);return{c(){s&&s.c(),e=$()},l(t){s&&s.l(t),e=$()},m(t,a){s&&s.m(t,a),m(t,e,a),r=!0},p(t,r){t[0][2]?s?(s.p(t,r),1&r&&U(s,1)):(s=K(t),s.c(),U(s,1),s.m(e.parentNode,e)):s&&(L(),k(s,1,1,(()=>{s=null})),j())},i(t){r||(U(s),r=!0)},o(t){k(s),r=!1},d(t){s&&s.d(t),t&&f(e)}}}function J(t){let e,r,s=t[0][1]&&B(t);return{c(){s&&s.c(),e=$()},l(t){s&&s.l(t),e=$()},m(t,a){s&&s.m(t,a),m(t,e,a),r=!0},p(t,r){t[0][1]?s?(s.p(t,r),1&r&&U(s,1)):(s=B(t),s.c(),U(s,1),s.m(e.parentNode,e)):s&&(L(),k(s,1,1,(()=>{s=null})),j())},i(t){r||(U(s),r=!0)},o(t){k(s),r=!1},d(t){s&&s.d(t),t&&f(e)}}}function M(t){let e,r=t[5]&&W(t);return{c(){e=h("div"),r&&r.c(),this.h()},l(t){e=d(t,"DIV",{id:!0,"aria-live":!0,"aria-atomic":!0,class:!0});var s=p(e);r&&r.l(s),s.forEach(f),this.h()},h(){g(e,"id","svelte-announcer"),g(e,"aria-live","assertive"),g(e,"aria-atomic","true"),g(e,"class","svelte-1pdgbjn")},m(t,s){m(t,e,s),r&&r.m(e,null)},p(t,s){t[5]?r?r.p(t,s):(r=W(t),r.c(),r.m(e,null)):r&&(r.d(1),r=null)},d(t){t&&f(e),r&&r.d()}}}function W(t){let e;return{c(){e=_(t[6])},l(r){e=y(r,t[6])},m(t,r){m(t,e,r)},p(t,r){64&r&&b(e,t[6])},d(t){t&&f(e)}}}function z(t){let e,r,s,a;const o=[t[1]||{}];var n=t[0][0];function i(t){let e={$$slots:{default:[J]},$$scope:{ctx:t}};for(let r=0;r{O(t,1)})),j()}n?(e=new n(i(t)),v(e.$$.fragment),U(e.$$.fragment,1),q(e,r.parentNode,r)):e=null}else n&&e.$set(c);t[4]?l?l.p(t,a):(l=M(t),l.c(),l.m(s.parentNode,s)):l&&(l.d(1),l=null)},i(t){a||(e&&U(e.$$.fragment,t),a=!0)},o(t){e&&k(e.$$.fragment,t),a=!1},d(t){e&&O(e,t),t&&f(r),l&&l.d(t),t&&f(s)}}}function X(t,e,r){let{stores:s}=e,{page:a}=e,{components:o}=e,{props_0:n=null}=e,{props_1:i=null}=e,{props_2:l=null}=e;A("__svelte__",s),P(s.page.notify);let c=!1,u=!1,h=null;return T((()=>{const t=s.page.subscribe((()=>{c&&(r(5,u=!0),r(6,h=document.title||"untitled page"))}));return r(4,c=!0),t})),t.$$set=t=>{"stores"in t&&r(7,s=t.stores),"page"in t&&r(8,a=t.page),"components"in t&&r(0,o=t.components),"props_0"in t&&r(1,n=t.props_0),"props_1"in t&&r(2,i=t.props_1),"props_2"in t&&r(3,l=t.props_2)},t.$$.update=()=>{384&t.$$.dirty&&s.page.set(a)},[o,n,i,l,c,u,h,s,a]}class Y extends l{constructor(t){super(),c(this,t,X,z,u,{stores:7,page:8,components:0,props_0:1,props_1:2,props_2:3})}}const F=[()=>V((()=>import("./pages/__layout.svelte-313bdcaf.js")),["pages/__layout.svelte-313bdcaf.js","assets/pages/__layout.svelte-c7a2ce1b.css","chunks/vendor-58c10135.js","chunks/paths-28a87002.js","chunks/state-192747cd.js","chunks/preload-helper-1db36302.js","chunks/theme-32ab91e2.js"]),()=>V((()=>import("./error.svelte-31bd7bdc.js")),["error.svelte-31bd7bdc.js","chunks/vendor-58c10135.js"]),()=>V((()=>import("./pages/index.svelte-6dbe7827.js")),["pages/index.svelte-6dbe7827.js","chunks/vendor-58c10135.js","chunks/singletons-12a22614.js","chunks/paths-28a87002.js"]),()=>V((()=>import("./pages/edit.svelte-7f5a1dd8.js")),["pages/edit.svelte-7f5a1dd8.js","assets/pages/edit.svelte-3300ec7f.css","chunks/vendor-58c10135.js","chunks/state-192747cd.js","chunks/preload-helper-1db36302.js","chunks/theme-32ab91e2.js","chunks/util-134b5ae1.js","assets/util-c948b67a.css","chunks/paths-28a87002.js"]),()=>V((()=>import("./pages/view.svelte-c0eb3213.js")),["pages/view.svelte-c0eb3213.js","chunks/vendor-58c10135.js","chunks/util-134b5ae1.js","assets/util-c948b67a.css","chunks/state-192747cd.js","chunks/preload-helper-1db36302.js"])],H=[[/^\/$/,[F[0],F[2]],[F[1]]],[/^\/manifest\.json$/],[/^\/edit\/?$/,[F[0],F[3]],[F[1]]],[/^\/view\/?$/,[F[0],F[4]],[F[1]]],[/^\/([^/]+?)\/manifest\.json$/]],Q=[F[0](),F[1]()];function Z(){return{x:pageXOffset,y:pageYOffset}}function tt(t){for(;t&&"A"!==t.nodeName.toUpperCase();)t=t.parentNode;return t}function et(t){return t instanceof SVGAElement?new URL(t.href.baseVal,document.baseURI):new URL(t.href)}class rt{constructor({base:t,routes:e,trailing_slash:r,renderer:s}){this.base=t,this.routes=e,this.trailing_slash=r,this.renderer=s,s.router=this,this.enabled=!0,document.body.setAttribute("tabindex","-1"),history.replaceState(history.state||{},"",location.href)}init_listeners(){let t;"scrollRestoration"in history&&(history.scrollRestoration="manual"),addEventListener("beforeunload",(()=>{history.scrollRestoration="auto"})),addEventListener("load",(()=>{history.scrollRestoration="manual"})),addEventListener("scroll",(()=>{clearTimeout(t),t=setTimeout((()=>{const t=(s=i({},history.state||{}),a={"sveltekit:scroll":Z()},e(s,r(a)));var s,a;history.replaceState(t,document.title,window.location.href)}),50)}));const s=t=>{const e=tt(t.target);e&&e.href&&e.hasAttribute("sveltekit:prefetch")&&this.prefetch(et(e))};let a;addEventListener("touchstart",s),addEventListener("mousemove",(t=>{clearTimeout(a),a=setTimeout((()=>{s(t)}),20)})),addEventListener("click",(t=>{if(!this.enabled)return;if(t.button||1!==t.which)return;if(t.metaKey||t.ctrlKey||t.shiftKey||t.altKey)return;if(t.defaultPrevented)return;const e=tt(t.target);if(!e)return;if(!e.href)return;const r=et(e);if(r.toString()===location.href)return void(location.hash||t.preventDefault());const s=(e.getAttribute("rel")||"").split(/\s+/);if(e.hasAttribute("download")||s&&s.includes("external"))return;if(e instanceof SVGAElement?e.target.baseVal:e.target)return;if(!this.owns(r))return;const a=e.hasAttribute("sveltekit:noscroll");history.pushState({},"",r.href),this._navigate(r,a?Z():null,!1,[],r.hash),t.preventDefault()})),addEventListener("popstate",(t=>{if(t.state&&this.enabled){const e=new URL(location.href);this._navigate(e,t.state["sveltekit:scroll"],!1,[])}}))}owns(t){return t.origin===location.origin&&t.pathname.startsWith(this.base)}parse(t){if(this.owns(t)){const e=t.pathname.slice(this.base.length)||"/",r=decodeURI(e),s=this.routes.filter((([t])=>t.test(r))),a=new URLSearchParams(t.search);return{id:`${e}?${a}`,routes:s,path:e,decoded_path:r,query:a}}}async goto(t,{noscroll:e=!1,replaceState:r=!1,keepfocus:s=!1,state:a={}}={},o){const n=new URL(t,function(t){let e=t.baseURI;if(!e){const r=t.getElementsByTagName("base");e=r.length?r[0].href:t.URL}return e}(document));return this.enabled&&this.owns(n)?(history[r?"replaceState":"pushState"](a,"",t),this._navigate(n,e?Z():null,s,o,n.hash)):(location.href=n.href,new Promise((()=>{})))}enable(){this.enabled=!0}disable(){this.enabled=!1}async prefetch(t){const e=this.parse(t);if(!e)throw new Error("Attempted to prefetch a URL that does not belong to this app");return this.renderer.load(e)}async _navigate(t,e,r,s,a){const o=this.parse(t);if(!o)throw new Error("Attempted to navigate to a URL that does not belong to this app");if("/"!==o.path){const t=o.path.endsWith("/");(t&&"never"===this.trailing_slash||!t&&"always"===this.trailing_slash&&!(o.path.split("/").pop()||"").includes("."))&&(o.path=t?o.path.slice(0,-1):o.path+"/",history.replaceState({},"",`${this.base}${o.path}${location.search}`))}this.renderer.notify({path:o.path,query:o.query}),await this.renderer.update(o,s,!1),r||document.body.focus();const n=a&&document.getElementById(a.slice(1));e?scrollTo(e.x,e.y):n?n.scrollIntoView():scrollTo(0,0)}}function st(t){return t instanceof Error||t&&t.name&&t.message?t:new Error(JSON.stringify(t))}function at(t){const e=N(t);let r=!0;return{notify:function(){r=!0,e.update((t=>t))},set:function(t){r=!1,e.set(t)},subscribe:function(t){let s;return e.subscribe((e=>{(void 0===s||r&&e!==s)&&t(s=e)}))}}}function ot(t,e){let r=`script[data-type="svelte-data"][data-url="${"string"==typeof t?t:t.url}"]`;e&&"string"==typeof e.body&&(r+=`[data-body="${function(t){let e=5381,r=t.length;if("string"==typeof t)for(;r;)e=33*e^t.charCodeAt(--r);else for(;r;)e=33*e^t[--r];return(e>>>0).toString(36)}(e.body)}"]`);const n=document.querySelector(r);if(n&&n.textContent){const t=JSON.parse(n.textContent),{body:e}=t,r=((t,e)=>{var r={};for(var n in t)a.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(null!=t&&s)for(var n of s(t))e.indexOf(n)<0&&o.call(t,n)&&(r[n]=t[n]);return r})(t,["body"]);return Promise.resolve(new Response(e,r))}return fetch(t,e)}class nt{constructor({Root:t,fallback:e,target:r,session:s,host:a}){this.Root=t,this.fallback=e,this.host=a,this.router,this.target=r,this.started=!1,this.session_id=1,this.invalid=new Set,this.invalidating=null,this.current={page:null,session_id:0,branch:[]},this.cache=new Map,this.loading={id:null,promise:null},this.stores={page:at({}),navigating:N(null),session:N(s)},this.$session=null,this.root=null;let o=!1;this.stores.session.subscribe((async t=>{if(this.$session=t,!o||!this.router)return;this.session_id+=1;const e=this.router.parse(new URL(location.href));e&&this.update(e,[],!0)})),o=!0}async start({status:t,error:e,nodes:r,page:s}){const a=[];let o,n,l={};try{for(let o=0;o10||e.includes(t.path)))return void(this.router?this.router.goto(a.redirect,{replaceState:!0},[...e,t.path]):location.href=new URL(a.redirect,location.href).href);a=await this._load_error({status:500,error:new Error("Redirect loop"),path:t.path,query:t.query})}if(a.reload?location.reload():this.started?(this.current=a.state,this.root.$set(a.props),this.stores.navigating.set(null),await 0):this._init(a),dispatchEvent(new CustomEvent("sveltekit:navigation-end")),this.loading.promise=null,this.loading.id=null,!this.router)return;const o=a.state.branch[a.state.branch.length-1];o&&!1===o.module.router?this.router.disable():this.router.enable()}load(t){return this.loading.promise=this._get_navigation_result(t,!1),this.loading.id=t.id,this.loading.promise}invalidate(t){return this.invalid.add(t),this.invalidating||(this.invalidating=Promise.resolve().then((async()=>{const t=this.router&&this.router.parse(new URL(location.href));t&&await this.update(t,[],!0),this.invalidating=null}))),this.invalidating}_init(t){this.current=t.state;const e=document.querySelector("style[data-svelte]");e&&e.remove(),this.root=new this.Root({target:this.target,props:i({stores:this.stores},t.props),hydrate:!0}),this.started=!0}async _get_navigation_result(t,e){if(this.loading.id===t.id&&this.loading.promise)return this.loading.promise;for(let r=0;rt())),a+=1}const o=await this._load({route:s,info:t},e);if(o)return o}return await this._load_error({status:404,error:new Error(`Not found: ${t.path}`),path:t.path,query:t.query})}async _get_navigation_result_from_branch({page:t,branch:e}){const r=e.filter(Boolean),s={state:{page:t,branch:e,session_id:this.session_id},props:{components:r.map((t=>t.module.default))}};for(let n=0;n{this.cache.get(e)===s&&this.cache.delete(e),i(),clearTimeout(n)},n=setTimeout(a,1e3*o),i=this.stores.session.subscribe((()=>{r&&a()}));r=!0,this.cache.set(e,s)}return s}async _load_node({status:t,error:e,module:r,page:s,context:a}){const o={module:r,uses:{params:new Set,path:!1,query:!1,session:!1,context:!1,dependencies:[]},loaded:null,context:a},n={};for(const i in s.params)Object.defineProperty(n,i,{get:()=>(o.uses.params.add(i),s.params[i]),enumerable:!0});const l=this.$session;if(r.load){const{started:c}=this,u={page:{host:s.host,params:n,get path(){return o.uses.path=!0,s.path},get query(){return o.uses.query=!0,s.query}},get session(){return o.uses.session=!0,l},get context(){return o.uses.context=!0,i({},a)},fetch(t,e){const r="string"==typeof t?t:t.url,{href:a}=new URL(r,new URL(s.path,document.baseURI));return o.uses.dependencies.push(a),c?fetch(t,e):ot(t,e)}};e&&(u.status=t,u.error=e);const h=await r.load.call(null,u);if(!h)return;o.loaded=function(t){const e=t.status&&t.status>=400&&t.status<=599&&!t.redirect;if(t.error||e){const r=t.status;if(!t.error&&e)return{status:r||500,error:new Error};const s="string"==typeof t.error?new Error(t.error):t.error;return s instanceof Error?!r||r<400||r>599?(console.warn('"error" returned from load() without a valid status code — defaulting to 500'),{status:500,error:s}):{status:r,error:s}:{status:500,error:new Error(`"error" property returned from load() must be a string or instance of Error, received type "${typeof s}"`)}}if(t.redirect){if(!t.status||3!==Math.floor(t.status/100))return{status:500,error:new Error('"redirect" property returned from load() must be accompanied by a 3xx status code')};if("string"!=typeof t.redirect)return{status:500,error:new Error('"redirect" property returned from load() must be a string')}}return t}(h),o.loaded.context&&(o.context=o.loaded.context)}return o}async _load({route:t,info:{path:e,decoded_path:r,query:s}},a){const o=`${r}?${s}`;if(!a){const t=this.cache.get(o);if(t)return t}const[n,l,c,u]=t,h=u?u(n.exec(r)):{},d=this.current.page&&{path:e!==this.current.page.path,params:Object.keys(h).filter((t=>this.current.page.params[t]!==h[t])),query:s.toString()!==this.current.page.query.toString(),session:this.session_id!==this.current.session_id},p={host:this.host,path:e,query:s,params:h};let f,g=[],m={},_=!1,y=200;l.forEach((t=>t()));t:for(let v=0;vr.uses.params.has(t)))||d.query&&r.uses.query||d.session&&r.uses.session||r.uses.dependencies.some((t=>this.invalid.has(t)))||_&&r.uses.context){t=await this._load_node({module:e,page:p,context:m});const r=v===l.length-1;if(t&&t.loaded){if(t.loaded.error&&(y=t.loaded.status,f=t.loaded.error),t.loaded.redirect)return{redirect:t.loaded.redirect,props:{},state:this.current};t.loaded.context&&(_=!0)}else if(r&&e.load)return}else t=r}catch(b){y=500,f=st(b)}if(f){for(;v--;)if(c[v]){let t,e,r=v;for(;!(e=g[r]);)r-=1;try{if(t=await this._load_node({status:y,error:f,module:await c[v](),page:p,context:e.context}),t&&t.loaded&&t.loaded.error)continue;g=g.slice(0,r+1).concat(t);break t}catch(b){continue}}return await this._load_error({status:y,error:f,path:e,query:s})}t&&t.loaded&&t.loaded.context&&(m=i(i({},m),t.loaded.context)),g.push(t)}return await this._get_navigation_result_from_branch({page:p,branch:g})}async _load_error({status:t,error:e,path:r,query:s}){const a={host:this.host,path:r,query:s,params:{}},o=await this._load_node({module:await this.fallback[0],page:a,context:{}}),n=[o,await this._load_node({status:t,error:e,module:await this.fallback[1],page:a,context:o&&o.loaded&&o.loaded.context||{}})];return await this._get_navigation_result_from_branch({page:a,branch:n})}}async function it({paths:t,target:e,session:r,host:s,route:a,spa:o,trailing_slash:n,hydrate:i}){const l=new nt({Root:Y,fallback:Q,target:e,session:r,host:s}),c=a?new rt({base:t.base,routes:H,trailing_slash:n,renderer:l}):null;D(c),C(t),i&&await l.start(i),c&&(o&&c.goto(location.href,{replaceState:!0},[]),c.init_listeners()),dispatchEvent(new CustomEvent("sveltekit:start"))}export{it as start}; diff --git a/edit/index.html b/edit/index.html index 24eab21a..e9fd5276 100644 --- a/edit/index.html +++ b/edit/index.html @@ -50,7 +50,7 @@ - + @@ -58,7 +58,7 @@