@piagent/platform 1.38.1 → 1.39.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +25 -0
- package/README.md +1 -1
- package/README.vi.md +1 -1
- package/docs/command-reference-vietnamese.md +2 -2
- package/docs/distribution-standard.md +6 -6
- package/docs/languages.json +2 -2
- package/docs/operator-manual-vietnamese.md +7 -7
- package/docs/publishing-for-teams.md +2 -0
- package/docs/release-install-policy.md +2 -2
- package/docs/team-onboarding.md +2 -2
- package/docs-site/architecture.html +1 -1
- package/docs-site/benchmark.html +1 -1
- package/docs-site/commands.html +1 -1
- package/docs-site/content/en/index.html +4 -4
- package/docs-site/content/en/whats-new.html +12 -0
- package/docs-site/content/index.html +4 -4
- package/docs-site/content/whats-new.html +12 -0
- package/docs-site/context-engine.html +1 -1
- package/docs-site/ecosystem.html +1 -1
- package/docs-site/en/architecture.html +1 -1
- package/docs-site/en/benchmark.html +1 -1
- package/docs-site/en/commands.html +1 -1
- package/docs-site/en/context-engine.html +1 -1
- package/docs-site/en/ecosystem.html +1 -1
- package/docs-site/en/index.html +5 -5
- package/docs-site/en/mcp-approval.html +1 -1
- package/docs-site/en/mcp-auth.html +1 -1
- package/docs-site/en/mcp-servers.html +1 -1
- package/docs-site/en/mcp.html +1 -1
- package/docs-site/en/permissions.html +1 -1
- package/docs-site/en/profiles.html +1 -1
- package/docs-site/en/quickstart.html +1 -1
- package/docs-site/en/runtime.html +1 -1
- package/docs-site/en/scope.html +1 -1
- package/docs-site/en/security.html +1 -1
- package/docs-site/en/team.html +1 -1
- package/docs-site/en/whats-new.html +13 -1
- package/docs-site/en/windows.html +1 -1
- package/docs-site/en/workflows.html +1 -1
- package/docs-site/index.html +5 -5
- package/docs-site/mcp-approval.html +1 -1
- package/docs-site/mcp-auth.html +1 -1
- package/docs-site/mcp-servers.html +1 -1
- package/docs-site/mcp.html +1 -1
- package/docs-site/permissions.html +1 -1
- package/docs-site/profiles.html +1 -1
- package/docs-site/quickstart.html +1 -1
- package/docs-site/runtime.html +1 -1
- package/docs-site/scope.html +1 -1
- package/docs-site/security.html +1 -1
- package/docs-site/team.html +1 -1
- package/docs-site/whats-new.html +13 -1
- package/docs-site/windows.html +1 -1
- package/docs-site/workflows.html +1 -1
- package/evals/private-holdout-v1/public-exposure.v2.json +2 -2
- package/package.json +1 -1
- package/packages/piagent-core/managed/request-stream.mjs +3 -0
- package/packages/piagent-core/managed/workspace-report.mjs +51 -0
- package/packages/piagent-core/package.json +1 -1
- package/packages/piagent-webui/dist/client/assets/Alert-DGWhP2MM.js +1 -0
- package/packages/piagent-webui/dist/client/assets/Button-QItfZUNj.js +1 -0
- package/packages/piagent-webui/dist/client/assets/{DialogTitle-CL-fzCnT.js → DialogTitle-CyaFPaiW.js} +3 -3
- package/packages/piagent-webui/dist/client/assets/{MarkdownMessage-k4tq1y8s.js → MarkdownMessage-CMZESBjK.js} +2 -2
- package/packages/piagent-webui/dist/client/assets/TerminalPanel-DlcfsRaR.js +2 -0
- package/packages/piagent-webui/dist/client/assets/{TerminalView-B_a16moC.js → TerminalView-B83HGKgY.js} +3 -3
- package/packages/piagent-webui/dist/client/assets/Typography-B9om7Evq.js +1 -0
- package/packages/piagent-webui/dist/client/assets/WorkspaceCodeEditor-Ctf0VMQh.js +2 -0
- package/packages/piagent-webui/dist/client/assets/WorkspaceExplorer-fO2uXHZg.js +5 -0
- package/packages/piagent-webui/dist/client/assets/WorkspaceQuickOpen-ClaXnKl1.js +1 -0
- package/packages/piagent-webui/dist/client/assets/{dist-_JsfplOG.js → dist-B5MCHZv5.js} +2 -2
- package/packages/piagent-webui/dist/client/assets/dist-BM_LL1o9.js +1 -0
- package/packages/piagent-webui/dist/client/assets/dist-C2TMLUTo.js +23 -0
- package/packages/piagent-webui/dist/client/assets/dist-CqL3udNu.js +1 -0
- package/packages/piagent-webui/dist/client/assets/{dist-nvgpa2Us.js → dist-D4df0jLQ.js} +1 -1
- package/packages/piagent-webui/dist/client/assets/{dist-B1M7IjfA.js → dist-D6i5SpQu.js} +1 -1
- package/packages/piagent-webui/dist/client/assets/dist-DfjUS8LS.js +6 -0
- package/packages/piagent-webui/dist/client/assets/{dist-idN8f9Fc.js → dist-IRUjhd1P.js} +1 -1
- package/packages/piagent-webui/dist/client/assets/{dist-DcEu_WYV.js → dist-sNhoSseW.js} +1 -1
- package/packages/piagent-webui/dist/client/assets/index-BeBiJUDV.js +102 -0
- package/packages/piagent-webui/dist/client/assets/tab-close-ggR0dHlZ.js +1 -0
- package/packages/piagent-webui/dist/client/assets/ui-preferences-BO3AV7QE.js +10 -0
- package/packages/piagent-webui/dist/client/assets/useId-DEefKUAT.js +124 -0
- package/packages/piagent-webui/dist/client/index.html +7 -7
- package/packages/piagent-webui/gateway/gateway-service.ts +3 -0
- package/packages/piagent-webui/gateway/managed-projection.ts +6 -1
- package/packages/piagent-webui/gateway/session-catalog.ts +3 -2
- package/packages/piagent-webui/gateway/ui-preferences-store.ts +45 -0
- package/packages/piagent-webui/package.json +1 -0
- package/packages/piagent-webui/server/loopback-server.ts +2 -1
- package/packages/piagent-webui/server/member-routes.ts +20 -0
- package/packages/piagent-webui/shared/project-warning-copy.ts +16 -0
- package/schemas/piagent-webui/session-catalog-v1.schema.json +1 -1
- package/scripts/company-terminal.mjs +2 -0
- package/packages/piagent-webui/dist/client/assets/Alert-DXF8-XqE.js +0 -1
- package/packages/piagent-webui/dist/client/assets/Button-DZJosXQi.js +0 -1
- package/packages/piagent-webui/dist/client/assets/TerminalPanel-DvOPgrGI.js +0 -2
- package/packages/piagent-webui/dist/client/assets/Typography-DMZL1kLS.js +0 -1
- package/packages/piagent-webui/dist/client/assets/WorkspaceCodeEditor-BCiYM9NA.js +0 -2
- package/packages/piagent-webui/dist/client/assets/WorkspaceExplorer-DttpQtpf.js +0 -5
- package/packages/piagent-webui/dist/client/assets/WorkspaceQuickOpen-fgXwQ46B.js +0 -1
- package/packages/piagent-webui/dist/client/assets/dist-BUYtGaUP.js +0 -1
- package/packages/piagent-webui/dist/client/assets/dist-C82AtDDT.js +0 -6
- package/packages/piagent-webui/dist/client/assets/dist-D9b8j6pJ.js +0 -1
- package/packages/piagent-webui/dist/client/assets/dist-DLfpWwLs.js +0 -23
- package/packages/piagent-webui/dist/client/assets/index-BW8-BUMx.js +0 -102
- package/packages/piagent-webui/dist/client/assets/tab-close-HE0XxoJf.js +0 -1
- package/packages/piagent-webui/dist/client/assets/ui-preferences-DiddStu0.js +0 -124
- package/packages/piagent-webui/dist/client/assets/useTheme-_ESOj7MI.js +0 -10
|
@@ -92,7 +92,7 @@
|
|
|
92
92
|
"composerAvailable": { "type": "boolean" },
|
|
93
93
|
"needsAttention": { "type": "boolean" },
|
|
94
94
|
"managedHelpers": { "type": "object", "additionalProperties": false, "required": ["active", "maximum"], "properties": {"active": {"type": ["integer", "null"], "minimum": 0, "maximum": 4}, "maximum": {"type": "integer", "minimum": 0, "maximum": 4}} },
|
|
95
|
-
"managedThinkingLevels": {"type": "array", "uniqueItems": true, "maxItems": 7, "items": {"enum": ["off","minimal","low","medium","high","xhigh","max"]}}, "managedPermission": {"enum": ["workspace-write","trusted-full-access","bypass"]}, "managedBypass": {"const": true}, "managedFast": {"enum": ["off","on"]},
|
|
95
|
+
"managedThinkingLevels": {"type": "array", "uniqueItems": true, "maxItems": 7, "items": {"enum": ["off","minimal","low","medium","high","xhigh","max"]}}, "managedPermission": {"enum": ["workspace-write","trusted-full-access","bypass"]}, "managedBypass": {"const": true}, "managedProjectWarning": {"type": "object", "additionalProperties": false, "required": ["warnings"], "properties": {"team": {"type": "string", "minLength": 1, "maxLength": 80}, "warnings": {"type": "array", "minItems": 1, "maxItems": 6, "items": {"type": "object", "additionalProperties": false, "required": ["repo", "kind"], "properties": {"repo": {"type": "string", "minLength": 1, "maxLength": 200}, "kind": {"enum": ["other_team", "unlisted"]}}}}}}, "managedFast": {"enum": ["off","on"]},
|
|
96
96
|
"managedPlan": { "type": "object", "additionalProperties": false, "required": ["steps"], "properties": {
|
|
97
97
|
"steps": { "type": "array", "minItems": 1, "maxItems": 30, "items": { "type": "object", "additionalProperties": false, "required": ["step", "status"], "properties": {
|
|
98
98
|
"step": { "type": "string", "minLength": 1, "maxLength": 200 }, "status": { "enum": ["pending", "in_progress", "completed", "deferred"] } } } } } },
|
|
@@ -16,6 +16,7 @@ import { memoryOn } from '../packages/piagent-core/managed/memory.mjs';
|
|
|
16
16
|
import { companyFailureText } from '../packages/piagent-webui/shared/company-copy.ts';
|
|
17
17
|
import { headlineText, outcomeText, processItems } from '../packages/piagent-webui/shared/process-copy.ts';
|
|
18
18
|
import { turnEndCopy, turnEndOf } from '../packages/piagent-webui/shared/turn-end.ts';
|
|
19
|
+
import { projectWarningText } from '../packages/piagent-webui/shared/project-warning-copy.ts';
|
|
19
20
|
|
|
20
21
|
const LOCALE = 'vi';
|
|
21
22
|
|
|
@@ -399,6 +400,7 @@ export function companyTerminalExtension({ managed, packageRoot, sdkRoot, bindin
|
|
|
399
400
|
void showBranch();
|
|
400
401
|
session.subscribe((event) => {
|
|
401
402
|
if (event?.type === 'managed_helpers') ctx.ui?.setStatus?.('agent-watch-helpers', event.active ? `Subagent ${event.active}/${event.maximum}` : undefined);
|
|
403
|
+
if (event?.type === 'managed_project_warning') ctx.ui?.notify?.(projectWarningText(event.warnings, event.team, LOCALE), 'warning');
|
|
402
404
|
const end = event?.type === 'managed_turn_end' ? turnEndOf(event.end) : null;
|
|
403
405
|
if (!end) return;
|
|
404
406
|
const copy = turnEndCopy(end, LOCALE), stats = turnStats(session.messages);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{U as t,b as n,d as r,f as i,u as a}from"./useTheme-_ESOj7MI.js";import{A as o,C as s,D as c,E as l,N as u,S as d,T as f,_ as p,a as m,i as h,o as g,p as _,w as v}from"./ui-preferences-DiddStu0.js";import{r as y}from"./Typography-DMZL1kLS.js";var b=e(t(),1),x=n(),S=b.createContext();function C({value:e,...t}){return(0,x.jsx)(S.Provider,{value:e??!0,...t})}var w=()=>b.useContext(S)??!1;function T(e){return typeof e==`string`}function E(e,t=166){let n;function r(...r){clearTimeout(n),n=setTimeout(()=>{e.apply(this,r)},t)}return r.clear=()=>{clearTimeout(n)},r}function D(e){return e&&e.ownerDocument||document}function O(e){return D(e).defaultView||window}var k=u,A=D;function j(e){let t=e.activeElement;for(;t?.shadowRoot?.activeElement!=null;)t=t.shadowRoot.activeElement;return t}var ee=j;function M(e,t,n){return e===void 0||T(e)?t:{...t,ownerState:{...t.ownerState,...n}}}function N(e,t,n){return typeof e==`function`?e(t,n):e}function P(e,t){let n=e.charCodeAt(2);return e[0]===`o`&&e[1]===`n`&&n>=65&&n<=90&&typeof t==`function`}function F(e){if(e===void 0)return{};let t={};for(let n of Object.keys(e))P(n,e[n])&&(t[n]=e[n]);return t}function I(e){if(e===void 0)return{};let t={};return Object.keys(e).filter(t=>!(t.match(/^on[A-Z]/)&&typeof e[t]==`function`)).forEach(n=>{t[n]=e[n]}),t}function te(e){let{getSlotProps:t,additionalProps:n,externalSlotProps:r,externalForwardedProps:a,className:o}=e;if(!t){let e=i(n?.className,o,a?.className,r?.className),t={...n?.style,...a?.style,...r?.style},s={...n,...a,...r};return e.length>0&&(s.className=e),Object.keys(t).length>0&&(s.style=t),{props:s,internalRef:void 0}}let s=F({...a,...r}),c=I(r),l=I(a),u=t(s),d=i(u?.className,n?.className,o,a?.className,r?.className),f={...u?.style,...n?.style,...a?.style,...r?.style},p={...u,...n,...l,...c};return d.length>0&&(p.className=d),Object.keys(f).length>0&&(p.style=f),{props:p,internalRef:u.ref}}function L(e,t){let{className:n,elementType:r,ownerState:i,externalForwardedProps:a,internalForwardedProps:o,shouldForwardComponentProp:s=!1,...c}=t,{component:l,slots:u={[e]:void 0},slotProps:d={[e]:void 0},...p}=a,m=u[e]||r,h=N(d[e],i),{props:{component:g,..._},internalRef:v}=te({className:n,...c,externalForwardedProps:e===`root`?p:void 0,externalSlotProps:h}),y=f(v,h?.ref,t.ref),b=e===`root`?g||l:g;return[m,M(m,{...e===`root`&&!l&&!u[e]&&o,...e!==`root`&&!u[e]&&o,..._,...b&&!s&&{as:b},...b&&s&&{component:b},ref:y},i)]}function ne(e){return r(`MuiSvgIcon`,e)}a(`MuiSvgIcon`,[`root`,`colorPrimary`,`colorSecondary`,`colorAction`,`colorError`,`colorDisabled`,`fontSizeInherit`,`fontSizeSmall`,`fontSizeMedium`,`fontSizeLarge`]);var re=e=>{let{color:t,fontSize:n,classes:r}=e,i={root:[`root`,t!==`inherit`&&`color${d(t)}`,`fontSize${d(n)}`]};return o(i,ne,r)},ie=c(`svg`,{name:`MuiSvgIcon`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,n.color!==`inherit`&&t[`color${d(n.color)}`],t[`fontSize${d(n.fontSize)}`]]}})(s(({theme:e})=>({userSelect:`none`,width:`1em`,height:`1em`,display:`inline-block`,flexShrink:0,...p(e,`fill`,{duration:(e.vars??e).transitions?.duration?.shorter}),variants:[{props:e=>!e.hasSvgAsChild,style:{fill:`currentColor`}},{props:{fontSize:`inherit`},style:{fontSize:`inherit`}},{props:{fontSize:`small`},style:{fontSize:e.typography?.pxToRem?.(20)||`1.25rem`}},{props:{fontSize:`medium`},style:{fontSize:e.typography?.pxToRem?.(24)||`1.5rem`}},{props:{fontSize:`large`},style:{fontSize:e.typography?.pxToRem?.(35)||`2.1875rem`}},...Object.entries((e.vars??e).palette).filter(([,e])=>e&&e.main).map(([t])=>({props:{color:t},style:{color:(e.vars??e).palette?.[t]?.main}})),{props:{color:`action`},style:{color:(e.vars??e).palette?.action?.active}},{props:{color:`disabled`},style:{color:(e.vars??e).palette?.action?.disabled}},{props:{color:`inherit`},style:{color:void 0}}]}))),R=b.forwardRef(function(e,t){let n=l({props:e,name:`MuiSvgIcon`}),{children:r,className:a,color:o=`inherit`,component:s=`svg`,fontSize:c=`medium`,htmlColor:u,inheritViewBox:d=!1,titleAccess:f,viewBox:p=`0 0 24 24`,...m}=n,h=b.isValidElement(r)&&r.type===`svg`,g={...n,color:o,component:s,fontSize:c,instanceFontSize:e.fontSize,inheritViewBox:d,viewBox:p,hasSvgAsChild:h},_={};d||(_.viewBox=p);let v=re(g);return(0,x.jsxs)(ie,{as:s,className:i(v.root,a),focusable:`false`,color:u,"aria-hidden":!f||void 0,role:f?`img`:void 0,ref:t,..._,...m,...h&&r.props,ownerState:g,children:[h?r.props.children:r,f?(0,x.jsx)(`title`,{children:f}):null]})});R.muiName=`SvgIcon`;function z(e,t){function n(t,n){return(0,x.jsx)(R,{"data-testid":void 0,ref:n,...t,children:e})}return n.muiName=R.muiName,b.memo(b.forwardRef(n))}function B(e,t){if(!e||!t)return!1;if(e.contains(t))return!0;let n=t.getRootNode?.();if(n&&n instanceof ShadowRoot){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode??n.host??null}}return!1}var ae=B;function V(e,t){typeof e==`function`?e(t):e&&(e.current=t)}var oe=E,se=O;function ce(e){return r(`MuiIconButton`,e)}var H=a(`MuiIconButton`,[`root`,`disabled`,`colorInherit`,`colorPrimary`,`colorSecondary`,`colorError`,`colorInfo`,`colorSuccess`,`colorWarning`,`edgeStart`,`edgeEnd`,`sizeSmall`,`sizeMedium`,`sizeLarge`,`loading`,`loadingIndicator`,`loadingWrapper`]),le=e=>{let{classes:t,disabled:n,color:r,edge:i,size:a,loading:s}=e,c={root:[`root`,s&&`loading`,n&&`disabled`,r!=="default"&&`color${d(r)}`,i&&`edge${d(i)}`,`size${d(a)}`],loadingIndicator:[`loadingIndicator`],loadingWrapper:[`loadingWrapper`]};return o(c,ce,t)},ue=c(g,{name:`MuiIconButton`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,n.loading&&t.loading,n.color!=="default"&&t[`color${d(n.color)}`],n.edge&&t[`edge${d(n.edge)}`],t[`size${d(n.size)}`]]}})(s(({theme:e})=>({textAlign:`center`,flex:`0 0 auto`,fontSize:e.typography.pxToRem(24),padding:8,borderRadius:`50%`,color:(e.vars||e).palette.action.active,...p(e,`background-color`,{duration:e.transitions.duration.shortest}),variants:[{props:e=>!e.disableRipple,style:{"--IconButton-hoverBg":e.alpha((e.vars||e).palette.action.active,(e.vars||e).palette.action.hoverOpacity),"&:hover":{backgroundColor:`var(--IconButton-hoverBg)`,"@media (hover: none)":{backgroundColor:`transparent`}}}},{props:{edge:`start`},style:{marginLeft:-12}},{props:{edge:`start`,size:`small`},style:{marginLeft:-3}},{props:{edge:`end`},style:{marginRight:-12}},{props:{edge:`end`,size:`small`},style:{marginRight:-3}}]})),s(({theme:e})=>({variants:[{props:{color:`inherit`},style:{color:`inherit`}},...Object.entries(e.palette).filter(_()).map(([t])=>({props:{color:t},style:{color:(e.vars||e).palette[t].main,"--IconButton-hoverBg":e.alpha((e.vars||e).palette[t].main,(e.vars||e).palette.action.hoverOpacity)}})),{props:{size:`small`},style:{padding:5,fontSize:e.typography.pxToRem(18)}},{props:{size:`large`},style:{padding:12,fontSize:e.typography.pxToRem(28)}}],[`&.${H.disabled}`]:{backgroundColor:`transparent`,color:(e.vars||e).palette.action.disabled},[`&.${H.loading}`]:{color:`transparent`}}))),de=c(`span`,{name:`MuiIconButton`,slot:`LoadingIndicator`})(({theme:e})=>({display:`none`,position:`absolute`,visibility:`visible`,top:`50%`,left:`50%`,transform:`translate(-50%, -50%)`,color:(e.vars||e).palette.action.disabled,variants:[{props:{loading:!0},style:{display:`flex`}}]})),U=b.forwardRef(function(e,t){let n=l({props:e,name:`MuiIconButton`}),{edge:r=!1,children:a,className:o,color:s=`default`,disabled:c=!1,disableFocusRipple:u=!1,size:d=`medium`,id:f,loading:p=null,loadingIndicator:g,..._}=n,v=h(f),y=g??(0,x.jsx)(m,{"aria-labelledby":v,color:`inherit`,size:16}),b={...n,edge:r,color:s,disabled:c,disableFocusRipple:u,loading:p,loadingIndicator:y,size:d},S=le(b);return(0,x.jsxs)(ue,{id:p?v:f,className:i(S.root,o),centerRipple:!0,internalNativeButton:!0,focusRipple:!u,disabled:c||p,ref:t,..._,ownerState:b,children:[typeof p==`boolean`&&(0,x.jsx)(`span`,{className:S.loadingWrapper,style:{display:`contents`},children:(0,x.jsx)(de,{className:S.loadingIndicator,ownerState:b,children:p&&y})}),a]})}),W=b.createContext(void 0);function G(){let e=b.useContext(W);if(e===void 0)throw Error(`MUI: RovingTabIndexContext is missing. Roving tab index items must be placed within a roving tab index provider.`);return e}var fe=Object.is;function pe(e,t){if(e===t)return!0;if(!(e instanceof Object)||!(t instanceof Object))return!1;let n=0,r=0;for(let r in e)if(n+=1,!fe(e[r],t[r])||!(r in t))return!1;for(let e in t)r+=1;return n===r}var me=[`ArrowRight`,`ArrowLeft`,`ArrowUp`,`ArrowDown`,`Home`,`End`];function he(e){let{activeItemId:t,getDefaultActiveItemId:n,orientation:r,isRtl:i=!1,isItemFocusable:a=Ce,wrap:o=!0}=e,[s,c]=b.useState(t),[l,u]=b.useState(t),d=s;t!==l&&(u(t),t!==void 0&&t!==s&&(d=t,c(t)));let f=b.useRef(null),p=b.useRef(new Map),[m,h]=b.useState(0),g=b.useMemo(()=>X(p.current),[m]),_=K(d,g,a,n),y=b.useRef(_);y.current=_;let x=b.useCallback(()=>{let e=X(p.current);return ye(e,K(y.current,e,a,n))},[n,a]),S=b.useCallback(()=>p.current,[]),C=v(e=>{pe(p.current.get(e.id)??null,e)||(p.current.set(e.id,e),h(e=>e+1))}),w=v(e=>{p.current.delete(e)&&h(e=>e+1)}),T=v(e=>{c(e)}),E=b.useCallback(e=>y.current===e,[]),O=b.useCallback((e,t,n,r)=>{let i=J(Z(p.current),e,t,n,r??a);return i?(i.element?.focus(),c(i.id),i):null},[a]),k=b.useCallback((e,t,n)=>({onFocus:e=>{t?.(e);let n=Z(p.current),r=xe(n,e.target);r!==-1&&c(n[r].id)},onKeyDown:e=>{if(n?.(e),e.defaultPrevented||e.altKey||e.shiftKey||e.ctrlKey||e.metaKey||!me.includes(e.key))return;let t=r===`horizontal`?`ArrowLeft`:`ArrowUp`,a=r===`horizontal`?`ArrowRight`:`ArrowDown`;r===`horizontal`&&i&&(t=`ArrowRight`,a=`ArrowLeft`);let s=Z(p.current),c=j(D(f.current)),l=c===f.current,u=q(s,c,y.current),d=`next`;switch(e.key){case t:d=`previous`,e.preventDefault(),l&&(u=s.length);break;case a:e.preventDefault(),l&&(u=-1);break;case`Home`:e.preventDefault(),u=-1;break;case`End`:e.preventDefault(),d=`previous`,u=s.length;break;default:return}O(u,d,o)},ref:Te(e,e=>{f.current=e})}),[O,i,r,o]),A=b.useCallback(e=>{let t=Z(p.current),n=j(D(f.current)),r=n===f.current?-1:q(t,n,y.current);return O(r,`next`,!0,e)?.id??null},[O]);return b.useMemo(()=>({activeItemId:_,focusNext:A,getActiveItem:x,getContainerProps:k,getItemMap:S,isItemActive:E,registerItem:C,setActiveItemId:T,unregisterItem:w}),[_,A,x,k,S,E,C,T,w])}function ge(e){let{activeItemId:t,registerItem:n,unregisterItem:r}=G(),i=b.useRef(null),a=b.useMemo(()=>({disabled:e.disabled??!1,element:null,focusableWhenDisabled:e.focusableWhenDisabled??!1,id:e.id,selected:e.selected??!1,textValue:e.textValue}),[e.disabled,e.focusableWhenDisabled,e.id,e.selected,e.textValue]),o=b.useRef(a);o.current=a;let s=b.useCallback(t=>{if(i.current=t,t==null){queueMicrotask(()=>{i.current??r(e.id)});return}n({...o.current,element:t})},[e.id,n,r]),c=f(e.ref,s);return u(()=>{i.current&&n({...a,element:i.current})},[a,n]),u(()=>{let t=e.id;return()=>{r(t)}},[e.id,r]),{ref:c,tabIndex:t===e.id?0:-1}}function K(e,t,n,r){return e==null?ve(t,n,r):_e(e,t,n)}function _e(e,t,n){let r=be(t,e);return r===-1?Y(t,n):n(t[r])?t[r].id:J(t,r,`next`,!1,n)?.id??null}function ve(e,t,n){let r=n?.(e);if(r!=null){let n=ye(e,r);if(n&&t(n))return n.id}return Y(e,t)}function q(e,t,n){if(t){let n=xe(e,t);if(n!==-1)return n}return be(e,n)}function J(e,t,n,r,i){let a=e.length-1;if(a===-1)return null;let o=!1,s=Se(t,a,n,r),c=s;for(;s!==-1;){if(s===c){if(o)return null;o=!0}let t=e[s];if(!t||!i(t))s=Se(s,a,n,r);else return t}return null}function Y(e,t){return e.find(e=>t(e))?.id??null}function ye(e,t){return t==null?null:e.find(e=>e.id===t)??null}function be(e,t){return t==null?-1:e.findIndex(e=>e.id===t)}function xe(e,t){return t?e.findIndex(e=>e.element===t||e.element?.contains(t)):-1}function X(e){let t=Array.from(e.values());if(t.every(e=>e.element==null))return t;let n=t.filter(Q).sort((e,t)=>we(e.element,t.element)),r=t.filter(e=>!Q(e));return[...n,...r]}function Z(e){return X(e).filter(Q)}function Se(e,t,n,r=!0){return n===`next`?e===t?r?0:-1:e+1:e===0?r?t:-1:e-1}function Ce(e){return e.element?e.focusableWhenDisabled?!0:!e.disabled&&!e.element.hasAttribute(`disabled`)&&e.element.getAttribute(`aria-disabled`)!==`true`&&e.element.hasAttribute(`tabindex`):!1}function Q(e){return e.element!=null&&e.element.isConnected}function we(e,t){if(e===t)return 0;let n=e.compareDocumentPosition(t);return n&Node.DOCUMENT_POSITION_FOLLOWING||n&Node.DOCUMENT_POSITION_CONTAINED_BY?-1:n&Node.DOCUMENT_POSITION_PRECEDING||n&Node.DOCUMENT_POSITION_CONTAINS?1:0}function Te(...e){return t=>{e.forEach(e=>{V(e??null,t)})}}function Ee(e){let{elementType:t,externalSlotProps:n,ownerState:r,skipResolvingSlotProps:i=!1,...a}=e,o=i?{}:N(n,r),{props:s,internalRef:c}=te({...a,externalSlotProps:o}),l=f(c,o?.ref,e.additionalProps?.ref);return M(t,{...s,ref:l},r)}function De(e){return r(`MuiAlert`,e)}var Oe=a(`MuiAlert`,[`root`,`action`,`icon`,`message`,`filled`,`colorSuccess`,`colorInfo`,`colorWarning`,`colorError`,`outlined`,`standard`]),ke=z((0,x.jsx)(`path`,{d:`M20,12A8,8 0 0,1 12,20A8,8 0 0,1 4,12A8,8 0 0,1 12,4C12.76,4 13.5,4.11 14.2, 4.31L15.77,2.74C14.61,2.26 13.34,2 12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0, 0 22,12M7.91,10.08L6.5,11.5L11,16L21,6L19.59,4.58L11,13.17L7.91,10.08Z`}),`SuccessOutlined`),Ae=z((0,x.jsx)(`path`,{d:`M12 5.99L19.53 19H4.47L12 5.99M12 2L1 21h22L12 2zm1 14h-2v2h2v-2zm0-6h-2v4h2v-4z`}),`ReportProblemOutlined`),je=z((0,x.jsx)(`path`,{d:`M11 15h2v2h-2zm0-8h2v6h-2zm.99-5C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z`}),`ErrorOutline`),Me=z((0,x.jsx)(`path`,{d:`M11,9H13V7H11M12,20C7.59,20 4,16.41 4,12C4,7.59 7.59,4 12,4C16.41,4 20,7.59 20, 12C20,16.41 16.41,20 12,20M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10, 10 0 0,0 12,2M11,17H13V11H11V17Z`}),`InfoOutlined`),Ne=z((0,x.jsx)(`path`,{d:`M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z`}),`Close`),Pe=e=>{let{variant:t,color:n,severity:r,classes:i}=e,a={root:[`root`,`color${d(n||r)}`,`${t}`],icon:[`icon`],message:[`message`],action:[`action`]};return o(a,De,i)},Fe=c(y,{name:`MuiAlert`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,t[n.variant]]}})(s(({theme:e})=>{let t=e.palette.mode===`light`?e.darken:e.lighten,n=e.palette.mode===`light`?e.lighten:e.darken;return{...e.typography.body2,backgroundColor:`transparent`,display:`flex`,padding:`6px 16px`,variants:[...Object.entries(e.palette).filter(_([`light`])).map(([r])=>({props:{colorSeverity:r,variant:`standard`},style:{color:e.vars?e.vars.palette.Alert[`${r}Color`]:t(e.palette[r].light,.6),backgroundColor:e.vars?e.vars.palette.Alert[`${r}StandardBg`]:n(e.palette[r].light,.9),[`& .${Oe.icon}`]:e.vars?{color:e.vars.palette.Alert[`${r}IconColor`]}:{color:e.palette[r].main}}})),...Object.entries(e.palette).filter(_([`light`])).map(([n])=>({props:{colorSeverity:n,variant:`outlined`},style:{color:e.vars?e.vars.palette.Alert[`${n}Color`]:t(e.palette[n].light,.6),border:`1px solid ${(e.vars||e).palette[n].light}`,[`& .${Oe.icon}`]:e.vars?{color:e.vars.palette.Alert[`${n}IconColor`]}:{color:e.palette[n].main}}})),...Object.entries(e.palette).filter(_([`dark`])).map(([t])=>({props:{colorSeverity:t,variant:`filled`},style:{fontWeight:e.typography.fontWeightMedium,...e.vars?{color:e.vars.palette.Alert[`${t}FilledColor`],backgroundColor:e.vars.palette.Alert[`${t}FilledBg`]}:{backgroundColor:e.palette.mode===`dark`?e.palette[t].dark:e.palette[t].main,color:e.palette.getContrastText(e.palette[t].main)}}}))]}})),Ie=c(`div`,{name:`MuiAlert`,slot:`Icon`})({marginRight:12,padding:`7px 0`,display:`flex`,fontSize:22,opacity:.9}),Le=c(`div`,{name:`MuiAlert`,slot:`Message`})({padding:`8px 0`,minWidth:0,overflow:`auto`}),Re=c(`div`,{name:`MuiAlert`,slot:`Action`})({display:`flex`,alignItems:`flex-start`,padding:`4px 0 0 16px`,marginLeft:`auto`,marginRight:-8}),$={success:(0,x.jsx)(ke,{fontSize:`inherit`}),warning:(0,x.jsx)(Ae,{fontSize:`inherit`}),error:(0,x.jsx)(je,{fontSize:`inherit`}),info:(0,x.jsx)(Me,{fontSize:`inherit`})},ze=b.forwardRef(function(e,t){let n=l({props:e,name:`MuiAlert`}),{action:r,children:a,className:o,closeText:s=`Close`,color:c,icon:u,iconMapping:d=$,onClose:f,role:p=`alert`,severity:m=`success`,slotProps:h={},slots:g={},variant:_=`standard`,...v}=n,y={...n,color:c,severity:m,variant:_,colorSeverity:c||m},b=Pe(y),S={slots:g,slotProps:h},[C,w]=L(`root`,{ref:t,shouldForwardComponentProp:!0,className:i(b.root,o),elementType:Fe,externalForwardedProps:{...S,...v},ownerState:y,additionalProps:{role:p,elevation:0}}),[T,E]=L(`icon`,{className:b.icon,elementType:Ie,externalForwardedProps:S,ownerState:y}),[D,O]=L(`message`,{className:b.message,elementType:Le,externalForwardedProps:S,ownerState:y}),[k,A]=L(`action`,{className:b.action,elementType:Re,externalForwardedProps:S,ownerState:y}),[j,ee]=L(`closeButton`,{elementType:U,externalForwardedProps:S,ownerState:y}),[M,N]=L(`closeIcon`,{elementType:Ne,externalForwardedProps:S,ownerState:y});return(0,x.jsxs)(C,{...w,children:[u===!1?null:(0,x.jsx)(T,{...E,children:u||d[m]||$[m]}),(0,x.jsx)(D,{...O,children:a}),r==null?null:(0,x.jsx)(k,{...A,children:r}),r==null&&f?(0,x.jsx)(k,{...A,children:(0,x.jsx)(j,{size:`small`,"aria-label":s,title:s,color:`inherit`,onClick:f,...ee,children:(0,x.jsx)(M,{fontSize:`small`,...N})})}):null]})});export{D as C,w as D,C as E,O as S,T,F as _,he as a,A as b,U as c,V as d,ae as f,L as g,R as h,ge as i,se as l,z as m,Ee as n,W as o,B as p,Ce as r,G as s,ze as t,oe as u,P as v,E as w,k as x,ee as y};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{U as t,b as n,d as r,f as i,u as a}from"./useTheme-_ESOj7MI.js";import{A as o,C as s,D as c,E as l,O as u,P as d,S as f,_ as p,a as m,i as h,o as g,p as _}from"./ui-preferences-DiddStu0.js";var v=e(t(),1);function y(e){return r(`MuiButton`,e)}var b=a(`MuiButton`,`root.text.outlined.contained.disableElevation.focusVisible.disabled.colorInherit.colorPrimary.colorSecondary.colorSuccess.colorError.colorInfo.colorWarning.sizeMedium.sizeSmall.sizeLarge.fullWidth.startIcon.endIcon.icon.loading.loadingWrapper.loadingIconPlaceholder.loadingIndicator.loadingPositionCenter.loadingPositionStart.loadingPositionEnd`.split(`.`)),x=v.createContext({}),S=v.createContext(void 0),C=n(),w=e=>{let{color:t,disableElevation:n,fullWidth:r,size:i,variant:a,loading:s,loadingPosition:c,classes:l}=e,u={root:[`root`,s&&`loading`,a,`size${f(i)}`,`color${f(t)}`,n&&`disableElevation`,r&&`fullWidth`,s&&`loadingPosition${f(c)}`],startIcon:[`icon`,`startIcon`],endIcon:[`icon`,`endIcon`],loadingIndicator:[`loadingIndicator`],loadingWrapper:[`loadingWrapper`]},d=o(u,y,l);return{...l,...d}},T=[{props:{size:`small`},style:{"& > *:nth-of-type(1)":{fontSize:18}}},{props:{size:`medium`},style:{"& > *:nth-of-type(1)":{fontSize:20}}},{props:{size:`large`},style:{"& > *:nth-of-type(1)":{fontSize:22}}}],E=c(g,{shouldForwardProp:e=>u(e)||e===`classes`,name:`MuiButton`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,t[n.variant],t[`size${f(n.size)}`],n.color===`inherit`&&t.colorInherit,n.disableElevation&&t.disableElevation,n.fullWidth&&t.fullWidth,n.loading&&t.loading]}})(s(({theme:e})=>{let t=e.palette.mode===`light`?e.palette.grey[300]:e.palette.grey[800],n=e.palette.mode===`light`?e.palette.grey.A100:e.palette.grey[700];return{...e.typography.button,minWidth:64,padding:`6px 16px`,border:0,borderRadius:(e.vars||e).shape.borderRadius,...p(e,[`background-color`,`box-shadow`,`border-color`,`color`],{duration:e.transitions.duration.short}),"&:hover":{textDecoration:`none`},[`&.${b.disabled}`]:{color:(e.vars||e).palette.action.disabled},variants:[{props:{variant:`contained`},style:{color:`var(--variant-containedColor)`,backgroundColor:`var(--variant-containedBg)`,boxShadow:(e.vars||e).shadows[2],"&:hover":{boxShadow:(e.vars||e).shadows[4],"@media (hover: none)":{boxShadow:(e.vars||e).shadows[2]}},"&:active":{boxShadow:(e.vars||e).shadows[8]},[`&.${b.focusVisible}`]:{boxShadow:(e.vars||e).shadows[6]},[`&.${b.disabled}`]:{color:(e.vars||e).palette.action.disabled,boxShadow:(e.vars||e).shadows[0],backgroundColor:(e.vars||e).palette.action.disabledBackground}}},{props:{variant:`outlined`},style:{padding:`5px 15px`,border:`1px solid currentColor`,borderColor:`var(--variant-outlinedBorder, currentColor)`,backgroundColor:`var(--variant-outlinedBg)`,color:`var(--variant-outlinedColor)`,[`&.${b.disabled}`]:{border:`1px solid ${(e.vars||e).palette.action.disabledBackground}`}}},{props:{variant:`text`},style:{padding:`6px 8px`,color:`var(--variant-textColor)`,backgroundColor:`var(--variant-textBg)`}},...Object.entries(e.palette).filter(_()).map(([t])=>({props:{color:t},style:{"--variant-textColor":(e.vars||e).palette[t].main,"--variant-outlinedColor":(e.vars||e).palette[t].main,"--variant-outlinedBorder":e.alpha((e.vars||e).palette[t].main,.5),"--variant-containedColor":(e.vars||e).palette[t].contrastText,"--variant-containedBg":(e.vars||e).palette[t].main,"@media (hover: hover)":{"&:hover":{"--variant-containedBg":(e.vars||e).palette[t].dark,"--variant-textBg":e.alpha((e.vars||e).palette[t].main,(e.vars||e).palette.action.hoverOpacity),"--variant-outlinedBorder":(e.vars||e).palette[t].main,"--variant-outlinedBg":e.alpha((e.vars||e).palette[t].main,(e.vars||e).palette.action.hoverOpacity)}}}})),{props:{color:`inherit`},style:{color:`inherit`,borderColor:`currentColor`,"--variant-containedBg":e.vars?e.vars.palette.Button.inheritContainedBg:t,"@media (hover: hover)":{"&:hover":{"--variant-containedBg":e.vars?e.vars.palette.Button.inheritContainedHoverBg:n,"--variant-textBg":e.alpha((e.vars||e).palette.text.primary,(e.vars||e).palette.action.hoverOpacity),"--variant-outlinedBg":e.alpha((e.vars||e).palette.text.primary,(e.vars||e).palette.action.hoverOpacity)}}}},{props:{size:`small`,variant:`text`},style:{padding:`4px 5px`,fontSize:e.typography.pxToRem(13)}},{props:{size:`large`,variant:`text`},style:{padding:`8px 11px`,fontSize:e.typography.pxToRem(15)}},{props:{size:`small`,variant:`outlined`},style:{padding:`3px 9px`,fontSize:e.typography.pxToRem(13)}},{props:{size:`large`,variant:`outlined`},style:{padding:`7px 21px`,fontSize:e.typography.pxToRem(15)}},{props:{size:`small`,variant:`contained`},style:{padding:`4px 10px`,fontSize:e.typography.pxToRem(13)}},{props:{size:`large`,variant:`contained`},style:{padding:`8px 22px`,fontSize:e.typography.pxToRem(15)}},{props:{disableElevation:!0},style:{boxShadow:`none`,"&:hover":{boxShadow:`none`},[`&.${b.focusVisible}`]:{boxShadow:`none`},"&:active":{boxShadow:`none`},[`&.${b.disabled}`]:{boxShadow:`none`}}},{props:{fullWidth:!0},style:{width:`100%`}},{props:{loadingPosition:`center`},style:{...p(e,[`background-color`,`box-shadow`,`border-color`],{duration:e.transitions.duration.short}),[`&.${b.loading}`]:{color:`transparent`}}}]}})),D=c(`span`,{name:`MuiButton`,slot:`StartIcon`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.startIcon,n.loading&&t.startIconLoadingStart]}})(({theme:e})=>({display:`inherit`,alignItems:`center`,marginRight:8,marginLeft:-4,"&::before":{content:`"\\200b"`,width:0,overflow:`hidden`},variants:[{props:{size:`small`},style:{marginLeft:-2}},{props:{loadingPosition:`start`,loading:!0},style:{...p(e,[`opacity`],{duration:e.transitions.duration.short}),opacity:0}},{props:{loadingPosition:`start`,loading:!0,fullWidth:!0},style:{marginRight:-8}},...T]})),O=c(`span`,{name:`MuiButton`,slot:`EndIcon`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.endIcon,n.loading&&t.endIconLoadingEnd]}})(({theme:e})=>({display:`inherit`,marginRight:-4,marginLeft:8,variants:[{props:{size:`small`},style:{marginRight:-2}},{props:{loadingPosition:`end`,loading:!0},style:{...p(e,[`opacity`],{duration:e.transitions.duration.short}),opacity:0}},{props:{loadingPosition:`end`,loading:!0,fullWidth:!0},style:{marginLeft:-8}},...T]})),k=c(`span`,{name:`MuiButton`,slot:`LoadingIndicator`})(({theme:e})=>({display:`none`,position:`absolute`,visibility:`visible`,variants:[{props:{loading:!0},style:{display:`flex`}},{props:{loadingPosition:`start`},style:{left:14}},{props:{loadingPosition:`start`,size:`small`},style:{left:10}},{props:{variant:`text`,loadingPosition:`start`},style:{left:6}},{props:{loadingPosition:`center`},style:{left:`50%`,transform:`translate(-50%)`,color:(e.vars||e).palette.action.disabled}},{props:{loadingPosition:`end`},style:{right:14}},{props:{loadingPosition:`end`,size:`small`},style:{right:10}},{props:{variant:`text`,loadingPosition:`end`},style:{right:6}},{props:{loadingPosition:`start`,fullWidth:!0},style:{position:`relative`,left:-10}},{props:{loadingPosition:`end`,fullWidth:!0},style:{position:`relative`,right:-10}}]})),A=c(`span`,{name:`MuiButton`,slot:`LoadingIconPlaceholder`})({display:`inline-block`,width:`1em`,height:`1em`}),j=v.forwardRef(function(e,t){let n=v.useContext(x),r=v.useContext(S),a=d(n,e),o=l({props:a,name:`MuiButton`}),{children:s,color:c=`primary`,component:u=`button`,className:f,disabled:p=!1,disableElevation:g=!1,disableFocusRipple:_=!1,endIcon:y,focusVisibleClassName:b,fullWidth:T=!1,id:j,loading:M=null,loadingIndicator:N,loadingPosition:P=`center`,size:F=`medium`,startIcon:I,type:L,variant:R=`text`,...z}=o,B=h(j),V=N??(0,C.jsx)(m,{"aria-labelledby":B,color:`inherit`,size:16}),H={...o,color:c,component:u,disabled:p,disableElevation:g,disableFocusRipple:_,fullWidth:T,loading:M,loadingIndicator:V,loadingPosition:P,size:F,type:L,variant:R},U=w(H),W=(I||M&&P===`start`)&&(0,C.jsx)(D,{className:U.startIcon,ownerState:H,children:I||(0,C.jsx)(A,{className:U.loadingIconPlaceholder,ownerState:H})}),G=(y||M&&P===`end`)&&(0,C.jsx)(O,{className:U.endIcon,ownerState:H,children:y||(0,C.jsx)(A,{className:U.loadingIconPlaceholder,ownerState:H})}),K=r||``,q=typeof M==`boolean`?(0,C.jsx)(`span`,{className:U.loadingWrapper,style:{display:`contents`},children:M&&(0,C.jsx)(k,{className:U.loadingIndicator,ownerState:H,children:V})}):null,{root:J,...Y}=U;return(0,C.jsxs)(E,{ownerState:H,className:i(n.className,U.root,f,K),component:u,disabled:p||M,focusRipple:!_,focusVisibleClassName:i(U.focusVisible,b),ref:t,internalNativeButton:!0,type:L,id:M?B:j,...z,classes:Y,children:[W,P!==`end`&&q,s,P===`end`&&q,G]})});export{j as t};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/TerminalView-B_a16moC.js","assets/rolldown-runtime-hePW80VL.js","assets/useTheme-_ESOj7MI.js","assets/index-BW8-BUMx.js","assets/DialogTitle-CL-fzCnT.js","assets/ui-preferences-DiddStu0.js","assets/Alert-DXF8-XqE.js","assets/Typography-DMZL1kLS.js","assets/Button-DZJosXQi.js","assets/bootstrap-CedkNtRG.js","assets/index-Brs_HjIo.css","assets/TerminalView-kHJ-D0s7.css"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{U as t,b as n}from"./useTheme-_ESOj7MI.js";import{a as r,n as i,r as a}from"./ui-preferences-DiddStu0.js";import{c as o,t as s}from"./Alert-DXF8-XqE.js";import{t as c}from"./Typography-DMZL1kLS.js";import{t as l}from"./Button-DZJosXQi.js";import{_ as u,i as d,t as f,v as p,w as m}from"./index-BW8-BUMx.js";import{n as h,t as g}from"./tab-close-HE0XxoJf.js";var _=e(t(),1);function v(e){return Array.isArray(e)?`[${e.map(v).join(`,`)}]`:e&&typeof e==`object`?`{${Object.entries(e).sort(([e],[t])=>e.localeCompare(t)).map(([e,t])=>`${JSON.stringify(e)}:${v(t)}`).join(`,`)}}`:JSON.stringify(e)}async function y(e,t){let n=Date.now(),r=`terminal.command`,i={...e.identity},a={...e.revisions},o=await crypto.subtle.digest(`SHA-256`,new TextEncoder().encode(v({action:r,identity:i,expectedRevisions:a,payload:t})));return{schemaVersion:1,version:`piagent-terminal-v1`,messageType:`command`,action:r,identity:i,expectedRevisions:a,payload:t,commandId:crypto.randomUUID(),idempotencyKey:crypto.randomUUID(),requestedAt:new Date(n).toISOString(),expiresAt:new Date(n+6e4).toISOString(),actionDigest:`sha256:${[...new Uint8Array(o)].map(e=>e.toString(16).padStart(2,`0`)).join(``)}`}}var b=e=>e.phase===`rejected`&&e.reasonCode===`terminal-stale-revision`,x=class{#e;#t=new Set;#n;sessionRef;#r=null;#i=null;#a=Promise.resolve();#o=0;#s=0;#c=0;#l=null;constructor(e,t=f){this.sessionRef=e,this.#n=t,this.#e={state:null,connected:t.ready,error:null,pending:null,busy:!1}}snapshot=()=>this.#e;get disposable(){return!this.#t.size&&!this.#s&&!this.#e.pending&&!this.#e.busy}#u(e){this.#e={...this.#e,...e};for(let e of this.#t)e()}subscribe=e=>(this.#t.add(e),this.#r||(this.#r=this.#n.subscribe(e=>{e.messageType===`state`&&e.identity.sessionRef===this.sessionRef&&this.#u({state:e})}),this.#i=this.#n.connection(e=>{e||this.#o++,this.#u({connected:e}),e&&this.refresh()}),this.#u({connected:this.#n.ready}),this.#n.ready&&this.refresh()),()=>{this.#t.delete(e),this.#t.size||(this.#r?.(),this.#i?.(),this.#r=null,this.#i=null)});refresh=()=>(this.#l||=this.#n.state(this.sessionRef).then(e=>this.#u({state:e}),e=>{this.#u({error:e instanceof Error?e.message:`terminal-unavailable`})}).finally(()=>{this.#l=null}),this.#l);error=e=>this.#u({error:e});acknowledge=()=>{this.#e.busy||(this.#o++,this.#u({pending:null,error:null}))};async#d(e){this.#u({pending:e});let t=await this.#n.execute(e),n=this.#e.state;return n&&n.identity.runtimeInstanceRef===t.identity.runtimeInstanceRef&&n.identity.gatewayInstanceRef===t.identity.gatewayInstanceRef&&this.#u({state:{...n,revisions:t.observedRevisions}}),t.phase!==`settled`&&!b(t)&&this.#o++,t.phase===`uncertain`?(this.#u({error:t.reasonCode??`terminal-effect-uncertain`}),t):(this.#u({pending:null,error:t.phase===`rejected`?t.reasonCode??`terminal-command-rejected`:null}),t)}execute(e){let t=e.kind===`input`?new TextEncoder().encode(e.data).length:0;if(t>16384||this.#c+t>65536||this.#s>=64)return this.error(`terminal-input-limit`),Promise.resolve();if(!this.#e.connected||this.#e.pending&&!this.#e.busy)return this.error(`terminal-command-unconfirmed`),Promise.resolve();let n=this.#o;this.#c+=t,this.#s++;let r=this.#a.then(async()=>{if(n!==this.#o||this.#e.pending||!this.#e.connected)return;let t=this.#e.state;if(t?.available){if(e.kind===`resize`){let n=t.terminals.find(t=>t.terminalRef===e.terminalRef);if(!n||n.cols===e.cols&&n.rows===e.rows)return}this.#u({busy:!0});try{if(b(await this.#d(await y(t,e)))){await this.refresh();let t=this.#e.state;t?.available&&(this.#u({error:null}),await this.#d(await y(t,e)))}}catch(e){this.#o++,this.error(e instanceof Error?e.message:`terminal-effect-uncertain`)}finally{this.#u({busy:!1})}}}).finally(()=>{this.#c-=t,this.#s--});return this.#a=r.catch(()=>{}),r}retry=async()=>{let e=this.#e.pending;if(!(!e||this.#e.busy||!this.#e.connected)){this.#u({busy:!0});try{await this.#d(e)}catch(e){this.#o++,this.error(e instanceof Error?e.message:`terminal-effect-uncertain`)}finally{this.#u({busy:!1})}}}},S=new Map;function C(e){let t=S.get(e);if(!t){if(S.size>=64){let e=[...S].find(([,e])=>e.disposable);if(!e)throw Error(`terminal-client-capacity`);S.delete(e[0])}t=new x(e),S.set(e,t)}return t}var w=n(),T=(0,_.lazy)(()=>d(()=>import(`./TerminalView-B_a16moC.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11])));function E({sessionRef:e,onHide:t}){let{locale:n}=a(),d=(0,_.useMemo)(()=>C(e),[e]),f=(0,_.useSyncExternalStore)(d.subscribe,d.snapshot),v=f.state,[y,b]=(0,_.useState)(null),[x,S]=(0,_.useState)(280),E=(0,_.useRef)(null),D=v?.terminals.find(e=>e.terminalRef===y)?.terminalRef??v?.terminals[0]?.terminalRef??null,O=!f.connected||!v?.available||!!(f.pending&&!f.busy);return(0,w.jsxs)(m,{component:`section`,"aria-label":i(n,`Terminal`,`Terminal`),sx:{borderTop:1,borderColor:`divider`,minWidth:0},children:[(0,w.jsx)(m,{role:`separator`,tabIndex:0,"aria-label":i(n,`Chiều cao terminal`,`Terminal height`),"aria-orientation":`horizontal`,"aria-valuenow":x,"aria-valuemin":160,"aria-valuemax":700,onKeyDown:e=>{[`ArrowUp`,`ArrowDown`].includes(e.key)&&(e.preventDefault(),S(t=>Math.max(160,Math.min(700,t+(e.key===`ArrowUp`?20:-20)))))},onPointerDown:e=>{E.current={y:e.clientY,height:x},e.currentTarget.setPointerCapture(e.pointerId)},onPointerMove:e=>{E.current&&S(Math.max(160,Math.min(700,E.current.height+E.current.y-e.clientY)))},onPointerUp:()=>{E.current=null},onPointerCancel:()=>{E.current=null},sx:{height:8,cursor:`row-resize`,touchAction:`none`,bgcolor:`action.hover`}}),(0,w.jsxs)(m,{sx:{display:`flex`,alignItems:`center`,gap:1},children:[(0,w.jsx)(u,{value:D??!1,onChange:(e,t)=>b(t),variant:`scrollable`,sx:{flex:1,minWidth:0},children:v?.terminals.map(e=>(0,w.jsx)(p,{value:e.terminalRef,"aria-label":`Terminal ${e.number}${e.state===`exited`?i(n,` · đã thoát`,` · exited`):``}`,label:g(`Terminal ${e.number}${e.state===`exited`?i(n,` · đã thoát`,` · exited`):``}`,i(n,`Đóng Terminal ${e.number}`,`Close Terminal ${e.number}`),()=>{f.busy||d.execute({kind:`close`,terminalRef:e.terminalRef})})},e.terminalRef))}),(0,w.jsx)(l,{disabled:O||f.busy||(v?.terminals.length??0)>=4,"aria-label":i(n,`Mở terminal`,`Open terminal`),onClick:()=>void d.execute({kind:`open`,cols:80,rows:24}),children:`+`}),D&&(0,w.jsx)(l,{disabled:O||f.busy,onClick:()=>void d.execute({kind:`close`,terminalRef:D}),children:i(n,`Đóng terminal`,`Close terminal`)}),t&&(0,w.jsx)(o,{size:`small`,"aria-label":i(n,`Ẩn khung terminal`,`Hide terminal panel`),title:i(n,`Ẩn khung terminal (terminal vẫn chạy)`,`Hide terminal panel (terminals keep running)`),onClick:t,children:(0,w.jsx)(h,{fontSize:`small`})})]}),!f.connected&&(0,w.jsx)(s,{severity:`info`,children:i(n,`Đang nối lại terminal…`,`Reconnecting terminal…`)}),v&&!v.available&&(0,w.jsx)(s,{severity:`info`,children:v.reasonCode===`managed-terminal-seatbelt-unavailable`?i(n,`Sandbox hiện tại trên macOS không hỗ trợ terminal công ty.`,`The current macOS sandbox does not support company terminals.`):v.reasonCode===`company-terminal-disconnected`?i(n,`Mất kết nối với terminal công ty. Đang kết nối lại…`,`Company terminal disconnected. Reconnecting…`):(0,w.jsxs)(w.Fragment,{children:[i(n,`Terminal chưa khả dụng trên môi trường này.`,`Terminal is unavailable in this environment.`),` `,v.reasonCode]})}),f.error&&(0,w.jsxs)(s,{severity:`warning`,children:[i(n,`Thao tác terminal chưa hoàn tất.`,`The terminal action did not complete.`),` `,f.error,f.pending?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(c,{variant:`body2`,children:i(n,`Kiểm tra output trước khi tiếp tục. Lệnh có thể đã chạy.`,`Check the output before continuing. The command may have run.`)}),(0,w.jsx)(l,{disabled:f.busy||!f.connected,onClick:()=>void d.retry(),children:i(n,`Kiểm tra lại lệnh`,`Check command again`)}),(0,w.jsx)(l,{disabled:f.busy,onClick:d.acknowledge,children:i(n,`Đã kiểm tra, tiếp tục`,`Checked, continue`)})]}):(0,w.jsx)(l,{onClick:()=>void d.refresh(),children:i(n,`Tải lại`,`Refresh`)})]}),!v&&!f.error&&(0,w.jsx)(r,{size:24}),v?.available&&!v.terminals.length&&(0,w.jsx)(c,{sx:{p:2},children:i(n,`Nhấn + để mở terminal trong project.`,`Press + to open a terminal in the project.`)}),(0,w.jsx)(c,{variant:`caption`,sx:{px:1},children:i(n,`Gõ @terminal hoặc @terminal:2 trong tin nhắn để đính output đã che secret khi gửi.`,`Use @terminal or @terminal:2 in your message to attach redacted output when you send.`)}),(0,w.jsx)(m,{sx:{height:x,minWidth:0},children:(0,w.jsx)(_.Suspense,{fallback:(0,w.jsx)(r,{size:24}),children:v?.terminals.map(e=>(0,w.jsx)(T,{identity:v.identity,terminalRef:e.terminalRef,active:D===e.terminalRef,onReady:()=>void d.refresh(),onError:d.error,onInput:t=>{!O&&e.state===`running`&&d.execute({kind:`input`,terminalRef:e.terminalRef,data:t})},onResize:(t,n)=>{!O&&e.state===`running`&&d.execute({kind:`resize`,terminalRef:e.terminalRef,cols:t,rows:n})}},`${v.identity.runtimeInstanceRef}:${e.terminalRef}`))})})]})}export{E as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{U as t,a as n,b as r,c as i,d as a,f as o,t as s,u as c}from"./useTheme-_ESOj7MI.js";import{A as l,C as u,D as d,E as f,S as p,_ as m,p as h}from"./ui-preferences-DiddStu0.js";var g=e(t(),1);function _(e){return a(`MuiPaper`,e)}c(`MuiPaper`,`root.rounded.outlined.elevation.elevation0.elevation1.elevation2.elevation3.elevation4.elevation5.elevation6.elevation7.elevation8.elevation9.elevation10.elevation11.elevation12.elevation13.elevation14.elevation15.elevation16.elevation17.elevation18.elevation19.elevation20.elevation21.elevation22.elevation23.elevation24`.split(`.`));var v=r(),y=e=>{let{square:t,elevation:n,variant:r,classes:i}=e,a={root:[`root`,r,!t&&`rounded`,r===`elevation`&&`elevation${n}`]};return l(a,_,i)},b=d(`div`,{name:`MuiPaper`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,t[n.variant],!n.square&&t.rounded,n.variant===`elevation`&&t[`elevation${n.elevation}`]]}})(u(({theme:e})=>({backgroundColor:(e.vars||e).palette.background.paper,color:(e.vars||e).palette.text.primary,...m(e,`box-shadow`),variants:[{props:({ownerState:e})=>!e.square,style:{borderRadius:e.shape.borderRadius}},{props:{variant:`outlined`},style:{border:`1px solid ${(e.vars||e).palette.divider}`}},{props:{variant:`elevation`},style:{boxShadow:`var(--Paper-shadow)`,backgroundImage:`var(--Paper-overlay)`}}]}))),x=g.forwardRef(function(e,t){let r=f({props:e,name:`MuiPaper`}),a=s(),{className:c,component:l=`div`,elevation:u=1,square:d=!1,variant:p=`elevation`,...m}=r,h={...r,component:l,elevation:u,square:d,variant:p},g=y(h);return(0,v.jsx)(b,{as:l,ownerState:h,className:o(g.root,c),ref:t,...m,style:{...p===`elevation`&&{"--Paper-shadow":(a.vars||a).shadows[u],...a.vars&&{"--Paper-overlay":a.vars.overlays?.[u]},...!a.vars&&a.palette.mode===`dark`&&{"--Paper-overlay":`linear-gradient(${i(`#fff`,n(u))}, ${i(`#fff`,n(u))})`}},...m.style}})});function S(e){return a(`MuiTypography`,e)}var C=c(`MuiTypography`,[`root`,`h1`,`h2`,`h3`,`h4`,`h5`,`h6`,`subtitle1`,`subtitle2`,`body1`,`body2`,`inherit`,`button`,`caption`,`overline`,`alignLeft`,`alignRight`,`alignCenter`,`alignJustify`,`noWrap`,`gutterBottom`]),w=e=>{let{align:t,gutterBottom:n,noWrap:r,variant:i,classes:a}=e,o={root:[`root`,i,e.align!==`inherit`&&`align${p(t)}`,n&&`gutterBottom`,r&&`noWrap`]};return l(o,S,a)},T=d(`span`,{name:`MuiTypography`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,n.variant&&t[n.variant],n.align!==`inherit`&&t[`align${p(n.align)}`],n.noWrap&&t.noWrap,n.gutterBottom&&t.gutterBottom]}})(u(({theme:e})=>({margin:0,variants:[{props:{variant:`inherit`},style:{font:`inherit`,lineHeight:`inherit`,letterSpacing:`inherit`}},...Object.entries(e.typography).filter(([e,t])=>e!==`inherit`&&t&&typeof t==`object`).map(([e,t])=>({props:{variant:e},style:t})),...Object.entries(e.palette).filter(h()).map(([t])=>({props:{color:t},style:{color:(e.vars||e).palette[t].main}})),...Object.entries(e.palette?.text||{}).filter(([,e])=>typeof e==`string`).map(([t])=>({props:{color:`text${p(t)}`},style:{color:(e.vars||e).palette.text[t]}})),{props:({ownerState:e})=>e.align!==`inherit`,style:{textAlign:`var(--Typography-textAlign)`}},{props:({ownerState:e})=>e.noWrap,style:{overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`}},{props:({ownerState:e})=>e.gutterBottom,style:{marginBottom:`0.35em`}}]}))),E={h1:`h1`,h2:`h2`,h3:`h3`,h4:`h4`,h5:`h5`,h6:`h6`,subtitle1:`h6`,subtitle2:`h6`,body1:`p`,body2:`p`,inherit:`p`},D=g.forwardRef(function(e,t){let n=f({props:e,name:`MuiTypography`}),{color:r,align:i=`inherit`,className:a,component:s,gutterBottom:c=!1,noWrap:l=!1,variant:u=`body1`,variantMapping:d=E,...p}=n,m={...n,align:i,color:r,className:a,component:s,gutterBottom:c,noWrap:l,variant:u,variantMapping:d},h=s||d[u]||E[u]||`span`,g=w(m);return(0,v.jsx)(T,{as:h,ref:t,className:o(g.root,a),...p,ownerState:m,style:{...i!==`inherit`&&{"--Typography-textAlign":i},...p.style}})});export{C as n,x as r,D as t};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/dist-DLfpWwLs.js","assets/rolldown-runtime-hePW80VL.js","assets/dist-B1M7IjfA.js","assets/dist-idN8f9Fc.js","assets/dist-DcEu_WYV.js","assets/dist-BUYtGaUP.js","assets/dist-C82AtDDT.js","assets/dist-D9b8j6pJ.js","assets/dist-nvgpa2Us.js","assets/dist-_JsfplOG.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{U as t,b as n,t as r}from"./useTheme-_ESOj7MI.js";import{n as i,r as a}from"./ui-preferences-DiddStu0.js";import{t as o}from"./Button-DZJosXQi.js";import{i as s,w as c}from"./index-BW8-BUMx.js";import{A as l,C as u,D as d,E as f,M as p,O as m,R as h,S as g,T as _,c as v,w as y,x as b,y as x}from"./dist-B1M7IjfA.js";var S=class extends y{lines;label;comment;constructor(e,t,n){super(),this.lines=e,this.label=t,this.comment=n}toDOM(){let e=document.createElement(`div`);e.className=`cm-agent-deleted`;for(let t of this.lines){let n=document.createElement(`div`),r=document.createElement(`span`);if(r.textContent=`− ${t.text}`,n.append(r),this.comment){let e=document.createElement(`button`);e.type=`button`,e.textContent=this.label,e.setAttribute(`aria-label`,`${this.label} ${t.line}`),e.addEventListener(`click`,()=>this.comment?.(t.line,t.text,`old`)),n.append(e)}e.append(n)}return e}},C=class extends y{ref;label;keep;revertLabel;revert;constructor(e,t,n,r,i){super(),this.ref=e,this.label=t,this.keep=n,this.revertLabel=r,this.revert=i}toDOM(){let e=document.createElement(`div`);e.className=`cm-agent-actions`;let t=document.createElement(`button`);if(t.type=`button`,t.textContent=this.label,t.addEventListener(`click`,()=>this.keep(this.ref)),e.append(t),this.revert){let t=document.createElement(`button`);t.type=`button`,t.textContent=this.revertLabel,t.addEventListener(`click`,()=>this.revert?.(this.ref)),e.append(t)}return e}},w=new class extends u{toDOM(){let e=document.createElement(`span`);return e.textContent=`▎`,e.className=`cm-agent-marker`,e}};function T(e,t,n,r,i,a,o=``,s){let c=e.state.doc.toString(),l=[],u=[],f=t=>e.state.doc.line(Math.max(1,Math.min(e.state.doc.lines,t))).from;for(let e of t){let t=f(e.newStart+ +(e.newLineCount===0));u.push(t),l.push(b.widget({widget:new C(e.hunkRef,n,r,i,a),block:!0,side:-1}).range(t));let c=e.newStart+ +(e.newLineCount===0),d=[],p=()=>{d.length&&(l.push(b.widget({widget:new S(d,o,s),block:!0,side:-1}).range(f(c))),d=[])};for(let t of e.lines){if(t.kind===`deleted`){t.oldLineNumber!==null&&d.push({line:t.oldLineNumber,text:t.text});continue}p(),t.newLineNumber!==null&&(c=t.newLineNumber+1,t.kind===`added`&&l.push(b.line({class:`cm-agent-added`}).range(f(t.newLineNumber))))}p()}let p=h.define({create:()=>b.set(l,!0),update:(e,t)=>t.docChanged?b.none:e,provide:e=>g.decorations.from(e)}),m=e=>t=>{if(!u.length||t.state.doc.toString()!==c)return!1;let n=t.state.selection.main.head,r=e>0?u.find(e=>e>n)??u[0]:[...u].reverse().find(e=>e<n)??u.at(-1);return t.dispatch({selection:{anchor:r},effects:g.scrollIntoView(r,{y:`center`})}),!0};return[p,t.length?_({class:`cm-agent-gutter`,lineMarker:(e,t)=>e.state.field(p).size&&u.includes(t.from)?w:null}):[],d.of([{key:`Alt-ArrowDown`,run:m(1)},{key:`Alt-ArrowUp`,run:m(-1)}]),g.theme({".cm-agent-added":{backgroundColor:`color-mix(in srgb, #2e9d55 15%, transparent)`},".cm-agent-deleted":{margin:`0`,padding:`2px 8px`,whiteSpace:`pre-wrap`,backgroundColor:`color-mix(in srgb, #df4545 15%, transparent)`,fontFamily:`monospace`},".cm-agent-marker":{color:`#2e9d55`},".cm-agent-actions":{padding:`2px 8px`},".cm-agent-actions button":{color:`inherit`,background:`transparent`,border:`1px solid currentColor`,borderRadius:`4px`,cursor:`pointer`}})]}var E=e(t(),1),D=n();async function O(e){let t=e.split(`.`).at(-1)?.toLowerCase();switch(t){case`js`:case`mjs`:case`cjs`:case`jsx`:case`ts`:case`tsx`:return(await s(async()=>{let{javascript:e}=await import(`./dist-DLfpWwLs.js`).then(e=>e.t);return{javascript:e}},__vite__mapDeps([0,1,2,3,4]))).javascript({typescript:t===`ts`||t===`tsx`,jsx:t===`jsx`||t===`tsx`});case`json`:return(await s(async()=>{let{json:e}=await import(`./dist-BUYtGaUP.js`);return{json:e}},__vite__mapDeps([5,2,3]))).json();case`md`:return(await s(async()=>{let{markdown:e}=await import(`./dist-C82AtDDT.js`);return{markdown:e}},__vite__mapDeps([6,2,4,7,3,8,1,0]))).markdown();case`py`:return(await s(async()=>{let{python:e}=await import(`./dist-_JsfplOG.js`);return{python:e}},__vite__mapDeps([9,2,3,4]))).python();case`html`:return(await s(async()=>{let{html:e}=await import(`./dist-D9b8j6pJ.js`);return{html:e}},__vite__mapDeps([7,2,3,8,1,0,4]))).html();case`css`:return(await s(async()=>{let{css:e}=await import(`./dist-nvgpa2Us.js`).then(e=>e.r);return{css:e}},__vite__mapDeps([8,1,2,3]))).css();default:return[]}}var k=[],A=e=>{};function j({content:e,path:t,line:n=1,readOnly:s=!0,onChange:u,onSave:h,hunks:_=k,onKeep:y=A,onRevert:b,onComment:S}){let C=(0,E.useRef)(null),w=(0,E.useRef)(null),j=r(),M=(0,E.useRef)({onChange:u,onSave:h,onComment:S});M.current={onChange:u,onSave:h,onComment:S};let N=(0,E.useRef)(e);N.current=e;let P=(0,E.useRef)(new l),F=(0,E.useRef)(new l),{locale:I}=a();return(0,E.useEffect)(()=>{if(!C.current)return;let e=document.querySelector(`meta[name="csp-nonce"]`)?.content,n=new l,r=!1,i=new g({parent:C.current,state:p.create({doc:N.current,extensions:[F.current.of([]),g.cspNonce.of(e??``),P.current.of([p.readOnly.of(s),g.editable.of(!s)]),d.of([{key:`Mod-Shift-m`,run:e=>{let t=e.state.doc.lineAt(e.state.selection.main.head);return M.current.onComment?.(t.number,t.text),!!M.current.onComment}}]),d.of([`Ctrl-s`,`Meta-s`].map(e=>({key:e,run:()=>(M.current.onSave?.(),!0)}))),g.updateListener.of(e=>{e.docChanged&&M.current.onChange?.(e.state.doc.toString())}),m(),f(),x(v),n.of([]),g.contentAttributes.of({"aria-label":t,tabindex:`0`}),g.theme({"&":{height:`100%`,color:j.palette.text.primary,backgroundColor:j.palette.background.paper},".cm-scroller":{overflow:`auto`,fontFamily:`monospace`},".cm-gutters":{backgroundColor:j.palette.background.default,color:j.palette.text.secondary}},{dark:j.palette.mode===`dark`})]})});return w.current=i,O(t).then(e=>{r||i.dispatch({effects:n.reconfigure(e)})}).catch(()=>{}),()=>{r=!0,w.current=null,i.destroy()}},[t,j]),(0,E.useEffect)(()=>{let t=w.current;t&&t.state.doc.toString()!==e&&t.dispatch({changes:{from:0,to:t.state.doc.length,insert:e}})},[e,t,j]),(0,E.useEffect)(()=>{let e=w.current;e&&e.dispatch({effects:F.current.reconfigure(T(e,_,i(I,`Giữ`,`Keep`),y,i(I,`Hoàn tác`,`Revert`),b,i(I,`Comment dòng đã xóa`,`Comment on removed line`),S))})},[_,y,b,S,e,t,j,I]),(0,E.useEffect)(()=>{w.current?.dispatch({effects:P.current.reconfigure([p.readOnly.of(s),g.editable.of(!s)])})},[s,t,j]),(0,E.useEffect)(()=>{let e=w.current;if(!e)return;let t=e.state.doc.line(Math.max(1,Math.min(e.state.doc.lines,n))).from;e.dispatch({selection:{anchor:t},effects:g.scrollIntoView(t,{y:`center`})})},[n,t,j]),(0,D.jsxs)(c,{sx:{height:`100%`,display:`flex`,flexDirection:`column`},children:[S&&(0,D.jsx)(o,{size:`small`,onClick:()=>{let e=w.current;if(!e)return;let t=e.state.doc.lineAt(e.state.selection.main.head);S(t.number,t.text)},children:i(I,`Comment dòng hiện tại`,`Comment on current line`)}),(0,D.jsx)(c,{ref:C,sx:{flex:1,minHeight:240,overflow:`hidden`}})]})}export{j as default};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/WorkspaceCodeEditor-BCiYM9NA.js","assets/rolldown-runtime-hePW80VL.js","assets/useTheme-_ESOj7MI.js","assets/ui-preferences-DiddStu0.js","assets/Button-DZJosXQi.js","assets/index-BW8-BUMx.js","assets/DialogTitle-CL-fzCnT.js","assets/Alert-DXF8-XqE.js","assets/Typography-DMZL1kLS.js","assets/bootstrap-CedkNtRG.js","assets/index-Brs_HjIo.css","assets/dist-B1M7IjfA.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{U as t,b as n}from"./useTheme-_ESOj7MI.js";import{i as r,k as i,n as a,r as o,t as s}from"./DialogTitle-CL-fzCnT.js";import{a as c,n as l,r as u}from"./ui-preferences-DiddStu0.js";import{c as d,t as f}from"./Alert-DXF8-XqE.js";import{t as p}from"./Typography-DMZL1kLS.js";import{t as m}from"./Button-DZJosXQi.js";import{i as h,n as g,o as _}from"./bootstrap-CedkNtRG.js";import{_ as v,a as y,b,c as x,d as S,f as C,g as w,h as ee,i as T,l as E,m as D,n as O,o as k,p as A,r as te,s as j,u as M,v as N,w as P,x as F}from"./index-BW8-BUMx.js";import{n as ne,t as re}from"./tab-close-HE0XxoJf.js";import{i as I,r as ie,t as L}from"./workspace-api-O7auv_td.js";var R=e(t(),1),z=n();function ae(e,t,n,r=[]){let{locale:i}=u(),[c,d]=(0,R.useState)(()=>M(e)),[f,p]=(0,R.useState)();(0,R.useEffect)(()=>{d(M(e)),p(void 0);let t=t=>{t.detail===e&&d(M(e))};return window.addEventListener(x,t),()=>window.removeEventListener(x,t)},[e]),(0,R.useEffect)(()=>p(void 0),[t]);let m=t=>{d(t),A(e,t)},h={locale:i,comments:c,editing:f?E(f.path,f.side,f.line):null,open:(e,t,n,r)=>p({path:e,line:n,code:r,side:t}),cancel:()=>p(void 0),save:t=>{f&&m(C(M(e),{...f,text:t})),p(void 0)},remove:t=>m(M(e).filter(e=>E(e.path,e.side,e.line)!==t))},g=new Map(n.split(`
|
|
3
|
-
`).map((e,n)=>[E(t??``,`new`,n+1),e.slice(0,400)]));for(let e of r)for(let n of e.lines)n.oldLineNumber!==null&&g.set(E(t??``,`old`,n.oldLineNumber),n.text.slice(0,400));return{open:(e,n,r=`new`)=>{t&&p({path:t,line:e,code:n,side:r})},dialog:(0,z.jsxs)(o,{open:!!f,onClose:()=>p(void 0),fullWidth:!0,children:[(0,z.jsxs)(s,{children:[l(i,`Comment theo dòng`,`Line comment`),` · `,f?.path,`:`,f?.line]}),(0,z.jsx)(a,{children:(0,z.jsx)(j.Provider,{value:h,children:f&&(0,z.jsx)(k,{path:f.path,side:f.side,line:f.line})})})]}),bar:(0,z.jsx)(y,{comments:c,lines:g,linesPath:t,locale:i,onClear:()=>m([]),onSend:()=>{let t=M(e);t.length&&O(e,S(t,i===`en`)),m([])}})}}var B=new Map;function oe(e,t,n,r,i){let{locale:c}=u(),d=`${e}\0${t??``}`,h=`${d}\0${n}\0${r}`,g=(0,R.useRef)(h);g.current=h;let _=(0,R.useRef)(d);_.current=d;let v=(0,R.useRef)(!1),[y,b]=(0,R.useState)(!1),[x,S]=(0,R.useState)(!1),[C,T]=(0,R.useState)(),[E,O]=(0,R.useState)(),[k,A]=(0,R.useState)(!1);(0,R.useEffect)(()=>{S(!1),T(void 0),O(void 0),A(B.has(d))},[d]);let j=async a=>{if(!(v.current||!r||!i||i.file.path!==t||i.file.currentDigest!==`sha256:${n}`)&&(S(!0),O(void 0),T(void 0),A(B.has(d)),!B.has(d))){v.current=!0,b(!0);try{let n=await ee(e,i.file.fileRef,a);if(g.current!==h)return;if(n.state!==`ready`||!n.target||n.target.path!==t||n.target.fileRef!==i.file.fileRef||n.target.fileRevision!==i.file.fileRevision||!n.target.hunkRefs.some(e=>e===a))throw Error(`preview-unavailable`);T({value:n,scope:h})}catch{g.current===h&&O(l(c,`Chưa thể hoàn tác an toàn. Tải lại diff và thử lại.`,`Safe revert is unavailable. Refresh the diff and try again.`))}finally{v.current=!1,b(!1)}}},M=async()=>{if(!(v.current||!r||!B.has(d)&&(!C||C.scope!==h))){v.current=!0,b(!0),O(void 0);try{let t=B.get(d)??await D(C.value);if(g.current!==h)return;if(!B.has(d)&&B.size>=128){O(l(c,`Có quá nhiều lệnh chưa rõ kết quả. Kiểm tra lại các lệnh trước trước khi hoàn tác thêm.`,`Too many commands still need their results checked. Check earlier commands before reverting more.`));return}B.set(d,t),A(!0);let n=await w(t,void 0,e);if(n.phase!==`uncertain`&&B.delete(d),_.current===d&&A(B.has(d)),window.dispatchEvent(new CustomEvent(`piagent-workspace-changed`,{detail:{sessionRef:e}})),g.current!==h)return;A(B.has(d)),n.phase===`settled`?(S(!1),T(void 0)):(n.phase===`rejected`&&T(void 0),O(n.phase===`uncertain`?l(c,`Chưa xác định được kết quả. Kiểm tra tệp; kiểm tra lại sẽ dùng đúng lệnh cũ.`,`The result is uncertain. Inspect the file; checking again uses the same command.`):l(c,`Tệp hoặc quyền đã thay đổi. Hãy đóng và xem preview mới.`,`The file or permission changed. Close this dialog and request a new preview.`)))}catch{g.current===h&&O(l(c,`Chưa nhận được kết quả. Kiểm tra lại dùng cùng lệnh, không tạo lần hoàn tác mới.`,`No result received. Checking again reuses the same command.`))}finally{v.current=!1,b(!1)}}},N=C&&C.scope!==h;return{request:j,dialog:(0,z.jsxs)(o,{open:x,onClose:()=>{y||S(!1)},fullWidth:!0,maxWidth:`md`,children:[(0,z.jsx)(s,{children:l(c,`Hoàn tác thay đổi của agent`,`Revert agent changes`)}),(0,z.jsxs)(a,{children:[(0,z.jsx)(p,{children:t}),(0,z.jsx)(p,{children:l(c,`Các dòng dưới đây sẽ được hoàn tác. Git index được giữ nguyên.`,`The changes below will be reverted. The Git index is preserved.`)}),E&&(0,z.jsx)(f,{severity:`warning`,children:E}),N&&(0,z.jsx)(f,{severity:`warning`,children:l(c,`Nội dung editor đã đổi. Mở lại preview trước khi hoàn tác.`,`Editor contents changed. Open a new preview before reverting.`)}),k&&!C&&(0,z.jsx)(f,{severity:`info`,children:l(c,`Có lệnh chưa xác nhận kết quả cho tệp này.`,`A command for this file still needs its result confirmed.`)}),C?.value.preview?.hunks.map(e=>(0,z.jsxs)(P,{component:`pre`,sx:{whiteSpace:`pre-wrap`,overflowWrap:`anywhere`},children:[e.header,`
|
|
4
|
-
`,e.lines.map(e=>`${e.marker}${e.text}`).join(`
|
|
5
|
-
`)]},e.hunkRef))]}),(0,z.jsxs)(te,{children:[(0,z.jsx)(m,{disabled:y,onClick:()=>S(!1),children:l(c,`Đóng`,`Close`)}),(0,z.jsx)(m,{color:`error`,disabled:y||!r||!k&&(!C||!!N),onClick:()=>void M(),children:k?l(c,`Kiểm tra lại`,`Check again`):l(c,`Xác nhận hoàn tác`,`Confirm revert`)})]})]}),hasPending:k,checkPending:()=>{A(B.has(d)),S(!0)}}}async function se(e,t,n){let r=await fetch(`/api/v1/sessions/${encodeURIComponent(e)}/source-review${t?`/${encodeURIComponent(t)}`:``}`,{credentials:`same-origin`,headers:{Accept:`application/json`},signal:n});if(r.status===401&&_(),!r.ok)throw Error(`source-review-unavailable`);return r.json()}var ce=(e,t)=>se(e,void 0,t),le=(e,t,n)=>se(e,t,n);function ue(e,t,n,r,i){if(!e||!r||!n||e.file.path!==t||e.file.currentDigest!==`sha256:${n}`||e.availability.state!==`current`||e.truncation.truncated||e.redaction.applied)return[];let a=new Set(e.agentHunkRefs??[]);return e.hunks.filter(e=>a.has(e.hunkRef)&&!i.has(`${t}:${n}:${e.hunkRef}`))}var V=new Set,H=new Map,U=new Set,W=`piagent.kept-hunks.`,de=`piagent.kept-hunks`;function fe(e){try{let t=JSON.parse(localStorage.getItem(W+e)??`[]`);return Array.isArray(t)?new Set(t.filter(e=>typeof e==`string`).slice(-4096)):V}catch{return V}}function pe(e,t){try{let n=[...JSON.parse(localStorage.getItem(de)??`[]`).filter(t=>t!==e),e];for(let e of n.splice(0,Math.max(0,n.length-64)))localStorage.removeItem(W+e);localStorage.setItem(W+e,JSON.stringify([...t])),localStorage.setItem(de,JSON.stringify(n))}catch{}}var G=e=>(H.has(e)||H.set(e,fe(e)),H.get(e)??V);function K(e,t,n,r){let i=new Set([...G(e),`${t}:${n}:${r}`].slice(-4096));for(H.delete(e),H.set(e,i);H.size>64;)H.delete(H.keys().next().value);pe(e,i);for(let e of U)e()}function q(e){return(0,R.useSyncExternalStore)(e=>(U.add(e),()=>{U.delete(e)}),()=>G(e))}function me(e,t,n){let[r,i]=(0,R.useState)(),a=q(e),o=JSON.stringify(t.map(e=>e.file.path).sort());(0,R.useEffect)(()=>{let t=JSON.parse(o);if(!t.length){i(void 0);return}let n=new AbortController,r=!1,a=!1,s=async()=>{if(!n.signal.aborted){if(r){a=!0;return}r=!0;try{let r=await ce(e,n.signal),a=new Map;for(let i of t){if(n.signal.aborted)return;let t=r.files.find(e=>e.path===i&&e.pathDisplay===`exact-safe`);if(t)try{a.set(i,await le(e,t.fileRef,n.signal))}catch{}}n.signal.aborted||i({session:e,diffs:a})}catch{n.signal.aborted||i(void 0)}finally{r=!1,a&&!n.signal.aborted&&(a=!1,s())}}};s();let c=window.setInterval(()=>void s(),3e3),l=t=>{t.detail?.sessionRef===e&&s()};return window.addEventListener(`piagent-workspace-saved`,l),window.addEventListener(`piagent-workspace-changed`,l),()=>{n.abort(),clearInterval(c),window.removeEventListener(`piagent-workspace-saved`,l),window.removeEventListener(`piagent-workspace-changed`,l)}},[e,o]);let s=r?.session===e?r.diffs:void 0,c=e=>ue(s?.get(e.file.path),e.file.path,e.file.digest,!e.fresh&&!e.pending&&e.draft===(e.file.content??``),a),l=t.find(e=>e.file.path===n),u=l?c(l):[];return{diff:n?s?.get(n):void 0,hunks:u,counts:new Map(t.map(e=>[e.file.path,c(e).length])),keep:t=>{l?.file.digest&&u.some(e=>e.hunkRef===t)&&K(e,l.file.path,l.file.digest,t)}}}var J=new Map,Y=new Set,X={tabs:[]},Z=e=>e.fresh||e.draft!==(e.file.content??``);window.addEventListener(`beforeunload`,e=>{[...J.values()].some(e=>e.tabs.some(Z))&&(e.preventDefault(),e.returnValue=``)});var Q=e=>J.get(e)??X;function he(e){let t=(0,R.useSyncExternalStore)(e=>(Y.add(e),()=>{Y.delete(e)}),()=>J.get(e)??X),n=t=>{J.set(e,t(J.get(e)??X));for(let e of Y)e()};return{...t,update:n}}function ge(e,t,n){return e.file!==t||e.file.path!==n.path||e.pending||e.fresh||e.file.digest===n.digest&&e.file.protected===n.protected&&e.file.readOnly===n.readOnly?{tab:e}:e.draft===(e.file.content??``)?{tab:{...e,file:n,draft:n.content??``}}:{tab:e,conflict:n}}function _e(e,t,n){let{update:r}=he(e),i=(0,R.useRef)({update:r,conflict:n});i.current={update:r,conflict:n},(0,R.useEffect)(()=>{let n=new AbortController,r=new Map,a=!1,o=!1,s,c=async()=>{if(!(n.signal.aborted||t.current)){if(a){o=!0;return}a=!0;try{for(let a of Q(e).tabs)if(!(a.fresh||a.pending||t.current))try{let o=await L(e,a.file.path,n.signal);if(n.signal.aborted||t.current)return;let s;if(i.current.update(e=>({...e,tabs:e.tabs.map(t=>{if(t.file.path!==a.file.path)return t;let n=ge(t,a.file,o);return n.conflict&&e.active===t.file.path&&(s=n.conflict),n.tab})})),s){let e=`${s.digest}:${s.protected}:${s.readOnly}`;r.get(s.path)!==e&&(r.set(s.path,e),i.current.conflict(s))}}catch{}}finally{a=!1,o&&!n.signal.aborted&&(o=!1,l())}}},l=()=>{s||=setTimeout(()=>{s=void 0,c()},100)},u=t=>{t.detail?.sessionRef===e&&l()};window.addEventListener(`piagent-workspace-changed`,u),window.addEventListener(`piagent-workspace-saved`,u);let d=setInterval(l,5e3);return l(),()=>{n.abort(),clearTimeout(s),clearInterval(d),window.removeEventListener(`piagent-workspace-changed`,u),window.removeEventListener(`piagent-workspace-saved`,u)}},[e,t])}var ve=e=>`/api/v1/sessions/${encodeURIComponent(e)}/workspace/write`;function $(e){return Array.isArray(e)?`[${e.map($).join(`,`)}]`:e&&typeof e==`object`?`{${Object.entries(e).sort(([e],[t])=>e.localeCompare(t)).map(([e,t])=>`${JSON.stringify(e)}:${$(t)}`).join(`,`)}}`:JSON.stringify(e)}async function ye(e,t){let n=await fetch(ve(e),{credentials:`same-origin`,signal:t,headers:{Accept:`application/json`}});if(n.status===401&&_(),!n.ok)throw Error(`workspace-write-unavailable`);return await n.json()}async function be(e,t){let n=Date.now(),r=`workspace.write`,i=e.identity,a=e.revisions,o=await crypto.subtle.digest(`SHA-256`,new TextEncoder().encode($({action:r,identity:i,expectedRevisions:a,payload:t})));return{schemaVersion:1,version:`piagent-webui-workspace-write-v1`,messageType:`command`,action:r,identity:i,expectedRevisions:a,payload:t,commandId:crypto.randomUUID(),idempotencyKey:crypto.randomUUID(),requestedAt:new Date(n).toISOString(),expiresAt:new Date(n+6e4).toISOString(),actionDigest:`sha256:${[...new Uint8Array(o)].map(e=>e.toString(16).padStart(2,`0`)).join(``)}`}}async function xe(e,t){let n=g();if(!n)throw Error(`workspace-write-unavailable`);let r=await h(ve(e),{method:`POST`,credentials:`same-origin`,headers:{Accept:`application/json`,"Content-Type":`application/json`,"X-Piagent-CSRF":n},body:JSON.stringify(t)});if(r.status===401&&_(),!r.ok)throw Error(`workspace-write-unavailable`);let i=await r.json(),a=await crypto.subtle.digest(`SHA-256`,new TextEncoder().encode(t.idempotencyKey)),o=`sha256:${[...new Uint8Array(a)].map(e=>e.toString(16).padStart(2,`0`)).join(``)}`;if(i.schemaVersion!==1||i.version!==t.version||i.messageType!==`receipt`||i.path!==t.payload.path||i.commandId!==t.commandId||i.action!==t.action||i.actionDigest!==t.actionDigest||i.idempotencyKeyDigest!==o||$(i.identity)!==$(t.identity)||![`settled`,`rejected`,`uncertain`].includes(i.phase)||i.phase===`settled`&&(i.resultCode!==`saved`||!/^[a-f0-9]{64}$/.test(i.digest??``)))throw Error(`workspace-write-receipt-invalid`);return i}function Se(e){let{locale:t}=u(),n=he(e),[r,i]=(0,R.useState)(),[a,o]=(0,R.useState)(!1),s=(0,R.useRef)(!1),[c,d]=(0,R.useState)(),[f,p]=(0,R.useState)();_e(e,s,p),(0,R.useEffect)(()=>{let t=new AbortController,n=!1,r=()=>{n||(n=!0,ye(e,t.signal).then(i).catch(()=>{t.signal.aborted||i(void 0)}).finally(()=>{n=!1}))};r();let a=window.setInterval(r,5e3);return()=>{t.abort(),clearInterval(a)}},[e]);let m=(e,t=1,r=!1)=>n.update(n=>({active:e.path,tabs:[...n.tabs.filter(t=>t.file.path!==e.path),{file:e,line:t,fresh:r,draft:e.content??``}]})),h=(e,t)=>n.update(n=>({...n,active:e,tabs:n.tabs.map(n=>n.file.path===e&&t!==void 0?{...n,line:t}:n)})),g=(e,t)=>n.update(n=>({...n,tabs:n.tabs.map(n=>n.file.path===e?{...n,draft:t}:n)})),_=r=>{let i=Q(e).tabs.find(e=>e.file.path===r);i&&(Z(i)||i.pending)&&!window.confirm(l(t,`Bỏ thay đổi chưa lưu và đóng tệp?`,`Discard unsaved changes and close this file?`))||n.update(e=>({tabs:e.tabs.filter(e=>e.file.path!==r),active:e.active===r?e.tabs.find(e=>e.file.path!==r)?.file.path:e.active}))},v=async n=>{try{m(await L(e,n)),p(void 0),d(void 0)}catch{d(l(t,`Chưa tải lại được tệp. Bản sửa của bạn vẫn được giữ.`,`Could not reload the file. Your draft is preserved.`))}},y=async(r,a)=>{let c=Q(e).tabs.find(e=>e.file.path===r);if(!(!c||s.current||!Z(c)&&!c.pending||c.file.protected||c.file.readOnly)&&!(a&&!window.confirm(l(t,`Ghi đè phiên bản trên đĩa bằng bản sửa của bạn?`,`Replace the version on disk with your draft?`)))){s.current=!0,o(!0),d(void 0);try{let o=await ye(e);if(i(o),!o.writable)throw Error(`read-only`);let s=a?.digest??(c.fresh?`absent`:c.file.digest);if(!s)throw Error(`unavailable`);let u=c.pending??await be(o,{path:r,content:c.draft,expectedDigest:s});n.update(e=>({...e,tabs:e.tabs.map(e=>e.file.path===r?{...e,pending:u}:e)}));let f=await xe(e,u);if(f.phase===`uncertain`){d(l(t,`Chưa xác định được kết quả lưu. Tải lại để kiểm tra trước khi lưu tiếp.`,`The save result is uncertain. Reload to check before saving again.`));return}n.update(e=>({...e,tabs:e.tabs.map(e=>e.file.path===r?{...e,pending:void 0}:e)})),f.phase===`settled`&&f.resultCode===`saved`?(n.update(e=>({...e,tabs:e.tabs.map(e=>e.file.path===r?{...e,fresh:!1,file:{...e.file,content:u.payload.content,digest:f.digest,revision:f.observedRevisionsAfter.workspaceRevision}}:e)})),p(void 0),window.dispatchEvent(new CustomEvent(`piagent-workspace-saved`,{detail:{sessionRef:e,path:r}}))):f.resultCode===`stale-content`||f.resultCode===`stale-revision`?p(await L(e,r)):d(l(t,`Chưa lưu được tệp. Kiểm tra quyền ghi và thử lại.`,`Could not save the file. Check write access and try again.`))}catch{d(l(t,`Chưa lưu được tệp. Bản sửa vẫn được giữ; thử lưu lại hoặc tải lại để kiểm tra.`,`Could not confirm the save. Your draft is preserved; retry the save or reload to check.`))}finally{s.current=!1,o(!1)}}},b=async(r,a)=>{let c=Q(e).tabs.find(e=>e.file.path===r);if(s.current||c&&(Z(c)||c.pending))return d(l(t,`Lưu hoặc bỏ thay đổi trước khi đổi tên hay xóa tệp.`,`Save or discard your changes before renaming or deleting the file.`)),!1;s.current=!0,o(!0),d(void 0);try{let o=await ye(e);i(o);let s=c?.file.digest??(await L(e,r)).digest;if(!o.writable||!s)throw Error(`unavailable`);let u=await xe(e,await be(o,a?{path:r,content:``,expectedDigest:s,operation:`rename`,destination:a}:{path:r,content:``,expectedDigest:s,operation:`delete`}));return u.phase===`settled`&&u.resultCode===`saved`?(n.update(e=>({tabs:e.tabs.filter(e=>e.file.path!==r),active:e.active===r?void 0:e.active})),a&&m(await L(e,a)),window.dispatchEvent(new CustomEvent(`piagent-workspace-saved`,{detail:{sessionRef:e,path:r}})),!0):(d(u.phase===`uncertain`?l(t,`Chưa xác định được kết quả. Tải lại danh sách tệp để kiểm tra.`,`The result is uncertain. Reload the file list to check.`):u.resultCode===`stale-content`?l(t,`Tệp đã thay đổi trên đĩa hoặc tên mới đã có. Tải lại rồi thử lại.`,`The file changed on disk or the new name exists. Reload and try again.`):l(t,`Không thực hiện được. Kiểm tra quyền ghi và tên tệp.`,`This could not be done. Check write access and the file name.`)),!1)}catch{return d(l(t,`Chưa xác nhận được thao tác. Tải lại danh sách tệp để kiểm tra.`,`Could not confirm the action. Reload the file list to check.`)),!1}finally{s.current=!1,o(!1)}};return{...n,authority:r,saving:a,message:c,conflict:f,setConflict:p,load:m,select:h,change:g,close:_,reload:v,save:y,move:b}}var Ce=e(i(),1);function we({sessionRef:e,onOpen:t}){let{locale:n}=u(),[i,a]=(0,R.useState)(``),[o,s]=(0,R.useState)(),[d,h]=(0,R.useState)(!1),[g,_]=(0,R.useState)(!1);return(0,R.useEffect)(()=>{let t=new AbortController;if(s(void 0),_(!1),h(!1),!i.trim())return()=>t.abort();h(!0);let n=setTimeout(()=>{I(e,i,t.signal).then(e=>{t.signal.aborted||s(e)}).catch(()=>{t.signal.aborted||_(!0)}).finally(()=>{t.signal.aborted||h(!1)})},250);return()=>{clearTimeout(n),t.abort()}},[i,e]),(0,z.jsxs)(F,{spacing:1,sx:{p:1},children:[(0,z.jsx)(r,{size:`small`,label:l(n,`Tìm nội dung`,`Search contents`),value:i,onChange:e=>a(e.target.value),slotProps:{htmlInput:{maxLength:512}}}),d&&(0,z.jsx)(c,{size:18}),(g||o?.available===!1)&&(0,z.jsx)(f,{severity:`warning`,children:l(n,`Chưa tìm được nội dung trong project này.`,`Content search is unavailable for this project.`)}),o?.available&&o.backend===`fts`&&(0,z.jsx)(p,{variant:`caption`,children:l(n,`Tìm trong các tệp đã lập chỉ mục.`,`Searching indexed files.`)}),o?.matches.map(e=>(0,z.jsxs)(m,{onClick:()=>t(e.path,e.line),sx:{textTransform:`none`,display:`block`,textAlign:`left`,overflowWrap:`anywhere`},children:[(0,z.jsxs)(p,{variant:`caption`,component:`span`,children:[e.path,`:`,e.line,`:`,e.column]}),(0,z.jsx)(p,{variant:`body2`,component:`span`,sx:{display:`block`},children:e.preview})]},`${e.path}:${e.line}:${e.column}`)),o?.truncated&&(0,z.jsx)(p,{variant:`caption`,children:l(n,`Đã giới hạn kết quả. Hãy tìm cụ thể hơn.`,`Results were limited. Refine your search.`)}),o?.available&&!o.matches.length&&!o.truncated&&(0,z.jsx)(p,{variant:`caption`,children:l(n,`Không tìm thấy.`,`No matches.`)})]})}var Te=(0,R.lazy)(()=>T(()=>import(`./WorkspaceCodeEditor-BCiYM9NA.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11])));function Ee({sessionRef:e,target:t,navigationHost:n,sidebarMode:i,onHide:h,fill:g}){let{locale:_}=u(),[y,x]=(0,R.useState)(`files`),[S,C]=(0,R.useState)(!1),[w,ee]=(0,R.useState)(``),[T,E]=(0,R.useState)(!1),[D,O]=(0,R.useState)(),[k,A]=(0,R.useState)(``),j=Se(e),{tabs:M,active:I}=j,[B,se]=(0,R.useState)(``),[ce,le]=(0,R.useState)(),[ue,V]=(0,R.useState)(!1),[H,U]=(0,R.useState)(!1),W=(0,R.useRef)(null),[de,fe]=(0,R.useState)(0);(0,R.useEffect)(()=>{let t=t=>{t.detail?.sessionRef===e&&fe(e=>e+1)};return window.addEventListener(`piagent-workspace-saved`,t),()=>window.removeEventListener(`piagent-workspace-saved`,t)},[e]),(0,R.useEffect)(()=>{let t=new AbortController;return le(void 0),V(!1),ie(e,B,t.signal).then(e=>{t.signal.aborted||le(e)}).catch(()=>{t.signal.aborted||V(!0)}),()=>t.abort()},[e,B,de]),(0,R.useEffect)(()=>()=>W.current?.abort(),[]);let pe=async(t,n=1)=>{if(W.current?.abort(),U(!1),M.find(e=>e.file.path===t)){j.select(t,n);return}W.current?.abort();let r=new AbortController;W.current=r,U(!0),V(!1);try{let i=await L(e,t,r.signal);if(r.signal.aborted)return;if(i.protected){V(!0);return}j.load(i,n)}catch{r.signal.aborted||V(!0)}finally{r.signal.aborted||U(!1)}};(0,R.useEffect)(()=>{t&&pe(t.path,t.line??1)},[t]),(0,R.useEffect)(()=>{i&&i!==`sessions`&&x(i)},[i]);let G=M.find(e=>e.file.path===I),K=G?.file,q=me(e,M,I),J=oe(e,K?.path,K?.digest??null,!!G&&!Z(G),q.diff),Y=ae(e,K?.path,G?.draft??``,q.hunks),X=M.find(e=>e.file.path===j.conflict?.path),Q=(0,z.jsxs)(P,{component:`nav`,"aria-label":l(_,`Tệp dự án`,`Project files`),sx:{width:n?`100%`:180,flexShrink:0,overflow:`auto`,borderRight:1,borderColor:`divider`},children:[!n&&(0,z.jsxs)(v,{value:y,onChange:(e,t)=>x(t),"aria-label":l(_,`Khám phá project`,`Explore project`),children:[(0,z.jsx)(N,{value:`files`,label:l(_,`Tệp`,`Files`)}),(0,z.jsx)(N,{value:`search`,label:l(_,`Tìm kiếm`,`Search`)})]}),y===`search`?(0,z.jsx)(we,{sessionRef:e,onOpen:(e,t)=>void pe(e,t)}):(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(m,{disabled:!j.authority?.writable,onClick:()=>{ee(B?`${B}/`:``),C(!0)},children:l(_,`Tệp mới`,`New file`)}),B&&(0,z.jsx)(m,{onClick:()=>se(B.split(`/`).slice(0,-1).join(`/`)),children:l(_,`Thư mục cha`,`Parent folder`)}),(0,z.jsx)(p,{variant:`caption`,sx:{p:1,overflowWrap:`anywhere`},children:B||`/`}),!ce&&!ue&&(0,z.jsx)(c,{size:18}),ce?.entries.map(e=>(0,z.jsxs)(m,{fullWidth:!0,disabled:e.protected||e.kind===`symlink`||e.kind===`other`,"aria-label":e.protected?`${e.name} (${l(_,`được bảo vệ`,`protected`)})`:e.name,onClick:()=>e.kind===`directory`?se(e.path):void pe(e.path),sx:{justifyContent:`flex-start`,textTransform:`none`,overflowWrap:`anywhere`},children:[e.kind===`directory`?`▸ `:``,e.name,e.protected?` 🔒`:``]},e.path)),ce?.truncated&&(0,z.jsx)(p,{variant:`caption`,children:l(_,`Danh sách đã được giới hạn.`,`Listing limit reached.`)})]})]});return(0,z.jsxs)(z.Fragment,{children:[J.dialog,Y.dialog,(0,z.jsxs)(F,{direction:`row`,sx:{height:g?`100%`:`calc(100vh - 150px)`,minHeight:g?160:320},children:[n?(0,Ce.createPortal)(Q,n):Q,(0,z.jsxs)(P,{sx:{minWidth:0,flex:1,display:`flex`,flexDirection:`column`},children:[ue&&(0,z.jsx)(f,{severity:`warning`,children:l(_,`Chưa đọc được tệp hoặc thư mục này.`,`This file or folder could not be read.`)}),Y.bar,j.message&&(0,z.jsx)(f,{severity:`warning`,children:j.message}),j.authority?.agentRunning&&(0,z.jsx)(f,{severity:`info`,children:l(_,`Agent đang chạy và có thể sửa tệp này.`,`The agent is running and may change this file.`)}),(0,z.jsxs)(F,{direction:`row`,sx:{alignItems:`center`,borderBottom:1,borderColor:`divider`,minHeight:36},children:[(0,z.jsx)(v,{value:I??!1,onChange:(e,t)=>j.select(t),variant:`scrollable`,scrollButtons:`auto`,"aria-label":l(_,`Các tệp đang mở`,`Open files`),sx:{flex:1,minWidth:0,minHeight:36},children:M.map(e=>(0,z.jsx)(N,{value:e.file.path,sx:{minHeight:36,py:0},"aria-label":`${e.file.path}${Z(e)?` ●`:``}${q.counts.get(e.file.path)?` (${q.counts.get(e.file.path)})`:``}`,label:re(`${e.file.path}${Z(e)?` ●`:``}${q.counts.get(e.file.path)?` (${q.counts.get(e.file.path)})`:``}`,l(_,`Đóng ${e.file.path}`,`Close ${e.file.path}`),()=>j.close(e.file.path))},e.file.path))}),h&&(0,z.jsx)(d,{size:`small`,"aria-label":l(_,`Ẩn khung tệp`,`Hide files panel`),title:l(_,`Ẩn khung tệp (tệp đang mở vẫn giữ)`,`Hide files panel (open files are kept)`),onClick:h,children:(0,z.jsx)(ne,{fontSize:`small`})})]}),H&&(0,z.jsx)(c,{size:20}),K&&(0,z.jsxs)(F,{direction:`row`,children:[J.hasPending&&(0,z.jsx)(m,{onClick:J.checkPending,children:l(_,`Kiểm tra hoàn tác`,`Check revert`)}),(0,z.jsx)(m,{size:`small`,disabled:!j.authority?.writable||K.readOnly||!G||!Z(G)&&!G.pending||j.saving,onClick:()=>void j.save(K.path),children:l(_,`Lưu`,`Save`)}),(0,z.jsx)(m,{size:`small`,onClick:()=>j.close(K.path),children:l(_,`Đóng tệp`,`Close file`)}),(0,z.jsx)(m,{size:`small`,disabled:!j.authority?.writable||K.readOnly||!K.digest||j.saving,onClick:()=>{A(K.path),O(K.path)},children:l(_,`Đổi tên`,`Rename`)}),(0,z.jsx)(m,{size:`small`,color:`error`,disabled:!j.authority?.writable||K.readOnly||!K.digest||j.saving,onClick:()=>{window.confirm(l(_,`Xóa ${K.path}? Có thể khôi phục bằng Git nếu tệp đã commit.`,`Delete ${K.path}? Git can restore it if it was committed.`))&&j.move(K.path)},children:l(_,`Xóa`,`Delete`)}),(0,z.jsx)(m,{size:`small`,onClick:()=>{(!G||!Z(G)||window.confirm(l(_,`Bỏ thay đổi chưa lưu và tải lại?`,`Discard unsaved changes and reload?`)))&&j.reload(K.path)},children:l(_,`Tải lại`,`Reload`)})]}),K?.binary||K?.oversized?(0,z.jsx)(f,{severity:`info`,children:l(_,`Tệp nhị phân hoặc quá lớn để hiển thị.`,`This file is binary or too large to display.`)}):K?.content!==null&&K?.content!==void 0?(0,z.jsx)(P,{sx:{flex:1,minHeight:0},children:(0,z.jsx)(R.Suspense,{fallback:(0,z.jsx)(c,{size:20}),children:(0,z.jsx)(Te,{onComment:Y.open,hunks:q.hunks,onKeep:q.keep,onRevert:j.authority?.writable?e=>void J.request(e):void 0,content:G?.draft??K.content,path:K.path,line:G?.line??1,readOnly:!j.authority?.writable||K.readOnly,onChange:e=>j.change(K.path,e),onSave:()=>void j.save(K.path)})})}):(0,z.jsx)(p,{sx:{p:2},children:l(_,`Chọn một tệp để mở.`,`Select a file to open.`)})]})]}),(0,z.jsxs)(o,{open:S,onClose:()=>C(!1),fullWidth:!0,children:[(0,z.jsx)(s,{children:l(_,`Tạo tệp mới`,`Create a new file`)}),(0,z.jsx)(a,{children:(0,z.jsx)(r,{autoFocus:!0,fullWidth:!0,label:l(_,`Đường dẫn trong project`,`Path in project`),value:w,onChange:e=>ee(e.target.value)})}),(0,z.jsxs)(te,{children:[(0,z.jsx)(m,{onClick:()=>C(!1),children:l(_,`Hủy`,`Cancel`)}),(0,z.jsx)(m,{disabled:!b(w)||!j.authority?.writable,onClick:()=>{let e=b(w);!e||!j.authority||(M.some(t=>t.file.path===e.path)?j.select(e.path):j.load({schemaVersion:1,version:`piagent-webui-workspace-file-v1`,generatedAt:new Date().toISOString(),identity:j.authority.identity,path:e.path,language:`text`,protected:!1,readOnly:!1,binary:!1,oversized:!1,content:``,digest:null,revision:null},1,!0),C(!1))},children:l(_,`Tạo`,`Create`)})]})]}),(0,z.jsxs)(o,{open:!!D,onClose:()=>O(void 0),fullWidth:!0,children:[(0,z.jsx)(s,{children:l(_,`Đổi tên tệp`,`Rename file`)}),(0,z.jsx)(a,{children:(0,z.jsx)(r,{autoFocus:!0,fullWidth:!0,label:l(_,`Đường dẫn mới trong project`,`New path in project`),value:k,onChange:e=>A(e.target.value)})}),(0,z.jsxs)(te,{children:[(0,z.jsx)(m,{onClick:()=>O(void 0),children:l(_,`Hủy`,`Cancel`)}),(0,z.jsx)(m,{disabled:!b(k)||b(k)?.path===D||j.saving,onClick:()=>{let e=b(k);!e||!D||j.move(D,e.path).then(e=>{e&&O(void 0)})},children:l(_,`Đổi tên`,`Rename`)})]})]}),(0,z.jsxs)(o,{open:!!j.conflict,onClose:()=>{j.setConflict(void 0),E(!1)},fullWidth:!0,maxWidth:T?`lg`:`sm`,children:[(0,z.jsx)(s,{children:l(_,`Tệp đã thay đổi trên đĩa`,`The file changed on disk`)}),(0,z.jsxs)(a,{children:[(0,z.jsx)(p,{children:j.conflict?.path}),(0,z.jsx)(p,{children:l(_,`Bản sửa của bạn vẫn được giữ. Chọn cách xử lý xung đột.`,`Your draft is preserved. Choose how to resolve the conflict.`)}),T&&j.conflict&&X&&(0,z.jsxs)(F,{direction:`row`,spacing:1,children:[(0,z.jsxs)(P,{sx:{width:`50%`,height:360},children:[(0,z.jsx)(p,{children:l(_,`Trên đĩa`,`On disk`)}),(0,z.jsx)(R.Suspense,{fallback:(0,z.jsx)(c,{size:20}),children:(0,z.jsx)(Te,{path:j.conflict.path,content:j.conflict.content??``})})]}),(0,z.jsxs)(P,{sx:{width:`50%`,height:360},children:[(0,z.jsx)(p,{children:l(_,`Bản sửa của bạn`,`Your draft`)}),(0,z.jsx)(R.Suspense,{fallback:(0,z.jsx)(c,{size:20}),children:(0,z.jsx)(Te,{path:X.file.path,content:X.draft})})]})]})]}),(0,z.jsxs)(te,{children:[(0,z.jsx)(m,{onClick:()=>{j.setConflict(void 0),E(!1)},children:l(_,`Để sau`,`Later`)}),(0,z.jsx)(m,{onClick:()=>{j.conflict&&(j.load(j.conflict),j.setConflict(void 0),E(!1))},children:l(_,`Tải lại`,`Reload`)}),(0,z.jsx)(m,{onClick:()=>E(!0),children:l(_,`Xem khác biệt`,`Compare`)}),(0,z.jsx)(m,{disabled:j.saving||!j.conflict?.digest||j.conflict.protected||j.conflict.readOnly,onClick:()=>{j.conflict&&j.save(j.conflict.path,j.conflict)},children:l(_,`Ghi đè`,`Overwrite`)})]})]})]})}export{Ee as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{U as t,b as n}from"./useTheme-_ESOj7MI.js";import{i as r,m as i,n as a,r as o,t as s}from"./DialogTitle-CL-fzCnT.js";import{n as c,r as l}from"./ui-preferences-DiddStu0.js";import{t as u}from"./Alert-DXF8-XqE.js";import{S as d}from"./index-BW8-BUMx.js";import{n as f}from"./workspace-api-O7auv_td.js";var p=e(t(),1),m=n();function h({sessionRef:e,onClose:t,onOpen:n}){let{locale:h}=l(),[g,_]=(0,p.useState)(``),[v,y]=(0,p.useState)([]),[b,x]=(0,p.useState)(0),[S,C]=(0,p.useState)(!1);return(0,p.useEffect)(()=>{let t=new AbortController;C(!1),y([]),x(0);let n=setTimeout(()=>{f(e,g,t.signal).then(e=>{t.signal.aborted||y(e.suggestions.filter(e=>e.kind===`file`).map(e=>e.value))}).catch(()=>{t.signal.aborted||C(!0)})},120);return()=>{clearTimeout(n),t.abort()}},[e,g]),(0,m.jsxs)(o,{open:!0,onClose:t,fullWidth:!0,maxWidth:`sm`,children:[(0,m.jsx)(s,{children:c(h,`Mở nhanh`,`Quick open`)}),(0,m.jsxs)(a,{children:[(0,m.jsx)(r,{autoFocus:!0,fullWidth:!0,value:g,label:c(h,`Tên tệp`,`File name`),onChange:e=>_(e.target.value),onKeyDown:e=>{e.key===`ArrowDown`&&(e.preventDefault(),x(e=>Math.min(v.length-1,e+1))),e.key===`ArrowUp`&&(e.preventDefault(),x(e=>Math.max(0,e-1))),e.key===`Enter`&&v[b]&&(e.preventDefault(),n(v[b]))}}),S&&(0,m.jsx)(u,{severity:`warning`,children:c(h,`Chưa tìm được tệp.`,`Files could not be searched.`)}),(0,m.jsx)(i,{"aria-label":c(h,`Tệp tìm thấy`,`Matching files`),children:v.map((e,t)=>(0,m.jsx)(d,{selected:t===b,onClick:()=>n(e),children:e},e))})]})]})}export{h as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{U as e,W as t,f as n,h as r,i,p as a,s as o,t as s}from"./dist-B1M7IjfA.js";import{r as c}from"./dist-idN8f9Fc.js";var l=e({String:t.string,Number:t.number,"True False":t.bool,PropertyName:t.propertyName,Null:t.null,", :":t.separator,"[ ]":t.squareBracket,"{ }":t.brace}),u=c.deserialize({version:14,states:"$bOVQPOOOOQO'#Cb'#CbOnQPO'#CeOvQPO'#ClOOQO'#Cr'#CrQOQPOOOOQO'#Cg'#CgO}QPO'#CfO!SQPO'#CtOOQO,59P,59PO![QPO,59PO!aQPO'#CuOOQO,59W,59WO!iQPO,59WOVQPO,59QOqQPO'#CmO!nQPO,59`OOQO1G.k1G.kOVQPO'#CnO!vQPO,59aOOQO1G.r1G.rOOQO1G.l1G.lOOQO,59X,59XOOQO-E6k-E6kOOQO,59Y,59YOOQO-E6l-E6l",stateData:`#O~OeOS~OQSORSOSSOTSOWQO_ROgPO~OVXOgUO~O^[O~PVO[^O~O]_OVhX~OVaO~O]bO^iX~O^dO~O]_OVha~O]bO^ia~O`,goto:"!kjPPPPPPkPPkqwPPPPk{!RPPP!XP!e!hXSOR^bQWQRf_TVQ_Q`WRg`QcZRicQTOQZRQe^RhbRYQR]R",nodeNames:`⚠ JsonText True False Null Number String } { Object Property PropertyName : , ] [ Array`,maxTerm:25,nodeProps:[[`isolate`,-2,6,11,``],[`openedBy`,7,`{`,14,`[`],[`closedBy`,8,`}`,15,`]`]],propSources:[l],skippedNodes:[0],repeatNodeCount:2,tokenData:"(|~RaXY!WYZ!W]^!Wpq!Wrs!]|}$u}!O$z!Q!R%T!R![&c![!]&t!}#O&y#P#Q'O#Y#Z'T#b#c'r#h#i(Z#o#p(r#q#r(w~!]Oe~~!`Wpq!]qr!]rs!xs#O!]#O#P!}#P;'S!];'S;=`$o<%lO!]~!}Og~~#QXrs!]!P!Q!]#O#P!]#U#V!]#Y#Z!]#b#c!]#f#g!]#h#i!]#i#j#m~#pR!Q![#y!c!i#y#T#Z#y~#|R!Q![$V!c!i$V#T#Z$V~$YR!Q![$c!c!i$c#T#Z$c~$fR!Q![!]!c!i!]#T#Z!]~$rP;=`<%l!]~$zO]~~$}Q!Q!R%T!R![&c~%YRT~!O!P%c!g!h%w#X#Y%w~%fP!Q![%i~%nRT~!Q![%i!g!h%w#X#Y%w~%zR{|&T}!O&T!Q![&Z~&WP!Q![&Z~&`PT~!Q![&Z~&hST~!O!P%c!Q![&c!g!h%w#X#Y%w~&yO[~~'OO_~~'TO^~~'WP#T#U'Z~'^P#`#a'a~'dP#g#h'g~'jP#X#Y'm~'rOR~~'uP#i#j'x~'{P#`#a(O~(RP#`#a(U~(ZOS~~(^P#f#g(a~(dP#i#j(g~(jP#X#Y(m~(rOQ~~(wOW~~(|OV~",tokenizers:[0],topRules:{JsonText:[0,1]},tokenPrec:0}),d=s.define({name:`json`,parser:u.configure({props:[r.add({Object:o({except:/^\s*\}/}),Array:o({except:/^\s*\]/})}),a.add({"Object Array":n})]}),languageData:{closeBrackets:{brackets:[`[`,`{`,`"`]},indentOnInput:/^\s*[\}\]]$/}});function f(){return new i(d)}export{f as json};
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import{$ as e,D as t,F as n,H as r,J as i,K as a,M as o,Q as s,S as c,U as l,V as u,W as d,Y as f,Z as p,_ as m,a as h,b as g,g as ee,h as te,i as ne,j as _,l as re,m as ie,n as ae,p as oe,q as v,r as se}from"./dist-B1M7IjfA.js";import{t as ce}from"./dist-DcEu_WYV.js";import{html as le,htmlCompletionSource as ue}from"./dist-D9b8j6pJ.js";var de=class e{static create(t,n,r,i,a){let o=i+(i<<8)+t+(n<<4)|0;return new e(t,n,r,o,a,[],[])}constructor(e,t,n,r,i,a,o){this.type=e,this.value=t,this.from=n,this.hash=r,this.end=i,this.children=a,this.positions=o,this.blankFirstLine=!1,this.hashProp=[[v.contextHash,r]]}addChild(e,t){e.prop(v.contextHash)!=this.hash&&(e=new s(e.type,e.children,e.positions,e.length,this.hashProp)),this.children.push(e),this.positions.push(t)}toTree(e,t=this.end){let n=this.children.length-1;return n>=0&&(t=Math.max(t,this.positions[n]+this.children[n].length+this.from)),new s(e.types[this.type],this.children,this.positions,t-this.from).balance({makeTree:(e,t,n)=>new s(f.none,e,t,n,this.hashProp)})}},y;(function(e){e[e.Document=1]=`Document`,e[e.CodeBlock=2]=`CodeBlock`,e[e.FencedCode=3]=`FencedCode`,e[e.Blockquote=4]=`Blockquote`,e[e.HorizontalRule=5]=`HorizontalRule`,e[e.BulletList=6]=`BulletList`,e[e.OrderedList=7]=`OrderedList`,e[e.ListItem=8]=`ListItem`,e[e.ATXHeading1=9]=`ATXHeading1`,e[e.ATXHeading2=10]=`ATXHeading2`,e[e.ATXHeading3=11]=`ATXHeading3`,e[e.ATXHeading4=12]=`ATXHeading4`,e[e.ATXHeading5=13]=`ATXHeading5`,e[e.ATXHeading6=14]=`ATXHeading6`,e[e.SetextHeading1=15]=`SetextHeading1`,e[e.SetextHeading2=16]=`SetextHeading2`,e[e.HTMLBlock=17]=`HTMLBlock`,e[e.LinkReference=18]=`LinkReference`,e[e.Paragraph=19]=`Paragraph`,e[e.CommentBlock=20]=`CommentBlock`,e[e.ProcessingInstructionBlock=21]=`ProcessingInstructionBlock`,e[e.Escape=22]=`Escape`,e[e.Entity=23]=`Entity`,e[e.HardBreak=24]=`HardBreak`,e[e.Emphasis=25]=`Emphasis`,e[e.StrongEmphasis=26]=`StrongEmphasis`,e[e.Link=27]=`Link`,e[e.Image=28]=`Image`,e[e.InlineCode=29]=`InlineCode`,e[e.HTMLTag=30]=`HTMLTag`,e[e.Comment=31]=`Comment`,e[e.ProcessingInstruction=32]=`ProcessingInstruction`,e[e.Autolink=33]=`Autolink`,e[e.HeaderMark=34]=`HeaderMark`,e[e.QuoteMark=35]=`QuoteMark`,e[e.ListMark=36]=`ListMark`,e[e.LinkMark=37]=`LinkMark`,e[e.EmphasisMark=38]=`EmphasisMark`,e[e.CodeMark=39]=`CodeMark`,e[e.CodeText=40]=`CodeText`,e[e.CodeInfo=41]=`CodeInfo`,e[e.LinkTitle=42]=`LinkTitle`,e[e.LinkLabel=43]=`LinkLabel`,e[e.URL=44]=`URL`})(y||={});var fe=class{constructor(e,t){this.start=e,this.content=t,this.marks=[],this.parsers=[]}},pe=class{constructor(){this.text=``,this.baseIndent=0,this.basePos=0,this.depth=0,this.markers=[],this.pos=0,this.indent=0,this.next=-1}forward(){this.basePos>this.pos&&this.forwardInner()}forwardInner(){let e=this.skipSpace(this.basePos);this.indent=this.countIndent(e,this.pos,this.indent),this.pos=e,this.next=e==this.text.length?-1:this.text.charCodeAt(e)}skipSpace(e){return S(this.text,e)}reset(e){for(this.text=e,this.baseIndent=this.basePos=this.pos=this.indent=0,this.forwardInner(),this.depth=1;this.markers.length;)this.markers.pop()}moveBase(e){this.basePos=e,this.baseIndent=this.countIndent(e,this.pos,this.indent)}moveBaseColumn(e){this.baseIndent=e,this.basePos=this.findColumn(e)}addMarker(e){this.markers.push(e)}countIndent(e,t=0,n=0){for(let r=t;r<e;r++)n+=this.text.charCodeAt(r)==9?4-n%4:1;return n}findColumn(e){let t=0;for(let n=0;t<this.text.length&&n<e;t++)n+=this.text.charCodeAt(t)==9?4-n%4:1;return t}scrub(){if(!this.baseIndent)return this.text;let e=``;for(let t=0;t<this.basePos;t++)e+=` `;return e+this.text.slice(this.basePos)}};function me(e,t,n){if(n.pos==n.text.length||e!=t.block&&n.indent>=t.stack[n.depth+1].value+n.baseIndent)return!0;if(n.indent>=n.baseIndent+4)return!1;let r=(e.type==y.OrderedList?T:w)(n,t,!1);return r>0&&(e.type!=y.BulletList||C(n,t,!1)<0)&&n.text.charCodeAt(n.pos+r-1)==e.value}var b={[y.Blockquote](e,t,n){return n.next==62&&(n.markers.push(I(y.QuoteMark,t.lineStart+n.pos,t.lineStart+n.pos+1)),n.moveBase(n.pos+(x(n.text.charCodeAt(n.pos+1))?2:1)),e.end=t.lineStart+n.text.length,!0)},[y.ListItem](e,t,n){return!(n.next<0?e.blankFirstLine&&e.children.length==1:n.indent<n.baseIndent+e.value)&&(n.moveBaseColumn(n.baseIndent+e.value),!0)},[y.OrderedList]:me,[y.BulletList]:me,[y.Document](){return!0}};function x(e){return e==32||e==9||e==10||e==13}function S(e,t=0){for(;t<e.length&&x(e.charCodeAt(t));)t++;return t}function he(e,t,n){for(;t>n&&x(e.charCodeAt(t-1));)t--;return t}function ge(e){if(e.next!=96&&e.next!=126)return-1;let t=e.pos+1;for(;t<e.text.length&&e.text.charCodeAt(t)==e.next;)t++;if(t<e.pos+3)return-1;if(e.next==96){for(let n=t;n<e.text.length;n++)if(e.text.charCodeAt(n)==96)return-1}return t}function _e(e){return e.next==62?e.text.charCodeAt(e.pos+1)==32?2:1:-1}function C(e,t,n){if(e.next!=42&&e.next!=45&&e.next!=95)return-1;let r=1;for(let t=e.pos+1;t<e.text.length;t++){let n=e.text.charCodeAt(t);if(n==e.next)r++;else if(!x(n))return-1}return n&&e.next==45&&be(e)>-1&&e.depth==t.stack.length&&t.parser.leafBlockParsers.indexOf(De.SetextHeading)>-1||r<3?-1:1}function ve(e,t){for(let n=e.stack.length-1;n>=0;n--)if(e.stack[n].type==t)return!0;return!1}function w(e,t,n){return(e.next==45||e.next==43||e.next==42)&&(e.pos==e.text.length-1||x(e.text.charCodeAt(e.pos+1)))&&(!n||ve(t,y.BulletList)||e.skipSpace(e.pos+2)<e.text.length)?1:-1}function T(e,t,n){let r=e.pos,i=e.next;for(;i>=48&&i<=57;){if(r++,r==e.text.length)return-1;i=e.text.charCodeAt(r)}return r==e.pos||r>e.pos+9||i!=46&&i!=41||r<e.text.length-1&&!x(e.text.charCodeAt(r+1))||n&&!ve(t,y.OrderedList)&&(e.skipSpace(r+1)==e.text.length||r>e.pos+1||e.next!=49)?-1:r+1-e.pos}function ye(e){if(e.next!=35)return-1;let t=e.pos+1;for(;t<e.text.length&&e.text.charCodeAt(t)==35;)t++;if(t<e.text.length&&!x(e.text.charCodeAt(t)))return-1;let n=t-e.pos;return n>6?-1:n}function be(e){if(e.next!=45&&e.next!=61||e.indent>=e.baseIndent+4)return-1;let t=e.pos+1;for(;t<e.text.length&&e.text.charCodeAt(t)==e.next;)t++;let n=t;for(;t<e.text.length&&x(e.text.charCodeAt(t));)t++;return t==e.text.length?n:-1}var E=/^[ \t]*$/,xe=/-->/,Se=/\?>/,D=[[/^<(?:script|pre|style|textarea)(?:\s|>|$)/i,/<\/(?:script|pre|style|textarea)>/i],[/^\s*<!--/,xe],[/^\s*<\?/,Se],[/^\s*<![A-Z]/,/>/],[/^\s*<!\[CDATA\[/,/\]\]>/],[/^\s*<\/?(?:address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h1|h2|h3|h4|h5|h6|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul)(?:\s|\/?>|$)/i,E],[/^\s*(?:<\/[a-z][\w-]*\s*>|<[a-z][\w-]*(\s+[a-z:_][\w-.]*(?:\s*=\s*(?:[^\s"'=<>`]+|'[^']*'|"[^"]*"))?)*\s*>)\s*$/i,E]];function Ce(e,t,n){if(e.next!=60)return-1;let r=e.text.slice(e.pos);for(let e=0,t=D.length-+!!n;e<t;e++)if(D[e][0].test(r))return e;return-1}function we(e,t){let n=e.countIndent(t,e.pos,e.indent),r=e.skipSpace(t),i=e.countIndent(r,t,n);return i>=n+5||r==e.text.length?n+1:i}function O(e,t,n){let r=e.length-1;r>=0&&e[r].to==t&&e[r].type==y.CodeText?e[r].to=n:e.push(I(y.CodeText,t,n))}var k={LinkReference:void 0,IndentedCode(e,t){let n=t.baseIndent+4;if(t.indent<n)return!1;let r=t.findColumn(n),i=e.lineStart+r,a=e.lineStart+t.text.length,o=[],s=[];for(O(o,i,a);e.nextLine()&&t.depth>=e.stack.length;)if(t.pos==t.text.length){O(s,e.lineStart-1,e.lineStart);for(let e of t.markers)s.push(e)}else if(t.indent<n)break;else{if(s.length){for(let e of s)e.type==y.CodeText?O(o,e.from,e.to):o.push(e);s=[]}O(o,e.lineStart-1,e.lineStart);for(let e of t.markers)o.push(e);a=e.lineStart+t.text.length;let n=e.lineStart+t.findColumn(t.baseIndent+4);n<a&&O(o,n,a)}return s.length&&(s=s.filter(e=>e.type!=y.CodeText),s.length&&(t.markers=s.concat(t.markers))),e.addNode(e.buffer.writeElements(o,-i).finish(y.CodeBlock,a-i),i),!0},FencedCode(e,t){let n=ge(t);if(n<0)return!1;let r=e.lineStart+t.pos,i=t.next,a=n-t.pos,o=t.skipSpace(n),s=he(t.text,t.text.length,o),c=[I(y.CodeMark,r,r+a)];o<s&&c.push(I(y.CodeInfo,e.lineStart+o,e.lineStart+s));for(let n=!0,r=!0,o=!1;e.nextLine()&&t.depth>=e.stack.length;n=!1){let s=t.pos;if(t.indent-t.baseIndent<4)for(;s<t.text.length&&t.text.charCodeAt(s)==i;)s++;if(s-t.pos>=a&&t.skipSpace(s)==t.text.length){for(let e of t.markers)c.push(e);r&&o&&O(c,e.lineStart-1,e.lineStart),c.push(I(y.CodeMark,e.lineStart+t.pos,e.lineStart+s)),e.nextLine();break}{o=!0,n||(O(c,e.lineStart-1,e.lineStart),r=!1);for(let e of t.markers)c.push(e);let i=e.lineStart+t.basePos,a=e.lineStart+t.text.length;i<a&&(O(c,i,a),r=!1)}}return e.addNode(e.buffer.writeElements(c,-r).finish(y.FencedCode,e.prevLineEnd()-r),r),!0},Blockquote(e,t){let n=_e(t);return n<0?!1:(e.startContext(y.Blockquote,t.pos),e.addNode(y.QuoteMark,e.lineStart+t.pos,e.lineStart+t.pos+1),t.moveBase(t.pos+n),null)},HorizontalRule(e,t){if(C(t,e,!1)<0)return!1;let n=e.lineStart+t.pos;return e.nextLine(),e.addNode(y.HorizontalRule,n),!0},BulletList(e,t){let n=w(t,e,!1);if(n<0)return!1;e.block.type!=y.BulletList&&e.startContext(y.BulletList,t.basePos,t.next);let r=we(t,t.pos+1);return e.startContext(y.ListItem,t.basePos,r-t.baseIndent),e.addNode(y.ListMark,e.lineStart+t.pos,e.lineStart+t.pos+n),t.moveBaseColumn(r),e.block.blankFirstLine=r>=t.text.length,null},OrderedList(e,t){let n=T(t,e,!1);if(n<0)return!1;e.block.type!=y.OrderedList&&e.startContext(y.OrderedList,t.basePos,t.text.charCodeAt(t.pos+n-1));let r=we(t,t.pos+n);return e.startContext(y.ListItem,t.basePos,r-t.baseIndent),e.addNode(y.ListMark,e.lineStart+t.pos,e.lineStart+t.pos+n),t.moveBaseColumn(r),e.block.blankFirstLine=r==t.text.length,null},ATXHeading(e,t){let n=ye(t);if(n<0)return!1;let r=t.pos,i=e.lineStart+r,a=he(t.text,t.text.length,r),o=a;for(;o>r&&t.text.charCodeAt(o-1)==t.next;)o--;(o==a||o==r||!x(t.text.charCodeAt(o-1)))&&(o=t.text.length);let s=e.buffer.write(y.HeaderMark,0,n).writeElements(e.parser.parseInline(t.text.slice(r+n+1,o),i+n+1),-i);o<t.text.length&&s.write(y.HeaderMark,o-r,a-r);let c=s.finish(y.ATXHeading1-1+n,t.text.length-r);return e.nextLine(),e.addNode(c,i),!0},HTMLBlock(e,t){let n=Ce(t,e,!1);if(n<0)return!1;let r=e.lineStart+t.pos,i=D[n][1],a=[],o=i!=E;for(;!i.test(t.text)&&e.nextLine();){if(t.depth<e.stack.length){o=!1;break}for(let e of t.markers)a.push(e)}o&&e.nextLine();let s=i==xe?y.CommentBlock:i==Se?y.ProcessingInstructionBlock:y.HTMLBlock,c=e.prevLineEnd();return e.addNode(e.buffer.writeElements(a,-r).finish(s,c-r),r),!0},SetextHeading:void 0},Te=class{constructor(e){this.stage=0,this.elts=[],this.pos=0,this.start=e.start,this.advance(e.content)}nextLine(e,t,n){if(this.stage==-1)return!1;let r=n.content+`
|
|
2
|
-
`+t.scrub(),i=this.advance(r);return i>-1&&i<r.length&&this.complete(e,n,i)}finish(e,t){return(this.stage==2||this.stage==3)&&S(t.content,this.pos)==t.content.length&&this.complete(e,t,t.content.length)}complete(e,t,n){return e.addLeafElement(t,I(y.LinkReference,this.start,this.start+n,this.elts)),!0}nextStage(e){return e?(this.pos=e.to-this.start,this.elts.push(e),this.stage++,!0):(e===!1&&(this.stage=-1),!1)}advance(e){for(;;)if(this.stage==-1)return-1;else if(this.stage==0){if(!this.nextStage(Be(e,this.pos,this.start,!0)))return-1;if(e.charCodeAt(this.pos)!=58)return this.stage=-1;this.elts.push(I(y.LinkMark,this.pos+this.start,this.pos+this.start+1)),this.pos++}else if(this.stage==1){if(!this.nextStage(Re(e,S(e,this.pos),this.start)))return-1}else if(this.stage==2){let t=S(e,this.pos),n=0;if(t>this.pos){let r=ze(e,t,this.start);if(r){let t=A(e,r.to-this.start);t>0&&(this.nextStage(r),n=t)}}return n||=A(e,this.pos),n>0&&n<e.length?n:-1}else return A(e,this.pos)}};function A(e,t){for(;t<e.length;t++){let n=e.charCodeAt(t);if(n==10)break;if(!x(n))return-1}return t}var Ee=class{nextLine(e,t,n){let r=t.depth<e.stack.length?-1:be(t),i=t.next;if(r<0)return!1;let a=I(y.HeaderMark,e.lineStart+t.pos,e.lineStart+r);return e.nextLine(),e.addLeafElement(n,I(i==61?y.SetextHeading1:y.SetextHeading2,n.start,e.prevLineEnd(),[...e.parser.parseInline(n.content,n.start),a])),!0}finish(){return!1}},De={LinkReference(e,t){return t.content.charCodeAt(0)==91?new Te(t):null},SetextHeading(){return new Ee}},Oe=[(e,t)=>ye(t)>=0,(e,t)=>ge(t)>=0,(e,t)=>_e(t)>=0,(e,t)=>w(t,e,!0)>=0,(e,t)=>T(t,e,!0)>=0,(e,t)=>C(t,e,!0)>=0,(e,t)=>Ce(t,e,!0)>=0],ke={text:``,end:0},Ae=class{constructor(e,t,n,r){this.parser=e,this.input=t,this.ranges=r,this.line=new pe,this.atEnd=!1,this.reusePlaceholders=new Map,this.stoppedAt=null,this.rangeI=0,this.to=r[r.length-1].to,this.lineStart=this.absoluteLineStart=this.absoluteLineEnd=r[0].from,this.block=de.create(y.Document,0,this.lineStart,0,0),this.stack=[this.block],this.fragments=n.length?new He(n,t):null,this.readLine()}get parsedPos(){return this.absoluteLineStart}advance(){if(this.stoppedAt!=null&&this.absoluteLineStart>this.stoppedAt)return this.finish();let{line:e}=this;for(;;){for(let t=0;;){let n=e.depth<this.stack.length?this.stack[this.stack.length-1]:null;for(;t<e.markers.length&&(!n||e.markers[t].from<n.end);){let n=e.markers[t++];this.addNode(n.type,n.from,n.to)}if(!n)break;this.finishContext()}if(e.pos<e.text.length)break;if(!this.nextLine())return this.finish()}if(this.fragments&&this.reuseFragment(e.basePos))return null;start:for(;;){for(let t of this.parser.blockParsers)if(t){let n=t(this,e);if(n!=0){if(n==1)return null;e.forward();continue start}}break}if(e.pos==e.text.length)return this.nextLine()?null:this.finish();let t=new fe(this.lineStart+e.pos,e.text.slice(e.pos));for(let e of this.parser.leafBlockParsers)if(e){let n=e(this,t);n&&t.parsers.push(n)}lines:for(;this.nextLine()&&e.pos!=e.text.length;){if(e.indent<e.baseIndent+4){for(let n of this.parser.endLeafBlock)if(n(this,e,t))break lines}for(let n of t.parsers)if(n.nextLine(this,e,t))return null;t.content+=`
|
|
3
|
-
`+e.scrub();for(let n of e.markers)t.marks.push(n)}return this.finishLeaf(t),null}stopAt(e){if(this.stoppedAt!=null&&this.stoppedAt<e)throw RangeError(`Can't move stoppedAt forward`);this.stoppedAt=e}reuseFragment(e){if(!this.fragments.moveTo(this.absoluteLineStart+e,this.absoluteLineStart)||!this.fragments.matches(this.block.hash))return!1;let t=this.fragments.takeNodes(this);return t?(this.absoluteLineStart+=t,this.lineStart=We(this.absoluteLineStart,this.ranges),this.moveRangeI(),this.absoluteLineStart<this.to?(this.lineStart++,this.absoluteLineStart++,this.readLine()):(this.atEnd=!0,this.readLine()),!0):!1}get depth(){return this.stack.length}parentType(e=this.depth-1){return this.parser.nodeSet.types[this.stack[e].type]}nextLine(){return this.lineStart+=this.line.text.length,this.absoluteLineEnd>=this.to?(this.absoluteLineStart=this.absoluteLineEnd,this.atEnd=!0,this.readLine(),!1):(this.lineStart++,this.absoluteLineStart=this.absoluteLineEnd+1,this.moveRangeI(),this.readLine(),!0)}peekLine(){return this.scanLine(this.absoluteLineEnd+1).text}moveRangeI(){for(;this.rangeI<this.ranges.length-1&&this.absoluteLineStart>=this.ranges[this.rangeI].to;)this.rangeI++,this.absoluteLineStart=Math.max(this.absoluteLineStart,this.ranges[this.rangeI].from)}scanLine(e){let t=ke;if(t.end=e,e>=this.to)t.text=``;else if(t.text=this.lineChunkAt(e),t.end+=t.text.length,this.ranges.length>1){let e=this.absoluteLineStart,n=this.rangeI;for(;this.ranges[n].to<t.end;){n++;let r=this.ranges[n].from,i=this.lineChunkAt(r);t.end=r+i.length,t.text=t.text.slice(0,this.ranges[n-1].to-e)+i,e=t.end-t.text.length}}return t}readLine(){let{line:e}=this,{text:t,end:n}=this.scanLine(this.absoluteLineStart);for(this.absoluteLineEnd=n,e.reset(t);e.depth<this.stack.length;e.depth++){let t=this.stack[e.depth],n=this.parser.skipContextMarkup[t.type];if(!n)throw Error(`Unhandled block context `+y[t.type]);let r=this.line.markers.length;if(!n(t,this,e)){this.line.markers.length>r&&(t.end=this.line.markers[this.line.markers.length-1].to),e.forward();break}e.forward()}}lineChunkAt(e){let t=this.input.chunk(e),n;if(this.input.lineChunks)n=t==`
|
|
4
|
-
`?``:t;else{let e=t.indexOf(`
|
|
5
|
-
`);n=e<0?t:t.slice(0,e)}return e+n.length>this.to?n.slice(0,this.to-e):n}prevLineEnd(){return this.atEnd?this.lineStart:this.lineStart-1}startContext(e,t,n=0){this.block=de.create(e,n,this.lineStart+t,this.block.hash,this.lineStart+this.line.text.length),this.stack.push(this.block)}startComposite(e,t,n=0){this.startContext(this.parser.getNodeType(e),t,n)}addNode(e,t,n){typeof e==`number`&&(e=new s(this.parser.nodeSet.types[e],P,P,(n??this.prevLineEnd())-t)),this.block.addChild(e,t-this.block.from)}addElement(e){this.block.addChild(e.toTree(this.parser.nodeSet),e.from-this.block.from)}addLeafElement(e,t){this.addNode(this.buffer.writeElements(G(t.children,e.marks),-t.from).finish(t.type,t.to-t.from),t.from)}finishContext(){let e=this.stack.pop(),t=this.stack[this.stack.length-1];t.addChild(e.toTree(this.parser.nodeSet),e.from-t.from),this.block=t}finish(){for(;this.stack.length>1;)this.finishContext();return this.addGaps(this.block.toTree(this.parser.nodeSet,this.lineStart))}addGaps(e){return this.ranges.length>1?je(this.ranges,0,e.topNode,this.ranges[0].from,this.reusePlaceholders):e}finishLeaf(e){for(let t of e.parsers)if(t.finish(this,e))return;let t=G(this.parser.parseInline(e.content,e.start),e.marks);this.addNode(this.buffer.writeElements(t,-e.start).finish(y.Paragraph,e.content.length),e.start)}elt(e,t,n,r){return typeof e==`string`?I(this.parser.getNodeType(e),t,n,r):new Fe(e,t)}get buffer(){return new Pe(this.parser.nodeSet)}};function je(e,t,n,r,i){let a=e[t].to,o=[],c=[],l=n.from+r;function u(n,i){for(;i?n>=a:n>a;){let i=e[t+1].from-a;r+=i,n+=i,t++,a=e[t].to}}for(let s=n.firstChild;s;s=s.nextSibling){u(s.from+r,!0);let n=s.from+r,d,f=i.get(s.tree);f?d=f:s.to+r>a?(d=je(e,t,s,r,i),u(s.to+r,!1)):d=s.toTree(),o.push(d),c.push(n-l)}return u(n.to+r,!1),new s(n.type,o,c,n.to+r-l,n.tree?n.tree.propValues:void 0)}var Me=class e extends p{constructor(e,t,n,r,i,a,o,s,c){super(),this.nodeSet=e,this.blockParsers=t,this.leafBlockParsers=n,this.blockNames=r,this.endLeafBlock=i,this.skipContextMarkup=a,this.inlineParsers=o,this.inlineNames=s,this.wrappers=c,this.nodeTypes=Object.create(null);for(let t of e.types)this.nodeTypes[t.name]=t.id}createParse(e,t,n){let r=new Ae(this,e,t,n);for(let i of this.wrappers)r=i(r,e,t,n);return r}configure(t){let n=M(t);if(!n)return this;let{nodeSet:a,skipContextMarkup:o}=this,s=this.blockParsers.slice(),c=this.leafBlockParsers.slice(),u=this.blockNames.slice(),d=this.inlineParsers.slice(),p=this.inlineNames.slice(),m=this.endLeafBlock.slice(),h=this.wrappers;if(j(n.defineNodes)){o=Object.assign({},o);let e=a.types.slice(),t;for(let i of n.defineNodes){let{name:n,block:a,composite:s,style:c}=typeof i==`string`?{name:i}:i;if(e.some(e=>e.name==n))continue;s&&(o[e.length]=(e,t,n)=>s(t,n,e.value));let l=e.length,u=s?[`Block`,`BlockContext`]:a?l>=y.ATXHeading1&&l<=y.SetextHeading2?[`Block`,`LeafBlock`,`Heading`]:[`Block`,`LeafBlock`]:void 0;e.push(f.define({id:l,name:n,props:u&&[[v.group,u]]})),c&&(t||={},Array.isArray(c)||c instanceof r?t[n]=c:Object.assign(t,c))}a=new i(e),t&&(a=a.extend(l(t)))}if(j(n.props)&&(a=a.extend(...n.props)),j(n.remove))for(let e of n.remove){let t=this.blockNames.indexOf(e),n=this.inlineNames.indexOf(e);t>-1&&(s[t]=c[t]=void 0),n>-1&&(d[n]=void 0)}if(j(n.parseBlock))for(let e of n.parseBlock){let t=u.indexOf(e.name);if(t>-1)s[t]=e.parse,c[t]=e.leaf;else{let t=e.before?N(u,e.before):e.after?N(u,e.after)+1:u.length-1;s.splice(t,0,e.parse),c.splice(t,0,e.leaf),u.splice(t,0,e.name)}e.endLeaf&&m.push(e.endLeaf)}if(j(n.parseInline))for(let e of n.parseInline){let t=p.indexOf(e.name);if(t>-1)d[t]=e.parse;else{let t=e.before?N(p,e.before):e.after?N(p,e.after)+1:p.length-1;d.splice(t,0,e.parse),p.splice(t,0,e.name)}}return n.wrap&&(h=h.concat(n.wrap)),new e(a,s,c,u,m,o,d,p,h)}getNodeType(e){let t=this.nodeTypes[e];if(t==null)throw RangeError(`Unknown node type '${e}'`);return t}parseInline(e,t){let n=new W(this,e,t);outer:for(let e=t;e<n.end;){let t=n.char(e);for(let r of this.inlineParsers)if(r){let i=r(n,t,e);if(i>=0){e=i;continue outer}}e++}return n.resolveMarkers(0)}};function j(e){return e!=null&&e.length>0}function M(e){if(!Array.isArray(e))return e;if(e.length==0)return null;let t=M(e[0]);if(e.length==1)return t;let n=M(e.slice(1));if(!n||!t)return t||n;let r=(e,t)=>(e||P).concat(t||P),i=t.wrap,a=n.wrap;return{props:r(t.props,n.props),defineNodes:r(t.defineNodes,n.defineNodes),parseBlock:r(t.parseBlock,n.parseBlock),parseInline:r(t.parseInline,n.parseInline),remove:r(t.remove,n.remove),wrap:i?a?(e,t,n,r)=>i(a(e,t,n,r),t,n,r):i:a}}function N(e,t){let n=e.indexOf(t);if(n<0)throw RangeError(`Position specified relative to unknown parser ${t}`);return n}var Ne=[f.none];for(let e=1,t;t=y[e];e++)Ne[e]=f.define({id:e,name:t,props:e>=y.Escape?[]:[[v.group,e in b?[`Block`,`BlockContext`]:[`Block`,`LeafBlock`]]],top:t==`Document`});var P=[],Pe=class{constructor(e){this.nodeSet=e,this.content=[],this.nodes=[]}write(e,t,n,r=0){return this.content.push(e,t,n,4+r*4),this}writeElements(e,t=0){for(let n of e)n.writeTo(this,t);return this}finish(e,t){return s.build({buffer:this.content,nodeSet:this.nodeSet,reused:this.nodes,topID:e,length:t})}},F=class{constructor(e,t,n,r=P){this.type=e,this.from=t,this.to=n,this.children=r}writeTo(e,t){let n=e.content.length;e.writeElements(this.children,t),e.content.push(this.type,this.from+t,this.to+t,e.content.length+4-n)}toTree(e){return new Pe(e).writeElements(this.children,-this.from).finish(this.type,this.to-this.from)}},Fe=class{constructor(e,t){this.tree=e,this.from=t}get to(){return this.from+this.tree.length}get type(){return this.tree.type.id}get children(){return P}writeTo(e,t){e.nodes.push(this.tree),e.content.push(e.nodes.length-1,this.from+t,this.to+t,-1)}toTree(){return this.tree}};function I(e,t,n,r){return new F(e,t,n,r)}var L={resolve:`Emphasis`,mark:`EmphasisMark`},R={resolve:`Emphasis`,mark:`EmphasisMark`},z={},B={},V=class{constructor(e,t,n,r,i=n-t){this.type=e,this.from=t,this.to=n,this.side=r,this.size=i}},Ie=`!"#$%&'()*+,-./:;<=>?@[\\]^_\`{|}~`,H=/[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\xA1\u2010-\u2027]/;try{H=RegExp(`[\\p{S}|\\p{P}]`,`u`)}catch{}var U={Escape(e,t,n){if(t!=92||n==e.end-1)return-1;let r=e.char(n+1);for(let t=0;t<32;t++)if(Ie.charCodeAt(t)==r)return e.append(I(y.Escape,n,n+2));return-1},Entity(e,t,n){if(t!=38)return-1;let r=/^(?:#\d+|#x[a-f\d]+|\w+);/i.exec(e.slice(n+1,n+31));return r?e.append(I(y.Entity,n,n+1+r[0].length)):-1},InlineCode(e,t,n){if(t!=96||n&&e.char(n-1)==96)return-1;let r=n+1;for(;r<e.end&&e.char(r)==96;)r++;let i=r-n,a=0;for(;r<e.end;r++)if(e.char(r)==96){if(a++,a==i&&e.char(r+1)!=96)return e.append(I(y.InlineCode,n,r+1,[I(y.CodeMark,n,n+i),I(y.CodeMark,r+1-i,r+1)]))}else a=0;return-1},HTMLTag(e,t,n){if(t!=60||n==e.end-1)return-1;let r=e.slice(n+1,e.end),i=/^(?:[a-z][-\w+.]+:[^\s>]+|[a-z\d.!#$%&'*+/=?^_`{|}~-]+@[a-z\d](?:[a-z\d-]{0,61}[a-z\d])?(?:\.[a-z\d](?:[a-z\d-]{0,61}[a-z\d])?)*)>/i.exec(r);if(i)return e.append(I(y.Autolink,n,n+1+i[0].length,[I(y.LinkMark,n,n+1),I(y.URL,n+1,n+i[0].length),I(y.LinkMark,n+i[0].length,n+1+i[0].length)]));let a=/^!--(?:-?>|[^]*?-->)/.exec(r);if(a)return e.append(I(y.Comment,n,n+1+a[0].length));let o=/^\?[^]*?\?>/.exec(r);if(o)return e.append(I(y.ProcessingInstruction,n,n+1+o[0].length));let s=/^(?:![A-Z][^]*?>|!\[CDATA\[[^]*?\]\]>|\/[a-zA-Z][\w-]*\s*>|[a-zA-Z][\w-]*(\s+[a-zA-Z:_][\w-.:]*(?:\s*=\s*(?:[^\s"'=<>`]+|'[^']*'|"[^"]*"))?)*\s*\/?>)/.exec(r);return s?e.append(I(y.HTMLTag,n,n+1+s[0].length)):-1},Emphasis(e,t,n){if(t!=95&&t!=42)return-1;let r=n+1;for(;e.char(r)==t;)r++;let i=e.slice(n-1,n),a=e.slice(r,r+1),o=H.test(i),s=H.test(a),c=/\s|^$/.test(i),l=/\s|^$/.test(a),u=!l&&(!s||c||o),d=!c&&(!o||l||s),f=u&&(t==42||!d||o),p=d&&(t==42||!u||s);return e.append(new V(t==95?L:R,n,r,!!f|(p?2:0)))},HardBreak(e,t,n){if(t==92&&e.char(n+1)==10)return e.append(I(y.HardBreak,n,n+2));if(t==32){let t=n+1;for(;e.char(t)==32;)t++;if(e.char(t)==10&&t>=n+2)return e.append(I(y.HardBreak,n,t+1))}return-1},Link(e,t,n){return t==91?e.append(new V(z,n,n+1,1)):-1},Image(e,t,n){return t==33&&e.char(n+1)==91?e.append(new V(B,n,n+2,1)):-1},LinkEnd(e,t,n){if(t!=93)return-1;for(let t=e.parts.length-1;t>=0;t--){let r=e.parts[t];if(r instanceof V&&(r.type==z||r.type==B)){if(!r.side||e.skipSpace(r.to)==n&&!/[(\[]/.test(e.slice(n+1,n+2)))return e.parts[t]=null,-1;let i=e.takeContent(t),a=e.parts[t]=Le(e,i,r.type==z?y.Link:y.Image,r.from,n+1);if(r.type==z)for(let n=0;n<t;n++){let t=e.parts[n];t instanceof V&&t.type==z&&(t.side=0)}return a.to}}return-1}};function Le(e,t,n,r,i){let{text:a}=e,o=e.char(i),s=i;if(t.unshift(I(y.LinkMark,r,r+(n==y.Image?2:1))),t.push(I(y.LinkMark,i-1,i)),o==40){let n=e.skipSpace(i+1),r=Re(a,n-e.offset,e.offset),o;r&&(n=e.skipSpace(r.to),n!=r.to&&(o=ze(a,n-e.offset,e.offset),o&&(n=e.skipSpace(o.to)))),e.char(n)==41&&(t.push(I(y.LinkMark,i,i+1)),s=n+1,r&&t.push(r),o&&t.push(o),t.push(I(y.LinkMark,n,s)))}else if(o==91){let n=Be(a,i-e.offset,e.offset,!1);n&&(t.push(n),s=n.to)}return I(n,r,s,t)}function Re(e,t,n){if(e.charCodeAt(t)==60){for(let r=t+1,i=!1;r<e.length;r++){let a=e.charCodeAt(r);if(a==62&&!i)return I(y.URL,t+n,r+1+n);if(a==60&&!i||a==10)return!1;i=a==92}return null}{let r=0,i=t;for(let t=!1;i<e.length;i++){let n=e.charCodeAt(i);if(x(n))break;if(t)t=!1;else if(n==40)r++;else if(n==41){if(!r)break;r--}else n==92&&(t=!0)}return i>t?I(y.URL,t+n,i+n):i==e.length&&null}}function ze(e,t,n){let r=e.charCodeAt(t);if(r!=39&&r!=34&&r!=40)return!1;let i=r==40?41:r;for(let r=t+1,a=!1;r<e.length;r++){let o=e.charCodeAt(r);if(a)a=!1;else if(o==i)return I(y.LinkTitle,t+n,r+1+n);else o==92&&(a=!0)}return null}function Be(e,t,n,r){for(let i=!1,a=t+1,o=Math.min(e.length,a+999);a<o;a++){let o=e.charCodeAt(a);if(i)i=!1;else if(o==93)return!r&&I(y.LinkLabel,t+n,a+1+n);else{if(r&&!x(o)&&(r=!1),o==91)return!1;o==92&&(i=!0)}}return null}var W=class{constructor(e,t,n){this.parser=e,this.text=t,this.offset=n,this.parts=[]}char(e){return e>=this.end?-1:this.text.charCodeAt(e-this.offset)}get end(){return this.offset+this.text.length}slice(e,t){return this.text.slice(e-this.offset,t-this.offset)}append(e){return this.parts.push(e),e.to}addDelimiter(e,t,n,r,i){return this.append(new V(e,t,n,!!r|(i?2:0)))}get hasOpenLink(){for(let e=this.parts.length-1;e>=0;e--){let t=this.parts[e];if(t instanceof V&&(t.type==z||t.type==B))return!0}return!1}addElement(e){return this.append(e)}resolveMarkers(e){for(let t=e;t<this.parts.length;t++){let n=this.parts[t];if(!(n instanceof V&&n.type.resolve&&n.side&2))continue;let r=n.type==L||n.type==R,i=n.to-n.from,a,o=t-1;for(;o>=e;o--){let e=this.parts[o];if(e instanceof V&&e.side&1&&e.type==n.type&&!(r&&(n.side&1||e.side&2)&&(e.size+n.size)%3==0&&(e.size%3||n.size%3))){a=e;break}}if(!a)continue;let s=n.type.resolve,c=[],l=a.from,u=n.to;if(r){let e=Math.min(2,a.to-a.from,i);l=a.to-e,u=n.from+e,s=e==1?`Emphasis`:`StrongEmphasis`}a.type.mark&&c.push(this.elt(a.type.mark,l,a.to));for(let e=o+1;e<t;e++)this.parts[e]instanceof F&&c.push(this.parts[e]),this.parts[e]=null;n.type.mark&&c.push(this.elt(n.type.mark,n.from,u));let d=this.elt(s,l,u,c);this.parts[o]=r&&a.from!=l?new V(a.type,a.from,l,a.side,a.size):null,(this.parts[t]=r&&n.to!=u?new V(n.type,u,n.to,n.side,n.size):null)?this.parts.splice(t,0,d):this.parts[t]=d}let t=[];for(let n=e;n<this.parts.length;n++){let e=this.parts[n];e instanceof F&&t.push(e)}return t}findOpeningDelimiter(e){for(let t=this.parts.length-1;t>=0;t--){let n=this.parts[t];if(n instanceof V&&n.type==e&&n.side&1)return t}return null}takeContent(e){let t=this.resolveMarkers(e);return this.parts.length=e,t}getDelimiterAt(e){let t=this.parts[e];return t instanceof V?t:null}skipSpace(e){return S(this.text,e-this.offset)+this.offset}elt(e,t,n,r){return typeof e==`string`?I(this.parser.getNodeType(e),t,n,r):new Fe(e,t)}};W.linkStart=z,W.imageStart=B,W.emphasisAsterisk=R,W.emphasisUnderscore=L;function G(e,t){if(!t.length)return e;if(!e.length)return t;let n=e.slice(),r=0;for(let e of t){for(;r<n.length&&n[r].to<e.to;)r++;if(r<n.length&&n[r].from<e.from){let t=n[r];t instanceof F&&(n[r]=new F(t.type,t.from,t.to,G(t.children,[e])))}else n.splice(r++,0,e)}return n}var Ve=[y.CodeBlock,y.ListItem,y.OrderedList,y.BulletList],He=class{constructor(e,t){this.fragments=e,this.input=t,this.i=0,this.fragment=null,this.fragmentEnd=-1,this.cursor=null,e.length&&(this.fragment=e[this.i++])}nextFragment(){this.fragment=this.i<this.fragments.length?this.fragments[this.i++]:null,this.cursor=null,this.fragmentEnd=-1}moveTo(e,t){for(;this.fragment&&this.fragment.to<=e;)this.nextFragment();if(!this.fragment||this.fragment.from>(e?e-1:0))return!1;if(this.fragmentEnd<0){let e=this.fragment.to;for(;e>0&&this.input.read(e-1,e)!=`
|
|
6
|
-
`;)e--;this.fragmentEnd=e?e-1:0}let n=this.cursor;n||(n=this.cursor=this.fragment.tree.cursor(a.IncludeAnonymous|a.IgnoreMounts),n.firstChild());let r=e+this.fragment.offset;for(;n.to<=r;)if(!n.parent())return!1;for(;;){if(n.from>=r)return this.fragment.from<=t;if(!n.childAfter(r))return!1}}matches(e){let t=this.cursor.tree;for(;t&&t.type.isAnonymous&&t.children[0]instanceof s;)t=t.children[0];return t&&t.prop(v.contextHash)==e}takeNodes(e){let t=this.cursor,n=this.fragment.offset,r=this.fragmentEnd-+!!this.fragment.openEnd,i=e.absoluteLineStart,a=i,o=e.block.children.length,c=e.lineStart-e.block.from>>2,l=a,u=o;scan:for(;;){if(t.to-n>Math.min(r,e.to)||t.type.isAnonymous&&t.tree&&(t.to-t.from>c||!Ue(t.tree))){if(t.type.isAnonymous&&t.firstChild())continue;break}let i=We(t.from-n,e.ranges);if(t.to-n<=e.ranges[e.rangeI].to)e.addNode(t.tree,i);else{let n=new s(e.parser.nodeSet.types[y.Paragraph],[],[],0,e.block.hashProp);e.reusePlaceholders.set(n,t.tree),e.addNode(n,i)}for((t.type.isAnonymous||t.type.is(`Block`))&&(t.type.isAnonymous||Ve.indexOf(t.type.id)<0?(a=t.to-n,o=e.block.children.length):(a=l,o=u),l=t.to-n,u=e.block.children.length);;){if(t.nextSibling())continue scan;if(!t.parent()||!t.type.isAnonymous)break scan}}for(;e.block.children.length>o;)e.block.children.pop(),e.block.positions.pop();return a-i}};function Ue(e){for(;e.type.isAnonymous;){let t=e.children[e.children.length-1];if(t instanceof s)e=t;else return!1}return e.type.is(`Block`)&&Ve.indexOf(e.type.id)<0}function We(e,t){let n=e;for(let r=1;r<t.length;r++){let i=t[r-1].to,a=t[r].from;i<e&&(n-=a-i)}return n}var Ge=l({"Blockquote/...":d.quote,HorizontalRule:d.contentSeparator,"ATXHeading1/... SetextHeading1/...":d.heading1,"ATXHeading2/... SetextHeading2/...":d.heading2,"ATXHeading3/...":d.heading3,"ATXHeading4/...":d.heading4,"ATXHeading5/...":d.heading5,"ATXHeading6/...":d.heading6,"Comment CommentBlock":d.comment,Escape:d.escape,Entity:d.character,"Emphasis/...":d.emphasis,"StrongEmphasis/...":d.strong,"Link/... Image/...":d.link,"OrderedList/... BulletList/...":d.list,"BlockQuote/...":d.quote,"InlineCode CodeText":d.monospace,"URL Autolink":d.url,"HeaderMark HardBreak QuoteMark ListMark LinkMark EmphasisMark CodeMark":d.processingInstruction,"CodeInfo LinkLabel":d.labelName,LinkTitle:d.string,Paragraph:d.content}),Ke=new Me(new i(Ne).extend(Ge),Object.keys(k).map(e=>k[e]),Object.keys(k).map(e=>De[e]),Object.keys(k),Oe,b,Object.keys(U).map(e=>U[e]),Object.keys(U),[]);function qe(e,t,n){let r=[];for(let i=e.firstChild,a=t;;i=i.nextSibling){let e=i?i.from:n;if(e>a&&r.push({from:a,to:e}),!i)break;a=i.to}return r}function Je(t){let{codeParser:n,htmlParser:r}=t;return{wrap:e((e,t)=>{let i=e.type.id;if(n&&(i==y.CodeBlock||i==y.FencedCode)){let r=``;if(i==y.FencedCode){let n=e.node.getChild(y.CodeInfo);n&&(r=t.read(n.from,n.to))}let a=n(r);if(a)return{parser:a,overlay:e=>e.type.id==y.CodeText,bracketed:i==y.FencedCode}}else if(r&&(i==y.HTMLBlock||i==y.HTMLTag||i==y.CommentBlock))return{parser:r,overlay:qe(e.node,e.from,e.to)};return null})}}var Ye={resolve:`Strikethrough`,mark:`StrikethroughMark`},Xe={defineNodes:[{name:`Strikethrough`,style:{"Strikethrough/...":d.strikethrough}},{name:`StrikethroughMark`,style:d.processingInstruction}],parseInline:[{name:`Strikethrough`,parse(e,t,n){if(t!=126||e.char(n+1)!=126||e.char(n+2)==126)return-1;let r=e.slice(n-1,n),i=e.slice(n+2,n+3),a=/\s|^$/.test(r),o=/\s|^$/.test(i),s=H.test(r),c=H.test(i);return e.addDelimiter(Ye,n,n+2,!o&&(!c||a||s),!a&&(!s||o||c))},after:`Emphasis`}]};function K(e,t,n=0,r,i=0){let a=0,o=!0,s=-1,c=-1,l=!1,u=()=>{r.push(e.elt(`TableCell`,i+s,i+c,e.parser.parseInline(t.slice(s,c),i+s)))};for(let d=n;d<t.length;d++){let n=t.charCodeAt(d);n==124&&!l?((!o||s>-1)&&a++,o=!1,r&&(s>-1&&u(),r.push(e.elt(`TableDelimiter`,d+i,d+i+1))),s=c=-1):(l||n!=32&&n!=9)&&(s<0&&(s=d),c=d+1),l=!l&&n==92}return s>-1&&(a++,r&&u()),a}function Ze(e,t){for(let n=t;n<e.length;n++){let t=e.charCodeAt(n);if(t==124)return!0;t==92&&n++}return!1}var Qe=/^[>\s]*\|?(\s*:?-+:?\s*\|)+(\s*:?-+:?\s*)?$/,$e=class{constructor(){this.rows=null}nextLine(e,t,n){if(this.rows==null){this.rows=!1;let r;if((t.next==45||t.next==58||t.next==124)&&Qe.test(r=t.text.slice(t.pos))){let i=[];K(e,n.content,0,i,n.start)==K(e,r,0)&&(this.rows=[e.elt(`TableHeader`,n.start,n.start+n.content.length,i),e.elt(`TableDelimiter`,e.lineStart+t.pos,e.lineStart+t.text.length)])}}else if(this.rows){let n=[];K(e,t.text,t.pos,n,e.lineStart),this.rows.push(e.elt(`TableRow`,e.lineStart+t.pos,e.lineStart+t.text.length,n))}return!1}finish(e,t){return this.rows?(e.addLeafElement(t,e.elt(`Table`,t.start,t.start+t.content.length,this.rows)),!0):!1}},et={defineNodes:[{name:`Table`,block:!0},{name:`TableHeader`,style:{"TableHeader/...":d.heading}},`TableRow`,{name:`TableCell`,style:d.content},{name:`TableDelimiter`,style:d.processingInstruction}],parseBlock:[{name:`Table`,leaf(e,t){return Ze(t.content,0)?new $e:null},endLeaf(e,t,n){if(n.parsers.some(e=>e instanceof $e)||!Ze(t.text,t.basePos))return!1;let r=e.peekLine();return Qe.test(r)&&K(e,t.text,t.basePos)==K(e,r,t.basePos)},before:`SetextHeading`}]},tt=class{nextLine(){return!1}finish(e,t){return e.addLeafElement(t,e.elt(`Task`,t.start,t.start+t.content.length,[e.elt(`TaskMarker`,t.start,t.start+3),...e.parser.parseInline(t.content.slice(3),t.start+3)])),!0}},nt={defineNodes:[{name:`Task`,block:!0,style:d.list},{name:`TaskMarker`,style:d.atom}],parseBlock:[{name:`TaskList`,leaf(e,t){return/^\[[ xX]\][ \t]/.test(t.content)&&e.parentType().name==`ListItem`?new tt:null},after:`SetextHeading`}]},rt=/(www\.)|(https?:\/\/)|([\w.+-]{1,100}@)|(mailto:|xmpp:)/gy,it=/[\w-]+(\.[\w-]+)+(:\d+)?(\/[^\s<]*)?/gy,at=/[\w-]+\.[\w-]+($|[/:])/,ot=/[\w.+-]+@[\w-]+(\.[\w.-]+)+/gy,st=/\/[a-zA-Z\d@.]+/gy;function ct(e,t,n,r){let i=0;for(let a=t;a<n;a++)e[a]==r&&i++;return i}function lt(e,t){it.lastIndex=t;let n=it.exec(e);if(!n||at.exec(n[0])[0].indexOf(`_`)>-1)return-1;let r=t+n[0].length;for(;;){let n=e[r-1],i;if(/[?!.,:*_~]/.test(n)||n==`)`&&ct(e,t,r,`)`)>ct(e,t,r,`(`))r--;else if(n==`;`&&(i=/&(?:#\d+|#x[a-f\d]+|\w+);$/.exec(e.slice(t,r))))r=t+i.index;else break}return r}function ut(e,t){ot.lastIndex=t;let n=ot.exec(e);if(!n)return-1;let r=n[0][n[0].length-1];return r==`_`||r==`-`?-1:t+n[0].length-+(r==`.`)}var dt=[et,nt,Xe,{parseInline:[{name:`Autolink`,parse(e,t,n){let r=n-e.offset;if(r&&/\w/.test(e.text[r-1]))return-1;rt.lastIndex=r;let i=rt.exec(e.text),a=-1;return!i||(i[1]||i[2]?(a=lt(e.text,r+i[0].length),a>-1&&e.hasOpenLink&&(a=r+/([^\[\]]|\[[^\]]*\])*/.exec(e.text.slice(r,a))[0].length)):i[3]?a=ut(e.text,r):(a=ut(e.text,r+i[0].length),a>-1&&i[0]==`xmpp:`&&(st.lastIndex=a,i=st.exec(e.text),i&&(a=i.index+i[0].length))),a<0)?-1:(e.addElement(e.elt(`URL`,n,a+e.offset)),a+e.offset)}}]}];function ft(e,t,n){return(r,i,a)=>{if(i!=e||r.char(a+1)==e)return-1;let o=[r.elt(n,a,a+1)];for(let i=a+1;i<r.end;i++){let s=r.char(i);if(s==e)return r.addElement(r.elt(t,a,i+1,o.concat(r.elt(n,i,i+1))));if(s==92&&o.push(r.elt(`Escape`,i,i+++2)),x(s))break}return-1}}var pt={defineNodes:[{name:`Superscript`,style:d.special(d.content)},{name:`SuperscriptMark`,style:d.processingInstruction}],parseInline:[{name:`Superscript`,parse:ft(94,`Superscript`,`SuperscriptMark`)}]},mt={defineNodes:[{name:`Subscript`,style:d.special(d.content)},{name:`SubscriptMark`,style:d.processingInstruction}],parseInline:[{name:`Subscript`,parse:ft(126,`Subscript`,`SubscriptMark`)}]},ht={defineNodes:[{name:`Emoji`,style:d.character}],parseInline:[{name:`Emoji`,parse(e,t,n){let r;return t!=58||!(r=/^[a-zA-Z_0-9]+:/.exec(e.slice(n+1,e.end)))?-1:e.addElement(e.elt(`Emoji`,n,n+1+r[0].length))}}]},gt=re({commentTokens:{block:{open:`<!--`,close:`-->`}}}),_t=new v,vt=Ke.configure({props:[oe.add(e=>!e.is(`Block`)||e.is(`Document`)||q(e)!=null||yt(e)?void 0:(e,t)=>({from:t.doc.lineAt(e.from).to,to:e.to})),_t.add(q),te.add({Document:()=>null}),m.add({Document:gt})]});function q(e){let t=/^(?:ATX|Setext)Heading(\d)$/.exec(e.name);return t?+t[1]:void 0}function yt(e){return e.name==`OrderedList`||e.name==`BulletList`}function bt(e,t){let n=e;for(;;){let e=n.nextSibling,r;if(!e||(r=q(e.type))!=null&&r<=t)break;n=e}return n.to}var xt=ie.of((e,t,n)=>{for(let r=g(e).resolveInner(n,-1);r&&!(r.from<t);r=r.parent){let e=r.type.prop(_t);if(e==null)continue;let t=bt(r,e);if(t>n)return{from:n,to:t}}return null});function J(e){return new ae(gt,e,[],`markdown`)}var St=J(vt),Y=J(vt.configure([dt,mt,pt,ht,{props:[oe.add({Table:(e,t)=>({from:t.doc.lineAt(e.from).to,to:e.to})})]}]));function Ct(e,t){return n=>{if(n&&e){let t=null;if(n=/\S*/.exec(n)[0],t=typeof e==`function`?e(n):se.matchLanguageName(e,n,!0),t instanceof se)return t.support?t.support.language.parser:h.getSkippingParser(t.load());if(t)return t.parser}return t?t.parser:null}}var X=class{constructor(e,t,n,r,i,a,o){this.node=e,this.from=t,this.to=n,this.spaceBefore=r,this.spaceAfter=i,this.type=a,this.item=o}blank(e,t=!0){let n=this.spaceBefore+(this.node.name==`Blockquote`?`>`:``);if(e!=null){for(;n.length<e;)n+=` `;return n}for(let e=this.to-this.from-n.length-this.spaceAfter.length;e>0;e--)n+=` `;return n+(t?this.spaceAfter:``)}marker(e,t){let n=this.node.name==`OrderedList`?String(+Tt(this.item,e)[2]+t):``;return this.spaceBefore+n+this.type+this.spaceAfter}};function wt(e,t){let n=[],r=[];for(let t=e;t;t=t.parent){if(t.name==`FencedCode`)return r;(t.name==`ListItem`||t.name==`Blockquote`)&&n.push(t)}for(let e=n.length-1;e>=0;e--){let i=n[e],a,o=t.lineAt(i.from),s=i.from-o.from;if(i.name==`Blockquote`&&(a=/^ *>( ?)/.exec(o.text.slice(s))))r.push(new X(i,s,s+a[0].length,``,a[1],`>`,null));else if(i.name==`ListItem`&&i.parent.name==`OrderedList`&&(a=/^( *)\d+([.)])( *)/.exec(o.text.slice(s)))){let e=a[3],t=a[0].length;e.length>=4&&(e=e.slice(0,e.length-4),t-=4),r.push(new X(i.parent,s,s+t,a[1],e,a[2],i))}else if(i.name==`ListItem`&&i.parent.name==`BulletList`&&(a=/^( *)([-+*])( {1,4}\[[ xX]\])?( +)/.exec(o.text.slice(s)))){let e=a[4],t=a[0].length;e.length>4&&(e=e.slice(0,e.length-4),t-=4);let n=a[2];a[3]&&(n+=a[3].replace(/[xX]/,` `)),r.push(new X(i.parent,s,s+t,a[1],e,n,i))}}return r}function Tt(e,t){return/^(\s*)(\d+)(?=[.)])/.exec(t.sliceString(e.from,e.from+10))}function Z(e,t,n,r=0){for(let i=-1,a=e;;){if(a.name==`ListItem`){let e=Tt(a,t),o=+e[2];if(i>=0){if(o!=i+1)return;n.push({from:a.from+e[1].length,to:a.from+e[0].length,insert:String(i+2+r)})}i=o}let e=a.nextSibling;if(!e)break;a=e}}function Q(e,t){let n=/^[ \t]*/.exec(e)[0].length;if(!n||t.facet(ee)!=` `)return e;let r=u(e,4,n),i=``;for(let e=r;e>0;)e>=4?(i+=` `,e-=4):(i+=` `,e--);return i+e.slice(n)}var Et=((e={})=>({state:t,dispatch:n})=>{let r=g(t),{doc:i}=t,a=null,o=t.changeByRange(n=>{if(!n.empty||!Y.isActiveAt(t,n.from,-1)&&!Y.isActiveAt(t,n.from,1))return a={range:n};let o=n.from,s=i.lineAt(o),c=wt(r.resolveInner(o,-1),i);for(;c.length&&c[c.length-1].from>o-s.from;)c.pop();if(!c.length)return a={range:n};let l=c[c.length-1];if(l.to-l.spaceAfter.length>o-s.from)return a={range:n};let d=o>=l.to-l.spaceAfter.length&&!/\S/.test(s.text.slice(l.to));if(l.item&&d){if(l.item.from<s.from&&!/^[\s>]*$/.test(s.text.slice(0,l.to)))return a={range:n};let r=l.node.firstChild,u=l.node.getChild(`ListItem`,`ListItem`);if(r.to>=o||u&&u.to<o||s.from>0&&!/[^\s>]/.test(i.lineAt(s.from-1).text)||e.nonTightLists===!1){let e=c.length>1?c[c.length-2]:null,t,n=``;e&&e.item?(t=s.from+e.from,n=e.marker(i,1)):t=s.from+(e?e.to:0);let r=[{from:t,to:o,insert:n}];return l.node.name==`OrderedList`&&Z(l.item,i,r,-2),e&&e.node.name==`OrderedList`&&Z(e.item,i,r),{range:_.cursor(t+n.length),changes:r}}{let e=kt(c,t,s);return{range:_.cursor(o+e.length+1),changes:{from:s.from,insert:e+t.lineBreak}}}}if(l.node.name==`Blockquote`&&d&&s.from){let e=i.lineAt(s.from-1),r=/>\s*$/.exec(e.text);if(r&&r.index==l.from){let i=t.changes([{from:e.from+r.index,to:e.to},{from:s.from+l.from,to:s.to}]);return{range:n.map(i),changes:i}}}let f=[];l.node.name==`OrderedList`&&Z(l.item,i,f);let p=l.item&&l.item.from<s.from,m=``;if(!p||/^[\s\d.)\-+*>]*/.exec(s.text)[0].length>=l.to)for(let e=0,t=c.length-1;e<=t;e++)m+=e==t&&!p?c[e].marker(i,1):c[e].blank(e<t?u(s.text,4,c[e+1].from)-m.length:null);let h=o;for(;h>s.from&&/\s/.test(s.text.charAt(h-s.from-1));)h--;return m=Q(m,t),Ot(l.node,t.doc)&&(m=kt(c,t,s)+t.lineBreak+m),f.push({from:h,to:o,insert:t.lineBreak+m}),{range:_.cursor(h+m.length+1),changes:f}});return!a&&(n(t.update(o,{scrollIntoView:!0,userEvent:`input`})),!0)})();function Dt(e){return e.name==`QuoteMark`||e.name==`ListMark`}function Ot(e,t){if(e.name!=`OrderedList`&&e.name!=`BulletList`)return!1;let n=e.firstChild,r=e.getChild(`ListItem`,`ListItem`);if(!r)return!1;let i=t.lineAt(n.to),a=t.lineAt(r.from),o=/^[\s>]*$/.test(i.text);return i.number+ +!o<a.number}function kt(e,t,n){let r=``;for(let t=0,i=e.length-2;t<=i;t++)r+=e[t].blank(t<i?u(n.text,4,e[t+1].from)-r.length:null,t<i);return Q(r,t)}function At(e,t){let n=e.resolveInner(t,-1),r=t;Dt(n)&&(r=n.from,n=n.parent);for(let e;e=n.childBefore(r);)if(Dt(e))r=e.from;else if(e.name==`OrderedList`||e.name==`BulletList`)n=e.lastChild,r=n.to;else break;return n}var jt=[{key:`Enter`,run:Et},{key:`Backspace`,run:({state:e,dispatch:t})=>{let n=g(e),r=null,i=e.changeByRange(t=>{let i=t.from,{doc:a}=e;if(t.empty&&Y.isActiveAt(e,t.from)){let t=a.lineAt(i),r=wt(At(n,i),a);if(r.length){let n=r[r.length-1],a=n.to-n.spaceAfter.length+ +!!n.spaceAfter;if(i-t.from>a&&!/\S/.test(t.text.slice(a,i-t.from)))return{range:_.cursor(t.from+a),changes:{from:t.from+a,to:i}};if(i-t.from==a&&(n.item&&t.from<=n.item.from||/^[\s>]*$/.test(t.text.slice(0,n.to)))){let r=t.from+n.from;if(n.item&&n.node.from<n.item.from&&/\S/.test(t.text.slice(n.from,n.to))){let i=n.blank(u(t.text,4,n.to)-u(t.text,4,n.from));return r==t.from&&(i=Q(i,e)),{range:_.cursor(r+i.length),changes:{from:r,to:t.from+n.to,insert:i}}}if(r<i)return{range:_.cursor(r),changes:{from:r,to:i}}}}}return r={range:t}});return!r&&(t(e.update(i,{scrollIntoView:!0,userEvent:`delete`})),!0)}}],Mt=le({matchClosingTags:!1});function Nt(e={}){let{codeLanguages:r,defaultCodeLanguage:i,addKeymap:a=!0,base:{parser:o}=St,completeHTMLTags:s=!0,pasteURLAsLink:c=!0,htmlTagLanguage:l=Mt}=e;if(!(o instanceof Me))throw RangeError("Base parser provided to `markdown` should be a Markdown parser");let u=e.extensions?[e.extensions]:[],d=[l.support,xt],f;c&&d.push(Lt),i instanceof ne?(d.push(i.support),f=i.language):i&&(f=i);let p=r||f?Ct(r,f):void 0;u.push(Je({codeParser:p,htmlParser:l.language.parser})),a&&d.push(n.high(t.of(jt)));let m=J(o.configure(u));return s&&d.push(m.data.of({autocomplete:Pt})),new ne(m,d)}function Pt(e){let{state:t,pos:n}=e,r=/<[:\-\.\w\u00b7-\uffff]*$/.exec(t.sliceDoc(n-25,n));if(!r)return null;let i=g(t).resolveInner(n,-1);for(;i&&!i.type.isTop;){if(i.name==`CodeBlock`||i.name==`FencedCode`||i.name==`ProcessingInstructionBlock`||i.name==`CommentBlock`||i.name==`Link`||i.name==`Image`)return null;i=i.parent}return{from:n-r[0].length,to:n,options:Ft(),validFor:/^<[:\-\.\w\u00b7-\uffff]*$/}}var $=null;function Ft(){if($)return $;let e=ue(new ce(o.create({extensions:Mt}),0,!0));return $=e?e.options:[]}var It=/code|horizontalrule|html|link|comment|processing|escape|entity|image|mark|url/i,Lt=c.domEventHandlers({paste:(e,t)=>{let{main:n}=t.state.selection;if(n.empty)return!1;let r=e.clipboardData?.getData(`text/plain`);if(!r||!/^(https?:\/\/|mailto:|xmpp:|www\.)/.test(r)||(/^www\./.test(r)&&(r=`https://`+r),!Y.isActiveAt(t.state,n.from,1)))return!1;let i=g(t.state),a=!1;return i.iterate({from:n.from,to:n.to,enter:e=>{(e.from>n.from||It.test(e.name))&&(a=!0)},leave:e=>{e.to<n.to&&(a=!0)}}),!a&&(t.dispatch({changes:[{from:n.from,insert:`[`},{from:n.to,insert:`](${r})`}],userEvent:`input.paste`,scrollIntoView:!0}),!0)}});export{Nt as markdown};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{$ as e,S as t,U as n,W as r,b as i,h as a,i as o,j as s,o as c,p as l,t as ee}from"./dist-B1M7IjfA.js";import{n as u,r as te,t as ne}from"./dist-idN8f9Fc.js";import{n as d,t as re}from"./dist-nvgpa2Us.js";import{a as ie,i as ae,n as oe,o as se,r as f}from"./dist-DLfpWwLs.js";var ce=55,le=1,ue=56,de=2,fe=57,pe=3,p=4,me=5,m=6,he=7,ge=8,h=9,g=10,_e=11,ve=12,ye=13,_=58,be=14,xe=15,v=59,y=21,Se=23,b=24,Ce=25,x=27,S=28,we=29,Te=32,Ee=35,De=37,Oe=38,ke=0,Ae=1,je={area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,menuitem:!0},Me={dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},C={dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}};function Ne(e){return e==45||e==46||e==58||e>=65&&e<=90||e==95||e>=97&&e<=122||e>=161}var w=null,T=null,E=0;function D(e,t){let n=e.pos+t;if(E==n&&T==e)return w;let r=e.peek(t),i=``;for(;Ne(r);)i+=String.fromCharCode(r),r=e.peek(++t);return T=e,E=n,w=i?i.toLowerCase():r==Pe||r==Fe?void 0:null}var O=60,k=62,A=47,Pe=63,Fe=33,Ie=45;function j(e,t){this.name=e,this.parent=t}var Le=[m,g,he,ge,h],Re=new ne({start:null,shift(e,t,n,r){return Le.indexOf(t)>-1?new j(D(r,1)||``,e):e},reduce(e,t){return t==y&&e?e.parent:e},reuse(e,t,n,r){let i=t.type.id;return i==m||i==De?new j(D(r,1)||``,e):e},strict:!1}),ze=new u((e,t)=>{if(e.next!=O){e.next<0&&t.context&&e.acceptToken(_);return}e.advance();let n=e.next==A;n&&e.advance();let r=D(e,0);if(r===void 0)return;if(!r)return e.acceptToken(n?xe:be);let i=t.context?t.context.name:null;if(n){if(r==i)return e.acceptToken(_e);if(i&&Me[i])return e.acceptToken(_,-2);if(t.dialectEnabled(ke))return e.acceptToken(ve);for(let e=t.context;e;e=e.parent)if(e.name==r)return;e.acceptToken(ye)}else{if(r==`script`)return e.acceptToken(he);if(r==`style`)return e.acceptToken(ge);if(r==`textarea`)return e.acceptToken(h);if(je.hasOwnProperty(r))return e.acceptToken(g);i&&C[i]&&C[i][r]?e.acceptToken(_,-1):e.acceptToken(m)}},{contextual:!0}),Be=new u(e=>{for(let t=0,n=0;;n++){if(e.next<0){n&&e.acceptToken(v);break}if(e.next==Ie)t++;else if(e.next==k&&t>=2){n>=3&&e.acceptToken(v,-2);break}else t=0;e.advance()}});function Ve(e){for(;e;e=e.parent)if(e.name==`svg`||e.name==`math`)return!0;return!1}var He=new u((e,t)=>{if(e.next==A&&e.peek(1)==k){let n=t.dialectEnabled(Ae)||Ve(t.context);e.acceptToken(n?me:p,2)}else e.next==k&&e.acceptToken(p,1)});function M(e,t,n){let r=2+e.length;return new u(i=>{for(let a=0,o=0,s=0;;s++){if(i.next<0){s&&i.acceptToken(t);break}if(a==0&&i.next==O||a==1&&i.next==A||a>=2&&a<r&&i.next==e.charCodeAt(a-2))a++,o++;else if(a==r&&i.next==k){s>o?i.acceptToken(t,-o):i.acceptToken(n,-(o-2));break}else if((i.next==10||i.next==13)&&s){i.acceptToken(t,1);break}else a=o=0;i.advance()}})}var Ue=M(`script`,ce,le),We=M(`style`,ue,de),Ge=M(`textarea`,fe,pe),Ke=n({"Text RawText IncompleteTag IncompleteCloseTag":r.content,"StartTag StartCloseTag SelfClosingEndTag EndTag":r.angleBracket,TagName:r.tagName,"MismatchedCloseTag/TagName":[r.tagName,r.invalid],AttributeName:r.attributeName,"AttributeValue UnquotedAttributeValue":r.attributeValue,Is:r.definitionOperator,"EntityReference CharacterReference":r.character,Comment:r.blockComment,ProcessingInst:r.processingInstruction,DoctypeDecl:r.documentMeta}),qe=te.deserialize({version:14,states:",xOVO!rOOO!ZQ#tO'#CrO!`Q#tO'#C{O!eQ#tO'#DOO!jQ#tO'#DRO!oQ#tO'#DTO!tOaO'#CqO#PObO'#CqO#[OdO'#CqO$kO!rO'#CqOOO`'#Cq'#CqO$rO$fO'#DUO$zQ#tO'#DWO%PQ#tO'#DXOOO`'#Dl'#DlOOO`'#DZ'#DZQVO!rOOO%UQ&rO,59^O%aQ&rO,59gO%lQ&rO,59jO%wQ&rO,59mO&SQ&rO,59oOOOa'#D_'#D_O&_OaO'#CyO&jOaO,59]OOOb'#D`'#D`O&rObO'#C|O&}ObO,59]OOOd'#Da'#DaO'VOdO'#DPO'bOdO,59]OOO`'#Db'#DbO'jO!rO,59]O'qQ#tO'#DSOOO`,59],59]OOOp'#Dc'#DcO'vO$fO,59pOOO`,59p,59pO(OQ#|O,59rO(TQ#|O,59sOOO`-E7X-E7XO(YQ&rO'#CtOOQW'#D['#D[O(hQ&rO1G.xOOOa1G.x1G.xOOO`1G/Z1G/ZO(sQ&rO1G/ROOOb1G/R1G/RO)OQ&rO1G/UOOOd1G/U1G/UO)ZQ&rO1G/XOOO`1G/X1G/XO)fQ&rO1G/ZOOOa-E7]-E7]O)qQ#tO'#CzOOO`1G.w1G.wOOOb-E7^-E7^O)vQ#tO'#C}OOOd-E7_-E7_O){Q#tO'#DQOOO`-E7`-E7`O*QQ#|O,59nOOOp-E7a-E7aOOO`1G/[1G/[OOO`1G/^1G/^OOO`1G/_1G/_O*VQ,UO,59`OOQW-E7Y-E7YOOOa7+$d7+$dOOO`7+$u7+$uOOOb7+$m7+$mOOOd7+$p7+$pOOO`7+$s7+$sO*bQ#|O,59fO*gQ#|O,59iO*lQ#|O,59lOOO`1G/Y1G/YO*qO7[O'#CwO+SOMhO'#CwOOQW1G.z1G.zOOO`1G/Q1G/QOOO`1G/T1G/TOOO`1G/W1G/WOOOO'#D]'#D]O+eO7[O,59cOOQW,59c,59cOOOO'#D^'#D^O+vOMhO,59cOOOO-E7Z-E7ZOOQW1G.}1G.}OOOO-E7[-E7[",stateData:`,c~O!_OS~OUSOVPOWQOXROYTO[]O][O^^O_^Oa^Ob^Oc^Od^Oy^O|_O!eZO~OgaO~OgbO~OgcO~OgdO~OgeO~O!XfOPmP![mP~O!YiOQpP![pP~O!ZlORsP![sP~OUSOVPOWQOXROYTOZqO[]O][O^^O_^Oa^Ob^Oc^Od^Oy^O!eZO~O![rO~P#gO!]sO!fuO~OgvO~OgwO~OS|OT}OiyO~OS!POT}OiyO~OS!ROT}OiyO~OS!TOT}OiyO~OS}OT}OiyO~O!XfOPmX![mX~OP!WO![!XO~O!YiOQpX![pX~OQ!ZO![!XO~O!ZlORsX![sX~OR!]O![!XO~O![!XO~P#gOg!_O~O!]sO!f!aO~OS!bO~OS!cO~Oj!dOShXThXihX~OS!fOT!gOiyO~OS!hOT!gOiyO~OS!iOT!gOiyO~OS!jOT!gOiyO~OS!gOT!gOiyO~Og!kO~Og!lO~Og!mO~OS!nO~Ol!qO!a!oO!c!pO~OS!rO~OS!sO~OS!tO~Ob!uOc!uOd!uO!a!wO!b!uO~Ob!xOc!xOd!xO!c!wO!d!xO~Ob!uOc!uOd!uO!a!{O!b!uO~Ob!xOc!xOd!xO!c!{O!d!xO~OT~cbd!ey|!e~`,goto:"%q!aPPPPPPPPPPPPPPPPPPPPP!b!hP!nPP!zP!}#Q#T#Z#^#a#g#j#m#s#y!bP!b!bP$P$V$m$s$y%P%V%]%cPPPPPPPP%iX^OX`pXUOX`pezabcde{!O!Q!S!UR!q!dRhUR!XhXVOX`pRkVR!XkXWOX`pRnWR!XnXXOX`pQrXR!XpXYOX`pQ`ORx`Q{aQ!ObQ!QcQ!SdQ!UeZ!e{!O!Q!S!UQ!v!oR!z!vQ!y!pR!|!yQgUR!VgQjVR!YjQmWR![mQpXR!^pQtZR!`tS_O`ToXp",nodeNames:`⚠ StartCloseTag StartCloseTag StartCloseTag EndTag SelfClosingEndTag StartTag StartTag StartTag StartTag StartTag StartCloseTag StartCloseTag StartCloseTag IncompleteTag IncompleteCloseTag Document Text EntityReference CharacterReference InvalidEntity Element OpenTag TagName Attribute AttributeName Is AttributeValue UnquotedAttributeValue ScriptText CloseTag OpenTag StyleText CloseTag OpenTag TextareaText CloseTag OpenTag CloseTag SelfClosingTag Comment ProcessingInst MismatchedCloseTag CloseTag DoctypeDecl`,maxTerm:68,context:Re,nodeProps:[[`closedBy`,-10,1,2,3,7,8,9,10,11,12,13,`EndTag`,6,`EndTag SelfClosingEndTag`,-4,22,31,34,37,`CloseTag`],[`openedBy`,4,`StartTag StartCloseTag`,5,`StartTag`,-4,30,33,36,38,`OpenTag`],[`group`,-10,14,15,18,19,20,21,40,41,42,43,`Entity`,17,`Entity TextContent`,-3,29,32,35,`TextContent Entity`],[`isolate`,-11,22,30,31,33,34,36,37,38,39,42,43,`ltr`,-3,27,28,40,``]],propSources:[Ke],skippedNodes:[0],repeatNodeCount:9,tokenData:"!<p!aR!YOX$qXY,QYZ,QZ[$q[]&X]^,Q^p$qpq,Qqr-_rs3_sv-_vw3}wxHYx}-_}!OH{!O!P-_!P!Q$q!Q![-_![!]Mz!]!^-_!^!_!$S!_!`!;x!`!a&X!a!c-_!c!}Mz!}#R-_#R#SMz#S#T1k#T#oMz#o#s-_#s$f$q$f%W-_%W%oMz%o%p-_%p&aMz&a&b-_&b1pMz1p4U-_4U4dMz4d4e-_4e$ISMz$IS$I`-_$I`$IbMz$Ib$Kh-_$Kh%#tMz%#t&/x-_&/x&EtMz&Et&FV-_&FV;'SMz;'S;:j!#|;:j;=`3X<%l?&r-_?&r?AhMz?Ah?BY$q?BY?MnMz?MnO$q!Z$|caPlW!b`!dpOX$qXZ&XZ[$q[^&X^p$qpq&Xqr$qrs&}sv$qvw+Pwx(tx!^$q!^!_*V!_!a&X!a#S$q#S#T&X#T;'S$q;'S;=`+z<%lO$q!R&bXaP!b`!dpOr&Xrs&}sv&Xwx(tx!^&X!^!_*V!_;'S&X;'S;=`*y<%lO&Xq'UVaP!dpOv&}wx'kx!^&}!^!_(V!_;'S&};'S;=`(n<%lO&}P'pTaPOv'kw!^'k!_;'S'k;'S;=`(P<%lO'kP(SP;=`<%l'kp([S!dpOv(Vx;'S(V;'S;=`(h<%lO(Vp(kP;=`<%l(Vq(qP;=`<%l&}a({WaP!b`Or(trs'ksv(tw!^(t!^!_)e!_;'S(t;'S;=`*P<%lO(t`)jT!b`Or)esv)ew;'S)e;'S;=`)y<%lO)e`)|P;=`<%l)ea*SP;=`<%l(t!Q*^V!b`!dpOr*Vrs(Vsv*Vwx)ex;'S*V;'S;=`*s<%lO*V!Q*vP;=`<%l*V!R*|P;=`<%l&XW+UYlWOX+PZ[+P^p+Pqr+Psw+Px!^+P!a#S+P#T;'S+P;'S;=`+t<%lO+PW+wP;=`<%l+P!Z+}P;=`<%l$q!a,]`aP!b`!dp!_^OX&XXY,QYZ,QZ]&X]^,Q^p&Xpq,Qqr&Xrs&}sv&Xwx(tx!^&X!^!_*V!_;'S&X;'S;=`*y<%lO&X!_-ljiSaPlW!b`!dpOX$qXZ&XZ[$q[^&X^p$qpq&Xqr-_rs&}sv-_vw/^wx(tx!P-_!P!Q$q!Q!^-_!^!_*V!_!a&X!a#S-_#S#T1k#T#s-_#s$f$q$f;'S-_;'S;=`3X<%l?Ah-_?Ah?BY$q?BY?Mn-_?MnO$q[/ebiSlWOX+PZ[+P^p+Pqr/^sw/^x!P/^!P!Q+P!Q!^/^!a#S/^#S#T0m#T#s/^#s$f+P$f;'S/^;'S;=`1e<%l?Ah/^?Ah?BY+P?BY?Mn/^?MnO+PS0rXiSqr0msw0mx!P0m!Q!^0m!a#s0m$f;'S0m;'S;=`1_<%l?Ah0m?BY?Mn0mS1bP;=`<%l0m[1hP;=`<%l/^!V1vciSaP!b`!dpOq&Xqr1krs&}sv1kvw0mwx(tx!P1k!P!Q&X!Q!^1k!^!_*V!_!a&X!a#s1k#s$f&X$f;'S1k;'S;=`3R<%l?Ah1k?Ah?BY&X?BY?Mn1k?MnO&X!V3UP;=`<%l1k!_3[P;=`<%l-_!Z3hV!ahaP!dpOv&}wx'kx!^&}!^!_(V!_;'S&};'S;=`(n<%lO&}!_4WiiSlWd!ROX5uXZ7SZ[5u[^7S^p5uqr8trs7Sst>]tw8twx7Sx!P8t!P!Q5u!Q!]8t!]!^/^!^!a7S!a#S8t#S#T;{#T#s8t#s$f5u$f;'S8t;'S;=`>V<%l?Ah8t?Ah?BY5u?BY?Mn8t?MnO5u!Z5zblWOX5uXZ7SZ[5u[^7S^p5uqr5urs7Sst+Ptw5uwx7Sx!]5u!]!^7w!^!a7S!a#S5u#S#T7S#T;'S5u;'S;=`8n<%lO5u!R7VVOp7Sqs7St!]7S!]!^7l!^;'S7S;'S;=`7q<%lO7S!R7qOb!R!R7tP;=`<%l7S!Z8OYlWb!ROX+PZ[+P^p+Pqr+Psw+Px!^+P!a#S+P#T;'S+P;'S;=`+t<%lO+P!Z8qP;=`<%l5u!_8{iiSlWOX5uXZ7SZ[5u[^7S^p5uqr8trs7Sst/^tw8twx7Sx!P8t!P!Q5u!Q!]8t!]!^:j!^!a7S!a#S8t#S#T;{#T#s8t#s$f5u$f;'S8t;'S;=`>V<%l?Ah8t?Ah?BY5u?BY?Mn8t?MnO5u!_:sbiSlWb!ROX+PZ[+P^p+Pqr/^sw/^x!P/^!P!Q+P!Q!^/^!a#S/^#S#T0m#T#s/^#s$f+P$f;'S/^;'S;=`1e<%l?Ah/^?Ah?BY+P?BY?Mn/^?MnO+P!V<QciSOp7Sqr;{rs7Sst0mtw;{wx7Sx!P;{!P!Q7S!Q!];{!]!^=]!^!a7S!a#s;{#s$f7S$f;'S;{;'S;=`>P<%l?Ah;{?Ah?BY7S?BY?Mn;{?MnO7S!V=dXiSb!Rqr0msw0mx!P0m!Q!^0m!a#s0m$f;'S0m;'S;=`1_<%l?Ah0m?BY?Mn0m!V>SP;=`<%l;{!_>YP;=`<%l8t!_>dhiSlWOX@OXZAYZ[@O[^AY^p@OqrBwrsAYswBwwxAYx!PBw!P!Q@O!Q!]Bw!]!^/^!^!aAY!a#SBw#S#TE{#T#sBw#s$f@O$f;'SBw;'S;=`HS<%l?AhBw?Ah?BY@O?BY?MnBw?MnO@O!Z@TalWOX@OXZAYZ[@O[^AY^p@Oqr@OrsAYsw@OwxAYx!]@O!]!^Az!^!aAY!a#S@O#S#TAY#T;'S@O;'S;=`Bq<%lO@O!RA]UOpAYq!]AY!]!^Ao!^;'SAY;'S;=`At<%lOAY!RAtOc!R!RAwP;=`<%lAY!ZBRYlWc!ROX+PZ[+P^p+Pqr+Psw+Px!^+P!a#S+P#T;'S+P;'S;=`+t<%lO+P!ZBtP;=`<%l@O!_COhiSlWOX@OXZAYZ[@O[^AY^p@OqrBwrsAYswBwwxAYx!PBw!P!Q@O!Q!]Bw!]!^Dj!^!aAY!a#SBw#S#TE{#T#sBw#s$f@O$f;'SBw;'S;=`HS<%l?AhBw?Ah?BY@O?BY?MnBw?MnO@O!_DsbiSlWc!ROX+PZ[+P^p+Pqr/^sw/^x!P/^!P!Q+P!Q!^/^!a#S/^#S#T0m#T#s/^#s$f+P$f;'S/^;'S;=`1e<%l?Ah/^?Ah?BY+P?BY?Mn/^?MnO+P!VFQbiSOpAYqrE{rsAYswE{wxAYx!PE{!P!QAY!Q!]E{!]!^GY!^!aAY!a#sE{#s$fAY$f;'SE{;'S;=`G|<%l?AhE{?Ah?BYAY?BY?MnE{?MnOAY!VGaXiSc!Rqr0msw0mx!P0m!Q!^0m!a#s0m$f;'S0m;'S;=`1_<%l?Ah0m?BY?Mn0m!VHPP;=`<%lE{!_HVP;=`<%lBw!ZHcW!cxaP!b`Or(trs'ksv(tw!^(t!^!_)e!_;'S(t;'S;=`*P<%lO(t!aIYliSaPlW!b`!dpOX$qXZ&XZ[$q[^&X^p$qpq&Xqr-_rs&}sv-_vw/^wx(tx}-_}!OKQ!O!P-_!P!Q$q!Q!^-_!^!_*V!_!a&X!a#S-_#S#T1k#T#s-_#s$f$q$f;'S-_;'S;=`3X<%l?Ah-_?Ah?BY$q?BY?Mn-_?MnO$q!aK_kiSaPlW!b`!dpOX$qXZ&XZ[$q[^&X^p$qpq&Xqr-_rs&}sv-_vw/^wx(tx!P-_!P!Q$q!Q!^-_!^!_*V!_!`&X!`!aMS!a#S-_#S#T1k#T#s-_#s$f$q$f;'S-_;'S;=`3X<%l?Ah-_?Ah?BY$q?BY?Mn-_?MnO$q!TM_XaP!b`!dp!fQOr&Xrs&}sv&Xwx(tx!^&X!^!_*V!_;'S&X;'S;=`*y<%lO&X!aNZ!ZiSgQaPlW!b`!dpOX$qXZ&XZ[$q[^&X^p$qpq&Xqr-_rs&}sv-_vw/^wx(tx}-_}!OMz!O!PMz!P!Q$q!Q![Mz![!]Mz!]!^-_!^!_*V!_!a&X!a!c-_!c!}Mz!}#R-_#R#SMz#S#T1k#T#oMz#o#s-_#s$f$q$f$}-_$}%OMz%O%W-_%W%oMz%o%p-_%p&aMz&a&b-_&b1pMz1p4UMz4U4dMz4d4e-_4e$ISMz$IS$I`-_$I`$IbMz$Ib$Je-_$Je$JgMz$Jg$Kh-_$Kh%#tMz%#t&/x-_&/x&EtMz&Et&FV-_&FV;'SMz;'S;:j!#|;:j;=`3X<%l?&r-_?&r?AhMz?Ah?BY$q?BY?MnMz?MnO$q!a!$PP;=`<%lMz!R!$ZY!b`!dpOq*Vqr!$yrs(Vsv*Vwx)ex!a*V!a!b!4t!b;'S*V;'S;=`*s<%lO*V!R!%Q]!b`!dpOr*Vrs(Vsv*Vwx)ex}*V}!O!%y!O!f*V!f!g!']!g#W*V#W#X!0`#X;'S*V;'S;=`*s<%lO*V!R!&QX!b`!dpOr*Vrs(Vsv*Vwx)ex}*V}!O!&m!O;'S*V;'S;=`*s<%lO*V!R!&vV!b`!dp!ePOr*Vrs(Vsv*Vwx)ex;'S*V;'S;=`*s<%lO*V!R!'dX!b`!dpOr*Vrs(Vsv*Vwx)ex!q*V!q!r!(P!r;'S*V;'S;=`*s<%lO*V!R!(WX!b`!dpOr*Vrs(Vsv*Vwx)ex!e*V!e!f!(s!f;'S*V;'S;=`*s<%lO*V!R!(zX!b`!dpOr*Vrs(Vsv*Vwx)ex!v*V!v!w!)g!w;'S*V;'S;=`*s<%lO*V!R!)nX!b`!dpOr*Vrs(Vsv*Vwx)ex!{*V!{!|!*Z!|;'S*V;'S;=`*s<%lO*V!R!*bX!b`!dpOr*Vrs(Vsv*Vwx)ex!r*V!r!s!*}!s;'S*V;'S;=`*s<%lO*V!R!+UX!b`!dpOr*Vrs(Vsv*Vwx)ex!g*V!g!h!+q!h;'S*V;'S;=`*s<%lO*V!R!+xY!b`!dpOr!+qrs!,hsv!+qvw!-Swx!.[x!`!+q!`!a!/j!a;'S!+q;'S;=`!0Y<%lO!+qq!,mV!dpOv!,hvx!-Sx!`!,h!`!a!-q!a;'S!,h;'S;=`!.U<%lO!,hP!-VTO!`!-S!`!a!-f!a;'S!-S;'S;=`!-k<%lO!-SP!-kO|PP!-nP;=`<%l!-Sq!-xS!dp|POv(Vx;'S(V;'S;=`(h<%lO(Vq!.XP;=`<%l!,ha!.aX!b`Or!.[rs!-Ssv!.[vw!-Sw!`!.[!`!a!.|!a;'S!.[;'S;=`!/d<%lO!.[a!/TT!b`|POr)esv)ew;'S)e;'S;=`)y<%lO)ea!/gP;=`<%l!.[!R!/sV!b`!dp|POr*Vrs(Vsv*Vwx)ex;'S*V;'S;=`*s<%lO*V!R!0]P;=`<%l!+q!R!0gX!b`!dpOr*Vrs(Vsv*Vwx)ex#c*V#c#d!1S#d;'S*V;'S;=`*s<%lO*V!R!1ZX!b`!dpOr*Vrs(Vsv*Vwx)ex#V*V#V#W!1v#W;'S*V;'S;=`*s<%lO*V!R!1}X!b`!dpOr*Vrs(Vsv*Vwx)ex#h*V#h#i!2j#i;'S*V;'S;=`*s<%lO*V!R!2qX!b`!dpOr*Vrs(Vsv*Vwx)ex#m*V#m#n!3^#n;'S*V;'S;=`*s<%lO*V!R!3eX!b`!dpOr*Vrs(Vsv*Vwx)ex#d*V#d#e!4Q#e;'S*V;'S;=`*s<%lO*V!R!4XX!b`!dpOr*Vrs(Vsv*Vwx)ex#X*V#X#Y!+q#Y;'S*V;'S;=`*s<%lO*V!R!4{Y!b`!dpOr!4trs!5ksv!4tvw!6Vwx!8]x!a!4t!a!b!:]!b;'S!4t;'S;=`!;r<%lO!4tq!5pV!dpOv!5kvx!6Vx!a!5k!a!b!7W!b;'S!5k;'S;=`!8V<%lO!5kP!6YTO!a!6V!a!b!6i!b;'S!6V;'S;=`!7Q<%lO!6VP!6lTO!`!6V!`!a!6{!a;'S!6V;'S;=`!7Q<%lO!6VP!7QOyPP!7TP;=`<%l!6Vq!7]V!dpOv!5kvx!6Vx!`!5k!`!a!7r!a;'S!5k;'S;=`!8V<%lO!5kq!7yS!dpyPOv(Vx;'S(V;'S;=`(h<%lO(Vq!8YP;=`<%l!5ka!8bX!b`Or!8]rs!6Vsv!8]vw!6Vw!a!8]!a!b!8}!b;'S!8];'S;=`!:V<%lO!8]a!9SX!b`Or!8]rs!6Vsv!8]vw!6Vw!`!8]!`!a!9o!a;'S!8];'S;=`!:V<%lO!8]a!9vT!b`yPOr)esv)ew;'S)e;'S;=`)y<%lO)ea!:YP;=`<%l!8]!R!:dY!b`!dpOr!4trs!5ksv!4tvw!6Vwx!8]x!`!4t!`!a!;S!a;'S!4t;'S;=`!;r<%lO!4t!R!;]V!b`!dpyPOr*Vrs(Vsv*Vwx)ex;'S*V;'S;=`*s<%lO*V!R!;uP;=`<%l!4t!V!<TXjSaP!b`!dpOr&Xrs&}sv&Xwx(tx!^&X!^!_*V!_;'S&X;'S;=`*y<%lO&X",tokenizers:[Ue,We,Ge,He,ze,Be,0,1,2,3,4,5],topRules:{Document:[0,16]},dialects:{noMatch:0,selfClosing:515},tokenPrec:517});function N(e,t){let n=Object.create(null);for(let r of e.getChildren(b)){let e=r.getChild(Ce),i=r.getChild(x)||r.getChild(S);e&&(n[t.read(e.from,e.to)]=i?i.type.id==x?t.read(i.from+1,i.to-1):t.read(i.from,i.to):``)}return n}function P(e,t){let n=e.getChild(Se);return n?t.read(n.from,n.to):` `}function F(e,t,n){let r;for(let i of n)if(!i.attrs||i.attrs(r||=N(e.node.parent.firstChild,t)))return{parser:i.parser,bracketed:!0};return null}function I(t=[],n=[]){let r=[],i=[],a=[],o=[];for(let e of t)(e.tag==`script`?r:e.tag==`style`?i:e.tag==`textarea`?a:o).push(e);let s=n.length?Object.create(null):null;for(let e of n)(s[e.name]||(s[e.name]=[])).push(e);return e((e,t)=>{let n=e.type.id;if(n==we)return F(e,t,r);if(n==Te)return F(e,t,i);if(n==Ee)return F(e,t,a);if(n==y&&o.length){let n=e.node,r=n.firstChild,i=r&&P(r,t),a;if(i){for(let e of o)if(e.tag==i&&(!e.attrs||e.attrs(a||=N(r,t)))){let t=n.lastChild,i=t.type.id==Oe?t.from:n.to;if(i>r.to)return{parser:e.parser,overlay:[{from:r.to,to:i}]}}}}if(s&&n==b){let n=e.node,r;if(r=n.firstChild){let e=s[t.read(r.from,r.to)];if(e)for(let r of e){if(r.tagName&&r.tagName!=P(n.parent,t))continue;let e=n.lastChild;if(e.type.id==x){let t=e.from+1,n=e.lastChild,i=e.to-(n&&n.isError?0:1);if(i>t)return{parser:r.parser,overlay:[{from:t,to:i}],bracketed:!0}}else if(e.type.id==S)return{parser:r.parser,overlay:[{from:e.from,to:e.to}]}}}}return null})}var L=[`_blank`,`_self`,`_top`,`_parent`],R=[`ascii`,`utf-8`,`utf-16`,`latin1`,`latin1`],z=[`get`,`post`,`put`,`delete`],B=[`application/x-www-form-urlencoded`,`multipart/form-data`,`text/plain`],V=[`true`,`false`],H={},Je={a:{attrs:{href:null,ping:null,type:null,media:null,target:L,hreflang:null}},abbr:H,address:H,area:{attrs:{alt:null,coords:null,href:null,target:null,ping:null,media:null,hreflang:null,type:null,shape:[`default`,`rect`,`circle`,`poly`]}},article:H,aside:H,audio:{attrs:{src:null,mediagroup:null,crossorigin:[`anonymous`,`use-credentials`],preload:[`none`,`metadata`,`auto`],autoplay:[`autoplay`],loop:[`loop`],controls:[`controls`]}},b:H,base:{attrs:{href:null,target:L}},bdi:H,bdo:H,blockquote:{attrs:{cite:null}},body:H,br:H,button:{attrs:{form:null,formaction:null,name:null,value:null,autofocus:[`autofocus`],disabled:[`autofocus`],formenctype:B,formmethod:z,formnovalidate:[`novalidate`],formtarget:L,type:[`submit`,`reset`,`button`]}},canvas:{attrs:{width:null,height:null}},caption:H,center:H,cite:H,code:H,col:{attrs:{span:null}},colgroup:{attrs:{span:null}},command:{attrs:{type:[`command`,`checkbox`,`radio`],label:null,icon:null,radiogroup:null,command:null,title:null,disabled:[`disabled`],checked:[`checked`]}},data:{attrs:{value:null}},datagrid:{attrs:{disabled:[`disabled`],multiple:[`multiple`]}},datalist:{attrs:{data:null}},dd:H,del:{attrs:{cite:null,datetime:null}},details:{attrs:{open:[`open`]}},dfn:H,div:H,dl:H,dt:H,em:H,embed:{attrs:{src:null,type:null,width:null,height:null}},eventsource:{attrs:{src:null}},fieldset:{attrs:{disabled:[`disabled`],form:null,name:null}},figcaption:H,figure:H,footer:H,form:{attrs:{action:null,name:null,"accept-charset":R,autocomplete:[`on`,`off`],enctype:B,method:z,novalidate:[`novalidate`],target:L}},h1:H,h2:H,h3:H,h4:H,h5:H,h6:H,head:{children:[`title`,`base`,`link`,`style`,`meta`,`script`,`noscript`,`command`]},header:H,hgroup:H,hr:H,html:{attrs:{manifest:null}},i:H,iframe:{attrs:{src:null,srcdoc:null,name:null,width:null,height:null,sandbox:[`allow-top-navigation`,`allow-same-origin`,`allow-forms`,`allow-scripts`],seamless:[`seamless`]}},img:{attrs:{alt:null,src:null,ismap:null,usemap:null,width:null,height:null,crossorigin:[`anonymous`,`use-credentials`]}},input:{attrs:{alt:null,dirname:null,form:null,formaction:null,height:null,list:null,max:null,maxlength:null,min:null,name:null,pattern:null,placeholder:null,size:null,src:null,step:null,value:null,width:null,accept:[`audio/*`,`video/*`,`image/*`],autocomplete:[`on`,`off`],autofocus:[`autofocus`],checked:[`checked`],disabled:[`disabled`],formenctype:B,formmethod:z,formnovalidate:[`novalidate`],formtarget:L,multiple:[`multiple`],readonly:[`readonly`],required:[`required`],type:[`hidden`,`text`,`search`,`tel`,`url`,`email`,`password`,`datetime`,`date`,`month`,`week`,`time`,`datetime-local`,`number`,`range`,`color`,`checkbox`,`radio`,`file`,`submit`,`image`,`reset`,`button`]}},ins:{attrs:{cite:null,datetime:null}},kbd:H,keygen:{attrs:{challenge:null,form:null,name:null,autofocus:[`autofocus`],disabled:[`disabled`],keytype:[`RSA`]}},label:{attrs:{for:null,form:null}},legend:H,li:{attrs:{value:null}},link:{attrs:{href:null,type:null,hreflang:null,media:null,sizes:[`all`,`16x16`,`16x16 32x32`,`16x16 32x32 64x64`]}},map:{attrs:{name:null}},mark:H,menu:{attrs:{label:null,type:[`list`,`context`,`toolbar`]}},meta:{attrs:{content:null,charset:R,name:[`viewport`,`application-name`,`author`,`description`,`generator`,`keywords`],"http-equiv":[`content-language`,`content-type`,`default-style`,`refresh`]}},meter:{attrs:{value:null,min:null,low:null,high:null,max:null,optimum:null}},nav:H,noscript:H,object:{attrs:{data:null,type:null,name:null,usemap:null,form:null,width:null,height:null,typemustmatch:[`typemustmatch`]}},ol:{attrs:{reversed:[`reversed`],start:null,type:[`1`,`a`,`A`,`i`,`I`]},children:[`li`,`script`,`template`,`ul`,`ol`]},optgroup:{attrs:{disabled:[`disabled`],label:null}},option:{attrs:{disabled:[`disabled`],label:null,selected:[`selected`],value:null}},output:{attrs:{for:null,form:null,name:null}},p:H,param:{attrs:{name:null,value:null}},pre:H,progress:{attrs:{value:null,max:null}},q:{attrs:{cite:null}},rp:H,rt:H,ruby:H,samp:H,script:{attrs:{type:[`text/javascript`],src:null,async:[`async`],defer:[`defer`],charset:R}},section:H,select:{attrs:{form:null,name:null,size:null,autofocus:[`autofocus`],disabled:[`disabled`],multiple:[`multiple`]}},slot:{attrs:{name:null}},small:H,source:{attrs:{src:null,type:null,media:null}},span:H,strong:H,style:{attrs:{type:[`text/css`],media:null,scoped:null}},sub:H,summary:H,sup:H,table:H,tbody:H,td:{attrs:{colspan:null,rowspan:null,headers:null}},template:H,textarea:{attrs:{dirname:null,form:null,maxlength:null,name:null,placeholder:null,rows:null,cols:null,autofocus:[`autofocus`],disabled:[`disabled`],readonly:[`readonly`],required:[`required`],wrap:[`soft`,`hard`]}},tfoot:H,th:{attrs:{colspan:null,rowspan:null,headers:null,scope:[`row`,`col`,`rowgroup`,`colgroup`]}},thead:H,time:{attrs:{datetime:null}},title:H,tr:H,track:{attrs:{src:null,label:null,default:null,kind:[`subtitles`,`captions`,`descriptions`,`chapters`,`metadata`],srclang:null}},ul:{children:[`li`,`script`,`template`,`ul`,`ol`]},var:H,video:{attrs:{src:null,poster:null,width:null,height:null,crossorigin:[`anonymous`,`use-credentials`],preload:[`auto`,`metadata`,`none`],autoplay:[`autoplay`],mediagroup:[`movie`],muted:[`muted`],controls:[`controls`]}},wbr:H},U={accesskey:null,class:null,contenteditable:V,contextmenu:null,dir:[`ltr`,`rtl`,`auto`],draggable:[`true`,`false`,`auto`],dropzone:[`copy`,`move`,`link`,`string:`,`file:`],hidden:[`hidden`],id:null,inert:[`inert`],itemid:null,itemprop:null,itemref:null,itemscope:[`itemscope`],itemtype:null,lang:[`ar`,`bn`,`de`,`en-GB`,`en-US`,`es`,`fr`,`hi`,`id`,`ja`,`pa`,`pt`,`ru`,`tr`,`zh`],spellcheck:V,autocorrect:V,autocapitalize:V,style:null,tabindex:null,title:null,translate:[`yes`,`no`],rel:[`stylesheet`,`alternate`,`author`,`bookmark`,`help`,`license`,`next`,`nofollow`,`noreferrer`,`prefetch`,`prev`,`search`,`tag`],role:`alert application article banner button cell checkbox complementary contentinfo dialog document feed figure form grid gridcell heading img list listbox listitem main navigation region row rowgroup search switch tab table tabpanel textbox timer`.split(` `),"aria-activedescendant":null,"aria-atomic":V,"aria-autocomplete":[`inline`,`list`,`both`,`none`],"aria-busy":V,"aria-checked":[`true`,`false`,`mixed`,`undefined`],"aria-controls":null,"aria-describedby":null,"aria-disabled":V,"aria-dropeffect":null,"aria-expanded":[`true`,`false`,`undefined`],"aria-flowto":null,"aria-grabbed":[`true`,`false`,`undefined`],"aria-haspopup":V,"aria-hidden":V,"aria-invalid":[`true`,`false`,`grammar`,`spelling`],"aria-label":null,"aria-labelledby":null,"aria-level":null,"aria-live":[`off`,`polite`,`assertive`],"aria-multiline":V,"aria-multiselectable":V,"aria-owns":null,"aria-posinset":null,"aria-pressed":[`true`,`false`,`mixed`,`undefined`],"aria-readonly":V,"aria-relevant":null,"aria-required":V,"aria-selected":[`true`,`false`,`undefined`],"aria-setsize":null,"aria-sort":[`ascending`,`descending`,`none`,`other`],"aria-valuemax":null,"aria-valuemin":null,"aria-valuenow":null,"aria-valuetext":null},W=`beforeunload copy cut dragstart dragover dragleave dragenter dragend drag paste focus blur change click load mousedown mouseenter mouseleave mouseup keydown keyup resize scroll unload`.split(` `).map(e=>`on`+e);for(let e of W)U[e]=null;var G=class{constructor(e,t){this.tags={...Je,...e},this.globalAttrs={...U,...t},this.allTags=Object.keys(this.tags),this.globalAttrNames=Object.keys(this.globalAttrs)}};G.default=new G;function K(e,t,n=e.length){if(!t)return``;let r=t.firstChild,i=r&&r.getChild(`TagName`);return i?e.sliceString(i.from,Math.min(i.to,n)):``}function q(e,t=!1){for(;e;e=e.parent)if(e.name==`Element`){if(t)t=!1;else return e}return null}function J(e,t,n){return n.tags[K(e,q(t))]?.children||n.allTags}function Y(e,t){let n=[];for(let r=q(t);r&&!r.type.isTop;r=q(r.parent)){let i=K(e,r);if(i&&r.lastChild.name==`CloseTag`)break;i&&n.indexOf(i)<0&&(t.name==`EndTag`||t.from>=r.firstChild.to)&&n.push(i)}return n}var X=/^[:\-\.\w\u00b7-\uffff]*$/;function Z(e,t,n,r,i){let a=/\s*>/.test(e.sliceDoc(i,i+5))?``:`>`,o=q(n,n.name==`StartTag`||n.name==`TagName`);return{from:r,to:i,options:J(e.doc,o,t).map(e=>({label:e,type:`type`})).concat(Y(e.doc,n).map((e,t)=>({label:`/`+e,apply:`/`+e+a,type:`type`,boost:99-t}))),validFor:/^\/?[:\-\.\w\u00b7-\uffff]*$/}}function Ye(e,t,n,r){let i=/\s*>/.test(e.sliceDoc(r,r+5))?``:`>`;return{from:n,to:r,options:Y(e.doc,t).map((e,t)=>({label:e,apply:e+i,type:`type`,boost:99-t})),validFor:X}}function Xe(e,t,n,r){let i=[],a=0;for(let r of J(e.doc,n,t))i.push({label:`<`+r,type:`type`});for(let t of Y(e.doc,n))i.push({label:`</`+t+`>`,type:`type`,boost:99-a++});return{from:r,to:r,options:i,validFor:/^<\/?[:\-\.\w\u00b7-\uffff]*$/}}function Ze(e,t,n,r,i){let a=q(n),o=a?t.tags[K(e.doc,a)]:null,s=o&&o.attrs?Object.keys(o.attrs):[];return{from:r,to:i,options:(o&&o.globalAttrs===!1?s:s.length?s.concat(t.globalAttrNames):t.globalAttrNames).map(e=>({label:e,type:`property`})),validFor:X}}function Qe(e,t,n,r,i){let a=n.parent?.getChild(`AttributeName`),o=[],s;if(a){let c=e.sliceDoc(a.from,a.to),l=t.globalAttrs[c];if(!l){let r=q(n),i=r?t.tags[K(e.doc,r)]:null;l=i?.attrs&&i.attrs[c]}if(l){let t=e.sliceDoc(r,i).toLowerCase(),n=`"`,a=`"`;/^['"]/.test(t)?(s=t[0]==`"`?/^[^"]*$/:/^[^']*$/,n=``,a=e.sliceDoc(i,i+1)==t[0]?``:t[0],t=t.slice(1),r++):s=/^[^\s<>='"]*$/;for(let e of l)o.push({label:e,apply:n+e+a,type:`constant`})}}return{from:r,to:i,options:o,validFor:s}}function Q(e,t){let{state:n,pos:r}=t,a=i(n).resolveInner(r,-1),o=a.resolve(r);for(let e=r,t;o==a&&(t=a.childBefore(e));){let n=t.lastChild;if(!n||!n.type.isError||n.from<n.to)break;o=a=t,e=n.from}return a.name==`TagName`?a.parent&&/CloseTag$/.test(a.parent.name)?Ye(n,a,a.from,r):Z(n,e,a,a.from,r):a.name==`StartTag`||a.name==`IncompleteTag`?Z(n,e,a,r,r):a.name==`StartCloseTag`||a.name==`IncompleteCloseTag`?Ye(n,a,r,r):a.name==`OpenTag`||a.name==`SelfClosingTag`||a.name==`AttributeName`?Ze(n,e,a,a.name==`AttributeName`?a.from:r,r):a.name==`Is`||a.name==`AttributeValue`||a.name==`UnquotedAttributeValue`?Qe(n,e,a,a.name==`Is`?r:a.from,r):t.explicit&&(o.name==`Element`||o.name==`Text`||o.name==`Document`)?Xe(n,e,a,r):null}function $e(e){return Q(G.default,e)}function et(e){let{extraTags:t,extraGlobalAttributes:n}=e,r=n||t?new G(t,n):G.default;return e=>Q(r,e)}var tt=f.parser.configure({top:`SingleExpression`}),nt=[{tag:`script`,attrs:e=>e.type==`text/typescript`||e.lang==`ts`,parser:se.parser},{tag:`script`,attrs:e=>e.type==`text/babel`||e.type==`text/jsx`,parser:ae.parser},{tag:`script`,attrs:e=>e.type==`text/typescript-jsx`,parser:ie.parser},{tag:`script`,attrs(e){return/^(importmap|speculationrules|application\/(.+\+)?json)$/i.test(e.type)},parser:tt},{tag:`script`,attrs(e){return!e.type||/^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^module$|^$/i.test(e.type)},parser:f.parser},{tag:`style`,attrs(e){return(!e.lang||e.lang==`css`)&&(!e.type||/^(text\/)?(x-)?(stylesheet|css)$/i.test(e.type))},parser:d.parser}],rt=[{name:`style`,parser:d.parser.configure({top:`Styles`})}].concat(W.map(e=>({name:e,parser:f.parser}))),it=ee.define({name:`html`,parser:qe.configure({props:[a.add({Element(e){let t=/^(\s*)(<\/)?/.exec(e.textAfter);return e.node.to<=e.pos+t[0].length?e.continue():e.lineIndent(e.node.from)+(t[2]?0:e.unit)},"OpenTag CloseTag SelfClosingTag"(e){return e.column(e.node.from)+e.unit},Document(e){if(e.pos+/\s*/.exec(e.textAfter)[0].length<e.node.to)return e.continue();let t=null,n;for(let n=e.node;;){let e=n.lastChild;if(!e||e.name!=`Element`||e.to!=n.to)break;t=n=e}return t&&!((n=t.lastChild)&&(n.name==`CloseTag`||n.name==`SelfClosingTag`))?e.lineIndent(t.from)+e.unit:null}}),l.add({Element(e){let t=e.firstChild,n=e.lastChild;return!t||t.name!=`OpenTag`?null:{from:t.to,to:n.name==`CloseTag`?n.from:e.to}}}),c.add({"OpenTag CloseTag":e=>e.getChild(`TagName`)})]}),languageData:{commentTokens:{block:{open:`<!--`,close:`-->`}},indentOnInput:/^\s*<\/\w+\W$/,wordChars:`-_`}}),$=it.configure({wrap:I(nt,rt)});function at(e={}){let t=``,n;e.matchClosingTags===!1&&(t=`noMatch`),e.selfClosingTags===!0&&(t=(t?t+` `:``)+`selfClosing`),(e.nestedLanguages&&e.nestedLanguages.length||e.nestedAttributes&&e.nestedAttributes.length)&&(n=I((e.nestedLanguages||[]).concat(nt),(e.nestedAttributes||[]).concat(rt)));let r=n?it.configure({wrap:n,dialect:t}):t?$.configure({dialect:t}):$;return new o(r,[$.data.of({autocomplete:et(e)}),e.autoCloseTags===!1?[]:ct,oe().support,re().support])}var ot=new Set(`area base br col command embed frame hr img input keygen link meta param source track wbr menuitem`.split(` `));function st(e,t,n){for(;;){if(t.lastChild?.name!=`CloseTag`)return!1;let r=t.parent;if(!r||K(e,r)!=n)return!0;t=r}}var ct=t.inputHandler.of((e,t,n,r,a)=>{if(e.composing||e.state.readOnly||t!=n||r!=`>`&&r!=`/`||!$.isActiveAt(e.state,t,-1))return!1;let o=a(),{state:c}=o,l=c.changeByRange(e=>{let t=c.doc.sliceString(e.from-1,e.to)==r,{head:n}=e,a=i(c).resolveInner(n,-1),o;if(t&&r==`>`&&a.name==`EndTag`){let t=a.parent;if((o=K(c.doc,t.parent,n))&&!ot.has(o)&&!st(c.doc,t.parent,o))return{range:e,changes:{from:n,to:n+ +(c.doc.sliceString(n,n+1)===`>`),insert:`</${o}>`}}}else if(t&&r==`/`&&a.name==`IncompleteCloseTag`){let e=a.parent;if(a.from==n-2&&e.lastChild?.name!=`CloseTag`&&(o=K(c.doc,e,n))&&!ot.has(o)){let e=n+ +(c.doc.sliceString(n,n+1)===`>`),t=`${o}>`;return{range:s.cursor(n+t.length,-1),changes:{from:n,to:e,insert:t}}}}return{range:e}});return!l.changes.empty&&(e.dispatch([o,c.update(l,{userEvent:`input.complete`,scrollIntoView:!0})]),!0)});export{at as html,$e as htmlCompletionSource};
|