1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2691],{65451:function(e,t,i){i.d(t,{Fx:function(){return s},Qi:function(){return l},Vl:function(){return d},ex:function(){return o},k7:function(){return r},sd:function(){return a},t_:function(){return n}});let a="clipmind-sequence-storage",s="sequences",n=5,r=.2,l=.01,d=50,o={laneWidth:180,rowHeight:56,topMargin:80,bottomMargin:40,leftMargin:48,rightMargin:48,lifelineHeaderH:44,lifelineHeaderW:140,selfMessageRows:1.5,activationWidth:12,noteWidth:160,noteGap:12,fragmentHeaderH:24,fragmentPadding:16}},55509:function(e,t,i){i.d(t,{z:function(){return n}});var a=i(65451);function s(e,t){let i=Math.max(1,Math.floor(Math.max(20,t-18)/6.4));return Math.max(36,14+16*Math.max(1,(e||"").split("\n").reduce((e,t)=>0===t.length?e+1:e+Math.ceil(t.length/i),0)))}function n(e){let t=a.ex,i=[...e.lifelines].sort((e,t)=>e.order-t.order),n=[...e.messages].sort((e,t)=>e.order-t.order),r=new Map,l=i.map((e,i)=>{let a=t.leftMargin+t.lifelineHeaderW/2+i*t.laneWidth;return r.set(e.id,a),{id:e.id,x:a,headY:t.topMargin-t.lifelineHeaderH/2,bottomY:0,label:e.label,iconSlug:e.iconSlug}}),d=[],o=t.topMargin+t.lifelineHeaderH/2+t.rowHeight,h=new Map;for(let e of n){var g,c;let i=null!==(g=r.get(e.fromLifelineId))&&void 0!==g?g:0,a=null!==(c=r.get(e.toLifelineId))&&void 0!==c?c:0,s=e.fromLifelineId===e.toLifelineId,n=s?t.selfMessageRows:1,l=o;h.set(e.id,l),d.push({id:e.id,y:l,fromX:i,toX:a,isSelf:s,label:e.label,guard:e.guard,kind:e.kind}),o+=t.rowHeight*n}let f=o+t.bottomMargin+Math.max(0,.3*t.rowHeight),u=t.leftMargin+t.rightMargin+Math.max(i.length,1)*t.laneWidth;for(let e of l)e.bottomY=f-t.bottomMargin;for(let e of i){let i=l.find(t=>t.id===e.id);if(i){if(e.createdByMessageId){let a=h.get(e.createdByMessageId);void 0!==a&&(i.headY=a-t.lifelineHeaderH/2)}if(e.destroyAt){let t=h.get(e.destroyAt);void 0!==t&&(i.bottomY=t)}}}let m=e.fragments.map(i=>{let a=i.messageIds.map(e=>h.get(e)).filter(e=>void 0!==e),s=a.length?Math.min(...a)-.6*t.rowHeight:t.topMargin,n=a.length?Math.max(...a)+.4*t.rowHeight:s+t.rowHeight,l=new Set;for(let t of i.messageIds){let i=e.messages.find(e=>e.id===t);i&&(l.add(i.fromLifelineId),l.add(i.toLifelineId))}let d=Array.from(l).map(e=>r.get(e)).filter(e=>void 0!==e),o=d.length?Math.min(...d)-t.laneWidth/2+16:t.leftMargin,g=d.length?Math.max(...d)+t.laneWidth/2-16:u-t.rightMargin;return{id:i.id,kind:i.kind,guards:i.guards,x:o,y:s,width:g-o,height:n-s}}),p=new Map,v=function(t){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Set;if(p.has(t))return p.get(t);if(i.has(t))return 0;i.add(t);let a=e.activations.find(e=>e.id===t),s=(null==a?void 0:a.parentActivationId)?v(a.parentActivationId,i)+1:0;return p.set(t,s),s},I=[];for(let i of e.activations){let e=r.get(i.lifelineId),a=h.get(i.startMessageId),s=h.get(i.endMessageId);if(void 0===e||void 0===a||void 0===s)continue;let n=v(i.id);I.push({id:i.id,x:e-t.activationWidth/2+4*n,y:Math.min(a,s),width:t.activationWidth,height:Math.max(Math.abs(s-a),.4*t.rowHeight)})}let M=e.notes.map(e=>{var i,a;let n=e.anchorLifelineIds.map(e=>r.get(e)).filter(e=>void 0!==e),l=null!==(i=h.get(e.anchorMessageId))&&void 0!==i?i:t.topMargin;if("over"===e.position&&n.length>=1){let i=Math.min(...n),a=Math.max(t.noteWidth,Math.max(...n)-i+t.laneWidth/2);return{id:e.id,x:i-t.laneWidth/4,y:l-.6*t.rowHeight,width:a,height:s(e.text,a),text:e.text,position:e.position}}let d=null!==(a=n[0])&&void 0!==a?a:t.leftMargin;return{id:e.id,x:"left"===e.position?d-t.noteWidth-t.noteGap:d+t.noteGap,y:l-.6*t.rowHeight,width:t.noteWidth,height:s(e.text,t.noteWidth),text:e.text,position:e.position}}),x=l.map(e=>e.x-a.ex.lifelineHeaderW/2),w=l.map(e=>e.x+a.ex.lifelineHeaderW/2),y=M.map(e=>e.x),b=M.map(e=>e.x+e.width),S=m.map(e=>e.x),k=m.map(e=>e.x+e.width),L=Math.min(t.leftMargin,...x,...y,...S),_=L<8?8-L:0;if(_>0){for(let e of l)e.x+=_;for(let e of d)e.fromX+=_,e.toX+=_;for(let e of M)e.x+=_;for(let e of m)e.x+=_;for(let e of I)e.x+=_}let A=Math.max(u,...w.map(e=>e+_),...b.map(e=>e+_),...k.map(e=>e+_)),T=Math.max(f,...M.map(e=>e.y+e.height).map(e=>e+t.bottomMargin));for(let e of l)e.bottomY===f-t.bottomMargin&&(e.bottomY=T-t.bottomMargin);return{lifelines:l,messages:d,fragments:m,activations:I,notes:M,width:Math.max(u+_,A+8),height:T}}},19599:function(e,t,i){i.d(t,{o:function(){return c},t:function(){return f}});let a=0,s=e=>(a+=1,"".concat(e,"-").concat(Date.now().toString(36),"-").concat(a)),n=[{marker:"-->>+",kind:"return"},{marker:"-->>-",kind:"return"},{marker:"-->>",kind:"return"},{marker:"->>+",kind:"sync"},{marker:"->>-",kind:"sync"},{marker:"->>",kind:"sync"},{marker:"--x",kind:"destroy"},{marker:"->+",kind:"async"},{marker:"->-",kind:"async"},{marker:"->",kind:"async"},{marker:"-x",kind:"destroy"}],r=e=>e.replace(/^"|"$/g,"").replace(/^'|'$/g,"").trim(),l=new Set(["participant","actor","boundary","control","entity","database","queue","service","gateway","external"]),d=/\s*%%\s*clipmind:\s*(.+?)\s*$/i,o=e=>{let t=e.match(d);if(!t)return{line:e,annot:{}};let i={};for(let e of t[1].split(/[,;]/)){let t=e.indexOf("=");if(t<0)continue;let a=e.slice(0,t).trim().toLowerCase(),s=e.slice(t+1).trim();if(s){if("kind"===a){let e=s.toLowerCase();l.has(e)&&(i.kind=e)}else("icon"===a||"iconslug"===a)&&(i.iconSlug=s)}}return{line:e.replace(d,"").trim(),annot:i}},h=function(e,t,i){let a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"participant",n=arguments.length>4?arguments[4]:void 0,l=i.match(/^([A-Za-z0-9_]+)\s+as\s+(.+)$/),d=i,o=i;l?(d=l[1],o=r(l[2])):(d=r(i).replace(/\s+/g,"_"),o=r(i));let h=t.get(d);if(h)return"participant"!==a&&"participant"===h.kind&&(h.kind=a),n&&!h.iconSlug&&(h.iconSlug=n),h;let g={id:s("ll"),label:o||d,kind:a,order:e.length};return n&&(g.iconSlug=n),e.push(g),t.set(d,g),g},g=e=>{let t=e.toLowerCase();return"alt"===t||"opt"===t||"loop"===t||"par"===t||"critical"===t||"break"===t||"neg"===t||"ref"===t?t:null};function c(e){var t,i,a,l,d,c,f;let u=[],m=[],p=[],v=[],I=[],M=new Map,x=[],w="",y=null,b=new Map;for(let f of e.split(/\r?\n/).map(e=>e.trim()).filter(e=>e.length>0&&!e.startsWith("%%")).filter(e=>"```mermaid"!==e&&"```"!==e)){let{line:e,annot:S}=o(f);if(/^sequenceDiagram\b/i.test(e)||/^autonumber\b/i.test(e))continue;let k=e.match(/^title\s*[:]\s*(.+)$/i);if(k){w=r(k[1]);continue}let L=e.match(/^(participant|actor)\s+(.+)$/i);if(L){let e="actor"===L[1].toLowerCase()?"actor":"participant",i=null!==(t=S.kind)&&void 0!==t?t:e;h(u,M,L[2],i,S.iconSlug);continue}let _=e.match(/^create\s+(?:participant|actor)\s+(.+)$/i);if(_){let t=/^create\s+actor/i.test(e)?"actor":"participant",a=null!==(i=S.kind)&&void 0!==i?i:t;y=h(u,M,_[1],a,S.iconSlug).id;continue}
1let A=e.match(/^destroy\s+(.+)$/i);if(A){let e=h(u,M,A[1]),t=m[m.length-1];t&&(e.destroyAt=t.id);continue}let T=e.match(/^activate\s+(\S+)/i);if(T){let e=h(u,M,T[1]),t=b.get(e.id)||[],i={id:s("act"),lifelineId:e.id,startMessageId:"",endMessageId:""};t.push(i),b.set(e.id,t);continue}let B=e.match(/^deactivate\s+(\S+)/i);if(B){let e=h(u,M,B[1]),t=b.get(e.id)||[],i=t.pop();i&&(i.endMessageId=(null===(a=m[m.length-1])||void 0===a?void 0:a.id)||"",v.push(i)),b.set(e.id,t);continue}let D=e.match(/^note\s+(left\s+of|right\s+of|over)\s+([^:]+)\s*:\s*(.+)$/i);if(D){let e=D[1].toLowerCase().startsWith("left")?"left":D[1].toLowerCase().startsWith("right")?"right":"over",t=D[2].split(",").map(e=>e.trim()).map(e=>h(u,M,e).id),i=(null===(l=m[m.length-1])||void 0===l?void 0:l.id)||"";I.push({id:s("note"),text:r(D[3]),position:e,anchorLifelineIds:t,anchorMessageId:i});continue}let H=e.match(/^(alt|opt|loop|par|critical|break|neg|ref)\b\s*(.*)$/i),E=H&&g(H[1]);if(H&&E){let e={id:s("frag"),kind:E,label:E,guards:[H[2]||""],parentFragmentId:null===(d=x[x.length-1])||void 0===d?void 0:d.fragment.id,messageIds:[],branchMessageIds:[[]]};p.push(e),x.push({fragment:e,branchIndex:0});continue}if(/^(else|and)\b/i.test(e)){let t=x[x.length-1];if(t){let i=e.replace(/^(else|and)\b\s*/i,"").trim();t.fragment.guards.push(i),t.branchIndex+=1,t.fragment.branchMessageIds||(t.fragment.branchMessageIds=[[]]),t.fragment.branchMessageIds[t.branchIndex]=[]}continue}if(/^end\b/i.test(e)){x.pop();continue}let C=!1;for(let{marker:t,kind:i}of n){let a=e.indexOf(t);if(a<=0)continue;let n=e.slice(0,a).trim(),r=e.slice(a+t.length),l=r.indexOf(":"),d=(l>=0?r.slice(0,l):r).trim(),o=l>=0?r.slice(l+1).trim():"";if(!n||!d)continue;let g=h(u,M,n),f=h(u,M,d),p={id:s("msg"),fromLifelineId:g.id,toLifelineId:f.id,label:o,kind:i,order:m.length,activationStart:t.endsWith("+"),activationEnd:t.endsWith("-")};if(m.push(p),y){let e=u.find(e=>e.id===y);e&&(e.id===f.id||e.id===g.id)&&(e.createdByMessageId=p.id),y=null}let I=null===(c=b.get(f.id))||void 0===c?void 0:c.slice(-1)[0];if(I&&!I.startMessageId&&(I.startMessageId=p.id),t.endsWith("+")){let e={id:s("act"),lifelineId:f.id,startMessageId:p.id,endMessageId:""},t=b.get(f.id)||[];t.push(e),b.set(f.id,t)}if(t.endsWith("-")){let e=b.get(g.id)||[],t=e.pop();t&&(t.endMessageId=p.id,v.push(t)),b.set(g.id,e)}let w=x[x.length-1];w&&(w.fragment.messageIds.push(p.id),w.fragment.branchMessageIds||(w.fragment.branchMessageIds=[[]]),w.fragment.branchMessageIds[w.branchIndex]||(w.fragment.branchMessageIds[w.branchIndex]=[]),w.fragment.branchMessageIds[w.branchIndex].push(p.id)),C=!0;break}if(C)continue}for(let e of b.values())for(let t of e)t.startMessageId&&(t.endMessageId=t.endMessageId||(null===(f=m[m.length-1])||void 0===f?void 0:f.id)||t.startMessageId,v.push(t));return{title:w,lifelines:u,messages:m,fragments:p,activations:v,notes:I}}function f(e){return{id:s("seq"),title:e.title||"Untitled Sequence",lifelines:e.lifelines,messages:e.messages,fragments:e.fragments,activations:e.activations,notes:e.notes,themeId:"classical",createdAt:Date.now(),updatedAt:Date.now()}}},55912:function(e,t,i){i.d(t,{M:function(){return n}});let a=e=>{switch(e){case"sync":case"create":return"->>";case"async":default:return"->";case"return":return"-->>";case"destroy":return"--x"}},s=(e,t,i)=>i===t?"".concat(e," ").concat(t):"".concat(e," ").concat(t,' as "').concat(i.replace(/"/g,'\\"'),'"');function n(e){let t=["sequenceDiagram"];e.title&&t.push(" title: ".concat(e.title));let i=new Map,n=new Map(e.lifelines.map(e=>[e.id,e])),r=new Set;for(let a of[...e.lifelines].sort((e,t)=>e.order-t.order)){let e=(a.label||a.id).replace(/[^A-Za-z0-9_]/g,"_")||"P",n=e,l=1;for(;r.has(n);)l+=1,n="".concat(e,"_").concat(l);if(r.add(n),i.set(a.id,n),a.createdByMessageId)continue;let d="actor"===a.kind?"actor":"participant";t.push(" ".concat(s(d,n,a.label||n)))}let l=new Map,d=new Map;for(let t of e.lifelines){if(t.createdByMessageId){let e=l.get(t.createdByMessageId)||[];e.push(t.id),l.set(t.createdByMessageId,e)}if(t.destroyAt){let e=d.get(t.destroyAt)||[];e.push(t.id),d.set(t.destroyAt,e)}}let o=new Map;
1e.messages.forEach(e=>o.set(e.id,e));let h=new Map;for(let t of e.fragments)for(let e of t.messageIds)h.set(e,t.id);let g=new Map;for(let t of e.fragments)t.branchMessageIds&&t.branchMessageIds.forEach((e,t)=>{for(let i of e)g.set(i,t)});let c=new Map;for(let t of e.activations)t.startMessageId&&c.set(t.startMessageId,"".concat(c.get(t.startMessageId)||"","+")),t.endMessageId&&c.set(t.endMessageId,"".concat(c.get(t.endMessageId)||"","-"));let f=(e,s)=>{let n=i.get(e.fromLifelineId)||e.fromLifelineId,r=i.get(e.toLifelineId)||e.toLifelineId,l=a(e.kind)+(c.get(e.id)||""),d=e.label?": ".concat(e.guard?"[".concat(e.guard,"] "):"").concat(e.label):"";t.push("".concat(s).concat(n).concat(l).concat(r).concat(d))},u=[...e.messages].sort((e,t)=>e.order-t.order),m=[],p=new Map,v=new Map(e.fragments.map(e=>[e.id,e]));for(let e of u){let a=h.get(e.id);for(;m.length>0;){let e=m[m.length-1],i=v.get(e);if(!i||i.id===a)break;m.pop(),p.delete(e);let s=" ".repeat(m.length+1);t.push("".concat(s,"end"))}if(a&&!m.includes(a)){let e=v.get(a);if(e){let i=" ".repeat(m.length+1),s=e.guards[0]?" ".concat(e.guards[0]):"";t.push("".concat(i).concat(e.kind).concat(s)),m.push(a),p.set(a,0)}}if(a&&m.includes(a)){var I,M;let i=v.get(a),s=null!==(I=g.get(e.id))&&void 0!==I?I:0,n=null!==(M=p.get(a))&&void 0!==M?M:0;for(;i&&n<s&&n+1<i.guards.length;){n+=1;let e=" ".repeat(m.indexOf(a)+1),s=i.guards[n]||"";t.push("".concat(e,"else").concat(s?" ".concat(s):""))}p.set(a,n)}let r=" ".repeat(m.length+1),o=l.get(e.id);if(o)for(let e of o){let a=n.get(e);if(!a)continue;let l=i.get(a.id)||a.id,d="actor"===a.kind?"actor":"participant";t.push("".concat(r,"create ").concat(s(d,l,a.label||l)))}f(e,r);let c=d.get(e.id);if(c)for(let e of c){let a=n.get(e);if(!a)continue;let s=i.get(a.id)||a.id;t.push("".concat(r,"destroy ").concat(s))}}for(;m.length>0;){m.pop();let e=" ".repeat(m.length+1);t.push("".concat(e,"end"))}for(let a of e.notes){if(!a.anchorLifelineIds.length)continue;let e=a.anchorLifelineIds.map(e=>i.get(e)||e).join(", "),s="left"===a.position?"left of":"right"===a.position?"right of":"over";t.push(" note ".concat(s," ").concat(e,": ").concat(a.text))}return t.join("\n")}},75237:function(e,t,i){i.d(t,{O:function(){return s}});var a=i(85682);class s extends a.bA{constructor(e){super(),this.boundsProvider=e,this.fitToScreen=()=>{let e=this.boundsProvider.calcBox();e.w<=0||e.h<=0||this.fitToBounds(e)},this.zoom_to=e=>{this.zoomTo(e)}}}},32691:function(e,t,i){i.d(t,{K:function(){return x}});var a=i(99785),s=i(19599),n=i(55912),r=i(97451),l=i(88669),d=i(22934),o=i(35665),h=i(26465);class g{begin(e,t,i){this.graph.getLifeline(e)&&(this.fromLifelineId=e,this.fromX=t,this.fromY=i,this.pointer={x:t,y:i},this.targetLifelineId=e,this.editingMessageId=null,this.editingEndpoint=null)}beginEditEndpoint(e,t,i,a,s){this.graph.getMessage(e)&&this.graph.getLifeline(i)&&(this.fromLifelineId=i,this.fromX=a,this.fromY=s,this.pointer={x:a,y:s},this.targetLifelineId=i,this.editingMessageId=e,this.editingEndpoint=t)}update(e,t,i){this.fromLifelineId&&(this.pointer={x:e,y:t},this.targetLifelineId=i)}finish(){if(!this.fromLifelineId)return this.reset(),null;let e=this.fromLifelineId,t=this.targetLifelineId,i=this.editingMessageId,a=this.editingEndpoint;return(this.reset(),t)?i&&a?{mode:"from"===a?"edit-from":"edit-to",messageId:i,targetLifelineId:t}:{mode:"create",fromId:e,toId:t}:null}cancel(){this.reset()}reset(){this.fromLifelineId=null,this.fromX=0,this.fromY=0,this.pointer=null,this.targetLifelineId=null,this.editingMessageId=null,this.editingEndpoint=null}get active(){return null!==this.fromLifelineId}constructor(e){this.fromLifelineId=null,this.fromX=0,this.fromY=0,this.pointer=null,this.targetLifelineId=null,this.editingMessageId=null,this.editingEndpoint=null,this.graph=e,(0,a.ky)(this,{graph:!1},{autoBind:!0})}}var c=i(24277),f=i(30349),u=i(94433),m=i(85385),p=i(38576);class v{async export(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"sequence",a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};if("svg"===t){this.downloadBlob(new Blob([e],{type:"image/svg+xml;charset=utf-8"}),"".concat(i,".svg"));return}let s=await this.svgToImageBlob(e,"png"===t?"image/png":"image/jpeg",a);s&&this.downloadBlob(s,"".concat(i,".").concat(t))}async exportPdf(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"sequence",a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},s=await this.svgToImageBlob(e,"image/png",a);if(!s)return;let{PDFDocument:n}=await Promise.resolve().then(i.bind(i,8598)),r=await n.create(),l=await s.arrayBuffer(),d=await r.embedPng(l);r.addPage([d.width,d.height]).drawImage(d,{x:0,y:0,width:d.width,height:d.height});let o=await r.save();this.downloadBlob(new Blob([o],{type:"application/pdf"}),"".concat(t,".pdf"))}async toBlob(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return"svg"===t?new Blob([e],{type:"image/svg+xml;charset=utf-8"}):this.svgToImageBlob(e,"png"===t?"image/png":"image/jpeg",i)}svgToImageBlob(e,t,i){var a,s;let n=null!==(a=i.scale)&&void 0!==a?a:2,r=null!==(s=i.backgroundColor)&&void 0!==s?s:"#ffffff",{targetWidth:l,targetHeight:d,sealConfig:o}=i;return new Promise(i=>{let a=new Image;a.onload=()=>{let e=a.width*n,s=a.height*n;l&&d&&(e=l,s=d);let h=document.createElement("canvas");h.width=e,h.height=s;let g=h.getContext("2d");if(!g){i(null);return}if(("image/jpeg"===t||"transparent"!==r)&&(g.fillStyle="transparent"===r?"#ffffff"
1:r,g.fillRect(0,0,h.width,h.height)),l&&d){let t=Math.min(e/a.width,s/a.height),i=a.width*t,n=a.height*t;g.drawImage(a,(e-i)/2,(s-n)/2,i,n)}else g.scale(n,n),g.drawImage(a,0,0);(async()=>{g.setTransform(1,0,0,1,0,0),await this.addBrand(g,e,s,o,n),h.toBlob(e=>i(e),t,"image/jpeg"===t?.92:void 0)})()},a.onerror=()=>{console.error("[SequenceImageExporter] failed to load SVG as <img>"),i(null)},a.src=URL.createObjectURL(new Blob([e],{type:"image/svg+xml;charset=utf-8"}))})}async addBrand(e,t,i,a){let s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,n=(null==a?void 0:a.style)||m.Ix.Default;if(n!==m.Ix.None){if(e.save(),e.fillStyle="#686868",e.strokeStyle="#686868",e.globalAlpha=.8,[m.Ix.Square,m.Ix.Tech,m.Ix.Grunge,m.Ix.Oval,m.Ix.Hexagon,m.Ix.GoldWax,m.Ix.RedWax].includes(n))await this.drawSvgSeal(e,t,i,n,(null==a?void 0:a.text)||"CLIPMIND",null==a?void 0:a.prefix,s);else{e.font="lighter 18px Lexend, Arial, sans-serif",e.textAlign="center",e.textBaseline="bottom";let s="".concat((null==a?void 0:a.prefix)||"Generated with"," ").concat((null==a?void 0:a.text)||"ClipMind");e.fillText(s,t/2,i-40)}e.restore()}}async drawSvgSeal(e,t,i,a,s,n){let r=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1,l=(0,p.R)(a,s,n,r),d=new Image,o=URL.createObjectURL(new Blob([l],{type:"image/svg+xml;charset=utf-8"}));return new Promise(a=>{d.onload=()=>{let s=d.naturalWidth||200*r,n=d.naturalHeight||200*r,l=s/r,h=n/r;e.drawImage(d,t-l-40,i-h-40,l,h),URL.revokeObjectURL(o),a()},d.onerror=()=>{URL.revokeObjectURL(o),a()},d.src=o})}downloadBlob(e,t){let i=URL.createObjectURL(e),a=document.createElement("a");a.href=i,a.download=t,document.body.appendChild(a),a.click(),document.body.removeChild(a),URL.revokeObjectURL(i)}}var I=i(75237);let M=e=>{let t={id:"ll-client",label:"Client",kind:"actor",order:0},i={id:"ll-server",label:"Server",kind:"participant",order:1},a={id:"ll-db",label:"Database",kind:"database",order:2},s={id:"m-1",fromLifelineId:t.id,toLifelineId:i.id,label:"GET /resource",kind:"sync",order:0},n={id:"m-2",fromLifelineId:i.id,toLifelineId:a.id,label:"SELECTâ¦",kind:"sync",order:1},r={id:"m-3",fromLifelineId:a.id,toLifelineId:i.id,label:"rows",kind:"return",order:2},l={id:"m-4",fromLifelineId:i.id,toLifelineId:t.id,label:"JSON",kind:"return",order:3};return{id:e,title:"Untitled Sequence",lifelines:[t,i,a],messages:[s,n,r,l],fragments:[],activations:[],notes:[],themeId:"classical",createdAt:Date.now(),updatedAt:Date.now()}};class x{async exportImage(e,t,i,a){await this.imageExporter.export(e,t,i,a)}async exportPdf(e,t,i){await this.imageExporter.exportPdf(e,t,i)}get data(){return this.graph.data}get title(){return this.graph.data.title}get theme(){return(0,r.Y)(this.graph.data.themeId)}setTitle(e){this.graph.data.title=e,this.graph.data.updatedAt=Date.now(),this.scheduleSave()}setTheme(e){this.graph.data.themeId=e,this.graph.data.updatedAt=Date.now(),this.scheduleSave()}setLoading(e){this.loading=e}setGenerating(e){this.generating=e}setDisplay(e){this.display=e}loadFromMermaid(e){let t=(0,s.o)(e),i=(0,s.t)(t);i.id=this.id,i.themeId=this.graph.data.themeId,i.title=t.title||this.graph.data.title,this.graph.loadData(i),this.graph.data.updatedAt=Date.now()}toMermaid(){return(0,n.M)(this.graph.data)}addLifeline(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"Participant",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"participant",i=this.graph.addLifeline(e,t);return this.selection.select("lifeline",i.id),this.saveToHistory(),this.scheduleSave(),i}addMessage(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"sync",s=this.graph.addMessage(e,t,i,a);return s&&(this.selection.select("message",s.id),this.saveToHistory(),this.scheduleSave()),s}removeLifeline(e){this.graph.removeLifeline(e),this.selection.isSelected("lifeline",e)&&this.selection.clear(),this.saveToHistory(),this.scheduleSave()}removeMessage(e){this.graph.removeMessage(e),this.selection.isSelected("message",e)&&this.selection.clear(),this.saveToHistory(),this.scheduleSave()}setMessageKind(e,t){let i=this.graph.getMessage(e);if(!i)return;let a=i.kind,s=i.toLifelineId;a!==t&&("destroy"===a?this.graph.mutateLifeline(s,{destroyAt:void 0}):"create"===a&&this.graph.mutateLifeline(s,{createdByMessageId:void 0}),this.graph.mutateMessage(e,{kind:t}),"destroy"===t?this.graph.mutateLifeline(s,{destroyAt:e}):"create"===t&&this.graph.mutateLifeline(s,{createdByMessageId:e}),this.saveToHistory(),this.scheduleSave())}addFragment(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"alt",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],i=this.graph.addFragment(e,"",[""],t);return this.selection.select("fragment",i.id),this.saveToHistory(),this.scheduleSave(),i}removeFragment(e){this.graph.removeFragment(e),this.selection.isSelected("fragment",e)&&this.selection.clear(),this.saveToHistory(),this.scheduleSave()}addFragmentForSelection(){return"message"===this.selection.selectedKind&&this.selection.selectedId?this.addFragment("alt",[this.selection.selectedId]):this.addFragment("alt",[])}addActivation(e,t,i){let a=this.graph.addActivation(e,t,i);return a&&(this.selection.select("activation",a.id),this.saveToHistory(),this.scheduleSave()),a}removeActivation(e){this.graph.removeActivation(e),this.selection.isSelected("activation",e)&&this.selection.clear(),this.saveToHistory(),this.scheduleSave()}addActivationForSelection(){var e;if("message"!==this.selection.selectedKind||!this.selection.selectedId)return null;let t=this.graph.getMessage(this.selection.selectedId);if(!t)return null;let i=this.graph.messages,a=i.findIndex(e=>e.id===t.id),s=null!==(e=i[a+1])&&void 0!==e?e:t;return this.addActivation(t.toLifelineId,t.id,s.id)}addNote(e,t,i,a){let s=this.graph.addNote(e,t,i,a);return s&&(this.selection.select("note",s.id),this.saveToHistory(),this.scheduleSave()),s}removeNote(e){this.graph.removeNote(e),this.selection.isSelected("note",e)&&this.selection.clear(),this.saveToHistory(),this.scheduleSave()}addNoteForSelection(){if("message"!==this.selection.selectedKind||!this.selection.selectedId)return null;let e=this.graph.getMessage(this.selection.selectedId);return e?this.addNote("Note","over",[e.fromLifelineId],e.id):null}deleteSelected(){if(!this.selection.hasSelection)return;let e=[...this.selection.items],t={activation:0,note:1,fragment:2,message:3,lifeline:4};for(let{kind:i,id:a}of(e.sort((e,i)=>t[e.kind]-t[i.kind]),e))switch(i){case"lifeline":this.graph.removeLifeline(a);break;
1case"message":this.graph.removeMessage(a);break;case"fragment":this.graph.removeFragment(a);break;case"activation":this.graph.removeActivation(a);break;case"note":this.graph.removeNote(a)}this.selection.clear(),this.saveToHistory(),this.scheduleSave()}selectAllMessages(){this.selection.selectMany("message",this.graph.messages.map(e=>e.id))}duplicateSelected(){var e,t,i,a,s,n;if(!this.selection.hasSelection)return;let r=[...this.selection.items],l=new Map,d=[];for(let{kind:e,id:t}of r.filter(e=>"lifeline"===e.kind)){let e=this.graph.getLifeline(t);if(!e)continue;let i=this.graph.addLifeline("".concat(e.label," (copy)"),e.kind);l.set(t,i.id),d.push({kind:"lifeline",id:i.id})}for(let{kind:i,id:a}of r.filter(e=>"message"===e.kind)){let i=this.graph.getMessage(a);if(!i)continue;let s=null!==(e=l.get(i.fromLifelineId))&&void 0!==e?e:i.fromLifelineId,n=null!==(t=l.get(i.toLifelineId))&&void 0!==t?t:i.toLifelineId,r=this.graph.addMessage(s,n,i.label,i.kind);r&&(l.set(a,r.id),d.push({kind:"message",id:r.id}))}for(let{kind:e,id:t}of r.filter(e=>"activation"===e.kind)){let e=this.graph.getActivation(t);if(!e)continue;let n=null!==(i=l.get(e.lifelineId))&&void 0!==i?i:e.lifelineId,r=null!==(a=l.get(e.startMessageId))&&void 0!==a?a:e.startMessageId,o=null!==(s=l.get(e.endMessageId))&&void 0!==s?s:e.endMessageId,h=this.graph.addActivation(n,r,o);h&&(l.set(t,h.id),d.push({kind:"activation",id:h.id}))}for(let{kind:e,id:t}of r.filter(e=>"note"===e.kind)){let e=this.graph.getNote(t);if(!e)continue;let i=null!==(n=l.get(e.anchorMessageId))&&void 0!==n?n:e.anchorMessageId,a=e.anchorLifelineIds.map(e=>{var t;return null!==(t=l.get(e))&&void 0!==t?t:e}),s=this.graph.addNote(e.text,e.position,a,i);s&&(l.set(t,s.id),d.push({kind:"note",id:s.id}))}for(let{kind:e,id:t}of r.filter(e=>"fragment"===e.kind)){let e=this.graph.getFragment(t);if(!e)continue;let i=e.messageIds.map(e=>{var t;return null!==(t=l.get(e))&&void 0!==t?t:e}),a=this.graph.addFragment(e.kind,e.label,[...e.guards],i);l.set(t,a.id),d.push({kind:"fragment",id:a.id})}this.selection.setItems(d),this.saveToHistory(),this.scheduleSave()}async copyToClipboard(){if(!this.selection.hasSelection)return;let e=[...this.selection.items],t={kind:"clipmind-sequence-clip",version:1,lifelines:e.filter(e=>"lifeline"===e.kind).map(e=>this.graph.getLifeline(e.id)).filter(e=>!!e),messages:e.filter(e=>"message"===e.kind).map(e=>this.graph.getMessage(e.id)).filter(e=>!!e),fragments:e.filter(e=>"fragment"===e.kind).map(e=>this.graph.getFragment(e.id)).filter(e=>!!e),activations:e.filter(e=>"activation"===e.kind).map(e=>this.graph.getActivation(e.id)).filter(e=>!!e),notes:e.filter(e=>"note"===e.kind).map(e=>this.graph.getNote(e.id)).filter(e=>!!e)};try{await navigator.clipboard.writeText(JSON.stringify(t))}catch(e){}}async pasteFromClipboard(){var e,t,i,a,s,n,r,l,d,o,h,g,c,f;let u,m;try{u=await navigator.clipboard.readText()}catch(e){return}try{m=JSON.parse(u)}catch(e){return}if((null==m?void 0:m.kind)!=="clipmind-sequence-clip")return;let p=new Map,v=[];for(let t of null!==(e=m.lifelines)&&void 0!==e?e:[]){let e=this.graph.addLifeline(t.label,t.kind);p.set(t.id,e.id),v.push({kind:"lifeline",id:e.id})}for(let e of null!==(t=m.messages)&&void 0!==t?t:[]){let t=null!==(i=p.get(e.fromLifelineId))&&void 0!==i?i:e.fromLifelineId,s=null!==(a=p.get(e.toLifelineId))&&void 0!==a?a:e.toLifelineId;if(!this.graph.getLifeline(t)||!this.graph.getLifeline(s))continue;let n=this.graph.addMessage(t,s,e.label,e.kind);n&&(p.set(e.id,n.id),v.push({kind:"message",id:n.id}))}for(let e of null!==(s=m.activations)&&void 0!==s?s:[]){let t=null!==(n=p.get(e.lifelineId))&&void 0!==n?n:e.lifelineId,i=null!==(r=p.get(e.startMessageId))&&void 0!==r?r:e.startMessageId,a=null!==(l=p.get(e.endMessageId))&&void 0!==l?l:e.endMessageId;if(!this.graph.getLifeline(t)||!this.graph.getMessage(i)||!this.graph.getMessage(a))continue;let s=this.graph.addActivation(t,i,a);s&&(p.set(e.id,s.id),v.push({kind:"activation",id:s.id}))}for(let e of null!==(d=m.notes)&&void 0!==d?d:[]){let t=null!==(o=p.get(e.anchorMessageId))&&void 0!==o?o:e.anchorMessageId,i=(null!==(h=e.anchorLifelineIds)&&void 0!==h?h:[]).map(e=>{var t;return null!==(t=p.get(e))&&void 0!==t?t:e});if(!this.graph.getMessage(t))continue;let a=this.graph.addNote(e.text,e.position,i,t);a&&(p.set(e.id,a.id),v.push({kind:"note",id:a.id}))}for(let e of null!==(g=m.fragments)&&void 0!==g?g:[]){let t=(null!==(c=e.messageIds)&&void 0!==c?c:[]).map(e=>{var t;return null!==(t=p.get(e))&&void 0!==t?t:e}),i=this.graph.addFragment(e.kind,e.label,[...null!==(f=e.guards)&&void 0!==f?f:[""]],t);p.set(e.id,i.id),v.push({kind:"fragment",id:i.id})}v.length>0&&(this.selection.setItems(v),this.saveToHistory(),this.scheduleSave())}commitBoxSelection(){let e=this.selection.getBox();
1if(!e||e.w<2&&e.h<2)return;let t=[],i=this.layout.result,a=t=>t.x<e.x+e.w&&t.x+t.w>e.x&&t.y<e.y+e.h&&t.y+t.h>e.y;for(let e of i.lifelines)a({x:e.x-50,y:e.headY,w:100,h:40})&&t.push({kind:"lifeline",id:e.id});for(let e of i.messages){let i=Math.min(e.fromX,e.toX),s=Math.max(Math.abs(e.toX-e.fromX),14);a({x:i,y:e.y-7,w:s,h:14})&&t.push({kind:"message",id:e.id})}for(let e of i.fragments)a({x:e.x,y:e.y,w:e.width,h:e.height})&&t.push({kind:"fragment",id:e.id});for(let e of i.activations)a({x:e.x,y:e.y,w:e.width,h:e.height})&&t.push({kind:"activation",id:e.id});for(let e of i.notes)a({x:e.x,y:e.y,w:e.width,h:36})&&t.push({kind:"note",id:e.id});this.selection.setItems(t)}addLifelineAtEnd(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"participant",t=function(e){let t=new Set(e);for(let e=1;e<=999;e+=1){let i="Participant ".concat(e);if(!t.has(i))return i}return"Participant"}(this.graph.lifelines.map(e=>e.label));return this.addLifeline(t,e)}addMessageAtEnd(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"sync";if(this.graph.lifelines.length<2)return null;let t=this.graph.lifelines[0].id,i=this.graph.lifelines[1].id;return this.addMessage(t,i,"",e)}commitEditingLabel(){if(!this.editing.active)return;let e=this.editing.draft.trim();"lifeline"===this.editing.target&&this.editing.targetId?e&&(this.graph.mutateLifeline(this.editing.targetId,{label:e}),this.saveToHistory(),this.scheduleSave()):"message"===this.editing.target&&this.editing.targetId?(this.graph.mutateMessage(this.editing.targetId,{label:e}),this.saveToHistory(),this.scheduleSave()):"fragment"===this.editing.target&&this.editing.targetId?(this.graph.mutateFragment(this.editing.targetId,{label:e}),this.saveToHistory(),this.scheduleSave()):"note"===this.editing.target&&this.editing.targetId?(this.graph.mutateNote(this.editing.targetId,{text:e}),this.saveToHistory(),this.scheduleSave()):"title"===this.editing.target&&this.setTitle(e||"Untitled Sequence"),this.editing.end()}serialize(){return{...this.graph.data,view:{scale:this.canvas.zoom.value,x:this.canvas.scrollX,y:this.canvas.scrollY},paywalled:this.paywalled}}deserialize(e){this.id=e.id,this.paywalled=!0===e.paywalled,this.graph.loadData(e),e.view&&requestAnimationFrame(()=>{this.canvas.setView(e.view)}),this.display=!0}saveToHistory(){this.history.push({data:JSON.parse(JSON.stringify(this.graph.data))})}undo(){let e=this.history.undo();e&&(this.graph.loadData(e.data),this.selection.clear(),this.scheduleSave())}redo(){let e=this.history.redo();e&&(this.graph.loadData(e.data),this.selection.clear(),this.scheduleSave())}get canUndo(){return this.history.canUndo}get canRedo(){return this.history.canRedo}scheduleSave(){this.storage.scheduleSave(()=>this.serialize())}async saveSequenceData(){this.storage.flush(),await this.storage.save(this.serialize())}async flushAndWait(){await this.storage.flushAndWait(()=>this.serialize())}async loadSequenceData(e){this.loading=!0;let t=await this.storage.load(e);return this.loading=!1,!!t&&(this.deserialize(t),this.history.clear(),this.saveToHistory(),!0)}async deleteSequenceData(){await this.storage.delete(this.id)}constructor(e,t){this.loading=!0,this.generating=!1,this.display=!1,this.id=e,this.graph=new l.Q(t||M(e)),this.selection=new d.Z,this.editing=new o.$,this.reorder=new h.v(this.graph),this.connecting=new g(this.graph),this.layout=new c.n(this.graph),this.history=new f.E,this.storage=new u.A,this.imageExporter=new v,this.canvas=new I.O({calcBox:()=>this.layout.calcBox()}),(0,a.ky)(this,{graph:!1,selection:!1,editing:!1,reorder:!1,connecting:!1,layout:!1,history:!1,storage:!1,imageExporter:!1,canvas:!1},{autoBind:!0})}}},35665:function(e,t,i){i.d(t,{$:function(){return s}});var a=i(99785);class s{begin(e,t,i){this.target=e,this.targetId=t,this.draft=i}setDraft(e){this.draft=e}end(){this.target=null,this.targetId=null,this.draft=""}isEditing(e,t){return this.target===e&&this.targetId===t}get active(){return null!==this.target}constructor(){this.target=null,this.targetId=null,this.draft="",(0,a.ky)(this,{},{autoBind:!0})}}},88669:function(e,t,i){i.d(t,{Q:function(){return n}});var a=i(99785);let s=e=>"".concat(e,"-").concat(Date.now().toString(36),"-").concat(Math.random().toString(36).slice(2,6));
1class n{get data(){return this._data}get lifelines(){return this._data.lifelines}get messages(){return this._data.messages}get fragments(){return this._data.fragments}get activations(){return this._data.activations}get notes(){return this._data.notes}setData(e){this._data=e}getLifeline(e){return this._data.lifelines.find(t=>t.id===e)}getMessage(e){return this._data.messages.find(t=>t.id===e)}getFragment(e){return this._data.fragments.find(t=>t.id===e)}getActivation(e){return this._data.activations.find(t=>t.id===e)}getNote(e){return this._data.notes.find(t=>t.id===e)}addLifeline(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"participant",i=arguments.length>2?arguments[2]:void 0,a={id:s("ll"),label:e,kind:t,order:0};return void 0===i||i>=this._data.lifelines.length?this._data.lifelines.push(a):this._data.lifelines.splice(Math.max(0,i),0,a),this.reindexLifelines(),this._data.updatedAt=Date.now(),a}removeLifeline(e){this._data.lifelines=this._data.lifelines.filter(t=>t.id!==e),this._data.messages=this._data.messages.filter(t=>t.fromLifelineId!==e&&t.toLifelineId!==e),this._data.activations=this._data.activations.filter(t=>t.lifelineId!==e);let t=new Set(this._data.messages.map(e=>e.id));this._data.notes=this._data.notes.filter(e=>t.has(e.anchorMessageId)),this.reindexLifelines(),this.reindexMessages(),this._data.updatedAt=Date.now()}mutateLifeline(e,t){let i=this.getLifeline(e);i&&(Object.assign(i,t),this._data.updatedAt=Date.now())}reorderLifeline(e,t){let i=this._data.lifelines;if(e===t||e<0||e>=i.length||t<0||t>=i.length)return;let[a]=i.splice(e,1);i.splice(t,0,a),this.reindexLifelines(),this._data.updatedAt=Date.now()}reindexLifelines(){this._data.lifelines.forEach((e,t)=>{e.order=t})}addMessage(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"sync",n=arguments.length>4?arguments[4]:void 0;if(!this.getLifeline(e)||!this.getLifeline(t))return null;let r={id:s("msg"),fromLifelineId:e,toLifelineId:t,label:i,kind:a,order:0};return void 0===n||n>=this._data.messages.length?this._data.messages.push(r):this._data.messages.splice(Math.max(0,n),0,r),this.reindexMessages(),this._data.updatedAt=Date.now(),r}removeMessage(e){this._data.messages=this._data.messages.filter(t=>t.id!==e),this._data.activations=this._data.activations.filter(t=>t.startMessageId!==e&&t.endMessageId!==e),this._data.notes=this._data.notes.filter(t=>t.anchorMessageId!==e),this._data.fragments=this._data.fragments.map(t=>{var i;return{...t,messageIds:t.messageIds.filter(t=>t!==e),branchMessageIds:null===(i=t.branchMessageIds)||void 0===i?void 0:i.map(t=>t.filter(t=>t!==e))}}),this.reindexMessages(),this._data.updatedAt=Date.now()}mutateMessage(e,t){let i=this.getMessage(e);i&&(Object.assign(i,t),this._data.updatedAt=Date.now())}reorderMessage(e,t){let i=this._data.messages;if(e===t||e<0||e>=i.length||t<0||t>=i.length)return;let[a]=i.splice(e,1);i.splice(t,0,a),this.reindexMessages(),this._data.updatedAt=Date.now()}reindexMessages(){this._data.messages.forEach((e,t)=>{e.order=t})}addFragment(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"alt",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[""],a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],n=i.length>0?i:[""],r={id:s("frag"),kind:e,label:t||e,guards:n,messageIds:[...a],branchMessageIds:n.map((e,t)=>0===t?[...a]:[])};return this._data.fragments.push(r),this._data.updatedAt=Date.now(),r}removeFragment(e){this._data.fragments=this._data.fragments.filter(t=>t.id!==e),this._data.fragments=this._data.fragments.map(t=>t.parentFragmentId===e?{...t,parentFragmentId:void 0}:t),this._data.updatedAt=Date.now()}mutateFragment(e,t){let i=this.getFragment(e);i&&(Object.assign(i,t),this._data.updatedAt=Date.now())}addActivation(e,t,i){if(!this.getLifeline(e)||!this.getMessage(t)||!this.getMessage(i))return null;let a={id:s("act"),lifelineId:e,startMessageId:t,endMessageId:i};return this._data.activations.push(a),this._data.updatedAt=Date.now(),a}removeActivation(e){this._data.activations=this._data.activations.filter(t=>t.id!==e),this._data.updatedAt=Date.now()}mutateActivation(e,t){let i=this.getActivation(e);i&&(Object.assign(i,t),this._data.updatedAt=Date.now())}
1addNote(e,t,i,a){if(0===i.length||!this.getMessage(a))return null;for(let e of i)if(!this.getLifeline(e))return null;let n={id:s("note"),text:e,position:t,anchorLifelineIds:[...i],anchorMessageId:a};return this._data.notes.push(n),this._data.updatedAt=Date.now(),n}removeNote(e){this._data.notes=this._data.notes.filter(t=>t.id!==e),this._data.updatedAt=Date.now()}mutateNote(e,t){let i=this.getNote(e);i&&(Object.assign(i,t),this._data.updatedAt=Date.now())}loadData(e){this._data=e}constructor(e){this._data=e,(0,a.ky)(this,{},{autoBind:!0})}}},30349:function(e,t,i){i.d(t,{E:function(){return n}});var a=i(99785),s=i(65451);class n{push(e){let t=JSON.parse(JSON.stringify(e));if(this.cursor<this.stack.length-1&&(this.stack=this.stack.slice(0,this.cursor+1)),this.stack.push(t),this.stack.length>this.max){let e=this.stack.length-this.max;this.stack=this.stack.slice(e)}this.cursor=this.stack.length-1}undo(){return this.canUndo?(this.cursor-=1,JSON.parse(JSON.stringify(this.stack[this.cursor]))):null}redo(){return this.canRedo?(this.cursor+=1,JSON.parse(JSON.stringify(this.stack[this.cursor]))):null}get canUndo(){return this.cursor>0}get canRedo(){return this.cursor<this.stack.length-1}clear(){this.stack=[],this.cursor=-1}get size(){return this.stack.length}constructor(){this.stack=[],this.cursor=-1,this.max=s.Vl,(0,a.ky)(this,{},{autoBind:!0})}}},24277:function(e,t,i){i.d(t,{n:function(){return n}});var a=i(99785),s=i(55509);class n{get result(){return(0,s.z)(this.graph.data)}calcBox(){let e=this.result;return{x:0,y:0,w:e.width,h:e.height}}constructor(e){this.graph=e,(0,a.ky)(this,{graph:!1},{autoBind:!0})}}},26465:function(e,t,i){i.d(t,{v:function(){return s}});var a=i(99785);class s{beginLifeline(e,t,i){var a;this.graph.getLifeline(e)&&(this.kind="lifeline",this.draggingId=e,this.pointer={x:t,y:i},this.previewIndex=null!==(a=this.graph.lifelines.findIndex(t=>t.id===e))&&void 0!==a?a:null)}beginMessage(e,t,i){var a;this.graph.getMessage(e)&&(this.kind="message",this.draggingId=e,this.pointer={x:t,y:i},this.previewIndex=null!==(a=this.graph.messages.findIndex(t=>t.id===e))&&void 0!==a?a:null)}updatePointer(e,t,i){if(!this.kind||!this.draggingId)return;this.pointer={x:e,y:t};let a="lifeline"===this.kind?e:t,s=0,n=1/0;i.forEach((e,t)=>{let i=Math.abs(a-e);i<n&&(n=i,s=t)}),this.previewIndex=s}finish(){if(!this.kind||!this.draggingId||null===this.previewIndex)return this.reset(),!1;let e=("lifeline"===this.kind?this.graph.lifelines:this.graph.messages).findIndex(e=>e.id===this.draggingId),t=this.previewIndex;return this.reset(),!(e<0)&&e!==t&&("lifeline"===this.kindWas?this.graph.reorderLifeline(e,t):this.graph.reorderMessage(e,t),!0)}cancel(){this.reset()}reset(){this.kindWas=this.kind,this.kind=null,this.draggingId=null,this.pointer=null,this.previewIndex=null}get active(){return null!==this.kind}constructor(e){this.kind=null,this.draggingId=null,this.pointer=null,this.previewIndex=null,this.kindWas=null,this.graph=e,(0,a.ky)(this,{graph:!1},{autoBind:!0})}}},22934:function(e,t,i){i.d(t,{Z:function(){return s}});var a=i(99785);class s{get selectedKind(){return this.items.length>0?this.items[this.items.length-1].kind:null}get selectedId(){return this.items.length>0?this.items[this.items.length-1].id:null}get hasSelection(){return this.items.length>0}get isMultiSelect(){return this.items.length>1}select(e,t){this.items=[{kind:e,id:t}]}add(e,t){this.has(e,t)||(this.items=[...this.items,{kind:e,id:t}])}remove(e,t){this.items=this.items.filter(i=>!(i.kind===e&&i.id===t))}toggle(e,t){this.has(e,t)?this.remove(e,t):this.add(e,t)}selectMany(e,t){this.items=t.map(t=>({kind:e,id:t}))}setItems(e){this.items=[...e]}clear(){this.items=[]}has(e,t){return null!==e&&null!==t&&this.items.some(i=>i.kind===e&&i.id===t)}isSelected(e,t){return this.has(e,t)}setHovered(e,t){this.hoveredKind=e,this.hoveredId=t}beginBox(e,t){this.boxStart={x:e,y:t},this.boxCurrent={x:e,y:t}}updateBox(e,t){this.boxStart&&(this.boxCurrent={x:e,y:t})}endBox(){this.boxStart=null,this.boxCurrent=null}get isBoxing(){return null!==this.boxStart&&null!==this.boxCurrent}getBox(){if(!this.boxStart||!this.boxCurrent)return null;let e=Math.min(this.boxStart.x,this.boxCurrent.x);return{x:e,y:Math.min(this.boxStart.y,this.boxCurrent.y),w:Math.abs(this.boxCurrent.x-this.boxStart.x),h:Math.abs(this.boxCurrent.y-this.boxStart.y)}}constructor(){this.items=[],this.hoveredKind=null,this.hoveredId=null,this.boxStart=null,this.boxCurrent=null,(0,a.ky)(this,{},{autoBind:!0})}}},94433:function(e,t,i){i.d(t,{A:function(){return r}});var a=i(7258),s=i(5914),n=i(65451);class r{async save(e){try{await (0,a.sx)(n.sd,n.Fx,e)}catch(e){console.error("[SequenceStorage] Save failed:",e)}this.scheduleServerSave(e)}scheduleServerSave(e){let t=e.id;this.pendingServerData[t]=e,this.serverSaveTimers[t]||(this.serverSaveTimers[t]=setTimeout(async()=>{let e=this.pendingServerData[t];if(delete this.pendingServerData[t],delete this.serverSaveTimers[t],e)try{await (0,s.dN)("/sequences/".concat(e.id),"PUT",{body:e,retry:1}).fetch()}catch(e){console.error("[SequenceStorage] Server save failed:",e)}},this.SERVER_THROTTLE_MS))}scheduleSave(e){this.saveTimeout&&clearTimeout(this.saveTimeout),this.saveTimeout=setTimeout(()=>{this.save(e()),this.saveTimeout=null},this.SAVE_DEBOUNCE_MS)}async flushAndWait(e){this.saveTimeout&&(clearTimeout(this.saveTimeout),this.saveTimeout=null),await this.save(e())}async load(e){try{let t=await (0,a.mf)(n.sd,n.Fx,e);if(t)return t}catch(e){console.error("[SequenceStorage] IndexedDB load failed:",e)}try{let t=await (0,s.dN)("/sequences/".concat(e),"GET").fetch();if(!t.ok)return null;let i=await t.json(),r=null==i?void 0:i.data;if(r){try{await (0,a.sx)(n.sd,n.Fx,r)}catch(e){}return r}}catch(e){console.error("[SequenceStorage] Server load failed:",e)}return null}async loadAll(){try{return await (0,a.A2)(n.sd,n.Fx)}
1catch(e){return console.error("[SequenceStorage] LoadAll failed:",e),[]}}async delete(e){try{await (0,a.Iz)(n.sd,n.Fx,e)}catch(e){console.error("[SequenceStorage] Delete failed:",e)}}flush(){this.saveTimeout&&(clearTimeout(this.saveTimeout),this.saveTimeout=null)}constructor(){this.saveTimeout=null,this.SAVE_DEBOUNCE_MS=1e3,this.serverSaveTimers={},this.pendingServerData={},this.SERVER_THROTTLE_MS=1500}}},97451:function(e,t,i){i.d(t,{Y:function(){return d},p:function(){return l}});let a={id:"classical",name:"Classical",borderStyle:"clean",fontFamily:"Lexend, Inter, sans-serif",lifeline:{headFill:"#ffffff",headStroke:"#334155",headText:"#0f172a",lineColor:"#94a3b8",lineDash:"6 4"},message:{syncColor:"#0f172a",asyncColor:"#334155",returnColor:"#64748b",label:"#0f172a",guard:"#7c3aed"},fragment:{fill:"rgba(248, 250, 252, 0.6)",border:"#cbd5e1",headerFill:"#e2e8f0",headerText:"#0f172a"},activation:{fill:"#e2e8f0",stroke:"#475569"},note:{fill:"#fef9c3",border:"#facc15",text:"#713f12"},canvas:{background:"#ffffff"}},s={...a,id:"handdrawn",name:"Handdrawn",borderStyle:"handdrawn",fontFamily:'"Xiaolai SC", "Comic Sans MS", cursive'},n={...a,id:"handdrawn-soft",name:"Soft",borderStyle:"handdrawn-soft",fontFamily:'"Xiaolai SC", "Comic Sans MS", cursive',canvas:{background:"#fdfaf6"}},r={...a,id:"handdrawn-sketch",name:"Sketch",borderStyle:"handdrawn-sketch",fontFamily:'"Xiaolai SC", "Comic Sans MS", cursive',canvas:{background:"#fdfaf6"}},l={classical:a,handdrawn:s,"handdrawn-soft":n,"handdrawn-sketch":r},d=e=>l[e]||a}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.