koboyo 0.4.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +26 -0
- package/assets/editor/assets/ContextMenuTrigger-CXUL1E23.js +1 -0
- package/assets/editor/assets/{IconHelp-CaEwHrsN.js → IconHelp-4FIVl1rh.js} +2 -2
- package/assets/editor/assets/IconReplace-CYUD1RLF.js +1 -0
- package/assets/editor/assets/MenuSubmenuTrigger-BFlIkXYg.js +1 -0
- package/assets/editor/assets/{PopoverPopup-B3Y0VRYc.js → PopoverPopup-1zO38CRl.js} +1 -1
- package/assets/editor/assets/asset-glyph-DjBHkQcP.js +1 -0
- package/assets/editor/assets/build-pips-BRf3pMnt.js +1 -0
- package/assets/editor/assets/build-visibility-CAmmsnmF.js +1 -0
- package/assets/editor/assets/builders-DrWdKwLQ.js +1 -0
- package/assets/editor/assets/{chart-4iRduYdU.js → chart-CKIxcbcM.js} +4 -4
- package/assets/editor/assets/{chrome-layout-BzPU9far.js → chrome-layout-D5dql-y4.js} +1 -1
- package/assets/editor/assets/code-panel-BFikzGNv.js +18 -0
- package/assets/editor/assets/color-swatches-CZKb4DxX.js +1 -0
- package/assets/editor/assets/{command-palette-BR-_ChOL.js → command-palette-Uat68wmJ.js} +1 -1
- package/assets/editor/assets/connector-labels-DqVssnYz.js +2 -0
- package/assets/editor/assets/{copy-image-dialog-BzGP7Xw8.js → copy-image-dialog-C0fXdR1a.js} +1 -1
- package/assets/editor/assets/core-C1TxysMz.js +1 -0
- package/assets/editor/assets/diagram-fingerprint-B-HB8UbR.js +3 -0
- package/assets/editor/assets/{edit-C0sBxxsg.js → edit-B4DMFSZr.js} +1 -1
- package/assets/editor/assets/editor-DAJETlQW.js +1 -0
- package/assets/editor/assets/{elk-worker-loader-CVBdN1je.js → elk-worker-loader-BCdkmVMX.js} +1 -1
- package/assets/editor/assets/embed-input-D77Udvni.js +1 -0
- package/assets/editor/assets/export-FQTXirjn.js +2 -0
- package/assets/editor/assets/{export-dialog-x2n2a4KX.js → export-dialog-KYLeNY3G.js} +1 -1
- package/assets/editor/assets/export-u442sUQs.js +6 -0
- package/assets/editor/assets/flow-layer-B4Q8rktl.js +1 -0
- package/assets/editor/assets/flow-panel-DbnavW4w.js +1 -0
- package/assets/editor/assets/flow-stage-CSTrNMZF.js +1 -0
- package/assets/editor/assets/{flow-start-CpAvU-9P.js → flow-start-ByhFxEeV.js} +1 -1
- package/assets/editor/assets/{flows-Cj7AFMIA.js → flows-CGl4r-xb.js} +1 -1
- package/assets/editor/assets/{frames-Cp1QD3LR.js → frames-DRSLvE9E.js} +1 -1
- package/assets/editor/assets/generate-DHP90nDk.js +26 -0
- package/assets/editor/assets/{icon-picker-Cg39IKNJ.js → icon-picker-DIkw2xYL.js} +1 -1
- package/assets/editor/assets/{image-library-JQu_tb8P.js → image-library-BmoSPV9c.js} +1 -1
- package/assets/editor/assets/index-DFwoT1_W.js +25 -0
- package/assets/editor/assets/layout-offthread-JPTCbsLL.js +18 -0
- package/assets/editor/assets/menu-4xb5HtA1.js +1 -0
- package/assets/editor/assets/mermaid-paste-2cCwweY0.js +1 -0
- package/assets/editor/assets/panel-controls-B0Ccd0XF.js +1 -0
- package/assets/editor/assets/{panel-shell-BnMOHgWM.js → panel-shell-COqmheb-.js} +1 -1
- package/assets/editor/assets/plan-D4Jyzo5X.js +1 -0
- package/assets/editor/assets/presentation-DNmdm11D.js +1 -0
- package/assets/editor/assets/{presenter-keys-Bs3LnmOa.js → presenter-keys-DLNIsrm5.js} +1 -1
- package/assets/editor/assets/reflow-C6bvnSVm.js +1 -0
- package/assets/editor/assets/registry-d5KleeyB.js +1 -0
- package/assets/editor/assets/rich-paste-route-Bx69sREx.js +1 -0
- package/assets/editor/assets/ride-overlay-C1TrM7Ki.js +1 -0
- package/assets/editor/assets/selection-overlay-primitives-CfOaP5_G.js +1 -0
- package/assets/editor/assets/shape-meta-YgfIm0bQ.js +1 -0
- package/assets/editor/assets/shape-render-DZscezZk.js +1 -0
- package/assets/editor/assets/shapes-D5w8NTQQ.js +11 -0
- package/assets/editor/assets/{slide-notes-dialog-BQBXpep6.js → slide-notes-dialog-43EMJFJV.js} +1 -1
- package/assets/editor/assets/slides-DDNzjFz9.js +5 -0
- package/assets/editor/assets/slides-panel-DANnu_nw.js +26 -0
- package/assets/editor/assets/text-breaks-DhCXtQrJ.js +7 -0
- package/assets/editor/assets/{theme-palette-Dl_G_VIJ.js → theme-palette-DEq19D0h.js} +1 -1
- package/assets/editor/assets/tidy-browser-BdlwTfCT.js +1 -0
- package/assets/editor/assets/tidy-scope-REEad7oC.js +1 -0
- package/assets/editor/assets/{tool-catalog-DXPhX2S1.js → tool-catalog-CIjdZm_C.js} +1 -1
- package/assets/editor/assets/{tool-drawer-CWOX_njp.js → tool-drawer-B-Ys7Rsn.js} +1 -1
- package/assets/editor/assets/{tooltip-CyBz17g8.js → tooltip-CKCG8vcp.js} +1 -1
- package/assets/editor/assets/tree-BWJsAqkV.js +1 -0
- package/assets/editor/assets/use-export-command-BR-A4kAa.js +2 -0
- package/assets/editor/assets/{use-grid-keyboard-nav-DhQKecO1.js → use-grid-keyboard-nav-B0jjlh8Q.js} +0 -0
- package/assets/editor/assets/{use-icon-node-BxqH7H27.js → use-icon-node-uhKPP4Ki.js} +1 -1
- package/assets/editor/assets/{use-key-held-094C3Mn3.js → use-key-held-DaUTxGze.js} +1 -1
- package/assets/editor/assets/useTriggerFocusGuards-Mibi8yYw.js +1 -0
- package/assets/editor/assets/web-card-BTru0lge.js +1 -0
- package/assets/editor/assets/web-card-font-BbZEq3En.js +1 -0
- package/assets/editor/assets/web-controls-BjBov-C2.js +1 -0
- package/assets/editor/assets/web-embed-dialog-sT-1yK5o.js +1 -0
- package/assets/editor/assets/web-embed-url-CHu4SU82.js +1 -0
- package/assets/editor/assets/web-embeds-I3saJ_yp.js +1 -0
- package/assets/editor/assets/web-html-dialog-B5Hb3RGw.js +1 -0
- package/assets/editor/assets/web-runtime-wPi8lWzO.js +1 -0
- package/assets/editor/assets/web-widget-limits-DeMquLIR.js +1 -0
- package/assets/editor/assets/web-widgets-DsFUBhiq.js +325 -0
- package/assets/editor/assets/widget-source-C3N9ZKTz.js +2 -0
- package/assets/editor/assets/widget-target-C9a207gT.js +1 -0
- package/assets/editor/index.html +41 -35
- package/dist/koboyo.js +565 -232
- package/package.json +3 -3
- package/skills/koboyo/SKILL.md +8 -3
- package/skills/koboyo/references/architecture.md +1 -1
- package/skills/koboyo/references/bpmn.md +1 -1
- package/skills/koboyo/references/chart.md +1 -1
- package/skills/koboyo/references/cycle.md +1 -1
- package/skills/koboyo/references/erd.md +1 -1
- package/skills/koboyo/references/flowchart.md +1 -1
- package/skills/koboyo/references/funnel.md +1 -1
- package/skills/koboyo/references/gantt.md +1 -1
- package/skills/koboyo/references/gitgraph.md +1 -1
- package/skills/koboyo/references/journey.md +1 -1
- package/skills/koboyo/references/matrix.md +1 -1
- package/skills/koboyo/references/mindmap.md +1 -1
- package/skills/koboyo/references/orgchart.md +1 -1
- package/skills/koboyo/references/pyramid.md +1 -1
- package/skills/koboyo/references/sankey.md +1 -1
- package/skills/koboyo/references/sequence.md +1 -1
- package/skills/koboyo/references/statemachine.md +1 -1
- package/skills/koboyo/references/timeline.md +1 -1
- package/skills/koboyo/references/venn.md +1 -1
- package/skills/koboyo/references/wireframe.md +1 -1
- package/assets/editor/assets/MenuSubmenuTrigger-KacA9GM8.js +0 -1
- package/assets/editor/assets/asset-glyph-C1E6cGwM.js +0 -1
- package/assets/editor/assets/build-pips-BV-uwXlP.js +0 -1
- package/assets/editor/assets/build-visibility-DyML9SHt.js +0 -1
- package/assets/editor/assets/builders-DMHAOPEv.js +0 -1
- package/assets/editor/assets/code-panel-koBUgEWp.js +0 -43
- package/assets/editor/assets/connector-labels-CrEgadsC.js +0 -2
- package/assets/editor/assets/core-CmsJyU_-.js +0 -1
- package/assets/editor/assets/diagram-fingerprint-WGQ5iVXx.js +0 -3
- package/assets/editor/assets/editor-BeufBV54.js +0 -1
- package/assets/editor/assets/export-Bce6ra0N.js +0 -2
- package/assets/editor/assets/export-K2VWg76n.js +0 -6
- package/assets/editor/assets/flow-layer-ewaL7g2y.js +0 -1
- package/assets/editor/assets/flow-panel-BzXNGGke.js +0 -1
- package/assets/editor/assets/flow-stage-Ba_CAggI.js +0 -1
- package/assets/editor/assets/index-CBPPqsiR.js +0 -24
- package/assets/editor/assets/layout-offthread-mRHRulkS.js +0 -18
- package/assets/editor/assets/menu-B9BAk63v.js +0 -1
- package/assets/editor/assets/panel-controls-DWVXiNUZ.js +0 -1
- package/assets/editor/assets/plan-CkgM52Yh.js +0 -1
- package/assets/editor/assets/presentation-DJUO0t7I.js +0 -1
- package/assets/editor/assets/reflow-DaYiVkwp.js +0 -1
- package/assets/editor/assets/registry-rEGZW7Ab.js +0 -1
- package/assets/editor/assets/ride-overlay-Hx90v4ZK.js +0 -1
- package/assets/editor/assets/selection-overlay-primitives-BRp854AD.js +0 -1
- package/assets/editor/assets/shape-meta-COE2ATNh.js +0 -1
- package/assets/editor/assets/slides-D686obFO.js +0 -15
- package/assets/editor/assets/slides-panel-BEJCevJi.js +0 -26
- package/assets/editor/assets/text-breaks-DM4W6y5f.js +0 -7
- package/assets/editor/assets/tidy-browser-dF3BON7J.js +0 -1
- package/assets/editor/assets/tidy-scope-BGG3ZXvZ.js +0 -1
- package/assets/editor/assets/tree-KSgPjntC.js +0 -1
- package/assets/editor/assets/use-export-command-sC9UHj3_.js +0 -2
- package/assets/editor/assets/web-controls-CLE9zr7i.js +0 -1
- package/assets/editor/assets/web-embed-dialog-XUNelFFM.js +0 -1
- package/assets/editor/assets/web-html-dialog-BcAyzH5D.js +0 -1
- package/assets/editor/assets/web-shape-C941TGTy.js +0 -1
- package/assets/editor/assets/widget-source-CHujvUeA.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{G as e,V as t,Y as n,Z as r,it as i}from"./style-BENGW2ZV.js";import{A as a,Cn as o,E as s,N as c,S as l,T as u,Tn as d,_n as f,gn as p,h as m,j as h,w as g,wn as _,xn as v}from"./shapes-D5w8NTQQ.js";import{A as y,E as b,J as x,O as S,U as C,Y as w,j as ee,kt as te}from"./slides-DDNzjFz9.js";var ne=[`solid`,`dashed`,`dotted`,`none`],re=[`curved`,`elbow`],ie=[`arrow`,`sweep`,`triangle`,`triangleOutline`,`diamond`,`diamondOutline`,`circle`,`circleOutline`,`bar`,`cross`,`crowOne`,`crowMany`,`crowOneOrMany`,`crowOnlyOne`,`crowZeroOrOne`,`crowZeroOrMany`],ae=[`pastel`,`bold`,`outline`,`shadow`],oe=[`left`,`center`,`right`],se=[`top`,`middle`,`bottom`],ce=[`n`,`s`,`e`,`w`,`ne`,`nw`,`se`,`sw`],le=`rectangle.ellipse.diamond.triangle.oval.parallelogram.trapezoid.cylinder.note.hexagon.star.checkbox.crossbox.heart.cloud.arrow-up.arrow-down.arrow-left.arrow-right.plus.speech-bubble.bolt.queue.callout.document.predefined-process.manual-input.pentagon.chevron.octagon.cube.actor.double-circle.card.delay.fork-join.multi-document.multi-process.package.component.brace`.split(`.`),ue=[`fade`,`rise`,`scale`,`pop`,`blur`,`wipe`,`draw`,`type`,`pulse`,`shake`,`glow`],de=[`up`,`down`,`left`,`right`],fe=[`enter`,`emphasis`,`exit`],pe=[`sharp`,`rounded`],me=[`simple`,`phone`,`tablet`,`browser`,`window`,`lanes`,`vlanes`,`boundary`],he=[`call`,`async`,`reply`],ge=[`bar`,`line`,`area`,`scatter`,`pie`,`donut`,`radar`,`quadrant`],_e=[`number`,`percent`,`currency`],ve=`button.input.search.checkbox.radio.toggle.dropdown.slider.navbar.tabs.image.avatar.heading.paragraph.divider.link.textarea.stepper.badge.progress.breadcrumbs.pagination.rating.card.list.alert.menu.tooltip.accordion.datepicker.sidebar.scrollbar.segmented.tabbar.statusbar.fab.stepbadge`.split(`.`),ye=[`embed`,`html`];function T(e){return`kind`in e&&e.kind===`path`}function be(e){return e.type===`line`?e.points:e.type===`arrow`?[{x:e.x,y:e.y},{x:e.x2,y:e.y2}]:null}function E(n,r){let i=be(n)??[t(h(n))],a=Math.max(0,Math.min(r.seg,i.length-2)),o=i[a],s=i[a+1]??o,c=e(r.t);return{x:o.x+(s.x-o.x)*c,y:o.y+(s.y-o.y)*c}}function D(e,t){return t?T(e)?t.type===`line`||t.type===`arrow`:t.type!==`arrow`:!1}function xe(e,t,n){let r=new Set,i=[n];for(;i.length>0;){let n=i.pop();if(n===t)return!0;if(r.has(n))continue;r.add(n);let a=y(e,n);a?.type===`arrow`&&(a.startBinding&&i.push(a.startBinding.shapeId),a.endBinding&&i.push(a.endBinding.shapeId))}return!1}function Se(e,t){let n=Math.abs(t.x-e.x),r=Math.abs(t.x-(e.x+e.width)),i=Math.abs(t.y-e.y),a=Math.abs(t.y-(e.y+e.height)),o=Math.min(n,r,i,a);return o===n?{x:-1,y:0}:o===r?{x:1,y:0}:o===i?{x:0,y:-1}:{x:0,y:1}}function O(e,t){return e.type===`icon`?s(e,t):e.type===`control`&&e.kind===`lifeline`?w(e):h(e,t)}function k(e,n){return t(h(e,n))}var A=6,j=14;function M(e){return e.type===`text`?j:A}var Ce=new Set(te);function N(e,t,n){let r=n===`start`?t.startArrow:t.endArrow,i=n===`start`?t.startHead:t.endHead;return r&&i&&Ce.has(i)?0:M(e)}function P(e){if(e.type!==`rectangle`)return null;let t=e.kind;return t!==`diamond`&&t!==`ellipse`&&t!==`double-circle`?null:t}function F(e,t){return e===`diamond`?1-t:Math.sqrt(Math.max(0,1-t*t))}function we(e,t,n){let r=P(e);if(r===null)return n;let i=Se(t,n),a=t.x+t.width/2,o=t.y+t.height/2,s=i.x!==0,c=s?t.width/2:t.height/2,l=s?t.height/2:t.width/2,u=s?n.y-o:n.x-a,d=F(r,l===0?0:Math.min(1,Math.abs(u)/l)),f=s?i.x:i.y;return s?{x:a+f*c*d,y:n.y}:{x:n.x,y:o+f*c*d}}var I=.002;function L(e,t,n=0,r){let i=O(e,r),a=B(i,t);if(t.x>I&&t.x<1-I&&t.y>I&&t.y<1-I)return z(e,a,r);let o=we(e,i,a),s=e.type===`text`?Math.max(n,j):n;if(s<=0)return z(e,o,r);let c=Se(i,a);return z(e,{x:o.x+c.x*s,y:o.y+c.y*s},r)}var Te=.2;function Ee(e,t){return V(O(e,t),k(e,t))}function De(e,t,n){let r=Ee(e,n);return Math.abs(t.x-r.x)<=Te&&Math.abs(t.y-r.y)<=Te}function Oe(t){let n=e(t.x),r=e(t.y),i=n,a=1-n,o=r,s=1-r,c=Math.min(i,a,o,s);return c===i?{x:0,y:r}:c===a?{x:1,y:r}:c===o?{x:n,y:0}:{x:n,y:1}}function R(e,n,r){let i=c(e)*Math.PI/180;return i?a(n,t(h(e,r)),-i):n}function z(e,n,r){let i=c(e)*Math.PI/180;return i?a(n,t(h(e,r)),i):n}function B(e,t){return{x:e.x+t.x*e.width,y:e.y+t.y*e.height}}function V(e,t){return{x:e.width===0?.5:(t.x-e.x)/e.width,y:e.height===0?.5:(t.y-e.y)/e.height}}function H(e,t){return!e||t.has(e.shapeId)?!1:T(e)?!0:e.precise}function U(e,t){return e.type===`arrow`&&H(e.startBinding,t)&&H(e.endBinding,t)}function ke(t,n,r){let i=be(n);if(!i||i.length<2)return null;let a=Math.max(0,Math.min(t.seg,i.length-2)),o=i[a],s=i[a+1],c=s.x-o.x,l=s.y-o.y,u=Math.hypot(c,l);if(u<1e-6)return null;let d=(r.x*c+r.y*l)/u;return{...t,seg:a,t:e(t.t+d/u)}}function Ae(t,n,r,i){if(c(n)!==0)return null;let a=O(n,i),{anchor:o}=t;if(Y(n))return a.height>0?{...t,anchor:{x:o.x,y:e(o.y+r.y/a.height)}}:null;let s=.001,l=o.x<=s||o.x>=1-s,u=o.y<=s||o.y>=1-s;return l&&(!u||Math.abs(r.y)>=Math.abs(r.x))&&a.height>0?{...t,anchor:{x:o.x,y:e(o.y+r.y/a.height)},port:void 0}:u&&a.width>0?{...t,anchor:{x:e(o.x+r.x/a.width),y:o.y},port:void 0}:null}function W(e,t,n,r){return T(e)?ke(e,t,n):Ae(e,t,n,r)}function je(e,t,n,r,i){if(!U(e,r))return null;let a=e,o=a.startBinding?.shapeId,s=a.endBinding?.shapeId,c=o?y(n,o):void 0,l=s?y(n,s):void 0;if(!c||!l||!a.startBinding||!a.endBinding)return null;let u=W(a.startBinding,c,t,i),d=W(a.endBinding,l,t,i);return!u||!d?null:{...a,startBinding:u,endBinding:d}}function Me(e,t,n,r,i){let a=je(e,t,n,r,i);if(a)return a;let o=m(e,t);if(o.type!==`arrow`)return o;let s=e=>e&&r.has(e.shapeId)?e:null,c=s(o.startBinding),l=s(o.endBinding);return c===o.startBinding&&l===o.endBinding?o:{...o,startBinding:c,endBinding:l}}function Ne(e,t,n,i){for(let a=e.length-1;a>=0;--a){let o=e[a];if(o.type===`arrow`||o.type===`line`||o.type===`draw`||o.type===`polygon`||o.type===`figure`||n&&o.id===n||!u(o)&&!r(t,g(o)))continue;let c=o.type===`icon`?s(o,i):h(o,i);if(r(R(o,t,i),c))return o}return null}var Pe={n:{x:.5,y:0},s:{x:.5,y:1},e:{x:1,y:.5},w:{x:0,y:.5},ne:{x:1,y:0},nw:{x:0,y:0},se:{x:1,y:1},sw:{x:0,y:1}},G=8;function Fe(e,t){return e.x===0||e.x===1?Math.abs(e.y-.5)*t.height<=G?{x:e.x,y:.5}:e:Math.abs(e.x-.5)*t.width<=G?{x:.5,y:e.y}:e}function Ie(t,n,r){if(t.type!==`control`||t.kind!==`entity`||n.x!==0&&n.x!==1)return n;let i=C(t);if(i.length===0)return n;let a=r.y+n.y*r.height,o=i.reduce((e,t)=>Math.abs(t.cy-a)<Math.abs(e.cy-a)?t:e);return{x:n.x,y:e((o.cy-r.y)/r.height)}}function K(e,t,n){return Ie(e,Fe(Oe(t),n),n)}function Le(t,n,r){let i=O(t,r),a=V(i,R(t,n,r));return t.type===`control`&&t.kind===`lifeline`?{shapeId:t.id,anchor:{x:.5,y:e(a.y)},precise:!0}:De(t,a,r)?{shapeId:t.id,anchor:{x:e(a.x),y:e(a.y)},precise:!1}:{shapeId:t.id,anchor:K(t,a,i),precise:!0}}function q(e){return e.port?Pe[e.port]:e.anchor}function Re(t,n,r){let i=O(t,r);if(t.type===`control`&&t.kind===`lifeline`){let a=V(i,R(t,n,r));return{x:i.x+i.width/2,y:i.y+e(a.y)*i.height}}let a=V(i,R(t,n,r));return De(t,a,r)?k(t,r):z(t,B(i,K(t,a,i)),r)}function J(e,t=A){return n(e,t)}function Y(e){return e.type===`control`&&e.kind===`lifeline`}function ze(t,n,r,i){let a=O(t),o=a.x+a.width/2,s=a.y+e(n)*a.height,c=t.type===`control`?x(t,s):null,l=r.x<=o;return{x:(c?l?c.x:c.x+c.width:o)+(l?-i:i),y:s}}function X(t,n,r){if(T(n))return E(t,n);if(Y(t)&&n.precise){let r=O(t);return{x:r.x+r.width/2,y:r.y+e(n.anchor.y)*r.height}}return n.precise?L(t,q(n),M(t),r):k(t,r)}function Z(e,t,n,r=M(e),a){return T(t)?E(e,t):Y(e)&&t.precise?ze(e,t.anchor.y,n,r):t.precise?L(e,q(t),r,a):z(e,i(J(O(e,a),r),k(e,a),R(e,n,a)),a)}function Be(e,t,n,i,a){let o=J(O(e,a),i),s=n?1/64:-1/64,c=+!n;for(let n=1;n<=64;n+=1){let n=c+s;if(!r(R(e,t.pointAt(n),a),o)){let i=c,s=n;for(let n=0;n<16;n+=1){let n=(i+s)/2;r(R(e,t.pointAt(n),a),o)?i=n:s=n}return i}if(c=n,n<=0||n>=1)break}return+!n}function Ve(e,t,n,r,i){let a=e=>i?i.get(e):y(t,e),o=e.startBinding?a(e.startBinding.shapeId):void 0,s=e.endBinding?a(e.endBinding.shapeId):void 0;return{start:e.startBinding&&D(e.startBinding,o)?n(o,e.startBinding,`start`):r({x:e.x,y:e.y}),end:e.endBinding&&D(e.endBinding,s)?n(s,e.endBinding,`end`):r({x:e.x2,y:e.y2})}}function He(e,t,n,r){return Ve(e,t,(e,t)=>X(e,t,r),e=>e,n)}function Ue(e,n){let r=O(e,n),i=c(e)*Math.PI/180;return i?l(r,t(h(e,n)),i):r}function We(e,t,n){return e.type===`icon`?V(h(e,n),B(O(e,n),t)):t}function Ge(e,t){let n=e.x-.5,r=e.y-.5;if(t){let e=t*Math.PI/180,i=Math.cos(e),a=Math.sin(e),o=n*i-r*a,s=n*a+r*i;n=o,r=s}return Math.abs(n)<1e-6&&Math.abs(r)<1e-6?null:Math.abs(n)>Math.abs(r)-1e-4?n<0?`left`:`right`:r<0?`top`:`bottom`}function Ke(e,t){if(c(e)!==0)return;let n=P(e);if(n===null)return;let r=h(e),i=r.x+r.width/2,a=r.y+r.height/2,o=r.width/2,s=r.height/2,l=t===`left`||t===`right`,u=t===`right`||t===`bottom`?1:-1;return e=>{let t=l?i:a,r=l?o:s,c=l?a:i,d=l?s:o,f=d===0?0:Math.min(1,Math.abs(e-c)/d),p=F(n,f);return t+u*r*p}}function Q(e,t,n,r=M(e),i){if(T(t))return o(E(e,t),n);let a=t.precise?Ge(We(e,t.anchor,i),c(e)):null;return{bounds:Ue(e,i),target:t.precise?L(e,t.anchor,0,i):k(e,i),gap:r,minEnd:n*v,side:a,outline:a?Ke(e,a):void 0,isPoint:!1}}function qe(e,t,n,r){return Ve(e,t,(t,n,i)=>Q(t,n,e.strokeWidth,N(t,e,i),r),t=>o(t,e.strokeWidth),n)}function Je(e,t,n,r){let i=qe(e,t,n,r);return d(i.start,i.end,e.elbowMid??.5)}function Ye(e,t){return{...e,elbowPoints:t,elbowRoute:t,elbowMidHandle:void 0,x:t[0].x,y:t[0].y,x2:t[t.length-1].x,y2:t[t.length-1].y}}function Xe(e){return{...e,elbowPoints:void 0,elbowRoute:void 0,elbowMidHandle:void 0}}function Ze(e,t,n,r){if(!e.elbowPoints)return e;let i=qe(e,t,n,r),a=_(e.elbowPoints,i.start,i.end);return a?Ye(e,a):Xe(e)}var $=24;function Qe(e,t,n){let r=e.x+e.width,i=t.x,a=e.y+n.fromTop*e.height,o=Math.max(1,n.fromSpan*e.height),s=t.y+n.toTop*t.height,c=Math.max(1,n.toSpan*t.height),l=r+(i-r)/3,u=i-(i-r)/3,d=(e,t,n)=>{let r=1-e;return r*r*r*t+3*r*r*e*t+3*r*e*e*n+e*e*e*n},f=e=>{let t=1-e;return t*t*t*r+3*t*t*e*l+3*t*e*e*u+e*e*e*i},p=[],m=[];for(let e=0;e<=$;e+=1){let t=e/$,n=f(t);p.push({x:n,y:d(t,a,s)}),m.push({x:n,y:d(t,a+o,s+c)})}return[...p,...m.reverse()]}function $e(e,t,n){let r=e.band;if(!r||n&&!n.has(e.id)&&!n.has(r.from)&&!n.has(r.to))return e;let i=t.get(r.from),a=t.get(r.to);if(!i||!a||!et(i)||!et(a))return e;let o=Qe(i,a,r);return tt(o,e.points)?e:{...e,points:o}}function et(e){return`width`in e&&`height`in e&&`x`in e&&`y`in e}function tt(e,t){return e.length===t.length&&e.every((e,n)=>e.x===t[n].x&&e.y===t[n].y)}function nt(e,t){if(e===t)return!0;if(!e||!t||e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1)if(Math.abs(e[n].x-t[n].x)>.01||Math.abs(e[n].y-t[n].y)>.01)return!1;return!0}function rt(e,t,n,r){if(t==null){let t=e;for(let e=0;e<4;e+=1){let e=ut(t,n);if(e===t)break;t=e}return t}if(t.size===0)return e;let i=e,a=t;for(let e=0;e<4&&a.size>0;e+=1){let t=ft(i,a,n,e===0?r:void 0);if(t.shapes===i)break;i=t.shapes,a=t.moved}return i}function it(e){let t=new Set(e.map(e=>e.id)),n=new Set;for(let r of e)if(r.type===`arrow`){let{startBinding:e,endBinding:i}=r;e&&i&&t.has(e.shapeId)&&t.has(i.shapeId)&&n.add(r.id)}else r.type===`polygon`&&r.band&&t.has(r.band.from)&&t.has(r.band.to)&&n.add(r.id);return n}function at(e,t){return!!(t.has(e.id)||e.startBinding&&t.has(e.startBinding.shapeId)||e.endBinding&&t.has(e.endBinding.shapeId))}function ot(e,t,n,r,i,a,o,s){let{x:c,y:l,x2:u,y2:d}=e;if(t&&n){let r=Z(t,n,o,N(t,e,`start`),s);c=r.x,l=r.y}if(r&&i){let t=Z(r,i,a,N(r,e,`end`),s);u=t.x,d=t.y}return{x:c,y:l,x2:u,y2:d}}function st(e,t,n,r,i,a,s,c){let{x:l,y:u,x2:f,y2:p}=e,m=e.elbowPoints,h=e.elbowRoute,g=e.elbowMidHandle,v=t&&n?Q(t,n,e.strokeWidth,N(t,e,`start`),c):o({x:e.x,y:e.y},e.strokeWidth),y=r&&i?Q(r,i,e.strokeWidth,N(r,e,`end`),c):o({x:e.x2,y:e.y2},e.strokeWidth),b=null;if(m&&m.length>=3&&t&&t===r){let e=(e,t)=>e.map(n=>({x:n.x+t.x-e[0].x,y:n.y+t.y-e[0].y})),t=_(e(m,v.target),v,y)?.[0];t&&(m=e(m,t))}if(m&&m.length>=3)b=_(m,v,y),b||(m=void 0);else if(m){let e=e=>!e||T(e)||e.precise;e(n)&&e(i)?b=[{x:v.target.x,y:v.target.y},{x:y.target.x,y:y.target.y}]:m=void 0}if(b)({elbowPoints:m,elbowRoute:h,elbowMidHandle:g,x:l,y:u,x2:f,y2:p}=Ye(e,b));else{let o=d(v,y,e.elbowMid??.5);o.route&&o.route.length>=2?(h=o.route,g=o.midHandle??void 0,l=o.route[0].x,u=o.route[0].y,f=o.route[o.route.length-1].x,p=o.route[o.route.length-1].y):(h=void 0,g=void 0,{x:l,y:u,x2:f,y2:p}=ot(e,t,n,r,i,a,s,c))}return{x:l,y:u,x2:f,y2:p,bend:e.bend,bendAlong:e.bendAlong,bow:e.bow,bowAlong:e.bowAlong,elbowPoints:m,elbowRoute:h,elbowMidHandle:g}}function ct(e,t,n,r,i,a,o,s){let{x:c,y:l,x2:u,y2:d}=e,m=e.bend,h=e.bendAlong,g=e.bow??e.bend??0,_=e.bowAlong??e.bendAlong??0,v=g,y=_,b=p(a,o,g,_),x=!1;if(b){let a=t&&n&&!T(n)?Be(t,b,!0,N(t,e,`start`),s):0,o=r&&i&&!T(i)?Be(r,b,!1,N(r,e,`end`),s):1;if(o-a>.02){let e=b.pointAt(a),t=b.pointAt(o);if(c=e.x,l=e.y,u=t.x,d=t.y,_===0)m=f(e,t,b.pointAt((a+o)/2)).bow,h=0;else if(b.apexT>a+.01&&b.apexT<o-.01){let n=f(e,t,b.apex);m=n.bow,h=n.bowAlong}else m=f(e,t,b.pointAt((a+o)/2)).bow,h=0;x=!0}}return x||({x:c,y:l,x2:u,y2:d}=ot(e,t,n,r,i,a,o,s),m=0,h=0),{x:c,y:l,x2:u,y2:d,bend:m,bendAlong:h,bow:v,bowAlong:y,elbowPoints:e.elbowPoints,elbowRoute:void 0,elbowMidHandle:void 0}}function lt(e,t,n,r){if(e.type===`polygon`)return $e(e,t,n);if(e.type!==`arrow`||!e.startBinding&&!e.endBinding||n&&!at(e,n))return e;let i=e.startBinding,a=e.endBinding,o=i?t.get(i.shapeId):void 0,s=a?t.get(a.shapeId):void 0;i&&!D(i,o)&&(i=null),a&&!D(a,s)&&(a=null);let c=o&&i?X(o,i,r):{x:e.x,y:e.y},l=s&&a?X(s,a,r):{x:e.x2,y:e.y2},u=(e.bendStyle===`elbow`?st:ct)(e,o,i,s,a,c,l,r),{x:d,y:f,x2:p,y2:m,bend:h,bendAlong:g,bow:_,bowAlong:v}=u,y=u.elbowPoints,b=u.elbowRoute,x=u.elbowMidHandle,S=!nt(b,e.elbowRoute);S||(b=e.elbowRoute);let C=!nt(y,e.elbowPoints);C||(y=e.elbowPoints);let w=!pt(x,e.elbowMidHandle);return w||(x=e.elbowMidHandle),d===e.x&&f===e.y&&p===e.x2&&m===e.y2&&h===e.bend&&g===e.bendAlong&&_===e.bow&&v===e.bowAlong&&!S&&!C&&!w&&i===e.startBinding&&a===e.endBinding?e:{...e,x:d,y:f,x2:p,y2:m,bend:h,bendAlong:g,bow:_,bowAlong:v,elbowPoints:y,elbowRoute:b,elbowMidHandle:x,startBinding:i,endBinding:a}}function ut(e,t){let n=new Map(e.map(e=>[e.id,e])),r=!1,i=e.map(e=>{let i=lt(e,n,null,t);return i!==e&&(r=!0),i});return r?i:e}function dt(e,t){return e.type===`arrow`?(e.startBinding!==null||e.endBinding!==null)&&at(e,t):e.type===`polygon`&&e.band?t.has(e.id)||t.has(e.band.from)||t.has(e.band.to):!1}function ft(e,t,n,r){let{position:i,dependents:a}=ee(e),o=new Set,s=n=>{if(n===void 0||o.has(n))return;let i=e[n];dt(i,t)&&!r?.has(i.id)&&o.add(n)};for(let e of t){s(i.get(e));for(let t of a.get(e)??[])s(i.get(t))}let c=new Set;if(o.size===0)return{shapes:e,moved:c};let l=new Map;for(let t of o)for(let n of b(e[t])){let t=i.get(n);t!==void 0&&l.set(n,e[t])}let u=null,d=[];for(let r of o){let i=e[r],a=lt(i,l,t,n);a!==i&&(u??=e.slice(),u[r]=a,d.push(r),c.add(i.id))}return u?(S(e,u,d),{shapes:u,moved:c}):{shapes:e,moved:c}}function pt(e,t){return e===t?!0:!e||!t?!1:e.axis===t.axis&&Math.abs(e.x-t.x)<=.01&&Math.abs(e.y-t.y)<=.01&&Math.abs(e.span-t.span)<=.01}export{oe as A,ne as C,le as D,me as E,ye as M,ve as N,_e as O,pe as S,he as T,ue as _,xe as a,re as b,U as c,Me as d,Ne as f,de as g,Z as h,He as i,se as j,ce as k,Je as l,Ze as m,it as n,Le as o,X as p,Qe as r,Re as s,rt as t,T as u,fe as v,ae as w,ge as x,ie as y};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{B as e,G as t,b as n}from"./style-BENGW2ZV.js";import{ft as r,gt as i,in as a,j as o,mt as s,n as c,nn as l,rn as u}from"./shapes-D5w8NTQQ.js";import{B as d,Ct as f,I as p,P as m,Tt as h,_t as g,at as _,bt as ee,ct as v,dt as y,et as te,ft as ne,gt as b,ht as re,it as x,lt as ie,mt as S,nt as ae,pt as oe,rt as C,st as w,tt as T,ut as se,vt as E,xt as D,yt as ce}from"./slides-DDNzjFz9.js";function O(e){return(e.value??0)>=.5}function le(t){let{bounds:n,shape:r,ink:i}=t,o=[],s=w(r);if(s&&o.push({kind:`rect`,x:n.x,y:n.y,width:n.width,height:n.height,rx:10,fill:s}),o.push(...b(t,a(n.x,n.y,n.width,n.height,10),i)),r.label){let a=s?e(s):i;o.push(E(t,n.x+n.width/2,n.y+n.height/2,r.label,a,{anchor:`middle`}))}return o}function k(e,t=12){let{bounds:n,shape:r,ink:i}=e,o=b(e,a(n.x,n.y,n.width,n.height,6),i);return r.label&&o.push(E(e,n.x+t,n.y+n.height/2,r.label,x)),o}function ue(e){let{bounds:t,ink:n}=e,r=ne(t),i=t.x+12+r,a=t.y+t.height/2-r*.4,o=k(e,oe(t));return o.push(...b(e,l(i,a,r),n,T)),o.push(...b(e,u(i+r*.72,a+r*.72,i+r*1.7,a+r*1.7),n,T)),o}function de(e){let{bounds:t,shape:n,ink:r}=e,i=t.x,o=t.y+t.height/2-22/2,s=b(e,a(i,o,22,22,4),r);if(O(n)){let t=`M ${i+22*.22} ${o+22*.55} L ${i+22*.45} ${o+22*.75} L ${i+22*.8} ${o+22*.25}`;s.push(...b(e,t,r,2.2))}return n.label&&s.push(E(e,i+22+10,t.y+t.height/2,n.label,r)),s}function fe(e){let{bounds:t,shape:n,ink:r}=e,i=t.x+11,a=t.y+t.height/2,o=b(e,l(i,a,11),r);return O(n)&&o.push({kind:`circle`,cx:i,cy:a,r:4.5,fill:r}),n.label&&o.push(E(e,i+11+10,a,n.label,r)),o}function pe(e){let{bounds:t,shape:n,ink:i}=e,o=ce(t),s=o*1.9,c=t.x,u=t.y+t.height/2-o/2,d=t.y+t.height/2,f=O(n),p=[];f&&p.push({kind:`rect`,x:c,y:u,width:s,height:o,rx:o/2,fill:w(n)??`#4dabf7`}),p.push(...b(e,a(c,u,s,o,o/2),i));let m=o/2-4,h=f?c+s-o/2:c+o/2;return p.push({kind:`circle`,cx:h,cy:d,r:m,fill:r.paper}),p.push(...b(e,l(h,d,m),i,T)),n.label&&p.push(E(e,t.x+ee(t),d,n.label,i)),p}function me(e){let{bounds:t,shape:n,ink:r}=e,i=t.y+t.height/2,o=t.x+t.width,s=b(e,a(t.x,t.y,t.width,t.height,6),r);n.label&&s.push(E(e,t.x+12,i,n.label,r));let c=`M ${o-25} ${i-4} L ${o-18} ${i+4} L ${o-11} ${i-4}`;return s.push(...b(e,c,r,T)),s}function he(e){let{bounds:n,shape:i,ink:a}=e,o=t(i.value??.5),s=n.y+n.height/2+(i.label?n.height*.12:0),c=n.x+8,d=n.x+n.width-8,f=c+o*(d-c),p=b(e,u(c,s,d,s),x,T);return p.push({kind:`line`,x1:c,y1:s,x2:f,y2:s,stroke:a,width:3}),p.push({kind:`circle`,cx:f,cy:s,r:8,fill:r.paper}),p.push(...b(e,l(f,s,8),a,T)),i.label&&p.push(E(e,n.x,n.y+2,i.label,x,{size:i.fontSize*.7,baseline:`hanging`})),p}function ge(e){let{bounds:t,ink:n}=e,r=t.x+t.width/2,i=t.y+t.height/2,a=Math.min(t.width,t.height)/2-2,o=b(e,l(r,i,a),n);o.push(...b(e,l(r,i-a*.3,a*.32),n,T));let s=`M ${r-a*.55} ${i+a*.72} A ${a*.55} ${a*.55} 0 0 1 ${r+a*.55} ${i+a*.72}`;return o.push(...b(e,s,n,T)),o}function _e(e){let{bounds:t,shape:n,ink:r}=e;return n.label?[E(e,t.x,t.y+t.height/2,n.label,r,{size:n.fontSize*ae})]:[]}function ve(e,t,n,r){let i=(e+t)/2;return`M ${e} ${n} Q ${i} ${n-r} ${t} ${n} Q ${i} ${n+r} ${e} ${n} Z`}function ye(e,t,n,r){return{kind:`path`,d:ve(e,t,n,r),fill:x,stroke:`none`}}function be(e){let{bounds:t,shape:n,ink:r}=e;if(n.label){let i=n.fontSize*.9,a=i*1.4,o=f(n.label,t.width,i),s=Math.max(1,Math.floor(t.height/a));return o.slice(0,s).map((n,o)=>E(e,t.x,t.y+a*(o+.6),n,r,{size:i}))}let i=n.fontSize*1.4,a=Math.max(2,Math.floor(t.height/i)),o=[];for(let e=0;e<a;e+=1){let n=t.y+i*(e+.7),r=e===a-1?.6:1;o.push(ye(t.x,t.x+t.width*r,n,3))}return o}function A(e,t,n){let r=n*.45,i=[];for(let a=0;a<10;a+=1){let o=a%2==0?n:r,s=-Math.PI/2+a*Math.PI/5,c=e+Math.cos(s)*o,l=t+Math.sin(s)*o;i.push(`${a===0?`M`:`L`} ${c} ${l}`)}return`${i.join(` `)} Z`}function xe(e){let{bounds:t}=e,n=t.y+t.height/2;return b(e,u(t.x,n,t.x+t.width,n),x,T)}function j(e){let{bounds:t,shape:r}=e;if(!r.label)return[];let i=t.x+t.width/2,a=t.y+t.height/2,o=Math.min(t.width,r.label.length*r.fontSize*.55),s=a+r.fontSize*.6;return[E(e,i,a,r.label,n,{anchor:`middle`}),...b(e,u(i-o/2,s,i+o/2,s),n,T)]}function M(e){let{bounds:t,shape:n,ink:r}=e,i=b(e,a(t.x,t.y,t.width,t.height,6),r),o=n.fontSize*.9,s=o*1.4;if(n.label){let a=f(n.label,t.width-24,o),c=Math.max(1,Math.floor((t.height-12)/s));a.slice(0,c).forEach((n,a)=>{i.push(E(e,t.x+12,t.y+12+s*(a+.5),n,r,{size:o}))})}else i.push(E(e,t.x+12,t.y+12+s*.5,`Type here…`,x,{size:o}));let c=t.x+t.width-6,l=t.y+t.height-6;return i.push(...b(e,u(c-6,l,c,l-6),x,T)),i.push(...b(e,u(c-11,l,c,l-11),x,T)),i}function Se(e){let{bounds:t,shape:n,ink:r}=e,i=t.y+t.height/2,o=re(t),s=t.x+o,c=t.x+t.width-o,l=b(e,a(t.x,t.y,t.width,t.height,6),r);l.push(...b(e,u(s,t.y,s,t.y+t.height),r,T)),l.push(...b(e,u(c,t.y,c,t.y+t.height),r,T));let d=t.x+o/2,f=t.x+t.width-o/2,p=Math.min(n.fontSize*.42,o*.4,t.height*.3);return l.push(...b(e,u(d-p,i,d+p,i),r,2.2)),l.push(...b(e,u(f-p,i,f+p,i),r,2.2)),l.push(...b(e,u(f,i-p,f,i+p),r,2.2)),n.label&&l.push(E(e,(s+c)/2,i,n.label,r,{anchor:`middle`})),l}function Ce(e){let{bounds:t,shape:n,ink:r}=e,i=t.height/2,o=w(n),s=[];return o&&s.push({kind:`rect`,x:t.x,y:t.y,width:t.width,height:t.height,rx:i,fill:o}),s.push(...b(e,a(t.x,t.y,t.width,t.height,i),r)),n.label&&s.push(E(e,t.x+t.width/2,t.y+t.height/2,n.label,r,{anchor:`middle`,size:n.fontSize*te})),s}var N=`#ffd43b`;function we(t){let{bounds:n,shape:r}=t,i=n.x+n.width/2,a=n.y+n.height/2,o=Math.min(n.width,n.height)/2,s=w(r)??`#ffd43b`,c=h(i,a,o,r,t.nextSalt()).map(e=>({kind:`path`,d:e,fill:s,stroke:`none`}));return r.label&&c.push(E(t,i,a,r.label,e(s),{anchor:`middle`,size:o*.95})),c}function Te(e){let{bounds:n,shape:r,ink:i}=e,o=t(r.value??.6),s=Math.min(n.height,14),c=n.y+n.height/2-s/2,l=s/2,u=[],d=Math.max(s,n.width*o);return u.push({kind:`rect`,x:n.x,y:c,width:d,height:s,rx:l,fill:w(r)??i}),u.push(...b(e,a(n.x,c,n.width,s,l),i,T)),u}function Ee(e){let{bounds:t,shape:n,ink:r}=e,i=Math.max(0,Math.min(5,Math.round(n.value??3))),a=t.y+t.height/2,o=t.width/5,s=Math.min(o,t.height)*.42,c=[];for(let l=0;l<5;l+=1){let u=t.x+o*(l+.5);l<i&&c.push({kind:`path`,d:A(u,a,s),fill:w(n)??r}),c.push(...b(e,A(u,a,s),r,T))}return c}function De(e){let{bounds:n,shape:r,ink:i}=e,o=t(r.value??.3),s=n.width/2,c=b(e,a(n.x,n.y,n.width,n.height,s),x,T),l=Math.max(n.width*1.5,n.height*.32),u=n.y+o*(n.height-l);return c.push({kind:`rect`,x:n.x,y:u,width:n.width,height:l,rx:s,fill:w(r)??i}),c.push(...b(e,a(n.x,u,n.width,l,s),i,T)),c}var Oe={button:le,input:k,search:ue,checkbox:de,radio:fe,toggle:pe,dropdown:me,slider:he,avatar:ge,heading:_e,paragraph:be,divider:xe,link:j,textarea:M,stepper:Se,badge:Ce,progress:Te,rating:Ee,scrollbar:De,stepbadge:we},P=`rectangle.ellipse.circle.diamond.cylinder.queue.callout.hexagon.parallelogram.trapezoid.triangle.cloud.star.speech-bubble.note.sticky.checkbox.crossbox.heart.arrow-up.arrow-down.arrow-left.arrow-right.plus.bolt.document.predefined-process.manual-input.pentagon.chevron.octagon.cube.actor.double-circle.card.delay.fork-join.multi-document.multi-process.package.component.brace`.split(`.`),ke=[`browser`,`phone`,`window`,`tablet`],Ae={architecture:`architecture`,graph:`architecture`,flowchart:`flowchart`,flow:`flowchart`,bpmn:`bpmn`,orgchart:`orgchart`,org:`orgchart`,statemachine:`statemachine`,state:`statemachine`,fsm:`statemachine`,sequence:`sequence`,erd:`erd`,class:`erd`,uml:`erd`,wireframe:`wireframe`},je=[`architecture`,`flowchart`,`bpmn`,`orgchart`,`statemachine`,`sequence`,`erd`,`wireframe`],F=[`blue`,`green`,`red`,`orange`,`violet`,`teal`,`pink`,`yellow`,`gray`];function I(e){return Object.fromEntries(e.map(e=>[e,e]))}var Me={...I(F),grey:`gray`,purple:`violet`},Ne={...I(P),box:`rectangle`,oval:`ellipse`,decision:`diamond`,database:`cylinder`,db:`cylinder`,storage:`cylinder`,process:`rectangle`,terminator:`ellipse`,start:`ellipse`,end:`ellipse`,data:`parallelogram`,io:`parallelogram`,prep:`hexagon`,preparation:`hexagon`,crossedbox:`crossbox`,lightning:`bolt`,cross:`plus`,doc:`document`,subroutine:`predefined-process`,offpage:`pentagon`,"off-page":`pentagon`,stop:`octagon`,box3d:`cube`,person:`actor`,activity:`rectangle`,event:`ellipse`,gateway:`diamond`,doublecircle:`double-circle`,ring:`double-circle`,"notched-rectangle":`card`,fork:`fork-join`,join:`fork-join`,"stacked-document":`multi-document`,documents:`multi-document`,"stacked-rectangle":`multi-process`,processes:`multi-process`},Pe={app:`app-window`,money:`banknote`};function Fe(e){let t=e.replace(`/`,`:`),n=/^(tech|aws|gcp|azure)-(.+)$/.exec(t);return n?`${n[1]}:${n[2]}`:Pe[t]??t}var Ie=[`pastel`,`bold`,`outline`],Le=[`sharp`,`rounded`],Re=[`arrow`,`circle`,`cross`],ze=[`right`,`down`,`left`,`up`],Be=[`loop`,`alt`,`opt`,`par`,`break`],Ve=[`public`,`private`,`protected`,`package`],He={public:`+`,private:`-`,protected:`#`,package:`~`},Ue=[`zeroOrOne`,`one`,`zeroOrMany`,`oneOrMany`],We=[`inheritance`,`realization`,`composition`,`aggregation`,`dependency`,`association`];function Ge(e){if(e.fromCard||e.toCard)return{from:e.fromCard??`one`,to:e.toCard??`one`};switch(e.cardinality){case`1:1`:return{from:`one`,to:`one`};case`1:N`:return{from:`one`,to:`oneOrMany`};case`N:M`:return{from:`oneOrMany`,to:`oneOrMany`};default:return null}}var Ke=[`full`,`twoThirds`,`half`,`third`],L=[`info`,`success`,`warning`,`error`],qe=[`timeline`,`journey`,`cycle`,`funnel`,`pyramid`,`venn`,`matrix`],Je={min:0,max:5,default:3},Ye=[`normal`,`reverse`,`highlight`],Xe=[`done`,`active`,`critical`,`milestone`];function Ze(e){let{bounds:t,shape:n,ink:r}=e,i=t.x+t.width,o=t.y+t.height,s=b(e,a(t.x,t.y,t.width,t.height,4),r);return s.push(...b(e,u(t.x,t.y,i,o),r,T)),s.push(...b(e,u(i,t.y,t.x,o),r,T)),n.label&&s.push(E(e,t.x+t.width/2,t.y+t.height/2+Math.min(t.height*.25,n.fontSize*1.4),n.label,x,{size:n.fontSize*.8,anchor:`middle`})),s}var R=`Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt.`,z=1.3;function B(e,t){return Math.min(e.height*.5,Math.max(0,e.height-t*4))}function V(e){let t=o(e),n=e.fontSize,r=e.fontSize*.85,i=t.x+12,a=t.width-24,s=t.y+B(t,e.fontSize)+8,c=t.y+t.height-6,l=n*z,u=Math.max(1,e.label.trim()?D(e.label.trim(),a,n).length:1),d=Math.min(u*l,c-s),f=Math.min(s+d+4,c);return{title:{field:`label`,x:i,y:s,width:a,height:d,fontSize:n},body:{field:`body`,x:i,y:f,width:a,height:Math.max(r,c-f),fontSize:r}}}function H(e,t,n,r){let i=n.trim();if(!i)return[];let a=t.fontSize*z,o=Math.max(1,Math.floor(t.height/a));return D(i,t.width,t.fontSize).slice(0,o).map((n,i)=>E(e,t.x,t.y+a*i+2,n,r,{size:t.fontSize,baseline:`hanging`,testId:t.field===`body`?`card-body`:`card-title`}))}function Qe(e){let{bounds:t,shape:n,ink:r}=e,i=t.x+t.width,a=t.y+B(t,n.fontSize),o=y(e,10);o.push(...b(e,u(t.x,a,i,a),r,T)),o.push(...b(e,u(t.x,t.y,i,a),x,T)),o.push(...b(e,u(i,t.y,t.x,a),x,T));let s=V(n);return o.push(...H(e,s.title,n.label,r)),o.push(...H(e,s.body,n.body??``,x)),o}function $e(e){let{bounds:t,shape:n,ink:r}=e,i=S(n.label),a=y(e,6);if(i.length===0)return a;let o=t.height/i.length;return i.forEach((n,s)=>{let c=t.y+o*s,l=c+o/2,d=t.x+12;a.push({kind:`circle`,cx:d,cy:l,r:2.4,fill:x}),a.push(E(e,d+12,l,n,r)),s<i.length-1&&a.push(...b(e,u(t.x,c+o,t.x+t.width,c+o),x,1))}),a}var et={info:{label:`Info`,tint:`#e7f5ff`,ink:`#1971c2`},success:{label:`Success`,tint:`#ebfbee`,ink:`#2f9e44`},warning:{label:`Warning`,tint:`#fff9db`,ink:`#f08c00`},error:{label:`Error`,tint:`#fff5f5`,ink:`#e03131`}},U=L.map(e=>({key:e,...et[e]}));function tt(e){return U[Math.max(0,Math.min(U.length-1,Math.round(e.value??0)))]}function nt(e,t,n,r,i,a){let o=[];return t===`warning`?o.push(...b(e,`M ${n} ${r-i} L ${n+i} ${r+i*.85} L ${n-i} ${r+i*.85} Z`,a,T)):o.push(...b(e,l(n,r,i),a,T)),t===`success`?(o.push(...b(e,`M ${n-i*.45} ${r} L ${n-i*.1} ${r+i*.4} L ${n+i*.5} ${r-i*.4}`,a,2)),o):t===`info`?(o.push({kind:`circle`,cx:n,cy:r-i*.45,r:1.5,fill:a}),o.push(...b(e,u(n,r-i*.1,n,r+i*.5),a,2)),o):t===`warning`?(o.push(...b(e,u(n,r-i*.08,n,r+i*.28),a,2)),o.push({kind:`circle`,cx:n,cy:r+i*.5,r:1.4,fill:a}),o):(o.push(...b(e,u(n,r-i*.42,n,r+i*.12),a,2)),o.push({kind:`circle`,cx:n,cy:r+i*.42,r:1.4,fill:a}),o)}function rt(e){let{bounds:t,shape:n}=e,r=tt(n),i=t.y+t.height/2,o=[{kind:`rect`,x:t.x,y:t.y,width:t.width,height:t.height,rx:8,fill:r.tint}];o.push(...b(e,a(t.x,t.y,t.width,t.height,8),r.ink));let s=ie(t),c=t.x+s+12;if(o.push(...nt(e,r.key,c,i,s,r.ink)),n.label){let a=t.x+se(t);o.push(E(e,a,i,n.label,r.ink,{size:n.fontSize*.92}))}return o}function it(e){let{bounds:t,shape:n,ink:r}=e,i=S(n.label),a=y(e,8);if(i.length===0)return a;let o=t.height/i.length,s=v(n,i.length);return i.forEach((n,i)=>{let c=t.y+o*i,l=c+o/2;i===s&&a.push({kind:`rect`,x:t.x+4,y:c+3,width:t.width-8,height:o-6,rx:5,fill:C}),a.push(E(e,t.x+12,l,n,r))}),a}function at(t){let{bounds:n,shape:r,ink:i}=t,a=n.height-8,o=n.x+n.width/2,s=[],c=w(r),l=n.x,u=n.x+n.width,d=n.y,f=n.y+a,p=Math.min(6,a/2,n.width/2),m=`M ${l+p} ${d} H ${u-p} Q ${u} ${d} ${u} ${d+p} V ${f-p} Q ${u} ${f} ${u-p} ${f} H ${o+8} L ${o} ${f+8} L ${o-8} ${f} H ${l+p} Q ${l} ${f} ${l} ${f-p} V ${d+p} Q ${l} ${d} ${l+p} ${d} Z`;if(c&&(s.push({kind:`rect`,x:l,y:d,width:n.width,height:a,rx:p,fill:c}),s.push({kind:`path`,d:`M ${o-8} ${f} L ${o} ${f+8} L ${o+8} ${f} Z`,fill:c,stroke:`none`})),s.push(...b(t,m,i)),r.label){let l=c?e(c):i;s.push(E(t,o,n.y+a/2,r.label,l,{anchor:`middle`,size:r.fontSize*.9}))}return s}function ot(e){let{bounds:t,shape:n,ink:r}=e,i=S(n.label),a=y(e,8);if(i.length===0)return a;let o=v(n,i.length),s=Math.min(38,t.height/i.length),c=Math.max(0,t.height-s*i.length),l=t.x+t.width,d=t.y;return i.forEach((f,p)=>{let m=d+s/2,h=l-20,g=p===o,_=g?`M ${h-5} ${m-3} L ${h} ${m+3} L ${h+5} ${m-3}`:`M ${h-3} ${m-5} L ${h+3} ${m} L ${h-3} ${m+5}`;if(a.push(E(e,t.x+12,m,f,r)),a.push(...b(e,_,x,T)),d+=s,g&&c>0){let r=Math.max(1,Math.floor(c/(n.fontSize*1.4)));for(let i=0;i<r;i+=1){let o=d+n.fontSize*1.4*(i+.6);if(o>d+c)break;let s=i===r-1?.6:.92;a.push(...b(e,u(t.x+12,o,t.x+t.width*s,o),x,1))}d+=c}p<i.length-1&&a.push(...b(e,u(t.x,d,l,d),x,1))}),a}var st=`Are you sure you want to continue?`;function W(e){return Math.min(46,e.height*.24)}function G(e){return Math.min(56,e.height*.28)}function K(e){let t=e.x+e.width,n=e.y+e.height,r=G(e),i=n-r,a=Math.min(34,r-14),o=i+(r-a)/2,s=Math.min(88,(e.width-24-10)/2);if(s<=24)return null;let c=t-12-s;return{secondary:{x:c-10-s,y:o,width:s,height:a},primary:{x:c,y:o,width:s,height:a}}}function q(e){return e.primaryLabel??`OK`}function J(e){return e.secondaryLabel??`Cancel`}function ct(t){let{bounds:n,shape:r,ink:i}=t,o=n.x+n.width,c=n.y+n.height,l=W(n),d=c-G(n),f=y(t,12);r.label&&f.push(E(t,n.x+12,n.y+l/2,r.label,i,{testId:`card-title`}));let p=o-12-4,m=n.y+l/2;f.push(...b(t,u(p-5,m-5,p+5,m+5),x,T)),f.push(...b(t,u(p+5,m-5,p-5,m+5),x,T)),f.push(...b(t,u(n.x,n.y+l,o,n.y+l),x,1));let h=r.body??``;if(h){let e=r.fontSize*.92,a=e*1.4,o=n.y+l+10,s=D(h,n.width-24,e),c=Math.max(1,Math.floor((d-o)/a));s.slice(0,c).forEach((r,s)=>f.push(E(t,n.x+12,o+a*(s+.5),r,i,{size:e,testId:`card-body`})))}f.push(...b(t,u(n.x,d,o,d),x,1));let g=K(n);if(g){let{secondary:n,primary:o}=g,c=r.fontSize*.82,l=s(i)??e(i);f.push({kind:`rect`,x:o.x,y:o.y,width:o.width,height:o.height,rx:8,fill:i}),f.push(...b(t,a(o.x,o.y,o.width,o.height,8),i)),f.push(...b(t,a(n.x,n.y,n.width,n.height,8),i));let u=q(r),d=J(r);u&&f.push(E(t,o.x+o.width/2,o.y+o.height/2,u,l,{anchor:`middle`,size:c,testId:`modal-primary`})),d&&f.push(E(t,n.x+n.width/2,n.y+n.height/2,d,i,{anchor:`middle`,size:c,testId:`modal-secondary`}))}return f}var lt={image:Ze,card:Qe,list:$e,alert:rt,menu:it,tooltip:at,accordion:ot,modal:ct};function ut(e){let{bounds:t,shape:n,ink:r}=e,i=t.y+t.height/2,o=b(e,a(t.x,t.y,t.width,t.height,8),r),s=S(n.label),c=v(n,s.length);return s.forEach((n,a)=>{let l=t.x+t.width*(a+.5)/s.length;o.push(E(e,l,i,n,a===c?r:x,{anchor:`middle`}))}),o}var dt=14;function ft(e){let{bounds:t,shape:n,ink:r}=e,i=t.y+t.height/2,a=t.y+t.height-1,o=[{kind:`line`,x1:t.x,y1:a,x2:t.x+t.width,y2:a,stroke:x,width:1}],s=S(n.label);if(s.length>0){let c=v(n,s.length),l=n.fontSize*.55,d=t.x;s.forEach((t,n)=>{let s=t.length*l+dt*2;n===c&&o.push(...b(e,u(d+4,a,d+s-4,a),r,2.5)),o.push(E(e,d+s/2,i,t,n===c?r:x,{anchor:`middle`})),d+=s})}return o}function pt(e){let{bounds:t,shape:n,ink:r}=e,i=t.y+t.height/2,a=S(n.label),o=n.fontSize*.4,s=[],c=t.x;return a.forEach((t,n)=>{let l=n===a.length-1;s.push(E(e,c,i,t,l?r:x,{anchor:`start`})),c+=g(e,t),l||(c+=o,s.push(E(e,c,i,`/`,x,{anchor:`start`})),c+=g(e,`/`)+o)}),s}function mt(e){let{bounds:t,shape:n,ink:r}=e,i=t.y+t.height/2,o=S(n.label),s=t.height*.5,c=[],l=t.x+s*.5;c.push(...b(e,`M ${l+3} ${i-5} L ${l-3} ${i} L ${l+3} ${i+5}`,x,T));let u=t.x+t.width-s*.5;if(c.push(...b(e,`M ${u-3} ${i-5} L ${u+3} ${i} L ${u-3} ${i+5}`,x,T)),o.length>0){let l={x:t.x+s,width:t.width-s*2},u=l.width/o.length,d=v(n,o.length),f=Math.min(t.height,u)*.82;o.forEach((t,o)=>{let s=l.x+u*(o+.5);o===d&&c.push(...b(e,a(s-f/2,i-f/2,f,f,5),r,T)),c.push(E(e,s,i,t,o===d?r:x,{anchor:`middle`,size:n.fontSize*.85}))})}return c}function ht(e){let{bounds:t,shape:n,ink:r}=e,i=t.x+t.width,o=Math.min(34,t.height*.2),s=b(e,a(t.x,t.y,t.width,t.height,8),r),c=t.y+o/2;s.push(...b(e,`M ${t.x+18} ${c-4} L ${t.x+12} ${c} L ${t.x+18} ${c+4}`,x,T)),s.push(...b(e,`M ${i-18} ${c-4} L ${i-12} ${c} L ${i-18} ${c+4}`,x,T)),s.push(E(e,t.x+t.width/2,c,n.label||`Month`,x,{anchor:`middle`,size:n.fontSize*.85})),s.push(...b(e,u(t.x,t.y+o,i,t.y+o),x,1));let l=t.y+o+8,d=t.y+t.height-l-8,f=t.width/7,p=d/5,m=Math.min(f,p)*.16,h=Math.round((n.value??.4)*34);for(let e=0;e<5;e+=1)for(let i=0;i<7;i+=1){let a=t.x+f*(i+.5),o=l+p*(e+.5);e*7+i===h?s.push({kind:`circle`,cx:a,cy:o,r:m*1.8,fill:w(n)??r}):s.push({kind:`circle`,cx:a,cy:o,r:m,fill:x})}return s}function gt(e){let{bounds:t,shape:n,ink:r}=e,i=S(n.label),a=y(e,8);if(i.length===0)return a;let o=t.y+12,s=Math.min(40,(t.height-24)/i.length),c=v(n,i.length);return i.forEach((i,l)=>{let u=o+s*l,d=u+s/2;l===c&&a.push({kind:`rect`,x:t.x+6,y:u+3,width:t.width-12,height:s-6,rx:6,fill:C});let f=t.x+12+2;a.push({kind:`circle`,cx:f,cy:d,r:3,fill:l===c?r:x}),a.push(E(e,f+14,d,i,l===c?r:x,{size:n.fontSize*.9}))}),a}function Y(t){let{bounds:n,shape:r,ink:i}=t,o=S(r.label),s=Math.max(o.length,1),c=n.width/s,l=Math.min(8,n.height/2),d=n.y+n.height/2,f=v(r,o.length),p=w(r)??`#4dabf7`,m=[];o.length>0&&m.push({kind:`rect`,x:n.x+f*c,y:n.y,width:c,height:n.height,rx:f===0||f===s-1?l:0,fill:p}),m.push(...b(t,a(n.x,n.y,n.width,n.height,l),i));for(let e=1;e<s;e+=1){let r=n.x+e*c;m.push(...b(t,u(r,n.y,r,n.y+n.height),i,T))}return o.forEach((r,i)=>{let a=n.x+(i+.5)*c,o=i===f?e(p):x;m.push(E(t,a,d,r,o,{anchor:`middle`}))}),m}function _t(e){let{bounds:t,shape:n,ink:r}=e,i=S(n.label),a=Math.max(i.length,1),o=t.width/a,s=v(n,i.length),c=b(e,u(t.x,t.y,t.x+t.width,t.y),x,T),d=Math.min(8,t.height*.18),f=t.y+t.height*.4;return i.forEach((i,a)=>{let u=t.x+(a+.5)*o,p=a===s?r:x;c.push(...b(e,l(u,f,d),p,T)),c.push(E(e,u,t.y+t.height*.8,i,p,{anchor:`middle`,size:n.fontSize*.78}))}),c}function vt(e){let{bounds:t,shape:n,ink:r}=e,i=t.y+t.height/2,o=n.label&&n.label.length>0?n.label:`9:41`,s=[E(e,t.x+8,i,o,r,{size:n.fontSize*_})],c=t.x+t.width-8,l=Math.min(11,t.height*.5),u=l*2,d=c-u-2,f=i-l/2;s.push(...b(e,a(d,f,u,l,2),r,T)),s.push({kind:`rect`,x:d+u+1.5,y:i-l*.2,width:2,height:l*.4,fill:r}),s.push({kind:`rect`,x:d+1.5,y:f+1.5,width:(u-3)*.6,height:l-3,fill:r});let p=i+5,m=d-30;for(let e=0;e<4;e+=1){let t=3+e*2.2;s.push({kind:`rect`,x:m,y:p-t,width:3,height:t,fill:r}),m+=5}return s}function yt(t){let{bounds:n,shape:r,ink:i}=t,a=n.x+n.width/2,o=n.y+n.height/2,s=Math.min(n.width,n.height)/2-2,c=w(r),d=[];c&&d.push({kind:`circle`,cx:a,cy:o,r:s,fill:c}),d.push(...b(t,l(a,o,s),i));let f=s*.42,p=c?e(c):i;return d.push(...b(t,u(a-f,o,a+f,o),p,2.5)),d.push(...b(t,u(a,o-f,a,o+f),p,2.5)),d}var bt={navbar:ut,tabs:ft,breadcrumbs:pt,pagination:mt,datepicker:ht,sidebar:gt,segmented:Y,tabbar:_t,statusbar:vt,fab:yt},X=`#1e1e1e`,xt={...Oe,...bt,...lt,...d};function St(e,t){let n=o(e),r=0,a={shape:e,bounds:n,ink:i(e.color===`transparent`?X:e.color),text:t,nextSalt:()=>(r+=1,r)};return xt[e.kind](a)}var Z={button:{width:140,height:46},input:{width:220,height:46},search:{width:220,height:46},checkbox:{width:160,height:32},radio:{width:160,height:32},toggle:{width:140,height:36},dropdown:{width:200,height:46},slider:{width:220,height:42},navbar:{width:360,height:52},tabs:{width:320,height:46},image:{width:240,height:160},avatar:{width:72,height:72},heading:{width:240,height:46},paragraph:{width:280,height:84},divider:{width:240,height:16},link:{width:120,height:28},textarea:{width:240,height:110},stepper:{width:140,height:46},badge:{width:76,height:28},progress:{width:240,height:16},breadcrumbs:{width:280,height:32},pagination:{width:240,height:40},rating:{width:150,height:32},card:{width:240,height:200},list:{width:240,height:150},alert:{width:320,height:56},menu:{width:200,height:150},tooltip:{width:160,height:48},accordion:{width:280,height:170},datepicker:{width:240,height:220},sidebar:{width:180,height:280},scrollbar:{width:14,height:220},segmented:{width:240,height:36},tabbar:{width:360,height:56},statusbar:{width:320,height:28},fab:{width:56,height:56},modal:{width:320,height:210},stepbadge:{width:44,height:44},entity:{width:200,height:176},lifeline:{width:150,height:300},fragment:{width:300,height:180}},Q={button:`Button`,input:`Type here…`,search:`Search…`,dropdown:`Select…`,heading:`Heading`,navbar:`Home | About | Contact`,tabs:`First | Second`,checkbox:`Checkbox`,radio:`Option`,toggle:`Toggle`,link:`Link text`,badge:`New`,breadcrumbs:`Home | Library | Item`,pagination:`1 | 2 | 3 | 4`,card:`Card title`,list:`Item one | Item two | Item three`,alert:`Heads up. Something needs attention.`,menu:`New | Open | Save | Close`,tooltip:`Tooltip text`,accordion:`Section one | Section two | Section three`,sidebar:`Dashboard | Projects | Team | Settings`,segmented:`Day | Week | Month`,tabbar:`Home | Search | Profile`,statusbar:`9:41`,modal:`Dialog title`,stepbadge:`1`,entity:`User`,lifeline:`Participant`,fragment:`opt`},$={button:{resize:`free`,fill:!0,font:!0,label:!0},input:{resize:`width`,fill:!1,font:!0,label:!0},search:{resize:`width`,fill:!1,font:!0,label:!0},checkbox:{resize:`width`,fill:!1,font:!0,label:!0,value:`toggle`},radio:{resize:`width`,fill:!1,font:!0,label:!0,value:`toggle`},toggle:{resize:`width`,fill:!0,font:!0,label:!0,value:`toggle`},dropdown:{resize:`width`,fill:!1,font:!0,label:!0},slider:{resize:`width`,fill:!1,font:!0,label:!0,value:`range`},navbar:{resize:`width`,fill:!1,font:!0,label:!0,value:`index`},tabs:{resize:`width`,fill:!1,font:!0,label:!0,value:`index`},image:{resize:`free`,fill:!1,font:!0,label:!0},avatar:{resize:`aspect`,fill:!1,font:!1,label:!1},heading:{resize:`free`,fill:!1,font:!0,label:!0},paragraph:{resize:`free`,fill:!1,font:!0,label:!0},divider:{resize:`width`,fill:!1,font:!1,label:!1},link:{resize:`width`,fill:!1,font:!0,label:!0},textarea:{resize:`free`,fill:!1,font:!0,label:!0},stepper:{resize:`width`,fill:!1,font:!0,label:!0},badge:{resize:`width`,fill:!0,font:!0,label:!0},progress:{resize:`width`,fill:!0,font:!1,label:!1,value:`range`},breadcrumbs:{resize:`width`,fill:!1,font:!0,label:!0},pagination:{resize:`width`,fill:!1,font:!0,label:!0,value:`index`},rating:{resize:`width`,fill:!0,font:!1,label:!1,value:`stars`},card:{resize:`free`,fill:!0,font:!0,label:!0},list:{resize:`free`,fill:!0,font:!0,label:!0},alert:{resize:`width`,fill:!1,font:!0,label:!0,value:`alert`},menu:{resize:`free`,fill:!0,font:!0,label:!0,value:`index`},tooltip:{resize:`width`,fill:!0,font:!0,label:!0},accordion:{resize:`free`,fill:!0,font:!0,label:!0,value:`index`},datepicker:{resize:`free`,fill:!1,font:!1,label:!1},sidebar:{resize:`free`,fill:!0,font:!0,label:!0,value:`index`},scrollbar:{resize:`height`,fill:!0,font:!1,label:!1,value:`range`},segmented:{resize:`width`,fill:!0,font:!0,label:!0,value:`index`},tabbar:{resize:`width`,fill:!1,font:!0,label:!0,value:`index`},statusbar:{resize:`width`,fill:!1,font:!0,label:!0},fab:{resize:`aspect`,fill:!0,font:!1,label:!1},modal:{resize:`free`,fill:!0,font:!0,label:!0},stepbadge:{resize:`aspect`,fill:!0,font:!0,label:!0},entity:{resize:`free`,fill:!0,font:!0,label:!0},lifeline:{resize:`free`,fill:!0,font:!0,label:!0,value:`activation`},fragment:{resize:`free`,fill:!0,font:!0,label:!0,value:`operator`}};function Ct(e){return $[e].label}function wt(e,t,n){let r=Z[e];return{id:c(),type:`control`,kind:e,x:t.x,y:t.y,width:r.width,height:r.height,rotation:0,label:Q[e]??``,...e===`card`?{body:R}:{},...e===`modal`?{body:st}:{},...e===`entity`?{body:m}:{},...e===`fragment`?{fill:p}:{},...e===`stepbadge`?{fill:N}:{},fontSize:16,fontFamily:n.fontFamily,color:n.color===`transparent`?X:n.color,opacity:n.opacity,value:Tt(e)}}function Tt(e){if(e===`toggle`||e===`checkbox`||e===`radio`)return 1;if(e===`slider`||e===`progress`)return .6;if(e===`scrollbar`)return .3;if(e===`rating`)return 3;if(e===`alert`||e===`navbar`||e===`tabs`||e===`pagination`||e===`menu`||e===`accordion`||e===`sidebar`||e===`segmented`||e===`tabbar`)return 0}export{Le as A,Xe as C,Je as D,qe as E,He as F,Ve as I,Ge as L,P as M,Ne as N,F as O,Be as P,Fe as R,Ae as S,ke as T,We as _,Ct as a,Re as b,R as c,G as d,W as f,je as g,L as h,St as i,Ie as j,Me as k,V as l,J as m,Q as n,wt as o,q as p,Z as r,U as s,$ as t,K as u,Ke as v,Ye as w,Ue as x,ze as y,N as z};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e,t}from"./web-widget-limits-DeMquLIR.js";import{i as n}from"./web-embeds-I3saJ_yp.js";import{n as r}from"./embed-input-D77Udvni.js";function i(e){let t;try{t=new URL(e.trim())}catch{return null}return t.protocol!==`https:`||t.username!==``||t.password!==``||t.port!==``?null:t}function a(e){return e.hostname.toLowerCase().replace(/\.$/,``)}function o(e){let t=i(e);if(!t)return!1;let n=a(t);return n===`maps.app.goo.gl`?t.pathname.length>1:n===`goo.gl`&&/^\/maps\/[^/]+/.test(t.pathname)}var s=/^#([0-9a-f]{3}|[0-9a-f]{4}|[0-9a-f]{6}|[0-9a-f]{8})$/i,c=/^(rgba?|hsla?|oklch)\(([^()]*)\)$/i,l=/#[0-9a-f]+\b|(?:rgba?|hsla?|oklch)\([^()]*\)/iy,u=/[\s,;]*/y,d=/^["']?(?:--|\$|@)?([A-Za-z_][\w-]*)["']?\s*:\s*["']?(.+?)["']?\s*[;,]?$/,f=/^([^{}:]*:?[\w-]*\s*\{|\})$/;function p(e,t){let n=t.trim().replace(/\s+/g,` `);return!s.test(n)&&!c.test(n)?null:{name:e,value:n}}function m(e){let t=[],n=0;for(;n<e.length&&(u.lastIndex=n,u.exec(e),n=u.lastIndex,!(n>=e.length));){l.lastIndex=n;let r=l.exec(e),i=r?p(null,r[0]):null;if(!i)return null;t.push(i),n=l.lastIndex}return t}function h(e){let t=e.split(/\r?\n/).map(e=>e.trim()).filter(e=>e!==``),n=[];for(let e of t){let t=d.exec(e);if(t){let e=p(t[1],t[2]);if(!e)return null;n.push(e);continue}if(f.test(e))continue;let r=m(e);if(!r||(n.push(...r),n.length>24))return null}return n.length===0||n.length>24?null:n}function g(e,t,n){return Math.min(n,Math.max(t,e))}function _(e){return Math.round(g(e,0,255)).toString(16).padStart(2,`0`)}function v(e){let t=`#${_(e.r)}${_(e.g)}${_(e.b)}`;return e.a>=1?t:`${t}${_(e.a*255)}`}function y(e){let t=s.exec(e);if(!t)return null;let n=t[1];n.length<=4&&(n=n.replace(/(.)/g,`$1$1`));let r=e=>Number.parseInt(n.slice(e,e+2),16);return{r:r(0),g:r(2),b:r(4),a:n.length===8?r(6)/255:1}}function b(e){let t=/^([+-]?(?:\d+\.?\d*|\.\d+)(?:e[+-]?\d+)?)(%|deg|turn|rad)?$/i.exec(e);return t?{value:Number(t[1]),unit:(t[2]??``).toLowerCase()}:null}function x(e){let t=e.trim();if(t.includes(`,`)){let e=t.split(`,`).map(e=>e.trim());return e.length===3?{channels:e,alpha:null}:e.length===4?{channels:e.slice(0,3),alpha:e[3]}:null}let[n,r,i]=t.split(`/`).map(e=>e.trim());if(i!==void 0)return null;let a=n.split(/\s+/).filter(e=>e!==``);return a.length===3?{channels:a,alpha:r??null}:null}function S(e){if(e===null)return 1;let t=b(e);return!t||t.unit!==``&&t.unit!==`%`?null:g(t.unit===`%`?t.value/100:t.value,0,1)}function C(e){let t=b(e);return!t||t.unit===`%`?null:t.unit===`turn`?t.value*360:t.unit===`rad`?t.value*180/Math.PI:t.value}function w(e){let t=e.map(e=>{let t=b(e);return!t||t.unit!==``&&t.unit!==`%`?null:t.unit===`%`?t.value/100*255:t.value});if(t.some(e=>e===null))return null;let[n,r,i]=t;return{r:n,g:r,b:i}}function T(e){let t=b(e);return!t||t.unit!==`%`&&!(t.unit===``&&t.value===0)?null:g(t.value/100,0,1)}function E(e){let t=C(e[0]),n=T(e[1]),r=T(e[2]);if(t===null||n===null||r===null)return null;let i=(t%360+360)%360/360,a=(1-Math.abs(2*r-1))*n,o=e=>{let t=((i+e)%1+1)%1*6,n=Math.min(Math.max(Math.min(t,4-t),0),1);return(r-a/2+a*n)*255};return{r:o(1/3),g:o(0),b:o(-1/3)}}function D(e){let t=g(e,0,1);return(t<=.0031308?12.92*t:1.055*t**(1/2.4)-.055)*255}function O(e){let t=b(e[0]),n=b(e[1]),r=e[2].toLowerCase()===`none`?0:C(e[2]);if(!t||!n||r===null||t.unit!==``&&t.unit!==`%`||n.unit!==``&&n.unit!==`%`)return null;let i=t.unit===`%`?t.value/100:t.value,a=n.unit===`%`?n.value/100*.4:n.value,o=r*Math.PI/180,s=a*Math.cos(o),c=a*Math.sin(o),l=[(i+.3963377774*s+.2158037573*c)**3,(i-.1055613458*s-.0638541728*c)**3,(i-.0894841775*s-1.291485548*c)**3];return{r:D(4.0767416621*l[0]-3.3077115913*l[1]+.2309699292*l[2]),g:D(-1.2684380046*l[0]+2.6097574011*l[1]-.3413193965*l[2]),b:D(-.0041960863*l[0]-.7034186147*l[1]+1.707614701*l[2])}}function k(e){let t=c.exec(e);if(!t)return null;let n=x(t[2]),r=n?S(n.alpha):null;if(!n||r===null)return null;let i=t[1].toLowerCase(),a;return a=i.startsWith(`rgb`)?w(n.channels):i.startsWith(`hsl`)?E(n.channels):O(n.channels),a?{...a,a:r}:null}function A(e){let t=e.trim(),n=y(t)??k(t);return n?v(n):null}function j(e){let t=h(e);if(!t)return null;let n=[];for(let e of t){let t=A(e.value);if(!t)return null;n.push({...e,hex:t})}return n}function M(e){let t=e.trim();return/^(<!doctype\s+html\b|<html[\s>])/i.test(t)?t:null}var N=/^(flowchart|graph|sequenceDiagram|classDiagram|stateDiagram|stateDiagram-v2|erDiagram|gantt|mindmap|timeline|journey|pie|gitGraph)(\s.*)?$/;function P(e){let t=e.split(/\r?\n/).map(e=>e.trim()).filter(e=>e!==``&&!e.startsWith(`%%`));return t.length<2?!1:N.test(t[0])}var F=200,I=20;function L(e){return e==null?``:typeof e==`string`||typeof e==`number`||typeof e==`boolean`?String(e):null}function R(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function z(e){let t=e.trim();if(!t.startsWith(`[`))return null;let n;try{n=JSON.parse(t)}catch{return null}if(!Array.isArray(n)||n.length===0||n.length>F)return null;let r=[],i=new Set;for(let e of n){if(!R(e))return null;for(let t of Object.keys(e))i.has(t)||(i.add(t),r.push(t))}if(r.length===0||r.length>I)return null;let a=[r];for(let e of n){let t=[];for(let n of r){let r=L(e[n]);if(r===null)return null;t.push(r)}a.push(t)}return a}var B=`Couldn't open that map link`;async function V(e,t,r){let i=null;try{i=await t.resolveShortLink?.(e)??null}catch{i=null}let a=i?n(i):null;if(!a||a.provider!==`google-maps`){r(B);return}t.pasteEmbed(a)}async function H(n,i,a,s){let c=n.plainText,l=M(c);if(l)return e(l)>131072?(s(`That page is too big for a widget (max ${t/1024} KB)`),!0):(a.pasteHtmlWidget(l),!0);if(a.resolveShortLink&&o(c))return await V(c.trim(),a,s),!0;let u=r(c);if(u)return a.pasteEmbed(u),!0;if(h(c)){let e=j(c);return e?e.length===1&&a.hasSelection()?(a.applyColor(e[0].hex),s(`Applied ${e[0].value}`),!0):(a.pasteColors(e),!0):!1}if(P(c))return a.pasteMermaid(c.trim()),!0;let d=i?null:z(c);return d?(a.pasteGrid(d),!0):!1}export{H as pasteRichText};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{t}from"./react-lCSYwAWP.js";import{t as n}from"./jsx-runtime-DKdBMi_L.js";import{o as r,s as i}from"./editor-DAJETlQW.js";import{H as a,J as o,K as s,Q as c,W as l}from"./style-BENGW2ZV.js";import{A as u,B as d,N as f,j as p,ln as m,on as h}from"./shapes-D5w8NTQQ.js";import{C as ee,w as g}from"./slides-DDNzjFz9.js";import{n as te}from"./renderer-environment-D3n3hbug.js";import{r as ne,s as _,t as v}from"./IconHelp-4FIVl1rh.js";import{t as re}from"./editable-target-BTLnvKNi.js";import{t as y}from"./createReactComponent-C51FAx3B.js";import{n as ie,r as ae,t as oe}from"./IconTrash-C8w6ThWx.js";import{t as se}from"./IconArrowLeft-B4Zcy-Fc.js";import{n as ce,t as le}from"./IconPlayerStopFilled-D4qdct2R.js";import{t as ue}from"./IconEraser-CYfXj27R.js";import{t as de}from"./IconFocusCentered-Cn8rbfRI.js";import{t as fe}from"./IconPencil-D_pQsAyv.js";import{t as pe}from"./IconX-KrRqxr2j.js";import{t as me}from"./IconPlayerPlayFilled-DVAWmYt7.js";import{t as he}from"./storage-CvDRYh5V.js";import{s as b}from"./chrome-C2RCq3SI.js";import{i as ge,n as x,r as S,t as C}from"./DialogRoot-DUeVfNhS.js";import{n as w,t as _e}from"./DialogTitle-D5au2NAn.js";import{t as T}from"./DialogDescription-Ddhk2rmF.js";import{n as ve}from"./connector-labels-DqVssnYz.js";var ye=y(`outline`,`volume-off`,`VolumeOff`,[[`path`,{d:`M15 8a5 5 0 0 1 1.912 4.934m-1.377 2.602a5 5 0 0 1 -.535 .464`,key:`svg-0`}],[`path`,{d:`M17.7 5a9 9 0 0 1 2.362 11.086m-1.676 2.299a9 9 0 0 1 -.686 .615`,key:`svg-1`}],[`path`,{d:`M9.069 5.054l.431 -.554a.8 .8 0 0 1 1.5 .5v2m0 4v8a.8 .8 0 0 1 -1.5 .5l-3.5 -4.5h-2a1 1 0 0 1 -1 -1v-4a1 1 0 0 1 1 -1h2l1.294 -1.664`,key:`svg-2`}],[`path`,{d:`M3 3l18 18`,key:`svg-3`}]]),be=y(`outline`,`volume`,`Volume`,[[`path`,{d:`M15 8a5 5 0 0 1 0 8`,key:`svg-0`}],[`path`,{d:`M17.7 5a9 9 0 0 1 0 14`,key:`svg-1`}],[`path`,{d:`M6 15h-2a1 1 0 0 1 -1 -1v-4a1 1 0 0 1 1 -1h2l3.5 -4.5a.8 .8 0 0 1 1.5 .5v14a.8 .8 0 0 1 -1.5 .5l-3.5 -4.5`,key:`svg-2`}]]),E=e(t(),1),D=200,xe=24,O=48,k=new Set([`ellipse`,`oval`,`double-circle`,`delay`]);function A(e,t){return`${e}:${t}`}function Se(e){if(e.bendStyle===`elbow`)return m(e);let t={x:e.x,y:e.y},n={x:e.x2,y:e.y2};if(Math.abs(e.bend)<.5)return[t,n];let r=h(e),i={x:2*r.x-(t.x+n.x)/2,y:2*r.y-(t.y+n.y)/2},a=[];for(let e=0;e<=xe;e++){let r=e/xe,o=1-r;a.push({x:o*o*t.x+2*o*r*i.x+r*r*n.x,y:o*o*t.y+2*o*r*i.y+r*r*n.y})}return a}function j(e,t){let{x:n,y:r,width:i,height:a}=t,o=e.type===`rectangle`?e.kind:null;if(o&&k.has(o)){let e=[];for(let t=0;t<=O;t++){let o=t/O*Math.PI*2;e.push({x:n+i/2+Math.cos(o)*i/2,y:r+a/2+Math.sin(o)*a/2})}return e}return o===`diamond`?[{x:n+i/2,y:r},{x:n+i,y:r+a/2},{x:n+i/2,y:r+a},{x:n,y:r+a/2},{x:n+i/2,y:r}]:o===`triangle`?[{x:n+i/2,y:r},{x:n+i,y:r+a},{x:n,y:r+a},{x:n+i/2,y:r}]:[{x:n,y:r},{x:n+i,y:r},{x:n+i,y:r+a},{x:n,y:r+a},{x:n,y:r}]}var Ce=6;function M(e){if(e.length<3)return e;let t=[e[0]];for(let n=1;n<e.length-1;n++){let r=t[t.length-1];Math.hypot(e[n].x-r.x,e[n].y-r.y)>=Ce&&t.push(e[n])}return t.push(e[e.length-1]),t}function we(e){if(e.type===`draw`)return[M(e.points)];if(e.type===`line`)return[e.points];if(e.type===`polygon`)return e.points.length>2?[[...e.points,e.points[0]]]:[];if(e.type===`arrow`)return[Se(e)];if(e.type===`text`||e.type===`figure`||!d(e)&&e.type!==`table`)return[];let t=p(e),n=j(e,t),r=f(e);if(!r)return[n];let i={x:t.x+t.width/2,y:t.y+t.height/2},a=r*Math.PI/180;return[n.map(e=>u(e,i,a))]}function N(e,t){let n=Math.floor(Math.min(t.a.x,t.b.x)/D),r=Math.floor(Math.max(t.a.x,t.b.x)/D),i=Math.floor(Math.min(t.a.y,t.b.y)/D),a=Math.floor(Math.max(t.a.y,t.b.y)/D);for(let o=n;o<=r;o++)for(let n=i;n<=a;n++){let r=A(o,n),i=e.get(r);i?i.push(t):e.set(r,[t])}}function Te(e,t){for(let n=1;n<t.length;n++){let r=t[n-1],i=t[n];!Number.isFinite(r.x+r.y+i.x+i.y)||r.x===i.x&&r.y===i.y||(N(e.cells,{a:r,b:i}),e.bottom=Math.max(e.bottom,r.y,i.y),e.empty=!1)}}function Ee(e){return e.flatMap(we)}function De(e,t=[]){let n={cells:new Map,bottom:-1/0,empty:!0};for(let t of e)Te(n,t);for(let e of t)Te(n,M(e));return n}function P(e,t,n){let r=Math.floor((t.x-n)/D),i=Math.floor((t.x+n)/D),a=Math.floor((t.y-n)/D),o=Math.floor((t.y+n)/D),s=[];for(let t=r;t<=i;t++)for(let n=a;n<=o;n++){let r=e.cells.get(A(t,n));r&&s.push(...r)}return s}function Oe(e,t){let n=Math.floor(t.x/D),r=Math.floor(e.bottom/D);for(let i=Math.floor(t.y/D);i<=r;i++)for(let{a:r,b:a}of e.cells.get(A(n,i))??[]){let e=Math.min(r.x,a.x),n=Math.max(r.x,a.x);if(t.x<e||t.x>n)continue;let i=n===e?0:(t.x-r.x)/(a.x-r.x);if(Math.max(r.y,a.y)>=t.y&&r.y+(a.y-r.y)*i>=t.y)return!0}return!1}var ke=1500,F={x:8,y:-40},Ae={x:11,y:-29},I=7,L=.1,je=.02,R=5e3,Me=32,Ne=1300,Pe=1100,Fe=650,z=7,B=10,V=1,H=.15,U=2.5,Ie=3,Le=8,Re=1.2,ze=1700,Be=2400,Ve=.2,He=620,Ue=.15,We=1.4,Ge=700,Ke=4e3,qe=160,Je={left:!1,right:!1,boost:!1,duck:!1};function Ye(e,t){return{position:{...e},velocity:{...t},grounded:!1,normal:null}}function Xe(e,t){return{...Ye(e,t),spin:0}}function Ze(e){let t={x:0,y:0};return{left:Xe({x:e.x-23,y:e.y},t),right:Xe({x:e.x+23,y:e.y},t),facing:1,ducking:!1,rider:null,crashedFor:0,jumpBuffer:0,outcome:`riding`,distance:0,topSpeed:0,air:0,longestAir:0,angle:0,airTurn:0,groundTurn:0,leanLock:0,wasGrounded:!1,touchedDown:!1,lastGroundY:e.y,startY:e.y,trail:[{...e}],events:[]}}function W(e){return Math.hypot(e.x,e.y)}function G(e,t,n){return{x:e.x+(t.x-e.x)*n,y:e.y+(t.y-e.y)*n}}function Qe(e){return G(e.left.position,e.right.position,.5)}function $e(e){return W(G(e.left.velocity,e.right.velocity,.5))}function et(e,t,n){let r=G(e,t,.5),i=Math.atan2(t.y-e.y,t.x-e.x),a=Math.cos(i),o=Math.sin(i);return{x:r.x+n.x*a-n.y*o,y:r.y+n.x*o+n.y*a}}function tt(e,t){let{position:n,velocity:r}=e;r.y+=ke*t,r.x*=1-je*t,r.y*=1-je*t;let i=W(r);i>R&&(r.x=r.x/i*R,r.y=r.y/i*R),n.x+=r.x*t,n.y+=r.y*t}function nt(e,t,n,r){let{position:i,velocity:a}=e,o=0,c=0;for(let e of P(t,i,n)){let t=s(i,e.a,e.b),r=i.x-t.x,l=i.y-t.y,u=Math.hypot(r,l);if(u>=n)continue;let d,f;if(u>1e-6)d=r/u,f=l/u;else{let t=e.b.x-e.a.x,n=e.b.y-e.a.y,r=Math.hypot(t,n);d=n/r,f=-t/r,f>0&&(d=-d,f=-f)}i.x+=d*(n-u),i.y+=f*(n-u);let p=a.x*d+a.y*f;p<0&&(a.x-=1.1*p*d,a.y-=1.1*p*f),o+=d,c+=f}let l=Math.hypot(o,c);e.grounded=l>0,e.normal=e.grounded?{x:o/l,y:c/l}:null,e.grounded&&(a.x*=1-L*r,a.y*=1-L*r)}function rt(e,t,n){return P(e,t,n).some(e=>o(s(t,e.a,e.b),t)<n)}function K(e,t){let n=t.position.x-e.position.x,r=t.position.y-e.position.y,i=Math.hypot(n,r)||1;return{x:n/i,y:r/i}}function it(e,t){let n=t.position.x-e.position.x,r=t.position.y-e.position.y,i=Math.hypot(n,r)||1,a=n/i,o=r/i,s=(i-46)/2;e.position.x+=a*s,e.position.y+=o*s,t.position.x-=a*s,t.position.y-=o*s;let c=(t.velocity.x-e.velocity.x)*a+(t.velocity.y-e.velocity.y)*o;t.velocity.x-=a*c*.5,t.velocity.y-=o*c*.5,e.velocity.x+=a*c*.5,e.velocity.y+=o*c*.5}function at(e,t,n){let{left:r,right:i}=e,a=K(r,i),o=!!t.right-+!!t.left,s=r.grounded||i.grounded;o!==0&&s&&(e.facing=o>0?1:-1);let c={x:a.x*e.facing,y:a.y*e.facing};if(o!==0&&s)for(let e of[r,i]){if(!e.normal)continue;let t=-e.normal.y,r=e.normal.x;t*c.x+r*c.y<0&&(t=-t,r=-r),e.velocity.x*t+e.velocity.y*r<Pe&&(e.velocity.x+=t*Ne*n,e.velocity.y+=r*Ne*n)}if(o!==0&&!s&&(r.velocity.x+i.velocity.x)/2*o<Pe)for(let e of[r,i])e.velocity.x+=o*Fe*n;if(t.boost&&(r.velocity.x+i.velocity.x)/2*c.x+(r.velocity.y+i.velocity.y)/2*c.y<Be)for(let e of[r,i])e.velocity.x+=c.x*ze*n,e.velocity.y+=c.y*ze*n}function ot(e,t,n){return((t.velocity.x-e.velocity.x)*-n.y+(t.velocity.y-e.velocity.y)*n.x)/46}function st(e,t,n,r,i){let a=(i-r)*23;t.velocity.x+=-n.y*a,t.velocity.y+=n.x*a,e.velocity.x-=-n.y*a,e.velocity.y-=n.x*a}function ct(e,t){let{left:n,right:r}=e,i=K(n,r),a=ot(n,r,i),o=Math.atan2(i.y,i.x),s=l(-o*U,-3,Ie);st(n,r,i,a,Math.abs(o)>Re&&a*o>0?s:a+(s-a)*Math.min(1,Le*t))}function lt(e,t,n){let{left:r,right:i}=e,a=K(r,i),o=ot(r,i,a);st(r,i,a,o,o+(t*z-o)*Math.min(1,B*n))}function ut(e){let t=K(e.left,e.right);return Math.atan2(t.y,t.x)}function dt(e,t){let n=t-e;return n>Math.PI?n-=Math.PI*2:n<-Math.PI&&(n+=Math.PI*2),n}function ft(e,t=0){return Math.floor((Math.abs(e)+t)/(Math.PI*2))}function pt(e){e.outcome===`riding`&&(e.jumpBuffer=Ue)}function mt(e){let{left:t,right:n}=e;if(e.jumpBuffer<=0||!t.grounded&&!n.grounded)return;let r=K(t,n);for(let e of[t,n])e.velocity.x+=r.y*He,e.velocity.y-=r.x*He;e.jumpBuffer=0,e.events.push({kind:`jump`})}function ht(e,t,n,r){if(e.outcome===`fell`)return;let i=Math.max(W(e.left.velocity),W(e.right.velocity),e.rider?W(e.rider.velocity):0),a=Math.min(Me,Math.max(1,Math.ceil(i*r/(11*.4)))),s=r/a;for(let r=0;r<a;r++){let r=Qe(e);if(e.outcome===`riding`){e.ducking=n.duck,at(e,n,s);let t=!!n.right-+!!n.left,r=!e.left.grounded&&!e.right.grounded;r&&e.wasGrounded&&(e.leanLock=t),t!==e.leanLock&&(e.leanLock=0),e.wasGrounded=!r,e.touchedDown||=!r,r&&(t!==0&&e.leanLock===0&&e.touchedDown?lt(e,t,s):ct(e,s)),mt(e)}tt(e.left,s),tt(e.right,s),it(e.left,e.right),nt(e.left,t,11,s),nt(e.right,t,11,s);let i=K(e.left,e.right);for(let t of[e.left,e.right]){let e=t.velocity.x*i.x+t.velocity.y*i.y;t.spin+=e/11*s}let a=ut(e),c=dt(e.angle,a);if(e.angle=a,e.left.grounded||e.right.grounded?e.groundTurn+=c:(e.airTurn+=c,e.air<=H&&(e.groundTurn+=c)),e.outcome===`riding`){let t=Qe(e);e.distance+=o(r,t)}if(e.rider)tt(e.rider,s),nt(e.rider,t,I,s);else{let n=e.ducking?Ae:F,r=et(e.left.position,e.right.position,{x:n.x*e.facing,y:n.y});if(rt(t,r,I)){let t=G(e.left.velocity,e.right.velocity,.5);e.rider=Ye(r,{x:t.x,y:t.y-250}),e.outcome=`crashed`,e.events.push({kind:`crash`})}}}let c=Qe(e);if(e.outcome===`riding`&&(e.topSpeed=Math.max(e.topSpeed,$e(e))),e.left.grounded||e.right.grounded){if(e.outcome===`riding`){e.air>Ve&&e.events.push({kind:`land`,strength:Math.min(1,e.air/1.2),air:e.air});let t=ft(e.airTurn,V);if(t>0){let n=e.airTurn*e.facing>0?`frontflip`:`backflip`;e.events.push({kind:`trick`,trick:{kind:n,count:t}})}ft(e.groundTurn)>0&&(e.events.push({kind:`trick`,trick:{kind:`loop`}}),e.groundTurn-=Math.sign(e.groundTurn)*Math.PI*2)}e.air=0,e.airTurn=0,e.lastGroundY=c.y}else e.outcome===`riding`&&(e.air+=r,e.longestAir=Math.max(e.longestAir,e.air),e.air>H&&(e.groundTurn=0));e.outcome===`crashed`&&(e.crashedFor+=r),e.jumpBuffer=Math.max(0,e.jumpBuffer-r);let l=e.trail[e.trail.length-1];o(l,c)>6&&(e.trail.push(c),e.trail.length>qe&&e.trail.shift());let u=Math.max(t.bottom,e.startY)+Ke,d=c.y-e.lastGroundY>Ge&&!Oe(t,c);(c.y>u||d)&&(e.outcome=`fell`)}function gt(e){return e.outcome===`fell`||e.crashedFor>We}function q(e){return G(e.left,e.right,.5)}function _t(e){return{left:{x:e.x-23,y:e.y},right:{x:e.x+23,y:e.y},leftSpin:0,rightSpin:0,facing:1,ducking:!1,rider:null,riderSpin:0}}function vt(e){return{left:{...e.left.position},right:{...e.right.position},leftSpin:e.left.spin,rightSpin:e.right.spin,facing:e.facing,ducking:e.ducking,rider:e.rider?{...e.rider.position}:null,riderSpin:e.crashedFor*9}}function yt(e,t,n){return{left:G(e.left,t.left,n),right:G(e.right,t.right,n),leftSpin:e.leftSpin+(t.leftSpin-e.leftSpin)*n,rightSpin:e.rightSpin+(t.rightSpin-e.rightSpin)*n,facing:t.facing,ducking:t.ducking,rider:t.rider?G(e.rider??t.rider,t.rider,n):null,riderSpin:e.riderSpin+(t.riderSpin-e.riderSpin)*n}}var J=n(),bt=`#e03131`,xt=`#f76707`,Y=`var(--canvas-ink)`;function St(e){let{x:t,spin:n}=e;return(0,J.jsxs)(`g`,{transform:`translate(${t} 0) rotate(${n*180/Math.PI})`,children:[(0,J.jsx)(`circle`,{r:10,fill:`none`,stroke:Y,strokeWidth:2.5}),(0,J.jsx)(`path`,{d:`M -9 0 L 9 0 M 0 -9 L 0 9`,stroke:Y,strokeWidth:1,opacity:.6})]})}function Ct(e){let{rearSpin:t,frontSpin:n,riding:r,boosting:i,ducking:a}=e,o={x:-3,y:2},s=t*.6,c=e=>({x:o.x+Math.cos(s+e)*6,y:o.y+Math.sin(s+e)*6}),l=c(0),u=c(Math.PI),d=a?{x:-7,y:-17}:{x:-7,y:-20},f=a?{x:6,y:-23}:{x:4,y:-34},p=a?Ae:F,m=a?`M 6 -24 L -7 -23 L -12 -19`:`M 5 -33 L -8 -31 L -13 -27`,h=e=>{let t={x:(d.x+e.x)/2+6,y:(d.y+e.y)/2-3};return`M ${d.x} ${d.y} L ${t.x} ${t.y} L ${e.x} ${e.y}`};return(0,J.jsxs)(`g`,{strokeLinecap:`round`,strokeLinejoin:`round`,fill:`none`,children:[i&&(0,J.jsx)(`path`,{d:`M -30 -19 L ${-44-(Math.sin(t*7)+1)*5} -16 L -30 -13 Z`,fill:xt,stroke:xt,strokeWidth:1.5}),(0,J.jsx)(`rect`,{x:-30,y:-19,width:16,height:6,rx:3,fill:`var(--canvas-bg)`,stroke:Y,strokeWidth:2}),(0,J.jsx)(St,{x:-23,spin:t}),(0,J.jsx)(St,{x:23,spin:n}),r&&(0,J.jsx)(`path`,{d:h(u),stroke:Y,strokeWidth:2.5,opacity:.45}),(0,J.jsx)(`path`,{d:`M -23 0 L ${o.x} ${o.y} L 14 -16 L 23 0 M -23 0 L -8 -17 L ${o.x} ${o.y} M -12 -18 L -4 -18 M 14 -16 L 12 -23 L 18 -24`,stroke:Y,strokeWidth:2.5}),r&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`path`,{d:`${h(l)} M ${d.x} ${d.y} L ${f.x} ${f.y} L 16 -23`,stroke:Y,strokeWidth:2.5}),(0,J.jsx)(`circle`,{cx:p.x,cy:p.y,r:6,fill:`var(--canvas-bg)`,stroke:Y,strokeWidth:2.5}),(0,J.jsx)(`path`,{d:m,stroke:`#e03131`,strokeWidth:3})]})]})}function wt(){return(0,J.jsxs)(`g`,{strokeLinecap:`round`,fill:`none`,stroke:Y,strokeWidth:2.5,children:[(0,J.jsx)(`circle`,{r:6,fill:`var(--canvas-bg)`}),(0,J.jsx)(`path`,{d:`M 0 6 L 0 20 M 0 11 L -9 16 M 0 11 L 9 14 M 0 20 L -6 30 M 0 20 L 7 29`}),(0,J.jsx)(`path`,{d:`M -3 6 L -14 9`,stroke:bt,strokeWidth:3})]})}function Tt(e,t){let n=[e[0]];for(let r=1;r<e.length;r++){let i=e[r-1],a=e[r],s=Math.ceil(o(i,a)/t);for(let e=1;e<=s;e++){let t=e/s;n.push({x:i.x+(a.x-i.x)*t,y:i.y+(a.y-i.y)*t})}}return n}function Et(e){let t=1/0,n=1/0,r=-1/0,i=-1/0;for(let a of e)t=Math.min(t,a.x),n=Math.min(n,a.y),r=Math.max(r,a.x),i=Math.max(i,a.y);return{minX:t,minY:n,maxX:r,maxY:i}}function Dt(e,t,n,r){let i=[],a=!1;for(let o of e){let e=Et(o);if(!(Math.min(t.x,n.x)-r<=e.maxX&&Math.max(t.x,n.x)+r>=e.minX&&Math.min(t.y,n.y)-r<=e.maxY&&Math.max(t.y,n.y)+r>=e.minY)){i.push(o);continue}let s=[],l=!1;for(let e of Tt(o,r/2))c(e,t,n)<=r?(l=!0,s.length>1&&i.push(s),s=[]):s.push(e);if(!l){i.push(o);continue}a=!0,s.length>1&&i.push(s)}return a?i:e}function Ot(e,t){let n=e;for(let e of t)for(let t=0;t<e.points.length;t++)n=Dt(n,e.points[Math.max(0,t-1)],e.points[t],e.radius);return n}var kt=260,At=2.2,jt={smoke:-60,dust:500,spark:900};function X(e,t,n,r,i,a,o,s){for(let c=0;c<r;c++){let r=Math.random()*Math.PI*2,c=Math.random()*a;e.push({kind:t,x:n.x+(Math.random()-.5)*4,y:n.y+(Math.random()-.5)*4,vx:i.x+Math.cos(r)*c,vy:i.y+Math.sin(r)*c,age:0,life:o*(.6+Math.random()*.8),size:s*(.7+Math.random()*.6)})}e.length>kt&&e.splice(0,e.length-kt)}function Mt(e,t){let n=0;for(let r of e)r.age+=t,!(r.age>=r.life)&&(r.vx*=1-At*t,r.vy=r.vy*(1-At*t)+jt[r.kind]*t,r.x+=r.vx*t,r.y+=r.vy*t,e[n++]=r);e.length=n}var Z=.05;function Nt(e,t){let n=e.createBuffer(1,e.sampleRate*t,e.sampleRate),r=n.getChannelData(0);for(let e=0;e<r.length;e++)r[e]=Math.random()*2-1;return n}function Pt(e,t){let n=e.createBufferSource();return n.buffer=t,n.loop=!0,n.start(),n}function Ft(e){let t=typeof window>`u`?void 0:window.AudioContext??window.webkitAudioContext;if(!t)return null;let n=new t;n.resume().catch(()=>void 0);let r=n.createGain();r.gain.value=e?0:.6,r.connect(n.destination);let i=Nt(n,2),a=n.createBiquadFilter();a.type=`lowpass`,a.frequency.value=300;let o=n.createGain();o.gain.value=0,Pt(n,i).connect(a).connect(o).connect(r);let s=n.createOscillator();s.type=`sawtooth`,s.frequency.value=70;let c=n.createBiquadFilter();c.type=`lowpass`,c.frequency.value=700;let l=n.createGain();l.gain.value=0,s.connect(c).connect(l).connect(r),s.start();let u=n.createBiquadFilter();u.type=`bandpass`,u.frequency.value=1800,u.Q.value=.7;let d=n.createGain();d.gain.value=0,Pt(n,i).connect(u).connect(d).connect(r);let f=(e,t,i,a)=>{let o=n.currentTime,s=n.createOscillator();s.type=`sine`,s.frequency.setValueAtTime(e,o),s.frequency.exponentialRampToValueAtTime(t,o+a);let c=n.createGain();c.gain.setValueAtTime(i,o),c.gain.exponentialRampToValueAtTime(.001,o+a),s.connect(c).connect(r),s.start(o),s.stop(o+a)},p=(e,t,a)=>{let o=n.currentTime,s=n.createBufferSource();s.buffer=i;let c=n.createBiquadFilter();c.type=`lowpass`,c.frequency.value=e;let l=n.createGain();l.gain.setValueAtTime(t,o),l.gain.exponentialRampToValueAtTime(.001,o+a),s.connect(c).connect(l).connect(r),s.start(o),s.stop(o+a)};return{update:({speed:e,grounded:t,boosting:r,running:i})=>{let c=n.currentTime,u=Math.min(1,e/1500);o.gain.setTargetAtTime(i&&t?.05+u*.25:0,c,Z),a.frequency.setTargetAtTime(250+u*1400,c,Z);let f=i&&r;l.gain.setTargetAtTime(f?.1:0,c,Z),s.frequency.setTargetAtTime(60+u*90,c,Z),d.gain.setTargetAtTime(f?.18:0,c,Z)},land:e=>{f(140,45,.25+e*.45,.25),p(900,.15+e*.2,.18)},jump:()=>{f(180,520,.3,.14),p(2400,.08,.1)},trick:()=>{let e=n.currentTime;[660,990].forEach((t,i)=>{let a=e+i*.09,o=n.createOscillator();o.type=`triangle`,o.frequency.setValueAtTime(t,a);let s=n.createGain();s.gain.setValueAtTime(.001,e),s.gain.setValueAtTime(.18,a),s.gain.exponentialRampToValueAtTime(.001,a+.22),o.connect(s).connect(r),o.start(a),o.stop(a+.24)})},crash:()=>{p(1400,.6,.6),f(110,35,.7,.45)},setMuted:e=>{r.gain.setTargetAtTime(e?0:.6,n.currentTime,Z)},close:()=>{n.close().catch(()=>void 0)}}}var It=1/120,Lt=.05,Rt=5,zt=.25,Bt=260,Vt=48,Ht={x:-32,y:-16},Ut=100,Wt=150,Gt=50,Kt=1,qt=1.4,Jt=40,Yt=22;function Xt(e){return e.lift+e.age/qt*Jt}function Zt(e){if(e.kind===`loop`)return`Loop!`;let t=e.kind===`backflip`?`Backflip`:`Frontflip`;return e.count>1?`${e.count}× ${t}!`:`${t}!`}function Qt(e){return e.kind===`loop`?Wt:Ut*e.count*e.count}function $t(){let e=0,t=null,n={bike:null,pose:null,blendFrom:null,controls:{...Je},particles:[],callouts:[],score:0,running:!1,following:!0,returning:!1,play(e,r){t??=Ft(r),n.bike=Ze(e),n.pose=vt(n.bike),n.blendFrom=null,n.returning=!1,n.following=!0,n.running=!0,n.score=0,n.callouts=[]},stop(e){let r=n.bike,i=r?{distance:r.distance,topSpeed:r.topSpeed,longestAir:r.longestAir,score:n.score,outcome:e}:null;return n.bike=null,n.pose=null,n.controls={...Je},t?.update({speed:0,grounded:!1,boosting:!1,running:!1}),n.returning=n.following,n.running=!1,i},setMuted(e){t?.setMuted(e)},close(){t?.close(),t=null},tick(t,r,a,o,s){let c=Math.min(Lt,t),l=n.bike,u=null;if(l&&n.running){for(e+=c;e>=It;)n.blendFrom=vt(l),ht(l,r,n.controls,It),e-=It;let t=vt(l);if(n.pose=yt(n.blendFrom??t,t,e/It),i(l,t),gt(l))return{camera:null,ended:n.stop(l.outcome===`fell`?`fell`:`crashed`),moved:!1};!n.following&&en(q(n.pose),a,o)&&(n.following=!0),n.following&&(u=tn(l,n.pose))}else e=0,n.returning&&s&&(u=s);let d=null;if(u){let e=1-Math.exp(-c*Rt),t=a.width/2-u.x*o.zoom-o.x,r=a.height/2-u.y*o.zoom-o.y;!n.running&&Math.hypot(t,r)<1&&(n.returning=!1),d={...o,x:o.x+t*e,y:o.y+r*e}}if(n.particles.length>0&&Mt(n.particles,c),n.callouts.length>0){for(let e of n.callouts)e.age+=c;n.callouts=n.callouts.filter(e=>e.age<qt)}return{camera:d,ended:null,moved:n.running||n.particles.length>0||n.callouts.length>0}}};function r(e,t,r){n.score+=t;let i=q(r),a=0,o=n.callouts.map(Xt).sort((e,t)=>e-t);for(let e of o)e<a+Yt&&(a=Math.max(a,e+Yt));n.callouts.push({text:`${e} +${t}`,at:{x:i.x,y:i.y-60},age:0,lift:a})}function i(e,i){let a=n.particles,o=n.controls.boost&&e.outcome===`riding`;if(o){let t=et(i.left,i.right,{x:Ht.x*e.facing,y:Ht.y}),n={x:(e.left.velocity.x+e.right.velocity.x)*.15,y:(e.left.velocity.y+e.right.velocity.y)*.15};X(a,`smoke`,t,2,n,90,.9,7),X(a,`spark`,t,1,n,160,.25,2.5)}for(let n of e.events)if(n.kind===`jump`){t?.jump();for(let e of[i.left,i.right])X(a,`dust`,{x:e.x,y:e.y+11},4,{x:0,y:-40},120,.45,3.5)}else if(n.kind===`trick`)t?.trick(),r(Zt(n.trick),Qt(n.trick),i);else if(n.kind===`land`){n.air>=Kt&&r(`Big air ${n.air.toFixed(1)}s`,Math.round(n.air*Gt),i),t?.land(n.strength);for(let e of[i.left,i.right])X(a,`dust`,{x:e.x,y:e.y+11},6,{x:0,y:-80},160+n.strength*200,.6,4)}else t?.crash(),X(a,`dust`,i.rider??q(i),18,{x:0,y:-120},320,.8,5);e.events.length=0,t?.update({speed:$e(e),grounded:e.left.grounded||e.right.grounded,boosting:o,running:e.outcome===`riding`})}return n}function en(e,t,n){let r=e.x*n.zoom+n.x,i=e.y*n.zoom+n.y;return r<Vt||i<Vt||r>t.width-Vt||i>t.height-Vt}function tn(e,t){let n=q(t),r={x:(e.left.velocity.x+e.right.velocity.x)/2,y:(e.left.velocity.y+e.right.velocity.y)/2},i=Math.min(1,Bt/(Math.hypot(r.x,r.y)*zt||1));return{x:n.x+r.x*zt*i,y:n.y+r.y*zt*i}}var nn=e=>Math.round(e/50),rn=e=>Math.round(e/10);function Q(e){let{label:t,value:n,fresh:r}=e;return(0,J.jsxs)(`span`,{className:`flex items-baseline gap-1`,children:[(0,J.jsx)(`span`,{className:`tabular-nums ${r?`font-semibold text-[var(--canvas-selection)]`:`text-[var(--chrome-fg-900)]`}`,children:n}),(0,J.jsx)(`span`,{className:`text-[var(--chrome-fg-500)]`,children:t})]})}function an(e){let{live:t,last:n,best:r,newBest:i,hint:a}=e;return(0,J.jsx)(`div`,{className:`pointer-events-none flex flex-col items-center ${_}`,children:(0,J.jsxs)(`div`,{"data-overlay":!0,"data-ride-hud":!0,onPointerDown:e=>e.stopPropagation(),className:`pointer-events-auto flex h-8 items-center gap-3 rounded-xl px-3 text-[12px] text-[var(--chrome-fg-600)] ${b}`,children:[t&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(Q,{label:`km/h`,value:String(rn(t.speed))}),(0,J.jsx)(Q,{label:`m`,value:String(nn(t.distance))}),(0,J.jsx)(Q,{label:`s air`,value:t.longestAir.toFixed(1)}),(0,J.jsx)(Q,{label:`pts`,value:String(t.score)})]}),!t&&n&&(0,J.jsxs)(J.Fragment,{children:[(i.distance||i.score)&&(0,J.jsx)(`span`,{className:`font-semibold text-[var(--canvas-selection)]`,children:`New best!`}),(0,J.jsx)(Q,{label:`m last`,value:String(nn(n.distance))}),n.score>0&&(0,J.jsx)(Q,{label:`pts`,value:String(n.score)}),(0,J.jsx)(Q,{label:`m best`,value:String(nn(r.distance)),fresh:i.distance}),r.score>0&&(0,J.jsx)(Q,{label:`pts best`,value:String(r.score),fresh:i.score})]}),a&&(0,J.jsx)(`span`,{className:`text-[var(--chrome-fg-500)]`,children:a})]})})}function $(e){let{label:t,title:n,active:r,onClick:i,children:a}=e;return(0,J.jsx)(`button`,{type:`button`,"aria-label":t,"aria-pressed":r,title:n,onClick:i,className:`flex h-9 min-w-9 cursor-pointer touch-none select-none items-center justify-center rounded-lg px-2 transition-colors ${r?`bg-[var(--canvas-selection)]/15 text-[var(--canvas-selection)]`:`text-[var(--chrome-fg-600)] hover:bg-[var(--chrome-hover)] hover:text-[var(--chrome-fg-900)]`}`,children:a})}function on(e){let{inkTool:t,hasDrawings:n,running:r,following:i,muted:a}=e,{onInkTool:o,onResetDrawings:s,onPlay:c,onStop:l}=e,{onFollow:u,onToggleMuted:d,onExit:f,onHelp:p}=e;return(0,J.jsxs)(`div`,{"data-overlay":!0,"data-ride-hud":!0,onPointerDown:e=>e.stopPropagation(),onDoubleClick:e=>e.stopPropagation(),className:`pointer-events-auto absolute bottom-[calc(1rem+env(safe-area-inset-bottom))] left-1/2 flex -translate-x-1/2 items-center gap-1 rounded-xl p-1 ${b}`,children:[(0,J.jsx)($,{label:`Pen`,title:`Pen (P) — ride mode drawings aren't saved`,active:t===`pen`,onClick:()=>o(`pen`),children:(0,J.jsx)(fe,{size:18,stroke:1.75})}),(0,J.jsx)($,{label:`Eraser`,title:`Eraser (E)`,active:t===`eraser`,onClick:()=>o(`eraser`),children:(0,J.jsx)(ue,{size:18,stroke:1.75})}),n&&(0,J.jsx)($,{label:`Reset drawings`,title:`Clear ride drawings and bring back anything erased`,onClick:s,children:(0,J.jsx)(oe,{size:18,stroke:1.75})}),(0,J.jsx)(`span`,{className:`mx-1 h-5 w-px bg-[var(--chrome-ring)]`}),(0,J.jsxs)(`button`,{type:`button`,"data-testid":`ride-play`,"aria-label":r?`Stop`:`Play`,title:r?`Back to the start`:`Play (Space)`,onClick:r?l:c,className:`flex h-9 cursor-pointer items-center gap-1.5 rounded-lg bg-[var(--canvas-selection)] px-3 text-[13px] font-medium text-white transition-opacity hover:opacity-90`,children:[r?(0,J.jsx)(le,{size:14}):(0,J.jsx)(me,{size:14}),r?`Stop`:`Play`]}),r&&!i&&(0,J.jsx)($,{label:`Follow the bike`,title:`Follow the bike`,onClick:u,children:(0,J.jsx)(de,{size:18,stroke:1.75})}),(0,J.jsx)(`span`,{className:`mx-1 h-5 w-px bg-[var(--chrome-ring)]`}),(0,J.jsx)($,{label:a?`Unmute`:`Mute`,title:a?`Sound off`:`Sound on`,onClick:d,children:a?(0,J.jsx)(ye,{size:18,stroke:1.75}):(0,J.jsx)(be,{size:18,stroke:1.75})}),(0,J.jsx)($,{label:`How to play`,title:`How to play (?)`,onClick:p,children:(0,J.jsx)(v,{size:18,stroke:1.75})}),(0,J.jsx)($,{label:`Exit ride mode`,title:`Exit ride mode (Esc)`,onClick:f,children:(0,J.jsx)(pe,{size:18,stroke:1.75})})]})}var sn=(0,E.memo)(on),cn={"←":se,"→":ce,"↑":ie,"↓":ae};function ln(e){let t=cn[e.name];return(0,J.jsx)(`kbd`,{className:`flex h-6 min-w-6 items-center justify-center rounded-md bg-[var(--chrome-hover)] px-1.5 text-[11px] text-[var(--chrome-fg-600)] ring-1 ring-[var(--chrome-ring)]`,children:t?(0,J.jsx)(t,{size:13,stroke:2}):e.name})}var un=[[[[`Space`],`Start playing`],[[`←`,`→`],`Drive`],[[`↑`],`Jump`],[[`R`],`Restart`],[[`B`],`Move bike to cursor`],[[`P`],`Pen`],[[`E`],`Eraser`]],[[[`↓`],`Duck`],[[`Shift`],`Boost`],[[`←`,`→`],`Flip, in the air`],[[`⌘`,`Z`],`Undo a stroke`],[[`?`],`These shortcuts`],[[`Esc`],`Leave ride mode`]]];function dn(){return(0,J.jsxs)(`svg`,{viewBox:`0 0 420 96`,className:`h-24 w-full`,"aria-hidden":!0,children:[(0,J.jsx)(`path`,{d:`M 0 82 L 150 82 Q 250 82 300 40`,fill:`none`,stroke:`var(--canvas-selection)`,strokeWidth:3,strokeLinecap:`round`}),(0,J.jsx)(`g`,{transform:`translate(110 71)`,children:(0,J.jsx)(Ct,{rearSpin:0,frontSpin:0,riding:!0,boosting:!1,ducking:!1})})]})}var fn=(0,E.memo)(function(e){let{open:t,onClose:n}=e;return(0,J.jsx)(C,{open:t,onOpenChange:e=>{e||n()},children:(0,J.jsxs)(x,{children:[(0,J.jsx)(ge,{"data-overlay":!0,className:`fixed inset-0 z-50 bg-gray-900/15`}),(0,J.jsxs)(S,{"data-overlay":!0,"data-testid":`ride-guide`,onKeyDown:e=>{e.stopPropagation(),e.key===`Escape`&&(e.preventDefault(),n())},className:`fixed left-1/2 top-1/2 z-50 flex w-[min(480px,92vw)] overflow-hidden -translate-x-1/2 -translate-y-1/2 flex-col gap-4 rounded-2xl bg-[var(--chrome-popup)] p-5 outline-none ring-1 ring-[var(--chrome-ring)]`,children:[(0,J.jsx)(`div`,{className:`-mx-5 -mt-5 rounded-t-2xl bg-[var(--chrome-hover)] px-5 pt-4`,children:(0,J.jsx)(dn,{})}),(0,J.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,J.jsx)(_e,{className:`text-[15px] font-medium text-[var(--chrome-fg-900)]`,children:`Ride your canvas`}),(0,J.jsx)(T,{className:`text-[13px] leading-relaxed text-[var(--chrome-fg-500)]`,children:`Nothing you draw or erase changes your work.`})]}),(0,J.jsx)(`div`,{className:`grid grid-cols-2 gap-x-6`,children:un.map((e,t)=>(0,J.jsx)(`div`,{className:`flex flex-col gap-2`,children:e.map(([e,t])=>(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-2 text-[13px] text-[var(--chrome-fg-600)]`,children:[(0,J.jsx)(`span`,{children:t}),(0,J.jsx)(`span`,{className:`flex gap-1`,children:e.map(e=>(0,J.jsx)(ln,{name:e},e))})]},t))},t))}),(0,J.jsx)(w,{className:`h-9 w-full cursor-pointer rounded-xl bg-[var(--chrome-fg-900)] text-[13px] font-medium text-[var(--chrome-popup)] outline-none transition-opacity hover:opacity-90 active:scale-[0.99]`,children:`Start Playing`})]})]})})}),pn=new Set([`ArrowLeft`,`KeyA`]),mn=new Set([`ArrowRight`,`KeyD`]),hn=new Set([`ArrowUp`,`KeyW`,`Space`]),gn=new Set([`ShiftLeft`,`ShiftRight`]),_n=new Set([`ArrowDown`,`KeyS`]),vn=new Set([`Equal`,`Minus`,`Digit0`,`Digit1`]);function yn(e){return pn.has(e)?`left`:mn.has(e)?`right`:gn.has(e)?`boost`:_n.has(e)?`duck`:null}function bn(e,t,n){let r=(0,E.useRef)(t);r.current=t;let i=(0,E.useRef)(n);i.current=n,(0,E.useEffect)(()=>{let t=t=>{if(i.current||re(t.target))return;let n=t.metaKey||t.ctrlKey;if(n&&vn.has(t.code)||t.shiftKey&&!n&&t.code===`KeyR`)return;t.stopImmediatePropagation();let a=r.current;if(t.key===`Escape`){t.preventDefault(),a.escape();return}if(n&&t.code===`KeyZ`){t.preventDefault(),a.undo();return}if(!n&&t.code===`KeyP`){a.pickTool(`pen`);return}if(!n&&t.code===`KeyE`){a.pickTool(`eraser`);return}if(!n&&t.code===`KeyB`){a.placeBike();return}if(t.key===`?`){t.preventDefault(),a.help();return}let o=e.bike;if(!n&&t.code===`KeyR`){t.preventDefault(),t.repeat||a.restart();return}if(t.code===`Space`&&!e.running){t.preventDefault(),t.repeat||a.play();return}if(!e.running||!o)return;let s=yn(t.code);if(!(!hn.has(t.code)&&!s)){if(t.preventDefault(),t.repeat||(e.following=!0),s){e.controls[s]=!0;return}t.repeat||pt(o)}},n=t=>{let n=yn(t.code);n&&(e.controls[n]=!1)},a=()=>{e.controls={...Je}};return window.addEventListener(`keydown`,t,!0),window.addEventListener(`keyup`,n,!0),window.addEventListener(`blur`,a),()=>{window.removeEventListener(`keydown`,t,!0),window.removeEventListener(`keyup`,n,!0),window.removeEventListener(`blur`,a)}},[e])}var xn=`koboyo.ride-muted`,Sn=`koboyo.ride-guide-seen`,Cn={smoke:`#adb5bd`,dust:`#b08968`,spark:`#f76707`},wn=`var(--canvas-selection)`,Tn=12,En=50,Dn=3,On=new WeakMap;function kn(e){return e.map((e,t)=>`${t===0?`M`:`L`} ${e.x} ${e.y}`).join(` `)}var An=(0,E.memo)(function(e){let{ink:t,cuts:n,inkWidth:r}=e;return(0,J.jsxs)(J.Fragment,{children:[n.map((e,t)=>(0,J.jsx)(`path`,{d:kn(e.points.length>1?e.points:[e.points[0],e.points[0]]),fill:`none`,stroke:`var(--canvas-bg)`,strokeWidth:e.radius*2,strokeLinecap:`round`,strokeLinejoin:`round`},t)),t.map((e,t)=>(0,J.jsx)(`path`,{"data-testid":`ride-ink`,d:kn(e),fill:`none`,stroke:wn,strokeWidth:r,vectorEffect:`non-scaling-stroke`,strokeLinecap:`round`,strokeLinejoin:`round`},t))]})});function jn(e,t){return e.map((e,n)=>{let r=g(e,t);return`${n===0?`M`:`L`} ${r.x} ${r.y}`}).join(` `)}function Mn(e,t){let n=p(e);return e.type!==`arrow`&&e.type!==`line`?[n]:[n,...ve(e,t)]}function Nn(){let e=i(),t=te(),n=r(e=>e.viewport),s=r(e=>e.shapes),c=(0,E.useRef)(null),[l]=(0,E.useState)(()=>On.get(e)),u=(0,E.useRef)(l?.start??null),[d]=(0,E.useState)($t),f=(0,E.useRef)(null),p=(0,E.useRef)(null),m=(0,E.useRef)(null),h=(0,E.useRef)(0),_=(0,E.useRef)(null),v=(0,E.useRef)([]),[y,ie]=(0,E.useState)(!1),[ae,oe]=(0,E.useState)(!0),se=(0,E.useRef)(ae);se.current=ae;let[ce,le]=(0,E.useState)(null),[ue,de]=(0,E.useState)(l?.best??{distance:0,score:0}),[fe,pe]=(0,E.useState)({distance:!1,score:!1}),me=(0,E.useRef)(ue);me.current=ue;let[b,ge]=(0,E.useState)(()=>he.getString(xn)===`1`),x=(0,E.useMemo)(()=>Ee(s),[s]),[S,C]=(0,E.useState)(()=>({ink:l?.ink??[],cuts:l?.cuts??[],lines:l?Ot(x,l.cuts):x})),{ink:w,cuts:_e}=S,[T,ve]=(0,E.useState)(`pen`),[ye,be]=(0,E.useState)(null),[D,xe]=(0,E.useState)(()=>he.getString(Sn)!==`1`),[,O]=(0,E.useState)(0);(0,E.useEffect)(()=>{C(e=>e.lines===x&&e.cuts.length===0?e:{...e,lines:Ot(x,e.cuts)})},[x]);let k=(0,E.useMemo)(()=>De(S.lines,w),[S.lines,w]),A=(0,E.useRef)(S),Se=(0,E.useRef)(x);Se.current=x,A.current=S;let j=(0,E.useCallback)(()=>{let e=v.current;e.push(A.current),e.length>En&&e.shift()},[]),Ce=(0,E.useRef)(k);Ce.current=k;let M=(0,E.useCallback)(e=>{d.following=e,oe(e)},[d]),we=(0,E.useCallback)(()=>{ge(e=>{let t=!e;return he.setString(xn,t?`1`:`0`),d.setMuted(t),t})},[d]);(0,E.useEffect)(()=>()=>d.close(),[d]),(0,E.useEffect)(()=>()=>{On.set(e,{ink:A.current.ink,cuts:A.current.cuts,start:u.current,best:me.current})},[e]),(0,E.useLayoutEffect)(()=>{let t=c.current;if(!t)return;let n=t.getBoundingClientRect(),r=e.getState().viewport,i=e=>e.x>=0&&e.y>=0&&e.x<=n.width&&e.y<=n.height,a=ne.at&&{x:ne.at.x-n.left,y:ne.at.y-n.top};if(a&&i(a)){u.current=ee(a,r),O(e=>e+1);return}let o=u.current;o&&i(g(o,r))||(u.current=ee({x:n.width*.3,y:n.height*.4},r),O(e=>e+1))},[e]),(0,E.useEffect)(()=>{e.getState().setSelectedIds(new Set)},[e]),(0,E.useEffect)(()=>{let e=e=>{re(e.target)||e.stopImmediatePropagation()};return window.addEventListener(`paste`,e,!0),window.addEventListener(`cut`,e,!0),()=>{window.removeEventListener(`paste`,e,!0),window.removeEventListener(`cut`,e,!0)}},[]);let N=(0,E.useCallback)(()=>{let e=u.current;e&&(d.play(e,b),M(!0),ie(!0),pe({distance:!1,score:!1}))},[d,b,M]),P=(0,E.useCallback)(e=>{if(e){let t=me.current,n={distance:e.distance>t.distance&&t.distance>0,score:e.score>t.score&&t.score>0};le(e),pe(n),de({distance:Math.max(t.distance,e.distance),score:Math.max(t.score,e.score)})}ie(!1)},[]),ke=(0,E.useCallback)(()=>P(d.stop(`stopped`)),[d,P]),Ae=(0,E.useCallback)(()=>{d.running&&P(d.stop(`stopped`)),N()},[d,P,N]),I=(0,E.useCallback)(()=>e.getState().setRideMode(!1),[e]),L=(0,E.useCallback)(()=>{d.running&&P(d.stop(`stopped`)),d.controls={...Je},xe(!0)},[d,P]),je=(0,E.useCallback)(()=>{he.setString(Sn,`1`),xe(!1)},[]);bn(d,{escape:()=>{if(p.current){p.current=null,O(e=>e+1);return}I()},undo:()=>{let e=v.current.pop();e&&C({...e,lines:Ot(Se.current,e.cuts)})},pickTool:ve,placeBike:()=>{let e=_.current;!e||d.running||(u.current=e,O(e=>e+1))},play:N,restart:Ae,help:L},D),(0,E.useEffect)(()=>{let e=c.current?.parentElement;if(!e)return;let t=e=>{e.target instanceof Element&&e.target.closest(`[data-ride-hud]`)||(d.returning=!1,d.running&&d.following&&M(!1))};return e.addEventListener(`pointerdown`,t,!0),e.addEventListener(`wheel`,t,{capture:!0,passive:!0}),()=>{e.removeEventListener(`pointerdown`,t,!0),e.removeEventListener(`wheel`,t,!0)}},[d,M]),(0,E.useEffect)(()=>{let t=0,n=performance.now(),r=i=>{t=requestAnimationFrame(r);let a=(i-n)/1e3;n=i;let o=c.current;if(!o)return;let s=d.tick(a,Ce.current,{width:o.clientWidth,height:o.clientHeight},e.getState().viewport,u.current);if(s.ended){P(s.ended);return}if(d.following&&!se.current&&M(!0),s.camera){e.getState().setViewport(s.camera);return}s.moved&&O(e=>e+1)};return t=requestAnimationFrame(r),()=>cancelAnimationFrame(t)},[d,e,P,M]);let R=t=>{let n=c.current?.getBoundingClientRect();return ee({x:t.clientX-(n?.left??0),y:t.clientY-(n?.top??0)},e.getState().viewport)},Me=(n,r,i)=>{let o=Tn/e.getState().viewport.zoom,s={x:Math.min(n.x,r.x)-o,y:Math.min(n.y,r.y)-o,width:Math.abs(r.x-n.x)+o*2,height:Math.abs(r.y-n.y)+o*2},c=e.getState().shapes.some(e=>Mn(e,t.text).some(e=>a(e,s)));C(e=>{let t=Dt(e.ink,n,r,o);if(!c)return t===e.ink?e:{...e,ink:t};let a=e.cuts[e.cuts.length-1];return{ink:t,cuts:a?.gesture===i?[...e.cuts.slice(0,-1),{...a,points:[...a.points,r]}]:[...e.cuts,{gesture:i,radius:o,points:[n,r]}],lines:Dt(e.lines,n,r,o)}})},Ne=()=>{let e=p.current;if(p.current=null,e&&e.points.length>1){let t=e.points;j(),C(e=>({...e,ink:[...e.ink,t]}))}else O(e=>e+1)},Pe=(0,E.useCallback)(()=>M(!0),[M]),Fe=(0,E.useCallback)(()=>{j(),C({ink:[],cuts:[],lines:Se.current})},[j]),z=u.current,B=d.bike,V=y?d.pose:z?_t(z):null,H=V?q(V):null,U=H?g(H,n):null,Ie=V?Math.atan2(V.right.y-V.left.y,V.right.x-V.left.x):0,Le=V?.rider?g(V.rider,n):null,Re=p.current,ze=y&&B?.outcome===`riding`&&d.controls.boost,Be=Math.max(1.5,3*n.zoom),Ve;return Ve=y?B?.outcome===`crashed`?`Ouch!`:``:k.empty||z&&!Oe(k,z)?`Draw a track under the bike, then press Play`:ce?.outcome===`crashed`?`Crashed! Press Play to go again`:ce?.outcome===`fell`?`Fell off the world. Press Play to go again`:`Drag the bike, or press B to park it under the cursor. Space to play`,(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`div`,{ref:c,"data-testid":`ride-overlay`,className:`absolute inset-0 ${T===`pen`?`cursor-crosshair`:`cursor-none`}`,onPointerDown:e=>{if(e.button!==0)return;e.stopPropagation(),e.currentTarget.setPointerCapture(e.pointerId);let t=R(e);if(T===`pen`)p.current={pointerId:e.pointerId,points:[t]};else{j();let n=++h.current;m.current={pointerId:e.pointerId,last:t,gesture:n},Me(t,t,n)}},onPointerMove:t=>{t.buttons<=1&&t.stopPropagation();let n=R(t);_.current=n,T===`eraser`&&be(n);let r=p.current;if(r&&r.pointerId===t.pointerId){let t=r.points[r.points.length-1],i=Dn/e.getState().viewport.zoom;o(t,n)>=i&&(r.points.push(n),Te(Ce.current,[t,n]),O(e=>e+1))}else m.current?.pointerId===t.pointerId&&(Me(m.current.last,n,m.current.gesture),m.current.last=n)},onPointerUp:e=>{if(p.current?.pointerId===e.pointerId&&Ne(),m.current?.pointerId===e.pointerId){m.current=null;let e=v.current;e[e.length-1]===A.current&&e.pop()}},onPointerCancel:()=>{p.current=null,m.current=null},onPointerLeave:()=>{_.current=null,be(null)},onDoubleClick:e=>e.stopPropagation(),onContextMenu:e=>{e.preventDefault(),e.stopPropagation()},onDragOver:e=>{e.preventDefault(),e.stopPropagation()},onDrop:e=>{e.preventDefault(),e.stopPropagation()},children:[(0,J.jsxs)(`svg`,{className:`pointer-events-none absolute inset-0 h-full w-full`,children:[(0,J.jsxs)(`g`,{transform:`translate(${n.x} ${n.y}) scale(${n.zoom})`,children:[(0,J.jsx)(An,{ink:w,cuts:_e,inkWidth:Be}),Re&&(0,J.jsx)(`path`,{d:kn(Re.points),fill:`none`,stroke:wn,strokeWidth:Be,vectorEffect:`non-scaling-stroke`,strokeLinecap:`round`,strokeLinejoin:`round`})]}),T===`eraser`&&ye&&(0,J.jsx)(`circle`,{cx:g(ye,n).x,cy:g(ye,n).y,r:Tn,fill:`none`,stroke:`var(--chrome-fg-500)`,strokeWidth:1.5}),y&&B&&B.trail.length>1&&(0,J.jsx)(`path`,{d:jn(B.trail,n),fill:`none`,stroke:`#e03131`,strokeOpacity:.3,strokeWidth:Math.max(1.5,3*n.zoom),strokeLinecap:`round`,strokeLinejoin:`round`}),d.particles.map((e,t)=>{let r=g(e,n),i=e.age/e.life,a=e.kind===`smoke`?1+i*2:1;return(0,J.jsx)(`circle`,{cx:r.x,cy:r.y,r:e.size*a*n.zoom,fill:Cn[e.kind],opacity:(1-i)*(e.kind===`smoke`?.45:.8)},t)}),V&&U&&(0,J.jsx)(`g`,{opacity:y?1:.85,transform:`translate(${U.x} ${U.y}) rotate(${Ie*180/Math.PI}) scale(${n.zoom*V.facing} ${n.zoom})`,children:(0,J.jsx)(Ct,{rearSpin:V.facing===1?V.leftSpin:-V.rightSpin,frontSpin:V.facing===1?V.rightSpin:-V.leftSpin,riding:!V.rider,boosting:ze,ducking:V.ducking})}),d.callouts.map((e,t)=>{let r=g(e.at,n),i=e.age/qt;return(0,J.jsx)(`text`,{x:r.x,y:r.y-Xt(e),textAnchor:`middle`,fontSize:16,fontWeight:700,fill:`var(--canvas-selection)`,stroke:`var(--canvas-bg)`,strokeWidth:4,paintOrder:`stroke`,opacity:Math.min(1,(1-i)*2),children:e.text},t)}),V&&Le&&(0,J.jsx)(`g`,{transform:`translate(${Le.x} ${Le.y}) rotate(${V.riderSpin*180/Math.PI}) scale(${n.zoom})`,children:(0,J.jsx)(wt,{})})]}),!y&&U&&(0,J.jsx)(`div`,{"data-ride-hud":!0,"data-testid":`ride-start-handle`,title:`Drag to move the start`,className:`pointer-events-auto absolute cursor-grab touch-none active:cursor-grabbing`,style:{left:U.x-34*n.zoom,top:U.y+(F.y-8)*n.zoom,width:68*n.zoom,height:(11-F.y+8)*n.zoom},onPointerDown:e=>{if(e.stopPropagation(),e.button!==0||!u.current)return;e.currentTarget.setPointerCapture(e.pointerId);let t=R(e);f.current={pointerId:e.pointerId,offset:{x:t.x-u.current.x,y:t.y-u.current.y}}},onPointerMove:e=>{let t=f.current;if(!t||t.pointerId!==e.pointerId)return;e.stopPropagation();let n=R(e);u.current={x:n.x-t.offset.x,y:n.y-t.offset.y},O(e=>e+1)},onPointerUp:()=>{f.current=null},onPointerCancel:()=>{f.current=null},onDoubleClick:e=>e.stopPropagation()}),(0,J.jsx)(an,{live:y&&B?{speed:$e(B),distance:B.distance,longestAir:B.longestAir,score:d.score}:null,last:ce,best:ue,newBest:fe,hint:Ve}),(0,J.jsx)(sn,{inkTool:T,hasDrawings:w.length>0||_e.length>0,running:y,following:ae,muted:b,onInkTool:ve,onResetDrawings:Fe,onPlay:N,onStop:ke,onFollow:Pe,onToggleMuted:we,onExit:I,onHelp:L})]}),(0,J.jsx)(fn,{open:D,onClose:je})]})}export{Nn as RideOverlay};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{t}from"./react-lCSYwAWP.js";import{t as n}from"./jsx-runtime-DKdBMi_L.js";import{a as r}from"./editor-DAJETlQW.js";import{Z as i}from"./style-BENGW2ZV.js";import{A as a,E as o,N as s,j as c}from"./shapes-D5w8NTQQ.js";import{t as l}from"./registry-d5KleeyB.js";var u=e(t(),1);function d(e,t){let n=c(e,t),r=o(e,t),i=s(e)*Math.PI/180;if(!i)return{body:n,footprint:r,toLocal:e=>e,toWorld:e=>e};let l={x:n.x+n.width/2,y:n.y+n.height/2};return{body:n,footprint:r,toLocal:e=>a(e,l,-i),toWorld:e=>a(e,l,i)}}function f(e,t,n){let r=d(e,n);return i(r.toLocal(t),r.footprint)}function p(e){function t(){document.hidden&&e()}return window.addEventListener(`blur`,e),document.addEventListener(`visibilitychange`,t),()=>{window.removeEventListener(`blur`,e),document.removeEventListener(`visibilitychange`,t)}}var m=n(),h=`coarse:before:absolute coarse:before:-inset-[18px] coarse:before:content-['']`,g=[{handle:`nw`,cursor:`nwse-resize`},{handle:`ne`,cursor:`nesw-resize`},{handle:`sw`,cursor:`nesw-resize`},{handle:`se`,cursor:`nwse-resize`}],_=[{handle:`n`,cursor:`ns-resize`},{handle:`w`,cursor:`ew-resize`},{handle:`e`,cursor:`ew-resize`},{handle:`s`,cursor:`ns-resize`}],v=[{handle:`n`,cursor:`ns-resize`},{handle:`w`,cursor:`ew-resize`},{handle:`e`,cursor:`ew-resize`},{handle:`s`,cursor:`ns-resize`}],y=_.filter(e=>e.handle===`w`||e.handle===`e`),b=_.filter(e=>e.handle===`n`||e.handle===`s`);function x(e){if(e.type!==`control`)return{edges:e.type===`text`?v:_,corners:g};switch(l[e.kind].resize){case`width`:return{edges:y,corners:[]};case`height`:return{edges:b,corners:[]};case`aspect`:return{edges:[],corners:g};default:return{edges:_,corners:g}}}function S(e,t,n,r=0){let i=t/2;e.includes(`w`)?i=-r:e.includes(`e`)&&(i=t+r);let a=n/2;return e.includes(`n`)?a=-r:e.includes(`s`)&&(a=n+r),{x:i,y:a}}function C(e,t){if(e.type===`text`){let n=t?.textBounds(e.id);if(n)return{x:e.x,y:e.y,width:n.width,height:n.height}}return e.type===`icon`?o(e,t):c(e,t)}function w(e,t,n,r){let i=c(e,r);return{x:(i.x+i.width/2-t.x)*n,y:(i.y+i.height/2-t.y)*n}}function T(e,t){let n=C(e,t);return[{x:n.x,y:n.y},{x:n.x+n.width,y:n.y},{x:n.x+n.width,y:n.y+n.height},{x:n.x,y:n.y+n.height}].map(d(e,t).toWorld).reduce((e,t)=>t.y<e.y-.5||Math.abs(t.y-e.y)<=.5&&t.x<e.x?t:e)}var E=[`ew-resize`,`nwse-resize`,`ns-resize`,`nesw-resize`],D={e:0,se:45,s:90,sw:135,w:180,nw:225,n:270,ne:315};function O(e,t){let n=(((D[e]??0)+t)%180+180)%180;return E[Math.round(n/45)%4]}function k(e){let t=r().measurement,[n,i]=(0,u.useState)(()=>C(e,t));return(0,u.useLayoutEffect)(()=>{let n=C(e,t);i(e=>e.x===n.x&&e.y===n.y&&e.width===n.width&&e.height===n.height?e:n)},[e,t]),n}var A=15;function j(e,t){return t===void 0?0:Math.max(0,t-(e-A/2))}function M(e){let{position:t,cursor:n,round:r,testId:i,minHitTop:a,onPointerDown:o,onDoubleClick:s}=e,c=j(t.y,a),l=a===void 0?void 0:Math.min(0,Math.max(-15,a-(t.y+c-A/2)));return(0,m.jsx)(`div`,{"data-testid":i,onPointerDown:o,onDoubleClick:s?e=>{e.stopPropagation(),s()}:void 0,className:`absolute flex h-[15px] w-[15px] -translate-x-1/2 -translate-y-1/2 items-center justify-center coarse:before:absolute coarse:before:-inset-[15px] coarse:before:top-[var(--handle-touch-top,-15px)] coarse:before:content-['']`,style:{left:t.x,top:t.y+c,cursor:n,pointerEvents:`all`,...l===void 0?{}:{"--handle-touch-top":`${l}px`}},children:(0,m.jsx)(`div`,{className:`pointer-events-none h-[9px] w-[9px] border border-[var(--canvas-selection)] bg-white ${r?`rounded-full`:`rounded-[2px]`}`,style:c?{translate:`0 ${-c}px`}:void 0})})}function N(e){let{position:t,onPointerDown:n}=e;return(0,m.jsxs)(`div`,{"data-testid":`sticky-duplicate`,onPointerDown:n,className:`group absolute flex h-[22px] w-[22px] -translate-x-1/2 -translate-y-1/2 items-center justify-center`,style:{left:t.x,top:t.y,cursor:`grab`,pointerEvents:`all`},children:[(0,m.jsx)(`div`,{className:`absolute inset-0 rounded-full bg-[var(--canvas-selection)]/25 opacity-0 transition-opacity group-hover:opacity-100`}),(0,m.jsx)(`div`,{className:`h-[7px] w-[7px] rounded-full bg-[var(--canvas-selection)]`})]})}var P=7,F=10,I=10,L=8,R=12,z=8;function B(){return typeof window<`u`&&window.matchMedia(`(pointer: coarse)`).matches}function V(e){return e?B()?{inward:0,outward:R}:{inward:0,outward:L}:B()?{inward:F,outward:I}:{inward:3,outward:P}}function H(e,t){let n=V(e);if(t===void 0||n.outward<=t)return n;let r=Math.max(0,t);return{inward:n.inward+n.outward-r,outward:r}}function U(e){return 4*e}function W(e){let{edge:t,cursor:n,testId:r,along:i,across:a,inset:o,outwardLimit:s,onPointerDown:c}=e,l=o??(i<24?0:z),{inward:u,outward:d}=H(a<24,s);return(0,m.jsx)(`div`,{"data-testid":r,onPointerDown:c,className:`absolute`,style:{...t===`w`||t===`e`?{top:l,bottom:l,width:u+d,[t===`w`?`left`:`right`]:-d}:{left:l,right:l,height:u+d,[t===`n`?`top`:`bottom`]:-d},cursor:n,pointerEvents:`all`}})}function G(){return B()?20:14}var K=`url("data:image/svg+xml,%3Csvg%20xmlns%3D'http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg'%20width%3D'24'%20height%3D'24'%20viewBox%3D'0%200%2024%2024'%20fill%3D'none'%20stroke-linecap%3D'round'%20stroke-linejoin%3D'round'%3E%3Cg%20stroke%3D'white'%20stroke-width%3D'4'%3E%3Cpolyline%20points%3D'23%204%2023%2010%2017%2010'%2F%3E%3Cpath%20d%3D'M20.49%2015a9%209%200%201%201-2.12-9.36L23%2010'%2F%3E%3C%2Fg%3E%3Cg%20stroke%3D'black'%20stroke-width%3D'2'%3E%3Cpolyline%20points%3D'23%204%2023%2010%2017%2010'%2F%3E%3Cpath%20d%3D'M20.49%2015a9%209%200%201%201-2.12-9.36L23%2010'%2F%3E%3C%2Fg%3E%3C%2Fsvg%3E") 12 12, grabbing`;function q(e){let{position:t,onPointerDown:n,testId:r}=e;return(0,m.jsx)(`div`,{"data-testid":r,onPointerDown:n,className:`absolute h-[9px] w-[9px] -translate-x-1/2 -translate-y-1/2 rounded-full border border-[var(--canvas-selection)] bg-white ${h}`,style:{left:t.x,top:t.y,cursor:K,pointerEvents:`all`}})}export{p as _,M as a,x as c,w as d,U as f,C as g,k as h,W as i,S as l,O as m,_ as n,q as o,T as p,N as r,h as s,g as t,G as u,f as v,d as y};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{$ as e,ot as t}from"./shapes-D5w8NTQQ.js";function n(n){let r=n.type===`text`?n.text:`label`in n&&typeof n.label==`string`?n.label:`text`in n&&typeof n.text==`string`?n.text:``;return e(r)?t(r):r}function r(e){return e.type===`rectangle`?e.kind:e.type===`figure`?`frame`:e.type===`web`?e.kind===`html`?`widget`:`embed`:e.type}var i=34;function a(e){let t=n(e).replace(/\s+/g,` `).trim();return t?t.length>i?`${t.slice(0,i-1)}…`:t:e.type===`icon`&&e.name?o(e.name):o(r(e))}function o(e){let t=e.replace(/[-_]+/g,` `).trim();return t.charAt(0).toUpperCase()+t.slice(1)}export{n,a as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{t}from"./react-lCSYwAWP.js";import{i as n}from"./config-D8b1QyEk.js";var r=e(t(),1);function i(){let e=n(),t=e.widgetOrigin,i=e.embed!==void 0,a=e.publicShare===!0;return(0,r.useMemo)(()=>({widgetOrigin:t,embedded:i,clickToRun:a}),[t,i,a])}var a=.32;function o(e,t){return t?e*a:e}function s(e,t){return{onPointerEnter:()=>t(e),onPointerLeave:()=>t(null)}}function c(e,t){e.key===`Escape`&&(e.stopPropagation(),t(),e.currentTarget.blur())}function l(e,t){(0,r.useEffect)(()=>{if(!t)return;let n=e.current;if(!n)return;let r=requestAnimationFrame(()=>{n.focus();let e=window.getSelection();if(e){let t=document.createRange();t.selectNodeContents(n),e.removeAllRanges(),e.addRange(t)}});return()=>cancelAnimationFrame(r)},[e,t])}export{i as a,l as i,o as n,s as r,c as t};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import{F as e,G as t,J as n,M as r,P as i,W as a,X as o,a as s,et as c,nt as l,q as u,rt as d,s as f,st as p,tt as m}from"./style-BENGW2ZV.js";function h(e){return 9+e*2.2}var g={arrow:.84,sweep:.88,triangle:1,triangleOutline:1,diamond:1,diamondOutline:1,circle:.8,circleOutline:.8,bar:0,cross:.69,crowOne:.55,crowOnlyOne:.9,crowMany:1,crowOneOrMany:1.3,crowZeroOrOne:1.3,crowZeroOrMany:1.7},_=.5,v=.32;function y(e,t,n,r=1/0){let i=Math.max(g[t],_);return Math.min(e,n*v/i,r/i)}var b=36,x=10.5,S=1.5,ee=3;function C(e){return{minX:e.x,minY:e.y,maxX:e.x+e.width,maxY:e.y+e.height}}function w(e,t){return{minX:e.minX-t,minY:e.minY-t,maxX:e.maxX+t,maxY:e.maxY+t}}function T(e,t){return{minX:Math.min(e.minX,t.minX),minY:Math.min(e.minY,t.minY),maxX:Math.max(e.maxX,t.maxX),maxY:Math.max(e.maxY,t.maxY)}}function E(e){return{x:(e.minX+e.maxX)/2,y:(e.minY+e.maxY)/2}}function D(e,t,n=0){return t.x>=e.minX-n&&t.x<=e.maxX+n&&t.y>=e.minY-n&&t.y<=e.maxY+n}function O(e,t){return e>=t.min&&e<=t.max}function k(e){return e.max-e.min}function A(e,t){return t.min<=e.min&&e.max<=t.max?[]:e.min<=t.min&&t.max<=e.max?[{min:e.min,max:t.min},{min:t.max,max:e.max}]:t.max<=e.min||t.min>=e.max?[e]:O(e.min,t)?[{min:t.max,max:e.max}]:[{min:e.min,max:t.min}]}function j(e,t,n){return e+(t-e)*n}var te=[`right`,`bottom`,`left`,`top`],ne={top:{sign:-1,main:`minY`,far:`maxY`,crossLo:`minX`,crossHi:`maxX`,crossAxis:`x`},bottom:{sign:1,main:`maxY`,far:`minY`,crossLo:`minX`,crossHi:`maxX`,crossAxis:`x`},left:{sign:-1,main:`minX`,far:`maxX`,crossLo:`minY`,crossHi:`maxY`,crossAxis:`y`},right:{sign:1,main:`maxX`,far:`minX`,crossLo:`minY`,crossHi:`maxY`,crossAxis:`y`}};function re(e,t,n){let r=ne[n],i=e.box[r.main],a=e.isPoint?null:i+r.sign*b,o={min:e.box[r.crossLo],max:e.box[r.crossHi]},s={min:Math.min(t.box[r.main],t.box[r.far]),max:Math.max(t.box[r.main],t.box[r.far])};t.isPoint||(r.sign>0?s.min-=x*2:s.max+=x*2);let c={min:t.box[r.crossLo]-b,max:t.box[r.crossHi]+b};if(O(i,s)&&!e.isPoint&&!t.isPoint){let e=A(o,c);if(e.length===0)return null;o=e.length===2&&k(e[1])>k(e[0])?e[1]:e[0]}let l=e.target[r.crossAxis];return O(l,o)?{value:i,expanded:a,cross:o,crossTarget:l}:null}function ie(e,t){return{top:re(e,t,`top`),right:re(e,t,`right`),bottom:re(e,t,`bottom`),left:re(e,t,`left`)}}function ae(e,t){return t===null?!!(e.top||e.right||e.bottom||e.left):!!e[t]}function oe(e){return e.isPoint?e:{box:{minX:e.target.x,minY:e.target.y,maxX:e.target.x,maxY:e.target.y},target:e.target,gap:0,minEnd:e.minEnd,side:null,isPoint:!0}}var se={sx:1,sy:1,swap:!1},ce={sx:1,sy:-1,swap:!1},le={sx:-1,sy:1,swap:!0},ue={sx:-1,sy:-1,swap:!1},de={sx:1,sy:-1,swap:!0};function fe(e,t){let n=e.sx*t.x,r=e.sy*t.y;return e.swap?{x:r,y:n}:{x:n,y:r}}function pe(e,t){let n=e.swap?t.y:t.x,r=e.swap?t.x:t.y;return{x:e.sx*n,y:e.sy*r}}function M(e,t){if(e.sx===-1){let e=t.minX;t.minX=-t.maxX,t.maxX=-e}if(e.sy===-1){let e=t.minY;t.minY=-t.maxY,t.maxY=-e}if(e.swap){let e=t.minX;t.minX=t.minY,t.minY=e,e=t.maxX,t.maxX=t.maxY,t.maxY=e}}function me(e){e&&(e.value=-e.value,e.expanded=e.expanded===null?null:-e.expanded)}function he(e){if(!e)return;let t=e.cross.min;e.cross.min=-e.cross.max,e.cross.max=-t,e.crossTarget=-e.crossTarget}function ge(e,t){if(e.sx===-1){let e=t.left;t.left=t.right,t.right=e,me(t.left),me(t.right),he(t.top),he(t.bottom)}if(e.sy===-1){let e=t.top;t.top=t.bottom,t.bottom=e,me(t.top),me(t.bottom),he(t.left),he(t.right)}if(e.swap){let e=t.left;t.left=t.top,t.top=e,e=t.right,t.right=t.bottom,t.bottom=e}}function _e(e,t){if(M(t,e.a.box),M(t,e.a.grown),M(t,e.b.box),M(t,e.b.grown),M(t,e.common.box),M(t,e.common.grown),ge(t,e.a.edges),ge(t,e.b.edges),e.bias=fe(t,e.bias),t.sx===-1&&(e.gapX=-e.gapX,e.midX=e.midX===null?null:-e.midX),t.sy===-1&&(e.gapY=-e.gapY,e.midY=e.midY===null?null:-e.midY),t.swap){let t=e.gapX;e.gapX=e.gapY,e.gapY=t,t=e.midX,e.midX=e.midY,e.midY=t}}function ve(e,t){_e(e,t),e.applied.push(t)}function ye(e){return e.swap?{sx:e.sy,sy:e.sx,swap:!0}:e}function be(e){for(;e.applied.length>0;){let t=e.applied.pop();t&&_e(e,ye(t))}}function xe(e,t,n){let r={x:t,y:n};for(let t=e.applied.length-1;t>=0;--t)r=pe(e.applied[t],r);return r}var N=.01,P=class{work;pts=[];mid=null;constructor(e){this.work=e}to(e,t){return this.pts.push(xe(this.work,e,t)),this}tagMid(e){let t=this.pts[this.pts.length-2],n=this.pts[this.pts.length-1],r=0;for(let e of this.work.applied)e.swap&&(r+=1);return this.mid={x:(t.x+n.x)/2,y:(t.y+n.y)/2,axis:r%2==1?e===`x`?`y`:`x`:e,span:Math.abs(t.x-n.x)+Math.abs(t.y-n.y)},this}done(){let e=Be(this.pts),t=0;for(let n=0;n<e.length-1;n+=1)t+=Math.abs(e[n+1].x-e[n].x)+Math.abs(e[n+1].y-e[n].y);return{points:e,dist:t,mid:this.mid}}};function Se(e){let t=e.a.edges.right,n=e.b.edges.left;if(!t||!n||t.crossTarget>n.crossTarget&&(ve(e,ce),t=e.a.edges.right,n=e.b.edges.left,!t||!n))return null;if(e.gapX>0&&e.midX!==null)return new P(e).to(t.value,t.crossTarget).to(e.midX,t.crossTarget).to(e.midX,n.crossTarget).tagMid(`x`).to(n.value,n.crossTarget).done();if(t.expanded===null||n.expanded===null)return null;if(e.midY!==null)return new P(e).to(t.value,t.crossTarget).to(t.expanded,t.crossTarget).to(t.expanded,e.midY).to(n.expanded,e.midY).tagMid(`y`).to(n.expanded,n.crossTarget).to(n.value,n.crossTarget).done();let r=Math.abs(t.value-e.common.grown.maxX)+Math.abs(t.crossTarget-e.common.grown.maxY)+Math.abs(e.common.grown.maxX-n.expanded)+Math.abs(e.common.grown.maxY-n.crossTarget)+b+6,i=b+Math.abs(t.crossTarget-e.common.grown.minY)+Math.abs(t.expanded-e.common.grown.minX)+Math.abs(e.common.grown.minY-n.crossTarget)+Math.abs(e.common.grown.minX-n.value)+6+e.bias.y,a=e.gapX<0&&e.midX!==null?b+Math.abs(t.crossTarget-e.a.grown.maxY)+(e.common.grown.maxX-e.common.grown.minX)+Math.abs(e.a.grown.maxY-e.b.grown.minY)+Math.abs(e.b.grown.minY-n.crossTarget)+b+8:1/0;return r<i&&r<a?new P(e).to(t.value,t.crossTarget).to(e.common.grown.maxX,t.crossTarget).to(e.common.grown.maxX,e.common.grown.maxY).to(n.expanded,e.common.grown.maxY).to(n.expanded,n.crossTarget).to(n.value,n.crossTarget).done():i<a?new P(e).to(t.value,t.crossTarget).to(t.expanded,t.crossTarget).to(t.expanded,e.common.grown.minY).to(e.common.grown.minX,e.common.grown.minY).to(e.common.grown.minX,n.crossTarget).to(n.value,n.crossTarget).done():e.midX===null?null:new P(e).to(t.value,t.crossTarget).to(t.expanded,t.crossTarget).to(t.expanded,e.a.grown.maxY).to(e.midX,e.a.grown.maxY).to(e.midX,e.b.grown.minY).tagMid(`y`).to(n.expanded,e.b.grown.minY).to(n.expanded,n.crossTarget).to(n.value,n.crossTarget).done()}function Ce(e){let t=e.a.edges.right,n=e.b.edges.top;if(!t||!n)return null;if(t.crossTarget<(n.expanded??n.value)&&n.crossTarget>(t.expanded??t.value)||e.a.isPoint&&D(e.b.grown,E(e.a.box)))return new P(e).to(t.value,t.crossTarget).to(n.crossTarget,t.crossTarget).to(n.crossTarget,n.value).done();if(e.gapX>0&&e.midX!==null&&n.expanded!==null)return new P(e).to(t.value,t.crossTarget).to(e.midX,t.crossTarget).to(e.midX,n.expanded).tagMid(`x`).to(n.crossTarget,n.expanded).to(n.crossTarget,n.value).done();if(e.gapY>0&&t.expanded!==null&&n.crossTarget<t.expanded&&e.midY!==null)return new P(e).to(t.value,t.crossTarget).to(t.expanded,t.crossTarget).to(t.expanded,e.midY).to(n.crossTarget,e.midY).tagMid(`y`).to(n.crossTarget,n.value).done();let r=Math.abs(t.value-e.common.grown.maxX)+Math.abs(t.crossTarget-e.common.grown.minY)+Math.abs(n.crossTarget-e.common.grown.maxX)+Math.abs(n.value-e.common.grown.minY),i=t.expanded!==null&&e.midY!==null&&n.expanded!==null?Math.abs(t.value-t.expanded)+Math.abs(e.b.grown.minX-t.expanded)+Math.abs(e.b.grown.minX-n.crossTarget)+Math.abs(t.crossTarget-e.b.grown.minY)+Math.abs(n.value-n.expanded):1/0,a=t.expanded!==null&&e.midX!==null&&n.expanded!==null?Math.abs(t.value-e.common.grown.maxX)+Math.abs(t.crossTarget-e.a.grown.maxY)+Math.abs(t.expanded-n.crossTarget)+Math.abs(e.a.grown.maxY-n.expanded)+Math.abs(n.expanded-n.value):1/0;return r<i&&r<a?new P(e).to(t.value,t.crossTarget).to(e.common.grown.maxX,t.crossTarget).to(e.common.grown.maxX,e.common.grown.minY).to(n.crossTarget,e.common.grown.minY).to(n.crossTarget,n.value).done():n.expanded!==null&&t.expanded!==null&&e.midY!==null&&i<a?new P(e).to(t.value,t.crossTarget).to(t.expanded,t.crossTarget).to(t.expanded,e.midY).to(e.b.grown.minX,e.midY).tagMid(`y`).to(e.b.grown.minX,n.expanded).to(n.crossTarget,n.expanded).to(n.crossTarget,n.value).done():n.expanded!==null&&t.expanded!==null&&e.midX!==null?new P(e).to(t.value,t.crossTarget).to(t.expanded,t.crossTarget).to(t.expanded,e.a.grown.maxY).to(e.midX,e.a.grown.maxY).to(e.midX,n.expanded).tagMid(`x`).to(n.crossTarget,n.expanded).to(n.crossTarget,n.value).done():null}function we(e){return ve(e,ce),Ce(e)}function Te(e){let t=e.a.edges.right,n=e.b.edges.right;if(!t||!n)return null;if((e.gapX<=0||t.crossTarget>e.b.grown.maxY||t.crossTarget<e.b.grown.minY)&&(n.value>e.a.box.minX||n.crossTarget>e.a.grown.maxY||n.crossTarget<e.a.grown.minY))return new P(e).to(t.value,t.crossTarget).to(e.common.grown.maxX,t.crossTarget).to(e.common.grown.maxX,n.crossTarget).to(n.value,n.crossTarget).done();if(e.midX===null)return null;if(n.expanded!==null&&e.gapX>=0){let r=Math.abs(n.crossTarget-e.b.grown.maxY)+Math.abs(t.crossTarget-e.b.grown.maxY)<Math.abs(n.crossTarget-e.b.grown.minY)+Math.abs(t.crossTarget-e.b.grown.minY)?e.b.grown.maxY:e.b.grown.minY;return new P(e).to(t.value,t.crossTarget).to(e.midX,t.crossTarget).to(e.midX,r).tagMid(`x`).to(n.expanded,r).to(n.expanded,n.crossTarget).to(n.value,n.crossTarget).done()}if(t.expanded!==null&&e.gapX<=0){let r=Math.abs(n.crossTarget-e.a.grown.maxY)+Math.abs(t.crossTarget-e.a.grown.maxY)<Math.abs(n.crossTarget-e.a.grown.minY)+Math.abs(t.crossTarget-e.a.grown.minY)?e.a.grown.maxY:e.a.grown.minY;return new P(e).to(t.value,t.crossTarget).to(t.expanded,t.crossTarget).to(t.expanded,r).to(e.midX,r).to(e.midX,n.crossTarget).tagMid(`x`).to(n.value,n.crossTarget).done()}return null}var Ee={top:{top:[de,Te],left:[de,Ce],bottom:[de,Se],right:[de,we]},right:{top:[se,Ce],right:[se,Te],bottom:[se,we],left:[se,Se]},bottom:{top:[le,Se],left:[le,we],bottom:[le,Te],right:[le,Ce]},left:{top:[ue,we],left:[ue,Te],bottom:[ue,Ce],right:[ue,Se]}};function F(e,t,n){let[r,i]=Ee[t][n];ve(e,r);let a=i(e);return be(e),a}function De(e,t){let n=null,r=1/0,i=1/0,a=0;for(let[o,s]of t){a+=1;let t=F(e,o,s);t&&(t.points.length<r?(r=t.points.length,i=t.dist,n=t):t.points.length===r&&t.dist+a<i&&(i=t.dist,n=t))}return n}function Oe(e,t){let n=e.a.edges[t];if(!n)return;let r=n.expanded??n.value,i=e=>t===`right`?r<=e:r>=e,a=e.b.edges.top;if(a&&i(a.crossTarget)&&n.crossTarget<=(a.expanded??a.value))return F(e,t,`top`);let o=e.b.edges.bottom;if(o&&i(o.crossTarget)&&n.crossTarget>=(o.expanded??o.value))return F(e,t,`bottom`)}function ke(e){let t=null;if(Math.abs(e.gapX)+1>Math.abs(e.gapY)&&e.midX!==null)t=e.gapX>0?F(e,`right`,`left`):F(e,`left`,`right`);else if(e.a.isPoint&&e.b.isPoint)t=e.gapY>0?F(e,`bottom`,`top`):F(e,`top`,`bottom`);else{let n=Oe(e,`right`);n===void 0&&(n=Oe(e,`left`)),n===void 0?e.gapY>0&&e.midY!==null?t=F(e,`bottom`,`top`):e.gapY<0&&e.midY!==null&&(t=F(e,`top`,`bottom`)):t=n}if(t)return t;let n=te.filter(t=>e.a.edges[t]),r=te.filter(t=>e.b.edges[t]);return De(e,n.flatMap(e=>r.map(t=>[e,t])))}function Ae(e,t){let n=null;return t===`right`?n=e.gapX>0&&e.gapX>Math.abs(e.gapY)&&e.midX!==null?F(e,`right`,`left`):Oe(e,`right`)??null:t===`left`&&(n=e.gapX<0&&Math.abs(e.gapX)>Math.abs(e.gapY)&&e.midX!==null?F(e,`left`,`right`):Oe(e,`left`)??null),n||De(e,{top:[`bottom`,`right`,`left`,`top`],bottom:[`top`,`right`,`left`,`bottom`],left:[`right`,`bottom`,`left`,`top`],right:[`left`,`bottom`,`right`,`top`]}[t].map(e=>[t,e]))}var I={top:`bottom`,bottom:`top`,left:`right`,right:`left`};function je(e,t,n){return F(e,t,n)||(e.a.isPoint&&e.b.isPoint?De(e,[[I[t],I[n]],[t,I[n]],[I[t],n]]):e.a.isPoint?F(e,I[t],n):e.b.isPoint?F(e,t,I[n]):null)}function Me(e,t,n){if(n.isPoint||n.gap<=0||e.length<2)return;let r=t?e[0]:e[e.length-1],i=t?e[1]:e[e.length-2],o=a(Math.abs(r.x-i.x)+Math.abs(r.y-i.y)-n.minEnd,0,n.gap);if(o<=0)return;let s=Math.sign(i.x-r.x),c=Math.sign(i.y-r.y);r.x+=s*o,r.y+=c*o}function Ne(e,t,n){if(!n.outline||!n.side||n.isPoint||e.length<2)return;let r=t?e[0]:e[e.length-1],i=t?e[1]:e[e.length-2];if(n.side===`left`||n.side===`right`){if(Math.abs(r.y-i.y)>N)return;r.x=n.outline(r.y)}else{if(Math.abs(r.x-i.x)>N)return;r.y=n.outline(r.x)}}function Pe(e,t,n){if(e.length<3)return;let r=t?e[0]:e[e.length-1],i=t?e[1]:e[e.length-2];if(!(Math.abs(r.x-i.x)+Math.abs(r.y-i.y)>=n)&&(e.splice(t?1:e.length-2,1),e.length>=3)){let n=t?e[1]:e[e.length-2];Math.abs(r.x-i.x)<N?n.y=r.y:n.x=r.x}}function Fe(e,t){let n=t.box.minX-e.box.maxX;n<0&&(n=-Math.max(0,e.box.minX-t.box.maxX));let r=t.box.minY-e.box.maxY;return r<0&&(r=-Math.max(0,e.box.minY-t.box.maxY)),{gapX:n,gapY:r}}var Ie={x:{lo:`minX`,hi:`maxX`},y:{lo:`minY`,hi:`maxY`}};function Le(e,t,n,r,i,a,o,s,c){let{lo:l,hi:u}=Ie[e];return t>n?{a:r.isPoint?r.box[u]+s:a[u],b:i.isPoint?i.box[l]-c:o[l]}:t<-n?{a:r.isPoint?r.box[l]-s:a[l],b:i.isPoint?i.box[u]+c:o[u]}:null}function Re(e,t,n,r){if(!e||e.points.length<2)return null;let i=e.points;return Ne(i,!0,t),Ne(i,!1,n),Me(i,!0,t),Me(i,!1,n),Pe(i,!0,t.minEnd),Pe(i,!1,n.minEnd),r&&i.reverse(),i}function ze(e,t,n){let r={box:C(e.bounds),target:{x:e.target.x,y:e.target.y},gap:e.gap,minEnd:e.minEnd,side:e.side,outline:e.outline,isPoint:e.isPoint},i={box:C(t.bounds),target:{x:t.target.x,y:t.target.y},gap:t.gap,minEnd:t.minEnd,side:t.side,outline:t.outline,isPoint:t.isPoint},a=!r.side&&!!i.side,o=a?i:r,s=a?r:i,c=ie(o,s),l=ie(s,o);(!ae(c,o.side)||!ae(l,s.side))&&(ae(c,o.side)||(s=oe(s)),ae(l,s.side)||(o=oe(o)),D(s.box,o.target,b)&&(s=oe(s)),D(o.box,s.target,b)&&(o=oe(o)),c=ie(o,s),l=ie(s,o));let u=o.isPoint?o.box:w(o.box,b),d=s.isPoint?s.box:w(s.box,b),{gapX:f,gapY:p}=Fe(o,s),m=o.minEnd*ee,h=s.minEnd*ee,g=(o.isPoint?m:x)+(s.isPoint?h:x),_=Le(`x`,f,g,o,s,u,d,m,h),v=Le(`y`,p,g,o,s,u,d,m,h),y=a?1-n:n,S=_?j(_.a,_.b,y):null,E=v?j(v.a,v.b,y):null,O={a:{box:o.box,grown:u,edges:c,isPoint:o.isPoint},b:{box:s.box,grown:d,edges:l,isPoint:s.isPoint},common:{box:T(o.box,s.box),grown:T(u,d)},gapX:f,gapY:p,midX:S,midY:E,bias:{x:1,y:1},applied:[]},k=null;return o.side&&s.side?k=je(O,o.side,s.side):o.side&&(k=Ae(O,o.side)),k||=ke(O),{route:Re(k,o,s,a),midHandle:k?.mid??null,midXRange:_?a?{lo:_.b,hi:_.a}:{lo:_.a,hi:_.b}:null,midYRange:v?a?{lo:v.b,hi:v.a}:{lo:v.a,hi:v.b}:null}}function Be(e){let t=[];for(let n of e){let e=t[t.length-1],r=t[t.length-2];if(!e){t.push({x:n.x,y:n.y});continue}let i=Math.abs(n.x-e.x)<N,a=Math.abs(n.y-e.y)<N;if(!(i&&a)){if(r&&i&&Math.abs(n.x-r.x)<N){e.y=n.y;continue}if(r&&a&&Math.abs(n.y-r.y)<N){e.x=n.x;continue}t.push({x:n.x,y:n.y})}}return t}function Ve(e,t,n,r){if(n.isPoint)return Math.sign(e-r)===t?r:null;let i=r+t*n.gap;return Math.sign(e-i)===t?i:Math.sign(e-r)===t&&Math.abs(e-r)>N?r+(e-r)/2:null}function He(e,t,n){let r=n?e[0]:e[e.length-1],i=n?e[1]:e[e.length-2],a=Math.abs(i.y-r.y)<=N;if(a===Math.abs(i.x-r.x)<=N||t.side&&(t.side===`left`||t.side===`right`)!==a)return!1;if(a){let e=Math.sign(i.x-r.x),n=Ve(i.x,e,t,!t.isPoint&&t.outline?t.outline(t.target.y):t.isPoint?t.target.x:e>0?t.bounds.x+t.bounds.width:t.bounds.x);return n===null?!1:(r.x=n,r.y=t.target.y,i.y=t.target.y,!0)}let o=Math.sign(i.y-r.y),s=Ve(i.y,o,t,!t.isPoint&&t.outline?t.outline(t.target.x):t.isPoint?t.target.y:o>0?t.bounds.y+t.bounds.height:t.bounds.y);return s===null?!1:(r.y=s,r.x=t.target.x,i.x=t.target.x,!0)}function Ue(e,t,n){if(e.length<3)return null;let r=e.map(e=>({x:e.x,y:e.y}));if(!He(r,t,!0)||!He(r,n,!1))return null;let i=Be(r);if(i.length<3)return null;for(let e=0;e<i.length-1;e+=1)if(Math.abs(i[e+1].x-i[e].x)>N&&Math.abs(i[e+1].y-i[e].y)>N)return null;return i}function We(e,t,n){if(e.length<2||t<0||t>e.length-2)return null;let r=e.map(e=>({x:e.x,y:e.y})),i=r[t],a=r[t+1],o=a.x-i.x,s=a.y-i.y,c=Math.abs(s)<=Math.abs(o),l=Math.abs(c?o:s);if(l<N)return null;let u=Math.min(b,l/2);if(t===e.length-2){let e=r[r.length-1],t=c?{x:e.x-Math.sign(o)*u,y:e.y}:{x:e.x,y:e.y-Math.sign(s)*u};r.splice(r.length-1,0,{...t},{...t})}let d=t;if(t===0){let e=r[0],t=c?{x:e.x+Math.sign(o)*u,y:e.y}:{x:e.x,y:e.y+Math.sign(s)*u};r.splice(1,0,{...t},{...t}),d=2}let f=r[d],p=r[d+1];c?(f.y=n,p.y=n):(f.x=n,p.x=n);let m=Be(r);return m.length<2?null:m}function Ge(e,t){return{bounds:{x:e.x,y:e.y,width:0,height:0},target:{x:e.x,y:e.y},gap:0,minEnd:t*S,side:null,isPoint:!0}}var Ke=18,qe=.58,Je=.15,Ye=.16,Xe=.5,Ze=.68;function Qe(e,t,n){let r={x:-Math.sin(t),y:Math.cos(t)},i=r=>{let i=t+qe*r;return{x:e.x-n*Math.cos(i),y:e.y-n*Math.sin(i)}},a=t=>({x:t.x+(e.x-t.x)*Ye,y:t.y+(e.y-t.y)*Ye}),o=t=>{let i=Math.sign((t.x-e.x)*r.x+(t.y-e.y)*r.y);return{x:e.x+r.x*i*n*Je,y:e.y+r.y*i*n*Je}},s=i(-1),c=i(1),l=a(s),u=a(c),d=o(s),f=o(c);return`M ${s.x} ${s.y} C ${l.x} ${l.y} ${d.x} ${d.y} ${e.x} ${e.y} C ${f.x} ${f.y} ${u.x} ${u.y} ${c.x} ${c.y}`}function $e(e,t,n){let r={x:-Math.sin(t),y:Math.cos(t)},i=i=>{let a=t+Xe*i,o={x:e.x-n*Math.cos(a),y:e.y-n*Math.sin(a)},s={x:(o.x+e.x)/2,y:(o.y+e.y)/2},c=((s.x-e.x)*r.x+(s.y-e.y)*r.y)*Ze,l={x:s.x-r.x*c,y:s.y-r.y*c};return`M ${o.x} ${o.y} Q ${l.x} ${l.y} ${e.x} ${e.y}`};return`${i(-1)} ${i(1)}`}function et(e){return{x:(e.x+e.x2)/2,y:(e.y+e.y2)/2}}function tt(e,n){return l(e,c(e)*t(n)).point}function nt(e){let n=e.labelAlong;if(e.bendStyle===`elbow`)return tt(L(e),n??.5);let r=z(e);if(r)return n===void 0?r.apex:r.pointAt(n);if(n===void 0)return et(e);let i=t(n);return{x:e.x+(e.x2-e.x)*i,y:e.y+(e.y2-e.y)*i}}function rt(e,n){if(e.bendStyle===`elbow`)return u(L(e),n);let r=z(e);if(r)return vt(r,n);let i=e.x2-e.x,a=e.y2-e.y,o=i*i+a*a;return o<1e-9?.5:t(((n.x-e.x)*i+(n.y-e.y)*a)/o)}var it=22,at=10;function ot(e,t){let n=Math.hypot(t.x,t.y)||1;return{x:e.x+t.y/n*at,y:e.y-t.x/n*at}}function st(e,t){if(e.bendStyle===`elbow`){let n=L(e),r=t===`start`?n:[...n].reverse(),i=l(r,Math.min(it,c(r)*.4));return ot(i.point,i.dir)}let r={x:e.x,y:e.y},i={x:e.x2,y:e.y2},a=n(r,i)||1,o=z(e);if(!o){let e=Math.min(it,a*.4);return t===`start`?ot(p(r,i,e),{x:i.x-r.x,y:i.y-r.y}):ot(p(i,r,e),{x:r.x-i.x,y:r.y-i.y})}let s=Math.min(it/a,.4),u=t===`start`?o.pointAt(s):o.pointAt(1-s),d=t===`start`?o.pointAt(s+.02):o.pointAt(1-s-.02);return ot(u,{x:d.x-u.x,y:d.y-u.y})}function ct(e){let t=e.x2-e.x,n=e.y2-e.y,r=Math.hypot(t,n)||1,i={x:t/r,y:n/r};return{dir:i,normal:{x:-i.y,y:i.x}}}function lt(e){return ze(Ge({x:e.x,y:e.y},e.strokeWidth),Ge({x:e.x2,y:e.y2},e.strokeWidth),e.elbowMid??.5)}function L(e){if(e.elbowPoints&&e.elbowPoints.length>=2)return e.elbowPoints.map(e=>({x:e.x,y:e.y}));if(e.elbowRoute&&e.elbowRoute.length>=2)return e.elbowRoute.map(e=>({x:e.x,y:e.y}));let t=lt(e);return t.route&&t.route.length>=2?t.route:[{x:e.x,y:e.y},{x:e.x2,y:e.y2}]}function ut(e){return e.elbowPoints?null:e.startBinding||e.endBinding?e.elbowMidHandle??null:lt(e).midHandle}var dt=.4;function ft(e){return a(e||0,-.4,dt)}function pt(e){let t=et(e),{dir:r,normal:i}=ct(e),a=n({x:e.x,y:e.y},{x:e.x2,y:e.y2}),o=ft(e.bendAlong)*a;return{x:t.x+r.x*o+i.x*e.bend,y:t.y+r.y*o+i.y*e.bend}}var mt=Math.PI*2,R=e=>(e%mt+mt)%mt;function ht(e,t,n){let r=Math.atan2(e.y-t.y,e.x-t.x);return-Math.sin(r)*n.x+Math.cos(r)*n.y>0}function gt(e,t,r,i){let a=n(r,e),o=Math.atan2(e.y-r.y,e.x-r.x),s=Math.atan2(t.y-r.y,t.x-r.x),c=i?R(s-o):-R(o-s);return{from:e,to:t,center:r,r:a,a0:o,delta:c,len:Math.abs(c)*a}}function _t(e,r,i,a){let o=n(e,r);if(o<1||Math.abs(i)<.5)return null;let s={x:(r.x-e.x)/o,y:(r.y-e.y)/o},c={x:-s.y,y:s.x},l={x:(e.x+r.x)/2,y:(e.y+r.y)/2},u=ft(a)*o,d={x:l.x+s.x*u+c.x*i,y:l.y+s.y*u+c.y*i},f;if(Math.abs(u)<.5){let t=o/2,n=(i*i-t*t)/(2*i),a={x:l.x+c.x*n,y:l.y+c.y*n};f=[gt(e,r,a,ht(d,a,s))]}else{let t=e=>{let t=e.x-d.x,n=e.y-d.y,r=c.x*t+c.y*n;if(Math.abs(r)<.25||Math.hypot(t,n)<1)return null;let i=(t*t+n*n)/(2*r);return{x:d.x+c.x*i,y:d.y+c.y*i}},n=t(e),i=t(r);if(!n||!i)return null;f=[gt(e,d,n,ht(d,n,s)),gt(d,r,i,ht(d,i,s))]}let p=f.reduce((e,t)=>e+t.len,0);if(p<1)return null;let m=f[f.length-1];return{apex:d,apexT:f.length===2?f[0].len/p:.5,length:p,segments:f,pointAt:e=>{let n=t(e)*p;for(let e of f){if(n<=e.len||e===m){let t=e.len?Math.min(1,n/e.len):0,r=e.a0+e.delta*t;return{x:e.center.x+e.r*Math.cos(r),y:e.center.y+e.r*Math.sin(r)}}n-=e.len}return{x:r.x,y:r.y}}}}function vt(e,t){let r=0,i=.5,a=1/0;for(let o of e.segments){let s=Math.abs(o.delta),c=Math.atan2(t.y-o.center.y,t.x-o.center.x),l=o.delta>=0?R(c-o.a0):R(o.a0-c),u;u=s<1e-9?0:l<=s?l/s:n(t,o.from)<=n(t,o.to)?0:1;let d=o.a0+o.delta*u,f=n(t,{x:o.center.x+o.r*Math.cos(d),y:o.center.y+o.r*Math.sin(d)});f<a&&(a=f,i=(r+u*o.len)/e.length),r+=o.len}return i}function z(e){return _t({x:e.x,y:e.y},{x:e.x2,y:e.y2},e.bend,e.bendAlong??0)}function yt(e,t,r){let i=n(e,t)||1,a={x:(t.x-e.x)/i,y:(t.y-e.y)/i},o={x:-a.y,y:a.x},s={x:(e.x+t.x)/2,y:(e.y+t.y)/2},c=r.x-s.x,l=r.y-s.y;return{bow:c*o.x+l*o.y,bowAlong:ft((c*a.x+l*a.y)/i)}}function bt(e,t,n){return Math.abs(e*t)<=n?0:e}function xt(e,t){let n=t===`from`?e.a0:e.a0+e.delta,r=e.delta>=0?1:-1;return{x:-Math.sin(n)*r,y:Math.cos(n)*r}}function St(e){return pt(e)}function Ct(e,t){let n=yt({x:e.x,y:e.y},{x:e.x2,y:e.y2},t);return{bend:n.bow,bendAlong:n.bowAlong}}function wt(e,t){if(e.length<2)return``;let r=`M ${e[0].x} ${e[0].y}`;for(let i=1;i<e.length-1;i+=1){let a=e[i-1],o=e[i],s=e[i+1],c=Math.min(t,n(a,o)/2,n(o,s)/2),l=p(o,a,c),u=p(o,s,c);r+=` L ${l.x} ${l.y} Q ${o.x} ${o.y} ${u.x} ${u.y}`}let i=e[e.length-1];return r+=` L ${i.x} ${i.y}`,r}function Tt(e){if(e.bendStyle===`elbow`){let t=L(e);if(t.length>=2)return wt(t,Ke)}let t=e.bendStyle===`elbow`?null:z(e);if(!t)return`M ${e.x} ${e.y} L ${e.x2} ${e.y2}`;let n=`M ${t.segments[0].from.x} ${t.segments[0].from.y}`;for(let e of t.segments){let t=+(Math.abs(e.delta)>Math.PI),r=+(e.delta>0);n+=` A ${e.r} ${e.r} 0 ${t} ${r} ${e.to.x} ${e.to.y}`}return n}function Et(e,t,r,i){if(e.length>r){let a=i?1-r/e.length:r/e.length,o=e.pointAt(a);if(n(o,t)>1e-6)return Math.atan2(t.y-o.y,t.x-o.x)}if(i){let t=xt(e.segments[e.segments.length-1],`to`);return Math.atan2(t.y,t.x)}let a=xt(e.segments[0],`from`);return Math.atan2(-a.y,-a.x)}function Dt(e,t){let r=t===`end`,i=r?{x:e.x2,y:e.y2}:{x:e.x,y:e.y},a=(r?e.endHead:e.startHead)??`arrow`,o=h(e.strokeWidth),s=r?Math.atan2(e.y2-e.y,e.x2-e.x):Math.atan2(e.y-e.y2,e.x-e.x2);if(e.bendStyle===`elbow`){let t=L(e);return{tip:i,angle:m(t,r)??s,length:y(o,a,c(t),d(t,r))}}let l=z(e);if(!l)return{tip:i,angle:s,length:y(o,a,n({x:e.x,y:e.y},{x:e.x2,y:e.y2}))};let u=y(o,a,l.length);return{tip:i,angle:Et(l,i,u,r),length:u}}var Ot=[0,Math.PI/2,Math.PI,-Math.PI/2];function kt(e){let t=[e.from,e.to];for(let n of Ot)(e.delta>=0?R(n-e.a0):R(e.a0-n))>Math.abs(e.delta)||t.push({x:e.center.x+e.r*Math.cos(n),y:e.center.y+e.r*Math.sin(n)});return t}function At(e){if(e.bendStyle===`elbow`)return L(e);let t=z(e);return t?t.segments.flatMap(kt):[{x:e.x,y:e.y},{x:e.x2,y:e.y2},pt(e)]}function jt(e){let t=At(e),n=t.map(e=>e.x),r=t.map(e=>e.y),i=Math.min(...n),a=Math.min(...r);return{x:i,y:a,width:Math.max(...n)-i,height:Math.max(...r)-a}}function B(e,t,n,r,i){let a=Math.max(0,Math.min(i,n/2,r/2));return a===0?`M ${e} ${t} L ${e+n} ${t} L ${e+n} ${t+r} L ${e} ${t+r} Z`:`M ${e+a} ${t} L ${e+n-a} ${t} Q ${e+n} ${t} ${e+n} ${t+a} L ${e+n} ${t+r-a} Q ${e+n} ${t+r} ${e+n-a} ${t+r} L ${e+a} ${t+r} Q ${e} ${t+r} ${e} ${t+r-a} L ${e} ${t+a} Q ${e} ${t} ${e+a} ${t} Z`}function Mt(e,t,n,r,i){let a=Math.max(0,Math.min(i,n/2,r));return`M ${e} ${t+r} L ${e} ${t+a} Q ${e} ${t} ${e+a} ${t} L ${e+n-a} ${t} Q ${e+n} ${t} ${e+n} ${t+a} L ${e+n} ${t+r} Z`}function Nt(e,t,n){return`M ${e-n} ${t} A ${n} ${n} 0 1 0 ${e+n} ${t} A ${n} ${n} 0 1 0 ${e-n} ${t} Z`}function Pt(e,t,n,r){return`M ${e} ${t} L ${n} ${r}`}function Ft(e,t=0){if(e.length<3||t<=0)return e.map((e,t)=>`${t?`L`:`M`} ${e[0]} ${e[1]}`).join(` `)+` Z`;let n=(e,t,n)=>{let r=Math.hypot(t[0]-e[0],t[1]-e[1])||1;return[e[0]+(t[0]-e[0])/r*n,e[1]+(t[1]-e[1])/r*n]},r=[];for(let i=0;i<e.length;i+=1){let a=e[(i-1+e.length)%e.length],o=e[i],s=e[(i+1)%e.length],c=Math.min(t,Math.hypot(o[0]-a[0],o[1]-a[1])/2,Math.hypot(o[0]-s[0],o[1]-s[1])/2),l=n(o,a,c),u=n(o,s,c);r.push(`${i?`L`:`M`} ${l[0]} ${l[1]}`),r.push(`Q ${o[0]} ${o[1]} ${u[0]} ${u[1]}`)}return r.join(` `)+` Z`}var It={M:[`x`,`y`],L:[`x`,`y`],Q:[`x`,`y`,`x`,`y`],C:[`x`,`y`,`x`,`y`,`x`,`y`],A:[`keep`,`keep`,`rotation`,`keep`,`sweep`,`x`,`y`],Z:[]},Lt=/([A-Za-z])([^A-Za-z]*)/g,Rt=/[-+]?(?:\d*\.\d+|\d+\.?)(?:[eE][-+]?\d+)?/g;function zt(e){if(!Number.isFinite(e))return`0`;let t=Math.round(e*1e4)/1e4;return Object.is(t,-0)?`0`:String(t)}function Bt(e,t,n,r){if(!n&&!r)return e;let i=t.x+t.width/2,a=t.y+t.height/2,o=n!==r,s=[];Lt.lastIndex=0;for(let t=Lt.exec(e);t;t=Lt.exec(e)){let c=t[1],l=It[c];if(!l)return e;let u=t[2].match(Rt)?.map(Number)??[];if(l.length===0||u.length===0){s.push(c);continue}let d=u.map((e,t)=>{let s=l[t%l.length];return s===`x`?zt(n?2*i-e:e):s===`y`?zt(r?2*a-e:e):s===`rotation`?zt(o?-e:e):s===`sweep`&&o?String(+!e):zt(e)});s.push(`${c} ${d.join(` `)}`)}return s.join(` `)}var Vt=`rectangle.ellipse.diamond.triangle.oval.parallelogram.trapezoid.cylinder.queue.note.callout.hexagon.star.checkbox.crossbox.heart.cloud.arrow-up.arrow-down.arrow-left.arrow-right.plus.speech-bubble.bolt.document.predefined-process.manual-input.pentagon.chevron.octagon.cube.actor.double-circle.card.delay.fork-join.multi-document.multi-process.package.component.brace`.split(`.`);function V(e,t=0){return Ft(e,t)}function Ht(e){let t=e.x+e.width/2,n=e.y+e.height/2,r=e.width/2,i=e.height/2,a=[];for(let e=0;e<10;e+=1){let o=e%2==0?1:.42,s=-Math.PI/2+e*Math.PI/5;a.push([t+Math.cos(s)*r*o,n+Math.sin(s)*i*o])}return V(a)}function Ut(e){return Math.min(e.width*.1,e.height*.25)}function Wt(e){return Math.min(e.height*.34,e.width*.25)}function Gt(e){let{x:t,y:n,width:r,height:i}=e,a=e=>t+e*r,o=e=>n+e*i;return`M ${a(.5)} ${o(.28)} C ${a(.5)} ${o(.16)} ${a(.4)} ${o(.04)} ${a(.25)} ${o(.04)} C ${a(.06)} ${o(.04)} ${a(0)} ${o(.2)} ${a(0)} ${o(.32)} C ${a(0)} ${o(.52)} ${a(.2)} ${o(.68)} ${a(.5)} ${o(.96)} C ${a(.8)} ${o(.68)} ${a(1)} ${o(.52)} ${a(1)} ${o(.32)} C ${a(1)} ${o(.2)} ${a(.94)} ${o(.04)} ${a(.75)} ${o(.04)} C ${a(.6)} ${o(.04)} ${a(.5)} ${o(.16)} ${a(.5)} ${o(.28)} Z`}function Kt(e){return B(e.x,e.y,e.width,e.height,Math.min(6,e.width/2,e.height/2))}function qt(e){let{x:t,y:n,width:r,height:i}=e,a=e=>t+e*r,o=e=>n+e*i;return`M ${a(.23)} ${o(1)} C ${a(.1)} ${o(1)} ${a(0)} ${o(.85)} ${a(0)} ${o(.66)} C ${a(0)} ${o(.47)} ${a(.1)} ${o(.31)} ${a(.23)} ${o(.31)} C ${a(.25)} ${o(.17)} ${a(.32)} ${o(.06)} ${a(.42)} ${o(.02)} C ${a(.51)} ${o(0)} ${a(.61)} ${o(.01)} ${a(.69)} ${o(.1)} C ${a(.76)} ${o(.19)} ${a(.8)} ${o(.33)} ${a(.78)} ${o(.46)} L ${a(.83)} ${o(.46)} C ${a(.92)} ${o(.46)} ${a(1)} ${o(.58)} ${a(1)} ${o(.73)} C ${a(1)} ${o(.88)} ${a(.92)} ${o(1)} ${a(.83)} ${o(1)} Z`}function Jt(e,t){let n=t===`left`||t===`right`,r=n?e.width:e.height,i=n?e.height:e.width;return Math.min(i,r/2)}function Yt(e,t,n=0){let{x:r,y:i,width:a,height:o}=e,s=t===`left`||t===`right`,c=s?a:o,l=s?o:a,u=Jt(e,t),d=l*.25,f=l/2;return V([[0,f-d],[c-u,f-d],[c-u,0],[c,f],[c-u,l],[c-u,f+d],[0,f+d]].map(([e,n])=>t===`right`?[r+e,i+n]:t===`left`?[r+c-e,i+n]:t===`down`?[r+n,i+e]:[r+n,i+c-e]),n)}function Xt(e,t=0){let{x:n,y:r,width:i,height:a}=e,o=i*.32,s=a*.32;return V([[n+o,r],[n+i-o,r],[n+i-o,r+s],[n+i,r+s],[n+i,r+a-s],[n+i-o,r+a-s],[n+i-o,r+a],[n+o,r+a],[n+o,r+a-s],[n,r+a-s],[n,r+s],[n+o,r+s]],t)}function Zt(e){let{x:t,y:n,width:r,height:i}=e,a=(e,a)=>[t+e*r,n+a*i];return V([a(.56,0),a(0,.6),a(.5,.6),a(.44,1),a(1,.4),a(.5,.4)])}var Qt=.16;function $t(e){let{x:t,y:n,width:r,height:i}=e,a=i*Qt,o=n+i-a,s=e=>t+e*r;return`M ${t} ${n} L ${t+r} ${n} L ${t+r} ${o} C ${s(.72)} ${o-a*1.4} ${s(.56)} ${o+a*1.4} ${s(.4)} ${o} C ${s(.26)} ${o-a*1.4} ${s(.12)} ${o+a*1.1} ${t} ${o} Z`}function en(e){let{x:t,y:n,width:r,height:i}=e,a=Math.min(r*.12,16);return`M ${t+a} ${n} L ${t+a} ${n+i} M ${t+r-a} ${n} L ${t+r-a} ${n+i}`}function tn(e){let{x:t,y:n,width:r,height:i}=e;return V([[t,n+i*.28],[t+r,n],[t+r,n+i],[t,n+i]])}function nn(e){return Math.min(e.width*.22,e.height*.6)}function rn(e,t=0){let{x:n,y:r,width:i,height:a}=e,o=nn(e);return V([[n,r],[n+i-o,r],[n+i,r+a/2],[n+i-o,r+a],[n,r+a]],t)}function an(e){return Math.min(e.width*.24,e.height*.6)}function on(e,t=0){let{x:n,y:r,width:i,height:a}=e,o=an(e);return V([[n,r],[n+i-o,r],[n+i,r+a/2],[n+i-o,r+a],[n,r+a],[n+o,r+a/2]],t)}function sn(e,t=0){let{x:n,y:r,width:i,height:a}=e,o=Math.min(i,a)*.29;return V([[n+o,r],[n+i-o,r],[n+i,r+o],[n+i,r+a-o],[n+i-o,r+a],[n+o,r+a],[n,r+a-o],[n,r+o]],t)}function cn(e){return Math.min(e.width,e.height)*.26}function ln(e){let{x:t,y:n,width:r,height:i}=e,a=cn(e);return V([[t,n+a],[t+a,n],[t+r,n],[t+r,n+i-a],[t+r-a,n+i],[t,n+i]])}function un(e){let{x:t,y:n,width:r,height:i}=e,a=cn(e);return`M ${t} ${n+a} L ${t+r-a} ${n+a} L ${t+r} ${n} M ${t+r-a} ${n+a} L ${t+r-a} ${n+i}`}var dn=.72;function fn(e){let{x:t,y:n,width:r}=e,i=e.height*dn,a=t+r/2,o=Math.min(r*.22,i*.16),s=n+o+i*.04,c=s+o,l=n+i*.44,u=n+i*.64,d=n+i*.98,f=r*.3,p=r*.22;return`M ${a-o} ${s} A ${o} ${o} 0 1 0 ${a+o} ${s} A ${o} ${o} 0 1 0 ${a-o} ${s} M ${a} ${c} L ${a} ${u} M ${a-f} ${l} L ${a+f} ${l} M ${a} ${u} L ${a-p} ${d} M ${a} ${u} L ${a+p} ${d}`}var pn=.82,mn=.78;function hn(e,t,n,r){let{x:i,y:a,width:o,height:s}=e,c=a+s*t,l=Math.min(n,o/4,(c-a)/2);return`M ${i+l} ${a} L ${i+o-l} ${a} Q ${i+o} ${a} ${i+o} ${a+l} L ${i+o} ${c-l} Q ${i+o} ${c} ${i+o-l} ${c} L ${i+o*r[0]} ${c} L ${i+o*r[1]} ${a+s} L ${i+o*r[2]} ${c} L ${i+l} ${c} Q ${i} ${c} ${i} ${c-l} L ${i} ${a+l} Q ${i} ${a} ${i+l} ${a} Z`}function gn(e){return hn(e,pn,10,[.24,.04,.14])}function _n(e){return hn(e,mn,12,[.4,.22,.26])}function vn(e){let t=e.y+e.height/2,n=e.width/2,r=e.height/2;return`M ${e.x} ${t} A ${n} ${r} 0 1 0 ${e.x+e.width} ${t} A ${n} ${r} 0 1 0 ${e.x} ${t} Z`}function yn(e){let{x:t,y:n,width:r,height:i}=e,a=Math.min(r,i)*.2;return V([[t+a,n],[t+r,n],[t+r,n+i],[t,n+i],[t,n+a]])}function bn(e){return Math.min(e.height/2,e.width/2)}function xn(e){let{x:t,y:n,width:r,height:i}=e,a=bn(e),o=r-a;return`M ${t} ${n} L ${t+o} ${n} A ${a} ${a} 0 0 1 ${t+o} ${n+i} L ${t} ${n+i} Z`}function Sn(e){return H(e)}function Cn(e){return Math.min(Math.min(e.width,e.height)*.08,9)}function wn(e,t,n){let r=n??Cn(e);return t({x:e.x,y:e.y+2*r,width:e.width-2*r,height:e.height-2*r})}function Tn(e,t,n,r){let i=n??Cn(e),a=e.width-2*i,o=e.height-2*i,s=r??e.y+e.height;return`${En(e.x+2*i,e.y,a,o,i,s)} ${En(e.x+i,e.y+i,a,o,i,s)} ${wn(e,t,i)}`}function En(e,t,n,r,i,a){let o=e+n,s=Math.min(t+r,a);return`M ${e} ${t+i} L ${e} ${t} L ${o} ${t} L ${o} ${s} L ${o-i} ${s}`}function Dn(e,t){return e.y+2*t+(e.height-2*t)*(1-Qt)}var On=.12;function kn(e,t){let n=Math.min(e.width,e.height)*t;return vn(e)+` `+vn({x:e.x+n,y:e.y+n,width:e.width-2*n,height:e.height-2*n})}function H(e){return B(e.x,e.y,e.width,e.height,Math.min(4,e.width/2,e.height/2))}function An(e){return Math.min(e.height*.24,26)}function jn(e){return Math.min(e.width*.45,96)}function Mn(e){let{x:t,y:n,width:r,height:i}=e,a=An(e),o=jn(e);return V([[t,n],[t+o,n],[t+o,n+a],[t+r,n+a],[t+r,n+i],[t,n+i]])}function Nn(e){return Math.min(e.width*.16,22)}function Pn(e){let{x:t,y:n,width:r,height:i}=e,a=Nn(e),o=Math.min(i*.16,14)/2,s=n+i*.32,c=n+i*.68,l=`M ${t} ${n} L ${t+r} ${n} L ${t+r} ${n+i} L ${t} ${n+i} L ${t} ${c+o} M ${t} ${c-o} L ${t} ${s+o} M ${t} ${s-o} L ${t} ${n}`,u=e=>`M ${t-a/2} ${e-o} L ${t+a/2} ${e-o} L ${t+a/2} ${e+o} L ${t-a/2} ${e+o} Z`;return`${l} ${u(s)} ${u(c)}`}function Fn(e){return Math.min(e.width*.3,16)}function In(e){let{x:t,y:n,height:r}=e,i=Fn(e),a=n+r/2,o=t+i,s=t+i*.4;return`M ${o} ${n} Q ${s} ${n} ${s} ${n+r*.22} L ${s} ${a-r*.06} Q ${s} ${a} ${t} ${a} Q ${s} ${a} ${s} ${a+r*.06} L ${s} ${n+r*.78} Q ${s} ${n+r} ${o} ${n+r}`}var Ln=new Set([`diamond`,`triangle`,`parallelogram`,`trapezoid`,`hexagon`,`pentagon`,`octagon`,`chevron`,`plus`,`arrow-up`,`arrow-down`,`arrow-left`,`arrow-right`]);function Rn(e){return e===`rectangle`||Ln.has(e)}function zn(e){return e===`rectangle`?`rounded`:`sharp`}function Bn(e){return e===`rounded`?7:0}var Vn={triangle:{y:!0},parallelogram:{x:!0,y:!0},trapezoid:{y:!0},cylinder:{y:!0},note:{x:!0,y:!0},star:{y:!0},checkbox:{x:!0,y:!0},heart:{y:!0},cloud:{x:!0,y:!0},"arrow-up":{y:!0},"arrow-down":{y:!0},"arrow-left":{x:!0},"arrow-right":{x:!0},"speech-bubble":{x:!0,y:!0},bolt:{x:!0,y:!0},queue:{x:!0},callout:{x:!0,y:!0},document:{x:!0,y:!0},"manual-input":{x:!0,y:!0},pentagon:{x:!0},chevron:{x:!0},cube:{x:!0,y:!0},actor:{y:!0},card:{x:!0,y:!0},delay:{x:!0},"multi-document":{x:!0,y:!0},"multi-process":{x:!0,y:!0},package:{x:!0,y:!0},component:{x:!0},brace:{x:!0}};function Hn(e){let t=Vn[e];return{x:t?.x===!0,y:t?.y===!0}}function U(e,t,n,r){if(r?.x||r?.y)return Bt(U(e,t,n),t,!!r.x,!!r.y);let{x:i,y:a,width:o,height:s}=t,c=i+o/2,l=a+s/2,u=Bn(n);switch(e){case`ellipse`:return vn(t);case`oval`:return B(i,a,o,s,Math.min(o,s)/2);case`diamond`:return V([[c,a],[i+o,l],[c,a+s],[i,l]],u);case`triangle`:return V([[c,a],[i+o,a+s],[i,a+s]],u);case`parallelogram`:{let e=Math.min(o*.25,s);return V([[i+e,a],[i+o,a],[i+o-e,a+s],[i,a+s]],u)}case`trapezoid`:{let e=o*.22;return V([[i+e,a],[i+o-e,a],[i+o,a+s],[i,a+s]],u)}case`hexagon`:{let e=Math.min(o*.25,o/2);return V([[i+e,a],[i+o-e,a],[i+o,l],[i+o-e,a+s],[i+e,a+s],[i,l]],u)}case`star`:return Ht(t);case`checkbox`:case`crossbox`:return Kt(t);case`heart`:return Gt(t);case`cloud`:return qt(t);case`arrow-up`:case`arrow-down`:case`arrow-left`:case`arrow-right`:return Yt(t,e.slice(6),u);case`plus`:return Xt(t,u);case`speech-bubble`:return _n(t);case`callout`:return gn(t);case`bolt`:return Zt(t);case`document`:return $t(t);case`manual-input`:return tn(t);case`pentagon`:return rn(t,u);case`predefined-process`:return B(i,a,o,s,Math.min(3,o/2,s/2));case`chevron`:return on(t,u);case`octagon`:return sn(t,u);case`cube`:return ln(t);case`actor`:return B(i,a,o,s,Math.min(o,s)/2.4);case`note`:{let e=Math.min(o,s)*.26;return`M ${i} ${a} L ${i+o-e} ${a} L ${i+o} ${a+e} L ${i+o} ${a+s} L ${i} ${a+s} Z`}case`cylinder`:{let e=Ut(t),n=o/2,r=a+e,c=a+s-e;return`M ${i} ${r} L ${i} ${c} A ${n} ${e} 0 0 0 ${i+o} ${c} L ${i+o} ${r} A ${n} ${e} 0 0 0 ${i} ${r} Z`}case`queue`:{let e=Wt(t),n=s/2,r=i+e,c=i+o-e;return`M ${r} ${a} L ${c} ${a} A ${e} ${n} 0 0 1 ${c} ${a+s} L ${r} ${a+s} A ${e} ${n} 0 0 1 ${r} ${a} Z`}case`double-circle`:return vn(t);case`card`:return yn(t);case`delay`:return xn(t);case`fork-join`:return Sn(t);case`multi-process`:return wn(t,H);case`multi-document`:return wn(t,$t);case`package`:return Mn(t);case`component`:return H(t);case`brace`:return H(t);default:return B(i,a,o,s,n===`sharp`?0:Math.min(12,o/2,s/2))}}function Un(e,t,n,r){if(r?.x||r?.y)return Bt(Un(e,t,n),t,!!r.x,!!r.y);let{x:i,y:a,width:o,height:s}=t;if(e===`cylinder`){let r=Ut(t),s=o/2,c=a+r;return U(e,t,n)+` M ${i} ${c} A ${s} ${r} 0 0 0 ${i+o} ${c}`}if(e===`queue`){let r=Wt(t),o=s/2,c=i+r;return U(e,t,n)+` M ${c} ${a} A ${r} ${o} 0 0 1 ${c} ${a+s}`}if(e===`note`){let r=Math.min(o,s)*.26;return U(e,t,n)+` M ${i+o-r} ${a} L ${i+o-r} ${a+r} L ${i+o} ${a+r}`}if(e===`crossbox`){let r=o*.06,c=s*.06;return U(e,t,n)+` M ${i+r} ${a+c} L ${i+o-r} ${a+s-c} M ${i+o-r} ${a+c} L ${i+r} ${a+s-c}`}if(e===`checkbox`)return U(e,t,n)+` M ${i+o*.24} ${a+s*.52} L ${i+o*.44} ${a+s*.72} L ${i+o*.78} ${a+s*.28}`;if(e===`predefined-process`)return U(e,t,n)+` `+en(t);if(e===`cube`)return U(e,t,n)+` `+un(t);if(e===`actor`)return fn(t);if(e===`double-circle`)return kn(t,On);if(e===`multi-process`)return Tn(t,H);if(e===`multi-document`)return Tn(t,$t,void 0,Dn(t,Cn(t)));if(e===`package`){let r=An(t),i=jn(t);return U(e,t,n)+` M ${t.x} ${t.y+r} L ${t.x+i} ${t.y+r}`}return e===`component`?Pn(t):e===`brace`?In(t):U(e,t,n)}function Wn(e){if(e===`arrow-up`||e===`arrow-down`||e===`bolt`||e===`actor`)return Un(e,{x:5,y:4,width:14,height:16});if(e===`plus`||e===`checkbox`||e===`crossbox`||e===`heart`)return Un(e,{x:5,y:5,width:14,height:14});if(e===`double-circle`)return kn({x:4,y:4,width:16,height:16},.26);if(e===`multi-process`)return Gn({x:4,y:5,width:15,height:13},H,4);if(e===`multi-document`){let e={x:4,y:5,width:15,height:13};return Gn(e,$t,4,e.y+4+(e.height-4)*(1-Qt))}return e===`fork-join`?Sn({x:4,y:9,width:16,height:6}):Un(e,{x:4,y:5,width:16,height:14})}function Gn(e,t,n,r){let i=e.width-n,a=e.height-n,o=t({x:e.x,y:e.y+n,width:i,height:a});return`${En(e.x+n,e.y,i,a,n,r??e.y+a)} ${o}`}var{PI:Kn}=Math,qn=Kn+1e-4,Jn=.5,Yn=[1,1];function Xn(e,t,n,r=e=>e){return e*r(.5-t*(.5-n))}var{min:Zn}=Math;function Qn(e,t,n){let r=Zn(1,t/n);return Zn(1,e+(Zn(1,1-r)-e)*(r*.275))}function $n(e){return[-e[0],-e[1]]}function W(e,t){return[e[0]+t[0],e[1]+t[1]]}function er(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e}function G(e,t){return[e[0]-t[0],e[1]-t[1]]}function tr(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e}function K(e,t){return[e[0]*t,e[1]*t]}function nr(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e}function rr(e,t){return[e[0]/t,e[1]/t]}function ir(e){return[e[1],-e[0]]}function ar(e,t){let n=t[0];return e[0]=t[1],e[1]=-n,e}function or(e,t){return e[0]*t[0]+e[1]*t[1]}function sr(e,t){return e[0]===t[0]&&e[1]===t[1]}function cr(e){return Math.hypot(e[0],e[1])}function lr(e,t){let n=e[0]-t[0],r=e[1]-t[1];return n*n+r*r}function ur(e){return rr(e,cr(e))}function dr(e,t){return Math.hypot(e[1]-t[1],e[0]-t[0])}function fr(e,t,n){let r=Math.sin(n),i=Math.cos(n),a=e[0]-t[0],o=e[1]-t[1],s=a*i-o*r,c=a*r+o*i;return[s+t[0],c+t[1]]}function pr(e,t,n,r){let i=Math.sin(r),a=Math.cos(r),o=t[0]-n[0],s=t[1]-n[1],c=o*a-s*i,l=o*i+s*a;return e[0]=c+n[0],e[1]=l+n[1],e}function mr(e,t,n){return W(e,K(G(t,e),n))}function hr(e,t,n,r){let i=n[0]-t[0],a=n[1]-t[1];return e[0]=t[0]+i*r,e[1]=t[1]+a*r,e}function gr(e,t,n){return W(e,K(t,n))}var q=[0,0],J=[0,0],Y=[0,0];function _r(e,t){let n=gr(e,ur(ir(G(e,W(e,[1,1])))),-t),r=[],i=1/13;for(let t=i;t<=1;t+=i)r.push(fr(n,e,qn*2*t));return r}function vr(e,t,n){let r=[],i=1/n;for(let n=i;n<=1;n+=i)r.push(fr(t,e,qn*n));return r}function yr(e,t,n){let r=G(t,n),i=K(r,.5),a=K(r,.51);return[G(e,i),G(e,a),W(e,a),W(e,i)]}function br(e,t,n,r){let i=[],a=gr(e,t,n),o=1/r;for(let t=o;t<1;t+=o)i.push(fr(a,e,qn*3*t));return i}function xr(e,t,n){return[W(e,K(t,n)),W(e,K(t,n*.99)),G(e,K(t,n*.99)),G(e,K(t,n))]}function Sr(e,t,n){return e===!1||e===void 0?0:e===!0?Math.max(t,n):e}function Cr(e,t,n){return e.slice(0,10).reduce((e,r)=>{let i=r.pressure;return t&&(i=Qn(e,r.distance,n)),(e+i)/2},e[0].pressure)}function wr(e,t={}){let{size:n=16,smoothing:r=.5,thinning:i=.5,simulatePressure:a=!0,easing:o=e=>e,start:s={},end:c={},last:l=!1}=t,{cap:u=!0,easing:d=e=>e*(2-e)}=s,{cap:f=!0,easing:p=e=>--e*e*e+1}=c;if(e.length===0||n<=0)return[];let m=e[e.length-1].runningLength,h=Sr(s.taper,n,m),g=Sr(c.taper,n,m),_=(n*r)**2,v=[],y=[],b=Cr(e,a,n),x=Xn(n,i,e[e.length-1].pressure,o),S,ee=e[0].vector,C=e[0].point,w=C,T=C,E=w,D=!1;for(let t=0;t<e.length;t++){let{pressure:r}=e[t],{point:s,vector:c,distance:l,runningLength:u}=e[t],f=t===e.length-1;if(!f&&m-u<3)continue;i?(a&&(r=Qn(b,l,n)),x=Xn(n,i,r,o)):x=n/2,S===void 0&&(S=x);let O=u<h?d(u/h):1,k=m-u<g?p((m-u)/g):1;x=Math.max(.01,x*Math.min(O,k));let A=(f?e[t]:e[t+1]).vector,j=f?1:or(c,A),te=or(c,ee)<0&&!D,ne=j!==null&&j<0;if(te||ne){ar(q,ee),nr(q,q,x);for(let e=0;e<=1;e+=.07692307692307693)tr(J,s,q),pr(J,J,s,qn*e),T=[J[0],J[1]],v.push(T),er(Y,s,q),pr(Y,Y,s,qn*-e),E=[Y[0],Y[1]],y.push(E);C=T,w=E,ne&&(D=!0);continue}if(D=!1,f){ar(q,c),nr(q,q,x),v.push(G(s,q)),y.push(W(s,q));continue}hr(q,A,c,j),ar(q,q),nr(q,q,x),tr(J,s,q),T=[J[0],J[1]],(t<=1||lr(C,T)>_)&&(v.push(T),C=T),er(Y,s,q),E=[Y[0],Y[1]],(t<=1||lr(w,E)>_)&&(y.push(E),w=E),b=r,ee=c}let O=[e[0].point[0],e[0].point[1]],k=e.length>1?[e[e.length-1].point[0],e[e.length-1].point[1]]:W(e[0].point,[1,1]),A=[],j=[];if(e.length===1){if(!(h||g)||l)return _r(O,S||x)}else{h||g&&e.length===1||(u?A.push(...vr(O,y[0],13)):A.push(...yr(O,v[0],y[0])));let t=ir($n(e[e.length-1].vector));g||h&&e.length===1?j.push(k):f?j.push(...br(k,t,x,29)):j.push(...xr(k,t,x))}return v.concat(j,y.reverse(),A)}var Tr=[0,0];function Er(e){return e!=null&&e>=0}function Dr(e,t={}){let{streamline:n=.5,size:r=16,last:i=!1}=t;if(e.length===0)return[];let a=.15+(1-n)*.85,o=Array.isArray(e[0])?e:e.map(({x:e,y:t,pressure:n=Jn})=>[e,t,n]);if(o.length===2){let e=o[1];o=o.slice(0,-1);for(let t=1;t<5;t++)o.push(mr(o[0],e,t/4))}o.length===1&&(o=[...o,[...W(o[0],Yn),...o[0].slice(2)]]);let s=[{point:[o[0][0],o[0][1]],pressure:Er(o[0][2])?o[0][2]:.25,vector:[...Yn],distance:0,runningLength:0}],c=!1,l=0,u=s[0],d=o.length-1;for(let e=1;e<o.length;e++){let t=i&&e===d?[o[e][0],o[e][1]]:mr(u.point,o[e],a);if(sr(u.point,t))continue;let n=dr(t,u.point);if(l+=n,e<d&&!c){if(l<r)continue;c=!0}tr(Tr,u.point,t),u={point:t,pressure:Er(o[e][2])?o[e][2]:Jn,vector:ur(Tr),distance:n,runningLength:l},s.push(u)}return s[0].vector=s[1]?.vector||[0,0],s}function Or(e,t={}){return wr(Dr(e,t),t)}function kr(e){return e.highlighter?e.strokeWidth*3:e.strokeWidth}function Ar(e){if(e.length<3)return``;let t=`M${(e[0][0]+e[1][0])/2} ${(e[0][1]+e[1][1])/2}`;for(let n=1;n<=e.length;n+=1){let[r,i]=e[n%e.length],[a,o]=e[(n+1)%e.length];t+=`Q${r} ${i} ${(r+a)/2} ${(i+o)/2}`}return t+`Z`}function jr(e){return{size:kr(e)*2,thinning:0,smoothing:.5,streamline:.5,simulatePressure:!1,last:!0}}function Mr(e){return Ar(Or(e.points.map(e=>[e.x,e.y]),jr(e)))}function Nr(e){let t=Dr(e.points.map(e=>[e.x,e.y]),jr(e)).map(e=>e.point);if(t.length<2)return``;let n=`M${t[0][0]} ${t[0][1]}`;for(let e=1;e<t.length-1;e+=1){let[r,i]=t[e],[a,o]=t[e+1];n+=`Q${r} ${i} ${(r+a)/2} ${(i+o)/2}`}let r=t[t.length-1];return`${n}L${r[0]} ${r[1]}`}function Pr(e){if(e.length===0)return{x:0,y:0,width:0,height:0};let t=1/0,n=1/0,r=-1/0,i=-1/0;for(let a of e)t=Math.min(t,a.x),n=Math.min(n,a.y),r=Math.max(r,a.x),i=Math.max(i,a.y);return{x:t,y:n,width:r-t,height:i-n}}var Fr={top:0,right:0,bottom:0,left:0},Ir=.46,Lr=.28,Rr=.2,zr=.35,Br=.4,Vr=.35;function Hr(e,t,n,r){let i=Ur(e,t,n);return!r?.x&&!r?.y?i:{top:r.y?i.bottom:i.top,right:r.x?i.left:i.right,bottom:r.y?i.top:i.bottom,left:r.x?i.right:i.left}}function Ur(e,t,n){let r={x:0,y:0,width:t,height:n};if(e===`multi-process`){let e=Cn(r);return{top:2*e,right:2*e,bottom:0,left:0}}if(e===`multi-document`){let e=Cn(r);return{top:2*e,right:2*e,bottom:(n-2*e)*Qt,left:0}}if(e===`cube`){let e=cn(r);return{top:e,right:e,bottom:0,left:0}}if(e===`double-circle`){let e=Math.min(t,n)*On+6;return{top:e,right:e,bottom:e,left:e}}if(e===`cylinder`)return{top:2*Ut(r),right:0,bottom:0,left:0};if(e===`queue`){let e=Wt(r);return{top:0,right:e,bottom:0,left:2*e}}if(e===`document`)return{top:0,right:0,bottom:n*Qt,left:0};if(e===`speech-bubble`)return{top:0,right:0,bottom:n*(1-mn),left:0};if(e===`callout`)return{top:0,right:0,bottom:n*(1-pn),left:0};if(e===`actor`)return{top:n*dn,right:0,bottom:0,left:0};if(e===`triangle`)return{top:n*Ir,right:0,bottom:0,left:0};if(e===`cloud`)return{top:n*Lr,right:0,bottom:0,left:0};if(e===`pentagon`)return{top:0,right:nn(r),bottom:0,left:0};if(e===`chevron`)return{top:0,right:0,bottom:0,left:an(r)*Vr};if(e===`manual-input`)return{top:n*Rr,right:0,bottom:0,left:0};if(e===`delay`)return{top:0,right:bn(r)*Br,bottom:0,left:0};if(e===`package`)return{top:An(r),right:0,bottom:0,left:0};if(e===`component`)return{top:0,right:0,bottom:0,left:Nn(r)+4};if(e===`brace`)return{top:0,right:0,bottom:0,left:Fn(r)+8};if(e===`arrow-up`||e===`arrow-down`||e===`arrow-left`||e===`arrow-right`){let t=Jt(r,e.slice(6))*zr;return e===`arrow-right`?{top:0,right:t,bottom:0,left:0}:e===`arrow-left`?{top:0,right:0,bottom:0,left:t}:e===`arrow-up`?{top:t,right:0,bottom:0,left:0}:{top:0,right:0,bottom:t,left:0}}return Fr}var Wr=14*.3;function Gr(e){return Math.max(14,Math.round(e))}function Kr(e){return Math.max(6,Math.round(e*.35))}var qr={ellipse:{fx:.146,fy:.146},diamond:{fx:.25,fy:.25},triangle:{fx:.25,fy:.5},parallelogram:{fx:.2,fy:0},trapezoid:{fx:.18,fy:0},hexagon:{fx:.25,fy:0},star:{fx:.3,fy:.18},heart:{fx:.22,fy:.1},cloud:{fx:.16,fy:.22},"speech-bubble":{fx:.05,fy:.05},bolt:{fx:.32,fy:.12},plus:{fx:.33,fy:.02},"arrow-up":{fx:.5,fy:.3},"arrow-down":{fx:.25,fy:.25},"arrow-left":{fx:.45,fy:.25},"arrow-right":{fx:.25,fy:.25}};function Jr(e,t,n,r){if(r?.x||r?.y){let i=Jr(e,t,n);return{x:r.x?t-i.x:i.x,y:r.y?n-i.y:i.y}}if(e===`oval`){let e=n/2*(1-Math.SQRT1_2);return{x:e,y:e}}if(e===`cylinder`)return{x:0,y:Ut({x:0,y:0,width:t,height:n})};if(e===`queue`)return{x:Wt({x:0,y:0,width:t,height:n}),y:0};let i=qr[e]??{fx:0,fy:0};return{x:i.fx*t,y:i.fy*n}}var Yr=1.25,Xr=1.15;function Zr(e){let{kind:t,width:n,height:r,fontSize:i,lineHeight:a,textPadding:o,flipX:s,flipY:c}=e,l=Hr(t,n,r,{x:s,y:c}),u=o??6,d=r-l.top-l.bottom-u*2,f=Math.floor(d/(a??1.25));return Math.max(8,Math.min(i,f))}var Qr=.917,$r=.292,ei=(Qr-$r)/2;function ti(e,t){return e*t/2+e*ei}function ni(e){if(!e)return null;let t=e.trim();return t?/^(https?:|mailto:)/i.test(t)?t:/^[\w-]+(\.[\w-]+)+([/?#].*)?$/.test(t)?`https://${t}`:null:null}var ri={blue:`#e7f5ff`,green:`#ebfbee`,red:`#fff5f5`,orange:`#fff4e6`,violet:`#f3f0ff`,teal:`#e6fcf5`,pink:`#fff0f6`,yellow:`#fff9db`,gray:`#f8f9fa`},ii={blue:r.blue.bold,green:r.green.bold,red:r.red.bold,orange:r.orange.bold,violet:r.purple.bold,teal:r.teal.bold,pink:r.pink.bold,yellow:r.yellow.bold,gray:r.gray.bold},ai=`#1e1e1e`,X={ink:`token:ink`,inkMuted:`token:ink-muted`,inkInverse:`token:ink-inverse`,paper:`token:paper`,paperGrid:`token:paper-grid`,paperLine:`token:paper-line`},oi={[X.ink]:{var:`var(--canvas-ink)`,key:`ink`,lit:`#1e1e1e`},[X.inkMuted]:{var:`var(--canvas-ink-muted)`,key:`inkMuted`,lit:`#495057`},[X.inkInverse]:{var:`var(--canvas-ink-inverse)`,key:`inkInverse`,lit:`#ffffff`},[X.paper]:{var:`var(--paper-bg)`,key:`paperBg`,lit:`#ffffff`},[X.paperGrid]:{var:`var(--paper-grid)`,key:`paperGrid`,lit:`#eceef0`},[X.paperLine]:{var:`var(--paper-line)`,key:`paperLine`,lit:`#dee2e6`}},si=Object.fromEntries(Object.values(oi).map(e=>[e.key,e.lit]));function ci(e){return oi[e]?.var??e}function li(e){return e===void 0?void 0:ci(e)}function ui(e){return Object.values(oi).find(t=>t.var===e)?.lit??e}function di(e,t){let n=oi[e];return n?t?t[n.key]:n.lit:e}var fi={"#1e1e1e":X.ink,"#495057":X.inkMuted,"#ffffff":X.inkInverse},pi={"#ffffff":X.paper,"#eceef0":X.paperGrid,"#dee2e6":X.paperLine};function mi(e){return fi[e]??e}function hi(e){return ci(mi(e))}function gi(e){return e===X.inkInverse?X.ink:oi[e]?X.paper:void 0}function _i(e,t){return di(mi(e),t)}function vi(e){return li(e===void 0?void 0:pi[e]??e)}function yi(e,t){return di(pi[e]??e,t)}var bi=new Map(Object.keys(ri).map(e=>[ri[e],ii[e]]));function xi(t){if(t===`#ffffff`)return ci(X.paper);if(e(t,0)>.9){let e=bi.get(t);return`color-mix(in srgb, ${t} var(--paper-tint-strength), ${e?`color-mix(in srgb, ${e} var(--paper-hue-strength), var(--canvas-bg))`:`var(--canvas-bg)`})`}return ci(t)}var Si=.08,Ci=.1;function wi(t,n){if(t!==`#ffffff`&&e(t,0)>.9&&e(n.bg,1)<.5){let e=bi.get(t);return ki(t,e?ki(e,n.bg,Ci):n.bg,Si)}return di(t===`#ffffff`?X.paper:t,n)}var Ti=.32,Ei=.4;function Di(e){return{pastel:e.pastel,fill:`color-mix(in srgb, ${e.pastel} var(--node-pastel-strength), color-mix(in srgb, ${e.bold} var(--node-hue-strength), var(--canvas-bg)))`,stroke:`color-mix(in srgb, var(--canvas-ink) var(--node-stroke-ink), ${e.bold})`}}function Oi(t,n){return e(n.bg,1)>=.5?{pastel:t.pastel,fill:t.pastel,stroke:n.ink}:{pastel:t.pastel,fill:ki(t.bold,n.bg,Ti),stroke:ki(n.ink,t.bold,Ei)}}function ki(e,t,n){let r=i(e),a=i(t);if(!r||!a)return t;let o=(e,t)=>Math.round(e*n+t*(1-n)).toString(16).padStart(2,`0`);return`#${o(r.r,a.r)}${o(r.g,a.g)}${o(r.b,a.b)}`}function Ai(t){return t&&e(t.paperBg,0)<.5?`screen`:`multiply`}function ji(e,t,n,r,i,a){if(a&&e===`stroke`&&t===`#1e1e1e`)return a.stroke;if(a&&e===`fill`&&t===a.pastel)return a.fill;if(e===`stroke`)return r(t);if(e===`fill`){if(n===`paper`)return i(t);if(n===`ink`)return r(t)}return t}var Mi=RegExp(`<(?:${[`strong`,`em`,`u`,`s`,`code`,`mark`,`a`,`span`,`i`,`b`,`del`,`strike`,`ul`,`ol`,`li`,`br`,`div`,`p`].join(`|`)})\\b`,`i`);function Ni(e){return Mi.test(e)}function Pi(e){return e.replace(/\u200B/g,``).replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`)}function Fi(e){return Pi(e).replace(/"/g,`"`)}function Ii(e){return`<ul>${e.map(e=>`<li>${Pi(e)}</li>`).join(``)}</ul>`}function Li(e){if(!e)return null;let t=e.trim().match(/^(\d+(?:\.\d+)?)px$/);if(!t)return null;let n=Math.round(Number(t[1]));return n<8||n>240?null:n}function Ri(e,t){return t===1?e:e.replace(/font-size:\s*(\d+(?:\.\d+)?)px/gi,(e,n)=>`font-size:${Math.round(a(Number(n)*t,8,240))}px`)}function zi(e){if(!e)return null;let t=e.trim().toLowerCase();return/^#[0-9a-f]{3,8}$/.test(t)||/^rgba?\([\d.,\s%/]+\)$/.test(t)?t:null}function Bi(e){let t=``;return e.childNodes.forEach(e=>{t+=Hi(e)}),t}function Vi(e){let t=e.tagName.toLowerCase()===`ol`?`ol`:`ul`,n=t===`ul`&&e.hasAttribute(`data-checklist`),r=``;return e.childNodes.forEach(e=>{if(e.nodeType===1&&e.tagName.toLowerCase()===`li`){let t=n&&e.hasAttribute(`data-checked`);r+=`<li${t?` data-checked="true"`:``}>${Bi(e)}</li>`}}),r?`<${t}${n?` data-checklist="true"`:``}>${r}</${t}>`:``}function Hi(e){if(e.nodeType===3)return Pi(e.nodeValue??``);if(e.nodeType!==1)return``;let t=e,n=t.tagName.toLowerCase();if(n===`br`)return`<br>`;let r=Bi(t);if(n===`em`||n===`i`)return r?`<em>${r}</em>`:``;if(n===`code`)return r?`<code>${r}</code>`:``;if(n===`mark`)return r?`<mark>${r}</mark>`:``;if(n===`b`||n===`strong`)return r?`<strong>${r}</strong>`:``;if(n===`u`)return r?`<u>${r}</u>`:``;if(n===`s`||n===`del`||n===`strike`)return r?`<s>${r}</s>`:``;if(n===`a`){let e=ni(t.getAttribute(`href`));return e&&r?`<a href="${Fi(e)}">${r}</a>`:r}if(n===`ul`||n===`ol`)return Vi(t);if(n===`span`){if(!r)return``;let e=r,n=t.style;n.fontStyle===`italic`&&(e=`<em>${e}</em>`),`${n.textDecorationLine} ${n.textDecoration}`.includes(`line-through`)&&(e=`<s>${e}</s>`),zi(n.backgroundColor)&&(e=`<mark>${e}</mark>`);let i=zi(n.color);i&&(e=`<span style="color:${i}">${e}</span>`);let a=Li(n.fontSize);return a&&(e=`<span style="font-size:${a}px">${e}</span>`),e}return r}function Z(e){let t=``,n=()=>t===``||/(?:<br>|\n|<\/ul>|<\/ol>)$/.test(t),r=()=>{n()||(t+=`<br>`)};return e.childNodes.forEach(e=>{if(e.nodeType===1){let n=e.tagName.toLowerCase();if(n===`div`||n===`p`){r(),t+=Bi(e);return}if(n===`ul`||n===`ol`){t+=Vi(e);return}}t+=Hi(e)}),t}function Ui(){return Promise.resolve()}function Wi(){return globalThis.DOMParser!==void 0}function Gi(e){let t=globalThis.DOMParser;if(!t)throw Error(`No HTML parser available: this environment has no global DOMParser. Install one with setHtmlParser (see @koboyo/renderer/adapters/node).`);return new t().parseFromString(e,`text/html`).body}function Q(e){return Gi(e)}function Ki(e){return Z(Q(e))}function qi(e){return e?Ni(e)?Ki(e).replaceAll(`<a href="`,`<a target="_blank" rel="noopener noreferrer" href="`).replace(/<span style="color:([^"]+)">/g,(e,t)=>{let n=mi(Ji(t));return n.startsWith(`token:`)?`<span data-ink="${n.slice(6)}" style="color:${t}">`:e}):Pi(e):``}function Ji(e){let t=/^rgba?\((\d+),\s*(\d+),\s*(\d+)\)$/.exec(e);return t?`#${t.slice(1).map(e=>Number(e).toString(16).padStart(2,`0`)).join(``)}`:e}function Yi(e,t=0){let n=``;return e.childNodes.forEach(e=>{if(e.nodeType===3){n+=(e.nodeValue??``).replace(/\u200B/g,``);return}if(e.nodeType!==1)return;let r=e,i=r.tagName.toLowerCase();if(i===`br`){n+=`
|
|
2
|
+
`;return}if(i===`li`){n&&!n.endsWith(`
|
|
3
|
+
`)&&(n+=`
|
|
4
|
+
`);let e=r.parentElement?.hasAttribute(`data-checklist`)?r.hasAttribute(`data-checked`)?`☑`:`☐`:`•`;n+=`${` `.repeat(Math.max(0,t-1))}${e} ${Yi(r,t)}`;return}if(i===`div`||i===`p`||i===`ul`||i===`ol`){n&&!n.endsWith(`
|
|
5
|
+
`)&&(n+=`
|
|
6
|
+
`),n+=Yi(r,i===`ul`||i===`ol`?t+1:t);return}n+=Yi(r,t)}),n}function Xi(e){return e?Ni(e)?Yi(Q(e)):e:``}function Zi(e){return Xi(e).trim().length===0}function Qi(e){return Ni(e)?e.replace(/\u200B/g,``).replace(/<(?:br|\/li|\/div|\/p|\/ul|\/ol)[^>]*>/gi,`
|
|
7
|
+
`).replace(/<li[^>]*>/gi,`• `).replace(/<[^>]+>/g,``).replace(/&[a-z#0-9]+;/gi,`*`).replace(/\n+/g,`
|
|
8
|
+
`).replace(/^\n|\n$/g,``):e}function $i(e){return Wi()?Xi(e):Qi(e)}function ea(e){if(!e||!Ni(e))return e;let t=Q(e);return t.querySelectorAll(`span`).forEach(e=>{e.style.color=``}),Z(t)}function ta(e,t){let n=Q(qi(e)),r=n.querySelectorAll(`ul[data-checklist] > li`)[t];return r?(r.hasAttribute(`data-checked`)?r.removeAttribute(`data-checked`):r.setAttribute(`data-checked`,`true`),Z(n)):null}function na(e,t){let n=e=>t===`strong`?e.bold:t===`em`?e.italic:t===`u`?e.underline:e.strike,r=!1;for(let t of sa(e))for(let e of t.runs)if(e.text.trim()!==``&&(r=!0,!n(e)))return!1;return r}function ra(e,t){let n=e.parentElement;for(;n;){if(n.tagName.toLowerCase()===t)return!0;n=n.parentElement}return!1}function ia(e,t,n){if(n)return aa(e,t)??e;let r=Q(qi(e));return r.querySelectorAll(t).forEach(e=>{let t=e.parentNode;if(t){for(;e.firstChild;)t.insertBefore(e.firstChild,e);t.removeChild(e)}}),Z(r)}function aa(e,t,n={}){let r=Q(qi(e)),i=[],a=e=>{e.childNodes.forEach(e=>{e.nodeType===3?(e.nodeValue??``).length>0&&i.push(e):e.nodeType===1&&a(e)})};a(r);let o=0,s=1/0;if(n.match!==void 0){let e=i.map(e=>e.nodeValue??``).join(``),t=n.match?e.toLowerCase().indexOf(n.match.toLowerCase()):-1;if(t<0)return null;o=t,s=t+n.match.length}let c=r.ownerDocument;if(!c)return Z(r);let l=0;for(let e of i){let r=e.nodeValue??``,i=Math.max(0,o-l),a=Math.min(r.length,s-l);l+=r.length;let u=e.parentNode;if(i>=a||!u||t!==`span`&&ra(e,t))continue;let d=c.createElement(t);for(let[e,t]of Object.entries(n.attributes??{}))d.setAttribute(e,t);d.appendChild(c.createTextNode(r.slice(i,a))),i>0&&u.insertBefore(c.createTextNode(r.slice(0,i)),e),u.insertBefore(d,e),a<r.length&&u.insertBefore(c.createTextNode(r.slice(a)),e),u.removeChild(e)}return Z(r)}var oa={bold:!1,italic:!1,underline:!1,strike:!1,code:!1,highlight:!1};function sa(e){let t=Q(qi(e)),n=[{runs:[]}],r=0,i=(e,t)=>{n.push({runs:[],marker:e,checked:t||void 0,depth:r||void 0})},a=(e,t)=>{let a=n[n.length-1];if(a.runs.length===0&&!a.marker){a.marker=e,a.checked=t||void 0,a.depth=r||void 0;return}i(e,t)},o=(e,t)=>{e.split(`
|
|
9
|
+
`).forEach((e,r)=>{r>0&&i(),e&&n[n.length-1].runs.push({text:e,...t})})},s=(e,t)=>{e.childNodes.forEach(e=>{if(e.nodeType===3){o((e.nodeValue??``).replace(/\u200B/g,``),t);return}if(e.nodeType!==1)return;let c=e,l=c.tagName.toLowerCase();if(l===`br`){i();return}if(l===`em`||l===`i`){s(c,{...t,italic:!0});return}if(l===`strong`||l===`b`){s(c,{...t,bold:!0});return}if(l===`u`){s(c,{...t,underline:!0});return}if(l===`s`||l===`del`||l===`strike`){s(c,{...t,strike:!0});return}if(l===`code`){s(c,{...t,code:!0});return}if(l===`mark`){s(c,{...t,highlight:!0});return}if(l===`a`){s(c,{...t,href:ni(c.getAttribute(`href`))??t.href});return}if(l===`span`){s(c,{...t,color:zi(c.style.color)??t.color,fontSize:Li(c.style.fontSize)??t.fontSize});return}if(l===`ul`||l===`ol`){let e=l===`ul`&&c.hasAttribute(`data-checklist`),n=1;c.childNodes.forEach(i=>{i.nodeType===1&&i.tagName.toLowerCase()===`li`&&(e?a({kind:`checkbox`},i.hasAttribute(`data-checked`)):a(l===`ol`?{kind:`number`,text:`${n++}.`}:{kind:`bullet`}),r+=1,s(i,t),--r)}),i();return}if(l===`div`||l===`p`){(n[n.length-1].runs.length>0||n[n.length-1].marker)&&i(),s(c,t);return}s(c,t)})};for(s(t,oa);n.length>1;){let e=n[n.length-1];if(e.runs.length===0&&!e.marker)n.pop();else break}return n}var ca=`93B[bw]4ABK]0B2IVCVYXUXMVU23]]]OuX_bc]Wec<R[UpefZhbXWcYtTVXBG?PY1TTQUW<US56M4lTTUVAM<SL^KILG3Ga`,la=32,ua=126,da=.55,fa=1;function pa(e){return e>=11904&&e<=42191||e>=44032&&e<=55203||e>=63744&&e<=64255||e>=65280&&e<=65376||e>=126976}function ma(e,t){let n=0;for(let t of e){let e=t.codePointAt(0)??0;if(e>=la&&e<=ua){n+=(ca.charCodeAt(e-la)-32)/100;continue}n+=pa(e)?fa:da}return n*t}var ha={rectangle:{geometry:`box`,color:!0,fill:!0,stroke:!0,dash:!0,font:`stored`,arrowEnds:!1,textField:`label`,edit:`text`,search:`label`,hit:`bounds`,animate:`box`,rotatable:!0},arrow:{geometry:`connector`,color:!0,fill:!1,stroke:!0,dash:!0,font:`optional`,arrowEnds:!0,textField:`label`,edit:`text`,search:`label`,hit:`stroke`,animate:`path`,rotatable:!0},text:{geometry:`text`,color:!0,fill:!1,stroke:!1,dash:!1,font:`stored`,arrowEnds:!1,textField:`text-or-delete`,edit:`text`,search:`text`,hit:`bounds`,animate:`text`,rotatable:!0},sticky:{geometry:`box`,color:!1,fill:!0,stroke:!1,dash:!1,font:`stored`,arrowEnds:!1,textField:`text`,edit:`text`,search:`text`,hit:`bounds`,animate:`text`,rotatable:!0},draw:{geometry:`points`,color:!0,fill:!1,stroke:!0,dash:!1,font:`none`,arrowEnds:!1,textField:`text-or-delete`,edit:`none`,search:`none`,hit:`stroke`,animate:`path`,rotatable:!0},polygon:{geometry:`points`,color:!0,fill:!0,stroke:!0,dash:!1,font:`none`,arrowEnds:!1,textField:`text-or-delete`,edit:`vertices`,search:`none`,hit:`bounds`,animate:`box`,rotatable:!0},line:{geometry:`points`,color:!0,fill:!1,stroke:!0,dash:!0,font:`optional`,arrowEnds:!0,textField:`label`,edit:`none`,search:`label`,hit:`stroke`,animate:`path`,rotatable:!0},image:{geometry:`box`,color:!1,fill:!1,stroke:!1,dash:!1,font:`none`,arrowEnds:!1,textField:`text-or-delete`,edit:`crop`,search:`none`,hit:`bounds`,animate:`box`,rotatable:!0},icon:{geometry:`box`,color:!0,fill:!1,stroke:!0,dash:!1,font:`stored`,arrowEnds:!1,textField:`label`,edit:`none`,search:`label-and-name`,hit:`bounds`,animate:`box`,rotatable:!0},figure:{geometry:`box`,color:!0,fill:!1,stroke:!1,dash:!1,font:`none`,arrowEnds:!1,textField:`label`,edit:`none`,search:`label`,hit:`outline`,animate:`box`,rotatable:!1},table:{geometry:`table`,color:!0,fill:!1,stroke:!1,dash:!1,font:`stored`,arrowEnds:!1,textField:`text-or-delete`,edit:`none`,search:`cells`,hit:`bounds`,animate:`box`,rotatable:!1},chart:{geometry:`box`,color:!0,fill:!1,stroke:!1,dash:!1,font:`stored`,arrowEnds:!1,textField:`text-or-delete`,edit:`none`,search:`cells`,hit:`bounds`,animate:`box`,rotatable:!0},control:{geometry:`box`,color:!0,fill:!1,stroke:!1,dash:!1,font:`stored`,arrowEnds:!1,textField:`label`,edit:`none`,search:`label`,hit:`bounds`,animate:`box`,rotatable:!0},web:{geometry:`box`,color:!1,fill:!1,stroke:!1,dash:!1,font:`none`,arrowEnds:!1,textField:`label`,edit:`interact`,search:`label`,hit:`bounds`,animate:`box`,rotatable:!1}};function ga(e){return e.type===`control`&&e.kind===`lifeline`?!1:ha[e.type].rotatable}function _a(e){return ha[e.type].geometry===`box`}function va(e){return ha[e.type].fill}function ya(e){return e.type===`figure`||e.type===`control`}function ba(e){return{strokeWidth:e.strokeWidth??1.5,dash:e.dash??`solid`}}var xa={fade:[`box`,`path`,`text`],rise:[`box`,`path`,`text`],scale:[`box`,`path`,`text`],pop:[`box`,`path`,`text`],blur:[`box`,`path`,`text`],wipe:[`box`,`path`,`text`],draw:[`path`],type:[`text`],pulse:[`box`,`path`,`text`],shake:[`box`,`path`,`text`],glow:[`box`,`path`,`text`]};function Sa(e,t){return xa[t].includes(ha[e.type].animate)}var Ca={fade:[`enter`,`exit`],rise:[`enter`,`exit`],scale:[`enter`,`exit`],pop:[`enter`],blur:[`enter`,`exit`],wipe:[`enter`,`exit`],draw:[`enter`,`exit`],type:[`enter`,`exit`],pulse:[`emphasis`],shake:[`emphasis`],glow:[`emphasis`]};function wa(e,t){return Ca[e]?.includes(t)??!1}function Ta(e){return e.type===`rectangle`&&e.fill===`transparent`}function Ea(e){throw Error(`Unhandled shape type: ${e.type??`unknown`}`)}function $(e,t){if(_a(e))return{x:Math.min(e.x,e.x+e.width),y:Math.min(e.y,e.y+e.height),width:Math.abs(e.width),height:Math.abs(e.height)};if(e.type===`arrow`)return jt(e);if(e.type===`draw`||e.type===`polygon`||e.type===`line`)return Pr(e.points);if(e.type===`table`)return{x:e.x,y:e.y,width:e.colWidths.reduce((e,t)=>e+t,0),height:e.rowHeights.reduce((e,t)=>e+t,0)};if(e.type===`text`){let n=t?.textBounds(e.id);if(n)return{x:e.x,y:e.y,width:n.width,height:n.height};let r=Qi(e.text).split(`
|
|
10
|
+
`),i=r.reduce((e,t)=>Math.max(e,t.length),0);return{x:e.x,y:e.y,width:e.width??Math.max(i*e.fontSize*.55,e.fontSize),height:Math.max(r.length*e.fontSize*(e.lineHeight??1.15),e.height??0)}}return Ea(e)}function Da(e,t,n){let r=Math.cos(n),i=Math.sin(n),a=e.x-t.x,o=e.y-t.y;return{x:t.x+a*r-o*i,y:t.y+a*i+o*r}}function Oa(e){let t=$(e);return{x:t.x+t.width/2,y:t.y+t.height/2}}function ka(e){return ga(e)&&(_a(e)||e.type===`text`||e.type===`table`)?e.rotation??0:0}function Aa(e){return ga(e)&&(_a(e)||e.type===`text`||e.type===`table`)}function ja(e){return Math.max(2,Math.round(e*.2))}function Ma(e,t){let n=$(e,t);if(e.type===`icon`&&e.label){let r=n.x+n.width/2,i=e.fontSize??36,a,o,s=t?.iconLabelBounds(e.id);if(s)a=s.width,o=s.height;else{let t=$i(e.label).split(`
|
|
11
|
+
`),n=Math.max(i*.58,...t.map(e=>ma(e,i)));a=Math.min(n,200),o=Math.round(i*1.45+(t.length-1)*i*Yr)}let c=Math.min(n.x,r-a/2),l=Math.max(n.x+n.width,r+a/2),u=n.y+n.height+ja(i)+o;return{x:c,y:n.y,width:l-c,height:u-n.y}}return n}var Na=new WeakMap;function Pa(e){return e.type===`text`||e.type===`icon`&&!!e.label}function Fa(e,t){if(Pa(e))return Ia(e,t);let n=Na.get(e);if(n)return n;let r=Ia(e);return Na.set(e,r),r}function Ia(e,t){let n=Ma(e,t),r=ka(e);if(!r)return n;let i=$(e,t);return La(n,{x:i.x+i.width/2,y:i.y+i.height/2},r*Math.PI/180)}function La(e,t,n){let r=[{x:e.x,y:e.y},{x:e.x+e.width,y:e.y},{x:e.x+e.width,y:e.y+e.height},{x:e.x,y:e.y+e.height}].map(e=>Da(e,t,n)),i=r.map(e=>e.x),a=r.map(e=>e.y),o=Math.min(...i),s=Math.min(...a);return{x:o,y:s,width:Math.max(...i)-o,height:Math.max(...a)-s}}function Ra(e,t){if(!t)return e;let n=t*Math.PI/180;return La(e,{x:e.x+e.width/2,y:e.y+e.height/2},n)}var za=new WeakMap;function Ba(e){let t=za.get(e);if(t)return t;let n=Va(e);return za.set(e,n),n}function Va(e){return Ra($(e),ka(e))}function Ha(e){return Number.isFinite(ka(e))&&o($(e))}function Ua(e){for(let t of e)if(!Ha(t))return e.filter(Ha);return e}function Wa(e,t){if(e.length===0)return null;let n=1/0,r=1/0,i=-1/0,a=-1/0;for(let s of e){let e=Fa(s,t);o(e)&&(n=Math.min(n,e.x),r=Math.min(r,e.y),i=Math.max(i,e.x+e.width),a=Math.max(a,e.y+e.height))}return n===1/0?null:{x:n,y:r,width:i-n,height:a-r}}function Ga(e){return{x:e.includes(`e`)?1:e.includes(`w`)?-1:0,y:e.includes(`s`)?1:e.includes(`n`)?-1:0}}function Ka(e,t,n){return Math.max(0,(e-t)*n)}function qa(e,t,n,r){let i=e.x,a=e.y,o=e.x+e.width,s=e.y+e.height;t.includes(`w`)&&(i=n.x),t.includes(`e`)&&(o=n.x),t.includes(`n`)&&(a=n.y),t.includes(`s`)&&(s=n.y);let c=r?.width??0,l=r?.height??0;return o-i<c&&(t.includes(`w`)?i=o-c:o=i+c),s-a<l&&(t.includes(`n`)?a=s-l:s=a+l),{x:Math.min(i,o),y:Math.min(a,s),width:Math.abs(o-i),height:Math.abs(s-a)}}function Ja(e,t,n,r,i=!1){let{box:o,fontSize:s,width:c,height:l}=r,u=o.x+o.width/2,d=o.y+o.height/2,f=Ga(t);if(t===`n`||t===`s`){let r=t===`s`?o.y:o.y+o.height,i=Math.max(s,Ka(n.y,r,f.y));return{...e,y:f.y===1?r:r-i,height:i}}if(t===`w`||t===`e`){if(i){let t=Math.abs(n.x-u);return{...e,x:u-t,width:Math.max(s,t*2)}}let r=t===`e`?o.x:o.x+o.width,a=Math.max(s,Ka(n.x,r,f.x));return{...e,x:f.x===1?r:r-a,width:a}}let p=t===`ne`||t===`se`?o.x:o.x+o.width,m=t===`sw`||t===`se`?o.y:o.y+o.height,h=a(s*(i?Math.max(Math.abs(n.x-u)/(o.width/2||1),Math.abs(n.y-d)/(o.height/2||1)):Math.max(Ka(n.x,p,f.x)/(o.width||1),Ka(n.y,m,f.y)/(o.height||1))),8,240),g=h/s,_=o.width*g,v=o.height*g,y={...e,fontSize:h,text:Ri(e.text,g)};return i?(y.x=u-_/2,y.y=d-v/2):(y.x=p===o.x?o.x:p-_,y.y=m===o.y?o.y:m-v),c!=null&&(y.width=c*g),l!=null&&(y.height=l*g),y}function Ya(e){return e.height==null?e.width==null?`auto-width`:`auto-height`:`fixed`}function Xa(e,t){let n=$(e);if(t===`auto-width`){if(e.width==null&&e.height==null)return e;let t={...e};return delete t.width,delete t.height,t}if(t===`auto-height`){if(e.width!=null&&e.height==null)return e;let t={...e};return delete t.height,t.width??=n.width,t}return e.width!=null&&e.height!=null?e:{...e,width:e.width??n.width,height:e.height??n.height}}function Za(e,t){if(e.type===`arrow`){let n={...e,x:e.x+t.x,y:e.y+t.y,x2:e.x2+t.x,y2:e.y2+t.y};return e.elbowPoints&&(n.elbowPoints=e.elbowPoints.map(e=>({x:e.x+t.x,y:e.y+t.y}))),e.elbowRoute&&(n.elbowRoute=e.elbowRoute.map(e=>({x:e.x+t.x,y:e.y+t.y}))),e.elbowMidHandle&&(n.elbowMidHandle={...e.elbowMidHandle,x:e.elbowMidHandle.x+t.x,y:e.elbowMidHandle.y+t.y}),n}return e.type===`draw`||e.type===`polygon`||e.type===`line`?{...e,points:e.points.map(e=>({x:e.x+t.x,y:e.y+t.y}))}:_a(e)||e.type===`text`||e.type===`table`?{...e,x:e.x+t.x,y:e.y+t.y}:Ea(e)}function Qa(e,t,n){if(e.type===`arrow`){let r=Da({x:e.x,y:e.y},t,n),i=Da({x:e.x2,y:e.y2},t,n);return{...e,x:r.x,y:r.y,x2:i.x,y2:i.y,elbowPoints:void 0,elbowRoute:void 0,elbowMidHandle:void 0}}if(e.type===`draw`||e.type===`polygon`||e.type===`line`)return{...e,points:e.points.map(e=>Da(e,t,n))};let r=$(e),i=Da({x:r.x+r.width/2,y:r.y+r.height/2},t,n),a={...e,x:i.x-r.width/2,y:i.y-r.height/2};return ga(e)?{...a,rotation:(e.rotation??0)+n*180/Math.PI}:a}function $a(e,t,n,r){let i=e=>t.x+(e-t.x)*n,a=e=>t.y+(e-t.y)*r;if(e.type===`arrow`)return{...e,x:i(e.x),y:a(e.y),x2:i(e.x2),y2:a(e.y2),bend:e.bend*(n+r)*.5,bow:e.bow==null?e.bow:e.bow*(n+r)*.5,elbowPoints:e.elbowPoints?.map(e=>({x:i(e.x),y:a(e.y)})),elbowRoute:void 0,elbowMidHandle:void 0};if(e.type===`text`){let t={...e,x:i(e.x),y:a(e.y),fontSize:e.fontSize*r,text:Ri(e.text,r)};return e.width!=null&&(t.width=e.width*n),t}if(e.type===`draw`||e.type===`polygon`||e.type===`line`)return{...e,points:e.points.map(e=>({x:i(e.x),y:a(e.y)}))};if(e.type===`table`)return{...e,x:i(e.x),y:a(e.y),colWidths:e.colWidths.map(e=>e*n),rowHeights:e.rowHeights.map(e=>e*r)};if(e.type===`sticky`){let t=$(e),n=i(t.x+t.width/2),r=a(t.y+t.height/2);return{...e,x:n-t.width/2,y:r-t.height/2}}if(e.type===`icon`){let t=$(e),o=(n+r)/2;return{...e,x:i(t.x),y:a(t.y),width:t.width*o,height:t.height*o,fontSize:e.fontSize*o}}let o=$(e);return{...e,x:i(o.x),y:a(o.y),width:o.width*n,height:o.height*r}}function eo(e,t){let n=Wa(e);if(!n)return e;let r=t===`horizontal`,i=new Set(e.map(e=>e.id)),a=n.x+n.width/2,o=n.y+n.height/2,s=e=>r?2*a-e:e,c=e=>r?e:2*o-e,l=e=>({x:s(e.x),y:c(e.y)});return e.map(e=>{if(e.type===`arrow`){let t=l({x:e.x,y:e.y}),n=l({x:e.x2,y:e.y2});return{...e,x:t.x,y:t.y,x2:n.x,y2:n.y,bend:-e.bend,bow:e.bow==null?e.bow:-e.bow,elbowPoints:e.elbowPoints?.map(l),elbowRoute:void 0,elbowMidHandle:void 0,startBinding:ro(e.startBinding,i,r),endBinding:ro(e.endBinding,i,r)}}if(e.type===`polygon`&&e.band)return{...e,points:e.points.map(l),band:io(e.band,i,r)};if(e.type===`draw`||e.type===`polygon`||e.type===`line`)return{...e,points:e.points.map(l)};let t=$(e),n=l({x:t.x+t.width/2,y:t.y+t.height/2}),a={...e,x:n.x-t.width/2,y:n.y-t.height/2,rotation:-ka(e)};if(a.type===`text`||a.type===`icon`||a.type===`image`)return{...a,flipX:r?!a.flipX:a.flipX,flipY:r?a.flipY:!a.flipY};if(a.type===`rectangle`){let e=Hn(a.kind),t=r&&e.x?!a.flipX:a.flipX,n=!r&&e.y?!a.flipY:a.flipY;return{...a,flipX:t||void 0,flipY:n||void 0}}return a})}var to={n:`n`,s:`s`,e:`w`,w:`e`,ne:`nw`,nw:`ne`,se:`sw`,sw:`se`},no={n:`s`,s:`n`,e:`e`,w:`w`,ne:`se`,se:`ne`,nw:`sw`,sw:`nw`};function ro(e,t,n){if(!e)return e;if(!t.has(e.shapeId))return null;if(`kind`in e)return e;let r=n?{x:1-e.anchor.x,y:e.anchor.y}:{x:e.anchor.x,y:1-e.anchor.y};if(!e.port)return{...e,anchor:r};let i=n?to:no;return{...e,anchor:r,port:i[e.port]}}function io(e,t,n){if(!(!t.has(e.from)||!t.has(e.to)))return n?{from:e.to,to:e.from,fromTop:e.toTop,fromSpan:e.toSpan,toTop:e.fromTop,toSpan:e.fromSpan}:{...e,fromTop:1-e.fromTop-e.fromSpan,toTop:1-e.toTop-e.toSpan}}function ao(e,t){return e.map(e=>({...e,steps:e.steps.flatMap(e=>{let n=t(e.target);if(!n)return[];let r={...e,target:n};if(e.also){let n=e.also.flatMap(e=>t(e)??[]);n.length>0?r.also=n:delete r.also}return[r]})}))}var oo={width:160,height:100};function so(e){return e===`drawnicons`?96:55}function co(e,t){return!Number.isFinite(t)||t<=0||t===1?{width:e,height:e}:t>1?{width:e,height:e/t}:{width:e*t,height:e}}function lo(e,t){return Math.max(0,t)/55*e}function uo(e,t){return(e-3)*(Math.max(0,t)/55)}function fo(e){return e===`ellipse`?{width:120,height:120}:e===`checkbox`||e===`crossbox`||e===`heart`||e===`plus`?{width:110,height:110}:e===`arrow-up`||e===`arrow-down`?{width:100,height:160}:e===`bolt`?{width:110,height:150}:e===`actor`?{width:100,height:150}:e===`arrow-left`||e===`arrow-right`?{width:160,height:100}:e===`queue`?{width:170,height:80}:e===`callout`?{width:180,height:90}:e===`double-circle`?{width:120,height:120}:e===`fork-join`?{width:160,height:26}:oo}function po(){return typeof crypto<`u`&&`randomUUID`in crypto?crypto.randomUUID():`shape-${Date.now()}-${Math.floor(Math.random()*1e6)}`}function mo(e){return{id:po(),type:`rectangle`,kind:`rectangle`,rotation:0,label:``,fontSize:16,fontFamily:f,color:s,fill:`transparent`,strokeWidth:1.5,dash:`solid`,opacity:1,...e}}function ho(e,t){if(!e)return null;let n=t.get(e.shapeId);return n?{...e,shapeId:n}:null}function go(e,t){let n=new Map,r=new Map,i=new Map,a=new Map;for(let t of e)n.set(t.id,po()),t.groupId&&i.set(t.groupId,(i.get(t.groupId)??0)+1),t.groupId&&!r.has(t.groupId)&&r.set(t.groupId,po()),t.lockId&&!a.has(t.lockId)&&a.set(t.lockId,po());return e.map(e=>{let o={...Za(e,t),id:n.get(e.id)};return o.groupId&&=(i.get(o.groupId)??0)>1?r.get(o.groupId):void 0,o.lockId&&=a.get(o.lockId),o.type===`arrow`&&(o.startBinding=ho(o.startBinding,n),o.endBinding=ho(o.endBinding,n)),o.type===`figure`&&o.flows&&(o.flows=ao(o.flows,e=>n.get(e))),o})}function _o(e,t){let n=e.width/(t.width||1),r=e.height/(t.height||1);return{x:e.x-t.x*n,y:e.y-t.y*r,width:n,height:r}}var vo=2;function yo(e,t){return e===`rounded`?Math.min(12,Math.abs(t.width)/2,Math.abs(t.height)/2):vo}export{Ni as $,Wn as $t,Da as A,ri as At,_a as B,Hr as Bt,Wa as C,Ge as Cn,xi as Ct,Ha as D,y as Dn,ci as Dt,Ma as E,h as En,ui as Et,Ua as F,Yr as Ft,va as G,Mr as Gt,ga as H,ti as Ht,Ea as I,Xr as It,Ii as J,Vt as Jt,ma as K,Ar as Kt,ha as L,Zr as Lt,Oa as M,Wr as Mt,ka as N,Qr as Nt,Aa as O,li as Ot,Fa as P,$r as Pt,Wi as Q,U as Qt,wa as R,Kr as Rt,La as S,We as Sn,vi as St,Pa as T,ze as Tn,ji as Tt,ba as U,kr as Ut,Ta as V,Jr as Vt,Sa as W,Nr as Wt,Ui as X,Rn as Xt,Ji as Y,Ut as Yt,Pi as Z,zn as Zt,Ja as _,yt as _n,Oi as _t,fo as a,Mt as an,Zi as at,Xa as b,$e as bn,hi as bt,yo as c,ut as cn,ea as ct,ao as d,Dt as dn,si as dt,Un as en,na as et,Ka as f,rt as fn,X as ft,qa as g,_t as gn,mi as gt,Za as h,Ct as hn,_i as ht,so as i,B as in,qi as it,$ as j,ni as jt,ja as k,ii as kt,_o as l,L as ln,ta as lt,Ga as m,Tt as mn,gi as mt,po as n,Nt as nn,sa as nt,co as o,St as on,Xi as ot,eo as p,nt as pn,Ai as pt,ia as q,Or as qt,mo as r,Pt as rn,$i as rt,lo as s,z as sn,Ki as st,go as t,Wt as tn,Gi as tt,uo as u,st as un,ai as ut,Qa as v,Qe as vn,wi as vt,Ba as w,Ue as wn,di as wt,Ya as x,S as xn,Di as xt,$a as y,bt as yn,yi as yt,ya as z,Gr as zt};
|
package/assets/editor/assets/{slide-notes-dialog-BQBXpep6.js → slide-notes-dialog-43EMJFJV.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{t}from"./react-lCSYwAWP.js";import{t as n}from"./jsx-runtime-DKdBMi_L.js";import{o as r,s as i}from"./editor-
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{t}from"./react-lCSYwAWP.js";import{t as n}from"./jsx-runtime-DKdBMi_L.js";import{o as r,s as i}from"./editor-DAJETlQW.js";import{A as a,f as o,i as s}from"./slides-DDNzjFz9.js";import{t as c}from"./IconX-KrRqxr2j.js";import{i as l,n as u,r as d,t as f}from"./DialogRoot-DUeVfNhS.js";import{n as p,t as m}from"./DialogTitle-D5au2NAn.js";var h=e(t(),1),g=n();function _(){let e=i(),t=r(e=>e.notesEditorId),n=r(e=>e.shapes),[_,v]=(0,h.useState)(``),y=s(n),b=y.findIndex(e=>e.id===t),x=b>=0?y[b]:null;(0,h.useEffect)(()=>{if(!t)return;let n=a(e.getState().shapes,t);v(n?.type===`figure`?n.notes??``:``)},[t,e]);function S(){let t=e.getState(),n=t.shapes.find(e=>e.id===t.notesEditorId),r=_.trim(),i=r.length>0?r:void 0;n?.type===`figure`&&n.notes!==i&&t.updateShape(n.id,{notes:i}),t.setNotesEditorId(null)}return(0,g.jsx)(f,{open:x!==null,onOpenChange:e=>{e||S()},children:(0,g.jsxs)(u,{children:[(0,g.jsx)(l,{className:`fixed inset-0 bg-gray-900/15`}),(0,g.jsxs)(d,{"data-overlay":!0,"data-testid":`slide-notes-dialog`,className:`fixed left-1/2 top-1/2 w-[min(480px,92vw)] -translate-x-1/2 -translate-y-1/2 rounded-2xl bg-[var(--chrome-popup)] p-4 shadow-[0_24px_70px_rgba(0,0,0,0.22)] outline-none ring-1 ring-[var(--chrome-ring)]`,children:[(0,g.jsxs)(`div`,{className:`mb-2.5 flex items-center justify-between`,children:[(0,g.jsxs)(m,{className:`text-[14px] text-[var(--chrome-fg-900)]`,children:[`Speaker notes — `,x?o(x,b):``]}),(0,g.jsx)(p,{"aria-label":`Close`,className:`-mr-1 flex h-7 w-7 items-center justify-center rounded-full text-[var(--chrome-fg-400)] outline-none transition-colors hover:bg-[var(--chrome-divider)] hover:text-[var(--chrome-fg-600)]`,children:(0,g.jsx)(c,{size:16,stroke:1.75})})]}),(0,g.jsx)(`textarea`,{autoFocus:!0,value:_,placeholder:`What you'll say on this slide: context, the story, the segue…`,"data-testid":`slide-notes-input`,onChange:e=>v(e.target.value),onKeyDown:e=>{e.stopPropagation(),e.key===`Escape`&&S()},className:`h-36 w-full resize-none rounded-lg bg-[var(--chrome-rest)] p-3 text-[13px] leading-relaxed text-[var(--chrome-fg-800)] outline-none ring-1 ring-[var(--chrome-ring)] placeholder:text-[var(--chrome-fg-400)]`}),(0,g.jsxs)(`div`,{className:`mt-3 flex justify-between`,children:[(0,g.jsx)(`span`,{className:`self-center text-[11px] text-[var(--chrome-fg-400)]`,children:`Shown to you while presenting (press N)`}),(0,g.jsx)(`button`,{type:`button`,"data-testid":`slide-notes-done`,onClick:S,className:`rounded-lg bg-[var(--chrome-accent)] px-3.5 py-1.5 text-[13px] text-white transition-colors hover:bg-[var(--chrome-accent-hover)]`,children:`Done`})]})]})]})})}export{_ as SlideNotesDialog};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{B as e,G as t,H as n,V as r,W as i,X as a,Z as o,et as s,nt as c,r as l,rt as u,s as d,tt as f}from"./style-BENGW2ZV.js";import{$ as p,C as m,Dn as h,En as g,T as _,an as v,bn as ee,dn as y,en as te,ft as ne,in as b,j as x,ln as re,mn as S,n as ie,ot as ae,rn as oe,t as se,vn as ce,w as le}from"./shapes-D5w8NTQQ.js";function ue(e){return f(e,!0)??0}function de(e){return f(e,!1)??0}function fe(e,n){return e.length===0?{x:0,y:0}:c(e,s(e)*t(n??.5)).point}function pe(e){return e.length===0?``:e.reduce((e,t,n)=>e+`${n===0?`M`:`L`} ${t.x} ${t.y} `,``)}function me(e){let t=[];for(let n of e){let e=t[t.length-1];(!e||Math.abs(e.x-n.x)>.01||Math.abs(e.y-n.y)>.01)&&t.push(n)}return t}var he=[`arrow`,`sweep`,`triangle`,`triangleOutline`],ge=[`circle`,`circleOutline`,`diamond`,`diamondOutline`,`bar`,`cross`],_e=[`crowOne`,`crowMany`,`crowOneOrMany`,`crowOnlyOne`,`crowZeroOrOne`,`crowZeroOrMany`];function ve(e){let t={x:Math.cos(e),y:Math.sin(e)};return{dir:t,normal:{x:-t.y,y:t.x}}}function ye(e){let[t,...n]=e;return`M ${t.x} ${t.y} `+n.map(e=>`L ${e.x} ${e.y} `).join(``)+`Z`}function be(e,t){return`M ${e.x-t} ${e.y} a ${t} ${t} 0 1 0 ${t*2} 0 a ${t} ${t} 0 1 0 ${-t*2} 0 Z`}function C(e,t,n,r){let{dir:i,normal:a}=ve(n),o=r,s=e=>({x:t.x-i.x*e,y:t.y-i.y*e}),c=(e,t)=>{let n=s(e),r={x:n.x+a.x*t,y:n.y+a.y*t},i={x:n.x-a.x*t,y:n.y-a.y*t};return`M ${r.x} ${r.y} L ${i.x} ${i.y}`},l=(e,n)=>{let r=s(e),i={x:t.x+a.x*n,y:t.y+a.y*n},o={x:t.x-a.x*n,y:t.y-a.y*n};return`M ${i.x} ${i.y} L ${r.x} ${r.y} L ${o.x} ${o.y}`},u=(e,t=`none`)=>({d:e,fill:t}),d=s(o);switch(e){case`arrow`:return[u(ce(t,n,o))];case`sweep`:return[u(ee(t,n,o))];case`triangle`:case`triangleOutline`:{let n=o*.42;return[u(ye([t,{x:d.x+a.x*n,y:d.y+a.y*n},{x:d.x-a.x*n,y:d.y-a.y*n}]),e===`triangle`?`solid`:`white`)]}case`diamond`:case`diamondOutline`:{let n=o*.34,r=s(o/2);return[u(ye([t,{x:r.x+a.x*n,y:r.y+a.y*n},d,{x:r.x-a.x*n,y:r.y-a.y*n}]),e===`diamond`?`solid`:`white`)]}case`circle`:case`circleOutline`:{let t=o*.4;return[u(be(s(t),t),e===`circle`?`solid`:`white`)]}case`bar`:return[u(c(0,o*.5))];case`cross`:{let e=o*.4,t=t=>{let n=i.x*t+a.x,r=i.y*t+a.y,o=Math.hypot(n,r)||1,c=n/o*e,l=r/o*e,u=s(e);return`M ${u.x-c} ${u.y-l} L ${u.x+c} ${u.y+l}`};return[u(t(1)),u(t(-1))]}case`crowOne`:return[u(c(o*.55,o*.45))];case`crowOnlyOne`:return[u(c(o*.45,o*.45)),u(c(o*.9,o*.45))];case`crowMany`:return[u(l(o,o*.5))];case`crowOneOrMany`:return[u(l(o,o*.5)),u(c(o*1.3,o*.45))];case`crowZeroOrOne`:{let e=o*.3;return[u(c(o*.4,o*.45)),u(be(s(o),e),`white`)]}case`crowZeroOrMany`:{let e=o*.3;return[u(l(o*.85,o*.5)),u(be(s(o*1.4),e),`white`)]}}}function xe(e){let t=[];if(e.endArrow){let n=y(e,`end`);t.push(...C(e.endHead??`arrow`,n.tip,n.angle,n.length))}if(e.startArrow){let n=y(e,`start`);t.push(...C(e.startHead??`arrow`,n.tip,n.angle,n.length))}return t}function Se(e){let t=e.points;if(t.length<2)return[];let n=g(e.strokeWidth),r=s(t),i=[];if(e.endArrow){let a=e.endHead??`arrow`;i.push(...C(a,t[t.length-1],ue(t),h(n,a,r,u(t,!0))))}if(e.startArrow){let a=e.startHead??`arrow`;i.push(...C(a,t[0],de(t),h(n,a,r,u(t,!1))))}return i}function Ce(e,t){return e===`solid`?t:e===`white`?`#ffffff`:`none`}function we(e,t,n){if(e&&e.length){let[r,i]=t,a=Math.PI/180*n,o=Math.cos(a),s=Math.sin(a);for(let t of e){let[e,n]=t;t[0]=(e-r)*o-(n-i)*s+r,t[1]=(e-r)*s+(n-i)*o+i}}}function Te(e,t){return e[0]===t[0]&&e[1]===t[1]}function Ee(e,t,n,r=1){let i=n,a=Math.max(t,.1),o=e[0]&&e[0][0]&&typeof e[0][0]==`number`?[e]:e,s=[0,0];if(i)for(let e of o)we(e,s,i);let c=function(e,t,n){let r=[];for(let t of e){let e=[...t];Te(e[0],e[e.length-1])||e.push([e[0][0],e[0][1]]),e.length>2&&r.push(e)}let i=[];t=Math.max(t,.1);let a=[];for(let e of r)for(let t=0;t<e.length-1;t++){let n=e[t],r=e[t+1];if(n[1]!==r[1]){let e=Math.min(n[1],r[1]);a.push({ymin:e,ymax:Math.max(n[1],r[1]),x:e===n[1]?n[0]:r[0],islope:(r[0]-n[0])/(r[1]-n[1])})}}if(a.sort(((e,t)=>e.ymin<t.ymin?-1:e.ymin>t.ymin?1:e.x<t.x?-1:e.x>t.x?1:e.ymax===t.ymax?0:(e.ymax-t.ymax)/Math.abs(e.ymax-t.ymax))),!a.length)return i;let o=[],s=a[0].ymin,c=0;for(;o.length||a.length;){if(a.length){let e=-1;for(let t=0;t<a.length&&!(a[t].ymin>s);t++)e=t;a.splice(0,e+1).forEach((e=>{o.push({s,edge:e})}))}if(o=o.filter((e=>!(e.edge.ymax<=s))),o.sort(((e,t)=>e.edge.x===t.edge.x?0:(e.edge.x-t.edge.x)/Math.abs(e.edge.x-t.edge.x))),(n!==1||c%t==0)&&o.length>1)for(let e=0;e<o.length;e+=2){let t=e+1;if(t>=o.length)break;let n=o[e].edge,r=o[t].edge;i.push([[Math.round(n.x),s],[Math.round(r.x),s]])}s+=n,o.forEach((e=>{e.edge.x=e.edge.x+n*e.edge.islope})),c++}return i}(o,a,r);if(i){for(let e of o)we(e,s,-i);(function(e,t,n){let r=[];e.forEach((e=>r.push(...e))),we(r,t,n)})(c,s,-i)}return c}function w(e,t){let n=t.hachureAngle+90,r=t.hachureGap;r<0&&(r=4*t.strokeWidth),r=Math.round(Math.max(r,.1));let i=1;return t.roughness>=1&&(t.randomizer?.next()||Math.random())>.7&&(i=r),Ee(e,r,n,i||1)}var De=class{constructor(e){this.helper=e}fillPolygons(e,t){return this._fillPolygons(e,t)}_fillPolygons(e,t){let n=w(e,t);return{type:`fillSketch`,ops:this.renderLines(n,t)}}renderLines(e,t){let n=[];for(let r of e)n.push(...this.helper.doubleLineOps(r[0][0],r[0][1],r[1][0],r[1][1],t));return n}};function T(e){let t=e[0],n=e[1];return Math.sqrt((t[0]-n[0])**2+(t[1]-n[1])**2)}var Oe=class extends De{fillPolygons(e,t){let n=t.hachureGap;n<0&&(n=4*t.strokeWidth),n=Math.max(n,.1);let r=w(e,Object.assign({},t,{hachureGap:n})),i=Math.PI/180*t.hachureAngle,a=[],o=.5*n*Math.cos(i),s=.5*n*Math.sin(i);for(let[e,t]of r)T([e,t])&&a.push([[e[0]-o,e[1]+s],[...t]],[[e[0]+o,e[1]-s],[...t]]);return{type:`fillSketch`,ops:this.renderLines(a,t)}}},ke=class extends De{fillPolygons(e,t){let n=this._fillPolygons(e,t),r=Object.assign({},t,{hachureAngle:t.hachureAngle+90}),i=this._fillPolygons(e,r);return n.ops=n.ops.concat(i.ops),n}},Ae=class{constructor(e){this.helper=e}fillPolygons(e,t){let n=w(e,t=Object.assign({},t,{hachureAngle:0}));return this.dotsOnLines(n,t)}dotsOnLines(e,t){let n=[],r=t.hachureGap;r<0&&(r=4*t.strokeWidth),r=Math.max(r,.1);let i=t.fillWeight;i<0&&(i=t.strokeWidth/2);let a=r/4;for(let o of e){let e=T(o),s=e/r,c=Math.ceil(s)-1,l=e-c*r,u=(o[0][0]+o[1][0])/2-r/4,d=Math.min(o[0][1],o[1][1]);for(let e=0;e<c;e++){let o=d+l+e*r,s=u-a+2*Math.random()*a,c=o-a+2*Math.random()*a,f=this.helper.ellipse(s,c,i,i,t);n.push(...f.ops)}}return{type:`fillSketch`,ops:n}}},je=class{constructor(e){this.helper=e}fillPolygons(e,t){let n=w(e,t);return{type:`fillSketch`,ops:this.dashedLine(n,t)}}dashedLine(e,t){let n=t.dashOffset<0?t.hachureGap<0?4*t.strokeWidth:t.hachureGap:t.dashOffset,r=t.dashGap<0?t.hachureGap<0?4*t.strokeWidth:t.hachureGap:t.dashGap,i=[];return e.forEach((e=>{let a=T(e),o=Math.floor(a/(n+r)),s=(a+r-o*(n+r))/2,c=e[0],l=e[1];c[0]>l[0]&&(c=e[1],l=e[0]);let u=Math.atan((l[1]-c[1])/(l[0]-c[0]));for(let e=0;e<o;e++){let a=e*(n+r),o=a+n,l=[c[0]+a*Math.cos(u)+s*Math.cos(u),c[1]+a*Math.sin(u)+s*Math.sin(u)],d=[c[0]+o*Math.cos(u)+s*Math.cos(u),c[1]+o*Math.sin(u)+s*Math.sin(u)];i.push(...this.helper.doubleLineOps(l[0],l[1],d[0],d[1],t))}})),i}},Me=class{constructor(e){this.helper=e}fillPolygons(e,t){let n=t.hachureGap<0?4*t.strokeWidth:t.hachureGap,r=t.zigzagOffset<0?n:t.zigzagOffset,i=w(e,t=Object.assign({},t,{hachureGap:n+r}));return{type:`fillSketch`,ops:this.zigzagLines(i,r,t)}}zigzagLines(e,t,n){let r=[];return e.forEach((e=>{let i=T(e),a=Math.round(i/(2*t)),o=e[0],s=e[1];o[0]>s[0]&&(o=e[1],s=e[0]);let c=Math.atan((s[1]-o[1])/(s[0]-o[0]));for(let e=0;e<a;e++){let i=2*e*t,a=2*(e+1)*t,s=Math.sqrt(2*t**2),l=[o[0]+i*Math.cos(c),o[1]+i*Math.sin(c)],u=[o[0]+a*Math.cos(c),o[1]+a*Math.sin(c)],d=[l[0]+s*Math.cos(c+Math.PI/4),l[1]+s*Math.sin(c+Math.PI/4)];r.push(...this.helper.doubleLineOps(l[0],l[1],d[0],d[1],n),...this.helper.doubleLineOps(d[0],d[1],u[0],u[1],n))}})),r}},E={},Ne=class{constructor(e){this.seed=e}next(){return this.seed?(2**31-1&(this.seed=Math.imul(48271,this.seed)))/2**31:Math.random()}},Pe=0,Fe=1,Ie=2,D={A:7,a:7,C:6,c:6,H:1,h:1,L:2,l:2,M:2,m:2,Q:4,q:4,S:4,s:4,T:2,t:2,V:1,v:1,Z:0,z:0};function Le(e,t){return e.type===t}function Re(e){let t=[],n=function(e){let t=[];for(;e!==``;)if(e.match(/^([ \t\r\n,]+)/))e=e.substr(RegExp.$1.length);else if(e.match(/^([aAcChHlLmMqQsStTvVzZ])/))t[t.length]={type:Pe,text:RegExp.$1},e=e.substr(RegExp.$1.length);else{if(!e.match(/^(([-+]?[0-9]+(\.[0-9]*)?|[-+]?\.[0-9]+)([eE][-+]?[0-9]+)?)/))return[];t[t.length]={type:Fe,text:`${parseFloat(RegExp.$1)}`},e=e.substr(RegExp.$1.length)}return t[t.length]={type:Ie,text:``},t}(e),r=`BOD`,i=0,a=n[i];for(;!Le(a,Ie);){let o=0,s=[];if(r===`BOD`){if(a.text!==`M`&&a.text!==`m`)return Re(`M0,0`+e);i++,o=D[a.text],r=a.text}else Le(a,Fe)?o=D[r]:(i++,o=D[a.text],r=a.text);if(!(i+o<n.length))throw Error(`Path data ended short`);for(let e=i;e<i+o;e++){let t=n[e];if(!Le(t,Fe))throw Error(`Param not a number: `+r+`,`+t.text);s[s.length]=+t.text}if(typeof D[r]!=`number`)throw Error(`Bad segment: `+r);{let e={key:r,data:s};t.push(e),i+=o,a=n[i],r===`M`&&(r=`L`),r===`m`&&(r=`l`)}}return t}function ze(e){let t=0,n=0,r=0,i=0,a=[];for(let{key:o,data:s}of e)switch(o){case`M`:a.push({key:`M`,data:[...s]}),[t,n]=s,[r,i]=s;break;case`m`:t+=s[0],n+=s[1],a.push({key:`M`,data:[t,n]}),r=t,i=n;break;case`L`:a.push({key:`L`,data:[...s]}),[t,n]=s;break;case`l`:t+=s[0],n+=s[1],a.push({key:`L`,data:[t,n]});break;case`C`:a.push({key:`C`,data:[...s]}),t=s[4],n=s[5];break;case`c`:{let e=s.map(((e,r)=>r%2?e+n:e+t));a.push({key:`C`,data:e}),t=e[4],n=e[5];break}case`Q`:a.push({key:`Q`,data:[...s]}),t=s[2],n=s[3];break;case`q`:{let e=s.map(((e,r)=>r%2?e+n:e+t));a.push({key:`Q`,data:e}),t=e[2],n=e[3];break}case`A`:a.push({key:`A`,data:[...s]}),t=s[5],n=s[6];break;case`a`:t+=s[5],n+=s[6],a.push({key:`A`,data:[s[0],s[1],s[2],s[3],s[4],t,n]});break;case`H`:a.push({key:`H`,data:[...s]}),t=s[0];break;case`h`:t+=s[0],a.push({key:`H`,data:[t]});break;case`V`:a.push({key:`V`,data:[...s]}),n=s[0];break;case`v`:n+=s[0],a.push({key:`V`,data:[n]});break;case`S`:a.push({key:`S`,data:[...s]}),t=s[2],n=s[3];break;case`s`:{let e=s.map(((e,r)=>r%2?e+n:e+t));a.push({key:`S`,data:e}),t=e[2],n=e[3];break}case`T`:a.push({key:`T`,data:[...s]}),t=s[0],n=s[1];break;case`t`:t+=s[0],n+=s[1],a.push({key:`T`,data:[t,n]});break;case`Z`:case`z`:a.push({key:`Z`,data:[]}),t=r,n=i}return a}function Be(e){let t=[],n=``,r=0,i=0,a=0,o=0,s=0,c=0;for(let{key:l,data:u}of e){switch(l){case`M`:t.push({key:`M`,data:[...u]}),[r,i]=u,[a,o]=u;break;case`C`:t.push({key:`C`,data:[...u]}),r=u[4],i=u[5],s=u[2],c=u[3];break;case`L`:t.push({key:`L`,data:[...u]}),[r,i]=u;break;case`H`:r=u[0],t.push({key:`L`,data:[r,i]});break;case`V`:i=u[0],t.push({key:`L`,data:[r,i]});break;case`S`:{let e=0,a=0;n===`C`||n===`S`?(e=r+(r-s),a=i+(i-c)):(e=r,a=i),t.push({key:`C`,data:[e,a,...u]}),s=u[0],c=u[1],r=u[2],i=u[3];break}case`T`:{let[e,a]=u,o=0,l=0;n===`Q`||n===`T`?(o=r+(r-s),l=i+(i-c)):(o=r,l=i);let d=r+2*(o-r)/3,f=i+2*(l-i)/3,p=e+2*(o-e)/3,m=a+2*(l-a)/3;t.push({key:`C`,data:[d,f,p,m,e,a]}),s=o,c=l,r=e,i=a;break}case`Q`:{let[e,n,a,o]=u,l=r+2*(e-r)/3,d=i+2*(n-i)/3,f=a+2*(e-a)/3,p=o+2*(n-o)/3;t.push({key:`C`,data:[l,d,f,p,a,o]}),s=e,c=n,r=a,i=o;break}case`A`:{let e=Math.abs(u[0]),n=Math.abs(u[1]),a=u[2],o=u[3],s=u[4],c=u[5],l=u[6];e===0||n===0?(t.push({key:`C`,data:[r,i,c,l,c,l]}),r=c,i=l):(r!==c||i!==l)&&(Ve(r,i,c,l,e,n,a,o,s).forEach((function(e){t.push({key:`C`,data:e})})),r=c,i=l);break}case`Z`:t.push({key:`Z`,data:[]}),r=a,i=o}n=l}return t}function O(e,t,n){return[e*Math.cos(n)-t*Math.sin(n),e*Math.sin(n)+t*Math.cos(n)]}function Ve(e,t,n,r,i,a,o,s,c,l){let u=(d=o,Math.PI*d/180);var d;let f=[],p=0,m=0,h=0,g=0;if(l)[p,m,h,g]=l;else{[e,t]=O(e,t,-u),[n,r]=O(n,r,-u);let o=(e-n)/2,l=(t-r)/2,d=o*o/(i*i)+l*l/(a*a);d>1&&(d=Math.sqrt(d),i*=d,a*=d);let f=i*i,_=a*a,v=f*_-f*l*l-_*o*o,ee=f*l*l+_*o*o,y=(s===c?-1:1)*Math.sqrt(Math.abs(v/ee));h=y*i*l/a+(e+n)/2,g=y*-a*o/i+(t+r)/2,p=Math.asin(parseFloat(((t-g)/a).toFixed(9))),m=Math.asin(parseFloat(((r-g)/a).toFixed(9))),e<h&&(p=Math.PI-p),n<h&&(m=Math.PI-m),p<0&&(p=2*Math.PI+p),m<0&&(m=2*Math.PI+m),c&&p>m&&(p-=2*Math.PI),!c&&m>p&&(m-=2*Math.PI)}let _=m-p;if(Math.abs(_)>120*Math.PI/180){let e=m,t=n,s=r;m=c&&m>p?p+120*Math.PI/180*1:p+120*Math.PI/180*-1,f=Ve(n=h+i*Math.cos(m),r=g+a*Math.sin(m),t,s,i,a,o,0,c,[m,e,h,g])}_=m-p;let v=Math.cos(p),ee=Math.sin(p),y=Math.cos(m),te=Math.sin(m),ne=Math.tan(_/4),b=4/3*i*ne,x=4/3*a*ne,re=[e,t],S=[e+b*ee,t-x*v],ie=[n+b*te,r-x*y],ae=[n,r];if(S[0]=2*re[0]-S[0],S[1]=2*re[1]-S[1],l)return[S,ie,ae].concat(f);{f=[S,ie,ae].concat(f);let e=[];for(let t=0;t<f.length;t+=3){let n=O(f[t][0],f[t][1],u),r=O(f[t+1][0],f[t+1][1],u),i=O(f[t+2][0],f[t+2][1],u);e.push([n[0],n[1],r[0],r[1],i[0],i[1]])}return e}}var He={randOffset:function(e,t){return M(e,t)},randOffsetWithRange:function(e,t,n){return j(e,t,n)},ellipse:function(e,t,n,r,i){return qe(e,t,i,Ke(n,r,i)).opset},doubleLineOps:function(e,t,n,r,i){return N(e,t,n,r,i,!0)}};function Ue(e,t,n,r,i){return{type:`path`,ops:N(e,t,n,r,i)}}function k(e,t,n){let r=(e||[]).length;if(r>2){let i=[];for(let t=0;t<r-1;t++)i.push(...N(e[t][0],e[t][1],e[t+1][0],e[t+1][1],n));return t&&i.push(...N(e[r-1][0],e[r-1][1],e[0][0],e[0][1],n)),{type:`path`,ops:i}}return r===2?Ue(e[0][0],e[0][1],e[1][0],e[1][1],n):{type:`path`,ops:[]}}function We(e,t,n,r,i){return function(e,t){return k(e,!0,t)}([[e,t],[e+n,t],[e+n,t+r],[e,t+r]],i)}function Ge(e,t){if(e.length){let n=typeof e[0][0]==`number`?[e]:e,r=P(n[0],1*(1+.2*t.roughness),t),i=t.disableMultiStroke?[]:P(n[0],1.5*(1+.22*t.roughness),Ze(t));for(let e=1;e<n.length;e++){let a=n[e];if(a.length){let e=P(a,1*(1+.2*t.roughness),t),n=t.disableMultiStroke?[]:P(a,1.5*(1+.22*t.roughness),Ze(t));for(let t of e)t.op!==`move`&&r.push(t);for(let e of n)e.op!==`move`&&i.push(e)}}return{type:`path`,ops:r.concat(i)}}return{type:`path`,ops:[]}}function Ke(e,t,n){let r=Math.sqrt(2*Math.PI*Math.sqrt(((e/2)**2+(t/2)**2)/2)),i=Math.ceil(Math.max(n.curveStepCount,n.curveStepCount/Math.sqrt(200)*r)),a=2*Math.PI/i,o=Math.abs(e/2),s=Math.abs(t/2),c=1-n.curveFitting;return o+=M(o*c,n),s+=M(s*c,n),{increment:a,rx:o,ry:s}}function qe(e,t,n,r){let[i,a]=et(r.increment,e,t,r.rx,r.ry,1,r.increment*j(.1,j(.4,1,n),n),n),o=F(i,null,n);if(!n.disableMultiStroke&&n.roughness!==0){let[i]=et(r.increment,e,t,r.rx,r.ry,1.5,0,n),a=F(i,null,n);o=o.concat(a)}return{estimatedPoints:a,opset:{type:`path`,ops:o}}}function Je(e,t,n,r,i,a,o,s,c){let l=e,u=t,d=Math.abs(n/2),f=Math.abs(r/2);d+=M(.01*d,c),f+=M(.01*f,c);let p=i,m=a;for(;p<0;)p+=2*Math.PI,m+=2*Math.PI;m-p>2*Math.PI&&(p=0,m=2*Math.PI);let h=2*Math.PI/c.curveStepCount,g=Math.min(h/2,(m-p)/2),_=tt(g,l,u,d,f,p,m,1,c);if(!c.disableMultiStroke){let e=tt(g,l,u,d,f,p,m,1.5,c);_.push(...e)}return o&&(s?_.push(...N(l,u,l+d*Math.cos(p),u+f*Math.sin(p),c),...N(l,u,l+d*Math.cos(m),u+f*Math.sin(m),c)):_.push({op:`lineTo`,data:[l,u]},{op:`lineTo`,data:[l+d*Math.cos(p),u+f*Math.sin(p)]})),{type:`path`,ops:_}}function Ye(e,t){let n=Be(ze(Re(e))),r=[],i=[0,0],a=[0,0];for(let{key:e,data:o}of n)switch(e){case`M`:a=[o[0],o[1]],i=[o[0],o[1]];break;case`L`:r.push(...N(a[0],a[1],o[0],o[1],t)),a=[o[0],o[1]];break;case`C`:{let[e,n,i,s,c,l]=o;r.push(...nt(e,n,i,s,c,l,a,t)),a=[c,l];break}case`Z`:r.push(...N(a[0],a[1],i[0],i[1],t)),a=[i[0],i[1]]}return{type:`path`,ops:r}}function Xe(e,t){let n=[];for(let r of e)if(r.length){let e=t.maxRandomnessOffset||0,i=r.length;if(i>2){n.push({op:`move`,data:[r[0][0]+M(e,t),r[0][1]+M(e,t)]});for(let a=1;a<i;a++)n.push({op:`lineTo`,data:[r[a][0]+M(e,t),r[a][1]+M(e,t)]})}}return{type:`fillPath`,ops:n}}function A(e,t){return function(e,t){let n=e.fillStyle||`hachure`;if(!E[n])switch(n){case`zigzag`:E[n]||(E[n]=new Oe(t));break;case`cross-hatch`:E[n]||(E[n]=new ke(t));break;case`dots`:E[n]||(E[n]=new Ae(t));break;case`dashed`:E[n]||(E[n]=new je(t));break;case`zigzag-line`:E[n]||(E[n]=new Me(t));break;default:n=`hachure`,E[n]||(E[n]=new De(t))}return E[n]}(t,He).fillPolygons(e,t)}function Ze(e){let t=Object.assign({},e);return t.randomizer=void 0,e.seed&&(t.seed=e.seed+1),t}function Qe(e){return e.randomizer||=new Ne(e.seed||0),e.randomizer.next()}function j(e,t,n,r=1){return n.roughness*r*(Qe(n)*(t-e)+e)}function M(e,t,n=1){return j(-e,e,t,n)}function N(e,t,n,r,i,a=!1){let o=a?i.disableMultiStrokeFill:i.disableMultiStroke,s=$e(e,t,n,r,i,!0,!1);if(o)return s;let c=$e(e,t,n,r,i,!0,!0);return s.concat(c)}function $e(e,t,n,r,i,a,o){let s=(e-n)**2+(t-r)**2,c=Math.sqrt(s),l=1;l=c<200?1:c>500?.4:-.0016668*c+1.233334;let u=i.maxRandomnessOffset||0;u*u*100>s&&(u=c/10);let d=u/2,f=.2+.2*Qe(i),p=i.bowing*i.maxRandomnessOffset*(r-t)/200,m=i.bowing*i.maxRandomnessOffset*(e-n)/200;p=M(p,i,l),m=M(m,i,l);let h=[],g=()=>M(d,i,l),_=()=>M(u,i,l),v=i.preserveVertices;return a&&(o?h.push({op:`move`,data:[e+(v?0:g()),t+(v?0:g())]}):h.push({op:`move`,data:[e+(v?0:M(u,i,l)),t+(v?0:M(u,i,l))]})),o?h.push({op:`bcurveTo`,data:[p+e+(n-e)*f+g(),m+t+(r-t)*f+g(),p+e+2*(n-e)*f+g(),m+t+2*(r-t)*f+g(),n+(v?0:g()),r+(v?0:g())]}):h.push({op:`bcurveTo`,data:[p+e+(n-e)*f+_(),m+t+(r-t)*f+_(),p+e+2*(n-e)*f+_(),m+t+2*(r-t)*f+_(),n+(v?0:_()),r+(v?0:_())]}),h}function P(e,t,n){if(!e.length)return[];let r=[];r.push([e[0][0]+M(t,n),e[0][1]+M(t,n)]),r.push([e[0][0]+M(t,n),e[0][1]+M(t,n)]);for(let i=1;i<e.length;i++)r.push([e[i][0]+M(t,n),e[i][1]+M(t,n)]),i===e.length-1&&r.push([e[i][0]+M(t,n),e[i][1]+M(t,n)]);return F(r,null,n)}function F(e,t,n){let r=e.length,i=[];if(r>3){let a=[],o=1-n.curveTightness;i.push({op:`move`,data:[e[1][0],e[1][1]]});for(let t=1;t+2<r;t++){let n=e[t];a[0]=[n[0],n[1]],a[1]=[n[0]+(o*e[t+1][0]-o*e[t-1][0])/6,n[1]+(o*e[t+1][1]-o*e[t-1][1])/6],a[2]=[e[t+1][0]+(o*e[t][0]-o*e[t+2][0])/6,e[t+1][1]+(o*e[t][1]-o*e[t+2][1])/6],a[3]=[e[t+1][0],e[t+1][1]],i.push({op:`bcurveTo`,data:[a[1][0],a[1][1],a[2][0],a[2][1],a[3][0],a[3][1]]})}if(t&&t.length===2){let e=n.maxRandomnessOffset;i.push({op:`lineTo`,data:[t[0]+M(e,n),t[1]+M(e,n)]})}}else r===3?(i.push({op:`move`,data:[e[1][0],e[1][1]]}),i.push({op:`bcurveTo`,data:[e[1][0],e[1][1],e[2][0],e[2][1],e[2][0],e[2][1]]})):r===2&&i.push(...$e(e[0][0],e[0][1],e[1][0],e[1][1],n,!0,!0));return i}function et(e,t,n,r,i,a,o,s){let c=[],l=[];if(s.roughness===0){e/=4,l.push([t+r*Math.cos(-e),n+i*Math.sin(-e)]);for(let a=0;a<=2*Math.PI;a+=e){let e=[t+r*Math.cos(a),n+i*Math.sin(a)];c.push(e),l.push(e)}l.push([t+r*Math.cos(0),n+i*Math.sin(0)]),l.push([t+r*Math.cos(e),n+i*Math.sin(e)])}else{let u=M(.5,s)-Math.PI/2;l.push([M(a,s)+t+.9*r*Math.cos(u-e),M(a,s)+n+.9*i*Math.sin(u-e)]);let d=2*Math.PI+u-.01;for(let o=u;o<d;o+=e){let e=[M(a,s)+t+r*Math.cos(o),M(a,s)+n+i*Math.sin(o)];c.push(e),l.push(e)}l.push([M(a,s)+t+r*Math.cos(u+2*Math.PI+.5*o),M(a,s)+n+i*Math.sin(u+2*Math.PI+.5*o)]),l.push([M(a,s)+t+.98*r*Math.cos(u+o),M(a,s)+n+.98*i*Math.sin(u+o)]),l.push([M(a,s)+t+.9*r*Math.cos(u+.5*o),M(a,s)+n+.9*i*Math.sin(u+.5*o)])}return[l,c]}function tt(e,t,n,r,i,a,o,s,c){let l=a+M(.1,c),u=[];u.push([M(s,c)+t+.9*r*Math.cos(l-e),M(s,c)+n+.9*i*Math.sin(l-e)]);for(let a=l;a<=o;a+=e)u.push([M(s,c)+t+r*Math.cos(a),M(s,c)+n+i*Math.sin(a)]);return u.push([t+r*Math.cos(o),n+i*Math.sin(o)]),u.push([t+r*Math.cos(o),n+i*Math.sin(o)]),F(u,null,c)}function nt(e,t,n,r,i,a,o,s){let c=[],l=[s.maxRandomnessOffset||1,(s.maxRandomnessOffset||1)+.3],u=[0,0],d=s.disableMultiStroke?1:2,f=s.preserveVertices;for(let p=0;p<d;p++)p===0?c.push({op:`move`,data:[o[0],o[1]]}):c.push({op:`move`,data:[o[0]+(f?0:M(l[0],s)),o[1]+(f?0:M(l[0],s))]}),u=f?[i,a]:[i+M(l[p],s),a+M(l[p],s)],c.push({op:`bcurveTo`,data:[e+M(l[p],s),t+M(l[p],s),n+M(l[p],s),r+M(l[p],s),u[0],u[1]]});return c}function I(e){return[...e]}function rt(e,t=0){let n=e.length;if(n<3)throw Error(`A curve must have at least three points.`);let r=[];if(n===3)r.push(I(e[0]),I(e[1]),I(e[2]),I(e[2]));else{let n=[];n.push(e[0],e[0]);for(let t=1;t<e.length;t++)n.push(e[t]),t===e.length-1&&n.push(e[t]);let i=[],a=1-t;r.push(I(n[0]));for(let e=1;e+2<n.length;e++){let t=n[e];i[0]=[t[0],t[1]],i[1]=[t[0]+(a*n[e+1][0]-a*n[e-1][0])/6,t[1]+(a*n[e+1][1]-a*n[e-1][1])/6],i[2]=[n[e+1][0]+(a*n[e][0]-a*n[e+2][0])/6,n[e+1][1]+(a*n[e][1]-a*n[e+2][1])/6],i[3]=[n[e+1][0],n[e+1][1]],r.push(i[1],i[2],i[3])}}return r}function L(e,t){return(e[0]-t[0])**2+(e[1]-t[1])**2}function it(e,t,n){let r=L(t,n);if(r===0)return L(e,t);let i=((e[0]-t[0])*(n[0]-t[0])+(e[1]-t[1])*(n[1]-t[1]))/r;return i=Math.max(0,Math.min(1,i)),L(e,R(t,n,i))}function R(e,t,n){return[e[0]+(t[0]-e[0])*n,e[1]+(t[1]-e[1])*n]}function at(e,t,n,r){let i=r||[];if(function(e,t){let n=e[t+0],r=e[t+1],i=e[t+2],a=e[t+3],o=3*r[0]-2*n[0]-a[0];o*=o;let s=3*r[1]-2*n[1]-a[1];s*=s;let c=3*i[0]-2*a[0]-n[0];c*=c;let l=3*i[1]-2*a[1]-n[1];return l*=l,o<c&&(o=c),s<l&&(s=l),o+s}(e,t)<n){let n=e[t+0];i.length?(a=i[i.length-1],o=n,Math.sqrt(L(a,o)))>1&&i.push(n):i.push(n),i.push(e[t+3])}else{let r=.5,a=e[t+0],o=e[t+1],s=e[t+2],c=e[t+3],l=R(a,o,r),u=R(o,s,r),d=R(s,c,r),f=R(l,u,r),p=R(u,d,r),m=R(f,p,r);at([a,l,f,m],0,n,i),at([m,p,d,c],0,n,i)}var a,o;return i}function ot(e,t){return z(e,0,e.length,t)}function z(e,t,n,r,i){let a=i||[],o=e[t],s=e[n-1],c=0,l=1;for(let r=t+1;r<n-1;++r){let t=it(e[r],o,s);t>c&&(c=t,l=r)}return Math.sqrt(c)>r?(z(e,t,l+1,r,a),z(e,l,n,r,a)):(a.length||a.push(o),a.push(s)),a}function st(e,t=.15,n){let r=[],i=(e.length-1)/3;for(let n=0;n<i;n++)at(e,3*n,t,r);return n&&n>0?z(r,0,r.length,n):r}var B=`none`,V=class{constructor(e){this.defaultOptions={maxRandomnessOffset:2,roughness:1,bowing:1,stroke:`#000`,strokeWidth:1,curveTightness:0,curveFitting:.95,curveStepCount:9,fillStyle:`hachure`,fillWeight:-1,hachureAngle:-41,hachureGap:-1,dashOffset:-1,dashGap:-1,zigzagOffset:-1,seed:0,disableMultiStroke:!1,disableMultiStrokeFill:!1,preserveVertices:!1,fillShapeRoughnessGain:.8},this.config=e||{},this.config.options&&(this.defaultOptions=this._o(this.config.options))}static newSeed(){return Math.floor(Math.random()*2**31)}_o(e){return e?Object.assign({},this.defaultOptions,e):this.defaultOptions}_d(e,t,n){return{shape:e,sets:t||[],options:n||this.defaultOptions}}line(e,t,n,r,i){let a=this._o(i);return this._d(`line`,[Ue(e,t,n,r,a)],a)}rectangle(e,t,n,r,i){let a=this._o(i),o=[],s=We(e,t,n,r,a);if(a.fill){let i=[[e,t],[e+n,t],[e+n,t+r],[e,t+r]];a.fillStyle===`solid`?o.push(Xe([i],a)):o.push(A([i],a))}return a.stroke!==B&&o.push(s),this._d(`rectangle`,o,a)}ellipse(e,t,n,r,i){let a=this._o(i),o=[],s=Ke(n,r,a),c=qe(e,t,a,s);if(a.fill)if(a.fillStyle===`solid`){let n=qe(e,t,a,s).opset;n.type=`fillPath`,o.push(n)}else o.push(A([c.estimatedPoints],a));return a.stroke!==B&&o.push(c.opset),this._d(`ellipse`,o,a)}circle(e,t,n,r){let i=this.ellipse(e,t,n,n,r);return i.shape=`circle`,i}linearPath(e,t){let n=this._o(t);return this._d(`linearPath`,[k(e,!1,n)],n)}arc(e,t,n,r,i,a,o=!1,s){let c=this._o(s),l=[],u=Je(e,t,n,r,i,a,o,!0,c);if(o&&c.fill)if(c.fillStyle===`solid`){let o=Object.assign({},c);o.disableMultiStroke=!0;let s=Je(e,t,n,r,i,a,!0,!1,o);s.type=`fillPath`,l.push(s)}else l.push(function(e,t,n,r,i,a,o){let s=e,c=t,l=Math.abs(n/2),u=Math.abs(r/2);l+=M(.01*l,o),u+=M(.01*u,o);let d=i,f=a;for(;d<0;)d+=2*Math.PI,f+=2*Math.PI;f-d>2*Math.PI&&(d=0,f=2*Math.PI);let p=(f-d)/o.curveStepCount,m=[];for(let e=d;e<=f;e+=p)m.push([s+l*Math.cos(e),c+u*Math.sin(e)]);return m.push([s+l*Math.cos(f),c+u*Math.sin(f)]),m.push([s,c]),A([m],o)}(e,t,n,r,i,a,c));return c.stroke!==B&&l.push(u),this._d(`arc`,l,c)}curve(e,t){let n=this._o(t),r=[],i=Ge(e,n);if(n.fill&&n.fill!==B)if(n.fillStyle===`solid`){let t=Ge(e,Object.assign(Object.assign({},n),{disableMultiStroke:!0,roughness:n.roughness?n.roughness+n.fillShapeRoughnessGain:0}));r.push({type:`fillPath`,ops:this._mergedShape(t.ops)})}else{let t=[],i=e;if(i.length){let e=typeof i[0][0]==`number`?[i]:i;for(let r of e)r.length<3?t.push(...r):r.length===3?t.push(...st(rt([r[0],r[0],r[1],r[2]]),10,(1+n.roughness)/2)):t.push(...st(rt(r),10,(1+n.roughness)/2))}t.length&&r.push(A([t],n))}return n.stroke!==B&&r.push(i),this._d(`curve`,r,n)}polygon(e,t){let n=this._o(t),r=[],i=k(e,!0,n);return n.fill&&(n.fillStyle===`solid`?r.push(Xe([e],n)):r.push(A([e],n))),n.stroke!==B&&r.push(i),this._d(`polygon`,r,n)}path(e,t){let n=this._o(t),r=[];if(!e)return this._d(`path`,r,n);e=(e||``).replace(/\n/g,` `).replace(/(-\s)/g,`-`).replace(`/(ss)/g`,` `);let i=n.fill&&n.fill!==`transparent`&&n.fill!==B,a=n.stroke!==B,o=!!(n.simplification&&n.simplification<1),s=function(e,t,n){let r=Be(ze(Re(e))),i=[],a=[],o=[0,0],s=[],c=()=>{s.length>=4&&a.push(...st(s,t)),s=[]},l=()=>{c(),a.length&&(i.push(a),a=[])};for(let{key:e,data:t}of r)switch(e){case`M`:l(),o=[t[0],t[1]],a.push(o);break;case`L`:c(),a.push([t[0],t[1]]);break;case`C`:if(!s.length){let e=a.length?a[a.length-1]:o;s.push([e[0],e[1]])}s.push([t[0],t[1]]),s.push([t[2],t[3]]),s.push([t[4],t[5]]);break;case`Z`:c(),a.push([o[0],o[1]])}if(l(),!n)return i;let u=[];for(let e of i){let t=ot(e,n);t.length&&u.push(t)}return u}(e,1,o?4-4*(n.simplification||1):(1+n.roughness)/2),c=Ye(e,n);if(i)if(n.fillStyle===`solid`)if(s.length===1){let t=Ye(e,Object.assign(Object.assign({},n),{disableMultiStroke:!0,roughness:n.roughness?n.roughness+n.fillShapeRoughnessGain:0}));r.push({type:`fillPath`,ops:this._mergedShape(t.ops)})}else r.push(Xe(s,n));else r.push(A(s,n));return a&&(o?s.forEach((e=>{r.push(k(e,!1,n))})):r.push(c)),this._d(`path`,r,n)}opsToPath(e,t){let n=``;for(let r of e.ops){let e=typeof t==`number`&&t>=0?r.data.map((e=>+e.toFixed(t))):r.data;switch(r.op){case`move`:n+=`M${e[0]} ${e[1]} `;break;case`bcurveTo`:n+=`C${e[0]} ${e[1]}, ${e[2]} ${e[3]}, ${e[4]} ${e[5]} `;break;case`lineTo`:n+=`L${e[0]} ${e[1]} `}}return n.trim()}toPaths(e){let t=e.sets||[],n=e.options||this.defaultOptions,r=[];for(let e of t){let t=null;switch(e.type){case`path`:t={d:this.opsToPath(e),stroke:n.stroke,strokeWidth:n.strokeWidth,fill:B};break;case`fillPath`:t={d:this.opsToPath(e),stroke:B,strokeWidth:0,fill:n.fill||B};break;case`fillSketch`:t=this.fillSketch(e,n)}t&&r.push(t)}return r}fillSketch(e,t){let n=t.fillWeight;return n<0&&(n=t.strokeWidth/2),{d:this.opsToPath(e),stroke:t.fill||B,strokeWidth:n,fill:B}}_mergedShape(e){return e.filter(((e,t)=>t===0||e.op!==`move`))}},ct=class{constructor(e,t){this.canvas=e,this.ctx=this.canvas.getContext(`2d`),this.gen=new V(t)}draw(e){let t=e.sets||[],n=e.options||this.getDefaultOptions(),r=this.ctx,i=e.options.fixedDecimalPlaceDigits;for(let a of t)switch(a.type){case`path`:r.save(),r.strokeStyle=n.stroke===`none`?`transparent`:n.stroke,r.lineWidth=n.strokeWidth,n.strokeLineDash&&r.setLineDash(n.strokeLineDash),n.strokeLineDashOffset&&(r.lineDashOffset=n.strokeLineDashOffset),this._drawToContext(r,a,i),r.restore();break;case`fillPath`:{r.save(),r.fillStyle=n.fill||``;let t=e.shape===`curve`||e.shape===`polygon`||e.shape===`path`?`evenodd`:`nonzero`;this._drawToContext(r,a,i,t),r.restore();break}case`fillSketch`:this.fillSketch(r,a,n)}}fillSketch(e,t,n){let r=n.fillWeight;r<0&&(r=n.strokeWidth/2),e.save(),n.fillLineDash&&e.setLineDash(n.fillLineDash),n.fillLineDashOffset&&(e.lineDashOffset=n.fillLineDashOffset),e.strokeStyle=n.fill||``,e.lineWidth=r,this._drawToContext(e,t,n.fixedDecimalPlaceDigits),e.restore()}_drawToContext(e,t,n,r=`nonzero`){e.beginPath();for(let r of t.ops){let t=typeof n==`number`&&n>=0?r.data.map((e=>+e.toFixed(n))):r.data;switch(r.op){case`move`:e.moveTo(t[0],t[1]);break;case`bcurveTo`:e.bezierCurveTo(t[0],t[1],t[2],t[3],t[4],t[5]);break;case`lineTo`:e.lineTo(t[0],t[1])}}t.type===`fillPath`?e.fill(r):e.stroke()}get generator(){return this.gen}getDefaultOptions(){return this.gen.defaultOptions}line(e,t,n,r,i){let a=this.gen.line(e,t,n,r,i);return this.draw(a),a}rectangle(e,t,n,r,i){let a=this.gen.rectangle(e,t,n,r,i);return this.draw(a),a}ellipse(e,t,n,r,i){let a=this.gen.ellipse(e,t,n,r,i);return this.draw(a),a}circle(e,t,n,r){let i=this.gen.circle(e,t,n,r);return this.draw(i),i}linearPath(e,t){let n=this.gen.linearPath(e,t);return this.draw(n),n}polygon(e,t){let n=this.gen.polygon(e,t);return this.draw(n),n}arc(e,t,n,r,i,a,o=!1,s){let c=this.gen.arc(e,t,n,r,i,a,o,s);return this.draw(c),c}curve(e,t){let n=this.gen.curve(e,t);return this.draw(n),n}path(e,t){let n=this.gen.path(e,t);return this.draw(n),n}},lt=`http://www.w3.org/2000/svg`,ut=class{constructor(e,t){this.svg=e,this.gen=new V(t)}draw(e){let t=e.sets||[],n=e.options||this.getDefaultOptions(),r=this.svg.ownerDocument||window.document,i=r.createElementNS(lt,`g`),a=e.options.fixedDecimalPlaceDigits;for(let o of t){let t=null;switch(o.type){case`path`:t=r.createElementNS(lt,`path`),t.setAttribute(`d`,this.opsToPath(o,a)),t.setAttribute(`stroke`,n.stroke),t.setAttribute(`stroke-width`,n.strokeWidth+``),t.setAttribute(`fill`,`none`),n.strokeLineDash&&t.setAttribute(`stroke-dasharray`,n.strokeLineDash.join(` `).trim()),n.strokeLineDashOffset&&t.setAttribute(`stroke-dashoffset`,`${n.strokeLineDashOffset}`);break;case`fillPath`:t=r.createElementNS(lt,`path`),t.setAttribute(`d`,this.opsToPath(o,a)),t.setAttribute(`stroke`,`none`),t.setAttribute(`stroke-width`,`0`),t.setAttribute(`fill`,n.fill||``),e.shape!==`curve`&&e.shape!==`polygon`||t.setAttribute(`fill-rule`,`evenodd`);break;case`fillSketch`:t=this.fillSketch(r,o,n)}t&&i.appendChild(t)}return i}fillSketch(e,t,n){let r=n.fillWeight;r<0&&(r=n.strokeWidth/2);let i=e.createElementNS(lt,`path`);return i.setAttribute(`d`,this.opsToPath(t,n.fixedDecimalPlaceDigits)),i.setAttribute(`stroke`,n.fill||``),i.setAttribute(`stroke-width`,r+``),i.setAttribute(`fill`,`none`),n.fillLineDash&&i.setAttribute(`stroke-dasharray`,n.fillLineDash.join(` `).trim()),n.fillLineDashOffset&&i.setAttribute(`stroke-dashoffset`,`${n.fillLineDashOffset}`),i}get generator(){return this.gen}getDefaultOptions(){return this.gen.defaultOptions}opsToPath(e,t){return this.gen.opsToPath(e,t)}line(e,t,n,r,i){let a=this.gen.line(e,t,n,r,i);return this.draw(a)}rectangle(e,t,n,r,i){let a=this.gen.rectangle(e,t,n,r,i);return this.draw(a)}ellipse(e,t,n,r,i){let a=this.gen.ellipse(e,t,n,r,i);return this.draw(a)}circle(e,t,n,r){let i=this.gen.circle(e,t,n,r);return this.draw(i)}linearPath(e,t){let n=this.gen.linearPath(e,t);return this.draw(n)}polygon(e,t){let n=this.gen.polygon(e,t);return this.draw(n)}arc(e,t,n,r,i,a,o=!1,s){let c=this.gen.arc(e,t,n,r,i,a,o,s);return this.draw(c)}curve(e,t){let n=this.gen.curve(e,t);return this.draw(n)}path(e,t){let n=this.gen.path(e,t);return this.draw(n)}},dt={canvas:(e,t)=>new ct(e,t),svg:(e,t)=>new ut(e,t),generator:e=>new V(e),newSeed:()=>V.newSeed()}.generator(),H=1,ft=1,pt=.45,mt=.2,ht=250,gt=.5;function _t(e){return e<=ht?1:Math.max(gt,ht/e)}var vt=.3,yt=220,bt=.35;function U(e){let t=0;for(let n=0;n<e.length;n+=1)t=t*31+e.charCodeAt(n)|0;return Math.abs(t)%2**31}var xt=2e3,W=new Map;function St(e,t){W.size>=xt&&W.delete(W.keys().next().value),W.set(e,t)}function G(e,t,n,r=H,i=ft){let a=`${t}|${n}|${r}|${i}|${e}`,o=W.get(a);if(o)return o;let s=dt.path(e,{seed:t,roughness:r,bowing:i,disableMultiStroke:!0,preserveVertices:!0,strokeWidth:n}),c=dt.toPaths(s).map(e=>e.d);return St(a,c),c}function Ct(e){let t=x(e),n={x:0,y:0,width:t.width,height:t.height},r=te(e.kind,n,e.corner,{x:e.flipX,y:e.flipY}),a=i(Math.min(t.width,t.height)/yt,bt,1);return G(r,U(e.id),e.strokeWidth,H*a,vt*a)}function wt(e,t,n){let r=U(t.id)+n;if(n>0)return G(e,r,1.5,.5,vt);let a=x(t),o=i(Math.min(a.width,a.height)/yt,bt,1);return G(e,r,1.5,H*o,vt*o)}function Tt(e,t,n,r,i){let a=U(r.id)+i,o=`disc|${a}|${e.toFixed(1)}|${t.toFixed(1)}|${n.toFixed(1)}`,s=W.get(o);if(s)return s;let c=dt.circle(e,t,n*2,{seed:a,roughness:H,bowing:ft,fill:`#000000`,fillStyle:`solid`,stroke:`none`,disableMultiStroke:!0}),l=dt.toPaths(c).filter(e=>e.fill&&e.fill!==`none`).map(e=>e.d);return St(o,l),l}function Et(e,t,n,r){let a=x(t),o=i(Math.min(a.width,a.height)/yt,bt,1);return G(e,U(t.id)+n,r,H*o,vt*o)}function Dt(e){return e.bendStyle===`elbow`?s(re(e)):Math.hypot(e.x2-e.x,e.y2-e.y)+Math.abs(e.bend)}function Ot(e){let t=_t(Dt(e));return G(S(e),U(e.id),e.strokeWidth,pt*t,mt*t)}function kt(e){let t=_t(s(e.points));return G(pe(e.points),U(e.id),e.strokeWidth,pt*t,mt*t)}var At=`#8a8f98`,jt=2,K=1.5,Mt=`#4dabf7`;function q(e,t,n,r=jt,i){return Et(t,e.shape,e.nextSalt(),r).map(e=>({kind:`path`,d:e,stroke:n,width:r,testId:i}))}function Nt(e,t,n,r){return[{kind:`rect`,x:t.x,y:t.y,width:t.width,height:t.height,rx:n,fill:r},...q(e,b(t.x,t.y,t.width,t.height,n),e.ink)]}function J(e,t,n,r,i,a={}){return{kind:`text`,x:t,y:n,text:r,size:a.size??e.shape.fontSize,color:i,family:e.shape.fontFamily,anchor:a.anchor??`start`,baseline:a.baseline??`middle`,testId:a.testId}}function Pt(e,t,n){return e.text.measure(t,n??e.shape.fontSize,e.shape.fontFamily)}function Y(e){return!e.fill||e.fill===`transparent`?null:e.fill}var Ft=1.6,It=.85,Lt=.85;function Rt(e){return Math.min(7,e.height*.18)}function zt(e){return 12+Rt(e)*2+12}function Bt(e){return Math.min(26,e.height)}function Vt(e){return Bt(e)*1.9+10}function Ht(e){return Math.min(e.height,e.width/3)}function Ut(e){return Math.min(e.height*.28,13)}function Wt(e){return Ut(e)*2+24}function Gt(e,t){let n=[],r=``;for(let i of e.split(/\s+/)){let e=r.length===0?i:`${r} ${i}`;e.length>t&&r.length>0?(n.push(r),r=i):r=e}return r.length>0&&n.push(r),n}function Kt(e,t,n){let r=n*.52;return Gt(e,Math.max(4,Math.floor(t/r)))}function qt(e,t,n){return e.split(/\r?\n/).flatMap(e=>e?Kt(e,t,n):[``])}var Jt=`#e7f5ff`;function Yt(e,t){let n=Y(e.shape);if(!n)return[];let{bounds:r}=e;return[{kind:`rect`,x:r.x,y:r.y,width:r.width,height:r.height,rx:t,fill:n}]}function Xt(e,t){let{bounds:n,ink:r}=e,i=Yt(e,t);return i.push(...q(e,b(n.x,n.y,n.width,n.height,t),r)),i}function Zt(e){return e.split(` | `).map(e=>e.trim()).filter(e=>e.length>0)}function Qt(e,t){return t===0?0:Math.max(0,Math.min(t-1,Math.round(e.value??0)))}var $t=`+id: string
|
|
2
|
+
+name: string
|
|
3
|
+
---
|
|
4
|
+
+save()
|
|
5
|
+
+delete()`,en=1.9,tn=1.4,nn=/^-{2,}$/;function rn(e){return(e??``).split(/\r?\n/).map(e=>e.trim()).filter(e=>e.length>0)}function an(e){return rn(e.body).map(e=>({text:e,divider:nn.test(e)}))}function on(e){return an(e).filter(e=>!e.divider).map(e=>e.text)}function sn(e){let t=e.fontSize*.9;return{fontSize:t,lineH:t*tn}}function cn(e){let t=x(e),n=on(e).length===0?t.height:Math.min(t.height,e.fontSize*en),r=t.x+12,i=t.width-24,{fontSize:a}=sn(e),o=t.y+n+4,s=t.y+t.height-4;return{title:{field:`label`,x:t.x,y:t.y,width:t.width,height:n,fontSize:e.fontSize},body:{field:`body`,x:r,y:o,width:i,height:Math.max(a,s-o),fontSize:a}}}function ln(e,t,n){let r=n*.9,i=r*tn,a=n*en,o=Math.round(a+4+t.length*i+8),s=(e,t)=>e.length*t*.62,c=Math.max(s(e,n),0,...t.filter(e=>!nn.test(e)).map(e=>s(e,r)));return{width:Math.max(160,Math.round(c+24+16)),height:o}}function un(e){let t=cn(e),{lineH:n}=sn(e),r=x(e).y+e.height;return an(e).map((e,r)=>({text:e.text,cy:t.body.y+n*(r+.5),divider:e.divider})).filter(e=>e.cy<=r)}function dn(e){let t=x(e);return un(e).filter(e=>!e.divider).map(({cy:e})=>({cy:e,left:{x:t.x,y:e},right:{x:t.x+t.width,y:e}}))}function fn(t){let{bounds:n,shape:r,ink:i}=t,a=cn(r),o=n.y+a.title.height,s=on(r).length>0,c=Y(r),l=[];c&&l.push({kind:`path`,d:s?v(n.x,n.y,n.width,a.title.height,6):b(n.x,n.y,n.width,n.height,6),fill:c,testId:`entity-header`}),l.push(...q(t,b(n.x,n.y,n.width,n.height,6),i)),s&&l.push(...q(t,oe(n.x,o,n.x+n.width,o),i,K));let u=r.label.trim();u&&l.push(J(t,n.x+n.width/2,n.y+a.title.height/2,u,c?e(c):i,{anchor:`middle`,testId:`entity-title`}));for(let{text:e,cy:o,divider:s}of un(r)){if(s){l.push(...q(t,oe(n.x,o,n.x+n.width,o),i,K,`entity-divider`));continue}l.push(J(t,a.body.x,o,e,i,{size:a.body.fontSize,testId:`entity-row`}))}return l}function X(e){return Math.min(e.height,pn(e.fontSize))}function pn(e){return e*2.4}var mn=12;function hn(e){if(!e.activations||e.activations.length===0)return[];let t=X(e),n=e.height;return e.activations.map(r=>{let i=Math.min(Math.max(r.top,t),Math.max(t,n-12)),a=Math.max(12,Math.min(r.height,n-i));return{x:e.x+e.width/2-mn/2,y:e.y+i,width:mn,height:a}})}function gn(e,t){for(let n of hn(e))if(t>=n.y&&t<=n.y+n.height)return n;return null}function _n(e){let t=X(e);return{x:e.x+e.width/2,y:e.y+t,width:0,height:Math.max(2,e.height-t)}}function vn(e){let t=X(e),n=Math.max(0,e.height-t),r=Math.min(Math.max(n*.12,16),64);return{top:t+r,height:Math.max(12,n-r*2)}}function yn(e){let t=hn(e);if(t.length===0)return vn(e);let n=X(e),r=t.map(t=>({top:t.y-e.y,bottom:t.y-e.y+t.height})).sort((e,t)=>e.top-t.top),i=[],a=n;for(let e of r)e.top>a&&i.push({start:a,end:e.top}),a=Math.max(a,e.bottom);a<e.height&&i.push({start:a,end:e.height});let o=i.sort((e,t)=>t.end-t.start-(e.end-e.start))[0];if(!o)return{top:Math.max(n,e.height-12),height:12};let s=o.end-o.start,c=Math.min(Math.max(s*.15,10),48);return{top:o.start+c,height:Math.max(12,s-c*2)}}var bn=12,xn=7,Sn=1.5;function Cn(t){let n=Y(t);return n?e(n):null}function wn(e){let{bounds:t,shape:n,ink:r}=e,i=X(n),a=t.x+t.width/2,o=Y(n)??ne.paper,s=Nt(e,{x:t.x,y:t.y,width:t.width,height:i},6,o);n.label.trim()&&s.push(J(e,a,t.y+i/2,n.label.trim(),Cn(n)??r,{anchor:`middle`,testId:`lifeline-name`}));let c=t.y+t.height;for(let e=t.y+i;e<c;e+=bn)s.push({kind:`line`,x1:a,y1:e,x2:a,y2:Math.min(e+xn,c),stroke:r,width:Sn});for(let t of hn(n))s.push(...Nt(e,t,2,o));return s}var Tn=[`opt`,`alt`,`loop`,`par`,`break`,`critical`,`seq`],En=`#f3f0ff`,Dn=14,On=8,kn=1.75,An=.1;function jn(e,t){let n=e.trimStart().match(/^\S+(\s[\s\S]*)?$/);return t+(n&&n[1]?n[1]:``)}function Mn(e){return Math.min(x(e).height,e.fontSize*kn)}function Nn(e,t){let n=x(e),r=e.label.trim()||`opt`,i=Math.min(n.width,t.measure(r,e.fontSize,e.fontFamily)+24);return{x:n.x,y:n.y,width:i,height:Mn(e)}}function Pn(e){let t=Math.min(On,e.width/2,e.height/2);return{tl:Math.min(Dn,e.width-t,e.height-t),br:t}}function Fn(e){let{x:t,y:n,width:r,height:i}=e,{tl:a,br:o}=Pn(e);return[`M ${t+a} ${n}`,`L ${t+r} ${n}`,`L ${t+r} ${n+i-o}`,`Q ${t+r} ${n+i} ${t+r-o} ${n+i}`,`L ${t} ${n+i}`,`L ${t} ${n+a}`,`Q ${t} ${n} ${t+a} ${n}`,`Z`].join(` `)}function In(e){let{x:t,y:n,width:r,height:i}=e,{br:a}=Pn(e);return`M ${t+r} ${n} L ${t+r} ${n+i-a} Q ${t+r} ${n+i} ${t+r-a} ${n+i} L ${t} ${n+i}`}function Ln(t){let{bounds:n,shape:r,ink:i}=t,a=Y(r)??`#f3f0ff`,o=Nn(r,t.text),s=[{kind:`path`,d:Fn(o),fill:a,testId:`fragment-tab`}];s.push(...q(t,b(n.x,n.y,n.width,n.height,Dn),i)),s.push(...q(t,In(o),i,K,`fragment-tab`));let c=r.label.trim();return c&&s.push(J(t,o.x+12,o.y+o.height/2+r.fontSize*An,c,e(a),{anchor:`start`,testId:`fragment-label`})),s}var Rn={entity:fn,lifeline:wn,fragment:Ln},zn=8,Z=[],Q={get(e){for(let t=Z.length-1;t>=0;--t)if(Z[t].shapes===e)return Z[t].index},has(e){return Q.get(e)!==void 0},set(e,t){Z.push({shapes:e,index:t}),Z.length>zn&&Z.shift()}};function Bn(e){if(e.type===`arrow`){let t=[];return e.startBinding&&t.push(e.startBinding.shapeId),e.endBinding&&t.push(e.endBinding.shapeId),t}return e.type===`polygon`&&e.band?[e.band.from,e.band.to]:[]}function Vn(e){let t=new Map,n=new Map,r=new Map;for(let i=0;i<e.length;i+=1){let a=e[i];t.has(a.id)||t.set(a.id,i);let o=r.get(a.type);o?o.push(i):r.set(a.type,[i]);for(let e of Bn(a)){let t=n.get(e);t?t.push(a.id):n.set(e,[a.id])}}return{position:t,dependents:n,byType:r}}function Hn(e){let t=Q.get(e);if(t)return t;let n=Vn(e);return Q.set(e,n),n}function Un(e,t){if(e===t||Q.has(t))return;let n=Q.get(e);if(!(!n||e.length!==t.length)){for(let n=0;n<t.length;n+=1){let r=e[n],i=t[n];if(r!==i&&!Gn(r,i))return}Q.set(t,n)}}function Wn(e,t,n){if(e===t||Q.has(t))return;let r=Q.get(e);if(!(!r||e.length!==t.length)){for(let r of n){let n=e[r],i=t[r];if(n!==i&&!Gn(n,i))return}Q.set(t,r)}}function Gn(e,t){return e.id===t.id&&e.type===t.type&&Kn(e,t)}function Kn(e,t){let n=Bn(t);if(n.length===0)return!0;let r=Bn(e);return n.every(e=>r.includes(e))}function qn(e,t){let{position:n}=Hn(e),r=[];for(let e of t){let t=n.get(e);t!==void 0&&r.push(t)}return r.sort((e,t)=>e-t),r.map(t=>e[t])}function Jn(e,t){let n=Q.get(e);return n?(n.byType.get(t)??[]).map(t=>e[t]):e.filter(e=>e.type===t)}function Yn(e){return Jn(e,`figure`)}function Xn(e,t){let n=Q.get(e);if(n){let r=n.position.get(t);return r===void 0?void 0:e[r]}return e.find(e=>e.id===t)}var Zn=.05;function Qn(e){return Number.isNaN(e)?1:i(e,Zn,8)}function $n(e){return{zoom:1,x:Number.isFinite(e.width)?e.width/2:0,y:Number.isFinite(e.height)?e.height/2:0}}function er(e,t){return{x:(e.x-t.x)/t.zoom,y:(e.y-t.y)/t.zoom}}function tr(e,t){return{x:e.x*t.zoom+t.x,y:e.y*t.zoom+t.y}}function nr(e,t,n){let r=Qn(t),i=er(n,e),a=n.x-i.x*r,o=n.y-i.y*r;return!Number.isFinite(a)||!Number.isFinite(o)?{zoom:r,x:n.x,y:n.y}:{zoom:r,x:a,y:o}}function rr(e,t,n,r=80,i=24){if(!a(e))return null;let o=tr({x:e.x,y:e.y},t),s=tr({x:e.x+e.width,y:e.y+e.height},t);if(o.x>=i&&o.y>=i&&s.x<=n.width-i&&s.y<=n.height-i)return null;if(e.width*t.zoom<=n.width-r*2&&e.height*t.zoom<=n.height-r*2){let r=e.x+e.width/2,i=e.y+e.height/2;return{zoom:t.zoom,x:n.width/2-r*t.zoom,y:n.height/2-i*t.zoom}}return ir(e,n,r)}function ir(e,t,n=80){if(!a(e))return $n(t);let r=Math.max(1,t.width-n*2),i=Math.max(1,t.height-n*2),o=Qn(Math.min(r/e.width,i/e.height,1)),s=e.x+e.width/2,c=e.y+e.height/2,l={zoom:o,x:t.width/2-s*o,y:t.height/2-c*o};return!Number.isFinite(l.x)||!Number.isFinite(l.y)?$n(t):l}function ar(e,t,n,i){return n.id===e.id?!1:n.type===`figure`?cr(t,x(n,i)):o(r(x(n,i)),t)}function or(e,t,r){let i=x(t,r);return e.filter(e=>(_(e)||n(le(e),i))&&ar(t,i,e,r))}function sr(e,t,n){let i=e.map((e,t)=>({x:r(x(e,n)).x,order:t,shape:e})).sort((e,t)=>e.x-t.x),a=i.map(e=>e.x),o=e=>{let t=0,n=a.length;for(;t<n;){let r=t+n>>1;a[r]<e?t=r+1:n=r}return t},s=e=>{let t=0,n=a.length;for(;t<n;){let r=t+n>>1;a[r]<=e?t=r+1:n=r}return t};return{members(e){let r=x(e,n),a=o(r.x),c=s(r.x+r.width);t?.onCandidates?.(Math.max(0,c-a));let l=[];for(let t=a;t<c;t+=1){let a=i[t];ar(e,r,a.shape,n)&&l.push(a)}return l.sort((e,t)=>e.order-t.order),l.map(e=>e.shape)}}}function cr(e,t){return t.x>=e.x&&t.y>=e.y&&t.x+t.width<=e.x+e.width&&t.y+t.height<=e.y+e.height}function lr(e,t){let n=x(t);return e.some(e=>e.type===`figure`&&e.id!==t.id&&cr(x(e),n))}function $(e){let t=e.filter(e=>e.type===`figure`),n=t.map(e=>x(e)),r=new Set;for(let e=0;e<t.length;e+=1)for(let i=0;i<t.length;i+=1)if(e!==i&&cr(n[i],n[e])){r.add(t[e].id);break}return r}function ur(e,t,n){let r=new Set(t.map(e=>e.id)),i=[...t];if(r.size>=e.length)return i;let a=t.filter(e=>e.type===`figure`),o=a.length>2?sr(e,void 0,n):null;for(let t of a){let a=o?o.members(t):or(e,t,n);for(let e of a)r.has(e.id)||(r.add(e.id),i.push(e))}return i}var dr=64,fr=480,pr=270;function mr(e,t){return e.type===`figure`&&e.slideOrder!==void 0&&!e.groupId&&(e.kind??`simple`)===`simple`&&!t.has(e.id)}function hr(e){let t=Yn(e);return _r(t,$(t))}function gr(e){return e.filter(e=>!e.slideSkipped)}function _r(e,t){return e.filter(e=>mr(e,t)).sort((e,t)=>(e.slideOrder??0)-(t.slideOrder??0))}function vr(e,t){let n=(p(e.label)?ae(e.label):e.label).trim();return n.length>0?n:`Frame ${t+1}`}function yr(e,t){return vr(e,t).toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-|-$/g,``)||`slide-${t+1}`}function br(e,t,n){let r=[...e],[i]=r.splice(t,1);return r.splice(n,0,i),r.map((e,t)=>({...e,slideOrder:t}))}function xr(e,t,n=1){return e.map((e,r)=>({...e,slideOrder:r<t?r:r+n}))}function Sr(e,t,n=[]){let r=e[e.length-1],i=r&&r.width>=fr&&r.height>=pr,a=i?r.width:960,o=i?r.height:540,s=r?null:m(n),c,u;return r?(c=Math.max(...e.map(e=>e.x+e.width))+dr,u=r.y):s?(c=s.x+s.width+dr,u=s.y+s.height/2-o/2):(c=t.x-a/2,u=t.y-o/2),{id:ie(),type:`figure`,x:c,y:u,width:a,height:o,rotation:0,label:`Frame ${e.length+1}`,fontSize:24,fontFamily:d,color:l,fill:`#ffffff`,opacity:1,slideOrder:e.length}}function Cr(e,t,n){let r=t[n],i=or(e,r),a={x:Math.max(...t.map(e=>e.x+e.width))+dr-r.x,y:0},[o,...s]=se([r,...i],a);return{clones:[{...o,slideOrder:n+1},...s],renumbered:xr(t,n+1)}}function wr(e,t){return new Set([t.id,...or(e,t).map(e=>e.id)])}function Tr(e,t){let n=$(e);return e.filter(e=>Er(t,e,n))}function Er(e,t,n){if(t.id===e.id||t.type===`figure`&&!n.has(t.id))return!1;let r=x(e),i=le(t);return i.x<r.x+r.width&&i.x+i.width>r.x&&i.y<r.y+r.height&&i.y+i.height>r.y}function Dr(e,t,n){if(n.size===0||t.length===0)return null;let r=$(e),i=null;for(let a of e){if(!n.has(a.id))continue;let e=t.find(e=>e.id===a.id)??Or(t,a,r);if(e){if(i&&i.id!==e.id)return null;i=e}}return i}function Or(e,t,n){let r=null,i=1/0;for(let a of e){if(!Er(a,t,n))continue;let e=x(a),o=e.width*e.height;o<i&&(r=a,i=o)}return r}function kr(e,t){let n=Qn(Math.min(t.width/e.width,t.height/e.height));return{zoom:n,x:t.width/2-(e.x+e.width/2)*n,y:t.height/2-(e.y+e.height/2)*n}}function Ar(e,t,n){return jr(e,er({x:n.width/2,y:n.height/2},t))}function jr(e,t){let n=-1,r=1/0;return e.forEach((e,i)=>{let a=x(e),o=t.x>=a.x&&t.x<=a.x+a.width&&t.y>=a.y&&t.y<=a.y+a.height,s=a.width*a.height;o&&s<r&&(n=i,r=s)}),n}export{yn as $,Xn as A,he as At,Rn as B,er as C,Kt as Ct,Un as D,kt as Dt,Bn as E,wt as Et,tn as F,Ce as Ft,Mn as G,ln as H,En as I,me as It,gn as J,jn as K,An as L,fe as Lt,qn as M,C as Mt,Jn as N,xe as Nt,Wn as O,Ct as Ot,$t as P,Se as Pt,Cn as Q,Tn as R,pe as Rt,rr as S,Gt as St,nr as T,Tt,dn as U,cn as V,Nn as W,X,_n as Y,pn as Z,or as _,Pt as _t,kr as a,Lt as at,Qn as b,Vt as bt,br as c,Qt as ct,Dr as d,Xt as dt,It as et,vr as f,Rt as ft,ur as g,q as gt,sr as h,Ht as ht,hr as i,At as it,Hn as j,ge as jt,Yn as k,_e as kt,Tr as l,Ut as lt,Er as m,Zt as mt,Sr as n,Ft as nt,gr as o,Mt as ot,wr as p,zt as pt,hn as q,Cr as r,Jt as rt,xr as s,Y as st,Ar as t,K as tt,yr as u,Wt as ut,lr as v,J as vt,tr as w,Ot as wt,ir as x,qt as xt,$ as y,Bt as yt,Sn as z};
|