@memoarchitect/architect 0.6.4 → 0.6.6
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 +40 -7
- package/dist/assets/AiWorkspace-DS79vBOT.js +3 -0
- package/dist/assets/AnalysisWorkspace-D_u4shRY.js +39 -0
- package/dist/assets/{ComplianceWizard-CVidRUY4.js → ComplianceWizard-k98NZ2ec.js} +1 -1
- package/dist/assets/{DSMView-DdcRG9Te.js → DSMView-DGheBwZ0.js} +1 -1
- package/dist/assets/{Dashboard-DxOueCqW.js → Dashboard-BRUQvUFK.js} +1 -1
- package/dist/assets/{DhfDashboard-CpDAP41S.js → DhfDashboard-B9V_n7kg.js} +1 -1
- package/dist/assets/{DhfSettingsPanel-C2vyewXY.js → DhfSettingsPanel-B8aLsWn6.js} +1 -1
- package/dist/assets/{DhfWorkbench-BGaEk0Qi.js → DhfWorkbench-TOnZkdUU.js} +3 -3
- package/dist/assets/DiagramCanvas-B9d4aLKt.js +1 -0
- package/dist/assets/{DiagramEditor-v6VJ5o2f.js → DiagramEditor-CJ7OG2IC.js} +2 -2
- package/dist/assets/ElementDetailView-CDcm1rvf.js +2 -0
- package/dist/assets/{ImportView-C8lcbof7.js → ImportView-CyMm-tSP.js} +1 -1
- package/dist/assets/{LayerGrid-BB30kAyl.js → LayerGrid-DNPZYTsD.js} +1 -1
- package/dist/assets/{LayerTable-BN9IZPbM.js → LayerTable-DhOq1DHo.js} +1 -1
- package/dist/assets/{MaxGraphCanvas-CfoIuwsi.js → MaxGraphCanvas-DqKU1PTY.js} +6 -6
- package/dist/assets/{ModelDiff-D6IR9kzb.js → ModelDiff-BbqIoesG.js} +1 -1
- package/dist/assets/OntologyDecompositionDiagram-DkxTe2C_.js +1 -0
- package/dist/assets/{OntologyViewer-cI3zi95S.js → OntologyViewer-BIpJC66j.js} +2 -2
- package/dist/assets/{ReviewDashboard-BTqze9-C.js → ReviewDashboard-DKoExM8K.js} +1 -1
- package/dist/assets/ScenarioEditor-JQ3huCnz.js +3 -0
- package/dist/assets/{StatisticsDashboard-BC1JkdTl.js → StatisticsDashboard-B8BduIDz.js} +1 -1
- package/dist/assets/{TabularView-Bn_WEMpm.js → TabularView-BXfFSluC.js} +1 -1
- package/dist/assets/{TraceabilityMatrix-BEEPlOQq.js → TraceabilityMatrix-CHZHFucA.js} +1 -1
- package/dist/assets/{WorkflowWizard-CFx5KVUH.js → WorkflowWizard-7--f9OH2.js} +1 -1
- package/dist/assets/index-CVW92JY7.js +3280 -0
- package/dist/assets/index-Y1UZTZg-.css +1 -0
- package/dist/assets/layout-selection-ClQ295Xc.js +1 -0
- package/dist/index.html +2 -2
- package/lib/__tests__/feature-grants.test.d.ts +2 -0
- package/lib/__tests__/feature-grants.test.d.ts.map +1 -0
- package/lib/__tests__/feature-grants.test.js +34 -0
- package/lib/__tests__/feature-grants.test.js.map +1 -0
- package/lib/bin/memo-architect.js +20 -3
- package/lib/bin/memo-architect.js.map +1 -1
- package/lib/commands/build.d.ts +3 -0
- package/lib/commands/build.d.ts.map +1 -1
- package/lib/commands/build.js +3 -0
- package/lib/commands/build.js.map +1 -1
- package/lib/commands/dev.d.ts +2 -0
- package/lib/commands/dev.d.ts.map +1 -1
- package/lib/commands/dev.js +5 -0
- package/lib/commands/dev.js.map +1 -1
- package/lib/commands/example.d.ts +2 -0
- package/lib/commands/example.d.ts.map +1 -1
- package/lib/commands/example.js +6 -2
- package/lib/commands/example.js.map +1 -1
- package/lib/feature-grants.d.ts +29 -0
- package/lib/feature-grants.d.ts.map +1 -0
- package/lib/feature-grants.js +31 -0
- package/lib/feature-grants.js.map +1 -0
- package/package.json +9 -5
- package/dist/assets/ChatPanel-DSjWi7UI.js +0 -3
- package/dist/assets/DiagramCanvas-DybZNdxw.js +0 -1
- package/dist/assets/ElementDetailView-9EkxZAaF.js +0 -2
- package/dist/assets/OntologyDecompositionDiagram-DjhvdWh5.js +0 -1
- package/dist/assets/ScenarioEditor-BL835I2V.js +0 -3
- package/dist/assets/SysmlGenerator-B_Me_xGE.js +0 -1
- package/dist/assets/index-BMgENwvO.js +0 -3280
- package/dist/assets/index-XtCtnAfF.css +0 -1
- package/dist/assets/layout-selection-ClQts3bC.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/*! tailwindcss v4.2.1 | MIT License | https://tailwindcss.com */@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-space-y-reverse:0;--tw-border-style:solid;--tw-leading:initial;--tw-font-weight:initial;--tw-tracking:initial;--tw-ordinal:initial;--tw-slashed-zero:initial;--tw-numeric-figure:initial;--tw-numeric-spacing:initial;--tw-numeric-fraction:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-outline-style:solid;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-ease:initial}}}@layer theme{:root,:host{--font-sans:ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";--font-mono:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;--color-red-50:oklch(97.1% .013 17.38);--color-red-500:oklch(63.7% .237 25.331);--color-slate-50:oklch(98.4% .003 247.858);--color-gray-50:oklch(98.5% .002 247.839);--color-gray-100:oklch(96.7% .003 264.542);--spacing:.25rem;--container-sm:24rem;--container-md:28rem;--container-lg:32rem;--container-2xl:42rem;--container-3xl:48rem;--container-5xl:64rem;--text-xs:.75rem;--text-xs--line-height:calc(1 / .75);--text-sm:.875rem;--text-sm--line-height:calc(1.25 / .875);--text-base:1rem;--text-base--line-height: 1.5 ;--text-lg:1.125rem;--text-lg--line-height:calc(1.75 / 1.125);--text-xl:1.25rem;--text-xl--line-height:calc(1.75 / 1.25);--text-2xl:1.5rem;--text-2xl--line-height:calc(2 / 1.5);--text-3xl:1.875rem;--text-3xl--line-height: 1.2 ;--font-weight-normal:400;--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--tracking-wide:.025em;--tracking-wider:.05em;--leading-relaxed:1.625;--radius-sm:.25rem;--radius-md:.375rem;--radius-lg:.5rem;--radius-xl:.75rem;--radius-2xl:1rem;--ease-in-out:cubic-bezier(.4, 0, .2, 1);--animate-pulse:pulse 2s cubic-bezier(.4, 0, .6, 1) infinite;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;-moz-tab-size:4;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab,red,red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){-webkit-appearance:button;-moz-appearance:button;appearance:button}::file-selector-button{-webkit-appearance:button;-moz-appearance:button;appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.pointer-events-none{pointer-events:none}.collapse{visibility:collapse}.invisible{visibility:hidden}.visible{visibility:visible}.sr-only{clip-path:inset(50%);white-space:nowrap;border-width:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.static{position:static}.sticky{position:sticky}.inset-0{inset:calc(var(--spacing) * 0)}.inset-x-0{inset-inline:calc(var(--spacing) * 0)}.start{inset-inline-start:var(--spacing)}.end{inset-inline-end:var(--spacing)}.top-0{top:calc(var(--spacing) * 0)}.top-3{top:calc(var(--spacing) * 3)}.top-7{top:calc(var(--spacing) * 7)}.top-16{top:calc(var(--spacing) * 16)}.top-full{top:100%}.right-0{right:calc(var(--spacing) * 0)}.right-3{right:calc(var(--spacing) * 3)}.bottom-3{bottom:calc(var(--spacing) * 3)}.bottom-12{bottom:calc(var(--spacing) * 12)}.left-0{left:calc(var(--spacing) * 0)}.left-1\/2{left:50%}.left-3{left:calc(var(--spacing) * 3)}.left-full{left:100%}.isolate{isolation:isolate}.z-10{z-index:10}.z-20{z-index:20}.z-30{z-index:30}.z-50{z-index:50}.container{width:100%}@media(min-width:40rem){.container{max-width:40rem}}@media(min-width:48rem){.container{max-width:48rem}}@media(min-width:64rem){.container{max-width:64rem}}@media(min-width:80rem){.container{max-width:80rem}}@media(min-width:96rem){.container{max-width:96rem}}.-mx-6{margin-inline:calc(var(--spacing) * -6)}.mx-1{margin-inline:calc(var(--spacing) * 1)}.mx-4{margin-inline:calc(var(--spacing) * 4)}.mx-auto{margin-inline:auto}.mt-0\.5{margin-top:calc(var(--spacing) * .5)}.mt-1{margin-top:calc(var(--spacing) * 1)}.mt-1\.5{margin-top:calc(var(--spacing) * 1.5)}.mt-2{margin-top:calc(var(--spacing) * 2)}.mt-3{margin-top:calc(var(--spacing) * 3)}.mt-4{margin-top:calc(var(--spacing) * 4)}.mt-6{margin-top:calc(var(--spacing) * 6)}.mt-8{margin-top:calc(var(--spacing) * 8)}.mr-0\.5{margin-right:calc(var(--spacing) * .5)}.mr-1\.5{margin-right:calc(var(--spacing) * 1.5)}.mr-2{margin-right:calc(var(--spacing) * 2)}.mb-0\.5{margin-bottom:calc(var(--spacing) * .5)}.mb-1{margin-bottom:calc(var(--spacing) * 1)}.mb-1\.5{margin-bottom:calc(var(--spacing) * 1.5)}.mb-2{margin-bottom:calc(var(--spacing) * 2)}.mb-3{margin-bottom:calc(var(--spacing) * 3)}.mb-4{margin-bottom:calc(var(--spacing) * 4)}.mb-5{margin-bottom:calc(var(--spacing) * 5)}.mb-6{margin-bottom:calc(var(--spacing) * 6)}.mb-8{margin-bottom:calc(var(--spacing) * 8)}.ml-1{margin-left:calc(var(--spacing) * 1)}.ml-2{margin-left:calc(var(--spacing) * 2)}.ml-3{margin-left:calc(var(--spacing) * 3)}.ml-auto{margin-left:auto}.block{display:block}.contents{display:contents}.flex{display:flex}.grid{display:grid}.hidden{display:none}.inline{display:inline}.inline-block{display:inline-block}.inline-flex{display:inline-flex}.table{display:table}.h-1{height:calc(var(--spacing) * 1)}.h-1\.5{height:calc(var(--spacing) * 1.5)}.h-2{height:calc(var(--spacing) * 2)}.h-2\.5{height:calc(var(--spacing) * 2.5)}.h-3{height:calc(var(--spacing) * 3)}.h-4{height:calc(var(--spacing) * 4)}.h-5{height:calc(var(--spacing) * 5)}.h-6{height:calc(var(--spacing) * 6)}.h-full{height:100%}.h-screen{height:100vh}.max-h-48{max-height:calc(var(--spacing) * 48)}.max-h-64{max-height:calc(var(--spacing) * 64)}.w-2{width:calc(var(--spacing) * 2)}.w-2\.5{width:calc(var(--spacing) * 2.5)}.w-3{width:calc(var(--spacing) * 3)}.w-5{width:calc(var(--spacing) * 5)}.w-6{width:calc(var(--spacing) * 6)}.w-8{width:calc(var(--spacing) * 8)}.w-20{width:calc(var(--spacing) * 20)}.w-64{width:calc(var(--spacing) * 64)}.w-full{width:100%}.max-w-2xl{max-width:var(--container-2xl)}.max-w-3xl{max-width:var(--container-3xl)}.max-w-5xl{max-width:var(--container-5xl)}.max-w-lg{max-width:var(--container-lg)}.max-w-md{max-width:var(--container-md)}.max-w-sm{max-width:var(--container-sm)}.min-w-0{min-width:calc(var(--spacing) * 0)}.min-w-48{min-width:calc(var(--spacing) * 48)}.min-w-\[80px\]{min-width:80px}.min-w-\[140px\]{min-width:140px}.flex-1{flex:1}.flex-shrink-0{flex-shrink:0}.grow{flex-grow:1}.border-collapse{border-collapse:collapse}.-translate-x-1\/2{--tw-translate-x: -50% ;translate:var(--tw-translate-x) var(--tw-translate-y)}.transform{transform:var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,)}.animate-pulse{animation:var(--animate-pulse)}.cursor-pointer{cursor:pointer}.resize{resize:both}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-baseline{align-items:baseline}.items-center{align-items:center}.items-start{align-items:flex-start}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.justify-end{justify-content:flex-end}.gap-0{gap:calc(var(--spacing) * 0)}.gap-0\.5{gap:calc(var(--spacing) * .5)}.gap-1{gap:calc(var(--spacing) * 1)}.gap-1\.5{gap:calc(var(--spacing) * 1.5)}.gap-2{gap:calc(var(--spacing) * 2)}.gap-2\.5{gap:calc(var(--spacing) * 2.5)}.gap-3{gap:calc(var(--spacing) * 3)}.gap-4{gap:calc(var(--spacing) * 4)}.gap-5{gap:calc(var(--spacing) * 5)}:where(.space-y-1>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 1) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 1) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-1\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 1.5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 1.5) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-2>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 2) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 2) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-3>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 3) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 3) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-4>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 4) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 4) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 5) * calc(1 - var(--tw-space-y-reverse)))}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-y-auto{overflow-y:auto}.rounded{border-radius:.25rem}.rounded-2xl{border-radius:var(--radius-2xl)}.rounded-full{border-radius:3.40282e38px}.rounded-lg{border-radius:var(--radius-lg)}.rounded-md{border-radius:var(--radius-md)}.rounded-sm{border-radius:var(--radius-sm)}.rounded-xl{border-radius:var(--radius-xl)}.border{border-style:var(--tw-border-style);border-width:1px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-l{border-left-style:var(--tw-border-style);border-left-width:1px}.bg-slate-50{background-color:var(--color-slate-50)}.p-1\.5{padding:calc(var(--spacing) * 1.5)}.p-2{padding:calc(var(--spacing) * 2)}.p-2\.5{padding:calc(var(--spacing) * 2.5)}.p-3{padding:calc(var(--spacing) * 3)}.p-4{padding:calc(var(--spacing) * 4)}.p-5{padding:calc(var(--spacing) * 5)}.p-6{padding:calc(var(--spacing) * 6)}.p-8{padding:calc(var(--spacing) * 8)}.px-1{padding-inline:calc(var(--spacing) * 1)}.px-1\.5{padding-inline:calc(var(--spacing) * 1.5)}.px-2{padding-inline:calc(var(--spacing) * 2)}.px-2\.5{padding-inline:calc(var(--spacing) * 2.5)}.px-3{padding-inline:calc(var(--spacing) * 3)}.px-4{padding-inline:calc(var(--spacing) * 4)}.px-5{padding-inline:calc(var(--spacing) * 5)}.px-6{padding-inline:calc(var(--spacing) * 6)}.py-0\.5{padding-block:calc(var(--spacing) * .5)}.py-1{padding-block:calc(var(--spacing) * 1)}.py-1\.5{padding-block:calc(var(--spacing) * 1.5)}.py-2{padding-block:calc(var(--spacing) * 2)}.py-2\.5{padding-block:calc(var(--spacing) * 2.5)}.py-3{padding-block:calc(var(--spacing) * 3)}.py-4{padding-block:calc(var(--spacing) * 4)}.py-5{padding-block:calc(var(--spacing) * 5)}.py-6{padding-block:calc(var(--spacing) * 6)}.py-8{padding-block:calc(var(--spacing) * 8)}.py-12{padding-block:calc(var(--spacing) * 12)}.py-16{padding-block:calc(var(--spacing) * 16)}.pt-0\.5{padding-top:calc(var(--spacing) * .5)}.pt-1{padding-top:calc(var(--spacing) * 1)}.pt-2{padding-top:calc(var(--spacing) * 2)}.pt-4{padding-top:calc(var(--spacing) * 4)}.pt-5{padding-top:calc(var(--spacing) * 5)}.pt-24{padding-top:calc(var(--spacing) * 24)}.pb-1{padding-bottom:calc(var(--spacing) * 1)}.pb-2{padding-bottom:calc(var(--spacing) * 2)}.pb-3{padding-bottom:calc(var(--spacing) * 3)}.text-center{text-align:center}.text-left{text-align:left}.text-right{text-align:right}.font-mono{font-family:var(--font-mono)}.text-2xl{font-size:var(--text-2xl);line-height:var(--tw-leading,var(--text-2xl--line-height))}.text-3xl{font-size:var(--text-3xl);line-height:var(--tw-leading,var(--text-3xl--line-height))}.text-base{font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--line-height))}.text-lg{font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xl{font-size:var(--text-xl);line-height:var(--tw-leading,var(--text-xl--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.leading-relaxed{--tw-leading:var(--leading-relaxed);line-height:var(--leading-relaxed)}.font-bold{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-normal{--tw-font-weight:var(--font-weight-normal);font-weight:var(--font-weight-normal)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.tracking-wide{--tw-tracking:var(--tracking-wide);letter-spacing:var(--tracking-wide)}.tracking-wider{--tw-tracking:var(--tracking-wider);letter-spacing:var(--tracking-wider)}.break-all{word-break:break-all}.text-red-500{color:var(--color-red-500)}.capitalize{text-transform:capitalize}.uppercase{text-transform:uppercase}.italic{font-style:italic}.tabular-nums{--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.line-through{text-decoration-line:line-through}.underline{text-decoration-line:underline}.shadow{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-2xl{--tw-shadow:0 25px 50px -12px var(--tw-shadow-color,#00000040);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-lg{--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,#0000001a), 0 4px 6px -4px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-xl{--tw-shadow:0 20px 25px -5px var(--tw-shadow-color,#0000001a), 0 8px 10px -6px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.outline{outline-style:var(--tw-outline-style);outline-width:1px}.blur{--tw-blur:blur(8px);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.filter{filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-all{transition-property:all;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-opacity{transition-property:opacity;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.ease-in-out{--tw-ease:var(--ease-in-out);transition-timing-function:var(--ease-in-out)}.select-none{-webkit-user-select:none;user-select:none}@media(hover:hover){.hover\:bg-gray-50:hover{background-color:var(--color-gray-50)}.hover\:bg-gray-100:hover{background-color:var(--color-gray-100)}.hover\:bg-red-50:hover{background-color:var(--color-red-50)}.hover\:underline:hover{text-decoration-line:underline}}.focus\:outline-none:focus{--tw-outline-style:none;outline-style:none}@media(min-width:48rem){.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}}}:root{--color-bg:#f7f7f5;--color-surface:#fff;--color-surface-alt:#f0f0ed;--color-border:#e5e5e0;--color-border-light:#ededea;--color-text:#1a1a1a;--color-text-secondary:#6b7280;--color-text-muted:#9ca3af;--color-accent:#2dd4a8;--color-hero-from:#1b3a4b;--color-hero-to:#2d6a7a}body{background:var(--color-bg);color:var(--color-text);-webkit-font-smoothing:antialiased;margin:0;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Inter,Roboto,sans-serif}#root{flex-direction:column;height:100vh;display:flex}.react-flow__controls{overflow:hidden;border:1px solid #e5e5e0!important;border-radius:12px!important;box-shadow:0 1px 3px #0000000f!important}.react-flow__controls-button{fill:#6b7280!important;background:#fff!important;border-bottom:1px solid #ededea!important}.react-flow__controls-button:hover{background:#f0f0ed!important}.react-flow__minimap{overflow:hidden;border:1px solid #e5e5e0!important;border-radius:12px!important;box-shadow:0 1px 3px #0000000f!important}::-webkit-scrollbar{width:6px}::-webkit-scrollbar-track{background:0 0}::-webkit-scrollbar-thumb{background:#d1d5db;border-radius:3px}::-webkit-scrollbar-thumb:hover{background:#9ca3af}.memo-explorer-resizer{z-index:30;cursor:col-resize;touch-action:none;outline:none;width:8px;position:absolute;top:0;bottom:0;right:-4px}.memo-explorer-resizer:after{content:"";background:0 0;width:2px;transition:background .12s;position:absolute;top:0;bottom:0;right:3px}.memo-explorer-resizer:hover:after,.memo-explorer-resizer:focus-visible:after{background:#38bdf8}.react-flow__node{transition:box-shadow .15s,opacity .15s}.ibd-interconnection-edge .react-flow__edge-interaction{pointer-events:none}@keyframes memo-ibd-flow{to{stroke-dashoffset:-30px}}.memo-ibd-flow{stroke-dasharray:8 7;pointer-events:none;animation:.7s linear infinite memo-ibd-flow}@media(prefers-reduced-motion:reduce){.memo-ibd-flow{animation:none}}.react-flow__edge path{transition:stroke-width .15s}.react-flow__edge:hover path{stroke-width:3px}.react-flow__node:hover .react-flow__handle{opacity:1!important}.react-flow__node:hover .react-flow__handle.ibd-port-anchor,.react-flow__handle.ibd-port-anchor{opacity:0!important;pointer-events:none!important}.react-flow__node:hover .react-flow__handle.ibd-port-connect,.react-flow__handle.ibd-port-connect{opacity:0!important}@property --tw-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-z{syntax:"*";inherits:false;initial-value:0}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-tracking{syntax:"*";inherits:false}@property --tw-ordinal{syntax:"*";inherits:false}@property --tw-slashed-zero{syntax:"*";inherits:false}@property --tw-numeric-figure{syntax:"*";inherits:false}@property --tw-numeric-spacing{syntax:"*";inherits:false}@property --tw-numeric-fraction{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@property --tw-ease{syntax:"*";inherits:false}@keyframes pulse{50%{opacity:.5}}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{f as Bt,H as tt,R as Gt,I as Be,F as it,V as un,u as le,J as vn}from"./index-CVW92JY7.js";import{r as kn,D as Cn}from"./layout-providers-Dr743WlP.js";import{j as _}from"./reactflow-CsCqNKB-.js";import{a as ft}from"./zustand-CrhqMOHB.js";const Qt=new Set(["composedOf","composes","decomposedBy","aggregation"]);function ge(e,t,o=Qt){const r=new Map;for(const a of e)r.set(a.id,a);const s=new Map,l=new Set;for(const a of t)o.has(a.type)&&(!r.has(a.sourceId)||!r.has(a.targetId)||a.sourceId!==a.targetId&&(l.has(a.targetId)||(s.has(a.sourceId)||s.set(a.sourceId,[]),s.get(a.sourceId).push(a.targetId),l.add(a.targetId))));return{roots:[...r.keys()].filter(a=>!l.has(a)),childrenMap:s,elements:r}}function os(e,t){const o=[],r=(s,l,h)=>{const a=e.childrenMap.get(s)??[];a.length>0&&l>=t&&o.push(s);for(const i of a)h.has(i)||(h.add(i),r(i,l+1,h))};for(const s of e.roots)r(s,0,new Set([s]));return o}function ss(e){if(e.elements.size===0)return null;const t=new Set,o=s=>{if(!t.has(s)){t.add(s);for(const l of e.childrenMap.get(s)??[])o(l)}};e.roots[0]&&o(e.roots[0]);const r=[...e.elements.keys()].filter(s=>!t.has(s));return e.roots.length===1&&r.length===0?null:{rootIds:e.roots,disconnectedIds:r}}const An=new Set(["name","title","description","shortDescription","longDescription","sourceReference","rationaleText","semantics","protocolSemantics","queryDescription","dataSourceDescription","documentUsage","doc"]);function On(e,t=4){const o=[];e.shortId&&o.push({key:"id",value:e.shortId});for(const[r,s]of Object.entries(e.attributes)){if(o.length>=t)break;if(An.has(r)||r.includes(".")||r==="id"&&o.some(h=>h.key==="id"))continue;const l=s.split("::").pop().trim();!l||l.length>28||o.push({key:r,value:l})}return o.slice(0,t)}const Kt={layout:(e,t)=>kn(e,t)},Nn=(e,t,o,r=10)=>{const s=o.x-r,l=o.x+o.width+r,h=o.y-r,a=o.y+o.height+r;return e.y===t.y?e.y>=h&&e.y<=a&&Math.max(e.x,t.x)>=s&&Math.min(e.x,t.x)<=l:e.x===t.x?e.x>=s&&e.x<=l&&Math.max(e.y,t.y)>=h&&Math.min(e.y,t.y)<=a:!1},gn=(e,t,o,r)=>e.y===t.y&&o.y===r.y&&e.y===o.y?Math.max(Math.min(e.x,t.x),Math.min(o.x,r.x))<Math.min(Math.max(e.x,t.x),Math.max(o.x,r.x)):e.x===t.x&&o.x===r.x&&e.x===o.x?Math.max(Math.min(e.y,t.y),Math.min(o.y,r.y))<Math.min(Math.max(e.y,t.y),Math.max(o.y,r.y)):!1,fn=(e,t,o,r)=>{const s=e.y===t.y,l=o.y===r.y;if(s===l)return!1;const h=s?e:o,a=s?t:r,i=s?o:e,f=s?r:t;return i.x>Math.min(h.x,a.x)&&i.x<Math.max(h.x,a.x)&&h.y>Math.min(i.y,f.y)&&h.y<Math.max(i.y,f.y)},_n=26,We=(e,t,o)=>t==="left"?{x:e.x-o,y:e.y}:t==="right"?{x:e.x+o,y:e.y}:t==="top"?{x:e.x,y:e.y-o}:{x:e.x,y:e.y+o};function te(e,t,o=18,r="long-first"){const s=new Map,l=[],h=Math.max(12,o*.75),a=[...e].sort((i,f)=>(r==="long-first"?1:-1)*(Math.abs(f.source.x-f.target.x)+Math.abs(f.source.y-f.target.y)-(Math.abs(i.source.x-i.target.x)+Math.abs(i.source.y-i.target.y))));for(const i of a){const{source:f,target:p}=i,d=Math.abs(f.x-p.x)+Math.abs(f.y-p.y),I=Math.min(_n,d/3),y=!!i.sourceSide&&I>.5,m=!!i.targetSide&&I>.5,u=y?We(f,i.sourceSide,I):f,c=m?We(p,i.targetSide,I):p,E=(n,g)=>g.x>n.x-h&&g.x<n.x+n.width+h&&g.y>n.y-h&&g.y<n.y+n.height+h,M=t.filter(n=>n.id!==i.sourceNodeId&&n.id!==i.targetNodeId&&!E(n,f)&&!E(n,p)),v=new Set([u.x,c.x,(u.x+c.x)/2,u.x-o,u.x+o,c.x-o,c.x+o]),b=new Set([u.y,c.y,(u.y+c.y)/2,u.y-o,u.y+o,c.y-o,c.y+o]);for(const n of M)v.add(n.x-h),v.add(n.x+n.width+h),b.add(n.y-h),b.add(n.y+n.height+h);for(const[n,g]of l)v.add(n.x),v.add(g.x),b.add(n.y),b.add(g.y);const C=[...v].sort((n,g)=>n-g),T=[...b].sort((n,g)=>n-g),j=[],G=new Map,H=(n,g)=>`${n.toFixed(3)}:${g.toFixed(3)}`,V=n=>M.some(g=>n.x>g.x-h&&n.x<g.x+g.width+h&&n.y>g.y-h&&n.y<g.y+g.height+h);for(const n of T)for(const g of C){const S={x:g,y:n};V(S)&&H(g,n)!==H(u.x,u.y)&&H(g,n)!==H(c.x,c.y)||(G.set(H(g,n),j.length),j.push(S))}const J=new Map,xt=(n,g)=>{J.has(n)||J.set(n,[]),J.has(g)||J.set(g,[]),J.get(n).push(g),J.get(g).push(n)},ht=(n,g)=>!M.some(S=>Nn(n,g,S,h-1));for(const n of T){const g=C.map(S=>G.get(H(S,n))).filter(S=>S!==void 0);for(let S=1;S<g.length;S++)ht(j[g[S-1]],j[g[S]])&&xt(g[S-1],g[S])}for(const n of C){const g=T.map(S=>G.get(H(n,S))).filter(S=>S!==void 0);for(let S=1;S<g.length;S++)ht(j[g[S-1]],j[g[S]])&&xt(g[S-1],g[S])}const D=G.get(H(u.x,u.y)),vt=G.get(H(c.x,c.y)),St=(n,g)=>`${n}:${g}`,at=D===void 0?[]:[{node:D,dir:"N",g:0,f:Math.abs(u.x-c.x)+Math.abs(u.y-c.y)}],kt=new Map(D===void 0?[]:[[St(D,"N"),0]]),Mt=new Map;at[0]&&Mt.set(St(at[0].node,at[0].dir),at[0]);let yt;const dt=(n,g,S)=>!S||S==="left"&&g.x<n.x||S==="right"&&g.x>n.x||S==="top"&&g.y<n.y||S==="bottom"&&g.y>n.y,wt=(n,g,S)=>!S||(S==="left"?g.x<=n.x:S==="right"?g.x>=n.x:S==="top"?g.y<=n.y:g.y>=n.y),Ot=y?wt:dt,It=m?wt:dt;for(;at.length>0;){at.sort((g,S)=>g.f-S.f);const n=at.shift();if(n.node===vt){yt=n;break}for(const g of J.get(n.node)??[]){const S=j[n.node],O=j[g];if(n.node===D&&!Ot(S,O,i.sourceSide)||g===vt&&!It(O,S,i.targetSide))continue;const N=S.y===O.y?"H":"V",L=Math.abs(S.x-O.x)+Math.abs(S.y-O.y);let P=n.dir!=="N"&&n.dir!==N?90:0;for(const[w,F]of l)gn(S,O,w,F)?P+=4e3:fn(S,O,w,F)&&(P+=600);const $=Math.abs(S.x-c.x)+Math.abs(S.y-c.y),X=Math.abs(O.x-c.x)+Math.abs(O.y-c.y);X>$&&(P+=(X-$)*1.5);const Et=n.g+L+P,Q=St(g,N);if(Et>=(kt.get(Q)??Number.POSITIVE_INFINITY))continue;const mt={node:g,dir:N,g:Et,f:Et+X,parent:St(n.node,n.dir)};kt.set(Q,Et),Mt.set(Q,mt),at.push(mt)}}let rt=[];if(yt){let n=yt;for(;n;)rt.push(j[n.node]),n=n.parent?Mt.get(n.parent):void 0;rt.reverse()}if(rt.length<2){const n=(u.x+c.x)/2;rt=[u,{x:n,y:u.y},{x:n,y:c.y},c]}y&&rt.unshift(f),m&&rt.push(p);const bt=rt.filter((n,g)=>g===0||g===rt.length-1||!(rt[g-1].x===n.x&&n.x===rt[g+1].x||rt[g-1].y===n.y&&n.y===rt[g+1].y));s.set(i.id,bt);for(let n=1;n<bt.length;n++)l.push([bt[n-1],bt[n]])}return s}const je=(e,t)=>{const o=Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x),r=Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y);return o>0&&r>0?o*r:0},Tn=(e,t,o)=>{if(e.y===t.y){if(e.y<o.y||e.y>o.y+o.height)return 0;const r=Math.min(Math.max(e.x,t.x),o.x+o.width)-Math.max(Math.min(e.x,t.x),o.x);return Math.max(r,0)}if(e.x===t.x){if(e.x<o.x||e.x>o.x+o.width)return 0;const r=Math.min(Math.max(e.y,t.y),o.y+o.height)-Math.max(Math.min(e.y,t.y),o.y);return Math.max(r,0)}return 0};function fe(e,t){var a;const o=new Map,r=[],s=i=>i.slice(1).reduce((f,p,d)=>f+Math.abs(p.x-i[d].x)+Math.abs(p.y-i[d].y),0),l=e.flatMap(i=>i.points.slice(1).map((f,p)=>({edgeId:i.id,a:i.points[p],b:f}))),h=[...e].sort((i,f)=>s(f.points)-s(i.points));for(const i of h){const{points:f,width:p,height:d}=i;if(f.length<2)continue;const I=[];for(let u=1;u<f.length;u++){const c=f[u-1],E=f[u],M=Math.abs(E.x-c.x)+Math.abs(E.y-c.y),v=Math.abs(E.x-c.x)>=Math.abs(E.y-c.y),b=d/2+4;for(const C of M>=p*1.5?[.5,.3,.7]:[.5,.25,.75]){const T={x:c.x+(E.x-c.x)*C,y:c.y+(E.y-c.y)*C};for(const j of[-1,1])I.push({center:v?{x:T.x,y:T.y+j*b}:{x:T.x+j*(p/2+4),y:T.y},segmentLength:M})}}let y=((a=I[0])==null?void 0:a.center)??f[0],m=Number.POSITIVE_INFINITY;for(const u of I){const c={x:u.center.x-p/2,y:u.center.y-d/2,width:p,height:d};let E=0;for(const M of r)E+=je(c,M)*3;for(const M of t)E+=je(c,M)*4;for(const M of l)M.edgeId!==i.id&&(E+=Tn(M.a,M.b,c)*12*2.5);E+=Math.max(0,p*1.4-u.segmentLength)*2,E<m&&(m=E,y=u.center)}o.set(i.id,y),r.push({x:y.x-p/2,y:y.y-d/2,width:p,height:d})}return o}const me=20,ye=e=>e.length*6.4+12;function Fn(e){const{connectors:t,rects:o}=e,r=e.obstacles??[...o.entries()].map(([y,m])=>({id:y,...m})),s=[],l=new Map;for(const y of t){const m=o.get(y.sourceId),u=o.get(y.targetId);if(!m||!u||y.sourceId===y.targetId)continue;const c=C=>({x:C.x+C.width/2,y:C.y+C.height/2}),E=Math.abs(c(u).x-c(m).x)>=Math.abs(c(u).y-c(m).y),M=E?c(u).x>=c(m).x:c(u).y>=c(m).y,v=E?M?"right":"left":M?"bottom":"top",b=E?M?"left":"right":M?"top":"bottom";l.set(y.id,{source:v,target:b}),s.push({connectorId:y.id,nodeId:y.sourceId,side:v,otherCentre:c(u)}),s.push({connectorId:y.id,nodeId:y.targetId,side:b,otherCentre:c(m)})}const h=new Map,a=(y,m)=>`${y}\0${m}`,i=new Map;for(const y of s){const m=`${y.nodeId}\0${y.side}`;i.set(m,[...i.get(m)??[],y])}for(const y of i.values()){const m=o.get(y[0].nodeId),u=y[0].side==="left"||y[0].side==="right",c=[...y].sort((v,b)=>u?v.otherCentre.y-b.otherCentre.y:v.otherCentre.x-b.otherCentre.x),E=(u?m.height:m.width)*.7,M=(u?m.y+m.height/2:m.x+m.width/2)-E/2;c.forEach((v,b)=>{const C=c.length===1?(u?m.height:m.width)/2:M+E*(b/(c.length-1))-(u?m.y:m.x);h.set(a(v.connectorId,v.nodeId),{x:v.side==="left"?m.x:v.side==="right"?m.x+m.width:m.x+(u?m.width/2:C),y:v.side==="top"?m.y:v.side==="bottom"?m.y+m.height:m.y+(u?C:m.height/2)})})}const f=[];for(const y of t){const m=l.get(y.id);m&&f.push({id:y.id,source:h.get(a(y.id,y.sourceId)),target:h.get(a(y.id,y.targetId)),sourceNodeId:y.sourceId,targetNodeId:y.targetId,sourceSide:m.source,targetSide:m.target})}const p=te(f,r,e.channelGap),d=fe(t.flatMap(y=>{const m=p.get(y.id);return y.label&&m&&m.length>=2?[{id:y.id,points:m,width:ye(y.label),height:me}]:[]}),r),I=new Map;for(const[y,m]of p)I.set(y,{points:m,labelPoint:d.get(y)});return I}function Pn(e,t,o=1.5){if(e<=0||t<=0)return Number.POSITIVE_INFINITY;const r=1+1.35*Math.abs(Math.log(e/t/o));return e*t*r}function Dn(e,t=1.25){return e<=1?Math.max(e,1):Math.min(e,Math.max(2,Math.round(Math.sqrt(e*t))))}function mn(e,t){const o=new Set(e.map(f=>f.id)),r=new Map,s=new Map(e.map(f=>[f.id,0]));for(const f of t)!o.has(f.source)||!o.has(f.target)||f.source===f.target||(r.has(f.source)||r.set(f.source,[]),r.get(f.source).push(f.target),s.set(f.target,(s.get(f.target)??0)+1));const l=e.map(f=>f.id),h=l.filter(f=>(s.get(f)??0)===0),a=[],i=new Set;for(;h.length;){const f=h.shift();if(!i.has(f)){i.add(f),a.push(f);for(const p of r.get(f)??[])s.set(p,(s.get(p)??1)-1),s.get(p)===0&&h.push(p)}}for(const f of l)i.has(f)||a.push(f);return a}function Ln(e,t,o,r,s){const l=new Map(e.map(u=>[u.id,u])),h=mn(e,t).map(u=>l.get(u)),a=Dn(e.length,s),i=Math.ceil(e.length/a),f=h.map((u,c)=>{const E=Math.floor(c/a),M=c%a,v=E%2===0?M:a-1-M;return{node:u,row:E,col:v}}),p=Array.from({length:a},()=>0),d=Array.from({length:i},()=>0);for(const{node:u,row:c,col:E}of f)p[E]=Math.max(p[E],u.width),d[c]=Math.max(d[c],u.height);const I=p.map((u,c)=>c===0?0:p.slice(0,c).reduce((E,M)=>E+M,0)+o*c),y=d.map((u,c)=>c===0?0:d.slice(0,c).reduce((E,M)=>E+M,0)+r*c),m=f.map(({node:u,row:c,col:E})=>({...u,x:I[E]+(p[E]-u.width)/2,y:y[c]+(d[c]-u.height)/2}));return{strategy:"balanced-board",width:p.reduce((u,c)=>u+c,0)+o*Math.max(a-1,0),height:d.reduce((u,c)=>u+c,0)+r*Math.max(i-1,0),children:m}}function Rn(e,t,o,r){const s={x:e.x+e.width/2,y:e.y+e.height/2},l={x:t.x+t.width/2,y:t.y+t.height/2},h={x:o.x+o.width/2,y:o.y+o.height/2},a={x:r.x+r.width/2,y:r.y+r.height/2},i=(f,p,d)=>(p.x-f.x)*(d.y-f.y)-(p.y-f.y)*(d.x-f.x);return i(s,l,h)*i(s,l,a)<0&&i(h,a,s)*i(h,a,l)<0}function He(e,t,o=1.5){const r=new Map(e.children.map(m=>[m.id,m]));let s=0,l=0,h=0,a=0;const i=t.filter(m=>r.has(m.source)&&r.has(m.target));for(const m of i){const u=r.get(m.source),c=r.get(m.target);s+=Math.abs(u.x+u.width/2-(c.x+c.width/2))+Math.abs(u.y+u.height/2-(c.y+c.height/2));const E=c.x+c.width/2-(u.x+u.width/2),M=Math.abs(c.y+c.height/2-(u.y+u.height/2));E<=0&&(h+=55e3),h+=Math.max(0,M-Math.max(E,0))*80,Math.abs(E)>8&&M>8&&(a+=18e3)}for(let m=0;m<i.length;m++)for(let u=m+1;u<i.length;u++){const c=i[m],E=i[u];c.source===E.source||c.source===E.target||c.target===E.source||c.target===E.target||Rn(r.get(c.source),r.get(c.target),r.get(E.source),r.get(E.target))&&l++}const f=te(i.map(m=>{const u=r.get(m.source),c=r.get(m.target);return{id:m.id,source:{x:u.x+u.width,y:u.y+u.height/2},target:{x:c.x,y:c.y+c.height/2},sourceNodeId:m.source,targetNodeId:m.target,sourceSide:"right",targetSide:"left"}}),e.children);let p=0,d=0,I=0;const y=[];for(const[m,u]of f){d+=Math.max(0,u.length-2);for(let c=1;c<u.length;c++)p+=Math.abs(u[c].x-u[c-1].x)+Math.abs(u[c].y-u[c-1].y),y.push({edgeId:m,a:u[c-1],b:u[c]})}for(let m=0;m<y.length;m++)for(let u=m+1;u<y.length;u++){const c=y[m],E=y[u];c.edgeId!==E.edgeId&&(gn(c.a,c.b,E.a,E.b)||fn(c.a,c.b,E.a,E.b))&&I++}return Pn(e.width,e.height,o)+s*18+h+a+l*Math.max(e.width*e.height*.35,5e4)+p*6+d*4e3+I*Math.max(e.width*e.height*.45,7e4)}async function ze(e){const{nodes:t,edges:o}=e;if(t.length===0)return{strategy:"balanced-board",width:0,height:0,children:[]};const r=e.targetAspect??1.5,s=e.gapX??54,l=e.gapY??58,h=i=>{const f=new Map(t.map(c=>[c.id,c])),p=mn(t,o).map(c=>f.get(c));let d=0;const I=Math.max(...i==="RIGHT"?p.map(c=>c.height):p.map(c=>c.width));let y=p.map(c=>{const E={...c,x:i==="RIGHT"?d:(I-c.width)/2,y:i==="DOWN"?d:(I-c.height)/2};return d+=i==="RIGHT"?c.width+s:c.height+l,E});if(i==="RIGHT"&&o.some(c=>c.sourceAnchorY!==void 0&&c.targetAnchorY!==void 0)){new Map(y.map(b=>[b.id,b]));const c=new Map,E=[...y].sort((b,C)=>C.width*C.height-b.width*b.height)[0];c.set(E.id,0);let M=!0;for(;M;){M=!1;for(const b of o){if(b.sourceAnchorY===void 0||b.targetAnchorY===void 0)continue;const C=c.get(b.source),T=c.get(b.target);C!==void 0&&T===void 0?(c.set(b.target,C+b.sourceAnchorY-b.targetAnchorY),M=!0):T!==void 0&&C===void 0&&(c.set(b.source,T+b.targetAnchorY-b.sourceAnchorY),M=!0)}}y=y.map(b=>({...b,y:c.get(b.id)??b.y}));const v=Math.min(...y.map(b=>b.y));y=y.map(b=>({...b,y:b.y-v}))}const m=Math.max(...y.map(c=>c.x+c.width)),u=Math.max(...y.map(c=>c.y+c.height));return{strategy:i==="RIGHT"?"layered-right":"layered-down",width:m,height:u,children:y}};if(e.directedFlowAxis==="RIGHT")return h("RIGHT");if(e.directedFlowAxis==="DOWN")return h("DOWN");const a=[Ln(t,o,s,l,r),h("RIGHT"),h("DOWN")];if(t.length>=3&&o.length>0)try{const i=new Map(t.filter(u=>{var c;return(c=u.ports)==null?void 0:c.length}).map(u=>[u.id,u])),f={left:"WEST",right:"EAST",top:"NORTH",bottom:"SOUTH"},p=new Set((e.graphPorts??[]).map(u=>u.id)),d=(e.graphPorts??[]).map(u=>({id:u.id,width:1,height:1,layoutOptions:{"elk.layered.layering.layerConstraint":u.side==="right"?"LAST_SEPARATE":"FIRST_SEPARATE"}})),y=(await Kt.layout({id:`resolver-${e.id}`,layoutOptions:{"elk.algorithm":"layered","elk.direction":"RIGHT","elk.edgeRouting":"ORTHOGONAL","elk.aspectRatio":String(r),"elk.padding":"[top=0,left=0,bottom=0,right=0]","elk.spacing.nodeNode":String(l),"elk.layered.spacing.nodeNodeBetweenLayers":String(s),"elk.layered.nodePlacement.strategy":"BRANDES_KOEPF","elk.layered.nodePlacement.favorStraightEdges":"true","elk.layered.crossingMinimization.strategy":"LAYER_SWEEP","elk.layered.crossingMinimization.semiInteractive":"true","elk.layered.thoroughness":"18","elk.layered.wrapping.strategy":t.length>5?"MULTI_EDGE":"OFF","elk.layered.wrapping.additionalEdgeSpacing":"18","elk.separateConnectedComponents":"true","elk.layered.considerModelOrder.strategy":"NODES_AND_EDGES","elk.randomSeed":"1"},children:[...d,...t.map(u=>{var c;return(c=u.ports)!=null&&c.length?{id:u.id,width:u.width,height:u.height,layoutOptions:{"elk.portConstraints":"FIXED_SIDE"},ports:u.ports.map(E=>({id:E.id,width:8,height:8,layoutOptions:{"elk.port.side":f[E.side]}}))}:{id:u.id,width:u.width,height:u.height}})],edges:o.map(u=>({id:u.id,sources:[i.has(u.source)&&u.sourcePort?u.sourcePort:u.source],targets:[i.has(u.target)&&u.targetPort?u.targetPort:u.target]}))},{providerId:e.layoutProviderId})).children??[],m=y.filter(u=>!p.has(u.id));if(m.length===t.length){const u=new Map(t.map(b=>[b.id,b])),c=Math.min(...m.map(b=>b.x??0)),E=Math.min(...m.map(b=>b.y??0)),M=m.map(b=>{const C=b.ports;return{...u.get(b.id),x:(b.x??0)-c,y:(b.y??0)-E,...C!=null&&C.length?{portY:new Map(C.map(T=>[T.id,T.y??0]))}:{}}}),v=y.filter(b=>p.has(b.id));a.push({strategy:"elk-layered",width:Math.max(...M.map(b=>b.x+b.width)),height:Math.max(...M.map(b=>b.y+b.height)),...v.length?{graphPortY:new Map(v.map(b=>[b.id,(b.y??0)-E]))}:{},children:M})}}catch{}return a.reduce((i,f)=>He(f,o,r)<He(i,o,r)?f:i)}async function Bn(e,t){var M;const o=Object.values(e.elements),r=t!=null&&t.viewpointFilter?o.filter(t.viewpointFilter):o,s=new Set(r.map(v=>v.id)),l=(M=t==null?void 0:t.relationshipTypes)!=null&&M.length?new Set(t.relationshipTypes.map(v=>v.toLowerCase())):void 0,h=e.relationships.filter(v=>s.has(v.sourceId)&&s.has(v.targetId)&&(!l||l.has(v.type.toLowerCase()))),a=r.length,i=a>60?"RIGHT":"DOWN",f=a>40?"24":a>20?"32":"40",p=a>40?"60":a>20?"80":"100",d=t!=null&&t.compartments?new Map(r.map(v=>[v.id,On(v)])):void 0,I=v=>Math.max(v.name.length*7.5+48,v.kind.length*6.8+48,130),y=v=>{const b=d==null?void 0:d.get(v.id);return 52+(b!=null&&b.length?b.length*15+10:0)},m={id:"root",layoutOptions:{"elk.algorithm":"layered","elk.direction":i,"elk.spacing.nodeNode":f,"elk.layered.spacing.nodeNodeBetweenLayers":p,"elk.layered.spacing.edgeNodeBetweenLayers":"24","elk.layered.considerModelOrder.strategy":"NODES_AND_EDGES","elk.layered.nodePlacement.strategy":"NETWORK_SIMPLEX","elk.layered.crossingMinimization.strategy":"LAYER_SWEEP","elk.layered.compaction.postCompaction.strategy":"EDGE_LENGTH","elk.layered.wrapping.strategy":"MULTI_EDGE","elk.layered.wrapping.additionalEdgeSpacing":"16","elk.separateConnectedComponents":"true","elk.spacing.componentComponent":"56","elk.aspectRatio":"1.6","elk.padding":"[top=20, left=20, bottom=20, right=20]"},children:r.map(v=>({id:v.id,width:I(v),height:y(v)})),edges:h.map((v,b)=>({id:v.id||`e-${b}`,sources:[v.sourceId],targets:[v.targetId]}))};let u;try{u=await Kt.layout(m,{providerId:t==null?void 0:t.layoutProviderId})}catch(v){console.warn("ELK layout failed, retrying without edge wrapping:",v),delete m.layoutOptions["elk.layered.wrapping.strategy"],delete m.layoutOptions["elk.layered.wrapping.additionalEdgeSpacing"],u=await Kt.layout(m,{providerId:t==null?void 0:t.layoutProviderId})}const c=(u.children||[]).map(v=>{const b=e.elements[v.id],C=Bt[b==null?void 0:b.layer]||"#666",T=d==null?void 0:d.get(v.id);return{id:v.id,type:"diagramNode",position:{x:v.x||0,y:v.y||0},data:{label:(b==null?void 0:b.name)||v.id,kind:(b==null?void 0:b.kind)??"",layer:(b==null?void 0:b.layer)??"",construct:b==null?void 0:b.construct,color:C,...T!=null&&T.length?{compartments:T}:{}}}}),E=h.map((v,b)=>{const C=Gt[v.type]||"#9CA3AF",T=v.type.toLowerCase(),j=v.type==="flow",G=v.type==="succession",H=T==="composedof"||T==="decomposedby"||T==="aggregation"||T==="composes";return{id:v.id||`e-${b}`,source:v.sourceId,target:v.targetId,label:H?void 0:v.type,type:G?"smoothstep":"default",animated:j,style:{stroke:C,strokeWidth:H?2.5:j?2:tt.defaultWidth,strokeDasharray:H||j?void 0:v.type==="traceTo"?"5 3":void 0},labelStyle:{fontSize:"10px",fill:"#6B7280",fontWeight:500},labelBgPadding:tt.labelBgPadding,labelBgBorderRadius:tt.labelBgRadius,labelBgStyle:tt.labelBgStyle,markerEnd:{type:H?"arrow":"arrowclosed",color:C,width:tt.arrowSize,height:tt.arrowSize}}});return{nodes:c,edges:E}}function yn(e){var h;const t=new Set((((h=e.registries)==null?void 0:h.kinds)??[]).filter(a=>{var i;return(i=a.namespace)==null?void 0:i.some(f=>f==="logical"||f==="implementation"||f==="realization")}).map(a=>a.name)),o=new Map;for(const a of Object.values(e.elements))t.has(a.kind)&&o.set(a.id,a);const r=new Map,s=new Set;for(const a of e.relationships)(a.type==="composedOf"||a.type==="aggregation")&&o.has(a.sourceId)&&o.has(a.targetId)&&(r.has(a.sourceId)||r.set(a.sourceId,[]),r.get(a.sourceId).push(a.targetId),s.add(a.targetId));return{roots:[...o.keys()].filter(a=>!s.has(a)),childrenMap:r,elements:o}}const Dt=64,ne=100,Ge=110,$e=300,Ye=44;function xe(e){return Math.max(e.name.length*8+80,220)}async function Wn(e,t){const o=t.tree??yn(e);if(o.roots.length===0)return{nodes:[],edges:[]};const r=t.positionCache??new Map,s=I=>t.nodeDirections.get(I)||"vertical",l=I=>(o.childrenMap.get(I)||[]).filter(y=>o.elements.has(y)),h=I=>{const y=o.elements.get(I),m=xe(y),u=l(I);if(!t.expandedNodes.has(I)||u.length===0)return{width:m,height:Dt};const c=u.map(h);if(s(I)==="vertical"){const v=c.reduce((C,T)=>C+T.width,0)+(c.length-1)*ne,b=Math.max(...c.map(C=>C.height));return{width:Math.max(m,v),height:Dt+Ge+b}}const E=Math.max(...c.map(v=>v.width)),M=c.reduce((v,b)=>v+b.height,0)+(c.length-1)*Ye;return{width:m+$e+E,height:Math.max(Dt,M)}},a=[],i=[],f=Gt.composedOf,p=(I,y,m,u)=>{const c=o.elements.get(I),E=xe(c),M=l(I),v=t.expandedNodes.has(I);let b=r.get(I);b||(b={x:m-E/2,y:u-Dt/2},r.set(I,b));const C={element:c,layerColor:Bt[c.layer]||"#666",isExpanded:v,hasChildren:M.length>0,childCount:M.length,direction:s(I),onToggleExpand:()=>t.callbacks.onToggleExpand(I),onToggleDirection:()=>t.callbacks.onToggleDirection(I),showDirectionButton:!0,label:c.name};if(a.push({id:I,type:"decompositionNode",position:{x:b.x,y:b.y},data:C,style:{width:E,height:Dt}}),y){const j=s(y);i.push({id:`decomp-${y}-${I}`,source:y,target:I,sourceHandle:j==="vertical"?"bottom":"right",targetHandle:j==="vertical"?"top":"left",type:"smoothstep",style:{stroke:f,strokeWidth:tt.defaultWidth},markerEnd:{type:"arrowclosed",color:f,width:tt.arrowSize,height:tt.arrowSize}})}if(!v||M.length===0)return;const T=M.map(h);if(s(I)==="vertical"){const j=T.reduce((V,J)=>V+J.width,0)+(T.length-1)*ne;let G=b.x+E/2-j/2;const H=b.y+Dt+Ge+Dt/2;M.forEach((V,J)=>{p(V,I,G+T[J].width/2,H),G+=T[J].width+ne})}else{const j=b.x+E+$e;let G=b.y+Dt+20;M.forEach((H,V)=>{const J=o.elements.get(H);p(H,I,j+xe(J)/2,G+Dt/2),G+=T[V].height+Ye})}};let d=0;for(const I of o.roots){if(!o.elements.has(I))continue;const y=h(I);p(I,null,d+y.width/2,100),d+=y.width+ne*2}return{nodes:a,edges:i}}const we=240,Ie=80,zt=20;function jn(e,t){const o=t.tree??yn(e);if(o.roots.length===0)return{nodes:[],edges:[]};const r=[];function s(d,I,y,m,u){const c=o.elements.get(d);if(!c)return{width:0,height:0};const E=Bt[c.layer]||"#666",M=o.childrenMap.get(d)||[],v=M.length>0,b=t.expandedNodes.has(d);let C=we,T=Ie;if(b&&v){let H=zt,V=Ie+zt,J=0,xt=0;for(const ht of M){if(!o.elements.has(ht))continue;const D=s(ht,d,y+1,H,V);H+D.width>800&&H>zt&&(H=zt,V+=J+zt,J=0,l(ht),s(ht,d,y+1,H,V)),H+=D.width+zt,J=Math.max(J,D.height),xt=Math.max(xt,H)}C=Math.max(we,xt),T=V+J+zt}const j=Be[y%Be.length],G={element:c,layerColor:E,isExpanded:b,hasChildren:v,childCount:M.length,direction:"vertical",onToggleExpand:()=>t.callbacks.onToggleExpand(d),onToggleDirection:()=>{},showDirectionButton:!1,depthBgColor:j,isContainer:v,label:c.name};return r.push({id:d,type:"decompositionNode",position:{x:m,y:u},...I?{parentId:I,extent:"parent"}:{},data:G,style:{width:b&&v?C:we,height:b&&v?T:Ie}}),{width:C,height:T}}function l(d){const I=new Set([d]),y=m=>{for(const u of o.childrenMap.get(m)||[])I.add(u),y(u)};y(d);for(let m=r.length-1;m>=0;m--)I.has(r[m].id)&&r.splice(m,1)}let h=0;for(const d of o.roots){if(!o.elements.has(d))continue;const I=s(d,null,0,h,0);h+=I.width+40}const a=new Map(r.map(d=>[d.id,d])),i=[],f=new Set,p=d=>{if(f.has(d.id))return;const I=d.parentId?a.get(d.parentId):void 0;I&&p(I),f.add(d.id),i.push(d)};for(const d of r)p(d);return{nodes:i,edges:[]}}function Hn(e){var h;const t=new Set((((h=e.registries)==null?void 0:h.kinds)??[]).filter(a=>{var i;return(i=a.namespace)==null?void 0:i.includes("functional")}).map(a=>a.name)),o=new Map;for(const a of Object.values(e.elements))t.has(a.kind)&&o.set(a.id,a);const r=new Map,s=new Set;for(const a of e.relationships)(a.type==="decomposedBy"||a.type==="composedOf")&&o.has(a.sourceId)&&o.has(a.targetId)&&(r.has(a.sourceId)||r.set(a.sourceId,[]),r.get(a.sourceId).push(a.targetId),s.add(a.targetId));return{roots:[...o.keys()].filter(a=>!s.has(a)),childrenMap:r,elements:o}}async function rs(e,t){const o=Hn(e);if(o.roots.length===0)return{nodes:[],edges:[]};const r=new Set,s=[];function l(p){if(o.elements.has(p)&&(r.add(p),t.expandedNodes.has(p)))for(const d of o.childrenMap.get(p)||[])o.elements.has(d)&&(s.push({parentId:p,childId:d}),l(d))}for(const p of o.roots)l(p);const h={id:"root",layoutOptions:{"elk.algorithm":"mrtree","elk.direction":"DOWN","elk.spacing.nodeNode":"40","elk.mrtree.searchOrder":"DFS"},children:[...r].map(p=>{const d=o.elements.get(p);return{id:p,width:Math.max(d.name.length*8+80,220),height:56}}),edges:s.map((p,d)=>({id:`fbs-${d}`,sources:[p.parentId],targets:[p.childId]}))},i=((await Kt.layout(h,{providerId:t.layoutProviderId})).children||[]).map(p=>{const d=o.elements.get(p.id),I=Bt[d.layer]||"#E67E22",y=(o.childrenMap.get(p.id)||[]).length,m=t.nodeDirections.get(p.id)||"vertical",u={element:d,layerColor:I,isExpanded:t.expandedNodes.has(p.id),hasChildren:y>0,childCount:y,direction:m,onToggleExpand:()=>t.callbacks.onToggleExpand(p.id),onToggleDirection:()=>t.callbacks.onToggleDirection(p.id),showDirectionButton:!0,label:d.name};return{id:p.id,type:"decompositionNode",position:{x:p.x||0,y:p.y||0},data:u}}),f=s.map((p,d)=>{const I=t.nodeDirections.get(p.parentId)||"vertical";return{id:`fbs-e-${d}`,source:p.parentId,target:p.childId,sourceHandle:I==="vertical"?"bottom":"right",targetHandle:I==="vertical"?"top":"left",type:"default",style:{stroke:Gt.decomposedBy,strokeWidth:tt.defaultWidth},markerEnd:{type:"arrowclosed",color:Gt.decomposedBy,width:tt.arrowSize,height:tt.arrowSize}}});return{nodes:i,edges:f}}const is=["graph","tree","containment"];function as(e){const t=e==null?void 0:e.layoutHint;return t==="tree"||t==="containment"||t==="graph"?t:"graph"}function zn(e,t){const o=Object.values(e.elements);return t?o.filter(t):o}function Gn(e,t,o){const r=o!=null&&o.length?new Set(o.map(s=>s.charAt(0).toLowerCase()+s.slice(1))):void 0;return ge(zn(e,t),e.relationships,r)}async function cs(e,t){if(t.mode==="graph")return Bn(e,{viewpointFilter:t.viewpointFilter,relationshipTypes:t.relationshipTypes,compartments:!0,layoutProviderId:t.layoutProviderId});const o=Gn(e,t.viewpointFilter,t.hierarchyRelationshipTypes);return t.mode==="tree"?Wn(e,{expandedNodes:t.expandedNodes,nodeDirections:t.nodeDirections,callbacks:t.callbacks,tree:o,positionCache:t.positionCache}):jn(e,{expandedNodes:t.expandedNodes,callbacks:{onToggleExpand:t.callbacks.onToggleExpand},tree:o})}const de="__inner";function ls(e){if(e&&!["left","right","top","bottom"].includes(e))return e.endsWith(de)?e.slice(0,-de.length):e}const ds={in:"#16A34A",out:"#D97706",inout:"#2563EB"},$n={data:"#3498DB",energy:"#D97706",material:"#16A34A",control:"#6B7280"};function Yn(e,t){const o=e??"";return/energy|power|voltage|current|thermal|heat/i.test(o)?"energy":/material|fluid|gas|liquid|drug|dose|batch|consumable/i.test(o)?"material":t&&/succession|control/i.test(t)?"control":"data"}function pn(e){return e.construct==="port"||e.kind.endsWith("Port")}function Xe(e){var r,s;const t=(r=e.portSpec)==null?void 0:r.direction;if(t==="in"||t==="out"||t==="inout")return t;const o=(s=(e.attributes.direction??"").split("::").pop())==null?void 0:s.trim();if(o==="bidirectional")return"inout";if(o==="in"||o==="out"||o==="inout")return o}const At=24,hs=At,be=At,ie=30,Lt=48,Se=44,oe=12,Ke=14,Ue=92,Xt=30,Vt=14,Me=90,Ve=112,Xn=72,Kn=(e,t=7.2)=>e.length*t+20,Un=e=>Math.min(Math.max(Kn(e,7.1),96),180);function xn(e){var r,s;const t=(r=e.portSpec)==null?void 0:r.direction,o=t==="in"||t==="out"||t==="inout"?t:(s=(e.attributes.direction??"").split("::").pop())==null?void 0:s.trim();if(o==="in")return"in";if(o==="out"||o==="inout"||o==="bidirectional"||/out(put)?$/i.test(e.name))return"out";if(/in(put)?$/i.test(e.name))return"in"}function Vn(e,t,o){return xn(e)??(t>o?"out":"in")}const qn=e=>e==="in"?"left":"right";function Zn(e,t){const o=e.filter(s=>!t.isConnected(s)&&!t.hasChildParts(s)&&t.portCount(s)===0),r=new Set(o);return{flowKids:e.filter(s=>!r.has(s)),orphanKids:o}}function Jn(e,t,o){const r=new Map,s=new Map;for(const[a,i]of e)i.owner&&(t(i.owner)?r.set(a,i.owner):e.has(i.owner)&&s.set(a,i.owner));for(const a of o)!Qt.has(a.type)||!e.has(a.targetId)||r.has(a.targetId)||s.has(a.targetId)||(t(a.sourceId)?r.set(a.targetId,a.sourceId):e.has(a.sourceId)&&s.set(a.targetId,a.sourceId));const l=new Map,h=(a,i)=>{const f=l.get(a)??r.get(a);if(f)return l.set(a,f),f;const p=s.get(a);if(!p||i.has(p))return;i.add(p);const d=h(p,i);return d&&l.set(a,d),d};for(const a of e.keys())h(a,new Set([a]));return{ownerPart:l,parentPort:s}}function qe(e,t,o){if(t==="none")return;if(t==="all")return e;let r=e;const s=new Set([r]);for(;o.has(r);){const l=o.get(r);if(s.has(l))break;s.add(l),r=l}return r}function Qn(e,t,o){const r=new Set,s=l=>{if(!(r.has(l)||!t(l))){r.add(l);for(const h of e.get(l)??[])s(h)}};return s(o),r}function to(e,t){const o=t.size??At,r=t.pitch??Xt,s=t.nestedPitch??ie,l=new Map;for(const h of["left","right"]){const a=e.filter(d=>t.sideOf(d)===h),i=a.length,f=Math.max(t.bodyBottom-t.bodyTop,0);let p=-1/0;a.forEach((d,I)=>{var m;let y=i===1&&t.singleCenterY!==void 0?t.singleCenterY:t.bodyTop+(i===1?f/2:(I+.5)/i*f);y=Math.max(y,t.bodyTop+r/2,p+r),p=y+((((m=t.weightOf)==null?void 0:m.call(t,d))??1)-1)*s,l.set(d,{x:h==="left"?-o/2:t.width-o/2,y:y-o/2,side:h})})}return l}function Ze(e,t){for(const o of["left","right"]){const r=[...e].filter(([l,h])=>h.side===o&&t.has(l)).map(([l])=>l);if(r.length<2)continue;const s=r.map(l=>e.get(l).y).sort((l,h)=>l-h);[...r].sort((l,h)=>t.get(l)-t.get(h)).forEach((l,h)=>{e.get(l).y=s[h]})}}function eo(e,t){return[...e.reduce((o,r)=>{const s=`${t(r.sourceId)}\0${t(r.targetId)}`,l=o.get(s);return l?l.count++:o.set(s,{rel:r,count:1}),o},new Map).values()].map(({rel:o,count:r})=>r===1?o:{...o,id:`bundle-${o.id}`,attributes:{...o.attributes,bundleCount:String(r)}})}async function us(e,t){var mt;const o=Object.values(e.elements),r=t!=null&&t.viewpointFilter?o.filter(t.viewpointFilter):o,s=new Map,l=[];for(const w of r)pn(w)?s.set(w.id,w):l.push(w);if(l.length===0)return{nodes:[],edges:[]};const h=(t==null?void 0:t.portDisplay)??"all",a=h!=="none",i=ge(l,e.relationships),f=t!=null&&t.focusId&&i.elements.has(t.focusId)?t.focusId:void 0,p=f?Qn(i.childrenMap,w=>i.elements.has(w),f):null,d=w=>i.elements.has(w)&&(!p||p.has(w)),I=w=>{var F;return(F=t==null?void 0:t.collapsedNodes)!=null&&F.has(w)?[]:(i.childrenMap.get(w)??[]).filter(d)},{ownerPart:y,parentPort:m}=Jn(s,d,e.relationships);for(const w of[...s.keys()])y.has(w)||s.delete(w);const u=w=>qe(w,"ports",m),c=new Map;for(const[w,F]of y)!s.has(w)||m.has(w)||(c.has(F)||c.set(F,[]),c.get(F).push(w));const E=new Map;if(h==="all")for(const[w]of m){if(!s.has(w))continue;const F=u(w);!s.has(F)||F===w||(E.has(F)||E.set(F,[]),E.get(F).push(w))}const M=w=>{var F;return 1+(((F=E.get(w))==null?void 0:F.length)??0)},v=(mt=t==null?void 0:t.relationshipTypes)!=null&&mt.length?new Set(t.relationshipTypes.map(w=>w.toLowerCase())):void 0,b=w=>s.has(w)||d(w),C=e.relationships.filter(w=>!Qt.has(w.type)&&(!v||v.has(w.type.toLowerCase()))&&b(w.sourceId)&&b(w.targetId)&&w.sourceId!==w.targetId),T=w=>y.get(w)??w,j=(t==null?void 0:t.connectionDisplay)??"summary",G=new Set([...y].filter(([,w])=>w===(t==null?void 0:t.focusId)).map(([w])=>w)),H=G.size>0?C.filter(w=>G.has(w.sourceId)||G.has(w.targetId)):C,V=j==="none"?[]:j==="all"?C:eo(H,T),J=new Set;for(const w of C)for(const F of[w.sourceId,w.targetId]){if(!s.has(F))continue;let R=F;for(;R&&!J.has(R);)J.add(R),R=m.get(R)}for(const[w,F]of c)c.set(w,F.filter(R=>J.has(R)));const xt=new Set(C.filter(w=>d(w.sourceId)).map(w=>w.sourceId)),ht=new Set(C.filter(w=>d(w.targetId)).map(w=>w.targetId)),D=new Map;for(const[w,F]of i.childrenMap)for(const R of F)d(R)&&D.set(R,w);const vt=new Map,St=w=>{const F=vt.get(w);if(F)return F;const R=s.get(w);let nt=xn(R);if(!nt){const q=m.get(w);if(q&&s.has(q))nt=St(q);else{let Z=0,Y=0;for(const x of V)x.sourceId===w&&Z++,x.targetId===w&&Y++;nt=Vn(R,Z,Y)}}return vt.set(w,nt),nt},at=w=>qn(St(w)),kt=w=>({left:w.some(F=>at(F)==="left")?Ue:Ke,right:w.some(F=>at(F)==="right")?Ue:Ke}),Mt=w=>Un(w.name),yt=(w,F)=>{const R={left:0,right:0};for(const A of F)R[at(A)]+=Xt+(M(A)-1)*ie;const nt=Math.max(R.left,R.right,0),q=Math.max(Se+nt+8,Xn),Z=kt(F),Y=Mt(w),x=Math.max(Z.left+Y+Z.right,Ve),k=to(F,{width:x,bodyTop:Se,bodyBottom:q-oe/2,sideOf:at,weightOf:M,singleCenterY:Math.max(q/2,Se+At/2)});return{width:x,height:q,childPos:new Map,portPos:k}},dt=new Map,wt=new Map,Ot=async w=>{const F=I(w),R=a?c.get(w)??[]:[],nt=i.elements.get(w);if(F.length===0){const K=yt(nt,R);return dt.set(w,K),K}const q=new Map;for(const K of F)q.set(K,await Ot(K));const Z=new Set(F),Y=new Set(R),x=K=>{if(s.has(K)){const z=u(K);if(Y.has(z))return z}let U=T(K);for(;U&&!Z.has(U);)U=D.get(U);return U},k=(K,U)=>{var ot;if(!s.has(K)||y.get(K)!==U)return;const z=u(K);return(ot=c.get(U))!=null&&ot.includes(z)?z:void 0},A=[],B=new Set;V.forEach((K,U)=>{const z=x(K.sourceId),ot=x(K.targetId);z&&ot&&z!==ot&&(A.push({id:`ic-${U}`,source:z,target:ot,sourcePort:k(K.sourceId,z),targetPort:k(K.targetId,ot)}),Z.has(z)&&B.add(z),Z.has(ot)&&B.add(ot))});const{flowKids:W,orphanKids:ct}=Zn(F,{isConnected:K=>B.has(K),hasChildParts:K=>(i.childrenMap.get(K)??[]).some(d),portCount:K=>{var U;return((U=c.get(K))==null?void 0:U.length)??0}}),lt=kt(R),Nt=new Map;let _t=0,Ct=0;if(W.length>0){const K=z=>(c.get(z)??[]).map(ot=>({id:ot,side:at(ot)})),U=await ze({id:`container-${w}`,nodes:W.map(z=>({id:z,width:q.get(z).width,height:q.get(z).height,ports:K(z)})),edges:A,graphPorts:R.map(z=>({id:z,side:at(z)})),gapX:54,gapY:58,targetAspect:2.4,layoutProviderId:t==null?void 0:t.layoutProviderId});for(const z of U.children){const ot=z.x+lt.left,st=z.y+Lt;Nt.set(z.id,{x:ot,y:st}),_t=Math.max(_t,ot-lt.left+z.width),Ct=Math.max(Ct,st+z.height),z.portY&&Ze(q.get(z.id).portPos,z.portY)}U.graphPortY&&wt.set(w,new Map([...U.graphPortY].map(([z,ot])=>[z,ot+Lt])))}if(W.length>0&&A.length>0){const K=(Lt+Math.max(Ct,Lt))/2,U=new Map(wt.get(w)??[]),z=(st,ut)=>{if(Y.has(st))return U.get(st)??K;const gt=Nt.get(st),et=q.get(st);if(!gt||!et)return;const pt=ut?et.portPos.get(ut):void 0;return pt?gt.y+pt.y+At/2:gt.y+et.height/2},ot=st=>st.reduce((ut,gt)=>ut+gt,0)/st.length;for(let st=0;st<2;st++){const ut=new Map,gt=(et,pt)=>{et===void 0||pt===void 0||(ut.has(et)||ut.set(et,[]),ut.get(et).push(pt))};for(const et of A){const pt=z(et.source,et.sourcePort),Pt=z(et.target,et.targetPort);gt(et.sourcePort??(Y.has(et.source)?et.source:void 0),Pt),gt(et.targetPort??(Y.has(et.target)?et.target:void 0),pt)}for(const et of W){const pt=q.get(et),Pt=new Map;for(const Ut of pt.portPos.keys()){const ee=ut.get(Ut);ee!=null&&ee.length&&Pt.set(Ut,ot(ee))}Pt.size>1&&Ze(pt.portPos,Pt)}for(const et of R){const pt=ut.get(et);pt!=null&&pt.length&&U.set(et,ot(pt))}}U.size>0&&wt.set(w,U)}if(ct.length>0){const K=Math.max(...ct.map(pt=>q.get(pt).width)),U=Math.max(_t,K),z=Math.max(1,Math.min(ct.length,Math.floor((U+Vt)/(K+Vt))||1)),ot=Ct>0?Ct+Vt:Lt;let st=0,ut=ot,gt=0,et=0;for(const pt of ct){const Pt=q.get(pt),Ut=lt.left+st*(K+Vt);Nt.set(pt,{x:Ut,y:ut}),_t=Math.max(_t,Ut-lt.left+Pt.width),gt=Math.max(gt,Pt.height),et=Math.max(et,ut+Pt.height),st++,st>=z&&(st=0,ut+=gt+Vt,gt=0)}Ct=Math.max(Ct,et)}const Ht=Math.min(Mt(nt)+32,248);let Tt=Math.max(lt.left+_t+lt.right,Ht,Ve),Wt=Math.max(Ct+oe,Lt+oe+8);const $t=new Map,Yt=wt.get(w)??new Map;for(const K of["left","right"]){const U=R.filter(ot=>at(ot)===K).sort((ot,st)=>(Yt.get(ot)??0)-(Yt.get(st)??0));let z=-1/0;for(const ot of U){const st=Math.max(Wt/2,Lt+At/2);let ut=Yt.get(ot)??(U.length===1?st:Lt+Xt/2);ut=Math.max(ut,Lt+Xt/2,z+Xt);const gt=ut+(M(ot)-1)*ie;z=gt,$t.set(ot,{x:K==="left"?-At/2:Tt-At/2,y:ut-At/2,side:K}),Wt=Math.max(Wt,gt+Xt/2+oe)}}for(const[K,U]of $t)U.side==="right"&&(U.x=Tt-At/2);const pe={width:Tt,height:Wt,childPos:Nt,portPos:$t};return dt.set(w,pe),pe},It=f?[f]:i.roots.filter(w=>d(w));for(const w of It)await Ot(w);const rt=new Map;if(It.length===1)rt.set(It[0],{x:0,y:0});else{const w=Y=>{let x=T(Y);const k=new Set;for(;x&&D.has(x)&&!k.has(x);)k.add(x),x=D.get(x);return x&&It.includes(x)?x:It.includes(Y)?Y:x},F=new Set(It),R=[],nt=(Y,x)=>{var k;if(s.has(Y)&&y.get(Y)===x){const A=u(Y),B=(k=dt.get(x))==null?void 0:k.portPos.get(A);if(B)return B.y+At/2}return dt.get(x).height/2};V.forEach((Y,x)=>{const k=w(Y.sourceId),A=w(Y.targetId);k&&A&&k!==A&&F.has(k)&&F.has(A)&&R.push({id:`root-${x}`,source:k,target:A,sourceAnchorY:nt(Y.sourceId,k),targetAnchorY:nt(Y.targetId,A)})});const q=await ze({id:"interconnection-roots",nodes:It.map(Y=>({id:Y,width:dt.get(Y).width,height:dt.get(Y).height})),edges:R,gapX:Me,gapY:Me,directedFlowAxis:"RIGHT",layoutProviderId:t==null?void 0:t.layoutProviderId});for(const Y of q.children)rt.set(Y.id,{x:Y.x,y:Y.y});let Z=0;for(const Y of It)rt.has(Y)||(rt.set(Y,{x:Z,y:0}),Z+=dt.get(Y).width+Me)}const bt=new Map;for(const[w,F]of c){const R=dt.get(w);if(!R)continue;const nt=[];for(const q of F){const Z=R.portPos.get(q);if(!Z)continue;const Y=s.get(q);nt.push({id:q,name:Y.name,x:Z.x,y:Z.y,side:Z.side,direction:Xe(Y)??St(q)});const x=Z.y+At/2,k=Z.x+(At-be)/2;(E.get(q)??[]).forEach((A,B)=>{const W=s.get(A);nt.push({id:A,name:W.name,x:k,y:x+ie*(B+1)-be/2,side:Z.side,direction:Xe(W)??St(A),size:be,nested:!0})})}bt.set(w,nt)}const n=[],g=new Map,S=(w,F,R,nt={x:0,y:0})=>{var W;const q=i.elements.get(w),Z=dt.get(w),Y=Bt[q.layer]||"#64748B",x=R??rt.get(w),k=F?{x:nt.x+x.x,y:nt.y+x.y}:x;g.set(w,k);const A=(i.childrenMap.get(w)??[]).some(d),B=A;n.push({id:w,type:"interconnectionNode",position:x,...F?{parentId:F,extent:"parent"}:{},data:{label:q.name,kind:q.kind,layer:q.layer,color:Y,isContainer:B,isFrame:!F&&B,hasChildren:A,isCollapsed:((W=t==null?void 0:t.collapsedNodes)==null?void 0:W.has(w))??!1,onToggleCollapse:A&&(t!=null&&t.onToggleCollapse)?()=>t.onToggleCollapse(w):void 0,onDrillIn:A&&F&&(t!=null&&t.onDrillIn)?()=>t.onDrillIn(w):void 0,ports:bt.get(w)??[],implicitIn:a&&ht.has(w),implicitOut:a&&xt.has(w),onPortMove:t!=null&&t.onPortMove?(ct,lt)=>t.onPortMove(w,ct,lt):void 0,minWidth:Z.width,minHeight:Z.height},style:{width:Z.width,height:Z.height}});for(const[ct,lt]of Z.childPos)S(ct,w,lt,k)};for(const w of It)S(w);const O=(w,F)=>{let R=w;const nt=new Set;for(;R&&!nt.has(R);){if(R===F)return!0;nt.add(R),R=D.get(R)}return!1},N=(w,F)=>{const R=y.get(w),nt=T(F);return O(nt,R)?`${w}${de}`:w},L=w=>s.has(w)?qe(w,h,m):void 0,P=V.flatMap((w,F)=>{var K;const R=L(w.sourceId),nt=L(w.targetId),q=s.has(w.sourceId)?y.get(w.sourceId):w.sourceId,Z=s.has(w.targetId)?y.get(w.targetId):w.targetId;if(!dt.has(q)||!dt.has(Z))return[];const Y=Yn(w.flowItem,w.type),x=$n[Y],k=Number(((K=w.attributes)==null?void 0:K.bundleCount)??0),A=k>1?`${k} connections`:w.flowItem||(w.type.toLowerCase()==="exchangeswith"?void 0:w.type),B=R?N(R,w.targetId):"right",W=nt?N(nt,w.sourceId):"left",ct=U=>U==="left"?"right":U==="right"?"left":U==="top"?"bottom":"top",lt=(U,z,ot,st)=>{var gt;if(!z)return st;const ut=((gt=(bt.get(U)??[]).find(et=>et.id===z))==null?void 0:gt.side)??st;return ot.endsWith(de)?ct(ut):ut},Nt=lt(q,R,B,"right"),_t=lt(Z,nt,W,"left"),Ct=w.id||`ic-e-${F}`,Ht=(U,z,ot)=>{const st=g.get(U),ut=dt.get(U);if(z){const gt=(bt.get(U)??[]).find(et=>et.id===z);if(gt){const et=gt.size??At;return{x:st.x+gt.x+et/2,y:st.y+gt.y+et/2}}}return{x:st.x+(ot?ut.width:0),y:st.y+ut.height/2}},Tt=Ht(q,R,!0),Wt=Ht(Z,nt,!1),$t=g.get(q),Yt=g.get(Z);return[{edge:{id:Ct,source:q,target:Z,sourceHandle:B,targetHandle:W,type:"interconnectionEdge",className:"ibd-interconnection-edge",label:A,animated:w.type==="flow",style:{stroke:x,strokeWidth:Math.max(2,tt.defaultWidth)},labelStyle:{fontSize:it.badge,fill:"#4B5563",fontWeight:600},labelBgPadding:tt.labelBgPadding,labelBgBorderRadius:tt.labelBgRadius,labelBgStyle:{...tt.labelBgStyle,fillOpacity:.96,stroke:"#E2E8F0",strokeWidth:1},markerEnd:{type:"arrowclosed",color:x,width:tt.arrowSize,height:tt.arrowSize},data:{flowCategory:Y,sourceOffset:{x:Tt.x-$t.x,y:Tt.y-$t.y},targetOffset:{x:Wt.x-Yt.x,y:Wt.y-Yt.y},sourcePortId:R,targetPortId:nt,sourceSide:Nt,targetSide:_t}},route:{id:Ct,source:Tt,target:Wt,sourceNodeId:q,targetNodeId:Z,sourceSide:Nt,targetSide:_t}}]}),$=n.filter(w=>!w.data.isFrame).map(w=>{const F=g.get(w.id),R=dt.get(w.id);return{id:w.id,x:F.x,y:F.y,width:R.width,height:R.height}}),X=te(P.map(w=>w.route),$,28,"short-first"),Et=fe(P.flatMap(({edge:w})=>{const F=X.get(w.id);return w.label&&F&&F.length>=2?[{id:w.id,points:F,width:ye(String(w.label)),height:me}]:[]}),$),Q=P.map(({edge:w})=>({...w,data:{...w.data,points:X.get(w.id)??[],labelPoint:Et.get(w.id)}}));return{nodes:n,edges:Q}}function jt(e){return e.kind==="ForkNode"||e.kind==="JoinNode"}function gs(e,t){const o=new Set(e.filter(s=>!jt(s)).map(s=>s.id)),r=new Set;for(const s of t.relationships)s.type!=="flow"&&s.type!=="succession"||(o.has(s.sourceId)&&r.add(s.sourceId),o.has(s.targetId)&&r.add(s.targetId));return e.filter(s=>!jt(s)&&!r.has(s.id))}function wn(e,t,o=new Set,r){const s=Object.values(e.elements),h=(t?s.filter(t):s).filter(d=>d.construct==="action"||d.kind==="ActionUsage"||d.kind==="ActionDefinition"),a=h.filter(d=>d.parentAction);if(a.length===0)return h;const i=new Map(h.map(d=>[d.id,d])),f=[],p=d=>{const I=h.filter(y=>y.parentAction===d.id);if(o.has(d.id)&&I.length>0){for(const y of I)p(y);return}f.push(d)};if(r){for(const d of h.filter(I=>I.parentAction===r))p(d);return f}for(const d of a){const I=d.parentAction?i.get(d.parentAction):void 0;I!=null&&I.parentAction||p(d)}return f}function no(e,t,o=new Set,r){if(o.size===0)return new Map;const s=new Set(wn(e,t,o,r).map(p=>p.id)),l=Object.values(e.elements),h=t?l.filter(t):l,a=new Map;for(const p of h)p.parentAction&&(a.has(p.parentAction)||a.set(p.parentAction,[]),a.get(p.parentAction).push(p));const i=new Map,f=(p,d)=>{const I=[];for(const y of a.get(p)??[])d.has(y.id)||(d.add(y.id),s.has(y.id)?I.push(y.id):I.push(...f(y.id,d)));return I};for(const p of o){if(s.has(p))continue;const d=f(p,new Set([p]));d.length>0&&i.set(p,d)}return i}function oo(e,t,o=new Set,r){const s=Object.values(e.elements),h=(t?s.filter(t):s).filter(m=>m.construct==="action"||m.kind==="ActionUsage"||m.kind==="ActionDefinition"),a=[],i=new Map,f=new Map,p=m=>h.filter(u=>u.parentAction===m),d=(m,u)=>{a.push(m),u&&(i.set(m.id,u),f.has(u)||f.set(u,[]),f.get(u).push(m.id));const c=p(m.id);if(!(c.length===0||!o.has(m.id))){f.set(m.id,[]);for(const E of c)d(E,m.id)}};if(r){for(const m of p(r))d(m);return{actions:a,parentOf:i,childrenOf:f}}const I=new Map(h.map(m=>[m.id,m])),y=h.filter(m=>m.parentAction);if(y.length===0)return{actions:h,parentOf:i,childrenOf:f};for(const m of y){const u=m.parentAction?I.get(m.parentAction):void 0;u!=null&&u.parentAction||d(m)}return{actions:a,parentOf:i,childrenOf:f}}function so(e,t){const o=e.attributes.actionType,r=o?t.elements[o]:void 0,s=((r==null?void 0:r.construct)==="action"?r.parameters:e.parameters)??[];return{inPorts:s.filter(l=>l.direction==="in"||l.direction==="inout").map(l=>l.name),outPorts:s.filter(l=>l.direction==="out"||l.direction==="inout").map(l=>l.name)}}const Je=["#4A90D9","#E67E22","#2ECC71","#9B59B6","#E74C3C","#1ABC9C","#F39C12","#7B68EE"],Ee="Unallocated",ro="Unstaged";function Le(e,t,o="all"){const r=new Map;for(const i of t.relationships)Qt.has(i.type)&&!r.has(i.targetId)&&r.set(i.targetId,i.sourceId);const s=[e],l=new Set(s);let h=e;for(;r.has(h);){const i=r.get(h);if(l.has(i))break;s.unshift(i),l.add(i),h=i}if(o==="all")return{id:e,level:s.length};const a=Math.min(Math.max(o,1),s.length)-1;return{id:s[a],level:a+1}}function io(e,t,o="all"){var s;const r=Le(e,t,o).id;return((s=t.elements[r])==null?void 0:s.name)??r}function fs(e,t){const o=[...new Set(e)].map(s=>Le(s,t).level);if(o.length===0)return[];const r=Math.min(...o);return r<=1?[]:Array.from({length:r},(s,l)=>l+1)}function ao(e,t,o="allocation",r="all"){var a,i;const s=new Map,l=[],h=new Map;for(const f of e){if(jt(f))continue;const p=f.allocatedTo?Le(f.allocatedTo,t,r).id:Ee,d=o==="stage"?f.attributes.stage||f.attributes.phase||ro:p;if(s.set(f.id,d),!h.has(d)){const I={id:d,label:o==="allocation"&&d!==Ee?((a=t.elements[d])==null?void 0:a.name)??d:d,color:Je[h.size%Je.length],inspectElementId:o==="allocation"&&d!==Ee?d:((i=Object.values(t.elements).find(y=>y.id===d||y.name===d))==null?void 0:i.id)??f.id};h.set(d,I),l.push(I)}}return{laneOf:s,lanes:l}}const co=18,lo=36,ho=20,qt=36,Qe=16,tn=120,ve=18,en=40,ke=32,nn=64,on=10;function uo(e,t,o){if(jt(e))return o==="vertical"?{width:nn,height:on}:{width:on,height:nn};const s=Math.max(t.inPorts.length,t.outPorts.length,0)*co;return{width:Math.max(e.name.length*9+40,140),height:lo+s+(s>0?8:0)+(e.allocatedTo?ho:0)}}function sn(e){const t=e??"";return/energy|power|voltage|current|thermal|heat/i.test(t)?"energy":/material|fluid|gas|liquid|batch|consumable/i.test(t)?"material":"data"}const Ce={control:"#4B5563",data:"#3498DB",energy:"#D97706",material:"#16A34A"};async function ms(e,t){var Ot,It,rt,bt;const o=(t==null?void 0:t.nesting)??"flat",r=o==="nested"?oo(e,t==null?void 0:t.viewpointFilter,t==null?void 0:t.expandedActionIds,t==null?void 0:t.focusActionId):{actions:wn(e,t==null?void 0:t.viewpointFilter,t==null?void 0:t.expandedActionIds,t==null?void 0:t.focusActionId),childrenOf:new Map},s=r.actions;if(s.length===0)return{nodes:[],edges:[]};const l=new Set(s.map(n=>n.id)),{laneOf:h,lanes:a}=ao(s,e,t==null?void 0:t.laneGrouping,t==null?void 0:t.displayLevel),i=(t==null?void 0:t.direction)??"horizontal",f=o!=="nested"&&((t==null?void 0:t.swimlanes)??!0)&&a.length>=1,p=e.relationships.filter(n=>n.type==="succession"),d=e.relationships.filter(n=>n.type==="flow"),I=new Map;for(const n of o==="nested"?[]:(t==null?void 0:t.expandedActionIds)??[]){const g=Object.values(e.elements).filter(N=>N.parentAction===n);if(g.length===0)continue;const S=((Ot=p.find(N=>N.sourceId===`${n}__start`))==null?void 0:Ot.targetId)??g[0].id,O=((It=p.find(N=>N.targetId===`${n}__done`))==null?void 0:It.sourceId)??g[g.length-1].id;I.set(n,{first:S,last:O})}const y=n=>n.map(g=>{var S,O;return{...g,sourceId:((S=I.get(g.sourceId))==null?void 0:S.last)??g.sourceId,targetId:((O=I.get(g.targetId))==null?void 0:O.first)??g.targetId}}),m=y(p),u=y(d),c=new Set;for(const n of m){const g=n.sourceId.endsWith("__start")?n.sourceId.slice(0,-7):void 0,S=n.targetId.endsWith("__done")?n.targetId.slice(0,-6):void 0;g&&!I.has(g)&&l.has(n.targetId)&&c.add(n.sourceId),S&&!I.has(S)&&l.has(n.sourceId)&&c.add(n.targetId)}const E=new Set([...l,...c]),M=u.filter(n=>E.has(n.sourceId)&&E.has(n.targetId)&&(!(t!=null&&t.visibleFlowKinds)||t.visibleFlowKinds.has(sn(n.flowItem)))),v=new Set(M.map(n=>`${n.sourceId}\0${n.targetId}`)),b=m.filter(n=>E.has(n.sourceId)&&E.has(n.targetId)&&(!(t!=null&&t.visibleFlowKinds)||t.visibleFlowKinds.has("control"))&&!v.has(`${n.sourceId}\0${n.targetId}`)),C=new Map(s.map(n=>[n.id,so(n,e)])),T=new Map(s.map(n=>[n.id,n])),j=new Map,G=new Map;if(o==="nested"){for(const[n,g]of r.childrenOf)j.set(n,g.filter(S=>E.has(S)));for(const n of c){const g=n.endsWith("__start")?n.slice(0,-7):n.slice(0,-6);j.has(g)&&j.get(g).push(n)}for(const[n,g]of j)for(const S of g)G.set(S,n)}const H=n=>{const g=T.get(n);return g?uo(g,C.get(n),i):{width:28,height:28}},V=n=>{const g=j.get(n)??[];return g.length===0?{id:n,...H(n)}:{id:n,layoutOptions:{"elk.algorithm":"layered","elk.direction":i==="vertical"?"DOWN":"RIGHT","elk.padding":"[top=44,left=24,bottom=24,right=24]","elk.spacing.nodeNode":"36","elk.layered.spacing.nodeNodeBetweenLayers":"68","elk.layered.considerModelOrder.strategy":"NODES_AND_EDGES"},children:g.map(V)}},J=[...c,...s.map(n=>n.id)].filter(n=>!G.has(n)),xt={id:"root",layoutOptions:{"elk.algorithm":"layered","elk.direction":i==="vertical"?"DOWN":"RIGHT","elk.spacing.nodeNode":"40","elk.layered.spacing.nodeNodeBetweenLayers":"80","elk.layered.considerModelOrder.strategy":"NODES_AND_EDGES","elk.layered.nodePlacement.strategy":"NETWORK_SIMPLEX","elk.layered.crossingMinimization.strategy":"LAYER_SWEEP","elk.separateConnectedComponents":"true","elk.spacing.componentComponent":"56",...o==="nested"?{"elk.hierarchyHandling":"INCLUDE_CHILDREN"}:{}},children:J.map(V),edges:[...M,...b].map((n,g)=>({id:`afe-${g}`,sources:[n.sourceId],targets:[n.targetId]}))},ht=await Kt.layout(xt,{providerId:t==null?void 0:t.layoutProviderId}),D=new Map,vt=n=>{D.set(n.id,{x:n.x??0,y:n.y??0,width:n.width??140,height:n.height??56});for(const g of n.children??[])vt(g)};for(const n of ht.children??[])vt(n);const St=new Map(a.map(n=>[n.id,n.color])),at=[];if(f&&i==="horizontal"){const n=new Map;for(const L of s){if(jt(L))continue;const P=D.get(L.id),$=h.get(L.id);n.has($)||n.set($,[]),n.get($).push(P.y)}const g=[...a].sort((L,P)=>{const $=X=>X.reduce((Et,Q)=>Et+Q,0)/X.length;return $(n.get(L.id)??[0])-$(n.get(P.id)??[0])});let S=1/0,O=-1/0;for(const L of s){const P=D.get(L.id);S=Math.min(S,P.x),O=Math.max(O,P.x+P.width)}let N=0;for(const L of g){const P=s.filter(Q=>h.get(Q.id)===L.id);P.sort((Q,mt)=>D.get(Q.id).x-D.get(mt.id).x||D.get(Q.id).y-D.get(mt.id).y);const $=Math.min(...P.map(Q=>D.get(Q.id).y));let X=0;const Et=[];for(const Q of P){const mt=D.get(Q.id);let w=N+qt+(mt.y-$);for(const F of Et)mt.x<F.x1&&mt.x+mt.width>F.x0&&(w=Math.max(w,F.bottom+16));D.set(Q.id,{...mt,y:w}),Et.push({x0:mt.x,x1:mt.x+mt.width,bottom:w+mt.height}),X=Math.max(X,w+mt.height-N)}X+=qt,at.push({id:`__lane_${L.id}`,type:"actionFlowLane",position:{x:S-tn,y:N},data:{label:L.label,color:L.color,orientation:"row",inspectElementId:L.inspectElementId,memberIds:P.map(Q=>Q.id),isFrame:!0},style:{width:O-S+tn+qt,height:X},draggable:!1,selectable:!1,zIndex:-1}),N+=X+Qe}}else if(f){let n=1/0,g=-1/0;for(const O of s){const N=D.get(O.id);n=Math.min(n,N.y),g=Math.max(g,N.y+N.height)}let S=0;for(const O of a){const N=s.filter($=>h.get($.id)===O.id).sort(($,X)=>D.get($.id).y-D.get(X.id).y||D.get($.id).x-D.get(X.id).x),P=Math.max(...N.map($=>D.get($.id).width))+qt*2;for(const $ of N){const X=D.get($.id);D.set($.id,{...X,x:S+(P-X.width)/2})}at.push({id:`__lane_${O.id}`,type:"actionFlowLane",position:{x:S,y:n-ke},data:{label:O.label,color:O.color,orientation:"column",inspectElementId:O.inspectElementId,memberIds:N.map($=>$.id),isFrame:!0},style:{width:P,height:g-n+ke+qt},draggable:!1,selectable:!1,zIndex:-1}),S+=P+Qe}}const kt=o==="nested"?[]:s.filter(jt);if(kt.length>0)for(const n of kt){const g=D.get(n.id),S=[];for(const N of[...b,...M]){const L=N.sourceId===n.id?N.targetId:N.targetId===n.id?N.sourceId:void 0;if(L===void 0)continue;const P=D.get(L);P&&S.push(i==="vertical"?P.x+P.width/2:P.y+P.height/2)}if(S.length===0)continue;const O=S.reduce((N,L)=>N+L,0)/S.length;D.set(n.id,i==="vertical"?{...g,x:O-g.width/2}:{...g,y:O-g.height/2})}for(const n of o==="nested"?[]:c){const g=D.get(n);if(!g)continue;const S=[];for(const P of b){const $=P.sourceId===n?P.targetId:P.targetId===n?P.sourceId:void 0;if(!$)continue;const X=D.get($);X&&S.push(i==="vertical"?X.x+X.width/2:X.y+X.height/2)}if(S.length===0)continue;const O=S.reduce((P,$)=>P+$,0)/S.length,N=s.filter(P=>!jt(P)).map(P=>D.get(P.id)).filter(P=>!!P),L=n.endsWith("__start");if(i==="vertical"){const P=Math.min(...N.map(X=>X.y)),$=Math.max(...N.map(X=>X.y+X.height));D.set(n,{...g,x:O-g.width/2,y:L?P-g.height-ke-16:$+24})}else{const P=Math.min(...N.map(X=>X.x)),$=Math.max(...N.map(X=>X.x+X.width));D.set(n,{...g,x:L?P-g.width-24:$+24,y:O-g.height/2})}}const Mt=[];if(o!=="nested"){const n=no(e,t==null?void 0:t.viewpointFilter,t==null?void 0:t.expandedActionIds,t==null?void 0:t.focusActionId);for(const[g,S]of n){const O=e.elements[g],N=S.map(Q=>D.get(Q)).filter(Q=>!!Q);if(!O||N.length===0)continue;const L=Math.min(...N.map(Q=>Q.x)),P=Math.min(...N.map(Q=>Q.y)),$=Math.max(...N.map(Q=>Q.x+Q.width)),X=Math.max(...N.map(Q=>Q.y+Q.height)),Et={element:O,label:O.name,nodeType:"action",laneColor:"#9CA3AF",layerColor:Bt[O.layer]||"#FF6B6B",inPorts:[],outPorts:[],hasChildren:!0,isExpanded:!0,isFrame:!0,onToggleExpand:t!=null&&t.onToggleAction?()=>t.onToggleAction(g):void 0,onDrillIn:t!=null&&t.onDrillInAction?()=>t.onDrillInAction(g):void 0,flowDirection:i};Mt.push({id:`__group_${g}`,type:"actionFlowNode",position:{x:L-ve,y:P-en},style:{width:$-L+ve*2,height:X-P+en+ve},draggable:!1,selectable:!1,data:Et})}}const yt=[...at,...Mt],dt=n=>{const g=G.get(n);return g?{parentId:g,extent:"parent"}:{}};for(const n of c){const g=D.get(n),S=n.endsWith("__start"),O={label:S?"Start":"Done",nodeType:S?"start":"done",laneColor:"#374151",layerColor:"#374151",inPorts:[],outPorts:[],flowDirection:i};yt.push({id:n,type:"actionFlowNode",position:{x:g.x,y:g.y},...dt(n),data:O})}for(const n of s){const g=D.get(n.id);if(jt(n)){const $={element:n,label:n.name,nodeType:n.kind==="ForkNode"?"fork":"join",laneColor:"#374151",layerColor:"#374151",inPorts:[],outPorts:[],flowDirection:i};yt.push({id:n.id,type:"actionFlowNode",position:{x:g.x,y:g.y},style:{width:g.width,height:g.height},...dt(n.id),data:$});continue}const S=C.get(n.id),O=h.get(n.id),N=n.allocatedTo?io(n.allocatedTo,e,t==null?void 0:t.displayLevel):void 0,L=(((rt=j.get(n.id))==null?void 0:rt.length)??0)>0,P={element:n,label:n.name,nodeType:"action",parameters:n.parameters,allocatedTo:N,laneColor:St.get(O)??"#9CA3AF",layerColor:Bt[n.layer]||"#FF6B6B",inPorts:S.inPorts,outPorts:S.outPorts,hasChildren:Object.values(e.elements).some($=>$.parentAction===n.id),isExpanded:((bt=t==null?void 0:t.expandedActionIds)==null?void 0:bt.has(n.id))??!1,isFrame:L,onToggleExpand:t!=null&&t.onToggleAction?()=>t.onToggleAction(n.id):void 0,onDrillIn:t!=null&&t.onDrillInAction?()=>t.onDrillInAction(n.id):void 0,flowDirection:i};yt.push({id:n.id,type:"actionFlowNode",position:{x:g.x,y:g.y},...L?{style:{width:g.width,height:g.height}}:{},...dt(n.id),data:P})}if(G.size>0){const n=new Map(yt.map(N=>[N.id,N])),g=[],S=new Set,O=N=>{if(S.has(N.id))return;S.add(N.id);const L=N.parentId?n.get(N.parentId):void 0;L&&O(L),g.push(N)};for(const N of yt)O(N);yt.length=0,yt.push(...g)}const wt=[];for(const n of M){const g=sn(n.flowItem),S=Ce[g],O=n.flowItem?/signal|error|status|code|report|alarm|response|command|data|reading/i.test(n.flowItem):!1;wt.push({id:n.id,source:n.sourceId,target:n.targetId,label:void 0,type:"smoothstep",animated:!1,style:{stroke:S,strokeWidth:tt.flowWidth,strokeDasharray:O?"6 3":void 0},labelStyle:{fontSize:it.badge,fill:S,fontWeight:600},labelBgStyle:tt.labelBgStyle,labelBgPadding:tt.labelBgPadding,labelBgBorderRadius:tt.labelBgRadius,markerEnd:{type:"arrowclosed",color:S,width:tt.arrowSize,height:tt.arrowSize},data:{flowCategory:g,flowItem:n.flowItem}})}for(const n of b)wt.push({id:n.id,source:n.sourceId,target:n.targetId,type:"smoothstep",animated:!1,style:{stroke:Ce.control,strokeWidth:1.5},markerEnd:{type:"arrowclosed",color:Ce.control,width:12,height:12},data:{flowCategory:"control"}});return{nodes:yt,edges:wt}}function go(e){return e.attributes.sourceState&&e.attributes.targetState?!0:e.kind==="Transition"||e.kind.endsWith("Transition")}function fo(e){return e.kind.endsWith("State")||e.kind.endsWith("Machine")||e.kind.endsWith("Mode")}function mo(e,t){const o=Object.values(e.elements),r=t?o.filter(t):o,s=[],l=[],h=[];for(const a of r)go(a)?l.push(a):fo(a)?s.push(a):h.push(a);return{states:s,transitions:l,annotations:h}}const rn=46;function yo(e){return e.length>rn?`${e.slice(0,rn-1)}…`:e}function po(e){const t=e.attributes.trigger??"",o=e.attributes.guardSummary??e.attributes.guard??"",r=o&&!/^none\b/i.test(o),s=t||e.name;return yo(r?`${s} [${o}]`:s)}function xo(e,t){const o=new Map;for(const s of t)o.set(s.name,s.id),o.set(s.id,s.id);const r=[];for(const s of e){const l=o.get(s.attributes.sourceState??""),h=o.get(s.attributes.targetState??"");!l||!h||r.push({element:s,sourceId:l,targetId:h,label:po(s)})}return r}function wo(e,t={}){const o=t.collapsedStateIds??new Set,r=t.focusStateId&&e.elements.has(t.focusStateId)?t.focusStateId:void 0,s=I=>(e.childrenMap.get(I)??[]).filter(y=>e.elements.has(y)),l=r?s(r):[],h=l.length>0?l:e.roots.filter(I=>e.elements.has(I)),a=new Set,i=new Map,f=new Map,p=(I,y)=>{i.set(I,y),f.set(y,(f.get(y)??0)+1);for(const m of s(I))p(m,y)},d=I=>{a.add(I);const y=s(I);if(o.has(I)){for(const m of y)p(m,I);return}for(const m of y)d(m)};for(const I of h)d(I);return{visible:a,liftTo:i,hiddenCount:f,roots:h}}function Io(e,t){const o=s=>t.visible.has(s)?s:t.liftTo.get(s),r=[];for(const s of e){const l=o(s.sourceId),h=o(s.targetId);if(!l||!h)continue;const a=s.sourceId===s.targetId;l===h&&!a||r.push({...s,sourceId:l,targetId:h})}return r}const bo="#FF6B6B",So="#95A5A6",an="#64748B";async function ys(e,t){const{states:o,transitions:r,annotations:s}=mo(e,t==null?void 0:t.viewpointFilter);if(o.length===0&&s.length===0)return{nodes:[],edges:[]};const l=ge(o,e.relationships),h=wo(l,{focusStateId:t==null?void 0:t.focusStateId,collapsedStateIds:t==null?void 0:t.collapsedStateIds}),a=Io(xo(r,o),h);if(h.visible.size===0&&s.length===0)return{nodes:[],edges:[]};const i=M=>({width:Math.max(M.name.length*7.5+56,150),height:(l.childrenMap.get(M.id)??[]).some(v=>l.elements.has(v))?74:54}),f=M=>{const v=l.elements.get(M),b=(l.childrenMap.get(M)??[]).filter(C=>h.visible.has(C));return b.length===0?{id:M,...i(v)}:{id:M,layoutOptions:{"elk.algorithm":"layered","elk.direction":"DOWN","elk.padding":"[top=48,left=28,bottom=28,right=28]","elk.spacing.nodeNode":"72","elk.layered.spacing.nodeNodeBetweenLayers":"120","elk.spacing.edgeNode":"32","elk.edgeRouting":"ORTHOGONAL","elk.layered.cycleBreaking.strategy":"MODEL_ORDER","elk.layered.considerModelOrder.strategy":"NODES_AND_EDGES"},children:b.map(f)}},p={id:"root",layoutOptions:{"elk.algorithm":"layered","elk.direction":"DOWN","elk.hierarchyHandling":"INCLUDE_CHILDREN","elk.edgeRouting":"ORTHOGONAL","elk.spacing.nodeNode":"72","elk.layered.spacing.nodeNodeBetweenLayers":"120","elk.spacing.edgeNode":"32","elk.spacing.edgeLabel":"8","elk.layered.cycleBreaking.strategy":"MODEL_ORDER","elk.layered.considerModelOrder.strategy":"NODES_AND_EDGES","elk.separateConnectedComponents":"true","elk.spacing.componentComponent":"64","elk.padding":"[top=20, left=20, bottom=20, right=20]"},children:h.roots.map(f),edges:a.map((M,v)=>({id:`st-${v}`,sources:[M.sourceId],targets:[M.targetId]}))},d=await Kt.layout(p,{providerId:t==null?void 0:t.layoutProviderId}),I=[],y=new Map,m=(M,v,b={x:0,y:0})=>{var T,j;const C=l.elements.get(M.id);if(C){const G=!!((T=M.children)!=null&&T.length),H=C.kind.endsWith("Machine"),V={x:b.x+(M.x??0),y:b.y+(M.y??0)};y.set(M.id,{...V,width:M.width??150,height:M.height??54,isContainer:G}),I.push({id:M.id,type:"stateNode",position:{x:M.x??0,y:M.y??0},...v?{parentId:v,extent:"parent"}:{},data:{label:C.name,kind:C.kind,color:bo,isContainer:G,isMachine:H,subtitle:C.attributes.modeKind,hasChildren:(l.childrenMap.get(M.id)??[]).some(J=>l.elements.has(J)),isCollapsed:!!((j=t==null?void 0:t.collapsedStateIds)!=null&&j.has(M.id)),hiddenCount:h.hiddenCount.get(M.id)??0,onToggleCollapse:t!=null&&t.onToggleCollapse?()=>t.onToggleCollapse(M.id):void 0,onDrillIn:t!=null&&t.onDrillIn?()=>t.onDrillIn(M.id):void 0},style:{width:M.width??150,height:M.height??54}});for(const J of M.children??[])m(J,M.id,V);return}};for(const M of d.children??[])m(M);if(s.length>0){let M=0,v=800;for(const G of d.children??[])M=Math.max(M,(G.y??0)+(G.height??0)),v=Math.max(v,(G.x??0)+(G.width??0));const b=240,C=48,T=14,j=Math.max(2,Math.floor(v/(b+T)));s.forEach((G,H)=>{I.push({id:G.id,type:"stateNode",position:{x:H%j*(b+T),y:M+56+Math.floor(H/j)*(C+T)},data:{label:G.name,kind:G.kind,color:So,isNote:!0},style:{width:b,height:C}})})}const u=[...y.entries()].filter(([,M])=>!M.isContainer).map(([M,v])=>({id:M,x:v.x,y:v.y,width:v.width,height:v.height})),c=Fn({connectors:a.map((M,v)=>({id:M.element.id||`st-e-${v}`,sourceId:M.sourceId,targetId:M.targetId,label:M.label})),rects:y,obstacles:u,channelGap:26}),E=a.map((M,v)=>{const b=M.element.id||`st-e-${v}`,C=c.get(b),T={id:b,source:M.sourceId,target:M.targetId,label:M.label,style:{stroke:an,strokeWidth:tt.defaultWidth},markerEnd:{type:"arrowclosed",color:an,width:tt.arrowSize,height:tt.arrowSize}};return C?{...T,type:"interconnectionEdge",data:{points:C.points,labelPoint:C.labelPoint}}:{...T,type:"smoothstep",labelStyle:{fontSize:it.badge,fill:"#6B7280",fontWeight:500},labelBgPadding:tt.labelBgPadding,labelBgBorderRadius:tt.labelBgRadius,labelBgStyle:tt.labelBgStyle}});return{nodes:I,edges:E}}const Mo=/(?:Actor|User)$/,Eo=new Set(["UseCase"]),In=new Set(["initiates","participatesin","performs","interactswith","includes","extends"]),Ft=e=>e.toLowerCase();function bn(e){return Mo.test(e.kind)||e.construct==="actor"}function Re(e){return Eo.has(e.kind)||e.construct==="use case"}function ps(e){const t=new Set(Object.values(e.elements).filter(Re).map(s=>s.id)),o=new Map;for(const s of e.relationships.filter(l=>Ft(l.type)==="includes"&&t.has(l.sourceId)&&t.has(l.targetId)))o.set(s.targetId,[...o.get(s.targetId)??[],s.sourceId]);const r=(s,l=new Set)=>{if(l.has(s))return 0;const h=o.get(s)??[];return h.length===0?0:1+Math.min(...h.map(a=>r(a,new Set([...l,s]))))};return Math.max(0,...[...t].map(s=>r(s)))}function xs(e){const t=Object.values(e.elements),o=new Set(t.filter(Re).map(s=>s.id)),r=new Set(e.relationships.filter(s=>In.has(Ft(s.type))).flatMap(s=>o.has(s.sourceId)?[s.targetId]:o.has(s.targetId)?[s.sourceId]:[]));return t.filter(bn).filter(s=>r.has(s.id)).map(s=>({id:s.id,name:s.name})).sort((s,l)=>s.name.localeCompare(l.name))}function ws(e){var s,l;const t=`${(e==null?void 0:e.layoutHint)??""};${(e==null?void 0:e.styleHint)??""}`,o=/(?:usecase:)?level\s*=\s*(all|\d+)/i.exec(t),r=/(?:edge|routing)\s*=\s*(straight|orthogonal|elbow|rounded|curved|arc)/i.exec(t);return{level:(o==null?void 0:o[1])==="all"?"all":o?Number(o[1]):"all",edgeStyle:{orthogonal:"elbow"}[((s=r==null?void 0:r[1])==null?void 0:s.toLowerCase())??""]??((l=r==null?void 0:r[1])==null?void 0:l.toLowerCase())??"straight"}}function Is(e,t={}){const o=Object.values(e.elements).filter(x=>!t.viewpointFilter||t.viewpointFilter(x)),r=o.filter(Re),s=e.relationships.filter(x=>In.has(Ft(x.type))),l=new Map;for(const x of s.filter(k=>Ft(k.type)==="includes")){const k=l.get(x.targetId)??[];k.push(x.sourceId),l.set(x.targetId,k)}const h=(x,k=new Set)=>{if(k.has(x))return 0;const A=l.get(x)??[];return A.length===0?0:1+Math.min(...A.map(B=>h(B,new Set([...k,x]))))},a=t.level??"all",i=new Set(r.filter(x=>a==="all"||h(x.id)<=a).map(x=>x.id));let f=!0;for(;f;){f=!1;for(const x of s.filter(k=>Ft(k.type)==="extends"))if(i.has(x.sourceId)||i.has(x.targetId))for(const k of[x.sourceId,x.targetId])!i.has(k)&&r.some(A=>A.id===k)&&(i.add(k),f=!0)}const p=t.hiddenActorIds??new Set;for(const x of s){const k=i.has(x.sourceId)?x.targetId:i.has(x.targetId)?x.sourceId:void 0;k&&p.has(k)&&(i.delete(x.sourceId),i.delete(x.targetId))}const d=r.filter(x=>i.has(x.id)),I=o.filter(bn).filter(x=>!p.has(x.id)).filter(x=>s.some(k=>k.sourceId===x.id&&i.has(k.targetId)||k.targetId===x.id&&i.has(k.sourceId))),y=new Set([...I,...d].map(x=>x.id));if(d.length===0)return{nodes:[],edges:[]};const m=new Set(s.filter(x=>Ft(x.type)==="extends").map(x=>x.sourceId)),u=new Map;for(const x of d){if(m.has(x.id))continue;const k=h(x.id);u.set(k,[...u.get(k)??[],x])}const E=[...u.keys()].sort((x,k)=>x-k).map(x=>[...u.get(x)??[]]);if(E.length===1&&E[0].length>4){const x=E[0],k=Math.min(3,Math.ceil(x.length/4)),A=Math.ceil(x.length/k);E.splice(0,1,...Array.from({length:k},(B,W)=>x.slice(W*A,(W+1)*A)))}const M=new Map;E.forEach((x,k)=>x.forEach(A=>M.set(A.id,k)));const v=new Map;for(const x of s.filter(k=>Ft(k.type)==="extends")){const k=d.find(W=>W.id===x.sourceId),A=M.get(x.targetId);if(!k||A===void 0||M.has(k.id))continue;const B=E[A];B.splice(B.findIndex(W=>W.id===x.targetId)+1,0,k),M.set(k.id,A),v.set(x.targetId,[...v.get(x.targetId)??[],k])}const b=new Set([...v.values()].flat().map(x=>x.id)),C=x=>s.filter(k=>k.sourceId===x||k.targetId===x).map(k=>k.sourceId===x?k.targetId:k.sourceId),T=new Map,j=()=>E.forEach(x=>x.forEach((k,A)=>T.set(k.id,A)));j(),I.forEach((x,k)=>T.set(x.id,k));const G=x=>{const k=C(x).map(A=>T.get(A)).filter(A=>A!==void 0);return k.length===0?T.get(x)??0:k.reduce((A,B)=>A+B,0)/k.length};for(let x=0;x<3;x++){const k=x%2===0?E:[...E].reverse();for(const A of k){const B=A.filter(W=>!b.has(W.id));B.sort((W,ct)=>G(W.id)-G(ct.id)),A.splice(0,A.length,...B.flatMap(W=>[W,...v.get(W.id)??[]])),j()}I.sort((A,B)=>G(A.id)-G(B.id)),I.forEach((A,B)=>T.set(A.id,B))}const H=176,V=88,J=104,xt=40,ht=104,D=88,vt=116,St=48,at=62,kt=44,Mt=76,yt=20,dt=Math.max(1,...E.map(x=>x.length)),wt=Math.max(520,E.length*H+Math.max(E.length-1,0)*J+St*2),Ot=Math.max(300,dt*V+(dt-1)*xt+at+kt),It=x=>St+x*(H+J)+H/2,rt=new Map;for(const x of I){const k=C(x.id).map(B=>M.get(B)).filter(B=>B!==void 0).map(It),A=k.length?k.reduce((B,W)=>B+W,0)/k.length:0;rt.set(x.id,k.length===0||A<=wt/2?"left":"right")}const bt=I.filter(x=>rt.get(x.id)==="left"),n=I.filter(x=>rt.get(x.id)==="right"),g=yt+(bt.length?ht+Mt:0),S=yt,O=[{id:"__use_case_boundary__",type:"useCaseBoundary",position:{x:g,y:S},data:{label:t.systemName||"System Boundary",isFrame:!0,kind:"System Boundary"},style:{width:wt,height:Ot},draggable:!1,selectable:!1,zIndex:-1}],N=new Map,L=S+at,P=Ot-at-kt;E.forEach((x,k)=>{const A=x.length*V+(x.length-1)*xt;let B=L+(P-A)/2;for(const W of x){const ct={x:g+St+k*(H+J),y:B};N.set(W.id,ct),O.push({id:W.id,type:"useCase",position:ct,data:{label:W.name,kind:W.kind,color:"#E67E22",level:h(W.id)},style:{width:H,height:V}}),B+=V+xt}});for(const x of["left","right"]){const A=(x==="left"?bt:n).map(W=>{const ct=C(W.id).map(lt=>N.get(lt)).filter(lt=>!!lt).map(lt=>lt.y);return{actor:W,y:ct.length?ct.reduce((lt,Nt)=>lt+Nt,0)/ct.length:S+at}}).sort((W,ct)=>W.y-ct.y);let B=-1/0;for(const{actor:W,y:ct}of A){const lt=Math.max(ct,B+vt-D,yt);B=lt+D,O.push({id:W.id,type:"useCaseActor",position:{x:x==="left"?yt:g+wt+Mt,y:lt},data:{label:W.name,kind:W.kind,color:"#334155",side:x},style:{width:ht,height:D}})}}const $=t.edgeStyle??"straight",X=s.filter(x=>y.has(x.sourceId)&&y.has(x.targetId)).map(x=>{const k=n.some(W=>W.id===x.sourceId),A=k?x.targetId:x.sourceId,B=k?x.sourceId:x.targetId;return{edge:{id:x.id,source:A,target:B,label:/^(includes|extends)$/.test(Ft(x.type))?`«${Ft(x.type)}»`:void 0,type:"useCaseEdge",data:{routing:$},style:{stroke:"#64748B",strokeWidth:1.4,strokeDasharray:/^(includes|extends)$/.test(Ft(x.type))?"5 4":void 0}},source:A,target:B}}),Et=new Map(O.map(x=>[x.id,x])),Q=x=>{var k,A;return{width:Number(((k=x.style)==null?void 0:k.width)??150),height:Number(((A=x.style)==null?void 0:A.height)??82)}},mt=(x,k)=>{const A=Q(Et.get(x));return k==="left"?{x:0,y:A.height/2}:k==="right"?{x:A.width,y:A.height/2}:k==="top"?{x:A.width/2,y:0}:{x:A.width/2,y:A.height}},w=(x,k)=>{const A=Et.get(x),B=mt(x,k);return{x:A.position.x+B.x,y:A.position.y+B.y}},F=X.map(({edge:x,source:k,target:A})=>{var Ct,Ht;const B=I.find(Tt=>Tt.id===k),W=I.find(Tt=>Tt.id===A),ct=!B&&!W&&M.get(k)!==void 0&&M.get(k)===M.get(A),lt=ct&&(((Ct=N.get(k))==null?void 0:Ct.y)??0)<(((Ht=N.get(A))==null?void 0:Ht.y)??0),Nt=B?n.includes(B)?"left":"right":ct?lt?"bottom":"top":"right",_t=W?n.includes(W)?"left":"right":ct?lt?"top":"bottom":"left";return{id:x.id,source:w(k,Nt),target:w(A,_t),sourceNodeId:k,targetNodeId:A,sourceSide:Nt,targetSide:_t}}),R=O.filter(x=>x.type==="useCase"||x.type==="useCaseActor").map(x=>({id:x.id,x:x.position.x,y:x.position.y,...Q(x)})),nt=$==="straight"?new Map:te(F,R,28),q=fe(X.flatMap(({edge:x})=>{const k=nt.get(x.id),A=x.label;return A&&k&&k.length>=2?[{id:x.id,points:k,width:ye(A),height:me}]:[]}),R),Z=new Map(F.map(x=>[x.id,x])),Y=X.map(({edge:x})=>({...x,data:{...x.data,points:nt.get(x.id)??[],labelPoint:q.get(x.id),sourceOffset:mt(x.source,Z.get(x.id).sourceSide),targetOffset:mt(x.target,Z.get(x.id).targetSide),sourceSide:Z.get(x.id).sourceSide,targetSide:Z.get(x.id).targetSide}}));return{nodes:O,edges:Y}}const cn=new Set(["includesStep",...Qt]);function ln(e){return e.kind.endsWith("Step")||!!e.attributes.stepOrder}function vo(e){if(!e)return;const t=e.split(":");return(t.length>1?t[t.length-1]:t[0]).trim()||void 0}function ko(e,t){const o=e.split(":")[0].trim(),r=t.elements[o];if(r)return r.name;for(const s of Object.values(t.elements))if(s.attributes.id===o)return s.name;return e}const dn=e=>{const t=Number(e.attributes.stepOrder);return Number.isFinite(t)?t:0};function Co(e,t){const o=Object.values(e.elements),r=t?o.filter(t):o,s=r.filter(ln),l=new Set(s.map(u=>u.id)),h=r.filter(u=>!ln(u)&&e.relationships.some(c=>cn.has(c.type)&&c.sourceId===u.id&&l.has(c.targetId))),a=[],i=new Map,f=u=>{const c=u.split(":")[0].trim()||u;return i.has(c)||(i.set(c,a.length),a.push({id:c,label:ko(u,e)})),i.get(c)},p=u=>[...u].sort((c,E)=>dn(c)-dn(E)).map(c=>({step:c,lane:f(c.attributes.allocatedFunction??c.allocatedTo??c.id),item:vo(c.attributes.exchangeItem)})),d=u=>{var E;const c=e.relationships.find(M=>M.type==="realizesScenario"&&M.sourceId===u.id);return c?(E=e.elements[c.targetId])==null?void 0:E.name:void 0},I=new Set,y=[];for(const u of h){const c=e.relationships.filter(E=>cn.has(E.type)&&E.sourceId===u.id&&l.has(E.targetId)).map(E=>e.elements[E.targetId]);for(const E of c)I.add(E.id);y.push({chain:u,scenario:d(u),occurrences:p(c)})}const m=s.filter(u=>!I.has(u.id));return m.length>0&&y.push({occurrences:p(m)}),{lifelines:a,sections:y.filter(u=>u.occurrences.length>0)}}const Zt=240,Ao=52,Oo=68,No=40,_o=24,hn=14;function bs(e,t){const o=Co(e,t==null?void 0:t.viewpointFilter);if(o.lifelines.length===0)return{nodes:[],edges:[]};const r=[],s=[],l=p=>p*Zt+Zt/2;let h=Ao+28;const a=[];for(const p of o.sections){const d=h;h+=No;const I=p.occurrences.map(y=>{const m={...y,y:h};return h+=Oo,m});a.push({section:p,top:d,bottom:h,placed:I}),h+=_o}const i=h,f=o.lifelines.length*Zt;return o.lifelines.forEach((p,d)=>{r.push({id:`__lifeline_${p.id}`,type:"seqLifeline",position:{x:d*Zt,y:0},data:{label:p.label},style:{width:Zt,height:i},draggable:!1,selectable:!1,zIndex:-2})}),a.forEach(({section:p,top:d,bottom:I,placed:y},m)=>{var u;r.push({id:`__section_${m}`,type:"seqSection",position:{x:-24,y:d},data:{label:((u=p.chain)==null?void 0:u.name)??"Steps",scenario:p.scenario},style:{width:f+48,height:I-d},draggable:!1,selectable:!1,zIndex:-1}),y.forEach((c,E)=>{if(r.push({id:c.step.id,type:"seqOccurrence",position:{x:l(c.lane)-hn/2,y:c.y-hn/2},data:{label:c.step.name,kind:c.step.kind},draggable:!1,zIndex:2}),E<y.length-1){const M=y[E+1],v=M.lane>=c.lane,b=M.lane===c.lane;s.push({id:`seq-${m}-${E}`,source:c.step.id,target:M.step.id,sourceHandle:b||v?"right":"left",targetHandle:b?"right":v?"left":"right",type:b?"smoothstep":"straight",label:c.item,style:{stroke:"#3498DB",strokeWidth:tt.flowWidth},labelStyle:{fontSize:it.badge,fill:"#4A90D9",fontWeight:600},labelBgPadding:tt.labelBgPadding,labelBgBorderRadius:tt.labelBgRadius,labelBgStyle:tt.labelBgStyle,markerEnd:{type:"arrowclosed",color:"#3498DB",width:tt.arrowSize,height:tt.arrowSize},zIndex:1})}})}),{nodes:r,edges:s}}const To=new Set(["interactsincontext","interactswith","exchangeswith","appliesincontext","connectsphysically"]),Ae=new Set(["Actor","User"]),ae=e=>e.toLowerCase(),Oe=e=>e.kind==="UseContext"||/environment|context/i.test(e.name)||/environment/i.test(String(e.attributes.entityKind??"")),Fo=e=>/systemofinterest|system-of-interest/i.test(String(e.attributes.contextRole??""))||String(e.attributes.isSystemOfInterest??"").toLowerCase()==="true",Rt=76,Sn=170,Po=238,se=30,Jt=104,Ne=240,_e=108,Te=92,Fe=74,Pe=40,re=e=>Math.min(Math.max(e.length*7.4+28,Sn),Po),Do=e=>{var o;const t=String(((o=e.attributes)==null?void 0:o.contextSide)??"").toLowerCase().replace(/[^a-z]/g,"");if(t.endsWith("actor"))return"left";if(t.endsWith("externalsystem"))return"right";if(t.endsWith("environment"))return"top";if(t.endsWith("constraint"))return"bottom"},Lo=e=>{var t;return((t=e.attributes)==null?void 0:t.interactionLabel)||`«${ae(e.type)}»`};function Ro(e,t,o){const r=new Map,s=[];for(const l of e){const h=t.some(i=>i.sourceId===l&&i.targetId===o),a=t.some(i=>i.sourceId===o&&i.targetId===l);h&&!a?r.set(l,"left"):a&&!h?r.set(l,"right"):s.push(l)}for(const l of s){const h=[...r.values()].filter(i=>i==="left").length,a=r.size-h;r.set(l,h<=a?"left":"right")}return r}function Ss(e,t,o={}){var rt,bt;const r=Object.values(e.elements).filter(n=>!o.viewpointFilter||o.viewpointFilter(n)),s=(rt=o.relationshipTypes)!=null&&rt.length?new Set(o.relationshipTypes.map(ae)):void 0,l=e.relationships.filter(n=>To.has(ae(n.type))&&(!s||s.has(ae(n.type)))),h=new Set(l.flatMap(n=>[n.sourceId,n.targetId])),a=r.filter(n=>h.has(n.id)&&!pn(n));if(a.length===0)return{nodes:[],edges:[]};const i=n=>l.filter(g=>g.sourceId===n.id||g.targetId===n.id).length,f=a.find(Fo)??a.find(n=>/system/i.test(n.name))??[...a].sort((n,g)=>i(g)-i(n))[0],p=a.filter(n=>n.id!==f.id),d=new Set([f.id,...p.map(n=>n.id)]),I=l.filter(n=>d.has(n.sourceId)&&d.has(n.targetId)),y=Ro(p.map(n=>n.id),I,f.id);for(const n of I){const g=Do(n);g&&y.set(n.sourceId,g)}const m=n=>Ae.has(n.kind)?0:Oe(n)?1:2,u=n=>p.filter(g=>y.get(g.id)===n).sort((g,S)=>m(g)-m(S)||g.name.localeCompare(S.name)),c={left:u("left"),right:u("right"),top:u("top"),bottom:u("bottom")},E=n=>n.length===0?0:n.length*Rt+(n.length-1)*se,M=n=>n.length===0?0:Math.max(...n.map(g=>re(g.name))),v=n=>n.length===0?0:n.reduce((g,S)=>g+re(S.name),0)+(n.length-1)*se,b=Ne+Te*2,C=_e+Fe*2,T=M(c.left),j=Pe+(T>0?T+Jt:0)+Math.max(b,v(c.top),v(c.bottom))/2,G=Pe+(c.top.length>0?Rt+Jt:0)+Math.max(C,E(c.left),E(c.right))/2,H=j-b/2,V=G-C/2,J=H+b+(c.right.length>0?Jt:0),xt=[{id:"__context_boundary__",type:"contextBoundary",position:{x:H,y:V},data:{label:`${t??f.name} — System Boundary`,isFrame:!0},style:{width:b,height:C},draggable:!1,selectable:!1,zIndex:-1},{id:f.id,type:"contextSystem",position:{x:H+Te,y:V+Fe},data:{label:f.name,kind:f.kind},style:{width:Ne,height:_e}}],ht=new Map;for(const n of["left","right"]){const g=c[n];let S=G-E(g)/2;for(const O of g){const N=re(O.name),L=n==="left"?Pe+T-N:J;ht.set(O.id,{x:L,y:S,width:N,height:Rt,side:n}),xt.push({id:O.id,type:"contextExternal",position:{x:L,y:S},data:{label:O.name,kind:O.kind,category:Oe(O)?"environment":Ae.has(O.kind)?"person":"system"},style:{width:N,height:Rt}}),S+=Rt+se}}for(const n of["top","bottom"]){const g=c[n],S=v(g);let O=j-S/2;const N=n==="top"?V-Jt-Rt:V+C+Jt;for(const L of g){const P=re(L.name);ht.set(L.id,{x:O,y:N,width:P,height:Rt,side:n}),xt.push({id:L.id,type:"contextExternal",position:{x:O,y:N},data:{label:L.name,kind:L.kind,category:Oe(L)?"environment":Ae.has(L.kind)?"person":"system"},style:{width:P,height:Rt}}),O+=P+se}}const D={x:H+Te,y:V+Fe,width:Ne,height:_e},vt={left:[],right:[],top:[],bottom:[]};for(const n of I){const g=n.sourceId===f.id?n.targetId:n.sourceId;if(n.sourceId!==f.id&&n.targetId!==f.id)continue;const S=(bt=ht.get(g))==null?void 0:bt.side;S&&!vt[S].includes(n.id)&&vt[S].push(n.id)}for(const n of["left","right"])vt[n].sort((g,S)=>{const O=N=>{var P;const L=I.find($=>$.id===N);return((P=ht.get(L.sourceId===f.id?L.targetId:L.sourceId))==null?void 0:P.y)??0};return O(g)-O(S)});const St=(n,g)=>{const S=vt[g],O=Math.max(S.indexOf(n),0);return{x:g==="left"?D.x:g==="right"?D.x+D.width:D.x+D.width*(O+.5)/Math.max(S.length,1),y:g==="top"?D.y:g==="bottom"?D.y+D.height:D.y+D.height*(O+.5)/Math.max(S.length,1)}},at=(n,g)=>{const S=ht.get(n);return g==="top"?{x:S.x+S.width/2,y:S.y}:g==="bottom"?{x:S.x+S.width/2,y:S.y+S.height}:{x:g==="left"?S.x:S.x+S.width,y:S.y+S.height/2}},kt=(n,g)=>{var P;if(n===f.id)return((P=ht.get(g))==null?void 0:P.side)??"left";const S=ht.get(n),O=g===f.id?D:ht.get(g),N={x:S.x+S.width/2,y:S.y+S.height/2},L={x:O.x+O.width/2,y:O.y+O.height/2};return Math.abs(L.y-N.y)>Math.abs(L.x-N.x)?L.y<N.y?"top":"bottom":O.x+(g===f.id?D.width:ht.get(g).width)/2>=S.x+S.width/2?"right":"left"},Mt=I.map(n=>{const g=kt(n.sourceId,n.targetId),S=kt(n.targetId,n.sourceId),O=(N,L)=>N===f.id?St(n.id,L):at(N,L);return{rel:n,sourceSide:g,targetSide:S,source:O(n.sourceId,g),target:O(n.targetId,S)}}),yt=xt.filter(n=>!n.data.isFrame).map(n=>{var g,S;return{id:n.id,x:n.position.x,y:n.position.y,width:Number(((g=n.style)==null?void 0:g.width)??Sn),height:Number(((S=n.style)==null?void 0:S.height)??Rt)}}),dt=te(Mt.map(n=>({id:n.rel.id,source:n.source,target:n.target,sourceNodeId:n.rel.sourceId,targetNodeId:n.rel.targetId,sourceSide:n.sourceSide,targetSide:n.targetSide})),yt,24),wt=new Map(Mt.map(n=>[n.rel.id,Lo(n.rel)])),Ot=fe(Mt.flatMap(n=>{const g=dt.get(n.rel.id),S=wt.get(n.rel.id);return g&&g.length>=2?[{id:n.rel.id,points:g,width:ye(S),height:me}]:[]}),yt),It=Mt.map(n=>{const g=(S,O,N)=>{const L=S===f.id?D:ht.get(S);return{x:N.x-L.x,y:N.y-L.y,side:O}};return{id:n.rel.id,source:n.rel.sourceId,target:n.rel.targetId,type:"useCaseEdge",label:wt.get(n.rel.id),style:{stroke:"#0F766E",strokeWidth:1.5},data:{routing:"rounded",points:dt.get(n.rel.id)??[n.source,n.target],labelPoint:Ot.get(n.rel.id),sourceSide:n.sourceSide,targetSide:n.targetSide,sourceOffset:g(n.rel.sourceId,n.sourceSide,n.source),targetOffset:g(n.rel.targetId,n.targetSide,n.target)}}});return{nodes:xt,edges:It}}const Bo=new Set(["name","title","description","shortDescription","longDescription","sourceReference","rationaleText","semantics","queryDescription","dataSourceDescription","doc"]),Wo=7,De=80;function jo(e,t){const o=e.attributes[t];return o===void 0?void 0:(o.includes("::")?o.split("::").pop().trim():o)||void 0}function Ho(e){const t=new Map;for(const o of e)for(const r of Object.keys(o.attributes))Bo.has(r)||r.includes(".")||t.set(r,(t.get(r)??0)+1);return[...t.entries()].sort((o,r)=>r[1]-o[1]).slice(0,Wo).map(([o])=>o)}function zo(e){const t=new Map;for(const r of e)t.has(r.kind)||t.set(r.kind,[]),t.get(r.kind).push(r);const o=[];for(const[r,s]of t){const l=Ho(s),h=s.map(i=>({element:i,values:l.map(f=>jo(i,f))})),a=l.map((i,f)=>{const p=h.map(d=>d.values[f]).filter(d=>d!==void 0);return p.length>0&&p.every(d=>Number.isFinite(Number(d)))});o.push({kind:r,columns:l,numeric:a,rows:h})}return o.sort((r,s)=>s.rows.length-r.rows.length)}function Go(e,t,o){const r=o==="asc"?1:-1;return[...e.rows].sort((l,h)=>{if(t<0)return l.element.name.localeCompare(h.element.name)*r;const a=l.values[t],i=h.values[t];return a===void 0&&i===void 0?0:a===void 0?1:i===void 0?-1:e.numeric[t]?(Number(a)-Number(i))*r:a.localeCompare(i)*r})}function $o(e,t,o){const r=new Map(e.map(d=>[d.id,d])),s=o!=null&&o.length?new Set(o.map(d=>d.toLowerCase())):void 0,l=t.filter(d=>r.has(d.sourceId)&&r.has(d.targetId)&&d.sourceId!==d.targetId&&(!s||s.has(d.type.toLowerCase())));if(l.length===0)return;const h=new Set,a=new Set,i=new Map,f=new Set;for(const d of l){h.add(d.sourceId),a.add(d.targetId),f.add(d.type);const I=`${d.sourceId}|${d.targetId}`;i.has(I)||i.set(I,[]),i.get(I).includes(d.type)||i.get(I).push(d.type)}const p=(d,I)=>d.kind.localeCompare(I.kind)||d.name.localeCompare(I.name);return{rows:[...h].map(d=>r.get(d)).sort(p),cols:[...a].map(d=>r.get(d)).sort(p),cells:i,relTypes:[...f].sort()}}const he={padding:"6px 10px",fontSize:it.xs,fontWeight:600,color:"#374151",textAlign:"left",borderBottom:"2px solid #E5E5E0",background:"#FAFAF8",position:"sticky",top:0,cursor:"pointer",whiteSpace:"nowrap",userSelect:"none"},ue={padding:"5px 10px",fontSize:it.xs,color:"#374151",borderBottom:"1px solid #F0F0ED",verticalAlign:"top"};function Yo(e){return e.length>De?`${e.slice(0,De-1)}…`:e}function Xo({section:e,search:t}){var d;const o=le(I=>I.selectElement),[r,s]=ft.useState(-1),[l,h]=ft.useState("asc"),a=ft.useMemo(()=>{const I=Go(e,r,l);if(!t)return I;const y=t.toLowerCase();return I.filter(m=>m.element.name.toLowerCase().includes(y)||m.values.some(u=>u==null?void 0:u.toLowerCase().includes(y)))},[e,r,l,t]);if(a.length===0)return null;const i=Bt[(d=e.rows[0])==null?void 0:d.element.layer]||"#6B7280",f=I=>{r===I?h(y=>y==="asc"?"desc":"asc"):(s(I),h("asc"))},p=I=>r===I?l==="asc"?" ↑":" ↓":"";return _.jsxs("div",{style:{marginBottom:28},children:[_.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[_.jsx("span",{style:{width:8,height:8,borderRadius:2,background:i,display:"inline-block"}}),_.jsx("span",{style:{fontSize:it.sm,fontWeight:700,color:"#1B3A4B"},children:e.kind}),_.jsx("span",{style:{fontSize:it.xs,color:"#9CA3AF"},children:a.length})]}),_.jsxs("table",{style:{borderCollapse:"collapse",width:"100%",background:"#FFFFFF",borderRadius:8,overflow:"hidden",border:"1px solid #E5E5E0"},children:[_.jsx("thead",{children:_.jsxs("tr",{children:[_.jsxs("th",{style:he,onClick:()=>f(-1),children:["Element",p(-1)]}),e.columns.map((I,y)=>_.jsxs("th",{style:he,onClick:()=>f(y),children:[I,p(y)]},I))]})}),_.jsx("tbody",{children:a.map(I=>_.jsxs("tr",{onMouseEnter:y=>{y.currentTarget.style.background="#F7F7F5"},onMouseLeave:y=>{y.currentTarget.style.background="transparent"},children:[_.jsx("td",{style:{...ue,whiteSpace:"nowrap"},children:_.jsx("button",{onClick:()=>o(I.element.id),style:{background:"none",border:"none",padding:0,fontSize:it.xs,fontWeight:600,color:"#1B6FD9",cursor:"pointer",textDecoration:"none"},title:"Open element detail",children:I.element.name})}),I.values.map((y,m)=>_.jsx("td",{style:ue,title:y&&y.length>De?y:void 0,children:y?Yo(y):_.jsx("span",{style:{color:"#D1D5DB"},children:"—"})},m))]},I.element.id))})]})]})}function Ko({elements:e,model:t,relationshipTypes:o}){const r=le(h=>h.selectElement),s=ft.useMemo(()=>$o(e,t.relationships,o),[e,t.relationships,o]);if(!s)return _.jsx("div",{style:{color:"#9CA3AF",fontSize:it.sm,padding:24},children:"No relationships among this view's elements."});const l=(h,a=!1)=>_.jsx("button",{onClick:()=>r(h.id),style:{background:"none",border:"none",padding:0,cursor:"pointer",fontSize:"10px",fontWeight:600,color:"#374151",...a?{writingMode:"vertical-rl",transform:"rotate(180deg)",maxHeight:120}:{},whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",maxWidth:180},title:`${h.kind} · open detail`,children:h.name});return _.jsxs("div",{children:[_.jsx("div",{className:"flex gap-3 mb-2",style:{fontSize:it.xs,color:"#6B7280"},children:s.relTypes.map(h=>_.jsxs("span",{className:"flex items-center gap-1",children:[_.jsx("span",{style:{width:8,height:8,borderRadius:"50%",background:Gt[h]||"#6B7280",display:"inline-block"}}),h]},h))}),_.jsxs("table",{style:{borderCollapse:"collapse",background:"#FFFFFF",border:"1px solid #E5E5E0"},children:[_.jsx("thead",{children:_.jsxs("tr",{children:[_.jsx("th",{style:{...he,cursor:"default"}}),s.cols.map(h=>_.jsx("th",{style:{...he,cursor:"default",verticalAlign:"bottom",padding:"8px 4px"},children:l(h,!0)},h.id))]})}),_.jsx("tbody",{children:s.rows.map(h=>_.jsxs("tr",{children:[_.jsx("td",{style:{...ue,whiteSpace:"nowrap",background:"#FAFAF8"},children:l(h)}),s.cols.map(a=>{const i=s.cells.get(`${h.id}|${a.id}`);return _.jsx("td",{style:{...ue,textAlign:"center",padding:"4px 6px"},title:i==null?void 0:i.join(", "),children:i==null?void 0:i.map(f=>_.jsx("span",{style:{width:9,height:9,borderRadius:"50%",margin:1,background:Gt[f]||"#6B7280",display:"inline-block"}},f))},a.id)})]},h.id))})]})]})}function Ms({diagram:e,model:t,viewpointFilter:o}){const[r,s]=ft.useState("table"),[l,h]=ft.useState(""),a=ft.useMemo(()=>{const p=Object.values(t.elements);return o?p.filter(o):p},[t,o]),i=ft.useMemo(()=>zo(a),[a]),f=un.grid;return _.jsx("div",{className:"flex-1 overflow-auto",style:{background:"#F7F7F5"},children:_.jsxs("div",{style:{padding:"16px 20px",maxWidth:1240},children:[_.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[_.jsx("span",{className:"px-1.5 py-0.5 rounded font-semibold",style:{background:f.color+"20",color:f.color,fontSize:it.badge},title:f.fullName,children:f.label}),_.jsx("span",{style:{fontSize:it.md,fontWeight:700,color:"#1a1a1a"},children:e.name}),_.jsxs("span",{style:{fontSize:it.xs,color:"#9CA3AF"},children:[a.length," elements"]}),_.jsx("div",{className:"flex rounded overflow-hidden ml-2",style:{border:"1px solid #E5E5E0"},children:["table","matrix"].map(p=>_.jsx("button",{onClick:()=>s(p),className:"px-2 py-0.5 text-xs font-medium capitalize",style:{background:r===p?"#1B3A4B":"#FFFFFF",color:r===p?"#FFFFFF":"#6B7280",border:"none",cursor:"pointer"},children:p},p))}),r==="table"&&_.jsx("input",{value:l,onChange:p=>h(p.target.value),placeholder:"Filter rows…",className:"px-2 py-1 rounded focus:outline-none ml-auto",style:{fontSize:it.xs,border:"1px solid #E5E5E0",background:"#FFFFFF",color:"#1a1a1a",width:200}})]}),r==="table"?i.map(p=>_.jsx(Xo,{section:p,search:l},p.kind)):_.jsx(Ko,{elements:a,model:t,relationshipTypes:e.relationshipTypes}),r==="table"&&i.length===0&&_.jsx("div",{style:{color:"#9CA3AF",fontSize:it.sm,padding:24},children:"This view selects no elements."})]})})}const Uo=8;function Mn(e,t,o){const r=(t.get(e.id)??[]).filter(s=>o.has(s)).map(s=>Mn(o.get(s),t,o));return r.sort(ce),{id:e.id,label:e.name,element:e,kind:e.kind,layer:e.layer,children:r,count:1+r.reduce((s,l)=>s+l.count,0)}}const ce=(e,t)=>(e.kind??"").localeCompare(t.kind??"")||e.label.localeCompare(t.label);function Vo(e,t){const o=ge(e,t),r=new Map,s=[];for(const l of o.roots){const h=o.elements.get(l),a=Mn(h,o.childrenMap,o.elements),i=h.package;if(!i){s.push(a);continue}if(!r.has(i)){const p=i.split("::").pop()??i,d={id:`pkg:${i}`,label:p,title:i,children:[],count:0};r.set(i,d),s.push(d)}const f=r.get(i);f.children.push(a),f.count+=a.count}for(const l of r.values()){const h=new Set(l.children.map(i=>i.kind));if(l.children.length<=Uo||h.size<=1){l.children.sort(ce);continue}const a=new Map;for(const i of l.children){const f=i.kind??"—";a.has(f)||a.set(f,[]),a.get(f).push(i)}l.children=[...a.entries()].sort((i,f)=>i[0].localeCompare(f[0])).map(([i,f])=>{var p;return{id:`kind:${l.id}:${i}`,label:i,kind:i,layer:(p=f[0])==null?void 0:p.layer,children:f.sort(ce),count:f.reduce((d,I)=>d+I.count,0)}})}return s.sort(ce),s}function qo(e,t){const o=t.trim().toLowerCase();if(!o)return;const r=new Set,s=new Set,l=(h,a)=>{const i=h.label.toLowerCase().includes(o)||(h.kind??"").toLowerCase().includes(o);let f=!1;for(const p of h.children)l(p,[...a,h.id])&&(f=!0);if(i||f){r.add(h.id);for(const p of a)r.add(p),s.add(p);return f&&s.add(h.id),!0}return!1};for(const h of e)l(h,[]);return{visible:r,expanded:s}}function Zo(e){if(!e)return"·";const t=e.replace(/[^A-Za-z]/g,"").match(/[A-Z]/g);return t&&t.length>=2?t.slice(0,2).join(""):e.slice(0,2).toUpperCase()}const Jo=26;function En({node:e,depth:t,expanded:o,visible:r,forceExpanded:s,onToggle:l}){const h=le(y=>y.selectElement),a=le(y=>y.selectedElementId);if(r&&!r.has(e.id))return null;const i=o.has(e.id)||!!(s!=null&&s.has(e.id)),f=e.children.length>0,p=!e.element,d=Bt[e.layer??""]||"#95A5A6",I=e.element&&e.id===a;return _.jsxs(_.Fragment,{children:[_.jsxs("div",{className:"flex items-center gap-1.5",style:{height:Jo,paddingLeft:8+t*18,cursor:"pointer",background:I?"#2DD4A818":void 0,borderRadius:6},onMouseEnter:y=>{I||(y.currentTarget.style.background="#F0F0ED")},onMouseLeave:y=>{y.currentTarget.style.background=I?"#2DD4A818":"transparent"},onClick:()=>{f&&l(e.id),e.element&&h(e.id)},title:e.title??e.kind,children:[_.jsx("span",{style:{width:12,textAlign:"center",flexShrink:0,fontSize:"9px",color:"#9CA3AF",transform:i?"rotate(90deg)":"none",transition:"transform 120ms ease",visibility:f?"visible":"hidden"},children:"▶"}),p?_.jsx("span",{style:{fontSize:"10px",flexShrink:0},children:e.id.startsWith("pkg:")?"📦":"▣"}):_.jsx("span",{style:{flexShrink:0,width:20,height:16,borderRadius:4,background:d+"22",color:d,fontSize:"8px",fontWeight:800,display:"inline-flex",alignItems:"center",justifyContent:"center",letterSpacing:"0.02em"},title:e.kind,children:Zo(e.kind)}),_.jsx("span",{style:{fontSize:it.xs,fontWeight:p?700:500,color:p?"#1B3A4B":"#374151",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:e.label}),f&&_.jsx("span",{style:{fontSize:"9px",color:"#9CA3AF"},children:e.count})]}),i&&e.children.map(y=>_.jsx(En,{node:y,depth:t+1,expanded:o,visible:r,forceExpanded:s,onToggle:l},y.id))]})}function Es({diagram:e,model:t,viewpointFilter:o}){const[r,s]=ft.useState(new Set),[l,h]=ft.useState(""),a=ft.useMemo(()=>{const m=Object.values(t.elements);return o?m.filter(o):m},[t,o]),i=ft.useMemo(()=>Vo(a,t.relationships),[a,t.relationships]),f=ft.useMemo(()=>qo(i,l),[i,l]),p=ft.useCallback(m=>{s(u=>{const c=new Set(u);return c.has(m)?c.delete(m):c.add(m),c})},[]),d=ft.useCallback((m,u)=>{for(const c of m)c.children.length>0&&(u.add(c.id),d(c.children,u));return u},[]),I=un.browser,y=a.length;return _.jsx("div",{className:"flex-1 overflow-auto",style:{background:"#F7F7F5"},children:_.jsxs("div",{style:{padding:"16px 20px",maxWidth:860},children:[_.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[_.jsx("span",{className:"px-1.5 py-0.5 rounded font-semibold",style:{background:I.color+"20",color:I.color,fontSize:it.badge},title:I.fullName,children:I.label}),_.jsx("span",{style:{fontSize:it.md,fontWeight:700,color:"#1a1a1a"},children:e.name}),_.jsxs("span",{style:{fontSize:it.xs,color:"#9CA3AF"},children:[y," elements"]}),_.jsx("button",{onClick:()=>s(d(i,new Set)),className:"px-2 py-0.5 text-xs font-medium rounded ml-2",style:{background:"#FFFFFF",color:"#374151",border:"1px solid #E5E5E0",cursor:"pointer"},children:"Expand All"}),_.jsx("button",{onClick:()=>s(new Set),className:"px-2 py-0.5 text-xs font-medium rounded",style:{background:"#FFFFFF",color:"#374151",border:"1px solid #E5E5E0",cursor:"pointer"},children:"Collapse All"}),_.jsx("input",{value:l,onChange:m=>h(m.target.value),placeholder:"Filter by name or kind…",className:"px-2 py-1 rounded focus:outline-none ml-auto",style:{fontSize:it.xs,border:"1px solid #E5E5E0",background:"#FFFFFF",color:"#1a1a1a",width:220}})]}),_.jsxs("div",{style:{background:"#FFFFFF",border:"1px solid #E5E5E0",borderRadius:10,padding:"10px 8px"},children:[i.length===0&&_.jsx("div",{style:{color:"#9CA3AF",fontSize:it.sm,padding:16},children:"This view selects no elements."}),i.map(m=>_.jsx(En,{node:m,depth:0,expanded:r,visible:f==null?void 0:f.visible,forceExpanded:f==null?void 0:f.expanded,onToggle:p},m.id)),f&&i.every(m=>!f.visible.has(m.id))&&_.jsxs("div",{style:{color:"#9CA3AF",fontSize:it.sm,padding:16},children:["No matches for “",l,"”."]})]})]})})}function vs({x:e,y:t,sourceElement:o,targetElement:r,registries:s,allowedTypes:l,onSelect:h,onCancel:a}){const i=ft.useRef(null),[f,p]=ft.useState(""),[d,I]=ft.useState(""),y=ft.useRef(null);ft.useEffect(()=>{var b;(b=y.current)==null||b.focus()},[]),ft.useEffect(()=>{const b=C=>{i.current&&!i.current.contains(C.target)&&a()};return document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[a]),ft.useEffect(()=>{const b=C=>{C.key==="Escape"&&a()};return document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)},[a]);const m=ft.useMemo(()=>{const b=vn(o,r,s);if(!(l!=null&&l.length))return b;const C=new Set(l.map(T=>T.toLowerCase()));return b.filter(T=>C.has(T.definition.name.toLowerCase())||C.has(T.definition.sysmlName.toLowerCase()))},[o,r,s,l]),u=ft.useMemo(()=>{const b=f.trim().toLowerCase();return b?m.filter(C=>C.definition.label.toLowerCase().includes(b)||C.definition.name.toLowerCase().includes(b)):m},[m,f]),c=260,E=320,M=Math.min(e,window.innerWidth-c-8),v=Math.min(t,window.innerHeight-E-8);return _.jsxs("div",{ref:i,className:"fixed z-50 flex flex-col shadow-xl rounded-xl overflow-hidden",style:{left:M,top:v,width:c,maxHeight:E,background:"#FFFFFF",border:"1px solid #E5E5E0",boxShadow:"0 8px 32px rgba(0,0,0,0.16)"},children:[_.jsxs("div",{className:"px-3 py-2",style:{borderBottom:"1px solid #E5E5E0",flexShrink:0},children:[_.jsx("div",{style:{fontSize:it.xs,fontWeight:600,color:"#374151",marginBottom:4},children:"Relationship Type"}),_.jsxs("div",{style:{fontSize:"10px",color:"#9CA3AF",marginBottom:4},children:[o.kind," → ",r.kind]}),_.jsx("input",{ref:y,value:f,onChange:b=>p(b.target.value),placeholder:"Search…","aria-label":"Search relationship types",className:"w-full px-2 py-1 rounded focus:outline-none",style:{fontSize:it.xs,background:"#F7F7F5",border:"1px solid #E5E5E0",color:"#374151"}}),_.jsx("input",{value:d,onChange:b=>I(b.target.value),placeholder:"Transported item / flow label (optional)","aria-label":"Transported item or flow label",className:"w-full px-2 py-1 rounded focus:outline-none",style:{marginTop:6,fontSize:it.xs,background:"#F7F7F5",border:"1px solid #E5E5E0",color:"#374151"}})]}),_.jsxs("div",{className:"flex-1 overflow-y-auto py-1",children:[u.map(b=>{const{definition:C,direction:T,sourceId:j,targetId:G}=b,H=T==="incoming";return _.jsxs("button",{onClick:()=>h({type:C.name,sourceId:j,targetId:G,direction:T,flowItem:d.trim()||void 0}),className:"w-full flex items-center gap-2.5 px-3 py-1.5 text-left",style:{background:"none",border:"none",cursor:"pointer"},onMouseEnter:V=>{V.currentTarget.style.background="#F7F7F5"},onMouseLeave:V=>{V.currentTarget.style.background="none"},children:[_.jsx("div",{style:{width:10,height:10,borderRadius:"50%",flexShrink:0,background:Gt[C.name]??"#6B7280"}}),_.jsxs("div",{style:{minWidth:0},children:[_.jsxs("div",{style:{fontSize:it.xs,fontWeight:500,color:"#1a1a1a"},children:[C.label,H&&_.jsx("span",{style:{color:"#9CA3AF",fontWeight:400},children:" (reversed)"})]}),_.jsxs("div",{className:"truncate",style:{fontSize:"10px",color:"#9CA3AF"},children:[C.sourceEnd.name," → ",C.targetEnd.name]})]})]},`${C.name}-${T}`)}),u.length===0&&_.jsx("div",{className:"p-3 text-center",style:{color:"#9CA3AF",fontSize:it.xs},children:m.length===0?`The ontology defines no relationship between a ${o.kind} and a ${r.kind}.`:"No matching types"})]})]})}function ks(e){var t,o,r;return((r=(o=(t=e)==null?void 0:t.canvas)==null?void 0:o.layout)==null?void 0:r.provider)??Cn}export{ls as A,Ms as B,Qt as C,Es as D,$n as E,te as F,is as G,hs as I,ds as P,vs as R,Wn as a,jn as b,rs as c,Is as d,Ss as e,us as f,ms as g,ys as h,bs as i,cs as j,Bn as k,de as l,xs as m,fs as n,gs as o,fo as p,ws as q,as as r,ks as s,os as t,ps as u,ge as v,ss as w,Gn as x,Hn as y,yn as z};
|
package/dist/index.html
CHANGED
|
@@ -8,10 +8,10 @@
|
|
|
8
8
|
<link rel="preconnect" href="https://fonts.googleapis.com">
|
|
9
9
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
|
10
10
|
<link href="https://fonts.googleapis.com/css2?family=Nunito:wght@700;800;900&display=swap" rel="stylesheet">
|
|
11
|
-
<script type="module" crossorigin src="/assets/index-
|
|
11
|
+
<script type="module" crossorigin src="/assets/index-CVW92JY7.js"></script>
|
|
12
12
|
<link rel="modulepreload" crossorigin href="/assets/zustand-CrhqMOHB.js">
|
|
13
13
|
<link rel="modulepreload" crossorigin href="/assets/reactflow-CsCqNKB-.js">
|
|
14
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
14
|
+
<link rel="stylesheet" crossorigin href="/assets/index-Y1UZTZg-.css">
|
|
15
15
|
</head>
|
|
16
16
|
<body>
|
|
17
17
|
<div id="root"></div>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"feature-grants.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/feature-grants.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { describe, it, expect } from 'vitest';
|
|
2
|
+
import { injectFeatureGrants, resolveFeatureGrants } from '../feature-grants.js';
|
|
3
|
+
// ─── Feature grants (CLI side) ──────────────────────────────────────────────
|
|
4
|
+
//
|
|
5
|
+
// Grants have to reach the client before its bundle runs, or gated nav renders
|
|
6
|
+
// and then vanishes. `__MEMO_FLAGS__` is Architect's vocabulary: Tools serves
|
|
7
|
+
// the shell through a generic transform and never learns what a grant means.
|
|
8
|
+
const SHELL = '<!DOCTYPE html><html><head><title>t</title></head><body></body></html>';
|
|
9
|
+
describe('resolveFeatureGrants', () => {
|
|
10
|
+
it('grants the experimental stage only when the flag was passed', () => {
|
|
11
|
+
expect(resolveFeatureGrants({ experimental: true })).toEqual({ experimental: true });
|
|
12
|
+
expect(resolveFeatureGrants({})).toEqual({ experimental: false });
|
|
13
|
+
});
|
|
14
|
+
it('states the grant explicitly rather than omitting it, so the client never guesses', () => {
|
|
15
|
+
expect(resolveFeatureGrants({ experimental: undefined }))
|
|
16
|
+
.toHaveProperty('experimental', false);
|
|
17
|
+
});
|
|
18
|
+
});
|
|
19
|
+
describe('injectFeatureGrants', () => {
|
|
20
|
+
it('splices grants into head, ahead of the bundle', () => {
|
|
21
|
+
const html = injectFeatureGrants(SHELL, { experimental: true });
|
|
22
|
+
expect(html).toContain('window.__MEMO_FLAGS__={"experimental":true}');
|
|
23
|
+
expect(html.indexOf('__MEMO_FLAGS__')).toBeLessThan(html.indexOf('<body>'));
|
|
24
|
+
});
|
|
25
|
+
it('is idempotent — a viewer built with baked grants keeps its own', () => {
|
|
26
|
+
const baked = SHELL.replace('</head>', '<script>window.__MEMO_FLAGS__={"experimental":true};</script></head>');
|
|
27
|
+
expect(injectFeatureGrants(baked, { experimental: false })).toBe(baked);
|
|
28
|
+
});
|
|
29
|
+
it('still delivers grants when the document has no head', () => {
|
|
30
|
+
const html = injectFeatureGrants('<div id="root"></div>', { experimental: true });
|
|
31
|
+
expect(html.startsWith('<script>window.__MEMO_FLAGS__=')).toBe(true);
|
|
32
|
+
});
|
|
33
|
+
});
|
|
34
|
+
//# sourceMappingURL=feature-grants.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"feature-grants.test.js","sourceRoot":"","sources":["../../src/__tests__/feature-grants.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAEjF,+EAA+E;AAC/E,EAAE;AACF,+EAA+E;AAC/E,8EAA8E;AAC9E,6EAA6E;AAE7E,MAAM,KAAK,GAAG,wEAAwE,CAAC;AAEvF,QAAQ,CAAC,sBAAsB,EAAE,GAAG,EAAE;IAClC,EAAE,CAAC,6DAA6D,EAAE,GAAG,EAAE;QACnE,MAAM,CAAC,oBAAoB,CAAC,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC,CAAC;QACrF,MAAM,CAAC,oBAAoB,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,YAAY,EAAE,KAAK,EAAE,CAAC,CAAC;IACtE,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,kFAAkF,EAAE,GAAG,EAAE;QACxF,MAAM,CAAC,oBAAoB,CAAC,EAAE,YAAY,EAAE,SAAS,EAAE,CAAC,CAAC;aACpD,cAAc,CAAC,cAAc,EAAE,KAAK,CAAC,CAAC;IAC/C,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC;AAEH,QAAQ,CAAC,qBAAqB,EAAE,GAAG,EAAE;IACjC,EAAE,CAAC,+CAA+C,EAAE,GAAG,EAAE;QACrD,MAAM,IAAI,GAAG,mBAAmB,CAAC,KAAK,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC,CAAC;QAChE,MAAM,CAAC,IAAI,CAAC,CAAC,SAAS,CAAC,6CAA6C,CAAC,CAAC;QACtE,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC,CAAC,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC;IAChF,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,gEAAgE,EAAE,GAAG,EAAE;QACtE,MAAM,KAAK,GAAG,KAAK,CAAC,OAAO,CACvB,SAAS,EACT,sEAAsE,CACzE,CAAC;QACF,MAAM,CAAC,mBAAmB,CAAC,KAAK,EAAE,EAAE,YAAY,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC5E,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,qDAAqD,EAAE,GAAG,EAAE;QAC3D,MAAM,IAAI,GAAG,mBAAmB,CAAC,uBAAuB,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC,CAAC;QAClF,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,gCAAgC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACzE,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
|
|
@@ -3,6 +3,7 @@ import { Command } from 'commander';
|
|
|
3
3
|
import { architectBuildCommand } from '../commands/build.js';
|
|
4
4
|
import { architectDevCommand } from '../commands/dev.js';
|
|
5
5
|
import { architectExampleCommand, listArchitectExamples, listArchitectTemplates, } from '../commands/example.js';
|
|
6
|
+
import { EXPERIMENTAL_FLAG_DESCRIPTION, resolveFeatureGrants } from '../feature-grants.js';
|
|
6
7
|
const program = new Command();
|
|
7
8
|
program
|
|
8
9
|
.name('memo-architect')
|
|
@@ -12,6 +13,7 @@ program
|
|
|
12
13
|
.option('--read-only', 'Always open the example in a disposable copy, even from a local checkout')
|
|
13
14
|
.option('-p, --port <port>', 'Server port', '3000')
|
|
14
15
|
.option('--no-open', 'Do not open a browser')
|
|
16
|
+
.option('--experimental', EXPERIMENTAL_FLAG_DESCRIPTION)
|
|
15
17
|
.action(async (options) => {
|
|
16
18
|
if (options.example) {
|
|
17
19
|
await architectExampleCommand({
|
|
@@ -19,6 +21,7 @@ program
|
|
|
19
21
|
port: Number.parseInt(options.port, 10),
|
|
20
22
|
open: options.open,
|
|
21
23
|
readOnly: options.readOnly,
|
|
24
|
+
featureGrants: resolveFeatureGrants(options),
|
|
22
25
|
});
|
|
23
26
|
return;
|
|
24
27
|
}
|
|
@@ -46,10 +49,16 @@ program
|
|
|
46
49
|
.description('Start Architect with live model reload')
|
|
47
50
|
.option('-p, --port <port>', 'Server port', '3000')
|
|
48
51
|
.option('--no-open', 'Do not open a browser')
|
|
52
|
+
.option('--experimental', EXPERIMENTAL_FLAG_DESCRIPTION)
|
|
49
53
|
.action(async function (options) {
|
|
50
54
|
const port = resolveOption(this, 'port', options.port);
|
|
51
55
|
const open = resolveOption(this, 'open', options.open);
|
|
52
|
-
|
|
56
|
+
const experimental = resolveOption(this, 'experimental', options.experimental);
|
|
57
|
+
await architectDevCommand({
|
|
58
|
+
port: Number.parseInt(String(port), 10),
|
|
59
|
+
open,
|
|
60
|
+
featureGrants: resolveFeatureGrants({ experimental }),
|
|
61
|
+
});
|
|
53
62
|
});
|
|
54
63
|
program
|
|
55
64
|
.command('examples')
|
|
@@ -74,8 +83,16 @@ program
|
|
|
74
83
|
.description('Build a static Architect viewer with embedded project data')
|
|
75
84
|
.option('-o, --output <dir>', 'Output directory', 'dist')
|
|
76
85
|
.option('--standalone', 'Inline the entry JavaScript and CSS into index.html')
|
|
77
|
-
.
|
|
78
|
-
|
|
86
|
+
.option('--experimental', EXPERIMENTAL_FLAG_DESCRIPTION)
|
|
87
|
+
.action(async function (options) {
|
|
88
|
+
// `--experimental` is declared on the program too, so Commander binds a
|
|
89
|
+
// command-line flag to the parent and leaves this command holding its
|
|
90
|
+
// own default. Same trap as `--port` on `dev`.
|
|
91
|
+
const experimental = resolveOption(this, 'experimental', options.experimental);
|
|
92
|
+
await architectBuildCommand({
|
|
93
|
+
...options,
|
|
94
|
+
featureGrants: resolveFeatureGrants({ experimental }),
|
|
95
|
+
});
|
|
79
96
|
});
|
|
80
97
|
program.parse();
|
|
81
98
|
//# sourceMappingURL=memo-architect.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"memo-architect.js","sourceRoot":"","sources":["../../src/bin/memo-architect.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,EACH,uBAAuB,EAAE,qBAAqB,EAAE,sBAAsB,GACzE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"memo-architect.js","sourceRoot":"","sources":["../../src/bin/memo-architect.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,EACH,uBAAuB,EAAE,qBAAqB,EAAE,sBAAsB,GACzE,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,6BAA6B,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAE3F,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE,CAAC;AAE9B,OAAO;KACF,IAAI,CAAC,gBAAgB,CAAC;KACtB,WAAW,CAAC,gEAAgE,CAAC;KAC7E,OAAO,CAAC,OAAO,CAAC;KAChB,MAAM,CAAC,kBAAkB,EAAE,yKAAyK,CAAC;KACrM,MAAM,CAAC,aAAa,EAAE,0EAA0E,CAAC;KACjG,MAAM,CAAC,mBAAmB,EAAE,aAAa,EAAE,MAAM,CAAC;KAClD,MAAM,CAAC,WAAW,EAAE,uBAAuB,CAAC;KAC5C,MAAM,CAAC,gBAAgB,EAAE,6BAA6B,CAAC;KACvD,MAAM,CAAC,KAAK,EAAE,OAEd,EAAE,EAAE;IACD,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;QAClB,MAAM,uBAAuB,CAAC;YAC1B,IAAI,EAAE,OAAO,CAAC,OAAO;YACrB,IAAI,EAAE,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC;YACvC,IAAI,EAAE,OAAO,CAAC,IAAI;YAClB,QAAQ,EAAE,OAAO,CAAC,QAAQ;YAC1B,aAAa,EAAE,oBAAoB,CAAC,OAAO,CAAC;SAC/C,CAAC,CAAC;QACH,OAAO;IACX,CAAC;IACD,OAAO,CAAC,IAAI,EAAE,CAAC;AACnB,CAAC,CAAC,CAAC;AAEP;;;;;;;;GAQG;AACH,SAAS,aAAa,CAAI,OAAgB,EAAE,IAAY,EAAE,KAAQ;IAC9D,IAAI,OAAO,CAAC,oBAAoB,CAAC,IAAI,CAAC,KAAK,KAAK;QAAE,OAAO,KAAK,CAAC;IAC/D,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAC9B,IAAI,MAAM,EAAE,oBAAoB,CAAC,IAAI,CAAC,KAAK,KAAK;QAAE,OAAO,MAAM,CAAC,IAAI,EAAE,CAAC,IAAI,CAAM,CAAC;IAClF,OAAO,KAAK,CAAC;AACjB,CAAC;AAED,OAAO;KACF,OAAO,CAAC,KAAK,CAAC;KACd,WAAW,CAAC,wCAAwC,CAAC;KACrD,MAAM,CAAC,mBAAmB,EAAE,aAAa,EAAE,MAAM,CAAC;KAClD,MAAM,CAAC,WAAW,EAAE,uBAAuB,CAAC;KAC5C,MAAM,CAAC,gBAAgB,EAAE,6BAA6B,CAAC;KACvD,MAAM,CAAC,KAAK,WAA0B,OAAgE;IACnG,MAAM,IAAI,GAAG,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;IACvD,MAAM,IAAI,GAAG,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;IACvD,MAAM,YAAY,GAAG,aAAa,CAAC,IAAI,EAAE,cAAc,EAAE,OAAO,CAAC,YAAY,CAAC,CAAC;IAC/E,MAAM,mBAAmB,CAAC;QACtB,IAAI,EAAE,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC;QACvC,IAAI;QACJ,aAAa,EAAE,oBAAoB,CAAC,EAAE,YAAY,EAAE,CAAC;KACxD,CAAC,CAAC;AACP,CAAC,CAAC,CAAC;AAEP,OAAO;KACF,OAAO,CAAC,UAAU,CAAC;KACnB,WAAW,CAAC,gDAAgD,CAAC;KAC7D,MAAM,CAAC,GAAG,EAAE;IACT,OAAO,CAAC,GAAG,CAAC,qBAAqB,CAAC,CAAC;IACnC,KAAK,MAAM,EAAE,IAAI,qBAAqB,EAAE;QAAE,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IACjE,OAAO,CAAC,GAAG,CAAC,gDAAgD,CAAC,CAAC;AAClE,CAAC,CAAC,CAAC;AAEP,OAAO;KACF,OAAO,CAAC,WAAW,CAAC;KACpB,WAAW,CAAC,qDAAqD,CAAC;KAClE,MAAM,CAAC,GAAG,EAAE;IACT,OAAO,CAAC,GAAG,CAAC,8BAA8B,CAAC,CAAC;IAC5C,KAAK,MAAM,EAAE,IAAI,sBAAsB,EAAE;QAAE,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IAClE,OAAO,CAAC,GAAG,CAAC,wDAAwD,CAAC,CAAC;AAC1E,CAAC,CAAC,CAAC;AAEP,OAAO;KACF,OAAO,CAAC,OAAO,CAAC;KAChB,WAAW,CAAC,4DAA4D,CAAC;KACzE,MAAM,CAAC,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,CAAC;KACxD,MAAM,CAAC,cAAc,EAAE,qDAAqD,CAAC;KAC7E,MAAM,CAAC,gBAAgB,EAAE,6BAA6B,CAAC;KACvD,MAAM,CAAC,KAAK,WAA0B,OAAyE;IAC5G,wEAAwE;IACxE,sEAAsE;IACtE,+CAA+C;IAC/C,MAAM,YAAY,GAAG,aAAa,CAAC,IAAI,EAAE,cAAc,EAAE,OAAO,CAAC,YAAY,CAAC,CAAC;IAC/E,MAAM,qBAAqB,CAAC;QACxB,GAAG,OAAO;QACV,aAAa,EAAE,oBAAoB,CAAC,EAAE,YAAY,EAAE,CAAC;KACxD,CAAC,CAAC;AACP,CAAC,CAAC,CAAC;AAEP,OAAO,CAAC,KAAK,EAAE,CAAC"}
|
package/lib/commands/build.d.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
|
+
import { type FeatureGrants } from '../feature-grants.js';
|
|
1
2
|
export declare function architectBuildCommand(options: {
|
|
2
3
|
output?: string;
|
|
3
4
|
standalone?: boolean;
|
|
5
|
+
/** Baked into the viewer, so a distributed build keeps the grants it was built with. */
|
|
6
|
+
featureGrants?: FeatureGrants;
|
|
4
7
|
}): Promise<void>;
|
|
5
8
|
//# sourceMappingURL=build.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../src/commands/build.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../src/commands/build.ts"],"names":[],"mappings":"AAWA,OAAO,EAAuB,KAAK,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAwB/E,wBAAsB,qBAAqB,CAAC,OAAO,EAAE;IACjD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,wFAAwF;IACxF,aAAa,CAAC,EAAE,aAAa,CAAC;CACjC,GAAG,OAAO,CAAC,IAAI,CAAC,CA4BhB"}
|
package/lib/commands/build.js
CHANGED
|
@@ -2,6 +2,7 @@ import { cpSync, existsSync, mkdirSync, readFileSync, rmSync, writeFileSync, } f
|
|
|
2
2
|
import { dirname, resolve } from 'node:path';
|
|
3
3
|
import { fileURLToPath } from 'node:url';
|
|
4
4
|
import { buildProjectSnapshot, serializeForInlineScript } from '@memoarchitect/tools';
|
|
5
|
+
import { injectFeatureGrants } from '../feature-grants.js';
|
|
5
6
|
function architectPackageRoot() {
|
|
6
7
|
return resolve(dirname(fileURLToPath(import.meta.url)), '../..');
|
|
7
8
|
}
|
|
@@ -37,6 +38,8 @@ export async function architectBuildCommand(options) {
|
|
|
37
38
|
completeness: snapshot.completeness,
|
|
38
39
|
});
|
|
39
40
|
html = html.replace('</head>', `<script>window.__MEMO_DATA__=${payload};</script>\n</head>`);
|
|
41
|
+
if (options.featureGrants)
|
|
42
|
+
html = injectFeatureGrants(html, options.featureGrants);
|
|
40
43
|
if (options.standalone)
|
|
41
44
|
html = inlineEntryAssets(html, outputDir);
|
|
42
45
|
writeFileSync(indexPath, html);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build.js","sourceRoot":"","sources":["../../src/commands/build.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,MAAM,EACN,UAAU,EACV,SAAS,EACT,YAAY,EACZ,MAAM,EACN,aAAa,GAChB,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,oBAAoB,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"build.js","sourceRoot":"","sources":["../../src/commands/build.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,MAAM,EACN,UAAU,EACV,SAAS,EACT,YAAY,EACZ,MAAM,EACN,aAAa,GAChB,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,oBAAoB,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AACtF,OAAO,EAAE,mBAAmB,EAAsB,MAAM,sBAAsB,CAAC;AAE/E,SAAS,oBAAoB;IACzB,OAAO,OAAO,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;AACrE,CAAC;AAED,SAAS,iBAAiB,CAAC,IAAY,EAAE,SAAiB;IACtD,IAAI,GAAG,IAAI,CAAC,OAAO,CACf,yDAAyD,EACzD,CAAC,KAAK,EAAE,IAAY,EAAE,EAAE;QACpB,MAAM,IAAI,GAAG,OAAO,CAAC,SAAS,EAAE,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,CAAC;QACzD,OAAO,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,UAAU,YAAY,CAAC,IAAI,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC;IACtF,CAAC,CACJ,CAAC;IACF,IAAI,GAAG,IAAI,CAAC,OAAO,CACf,4CAA4C,EAC5C,CAAC,KAAK,EAAE,GAAW,EAAE,EAAE;QACnB,MAAM,IAAI,GAAG,OAAO,CAAC,SAAS,EAAE,GAAG,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,CAAC;QACxD,OAAO,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,yBAAyB,YAAY,CAAC,IAAI,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,KAAK,CAAC;IACtG,CAAC,CACJ,CAAC;IACF,OAAO,IAAI,CAAC;AAChB,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,qBAAqB,CAAC,OAK3C;IACG,MAAM,QAAQ,GAAG,MAAM,oBAAoB,EAAE,CAAC;IAC9C,MAAM,UAAU,GAAG,OAAO,CAAC,oBAAoB,EAAE,EAAE,MAAM,CAAC,CAAC;IAC3D,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,UAAU,EAAE,YAAY,CAAC,CAAC,EAAE,CAAC;QACjD,MAAM,IAAI,KAAK,CAAC,yFAAyF,CAAC,CAAC;IAC/G,CAAC;IAED,MAAM,SAAS,GAAG,OAAO,CAAC,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC,MAAM,IAAI,MAAM,CAAC,CAAC;IAC1E,IAAI,SAAS,KAAK,UAAU,EAAE,CAAC;QAC3B,MAAM,IAAI,KAAK,CAAC,yEAAyE,CAAC,CAAC;IAC/F,CAAC;IACD,MAAM,CAAC,SAAS,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IACpD,SAAS,CAAC,SAAS,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAC1C,MAAM,CAAC,UAAU,EAAE,SAAS,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAEnD,MAAM,SAAS,GAAG,OAAO,CAAC,SAAS,EAAE,YAAY,CAAC,CAAC;IACnD,IAAI,IAAI,GAAG,YAAY,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;IAC5C,MAAM,OAAO,GAAG,wBAAwB,CAAC;QACrC,KAAK,EAAE,QAAQ,CAAC,KAAK;QACrB,UAAU,EAAE,QAAQ,CAAC,UAAU;QAC/B,YAAY,EAAE,QAAQ,CAAC,YAAY;KACtC,CAAC,CAAC;IACH,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,gCAAgC,OAAO,qBAAqB,CAAC,CAAC;IAC7F,IAAI,OAAO,CAAC,aAAa;QAAE,IAAI,GAAG,mBAAmB,CAAC,IAAI,EAAE,OAAO,CAAC,aAAa,CAAC,CAAC;IACnF,IAAI,OAAO,CAAC,UAAU;QAAE,IAAI,GAAG,iBAAiB,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;IAClE,aAAa,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;IAE/B,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,6BAA6B,SAAS,IAAI,CAAC,CAAC;AACrE,CAAC"}
|
package/lib/commands/dev.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dev.d.ts","sourceRoot":"","sources":["../../src/commands/dev.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"dev.d.ts","sourceRoot":"","sources":["../../src/commands/dev.ts"],"names":[],"mappings":"AAIA,OAAO,EAAuB,KAAK,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAY/E,wBAAsB,mBAAmB,CAAC,OAAO,EAAE;IAC/C,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,OAAO,CAAC;IAAC,aAAa,CAAC,EAAE,aAAa,CAAC;CAChE,GAAG,OAAO,CAAC,IAAI,CAAC,CAoBhB"}
|
package/lib/commands/dev.js
CHANGED
|
@@ -2,6 +2,7 @@ import { existsSync } from 'node:fs';
|
|
|
2
2
|
import { dirname, resolve } from 'node:path';
|
|
3
3
|
import { fileURLToPath } from 'node:url';
|
|
4
4
|
import { startProjectServer } from '@memoarchitect/tools';
|
|
5
|
+
import { injectFeatureGrants } from '../feature-grants.js';
|
|
5
6
|
function architectPackageRoot() {
|
|
6
7
|
return resolve(dirname(fileURLToPath(import.meta.url)), '../..');
|
|
7
8
|
}
|
|
@@ -24,6 +25,10 @@ export async function architectDevCommand(options) {
|
|
|
24
25
|
port: options.port,
|
|
25
26
|
open: options.open,
|
|
26
27
|
clientRoot: clientRoot(),
|
|
28
|
+
// Tools serves the shell; Architect decides what goes into it.
|
|
29
|
+
transformClientHtml: options.featureGrants
|
|
30
|
+
? html => injectFeatureGrants(html, options.featureGrants)
|
|
31
|
+
: undefined,
|
|
27
32
|
});
|
|
28
33
|
}
|
|
29
34
|
//# sourceMappingURL=dev.js.map
|
package/lib/commands/dev.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dev.js","sourceRoot":"","sources":["../../src/commands/dev.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"dev.js","sourceRoot":"","sources":["../../src/commands/dev.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,mBAAmB,EAAsB,MAAM,sBAAsB,CAAC;AAE/E,SAAS,oBAAoB;IACzB,OAAO,OAAO,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;AACrE,CAAC;AAED,SAAS,UAAU;IACf,MAAM,IAAI,GAAG,oBAAoB,EAAE,CAAC;IACpC,MAAM,UAAU,GAAG,OAAO,CAAC,IAAI,EAAE,UAAU,EAAE,KAAK,CAAC,CAAC;IACpD,OAAO,UAAU,CAAC,OAAO,CAAC,UAAU,EAAE,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC;AAC7E,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,mBAAmB,CAAC,OAEzC;IACG,wEAAwE;IACxE,2EAA2E;IAC3E,uEAAuE;IACvE,uEAAuE;IACvE,KAAK,MAAM,MAAM,IAAI,CAAC,QAAQ,EAAE,SAAS,CAAU,EAAE,CAAC;QAClD,OAAO,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,EAAE;YACtB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QACpB,CAAC,CAAC,CAAC;IACP,CAAC;IAED,MAAM,kBAAkB,CAAC;QACrB,IAAI,EAAE,OAAO,CAAC,IAAI;QAClB,IAAI,EAAE,OAAO,CAAC,IAAI;QAClB,UAAU,EAAE,UAAU,EAAE;QACxB,+DAA+D;QAC/D,mBAAmB,EAAE,OAAO,CAAC,aAAa;YACtC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,mBAAmB,CAAC,IAAI,EAAE,OAAO,CAAC,aAAc,CAAC;YAC3D,CAAC,CAAC,SAAS;KAClB,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { FeatureGrants } from '../feature-grants.js';
|
|
1
2
|
/** IDs accepted by `memo-architect --example`. */
|
|
2
3
|
export declare function listArchitectExamples(): string[];
|
|
3
4
|
/** Project templates supplied by the same ontology content package. */
|
|
@@ -16,5 +17,6 @@ export declare function architectExampleCommand(options: {
|
|
|
16
17
|
open?: boolean;
|
|
17
18
|
/** Force the disposable copy even for a local checkout. */
|
|
18
19
|
readOnly?: boolean;
|
|
20
|
+
featureGrants?: FeatureGrants;
|
|
19
21
|
}): Promise<void>;
|
|
20
22
|
//# sourceMappingURL=example.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"example.d.ts","sourceRoot":"","sources":["../../src/commands/example.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"example.d.ts","sourceRoot":"","sources":["../../src/commands/example.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAgE1D,kDAAkD;AAClD,wBAAgB,qBAAqB,IAAI,MAAM,EAAE,CAEhD;AAED,uEAAuE;AACvE,wBAAgB,sBAAsB,IAAI,MAAM,EAAE,CAEjD;AA2BD;;;;;;;GAOG;AACH,wBAAsB,uBAAuB,CAAC,OAAO,EAAE;IACnD,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,2DAA2D;IAC3D,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,aAAa,CAAC,EAAE,aAAa,CAAC;CACjC,GAAG,OAAO,CAAC,IAAI,CAAC,CA6ChB"}
|
package/lib/commands/example.js
CHANGED
|
@@ -126,7 +126,9 @@ export async function architectExampleCommand(options) {
|
|
|
126
126
|
console.log(`Opening example '${options.name}' from ${target}`);
|
|
127
127
|
console.log('Edits are saved to that directory.');
|
|
128
128
|
process.chdir(target);
|
|
129
|
-
await architectDevCommand({
|
|
129
|
+
await architectDevCommand({
|
|
130
|
+
port: options.port, open: options.open, featureGrants: options.featureGrants,
|
|
131
|
+
});
|
|
130
132
|
return;
|
|
131
133
|
}
|
|
132
134
|
const slug = options.name.replace(/[^A-Za-z0-9]+/g, '-');
|
|
@@ -145,6 +147,8 @@ export async function architectExampleCommand(options) {
|
|
|
145
147
|
const why = options.readOnly ? '--read-only' : 'installed package';
|
|
146
148
|
console.log(`Opening example '${options.name}' read-only (${why}: disposable copy; edits are discarded on exit).`);
|
|
147
149
|
process.chdir(tempRoot);
|
|
148
|
-
await architectDevCommand({
|
|
150
|
+
await architectDevCommand({
|
|
151
|
+
port: options.port, open: options.open, featureGrants: options.featureGrants,
|
|
152
|
+
});
|
|
149
153
|
}
|
|
150
154
|
//# sourceMappingURL=example.js.map
|