@vertesia/ui 1.5.0-dev.20260826.064249Z → 1.5.0-dev.20260901.033115Z

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.
Files changed (130) hide show
  1. package/lib/core/components/FormItem.d.ts.map +1 -1
  2. package/lib/core/components/FormItem.js +2 -3
  3. package/lib/core/components/FormItem.js.map +1 -1
  4. package/lib/core/components/InfoTip.d.ts +20 -0
  5. package/lib/core/components/InfoTip.d.ts.map +1 -0
  6. package/lib/core/components/InfoTip.js +18 -0
  7. package/lib/core/components/InfoTip.js.map +1 -0
  8. package/lib/core/components/index.d.ts +1 -0
  9. package/lib/core/components/index.d.ts.map +1 -1
  10. package/lib/core/components/index.js +1 -0
  11. package/lib/core/components/index.js.map +1 -1
  12. package/lib/core/components/shadcn/Panel.d.ts.map +1 -1
  13. package/lib/core/components/shadcn/Panel.js +3 -3
  14. package/lib/core/components/shadcn/Panel.js.map +1 -1
  15. package/lib/features/store/objects/search/DocumentSearchContext.d.ts +15 -0
  16. package/lib/features/store/objects/search/DocumentSearchContext.d.ts.map +1 -1
  17. package/lib/features/store/objects/search/DocumentSearchContext.js +45 -2
  18. package/lib/features/store/objects/search/DocumentSearchContext.js.map +1 -1
  19. package/lib/features/store/objects/selection/actions/DeleteObjectsAction.d.ts.map +1 -1
  20. package/lib/features/store/objects/selection/actions/DeleteObjectsAction.js +5 -0
  21. package/lib/features/store/objects/selection/actions/DeleteObjectsAction.js.map +1 -1
  22. package/lib/features/store/types/IntakePolicyEditor.d.ts.map +1 -1
  23. package/lib/features/store/types/IntakePolicyEditor.js +1 -1
  24. package/lib/features/store/types/IntakePolicyEditor.js.map +1 -1
  25. package/lib/features/store/types/IntakePolicyForm.d.ts.map +1 -1
  26. package/lib/features/store/types/IntakePolicyForm.js +15 -15
  27. package/lib/features/store/types/IntakePolicyForm.js.map +1 -1
  28. package/lib/features/store/types/TypeRegistry.d.ts +10 -0
  29. package/lib/features/store/types/TypeRegistry.d.ts.map +1 -1
  30. package/lib/features/store/types/search/ObjectTypeSearchContext.d.ts +10 -0
  31. package/lib/features/store/types/search/ObjectTypeSearchContext.d.ts.map +1 -1
  32. package/lib/i18n/locales/ar.json +35 -0
  33. package/lib/i18n/locales/de.json +35 -0
  34. package/lib/i18n/locales/en.json +35 -0
  35. package/lib/i18n/locales/es.json +35 -0
  36. package/lib/i18n/locales/fr.json +35 -0
  37. package/lib/i18n/locales/it.json +35 -0
  38. package/lib/i18n/locales/ja.json +35 -0
  39. package/lib/i18n/locales/ko.json +35 -0
  40. package/lib/i18n/locales/pt.json +35 -0
  41. package/lib/i18n/locales/ru.json +35 -0
  42. package/lib/i18n/locales/tr.json +35 -0
  43. package/lib/i18n/locales/zh-TW.json +35 -0
  44. package/lib/i18n/locales/zh.json +35 -0
  45. package/lib/router/RouteComponent.d.ts +8 -0
  46. package/lib/router/RouteComponent.d.ts.map +1 -1
  47. package/lib/router/RouteComponent.js +41 -9
  48. package/lib/router/RouteComponent.js.map +1 -1
  49. package/lib/session/UserSessionProvider.d.ts.map +1 -1
  50. package/lib/session/UserSessionProvider.js +12 -13
  51. package/lib/session/UserSessionProvider.js.map +1 -1
  52. package/lib/session/auth/domainRouting.d.ts +11 -0
  53. package/lib/session/auth/domainRouting.d.ts.map +1 -1
  54. package/lib/session/auth/domainRouting.js +13 -0
  55. package/lib/session/auth/domainRouting.js.map +1 -1
  56. package/lib/session/useUXTracking.d.ts.map +1 -1
  57. package/lib/session/useUXTracking.js +6 -1
  58. package/lib/session/useUXTracking.js.map +1 -1
  59. package/lib/vertesia-ui-core.js +199 -4
  60. package/lib/vertesia-ui-core.js.map +1 -1
  61. package/lib/vertesia-ui-features.js +975 -33
  62. package/lib/vertesia-ui-features.js.map +1 -1
  63. package/lib/vertesia-ui-i18n.BJBGsq-8.chunk.js +5 -0
  64. package/lib/vertesia-ui-i18n.BJBGsq-8.chunk.js.map +1 -0
  65. package/lib/vertesia-ui-i18n.BY5YG5cX.chunk.js +5 -0
  66. package/lib/vertesia-ui-i18n.BY5YG5cX.chunk.js.map +1 -0
  67. package/lib/vertesia-ui-i18n.Bd5_1BXO.chunk.js +5 -0
  68. package/lib/vertesia-ui-i18n.Bd5_1BXO.chunk.js.map +1 -0
  69. package/lib/vertesia-ui-i18n.Bvwej2HH.chunk.js +5 -0
  70. package/lib/vertesia-ui-i18n.Bvwej2HH.chunk.js.map +1 -0
  71. package/lib/vertesia-ui-i18n.CMT3f4gf.chunk.js +5 -0
  72. package/lib/vertesia-ui-i18n.CMT3f4gf.chunk.js.map +1 -0
  73. package/lib/vertesia-ui-i18n.D56DNPJW.chunk.js +5 -0
  74. package/lib/vertesia-ui-i18n.D56DNPJW.chunk.js.map +1 -0
  75. package/lib/vertesia-ui-i18n.DDzKLNx6.chunk.js +5 -0
  76. package/lib/vertesia-ui-i18n.DDzKLNx6.chunk.js.map +1 -0
  77. package/lib/vertesia-ui-i18n.D_Am1LpF.chunk.js +5 -0
  78. package/lib/vertesia-ui-i18n.D_Am1LpF.chunk.js.map +1 -0
  79. package/lib/vertesia-ui-i18n.DrZizgGV.chunk.js +5 -0
  80. package/lib/vertesia-ui-i18n.DrZizgGV.chunk.js.map +1 -0
  81. package/lib/vertesia-ui-i18n.DwHsq86z.chunk.js +5 -0
  82. package/lib/vertesia-ui-i18n.DwHsq86z.chunk.js.map +1 -0
  83. package/lib/vertesia-ui-i18n.PLpo0Bbz.chunk.js +5 -0
  84. package/lib/vertesia-ui-i18n.PLpo0Bbz.chunk.js.map +1 -0
  85. package/lib/vertesia-ui-i18n.js +2 -38
  86. package/lib/vertesia-ui-i18n.js.map +1 -1
  87. package/lib/vertesia-ui-i18n.xVbXALqz.chunk.js +5 -0
  88. package/lib/vertesia-ui-i18n.xVbXALqz.chunk.js.map +1 -0
  89. package/lib/vertesia-ui-layout.js +80 -1
  90. package/lib/vertesia-ui-layout.js.map +1 -1
  91. package/lib/vertesia-ui-rich-text.js +278 -4
  92. package/lib/vertesia-ui-rich-text.js.map +1 -1
  93. package/lib/vertesia-ui-router.js +1 -1
  94. package/lib/vertesia-ui-router.js.map +1 -1
  95. package/lib/vertesia-ui-session.js +1 -1
  96. package/lib/vertesia-ui-session.js.map +1 -1
  97. package/lib/vertesia-ui-shell.js +118 -1
  98. package/lib/vertesia-ui-shell.js.map +1 -1
  99. package/lib/vertesia-ui-widgets.js +336 -20
  100. package/lib/vertesia-ui-widgets.js.map +1 -1
  101. package/package.json +7 -7
  102. package/src/core/components/FormItem.tsx +2 -5
  103. package/src/core/components/InfoTip.test.tsx +33 -0
  104. package/src/core/components/InfoTip.tsx +32 -0
  105. package/src/core/components/index.ts +1 -0
  106. package/src/core/components/shadcn/Panel.tsx +3 -7
  107. package/src/features/store/objects/search/DocumentSearchContext.test.ts +45 -0
  108. package/src/features/store/objects/search/DocumentSearchContext.ts +50 -2
  109. package/src/features/store/objects/selection/actions/DeleteObjectsAction.tsx +5 -0
  110. package/src/features/store/types/IntakePolicyEditor.tsx +3 -4
  111. package/src/features/store/types/IntakePolicyForm.tsx +120 -20
  112. package/src/i18n/locales/ar.json +35 -0
  113. package/src/i18n/locales/de.json +35 -0
  114. package/src/i18n/locales/en.json +35 -0
  115. package/src/i18n/locales/es.json +35 -0
  116. package/src/i18n/locales/fr.json +35 -0
  117. package/src/i18n/locales/it.json +35 -0
  118. package/src/i18n/locales/ja.json +35 -0
  119. package/src/i18n/locales/ko.json +35 -0
  120. package/src/i18n/locales/pt.json +35 -0
  121. package/src/i18n/locales/ru.json +35 -0
  122. package/src/i18n/locales/tr.json +35 -0
  123. package/src/i18n/locales/zh-TW.json +35 -0
  124. package/src/i18n/locales/zh.json +35 -0
  125. package/src/router/RouteComponent.test.tsx +139 -0
  126. package/src/router/RouteComponent.tsx +54 -9
  127. package/src/session/UserSessionProvider.tsx +12 -11
  128. package/src/session/auth/domainRouting.test.ts +24 -1
  129. package/src/session/auth/domainRouting.ts +29 -0
  130. package/src/session/useUXTracking.tsx +6 -1
@@ -1,27 +1,343 @@
1
- import{Fragment as e,jsx as t,jsxs as n}from"react/jsx-runtime";import{Button as r,Center as i,DotBadge as a,DropdownMenu as o,DropdownMenuContent as s,DropdownMenuItem as c,DropdownMenuTrigger as l,FormItem as u,MessageBox as d,Modal as f,ModalBody as p,ModalFooter as m,ModalTitle as h,SelectBox as g,Spinner as _,Styles as v,Switch as y,Table as ee,Textarea as b,VTooltip as x,cn as S,errorMessage as te,useClickOutside as C,useFlag as w,useTheme as T,useToast as ne}from"@vertesia/ui/core";import E,{clsx as D}from"clsx";import{AlertCircleIcon as O,AlignLeft as k,BarChart3 as A,Check as re,CheckCircleIcon as j,ChevronDown as M,ChevronRight as ie,Code as ae,Code2 as oe,Copy as se,Download as ce,FileText as le,GitBranch as ue,GitCommitHorizontal as de,Heading2 as fe,Image as N,Info as pe,Link as me,List as he,Loader2 as ge,Maximize2 as _e,MessageSquare as ve,Minimize2 as ye,Pencil as be,Pilcrow as xe,Plus as Se,Quote as P,Send as F,SquarePen as I,Table as L,Table2 as R,Trash2 as Ce,UploadIcon as we,X as Te,XCircleIcon as Ee}from"lucide-react";import z,{Suspense as De,createContext as B,lazy as V,memo as Oe,useCallback as H,useContext as U,useEffect as W,useId as ke,useMemo as G,useRef as K,useState as q}from"react";import Ae from"ajv";import je from"ajv-formats";import{useUITranslation as J}from"@vertesia/ui/i18n";import Me from"debounce";import{FusionFragmentHandler as Ne,FusionFragmentProvider as Pe}from"@vertesia/fusion-ux";import Fe from"dompurify";import*as Y from"@radix-ui/react-dialog";import{useUserSession as Ie}from"@vertesia/ui/session";import Le from"papaparse";import{twMerge as Re}from"tailwind-merge";import ze,{defaultUrlTransform as Be}from"react-markdown";import{defListHastHandlers as Ve,remarkDefinitionList as He}from"remark-definition-list";import Ue from"remark-directive";import We from"remark-gfm";import Ge from"remark-github-blockquote-alert";import Ke from"remark-math";import qe from"remark-supersub";import{SKIP as Je,visit as Ye}from"unist-util-visit";import{XMLParser as Xe}from"fast-xml-parser";import{isNil as Ze,omit as Qe}from"lodash-es";const $e=B(void 0),et=$e.Provider;function tt(){let e=U($e);if(!e)throw Error(`useFieldSet must be used within a Form or FieldSet element`);return e}var nt=class{object;components;disabled;constructor(e,t={},n=!1){this.object=e,this.components=t,this.disabled=n}};const rt=B(void 0);function it(){let e=U(rt);if(!e)throw Error(`useForm must be used within a Form element`);return e}const at=rt.Provider,ot=z.forwardRef(({object:e,type:n=`text`,onChange:r,...i},a)=>{let[o,s]=q(e.value==null?``:String(e.value)),[c,l]=q(e.schema.isBoolean&&e.value===!0);i.className=i.className?E(v.INPUT,i.className):v.INPUT;let u=t=>{i.disabled||(s(t.target.value),e.schema.isBoolean?(e.value=t.target.checked,l(e.value)):e.value=t.target.value,r?.(t))};return n===`textarea`?t(`textarea`,{ref:a,...i,value:o,onChange:u}):n===`checkbox`?t(`input`,{ref:a,...i,type:`checkbox`,checked:c,onChange:u,className:`form-check-input`}):t(`input`,{ref:a,...i,type:n,value:o,onChange:u})});function st({object:e,components:n,onSubmit:r,children:i,onChange:a,disabled:o}){return e.observer=a,t(at,{value:new nt(e,n||{},o??!1),children:t(`form`,{className:`w-full`,onSubmit:t=>{t.stopPropagation(),t.preventDefault(),r?.(e.value)},children:i})})}function ct(){let e=it();return t(`div`,{className:`flex flex-col gap-4 w-full`,children:e.object.properties.map(ut)})}function lt({children:e,...r}){return n(st,{...r,children:[t(ct,{}),e]})}function ut(e){return e.isList?t(mt,{object:e},e.name):e.isObject?t(pt,{object:e},e.name):t(ft,{object:e},e.name)}function dt(e,n){return e.isList?t(mt,{object:e}):e.isObject?t(pt,{object:e}):t(ft,{object:e,editor:n})}function ft({object:e,editor:n,inline:r=!1}){n||=e.schema.editor;let{components:i,disabled:a}=it(),o=n&&i[n]||ot,s=e.getInputType();s===`checkbox`&&(r=!0);let c=t=>{a||(e.value=e.schema.isBoolean?t.target instanceof HTMLInputElement&&t.target.checked:e.schema.isNumber?parseFloat(t.target.value):t.target.value)};return e.isListItem?t(o,{object:e,type:s,onChange:c,disabled:a}):t(u,{label:e.title,required:e.schema.isRequired,description:e.schema.description,className:E(`flex`,r?`flex-row items-center`:`flex-col`),children:t(o,{object:e,type:s,onChange:c,disabled:a})})}function pt({object:e}){return n(`div`,{className:`flex flex-col gap-4 my-4 py-2 ps-4 border-s-4 border-s-solid border-s-slate-100 dark:border-s-slate-600`,children:[!e.isListItem&&t(`div`,{className:`text-gray-900 dark:text-gray-200 font-semibold`,children:e.title}),e.properties.map(ut)]})}function mt({object:e}){let{disabled:i}=it(),a=K((e.value??[]).length),[o,s]=q(()=>(e.value??[]).map((e,t)=>t)),c=()=>{i||(e.add(),s(e=>[...e,a.current++]))},l=t=>{i||(e.remove(t),s(e=>e.filter((e,n)=>n!==t)))};return n(`div`,{className:`flex flex-col gap-4 my-4 py-2 ps-4 border-s-4 border-s-solid border-s-slate-100 darK:border-s-slate-600`,children:[!e.isListItem&&t(`div`,{className:`text-gray-900 dark:text-gray-200 font-semibold`,children:e.title}),e.items.map((n,r)=>{let a=o[r];return t(ht,{object:n,list:e,onDelete:()=>l(r),disabled:i},a)}),t(`div`,{children:n(r,{variant:`outline`,onClick:c,disabled:i,children:[t(Se,{className:`size-6`}),` Add`]})})]})}function ht({list:e,object:i,onDelete:a,disabled:o}){let s=typeof e.schema.arraySchema.editor==`string`?e.schema.arraySchema.editor:void 0;return n(`div`,{className:`flex gap-2 w-full`,children:[t(`div`,{className:`flex-1`,children:dt(i,s)}),t(r,{variant:`ghost`,onClick:a,disabled:o,title:`Delete`,children:t(Ce,{className:`size-4 text-destructive`})})]})}function gt({label:e,required:n,children:r}){return t(u,{label:e,required:n,children:r})}function _t({children:e}){return t(`p`,{className:`mt-2 text-sm text-gray-500`,children:e})}function vt({children:e}){return t(`p`,{className:`mt-2 text-sm text-red-600`,children:e})}function yt(e){return e===`object`?{type:`object`,properties:{}}:e===`array`?{type:`array`,items:{}}:{type:e}}var bt=class{schema;properties={};_validator;constructor(e){this.schema=e||{type:`object`,properties:{}},this.load()}get validator(){if(!this._validator){let e=new Ae({allErrors:!0,strict:!1});je(e),this._validator=e.compile(this.schema)}return this._validator}load(){if(this.schema.properties){let e=this.schema.properties;Object.keys(e).forEach(t=>{this.loadProperty(t,e[t])})}}hasProperties(){return Object.keys(this.properties).length>0}get title(){let e=this.schema.title;if(typeof e==`string`)return e;let t=this.schema.name;return typeof t==`string`?t:void 0}get description(){return this.schema.description}loadProperty(e,t){let n;return n=t.type===`array`?new Ct(this,e,t):new xt(this,e,t),this.properties[e]=n,n}get type(){return this.schema.type}validate(e){return this.validator(e)?null:this.validator.errors||[]}addProperty(e,t,n=!1){this.schema.type!==`object`&&(this.schema.type=`object`),this.schema.properties||(this.schema.properties={});let r=typeof t==`string`?yt(t):t,i=this.loadProperty(e,r);return this.schema.properties[i.name]=i.schema,n&&(i.isRequired=!0),i}removeProperty(e){this.schema.properties&&(delete this.schema.properties[e],Array.isArray(this.schema.required)&&(this.schema.required=this.schema.required.filter(t=>t!==e))),delete this.properties[e]}getProperty(e){return this.properties[e]}get editor(){return typeof this.schema.editor==`string`?this.schema.editor:void 0}},xt=class extends bt{parent;name;constructor(e,t,n){if(super(n),this.parent=e,this.name=t,n.type===`array`)throw Error(`Array property must be instantiated using ArrayPropertySchema`);n.type===`object`&&!n.properties&&(n.properties={})}get isMulti(){return!1}get isReadOnly(){return!!this.schema.readOnly}set isReadOnly(e){this.schema.readOnly=e}get defaultValue(){return this.schema.default}set defaultValue(e){this.schema.default=e}get enum(){return this.schema.enum}set enum(e){this.schema.enum=e}get isRequired(){let e=this.parent.schema.required;return e?e.includes(this.name):!1}set isRequired(e){let t=Array.isArray(this.parent.schema.required)?this.parent.schema.required:[];t=e?t.concat(this.name):t.filter(e=>e!==this.name),this.parent.schema.required=t}get type(){return this.schema.type}set type(e){this.schema.type!==e&&(this.schema.type=e,e!==`object`&&(this.properties={},this.schema.properties=void 0))}remove(){this.parent.removeProperty(this.name)}get isBoolean(){return this.type===`boolean`}get isString(){return this.type===`string`}get isNumber(){return this.type===`number`||this.type===`integer`}get isObject(){return this.type===`object`}};function St(e){if(e.type!==`array`)throw Error(`Expecting an array schema`);if(!e.items)e.items={};else if(Array.isArray(e.items))throw Error(`Tuple arrays are not supported`);return e.items}var Ct=class extends xt{arraySchema;constructor(e,t,n){super(e,t,St(n)),this.arraySchema=n}get isMulti(){return!0}};function wt(e){return e=e.replace(/_/g,` `).replace(/([a-z0-9])&([A-Z])/g,`$1 $2`),e[0].toUpperCase()+e.slice(1)}function Tt(e,t){if(t.editor)return t.editor;if(t.schema.format)return t.schema.format;switch(t.type){case`number`:case`integer`:return`number`;case`boolean`:return`checkbox`;case`string`:return`text`;default:return`text`}}var Et=class{parent;schema;name;observer;constructor(e,t,n){this.parent=e,this.schema=t,this.name=n}get isRoot(){return!this.parent}get root(){return this.parent?this.parent.root:this}get path(){return this.parent?this.parent.path.concat(this.name):[]}get isScalar(){return!1}get isListItem(){return!1}get isObject(){return!1}get isList(){return!1}get title(){return this.schema.title||wt(this.name)}onChange(e){this.observer&&this.observer(this)===!1||this.parent?.onChange(e)}},Dt=class extends Et{get isObject(){return!0}getProperty(e){let t=this.schema.properties[e];return t.isMulti?new jt(this,t,this.getOrInitArrayProperty(e)):t.isObject?new kt(this,t,t.name,this.getOrInitObjectProperty(e)):new At(this,t)}getOrInitObjectProperty(e){let t=this.value[e];return t||(this.value[e]=t={}),t}getOrInitArrayProperty(e){let t=this.value[e];return t||(this.value[e]=t=[]),t}setPropertyValue(e,t){return this.value[e]!==t&&(this.value[e]=t,!0)}getPropertyValue(e){return this.value[e]}get properties(){let e=[];for(let t of Object.values(this.schema.properties))t.isMulti?e.push(new jt(this,t,this.getOrInitArrayProperty(t.name))):t.isObject?e.push(new kt(this,t,t.name,this.getOrInitObjectProperty(t.name))):e.push(new At(this,t));return e}[Symbol.iterator](){return this.properties[Symbol.iterator]()}},Ot=class extends Dt{value;constructor(e,t={}){super(null,e instanceof bt?e:new bt(e),`#root`),this.value=t}},kt=class extends Dt{value;constructor(e,t,n,r){super(e,t,n),this.value=r}},At=class extends Et{constructor(e,t){super(e,t,t.name),e.value[this.name]===void 0&&t.defaultValue!==void 0&&(e.value[this.name]=t.defaultValue)}get isScalar(){return!0}set value(e){this.parent.setPropertyValue(this.name,e)&&this.onChange(this)}get value(){return this.parent.getPropertyValue(this.name)}getInputType(){return Tt(this.name,this.schema)}},jt=class extends Et{value;items=[];constructor(e,t,n){super(e,t,t.name),this.value=n;for(let e of this.value)this.add()}get isList(){return!0}newItem(e){return this.schema.isObject?new Mt(this,e):new Nt(this,e)}add(){let e=this.newItem(this.items.length);return this.items.push(e),e}remove(e){let t=this.value;if(e>=0&&e<this.items.length){this.items.splice(e,1);for(let e=0,t=this.items.length;e<t;e++){let t=this.items[e];t.index=e,t.name=String(e)}}Array.isArray(t)&&e>=0&&e<t.length&&(t.splice(e,1),this.onChange(this))}[Symbol.iterator](){return this.items[Symbol.iterator]()}item(e){if(e<0||e>=this.value.length)return;let t=this.value[e];return this.schema.isObject?new kt(this,this.schema,String(e),t):new Nt(this,e)}trim(){for(;this.items[this.items.length-1]===void 0;)this.items.pop()}},Mt=class extends Dt{index;key;constructor(e,t){super(e,e.schema,String(t)),this.index=t,e.value[t]===void 0&&(e.value[t]={}),this.key=`${this.name}@${Date.now()}`}get isListItem(){return!0}set value(e){this.parent.value[this.index]=e}get value(){return this.parent.value[this.index]}},Nt=class extends Et{index;key;constructor(e,t){super(e,e.schema,String(t)),this.index=t,e.value[t]===void 0&&e.schema.defaultValue!==void 0&&(e.value[t]=e.schema.defaultValue),this.key=`${this.name}@${Date.now()}`}get isScalar(){return!0}get isListItem(){return!0}set value(e){this.parent.value[this.index]=e}get value(){return this.parent.value[this.index]}getInputType(){return Tt(this.name,this.schema)}};function Pt({data:e,className:r}){let i=G(()=>{try{return JSON.stringify(e,null,2)}catch(e){return console.error(`Failed to stringify JSON:`,e),`{}`}},[e]),a=G(()=>i.split(`
2
- `),[i]);return t(`pre`,{className:`h-full overflow-auto rounded-md border bg-background p-3 font-mono text-xs leading-5 text-foreground ${r||``}`,children:t(`code`,{children:a.map((e,t)=>n(`span`,{children:[Lt(e),t<a.length-1?`
3
- `:null]},`line-${t}`))})})}const Ft=/("(?:\\.|[^"\\])*"?)|\b(true|false|null)\b|(-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)/g,It=/^\s*:/;function Lt(e){Ft.lastIndex=0;let n=[],r=0,i=Ft.exec(e);for(;i!==null;){i.index>r&&n.push(e.slice(r,i.index));let[a,o,s,c]=i,l=o!==void 0&&It.test(e.slice(i.index+a.length))?`text-info`:o?`text-success`:s?`text-primary`:c?`text-attention`:void 0;n.push(t(`span`,{className:l,children:a},`${i.index}-${a}`)),r=i.index+a.length,i=Ft.exec(e)}return r<e.length&&n.push(e.slice(r)),n.length?n:e}function Rt({value:e}){return Array.isArray(e)?t(`div`,{className:`flex flex-col gap-4 px-2 h-full overflow-auto`,children:t(Ht,{value:e})}):typeof e!=`object`||!e?t(`div`,{className:`flex flex-col gap-4 px-2 h-full overflow-auto`,children:t(Vt,{name:`value`,value:e})}):t(`div`,{className:`flex flex-col gap-4 px-2 h-full overflow-auto`,children:Object.entries(e).map(([e,n])=>t(Vt,{name:e,value:n},e))})}function zt({name:e}){return t(`div`,{className:`text-sm font-semibold`,children:wt(e)})}function Bt({children:e,className:n}){return t(`div`,{className:E(`flex flex-col gap-4 py-2 ps-4 border-s-4 border-s-solid border-s-slate-100 dark:border-s-slate-600`,n),children:e})}function Vt({name:e,value:r}){let i=Wt(r);switch(i.type){case X.Inline:return n(`div`,{className:`w-full flex gap-2 text-sm`,children:[t(zt,{name:`${e}:`}),t(`p`,{children:i.value})]});case X.Paragraph:return n(`div`,{className:`w-full flex flex-col gap-2 text-sm`,children:[t(zt,{name:e}),t(`p`,{children:i.value})]});case X.Prose:return n(`div`,{className:`prose dark:prose-invert`,children:[t(zt,{name:e}),t(`div`,{className:`vprose prose-sm dark:prose-invert`,children:i.value})]});case X.Array:return t(Ht,{name:e,value:r});case X.Object:return n(`div`,{className:`w-full flex flex-col gap-2 text-sm`,children:[t(zt,{name:e}),t(Bt,{className:`mt-2`,children:Object.entries(r).map(([e,n])=>t(Vt,{name:e,value:n},e))})]})}}function Ht({name:e,value:r}){let i=r.join(` `).length,o=i/r.length,s=typeof r[0]==`string`&&(i<80||i<400&&o<32),c=r.length>9,l=r.map((e,t)=>({item:e,index:t,key:`${t}-${JSON.stringify(e)}`}));return s?n(`div`,{className:`flex gap-2 flex-wrap`,children:[e&&t(zt,{name:`${e}:`}),l.map(({item:e,key:n})=>t(a,{children:String(e)},n))]}):n(`div`,{children:[e&&t(zt,{name:e}),t(`div`,{className:`flex flex-col gap-2`,children:l.map(({item:e,index:n,key:r})=>t(Ut,{index:n,value:e,useBullet:c},r))})]})}function Ut({index:e,value:r,useBullet:i}){let a=i?t(`span`,{className:`text-xl`,children:`•`}):n(`span`,{children:[e+1,`.`]}),o=Wt(r),s;switch(o.type){case X.Object:s=t(Bt,{children:Object.entries(r).map(([e,n])=>t(Vt,{name:e,value:n},e))});break;case X.Array:s=t(Ht,{value:r});break;case X.Prose:s=t(`div`,{className:`prose dark:prose-invert`,children:o.value});break;default:s=t(`div`,{children:o.value})}return n(`div`,{className:`flex gap-4 hover:bg-muted py-2 pe-2 ps-4`,children:[t(`div`,{className:`font-semibold text-muted`,children:a}),t(`div`,{children:s})]})}var X;(function(e){e[e.Inline=0]=`Inline`,e[e.Paragraph=1]=`Paragraph`,e[e.Prose=2]=`Prose`,e[e.Array=3]=`Array`,e[e.Object=4]=`Object`})(X||={});function Wt(e){if(e==null)return{value:`-`,type:X.Inline};if(Array.isArray(e))return{value:e,type:X.Array};if(typeof e==`string`){let t=e.length,n,r=e;return t<80?n=X.Inline:t>400?n=X.Prose:(n=X.Paragraph,r=e.replace(/(?:\n\n)+/g,`
1
+ import{Fragment as e,jsx as t,jsxs as n}from"react/jsx-runtime";import{Button as r,Center as i,DotBadge as a,DropdownMenu as o,DropdownMenuContent as s,DropdownMenuItem as c,DropdownMenuTrigger as l,FormItem as u,MessageBox as d,Modal as f,ModalBody as p,ModalFooter as m,ModalTitle as h,SelectBox as g,Spinner as _,Styles as v,Switch as y,Table as b,Textarea as x,VTooltip as S,cn as C,errorMessage as w,useClickOutside as T,useFlag as E,useTheme as D,useToast as O}from"@vertesia/ui/core";import k,{clsx as A}from"clsx";import*as j from"react";import M,{Suspense as ee,createContext as N,createElement as te,forwardRef as P,lazy as ne,memo as re,useCallback as F,useContext as ie,useEffect as I,useId as ae,useMemo as L,useRef as R,useState as z}from"react";import oe from"ajv";import se from"ajv-formats";import{useUITranslation as B}from"@vertesia/ui/i18n";import ce from"debounce";import{FusionFragmentHandler as le,FusionFragmentProvider as ue}from"@vertesia/fusion-ux";import de from"dompurify";import{DismissableLayer as fe,useDismissableLayerSurface as pe}from"@radix-ui/react-dismissable-layer";import{FocusScope as me}from"@radix-ui/react-focus-scope";import*as he from"react-dom";import{useFocusGuards as ge}from"@radix-ui/react-focus-guards";import{RemoveScroll as _e}from"react-remove-scroll";import{hideOthers as ve}from"aria-hidden";import{useUserSession as ye}from"@vertesia/ui/session";import be from"papaparse";import{twMerge as xe}from"tailwind-merge";import{XMLParser as V}from"fast-xml-parser";import{isNil as Se,omit as Ce}from"lodash-es";var we=Object.create,Te=Object.defineProperty,Ee=Object.getOwnPropertyDescriptor,De=Object.getOwnPropertyNames,Oe=Object.getPrototypeOf,ke=Object.prototype.hasOwnProperty,Ae=(e,t,n)=>()=>{if(n)throw n[0];try{return e&&(t=e(e=0)),t}catch(e){throw n=[e],e}},je=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),Me=(e,t)=>{let n={};for(var r in e)Te(n,r,{get:e[r],enumerable:!0});return t||Te(n,Symbol.toStringTag,{value:`Module`}),n},Ne=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=De(t),a=0,o=i.length,s;a<o;a++)s=i[a],!ke.call(e,s)&&s!==n&&Te(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=Ee(t,s))||r.enumerable});return e},Pe=(e,t,n)=>(n=e==null?{}:we(Oe(e)),Ne(t||!e||!e.__esModule||!ke.call(e,`default`)?Te(n,`default`,{value:e,enumerable:!0}):n,e)),Fe=e=>ke.call(e,`module.exports`)?e[`module.exports`]:Ne(Te({},`__esModule`,{value:!0}),e);
2
+ /**
3
+ * @license lucide-react v1.31.0 - ISC
4
+ *
5
+ * This source code is licensed under the ISC license.
6
+ * See the LICENSE file in the root directory of this source tree.
7
+ */
8
+ const Ie=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),Le=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),Re=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),ze=e=>{
9
+ /**
10
+ * @license lucide-react v1.31.0 - ISC
11
+ *
12
+ * This source code is licensed under the ISC license.
13
+ * See the LICENSE file in the root directory of this source tree.
14
+ */
15
+ /**
16
+ * @license lucide-react v1.31.0 - ISC
17
+ *
18
+ * This source code is licensed under the ISC license.
19
+ * See the LICENSE file in the root directory of this source tree.
20
+ */
21
+ /**
22
+ * @license lucide-react v1.31.0 - ISC
23
+ *
24
+ * This source code is licensed under the ISC license.
25
+ * See the LICENSE file in the root directory of this source tree.
26
+ */
27
+ let t=Re(e);return t.charAt(0).toUpperCase()+t.slice(1)};
28
+ /**
29
+ * @license lucide-react v1.31.0 - ISC
30
+ *
31
+ * This source code is licensed under the ISC license.
32
+ * See the LICENSE file in the root directory of this source tree.
33
+ */
34
+ var Be={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`};
35
+ /**
36
+ * @license lucide-react v1.31.0 - ISC
37
+ *
38
+ * This source code is licensed under the ISC license.
39
+ * See the LICENSE file in the root directory of this source tree.
40
+ */
41
+ const Ve=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},He=N({}),Ue=()=>ie(He),We=P(({color:e,size:t,strokeWidth:n,absoluteStrokeWidth:r,className:i=``,children:a,iconNode:o,...s},c)=>{
42
+ /**
43
+ * @license lucide-react v1.31.0 - ISC
44
+ *
45
+ * This source code is licensed under the ISC license.
46
+ * See the LICENSE file in the root directory of this source tree.
47
+ */
48
+ /**
49
+ * @license lucide-react v1.31.0 - ISC
50
+ *
51
+ * This source code is licensed under the ISC license.
52
+ * See the LICENSE file in the root directory of this source tree.
53
+ */
54
+ let{size:l=24,strokeWidth:u=2,absoluteStrokeWidth:d=!1,color:f=`currentColor`,className:p=``}=Ue()??{},m=r??d?Number(n??u)*24/Number(t??l):n??u;return te(`svg`,{ref:c,...Be,width:t??l??Be.width,height:t??l??Be.height,stroke:e??f,strokeWidth:m,className:Ie(`lucide`,p,i),...!a&&!Ve(s)&&{"aria-hidden":`true`},...s},[...o.map(([e,t])=>te(e,t)),...Array.isArray(a)?a:[a]])}),H=(e,t)=>{
55
+ /**
56
+ * @license lucide-react v1.31.0 - ISC
57
+ *
58
+ * This source code is licensed under the ISC license.
59
+ * See the LICENSE file in the root directory of this source tree.
60
+ */
61
+ let n=P(({className:n,...r},i)=>te(We,{ref:i,iconNode:t,className:Ie(`lucide-${Le(ze(e))}`,`lucide-${e}`,n),...r}));return n.displayName=ze(e),n},Ge=H(`chart-column`,[[`path`,{d:`M3 3v16a2 2 0 0 0 2 2h16`,key:`c24i48`}],[`path`,{d:`M18 17V9`,key:`2bz60n`}],[`path`,{d:`M13 17V5`,key:`1frdt8`}],[`path`,{d:`M8 17v-3`,key:`17ska0`}]]),Ke=H(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),qe=H(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),Je=H(`chevron-right`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),Ye=H(`circle-alert`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`12`,x2:`12`,y1:`8`,y2:`12`,key:`1pkeuh`}],[`line`,{x1:`12`,x2:`12.01`,y1:`16`,y2:`16`,key:`4dfq90`}]]),Xe=H(`circle-check-big`,[[`path`,{d:`M21.801 10A10 10 0 1 1 17 3.335`,key:`yps3ct`}],[`path`,{d:`m9 11 3 3L22 4`,key:`1pflzl`}]]),Ze=H(`circle-x`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m15 9-6 6`,key:`1uzhvr`}],[`path`,{d:`m9 9 6 6`,key:`z0biqf`}]]),Qe=H(`code-xml`,[[`path`,{d:`m18 16 4-4-4-4`,key:`1inbqp`}],[`path`,{d:`m6 8-4 4 4 4`,key:`15zrgr`}],[`path`,{d:`m14.5 4-5 16`,key:`e7oirm`}]]),$e=H(`code`,[[`path`,{d:`m16 18 6-6-6-6`,key:`eg8j8`}],[`path`,{d:`m8 6-6 6 6 6`,key:`ppft3o`}]]),et=H(`copy`,[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),tt=H(`download`,[[`path`,{d:`M12 15V3`,key:`m9g1x1`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`path`,{d:`m7 10 5 5 5-5`,key:`brsn70`}]]),nt=H(`file-text`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 9H8`,key:`b1mrlr`}],[`path`,{d:`M16 13H8`,key:`t4e002`}],[`path`,{d:`M16 17H8`,key:`z1uh3a`}]]),rt=H(`git-branch`,[[`path`,{d:`M15 6a9 9 0 0 0-9 9V3`,key:`1cii5b`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}]]),it=H(`git-commit-horizontal`,[[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}],[`line`,{x1:`3`,x2:`9`,y1:`12`,y2:`12`,key:`1dyftd`}],[`line`,{x1:`15`,x2:`21`,y1:`12`,y2:`12`,key:`oup4p8`}]]),at=H(`heading-2`,[[`path`,{d:`M4 12h8`,key:`17cfdx`}],[`path`,{d:`M4 18V6`,key:`1rz3zl`}],[`path`,{d:`M12 18V6`,key:`zqpxq5`}],[`path`,{d:`M21 18h-4c0-4 4-3 4-6 0-1.5-2-2.5-4-1`,key:`9jr5yi`}]]),ot=H(`image`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}],[`circle`,{cx:`9`,cy:`9`,r:`2`,key:`af1f0g`}],[`path`,{d:`m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21`,key:`1xmnt7`}]]),st=H(`info`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 16v-4`,key:`1dtifu`}],[`path`,{d:`M12 8h.01`,key:`e9boi3`}]]),ct=H(`link`,[[`path`,{d:`M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71`,key:`1cjeqo`}],[`path`,{d:`M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71`,key:`19qd67`}]]),lt=H(`list`,[[`path`,{d:`M3 5h.01`,key:`18ugdj`}],[`path`,{d:`M3 12h.01`,key:`nlz23k`}],[`path`,{d:`M3 19h.01`,key:`noohij`}],[`path`,{d:`M8 5h13`,key:`1pao27`}],[`path`,{d:`M8 12h13`,key:`1za7za`}],[`path`,{d:`M8 19h13`,key:`m83p4d`}]]),ut=H(`loader-circle`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]),dt=H(`maximize-2`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`m21 3-7 7`,key:`1l2asr`}],[`path`,{d:`m3 21 7-7`,key:`tjx5ai`}],[`path`,{d:`M9 21H3v-6`,key:`wtvkvv`}]]),ft=H(`message-square`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}]]),pt=H(`minimize-2`,[[`path`,{d:`m14 10 7-7`,key:`oa77jy`}],[`path`,{d:`M20 10h-6V4`,key:`mjg0md`}],[`path`,{d:`m3 21 7-7`,key:`tjx5ai`}],[`path`,{d:`M4 14h6v6`,key:`rmj7iw`}]]),mt=H(`pencil`,[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]),ht=H(`pilcrow`,[[`path`,{d:`M13 4v16`,key:`8vvj80`}],[`path`,{d:`M17 4v16`,key:`7dpous`}],[`path`,{d:`M19 4H9.5a4.5 4.5 0 0 0 0 9H13`,key:`sh4n9v`}]]),gt=H(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),_t=H(`quote`,[[`path`,{d:`M16 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z`,key:`rib7q0`}],[`path`,{d:`M5 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z`,key:`1ymkrd`}]]),vt=H(`send`,[[`path`,{d:`M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z`,key:`1ffxy3`}],[`path`,{d:`m21.854 2.147-10.94 10.939`,key:`12cjpa`}]]),yt=H(`square-pen`,[[`path`,{d:`M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7`,key:`1m0v6g`}],[`path`,{d:`M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z`,key:`ohrbg2`}]]),bt=H(`table-2`,[[`path`,{d:`M9 3H5a2 2 0 0 0-2 2v4m6-6h10a2 2 0 0 1 2 2v4M9 3v18m0 0h10a2 2 0 0 0 2-2V9M9 21H5a2 2 0 0 1-2-2V9m0 0h18`,key:`gugj83`}]]),xt=H(`table`,[[`path`,{d:`M12 3v18`,key:`108xh3`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M3 9h18`,key:`1pudct`}],[`path`,{d:`M3 15h18`,key:`5xshup`}]]),St=H(`text-align-start`,[[`path`,{d:`M21 5H3`,key:`1fi0y6`}],[`path`,{d:`M15 12H3`,key:`6jk70r`}],[`path`,{d:`M17 19H3`,key:`z6ezky`}]]),Ct=H(`trash-2`,[[`path`,{d:`M10 11v6`,key:`nco0om`}],[`path`,{d:`M14 11v6`,key:`outv1u`}],[`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`,key:`miytrc`}],[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`,key:`e791ji`}]]),wt=H(`upload`,[[`path`,{d:`M12 3v12`,key:`1x0j5s`}],[`path`,{d:`m17 8-5-5-5 5`,key:`7q97r8`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}]]),Tt=H(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),Et=N(void 0),Dt=Et.Provider
62
+ /**
63
+ * @license lucide-react v1.31.0 - ISC
64
+ *
65
+ * This source code is licensed under the ISC license.
66
+ * See the LICENSE file in the root directory of this source tree.
67
+ */
68
+ /**
69
+ * @license lucide-react v1.31.0 - ISC
70
+ *
71
+ * This source code is licensed under the ISC license.
72
+ * See the LICENSE file in the root directory of this source tree.
73
+ */
74
+ /**
75
+ * @license lucide-react v1.31.0 - ISC
76
+ *
77
+ * This source code is licensed under the ISC license.
78
+ * See the LICENSE file in the root directory of this source tree.
79
+ */
80
+ /**
81
+ * @license lucide-react v1.31.0 - ISC
82
+ *
83
+ * This source code is licensed under the ISC license.
84
+ * See the LICENSE file in the root directory of this source tree.
85
+ */
86
+ /**
87
+ * @license lucide-react v1.31.0 - ISC
88
+ *
89
+ * This source code is licensed under the ISC license.
90
+ * See the LICENSE file in the root directory of this source tree.
91
+ */
92
+ /**
93
+ * @license lucide-react v1.31.0 - ISC
94
+ *
95
+ * This source code is licensed under the ISC license.
96
+ * See the LICENSE file in the root directory of this source tree.
97
+ */
98
+ /**
99
+ * @license lucide-react v1.31.0 - ISC
100
+ *
101
+ * This source code is licensed under the ISC license.
102
+ * See the LICENSE file in the root directory of this source tree.
103
+ */
104
+ /**
105
+ * @license lucide-react v1.31.0 - ISC
106
+ *
107
+ * This source code is licensed under the ISC license.
108
+ * See the LICENSE file in the root directory of this source tree.
109
+ */
110
+ /**
111
+ * @license lucide-react v1.31.0 - ISC
112
+ *
113
+ * This source code is licensed under the ISC license.
114
+ * See the LICENSE file in the root directory of this source tree.
115
+ */
116
+ /**
117
+ * @license lucide-react v1.31.0 - ISC
118
+ *
119
+ * This source code is licensed under the ISC license.
120
+ * See the LICENSE file in the root directory of this source tree.
121
+ */
122
+ /**
123
+ * @license lucide-react v1.31.0 - ISC
124
+ *
125
+ * This source code is licensed under the ISC license.
126
+ * See the LICENSE file in the root directory of this source tree.
127
+ */
128
+ /**
129
+ * @license lucide-react v1.31.0 - ISC
130
+ *
131
+ * This source code is licensed under the ISC license.
132
+ * See the LICENSE file in the root directory of this source tree.
133
+ */
134
+ /**
135
+ * @license lucide-react v1.31.0 - ISC
136
+ *
137
+ * This source code is licensed under the ISC license.
138
+ * See the LICENSE file in the root directory of this source tree.
139
+ */
140
+ /**
141
+ * @license lucide-react v1.31.0 - ISC
142
+ *
143
+ * This source code is licensed under the ISC license.
144
+ * See the LICENSE file in the root directory of this source tree.
145
+ */
146
+ /**
147
+ * @license lucide-react v1.31.0 - ISC
148
+ *
149
+ * This source code is licensed under the ISC license.
150
+ * See the LICENSE file in the root directory of this source tree.
151
+ */
152
+ /**
153
+ * @license lucide-react v1.31.0 - ISC
154
+ *
155
+ * This source code is licensed under the ISC license.
156
+ * See the LICENSE file in the root directory of this source tree.
157
+ */
158
+ /**
159
+ * @license lucide-react v1.31.0 - ISC
160
+ *
161
+ * This source code is licensed under the ISC license.
162
+ * See the LICENSE file in the root directory of this source tree.
163
+ */
164
+ /**
165
+ * @license lucide-react v1.31.0 - ISC
166
+ *
167
+ * This source code is licensed under the ISC license.
168
+ * See the LICENSE file in the root directory of this source tree.
169
+ */
170
+ /**
171
+ * @license lucide-react v1.31.0 - ISC
172
+ *
173
+ * This source code is licensed under the ISC license.
174
+ * See the LICENSE file in the root directory of this source tree.
175
+ */
176
+ /**
177
+ * @license lucide-react v1.31.0 - ISC
178
+ *
179
+ * This source code is licensed under the ISC license.
180
+ * See the LICENSE file in the root directory of this source tree.
181
+ */
182
+ /**
183
+ * @license lucide-react v1.31.0 - ISC
184
+ *
185
+ * This source code is licensed under the ISC license.
186
+ * See the LICENSE file in the root directory of this source tree.
187
+ */
188
+ /**
189
+ * @license lucide-react v1.31.0 - ISC
190
+ *
191
+ * This source code is licensed under the ISC license.
192
+ * See the LICENSE file in the root directory of this source tree.
193
+ */
194
+ /**
195
+ * @license lucide-react v1.31.0 - ISC
196
+ *
197
+ * This source code is licensed under the ISC license.
198
+ * See the LICENSE file in the root directory of this source tree.
199
+ */
200
+ /**
201
+ * @license lucide-react v1.31.0 - ISC
202
+ *
203
+ * This source code is licensed under the ISC license.
204
+ * See the LICENSE file in the root directory of this source tree.
205
+ */
206
+ /**
207
+ * @license lucide-react v1.31.0 - ISC
208
+ *
209
+ * This source code is licensed under the ISC license.
210
+ * See the LICENSE file in the root directory of this source tree.
211
+ */
212
+ /**
213
+ * @license lucide-react v1.31.0 - ISC
214
+ *
215
+ * This source code is licensed under the ISC license.
216
+ * See the LICENSE file in the root directory of this source tree.
217
+ */
218
+ /**
219
+ * @license lucide-react v1.31.0 - ISC
220
+ *
221
+ * This source code is licensed under the ISC license.
222
+ * See the LICENSE file in the root directory of this source tree.
223
+ */
224
+ /**
225
+ * @license lucide-react v1.31.0 - ISC
226
+ *
227
+ * This source code is licensed under the ISC license.
228
+ * See the LICENSE file in the root directory of this source tree.
229
+ */
230
+ /**
231
+ * @license lucide-react v1.31.0 - ISC
232
+ *
233
+ * This source code is licensed under the ISC license.
234
+ * See the LICENSE file in the root directory of this source tree.
235
+ */
236
+ /**
237
+ * @license lucide-react v1.31.0 - ISC
238
+ *
239
+ * This source code is licensed under the ISC license.
240
+ * See the LICENSE file in the root directory of this source tree.
241
+ */
242
+ /**
243
+ * @license lucide-react v1.31.0 - ISC
244
+ *
245
+ * This source code is licensed under the ISC license.
246
+ * See the LICENSE file in the root directory of this source tree.
247
+ */
248
+ /**
249
+ * @license lucide-react v1.31.0 - ISC
250
+ *
251
+ * This source code is licensed under the ISC license.
252
+ * See the LICENSE file in the root directory of this source tree.
253
+ */
254
+ /**
255
+ * @license lucide-react v1.31.0 - ISC
256
+ *
257
+ * This source code is licensed under the ISC license.
258
+ * See the LICENSE file in the root directory of this source tree.
259
+ */
260
+ /**
261
+ * @license lucide-react v1.31.0 - ISC
262
+ *
263
+ * This source code is licensed under the ISC license.
264
+ * See the LICENSE file in the root directory of this source tree.
265
+ */
266
+ /**
267
+ * @license lucide-react v1.31.0 - ISC
268
+ *
269
+ * This source code is licensed under the ISC license.
270
+ * See the LICENSE file in the root directory of this source tree.
271
+ */
272
+ ;function Ot(){let e=ie(Et);if(!e)throw Error(`useFieldSet must be used within a Form or FieldSet element`);return e}var kt=class{object;components;disabled;constructor(e,t={},n=!1){this.object=e,this.components=t,this.disabled=n}};const At=N(void 0);function jt(){let e=ie(At);if(!e)throw Error(`useForm must be used within a Form element`);return e}const Mt=At.Provider,Nt=M.forwardRef(({object:e,type:n=`text`,onChange:r,...i},a)=>{let[o,s]=z(e.value==null?``:String(e.value)),[c,l]=z(e.schema.isBoolean&&e.value===!0);i.className=i.className?k(v.INPUT,i.className):v.INPUT;let u=t=>{i.disabled||(s(t.target.value),e.schema.isBoolean?(e.value=t.target.checked,l(e.value)):e.value=t.target.value,r?.(t))};return n===`textarea`?t(`textarea`,{ref:a,...i,value:o,onChange:u}):n===`checkbox`?t(`input`,{ref:a,...i,type:`checkbox`,checked:c,onChange:u,className:`form-check-input`}):t(`input`,{ref:a,...i,type:n,value:o,onChange:u})});function Pt({object:e,components:n,onSubmit:r,children:i,onChange:a,disabled:o}){return e.observer=a,t(Mt,{value:new kt(e,n||{},o??!1),children:t(`form`,{className:`w-full`,onSubmit:t=>{t.stopPropagation(),t.preventDefault(),r?.(e.value)},children:i})})}function Ft(){let e=jt();return t(`div`,{className:`flex flex-col gap-4 w-full`,children:e.object.properties.map(Lt)})}function It({children:e,...r}){return n(Pt,{...r,children:[t(Ft,{}),e]})}function Lt(e){return e.isList?t(Vt,{object:e},e.name):e.isObject?t(Bt,{object:e},e.name):t(zt,{object:e},e.name)}function Rt(e,n){return e.isList?t(Vt,{object:e}):e.isObject?t(Bt,{object:e}):t(zt,{object:e,editor:n})}function zt({object:e,editor:n,inline:r=!1}){n||=e.schema.editor;let{components:i,disabled:a}=jt(),o=n&&i[n]||Nt,s=e.getInputType();s===`checkbox`&&(r=!0);let c=t=>{a||(e.value=e.schema.isBoolean?t.target instanceof HTMLInputElement&&t.target.checked:e.schema.isNumber?parseFloat(t.target.value):t.target.value)};return e.isListItem?t(o,{object:e,type:s,onChange:c,disabled:a}):t(u,{label:e.title,required:e.schema.isRequired,description:e.schema.description,className:k(`flex`,r?`flex-row items-center`:`flex-col`),children:t(o,{object:e,type:s,onChange:c,disabled:a})})}function Bt({object:e}){return n(`div`,{className:`flex flex-col gap-4 my-4 py-2 ps-4 border-s-4 border-s-solid border-s-slate-100 dark:border-s-slate-600`,children:[!e.isListItem&&t(`div`,{className:`text-gray-900 dark:text-gray-200 font-semibold`,children:e.title}),e.properties.map(Lt)]})}function Vt({object:e}){let{disabled:i}=jt(),a=R((e.value??[]).length),[o,s]=z(()=>(e.value??[]).map((e,t)=>t)),c=()=>{i||(e.add(),s(e=>[...e,a.current++]))},l=t=>{i||(e.remove(t),s(e=>e.filter((e,n)=>n!==t)))};return n(`div`,{className:`flex flex-col gap-4 my-4 py-2 ps-4 border-s-4 border-s-solid border-s-slate-100 darK:border-s-slate-600`,children:[!e.isListItem&&t(`div`,{className:`text-gray-900 dark:text-gray-200 font-semibold`,children:e.title}),e.items.map((n,r)=>{let a=o[r];return t(Ht,{object:n,list:e,onDelete:()=>l(r),disabled:i},a)}),t(`div`,{children:n(r,{variant:`outline`,onClick:c,disabled:i,children:[t(gt,{className:`size-6`}),` Add`]})})]})}function Ht({list:e,object:i,onDelete:a,disabled:o}){let s=typeof e.schema.arraySchema.editor==`string`?e.schema.arraySchema.editor:void 0;return n(`div`,{className:`flex gap-2 w-full`,children:[t(`div`,{className:`flex-1`,children:Rt(i,s)}),t(r,{variant:`ghost`,onClick:a,disabled:o,title:`Delete`,children:t(Ct,{className:`size-4 text-destructive`})})]})}function Ut({label:e,required:n,children:r}){return t(u,{label:e,required:n,children:r})}function Wt({children:e}){return t(`p`,{className:`mt-2 text-sm text-gray-500`,children:e})}function Gt({children:e}){return t(`p`,{className:`mt-2 text-sm text-red-600`,children:e})}function Kt(e){return e===`object`?{type:`object`,properties:{}}:e===`array`?{type:`array`,items:{}}:{type:e}}var qt=class{schema;properties={};_validator;constructor(e){this.schema=e||{type:`object`,properties:{}},this.load()}get validator(){if(!this._validator){let e=new oe({allErrors:!0,strict:!1});se(e),this._validator=e.compile(this.schema)}return this._validator}load(){if(this.schema.properties){let e=this.schema.properties;Object.keys(e).forEach(t=>{this.loadProperty(t,e[t])})}}hasProperties(){return Object.keys(this.properties).length>0}get title(){let e=this.schema.title;if(typeof e==`string`)return e;let t=this.schema.name;return typeof t==`string`?t:void 0}get description(){return this.schema.description}loadProperty(e,t){let n;return n=t.type===`array`?new Xt(this,e,t):new Jt(this,e,t),this.properties[e]=n,n}get type(){return this.schema.type}validate(e){return this.validator(e)?null:this.validator.errors||[]}addProperty(e,t,n=!1){this.schema.type!==`object`&&(this.schema.type=`object`),this.schema.properties||(this.schema.properties={});let r=typeof t==`string`?Kt(t):t,i=this.loadProperty(e,r);return this.schema.properties[i.name]=i.schema,n&&(i.isRequired=!0),i}removeProperty(e){this.schema.properties&&(delete this.schema.properties[e],Array.isArray(this.schema.required)&&(this.schema.required=this.schema.required.filter(t=>t!==e))),delete this.properties[e]}getProperty(e){return this.properties[e]}get editor(){return typeof this.schema.editor==`string`?this.schema.editor:void 0}},Jt=class extends qt{parent;name;constructor(e,t,n){if(super(n),this.parent=e,this.name=t,n.type===`array`)throw Error(`Array property must be instantiated using ArrayPropertySchema`);n.type===`object`&&!n.properties&&(n.properties={})}get isMulti(){return!1}get isReadOnly(){return!!this.schema.readOnly}set isReadOnly(e){this.schema.readOnly=e}get defaultValue(){return this.schema.default}set defaultValue(e){this.schema.default=e}get enum(){return this.schema.enum}set enum(e){this.schema.enum=e}get isRequired(){let e=this.parent.schema.required;return e?e.includes(this.name):!1}set isRequired(e){let t=Array.isArray(this.parent.schema.required)?this.parent.schema.required:[];t=e?t.concat(this.name):t.filter(e=>e!==this.name),this.parent.schema.required=t}get type(){return this.schema.type}set type(e){this.schema.type!==e&&(this.schema.type=e,e!==`object`&&(this.properties={},this.schema.properties=void 0))}remove(){this.parent.removeProperty(this.name)}get isBoolean(){return this.type===`boolean`}get isString(){return this.type===`string`}get isNumber(){return this.type===`number`||this.type===`integer`}get isObject(){return this.type===`object`}};function Yt(e){if(e.type!==`array`)throw Error(`Expecting an array schema`);if(!e.items)e.items={};else if(Array.isArray(e.items))throw Error(`Tuple arrays are not supported`);return e.items}var Xt=class extends Jt{arraySchema;constructor(e,t,n){super(e,t,Yt(n)),this.arraySchema=n}get isMulti(){return!0}};function Zt(e){return e=e.replace(/_/g,` `).replace(/([a-z0-9])&([A-Z])/g,`$1 $2`),e[0].toUpperCase()+e.slice(1)}function Qt(e,t){if(t.editor)return t.editor;if(t.schema.format)return t.schema.format;switch(t.type){case`number`:case`integer`:return`number`;case`boolean`:return`checkbox`;case`string`:return`text`;default:return`text`}}var $t=class{parent;schema;name;observer;constructor(e,t,n){this.parent=e,this.schema=t,this.name=n}get isRoot(){return!this.parent}get root(){return this.parent?this.parent.root:this}get path(){return this.parent?this.parent.path.concat(this.name):[]}get isScalar(){return!1}get isListItem(){return!1}get isObject(){return!1}get isList(){return!1}get title(){return this.schema.title||Zt(this.name)}onChange(e){this.observer&&this.observer(this)===!1||this.parent?.onChange(e)}},en=class extends $t{get isObject(){return!0}getProperty(e){let t=this.schema.properties[e];return t.isMulti?new an(this,t,this.getOrInitArrayProperty(e)):t.isObject?new nn(this,t,t.name,this.getOrInitObjectProperty(e)):new rn(this,t)}getOrInitObjectProperty(e){let t=this.value[e];return t||(this.value[e]=t={}),t}getOrInitArrayProperty(e){let t=this.value[e];return t||(this.value[e]=t=[]),t}setPropertyValue(e,t){return this.value[e]!==t&&(this.value[e]=t,!0)}getPropertyValue(e){return this.value[e]}get properties(){let e=[];for(let t of Object.values(this.schema.properties))t.isMulti?e.push(new an(this,t,this.getOrInitArrayProperty(t.name))):t.isObject?e.push(new nn(this,t,t.name,this.getOrInitObjectProperty(t.name))):e.push(new rn(this,t));return e}[Symbol.iterator](){return this.properties[Symbol.iterator]()}},tn=class extends en{value;constructor(e,t={}){super(null,e instanceof qt?e:new qt(e),`#root`),this.value=t}},nn=class extends en{value;constructor(e,t,n,r){super(e,t,n),this.value=r}},rn=class extends $t{constructor(e,t){super(e,t,t.name),e.value[this.name]===void 0&&t.defaultValue!==void 0&&(e.value[this.name]=t.defaultValue)}get isScalar(){return!0}set value(e){this.parent.setPropertyValue(this.name,e)&&this.onChange(this)}get value(){return this.parent.getPropertyValue(this.name)}getInputType(){return Qt(this.name,this.schema)}},an=class extends $t{value;items=[];constructor(e,t,n){super(e,t,t.name),this.value=n;for(let e of this.value)this.add()}get isList(){return!0}newItem(e){return this.schema.isObject?new on(this,e):new sn(this,e)}add(){let e=this.newItem(this.items.length);return this.items.push(e),e}remove(e){let t=this.value;if(e>=0&&e<this.items.length){this.items.splice(e,1);for(let e=0,t=this.items.length;e<t;e++){let t=this.items[e];t.index=e,t.name=String(e)}}Array.isArray(t)&&e>=0&&e<t.length&&(t.splice(e,1),this.onChange(this))}[Symbol.iterator](){return this.items[Symbol.iterator]()}item(e){if(e<0||e>=this.value.length)return;let t=this.value[e];return this.schema.isObject?new nn(this,this.schema,String(e),t):new sn(this,e)}trim(){for(;this.items[this.items.length-1]===void 0;)this.items.pop()}},on=class extends en{index;key;constructor(e,t){super(e,e.schema,String(t)),this.index=t,e.value[t]===void 0&&(e.value[t]={}),this.key=`${this.name}@${Date.now()}`}get isListItem(){return!0}set value(e){this.parent.value[this.index]=e}get value(){return this.parent.value[this.index]}},sn=class extends $t{index;key;constructor(e,t){super(e,e.schema,String(t)),this.index=t,e.value[t]===void 0&&e.schema.defaultValue!==void 0&&(e.value[t]=e.schema.defaultValue),this.key=`${this.name}@${Date.now()}`}get isScalar(){return!0}get isListItem(){return!0}set value(e){this.parent.value[this.index]=e}get value(){return this.parent.value[this.index]}getInputType(){return Qt(this.name,this.schema)}};function cn({data:e,className:r}){let i=L(()=>{try{return JSON.stringify(e,null,2)}catch(e){return console.error(`Failed to stringify JSON:`,e),`{}`}},[e]),a=L(()=>i.split(`
273
+ `),[i]);return t(`pre`,{className:`h-full overflow-auto rounded-md border bg-background p-3 font-mono text-xs leading-5 text-foreground ${r||``}`,children:t(`code`,{children:a.map((e,t)=>n(`span`,{children:[dn(e),t<a.length-1?`
274
+ `:null]},`line-${t}`))})})}const ln=/("(?:\\.|[^"\\])*"?)|\b(true|false|null)\b|(-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)/g,un=/^\s*:/;function dn(e){ln.lastIndex=0;let n=[],r=0,i=ln.exec(e);for(;i!==null;){i.index>r&&n.push(e.slice(r,i.index));let[a,o,s,c]=i,l=o!==void 0&&un.test(e.slice(i.index+a.length))?`text-info`:o?`text-success`:s?`text-primary`:c?`text-attention`:void 0;n.push(t(`span`,{className:l,children:a},`${i.index}-${a}`)),r=i.index+a.length,i=ln.exec(e)}return r<e.length&&n.push(e.slice(r)),n.length?n:e}function fn({value:e}){return Array.isArray(e)?t(`div`,{className:`flex flex-col gap-4 px-2 h-full overflow-auto`,children:t(gn,{value:e})}):typeof e!=`object`||!e?t(`div`,{className:`flex flex-col gap-4 px-2 h-full overflow-auto`,children:t(hn,{name:`value`,value:e})}):t(`div`,{className:`flex flex-col gap-4 px-2 h-full overflow-auto`,children:Object.entries(e).map(([e,n])=>t(hn,{name:e,value:n},e))})}function pn({name:e}){return t(`div`,{className:`text-sm font-semibold`,children:Zt(e)})}function mn({children:e,className:n}){return t(`div`,{className:k(`flex flex-col gap-4 py-2 ps-4 border-s-4 border-s-solid border-s-slate-100 dark:border-s-slate-600`,n),children:e})}function hn({name:e,value:r}){let i=yn(r);switch(i.type){case vn.Inline:return n(`div`,{className:`w-full flex gap-2 text-sm`,children:[t(pn,{name:`${e}:`}),t(`p`,{children:i.value})]});case vn.Paragraph:return n(`div`,{className:`w-full flex flex-col gap-2 text-sm`,children:[t(pn,{name:e}),t(`p`,{children:i.value})]});case vn.Prose:return n(`div`,{className:`prose dark:prose-invert`,children:[t(pn,{name:e}),t(`div`,{className:`vprose prose-sm dark:prose-invert`,children:i.value})]});case vn.Array:return t(gn,{name:e,value:r});case vn.Object:return n(`div`,{className:`w-full flex flex-col gap-2 text-sm`,children:[t(pn,{name:e}),t(mn,{className:`mt-2`,children:Object.entries(r).map(([e,n])=>t(hn,{name:e,value:n},e))})]})}}function gn({name:e,value:r}){let i=r.join(` `).length,o=i/r.length,s=typeof r[0]==`string`&&(i<80||i<400&&o<32),c=r.length>9,l=r.map((e,t)=>({item:e,index:t,key:`${t}-${JSON.stringify(e)}`}));return s?n(`div`,{className:`flex gap-2 flex-wrap`,children:[e&&t(pn,{name:`${e}:`}),l.map(({item:e,key:n})=>t(a,{children:String(e)},n))]}):n(`div`,{children:[e&&t(pn,{name:e}),t(`div`,{className:`flex flex-col gap-2`,children:l.map(({item:e,index:n,key:r})=>t(_n,{index:n,value:e,useBullet:c},r))})]})}function _n({index:e,value:r,useBullet:i}){let a=i?t(`span`,{className:`text-xl`,children:`•`}):n(`span`,{children:[e+1,`.`]}),o=yn(r),s;switch(o.type){case vn.Object:s=t(mn,{children:Object.entries(r).map(([e,n])=>t(hn,{name:e,value:n},e))});break;case vn.Array:s=t(gn,{value:r});break;case vn.Prose:s=t(`div`,{className:`prose dark:prose-invert`,children:o.value});break;default:s=t(`div`,{children:o.value})}return n(`div`,{className:`flex gap-4 hover:bg-muted py-2 pe-2 ps-4`,children:[t(`div`,{className:`font-semibold text-muted`,children:a}),t(`div`,{children:s})]})}var vn;(function(e){e[e.Inline=0]=`Inline`,e[e.Paragraph=1]=`Paragraph`,e[e.Prose=2]=`Prose`,e[e.Array=3]=`Array`,e[e.Object=4]=`Object`})(vn||={});function yn(e){if(e==null)return{value:`-`,type:vn.Inline};if(Array.isArray(e))return{value:e,type:vn.Array};if(typeof e==`string`){let t=e.length,n,r=e;return t<80?n=vn.Inline:t>400?n=vn.Prose:(n=vn.Paragraph,r=e.replace(/(?:\n\n)+/g,`
4
275
 
5
- `)),{type:n,value:r}}return typeof e==`number`||typeof e==`boolean`?{value:String(e),type:X.Inline}:{value:e,type:X.Object}}function Gt({value:e,viewCode:n=!1}){let{t:r}=J();return e?t(`div`,{className:`relative w-full h-full flex flex-col`,children:n||!Kt(e)?t(Pt,{data:e}):t(`div`,{className:`flex-1 min-h-0 overflow-auto`,children:t(Rt,{value:e})})}):t(`pre`,{className:`whitespace-pre-wrap`,children:r(`misc.noData`)})}function Kt(e){return e==null||typeof e==`string`||typeof e==`number`||typeof e==`boolean`?!0:Array.isArray(e)?e.every(Kt):typeof e==`object`&&Object.values(e).every(Kt)}const qt=new Set;function Jt(e){qt.has(`markdown`)||(qt.add(`markdown`),e.languages.registerFoldingRangeProvider(`markdown`,{provideFoldingRanges(e){let t=[],n=e.getLinesContent(),r=/^(#{1,6})\s/,i=[];for(let e=0;e<n.length;e++){let a=e+1,o=r.exec(n[e]);if(o){let e=o[1].length;for(;i.length>0&&i[i.length-1].level>=e;){let e=i.pop();e&&a-1>e.line&&t.push({start:e.line,end:a-1})}i.push({level:e,line:a})}}let a=n.length;for(;i.length>0;){let e=i.pop();e&&a>e.line&&t.push({start:e.line,end:a})}return t}}));for(let t of[`javascript`,`typescript`])qt.has(t)||(qt.add(t),e.languages.registerFoldingRangeProvider(t,{provideFoldingRanges(e){let t=e.getLinesContent(),n=/^(#{1,6})\s/,r=[],i=[],a=[],o=[],s=!1,c=!1,l=``;for(let e=0;e<t.length;e++){let u=e+1,d=t[e],f=s;for(let e=0;e<d.length;e++){let t=d[e];if(t===`\\`){e++;continue}if(c){t===l&&(c=!1);continue}if(s){t==="`"&&(s=!1);continue}if(t==="`"){s=!0;continue}if(t===`"`||t===`'`){c=!0,l=t;continue}if(t===`{`&&a.push(u),t===`}`&&a.length>0){let t=a.pop(),n=d.slice(e+1).trimStart().length>0?u-1:u;t!==void 0&&n>t&&r.push({start:t,end:n})}}if(f){let e=n.exec(d);if(e){let t=e[1].length;for(;o.length>0&&o[o.length-1].level>=t;){let e=o.pop();e&&u-1>e.line&&i.push({start:e.line,end:u-1})}o.push({level:t,line:u})}if(!s)for(;o.length>0;){let e=o.pop();e&&u>e.line&&i.push({start:e.line,end:u})}}}return[...r,...i]}}))}const Yt=V(()=>import(`@monaco-editor/react`).then(({Editor:e})=>({default:e})));let Xt;function Zt(){if(!(typeof document>`u`)){if(!Xt){let e=document.createElement(`div`);e.className=`monaco-editor`,e.style.position=`absolute`,e.style.top=`0`,e.style.left=`0`,e.style.zIndex=`10000`,document.body.appendChild(e),Xt=e}return Xt}}const Qt=new Map;let $t=0;function en(e){(e.languages.json?.jsonDefaults)?.setDiagnosticsOptions({validate:!0,enableSchemaRequest:!1,schemas:Array.from(Qt.entries()).map(([e,t])=>({uri:`vertesia://schemas/${encodeURIComponent(e)}`,fileMatch:[e],schema:t}))})}var tn=class{VgetValue;VsetValue;constructor(e,t){this.VgetValue=e,this.VsetValue=t}getValue(){return this.VgetValue()}setValue(e){this.VsetValue(e||``)}};function nn({onChange:e,value:n,className:r,editorRef:i,language:a=`javascript`,path:o,debounceTimeout:s=0,options:c={},beforeMount:l,onMount:u,defaultValue:d,useCustomFolding:f=!1,jsonSchema:p}){let[m,h]=q(n||d||``),g=K(null),_=K(null),[v]=q(()=>p?`inmemory://vertesia/json/${++$t}.json`:void 0),y=o??v,{theme:ee}=T(),b=ee===`system`?window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`:ee,x=n||d||``,S=K(()=>m),te=K(e=>{h(e),g.current&&g.current.setValue(e)});W(()=>{S.current=()=>m},[m]),W(()=>(i&&(i.current=new tn(()=>S.current(),e=>te.current(e))),()=>{i&&(i.current=void 0)}),[i]);let C=G(()=>{if(e)return s>0?Me(t=>e(t),s):e},[e,s]),w=H(async(e,t)=>{let n=e.getModel();if(n)for(let r of n.getValue().matchAll(/```[\s\S]*?```/g)){let i=n.getPositionAt(r.index).lineNumber,a=n.getPositionAt(r.index+r[0].length).lineNumber;e.setSelection(new t.Selection(i,1,a,1)),await e.getAction(`editor.createFoldingRangeFromSelection`)?.run()}},[]),ne=H(e=>{let t=e||``;if(h(t),C){let e={docChanged:!0,state:{doc:{toString:()=>t,length:t.length}}};C(e)}},[C]),D=H((e,t)=>{g.current=e,_.current=t,p&&y&&a===`json`&&(Qt.set(y,p),en(t)),f&&Jt(t),te.current=t=>{h(t),e.setValue(t)},t.editor.defineTheme(`errorLineTheme`,{base:b===`dark`?`vs-dark`:`vs`,inherit:!0,rules:[],colors:{"editorError.background":`#ffebee`,"editorError.border":`#f44336`}}),t.editor.setTheme(`errorLineTheme`),f&&setTimeout(()=>w(e,t),300),u?.(e,t)},[u,b,f,w,p,y,a]);W(()=>()=>{p&&y&&Qt.delete(y)&&_.current&&en(_.current)},[p,y]),W(()=>{g.current?.hasTextFocus()||h(e=>x===e?e:(g.current&&g.current.setValue(x),x))},[x]),W(()=>{if(!x||!f||!g.current||!_.current||g.current.hasTextFocus())return;let e=g.current,t=_.current,n=setTimeout(()=>w(e,t),300);return()=>clearTimeout(n)},[x,f,w]);let O={fontSize:14,fontFamily:`monospace`,minimap:{enabled:!1},scrollBeyondLastLine:!1,wordWrap:`on`,lineNumbers:`on`,folding:!0,lineDecorationsWidth:10,lineNumbersMinChars:3,automaticLayout:!0,formatOnPaste:!0,formatOnType:!0,tabSize:2,insertSpaces:!0,fixedOverflowWidgets:!0,overflowWidgetsDomNode:Zt(),glyphMargin:!0,renderValidationDecorations:`on`,renderLineHighlight:`line`,hover:{enabled:`on`,delay:100},quickSuggestions:{other:!0,comments:!0,strings:!0},...c};return t(`div`,{className:E(r,`w-full h-full!`),children:t(De,{fallback:t(`div`,{className:`h-full w-full`}),children:t(Yt,{className:`h-full w-full`,height:`100%`,theme:b===`dark`?`vs-dark`:`light`,language:a,path:y,onChange:ne,onMount:D,beforeMount:l,options:O,defaultValue:x})})})}function rn({value:e,onChange:r,onValidChange:i,readonly:a=!1,height:o=`200px`,placeholder:s,className:c}){let{theme:l}=T(),u=K(void 0),[d,f]=q(null),p=G(()=>{if(e==null)return s??`{}`;try{return JSON.stringify(e,null,2)}catch{return`{}`}},[e,s]),m=H(()=>{if(!u.current||a)return;let e=u.current.getValue();try{let t=JSON.parse(e);f(null),i?.(t)}catch{f(`Invalid JSON`)}},[a,i]);return n(`div`,{className:c,children:[t(`div`,{className:`border rounded overflow-hidden`,style:{height:o},children:t(nn,{defaultValue:p,editorRef:u,language:`json`,theme:l===`dark`?`vs-dark`:`vs`,onChange:m,options:a?{readOnly:!0,domReadOnly:!0}:void 0})}),d&&t(`p`,{className:`text-xs text-destructive mt-1`,children:d})]})}function an(e){if(!e.current)return null;try{return JSON.parse(e.current.getValue())}catch{return null}}function on({title:e,viewCode:i,setViewCode:a}){return n(`div`,{className:`flex items-center gap-1 bg-muted mb-2 p-1 rounded`,children:[t(r,{variant:i?`ghost`:`primary`,size:`sm`,title:`Preview properties`,onClick:()=>a(!1),children:e}),t(r,{variant:i?`primary`:`ghost`,size:`sm`,title:`View in JSON format`,onClick:()=>a(!0),children:`JSON`})]})}function sn(e){return e.replace(/([a-z0-9])([A-Z])/g,`$1 $2`).replace(/[_-]+/g,` `).replace(/\s+/g,` `).trim().replace(/^./,e=>e.toUpperCase())}function cn(r){return r==null?`Failed to query`:typeof r==`string`?r:Array.isArray(r)?r.length===0?`None`:r.some(e=>e&&typeof e==`object`)?t(e,{children:r.map((e,r)=>n(`div`,{className:`flex gap-1`,children:[n(`span`,{className:`text-xs align-top pe-2 font-medium`,children:[r+1,`:`]}),t(`span`,{className:`text-xs`,children:cn(e)})]},`item-${r}`))}):r.map(e=>String(e)).join(`, `):typeof r==`object`?t(e,{children:Object.entries(r).map(([e,r])=>n(`div`,{className:`flex gap-1`,children:[n(`span`,{className:`text-xs align-top pe-2 font-medium`,children:[sn(e),`:`]}),t(`span`,{className:`text-xs`,children:cn(r)})]},e))}):String(r)}function ln({data:e,className:r}){let i=e?Object.entries(e):[];return t(`table`,{className:r||`mb-2 text-xs bg-muted rounded-sm w-full`,children:t(`tbody`,{children:i.map(([e,r])=>n(`tr`,{className:`align-top hover:bg-background border-y`,children:[t(`td`,{className:`align-top pe-4 p-2`,children:sn(e)}),t(`td`,{className:`p-2`,children:cn(r)})]},e))})})}const un=B(()=>({kind:`none`})),dn=un.Provider;function fn(){return U(un)}const pn={store:`document`,document:`document`,collection:`collection`,interaction:`interaction`,prompt:`prompt`,agent:`agent`,workflow:`workflow`,process:`process`,run:`interaction_run`};function mn(e){let t=e.indexOf(`:`);if(t<=0)return;let n=e.slice(0,t);if(!Object.hasOwn(pn,n))return;let r=e.slice(t+1).trim().replace(/^\/+/,``);if(r)return{type:pn[n],id:r}}function hn(...e){return Re(D(e))}const gn=B(null);function _n(){return U(gn)}function vn(e){return e.startsWith(`agents/`)||e.startsWith(`documents/`)}function yn(e,t,n=`inline`){return`artifact:${e}:${t}:${n}`}function bn(e){return`file:${e}`}const xn=V(()=>import(`react-vega`).then(({VegaEmbed:e})=>({default:e})));function Sn({error:e,chartTitle:r}){return t(`div`,{className:`flex items-center justify-center h-full bg-red-50 dark:bg-red-950 rounded-md p-4`,children:n(`div`,{className:`text-center`,children:[n(`p`,{className:`text-sm font-medium text-red-600 dark:text-red-400`,children:[`Cannot render `,r||`Vega-Lite`,` chart`]}),t(`p`,{className:`text-xs text-red-500 dark:text-red-500 mt-1 max-w-xs truncate`,children:e})]})})}function Cn(){return t(`output`,{className:`flex items-center justify-center w-full h-full`,children:t(ge,{className:`w-5 h-5 animate-spin text-gray-500 dark:text-gray-400`})})}function wn({isOpen:e,onClose:i,title:a,description:o,children:s}){let{t:c}=J();return t(Y.Root,{open:e,onOpenChange:e=>!e&&i(),children:n(Y.Portal,{children:[t(Y.Overlay,{className:`fixed inset-0 z-50 bg-black/80 backdrop-blur-sm transition-all duration-300 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0`}),n(Y.Content,{className:`fixed inset-2 sm:inset-4 z-50 flex flex-col bg-white dark:bg-gray-900 rounded-xl shadow-2xl transition-all duration-300 ease-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-98 data-[state=open]:zoom-in-98 data-[state=closed]:slide-out-to-bottom-2 data-[state=open]:slide-in-from-bottom-2`,onEscapeKeyDown:i,children:[t(Y.Close,{asChild:!0,children:t(r,{variant:`unstyled`,onClick:i,className:`absolute top-3 end-3 z-10 p-2 rounded-lg bg-white/80 dark:bg-gray-800/80 backdrop-blur-sm hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors duration-150 shadow-sm`,"aria-label":c(`agent.closeFullscreen`),children:t(Te,{className:`w-5 h-5 text-gray-600 dark:text-gray-300`})})}),t(`div`,{className:`flex-1 overflow-auto p-4 sm:p-6 animate-in fade-in-0 duration-500 delay-150`,children:s}),t(`div`,{className:`flex items-center justify-between px-4 sm:px-6 py-3 border-t border-gray-200 dark:border-gray-800 bg-gray-50/50 dark:bg-gray-800/50 rounded-b-xl`,children:n(`div`,{className:`flex flex-col`,children:[t(Y.Title,{className:`text-base font-semibold text-gray-900 dark:text-gray-100`,children:a||c(`agent.dashboard`)}),o&&t(Y.Description,{className:`text-sm text-gray-500 dark:text-gray-400 mt-0.5`,children:o})]})})]})]})})}function Tn(e,t){if(t===`chart`)return 280;let n=1;if(e.vconcat)n=Array.isArray(e.vconcat)?e.vconcat.length:1;else if(e.concat){let t=e.columns||2,r=Array.isArray(e.concat)?e.concat.length:1;n=Math.ceil(r/t)}else e.facet&&(n=2);return Math.max(500,n*280+40)}const En={categorical:[`#6366f1`,`#8b5cf6`,`#ec4899`,`#f43f5e`,`#f97316`,`#eab308`,`#22c55e`,`#14b8a6`,`#06b6d4`,`#3b82f6`],blues:[`#dbeafe`,`#93c5fd`,`#3b82f6`,`#1d4ed8`,`#1e3a8a`],purples:[`#f3e8ff`,`#c4b5fd`,`#8b5cf6`,`#6d28d9`,`#4c1d95`],greens:[`#dcfce7`,`#86efac`,`#22c55e`,`#15803d`,`#14532d`],diverging:[`#ef4444`,`#fca5a5`,`#fef3c7`,`#86efac`,`#22c55e`]};function Dn(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function On(e){return Dn(e)}function kn(e){let t=JSON.parse(JSON.stringify(e)),n=[`vconcat`,`hconcat`,`concat`];if(!n.some(e=>Array.isArray(t[e])))return t;let r=[];if(Array.isArray(t.params))for(let e of t.params)e&&typeof e==`object`&&e.name&&e.select&&r.push({name:e.name,param:e});if(r.length===0)return t;for(let{name:e,param:i}of r){let r=i.select?.fields||[],a=i.select?.bind===`legend`,o=null;for(let e of n)if(Array.isArray(t[e])){o=t[e];break}if(!o||o.length===0)continue;let s=0;for(let e=0;e<o.length;e++){let t=o[e];if(jn(t,r)||a&&Mn(t,r)){s=e;break}}let c=o[s];c.params||=[],c.params.push(i),t.params=(t.params??[]).filter(t=>t.name!==e)}return Array.isArray(t.params)&&t.params.length===0&&delete t.params,t}function An(e,t){if(!t||Object.keys(t).length===0)return e;let n=JSON.parse(JSON.stringify(e)),r=e=>{for(let n of e)n.name&&n.name in t&&(n.value=t[n.name])};Array.isArray(n.params)&&r(n.params);let i=e=>{if(Array.isArray(e)){for(let t of e)if(Array.isArray(t.params)&&r(t.params),t.vconcat&&i(t.vconcat),t.hconcat&&i(t.hconcat),t.concat&&i(t.concat),Array.isArray(t.layer))for(let e of t.layer)Array.isArray(e.params)&&r(e.params)}};if(n.vconcat&&i(n.vconcat),n.hconcat&&i(n.hconcat),n.concat&&i(n.concat),Array.isArray(n.layer))for(let e of n.layer)e&&Array.isArray(e.params)&&r(e.params);return n}function jn(e,t){if(!e?.encoding)return!1;for(let n of t)for(let t of Object.values(e.encoding))if(t.field===n)return!0;if(Array.isArray(e.layer)){for(let n of e.layer)if(jn(n,t))return!0}return!1}function Mn(e,t){if(!e)return!1;let n=e=>{if(!e)return!1;let n=e.color?.field;return!!n&&t.includes(n)};if(n(e.encoding))return!0;if(Array.isArray(e.layer)){for(let t of e.layer)if(n(t.encoding))return!0}return!1}function Nn(e,t=[]){let n=[];if(!e||typeof e!=`object`)return n;if(e.data&&typeof e.data==`object`){let r=e.data.url;typeof r==`string`&&r.startsWith(`artifact:`)&&n.push({path:[...t,`data`],artifactPath:r.replace(/^artifact:/,``).trim()})}for(let r of[`layer`,`vconcat`,`hconcat`,`concat`,`spec`,`repeat`,`facet`])if(r in e){let i=e[r];Array.isArray(i)?i.forEach((e,i)=>{On(e)&&n.push(...Nn(e,[...t,r,String(i)]))}):On(i)&&n.push(...Nn(i,[...t,r]))}return n}function Pn(e,t){let n=JSON.parse(JSON.stringify(e));for(let[e,r]of t){let t=e.split(`.`),i=n;for(let e=0;e<t.length-1;e++){let n=i[t[e]];if(!Dn(n))break;i=n}let a=t[t.length-1],o=i[a];Dn(o)&&(delete o.url,o.values=r)}return n}function Fn(e){let t={background:`transparent`,view:{stroke:`transparent`},range:{category:En.categorical,diverging:En.diverging,heatmap:En.purples,ramp:En.blues},mark:{tooltip:!0},bar:{tooltip:!0,cornerRadiusTopLeft:4,cornerRadiusTopRight:4},line:{tooltip:!0,strokeWidth:2.5,strokeCap:`round`},point:{tooltip:!0,size:60,filled:!0},area:{tooltip:!0,fillOpacity:.7,line:!0},rect:{tooltip:!0,cornerRadius:2},arc:{tooltip:!0,cornerRadius:4},circle:{tooltip:!0,size:80}};return e?{...t,axis:{labelColor:`#a1a1aa`,titleColor:`#e4e4e7`,gridColor:`#3f3f46`,domainColor:`#52525b`,tickColor:`#52525b`,labelFont:`Inter, system-ui, sans-serif`,titleFont:`Inter, system-ui, sans-serif`,labelFontSize:11,titleFontSize:12,titleFontWeight:500},legend:{labelColor:`#a1a1aa`,titleColor:`#e4e4e7`,labelFont:`Inter, system-ui, sans-serif`,titleFont:`Inter, system-ui, sans-serif`,labelFontSize:11,titleFontSize:12,symbolSize:100},title:{color:`#fafafa`,font:`Inter, system-ui, sans-serif`,fontSize:14,fontWeight:600}}:{...t,axis:{labelColor:`#71717a`,titleColor:`#3f3f46`,gridColor:`#e4e4e7`,domainColor:`#d4d4d8`,tickColor:`#d4d4d8`,labelFont:`Inter, system-ui, sans-serif`,titleFont:`Inter, system-ui, sans-serif`,labelFontSize:11,titleFontSize:12,titleFontWeight:500},legend:{labelColor:`#71717a`,titleColor:`#3f3f46`,labelFont:`Inter, system-ui, sans-serif`,titleFont:`Inter, system-ui, sans-serif`,labelFontSize:11,titleFontSize:12,symbolSize:100},title:{color:`#18181b`,font:`Inter, system-ui, sans-serif`,fontSize:14,fontWeight:600}}}const In=Oe(function({spec:i,artifactRunId:a}){let{t:o}=J(),{title:s,description:c,options:l}=i,u=i.spec,[d,f]=q(!1),[p,m]=q(!1),[h,g]=q(null),[_,v]=q(!1),y=K(null),ee=K(null),b=K(null),{client:x}=Ie(),S=_n(),te=K(x);te.current=x;let C=K(S);C.current=S;let[w,T]=q(null),[ne,E]=q(!1),[D,O]=q(null),k=l?.mode||`chart`,A=k===`dashboard`,j=l?.enableFullscreen??A,M=l?.height||Tn(u,k);W(()=>{let e=Nn(u);if(e.length===0){T(u),E(!1),O(null);return}a?console.info(`[VegaLiteChart] resolving artifacts with runId:`,a,e.map(e=>e.artifactPath)):console.warn(`[VegaLiteChart] artifact references found but artifactRunId is missing!`,{references:e.map(e=>e.artifactPath),artifactRunId:a});let t=!1;return E(!0),O(null),(async()=>{let n=new Map,r=te.current,i=C.current;for(let o of e)try{let e=o.path.join(`.`),t;if(a&&!vn(o.artifactPath)){let e=yn(a,o.artifactPath,`inline`);t=i?await i.getOrFetch(e,async()=>(await r.files.getArtifactDownloadUrl(a,o.artifactPath,`inline`)).url):(await r.files.getArtifactDownloadUrl(a,o.artifactPath,`inline`)).url}else{let e=bn(o.artifactPath);t=i?await i.getOrFetch(e,async()=>(await r.files.getDownloadUrl(o.artifactPath)).url):(await r.files.getDownloadUrl(o.artifactPath)).url}let s=await fetch(t);if(!s.ok)throw Error(`Failed to fetch artifact data: ${s.statusText}`);let c=o.artifactPath.toLowerCase().endsWith(`.csv`),l;if(c){let e=await s.text();l=Le.parse(e,{header:!0,skipEmptyLines:!0,dynamicTyping:!0}).data}else{let e=await s.json();l=Array.isArray(e)?e:[e]}n.set(e,l)}catch(e){console.error(`Failed to resolve artifact: ${o.artifactPath}`,e),t||O(`Failed to load data from artifact: ${o.artifactPath}`);return}if(!t){let e=Pn(u,n);T(e),E(!1)}})(),()=>{t=!0}},[u,a]);let[ie,ae]=q(!1),oe=K(!1);W(()=>{let e=()=>{let e=document.documentElement.classList.contains(`dark`);e!==oe.current&&(oe.current=e,ae(e))};e();let t=new MutationObserver(e);return t.observe(document.documentElement,{attributes:!0,attributeFilter:[`class`]}),()=>t.disconnect()},[]);let[le,ue]=q(0),de=K(0);W(()=>{if(!b.current)return;let e,t=new ResizeObserver(t=>{clearTimeout(e),e=setTimeout(()=>{let e=t[0]?.contentRect.width;e&&e!==de.current&&(de.current=e,ue(e))},100)});t.observe(b.current);let n=b.current.clientWidth;return de.current=n,ue(n),()=>{clearTimeout(e),t.disconnect()}},[]);let fe=G(()=>Nn(u).length>0,[u]),N=G(()=>{if(fe&&!w)return null;let e=w||u;return e?(l?.parameterValues&&(e=An(e,l.parameterValues)),kn(e)):null},[w,u,fe,l?.parameterValues]),pe=H((e,t)=>{if(!e||typeof e!=`object`)return e;if(e.hconcat&&Array.isArray(e.hconcat)){let n=e.hconcat.length,r=(e.spacing??10)*(n-1),i=Math.floor((t-r)/n);return{...e,hconcat:e.hconcat.map(e=>pe(e,i))}}if(e.vconcat&&Array.isArray(e.vconcat))return{...e,vconcat:e.vconcat.map(e=>pe(e,t))};if(e.concat&&Array.isArray(e.concat)){let n=e.columns??e.concat.length,r=(e.spacing??10)*(n-1),i=Math.floor((t-r)/n);return{...e,concat:e.concat.map(e=>pe(e,i))}}let n=e.width;return n===`container`||typeof n==`number`&&n>t?{...e,width:t}:e},[]),me=H((e,t=!1)=>{if(!N)return null;let n=Fn(ie),r=t?typeof window<`u`?Math.min(window.innerWidth-80,1400):1200:le>0?le-24:500,i=`vconcat`in N||`hconcat`in N||`concat`in N,a=i?{type:`pad`,contains:`padding`}:{type:`fit`,contains:`padding`},o=N;i&&r&&(o=pe(N,r));let c=o.width,l=i?void 0:c===`container`?r:c??r,{width:u,...d}=o;return{$schema:`https://vega.github.io/schema/vega-lite/v6.json`,...!i&&l?{width:l}:{},height:t?void 0:e,autosize:a,...i?o:d,...s&&!N.title?{title:s}:{},config:{...n,...N.config}}},[N,s,ie,le,pe]),he=H(async()=>{let e=_?ee.current:y.current;if(!(!e||p))try{(await e.toCanvas(2)).toBlob(async e=>{e&&(await navigator.clipboard.write([new ClipboardItem({"image/png":e})]),m(!0),setTimeout(()=>m(!1),2e3))},`image/png`)}catch(e){console.error(`Failed to copy chart:`,e)}},[p,_]),ve=H(async()=>{let e=_?ee.current:y.current;if(!(!e||d)){f(!0);try{let t=await e.toImageURL(`png`,2),n=document.createElement(`a`);n.download=`${s||`chart`}.png`,n.href=t,n.click()}catch(e){console.error(`Failed to export chart:`,e)}finally{f(!1)}}},[s,d,_]),be=H(e=>{y.current=e,g(null)},[]),xe=H(e=>{ee.current=e},[]),Se=H(e=>{console.error(`Vega-Lite rendering error:`,e),g(e instanceof Error?e.message:`Unknown error`)},[]),P=H(()=>{v(e=>!e)},[]);W(()=>{g(null)},[u]);let F=({className:e})=>n(`div`,{className:hn(`flex items-center gap-2`,e),children:[n(r,{variant:`unstyled`,onClick:he,disabled:p,className:`text-xs px-2 py-1 rounded border border-gray-300 dark:border-gray-700 bg-gray-100 dark:bg-gray-800 text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700 cursor-pointer transition-colors disabled:opacity-50 flex items-center gap-1`,title:o(`agent.copyToClipboard`),children:[t(p?re:se,{className:`w-3 h-3`}),o(p?`agent.copied`:`agent.copy`)]}),n(r,{variant:`unstyled`,onClick:ve,disabled:d,className:`text-xs px-2 py-1 rounded border border-gray-300 dark:border-gray-700 bg-gray-100 dark:bg-gray-800 text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700 cursor-pointer transition-colors disabled:opacity-50 disabled:cursor-not-allowed flex items-center gap-1`,title:o(`agent.exportAsPng`),children:[t(ce,{className:`w-3 h-3`}),o(d?`agent.exporting`:`agent.export`)]}),j&&n(r,{variant:`unstyled`,onClick:P,className:`text-xs px-2 py-1 rounded border border-gray-300 dark:border-gray-700 bg-gray-100 dark:bg-gray-800 text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700 cursor-pointer transition-colors flex items-center gap-1`,title:o(_?`agent.exitFullscreen`:`agent.fullscreen`),children:[t(_?ye:_e,{className:`w-3 h-3`}),o(_?`agent.exit`:`agent.fullscreen`)]})]});if(ne||fe&&!w)return t(`div`,{className:`bg-white dark:bg-gray-900 rounded-lg border border-gray-200 dark:border-gray-800 shadow-sm`,children:n(`div`,{className:`flex flex-col gap-2 p-3`,children:[t(`div`,{className:`flex items-center justify-between`,children:t(`span`,{className:`font-medium text-sm text-gray-900 dark:text-gray-100`,children:s||`Chart`})}),t(`div`,{className:`flex items-center justify-center bg-gray-50 dark:bg-gray-800 rounded`,style:{width:`100%`,height:M},children:n(`div`,{className:`flex items-center gap-2 text-gray-500 dark:text-gray-400`,children:[t(ge,{className:`w-5 h-5 animate-spin`}),t(`span`,{className:`text-sm`,children:`Loading data from artifacts...`})]})})]})});if(D)return t(`div`,{className:`bg-white dark:bg-gray-900 rounded-lg border border-gray-200 dark:border-gray-800 shadow-sm`,children:n(`div`,{className:`flex flex-col gap-2 p-3`,children:[t(`div`,{className:`flex items-center justify-between`,children:t(`span`,{className:`font-medium text-sm text-gray-900 dark:text-gray-100`,children:s||`Chart`})}),t(`div`,{style:{width:`100%`,height:M},children:t(Sn,{error:D,chartTitle:s})})]})});if(h)return t(`div`,{className:`bg-white dark:bg-gray-900 rounded-lg border border-gray-200 dark:border-gray-800 shadow-sm`,children:n(`div`,{className:`flex flex-col gap-2 p-3`,children:[t(`div`,{className:`flex items-center justify-between`,children:t(`span`,{className:`font-medium text-sm text-gray-900 dark:text-gray-100`,children:s||`Chart`})}),t(`div`,{style:{width:`100%`,height:M},children:t(Sn,{error:h,chartTitle:s})})]})});let I=me(M),L=me(0,!0);return I?(typeof window<`u`&&localStorage.getItem(`DEBUG_VEGA_RENDERS`)&&console.log(`VegaLite rendering with spec:`,{title:s,hasData:!!I.data?.values,dataLength:I.data?.values?.length}),n(e,{children:[t(`div`,{className:hn(`bg-white dark:bg-gray-900 rounded-lg border border-gray-200 dark:border-gray-800 shadow-sm`,A&&`border-2`),children:n(`div`,{className:`flex flex-col gap-2 p-3`,children:[n(`div`,{className:`flex items-center justify-between`,children:[n(`div`,{className:`flex items-center gap-2`,children:[t(`span`,{className:`font-medium text-sm text-gray-900 dark:text-gray-100`,children:s||(A?`Dashboard`:`Chart`)}),A&&t(`span`,{className:`text-xs px-2 py-0.5 rounded-full bg-indigo-100 dark:bg-indigo-900 text-indigo-700 dark:text-indigo-300`,children:`Interactive`})]}),t(F,{})]}),c&&t(`span`,{className:`text-xs text-gray-500 dark:text-gray-400`,children:c}),t(`div`,{ref:b,className:`bg-white dark:bg-gray-900 rounded overflow-hidden`,style:{width:`100%`,height:M,minWidth:0},children:t(De,{fallback:t(Cn,{}),children:t(xn,{spec:I,onEmbed:e=>be(e.view),onError:Se,options:{renderer:l?.renderer||`canvas`,actions:!1}})})})]})}),n(wn,{isOpen:_,onClose:()=>v(!1),title:s||(A?`Dashboard`:`Chart`),description:c,children:[t(`div`,{className:`w-full h-full min-h-[calc(100vh-200px)]`,children:L&&t(De,{fallback:t(Cn,{}),children:t(xn,{spec:L,onEmbed:e=>xe(e.view),onError:Se,options:{renderer:l?.renderer||`canvas`,actions:!1}})})}),t(`div`,{className:`absolute bottom-6 end-6`,children:t(F,{className:`bg-white dark:bg-gray-800 rounded-lg shadow-lg p-2 border border-gray-200 dark:border-gray-700`})})]})]})):null},(e,t)=>JSON.stringify(e.spec)===JSON.stringify(t.spec)&&e.artifactRunId===t.artifactRunId),Ln=z.createContext({});function Rn({children:e,artifactRunId:n,onProposalSelect:r,onProposalSubmit:i,MarkdownRenderer:a}){let o=G(()=>({artifactRunId:n,onProposalSelect:r,onProposalSubmit:i,MarkdownRenderer:a}),[n,r,i,a]);return t(Ln.Provider,{value:o,children:e})}function zn(){return z.useContext(Ln)}const Bn={chart:{icon:A,label:`chart`,defaultHeight:200},mermaid:{icon:ue,label:`diagram`,defaultHeight:150},proposal:{icon:ve,label:`options`,defaultHeight:100},code:{icon:ae,label:`code`,defaultHeight:80},image:{icon:N,label:`image`,defaultHeight:150},link:{icon:me,label:`link`,defaultHeight:24},expand:{icon:ce,label:`content`,defaultHeight:100},table:{icon:L,label:`table`,defaultHeight:150},markdown:{icon:le,label:`content`,defaultHeight:100},"fusion-fragment":{icon:ae,label:`fragment`,defaultHeight:150}};function Z({type:e,error:i,onRetry:a,message:o,height:s}){let c=Bn[e],l=s??c.defaultHeight,u=e===`link`;if(i)return n(`div`,{className:`flex items-center gap-2 rounded border border-destructive/30 bg-destructive/5 text-destructive ${u?`inline-flex px-2 py-1 text-sm`:`p-4`}`,style:u?void 0:{minHeight:l},children:[n(`span`,{className:`text-destructive`,children:[`Failed to load `,c.label]}),a&&t(r,{variant:`unstyled`,onClick:a,className:`ms-2 rounded bg-destructive/10 px-2 py-1 text-xs hover:bg-destructive/20 transition-colors text-destructive`,children:`Retry`})]});let d=c.icon;return u?n(`span`,{className:`inline-flex items-center gap-1 text-muted animate-pulse`,children:[t(d,{className:`h-3 w-3`}),t(`span`,{children:o||`Loading ${c.label}...`})]}):n(`div`,{className:`flex flex-col items-center justify-center gap-3 rounded border border-border bg-muted/30 animate-pulse`,style:{minHeight:l},children:[t(d,{className:`h-8 w-8 text-muted`}),t(`span`,{className:`text-sm text-muted`,children:o||`Loading ${c.label}...`}),t(`div`,{className:`flex gap-1`,children:[...[,,,]].map((e,n)=>t(`div`,{className:`h-2 w-2 rounded-full bg-muted animate-bounce`,style:{animationDelay:`${n*150}ms`}},`dot-${n}`))})]})}var Q=class extends z.Component{constructor(e){super(e),this.state={hasError:!1}}static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(e,t){console.error(`CodeBlock rendering error (${this.props.type}):`,e,t),this.props.onError?.(e)}handleRetry=()=>{this.setState({hasError:!1,error:void 0})};render(){if(this.state.hasError){let{type:e,fallbackCode:r}=this.props;return n(`div`,{className:`space-y-2`,children:[t(Z,{type:e,error:this.state.error?.message||`Rendering failed`,onRetry:this.handleRetry}),r&&n(`details`,{className:`text-sm`,children:[t(`summary`,{className:`cursor-pointer text-muted hover:text-foreground`,children:`Show raw content`}),t(`pre`,{className:`mt-2 overflow-x-auto rounded bg-muted/50 p-2 text-xs`,children:t(`code`,{children:r})})]})]})}return this.props.children}};function Vn(e,t,n){let r=t.split(`.`).pop()?.toLowerCase();if(r===`svg`)return`mockup`;if([`png`,`jpg`,`jpeg`,`gif`,`webp`].includes(r||``))return`image`;if(r===`md`)return`markdown`;if(r===`csv`)return`table`;if(n===`json`&&typeof e==`object`&&e){let t=e;if(typeof t.$schema==`string`&&t.$schema.includes(`vega`)||t.library===`vega-lite`&&`spec`in t)return`vega-lite`;if(`template`in t&&`data`in t)return`fusion-fragment`;if(Array.isArray(e)&&e.length>0&&typeof e[0]==`object`)return`table`}return`code`}function Hn(e){if(typeof e!=`object`||!e)return null;let t=e;return t.library===`vega-lite`&&`spec`in t&&typeof t.spec==`object`&&t.spec!==null?t:typeof t.$schema==`string`&&t.$schema.includes(`vega`)?{library:`vega-lite`,spec:t}:null}function Un({content:e}){let{headers:r,rows:i}=G(()=>{if(!Array.isArray(e)||e.length===0)return{headers:[],rows:[]};let t=e[0];if(typeof t!=`object`||!t)return{headers:[],rows:[]};let n=Object.keys(t);return{headers:n,rows:e.map(e=>n.map(t=>{let n=e[t];return n==null?``:typeof n==`object`?JSON.stringify(n):String(n)}))}},[e]);return r.length===0?t(Z,{type:`table`,error:`No table data found`}):n(`div`,{className:`overflow-x-auto`,children:[n(`table`,{className:`min-w-full text-sm border-collapse`,children:[t(`thead`,{children:t(`tr`,{className:`border-b`,children:r.map(e=>t(`th`,{className:`px-3 py-2 text-start font-medium text-muted`,children:e},e))})}),t(`tbody`,{children:i.slice(0,100).map((e,n)=>t(`tr`,{className:`border-b border-muted/20`,children:e.map((e,n)=>t(`td`,{className:`px-3 py-2`,children:e},`cell-${n}`))},`row-${n}`))})]}),i.length>100&&n(`div`,{className:`text-sm text-muted py-2`,children:[`Showing 100 of `,i.length,` rows`]})]})}function Wn({content:e,path:n}){let r=n.split(`.`).pop()?.toLowerCase()||``,i=typeof e==`string`?e:JSON.stringify(e,null,2);return t(`pre`,{className:`overflow-x-auto p-3 bg-muted/10 rounded text-sm`,children:t(`code`,{className:`language-${r}`,children:i})})}function Gn(e){return Fe.sanitize(e,{USE_PROFILES:{svg:!0,svgFilters:!0},ADD_TAGS:[`use`],FORBID_TAGS:[`foreignObject`]})}function Kn(e){return e.replace(/<svg([^>]*)>/i,(e,t)=>{let n=t;if(!/viewBox/i.test(n)){let e=/\swidth\s*=\s*["']?(\d+(?:\.\d+)?)/i.exec(n),t=/\sheight\s*=\s*["']?(\d+(?:\.\d+)?)/i.exec(n);e&&t&&(n+=` viewBox="0 0 ${e[1]} ${t[1]}"`)}return n=n.replace(/\swidth\s*=\s*(?:"[^"]*"|'[^']*'|[^\s>]+)/i,``).replace(/\sheight\s*=\s*(?:"[^"]*"|'[^']*'|[^\s>]+)/i,``),/style="/i.test(n)?n=n.replace(/style="([^"]*)"/i,(e,t)=>`style="${t};width:100%;height:auto;display:block;max-width:100%;"`):n+=` style="width:100%;height:auto;display:block;max-width:100%;"`,/preserveAspectRatio=/i.test(n)||(n+=` preserveAspectRatio="xMidYMid meet"`),`<svg${n}>`})}function qn({content:e}){let n=G(()=>{let t=typeof e==`string`?e.trim():``;return t?Kn(Gn(t)):null},[e]);return n?t(`div`,{style:{margin:`16px 0`,width:`100%`,overflowX:`auto`},dangerouslySetInnerHTML:{__html:n}}):t(Z,{type:`expand`,error:`Empty mockup`})}function Jn({content:e,path:n}){let r=typeof e==`string`?e:``,i=n.split(`/`).pop()||`Artifact image`;return t(`img`,{src:r,alt:i,className:`max-w-full h-auto rounded`,loading:`lazy`})}function Yn({content:e,renderType:n,path:r,runId:i,contentType:a}){let{MarkdownRenderer:o}=zn();switch(G(()=>n===`auto`?Vn(e,r,a):n,[e,r,a,n])){case`chart`:{let n=Hn(e);return n?t(Q,{type:`chart`,fallbackCode:JSON.stringify(e,null,2),children:t(In,{spec:n,artifactRunId:i})}):t(Z,{type:`chart`,error:`Only Vega-Lite charts are supported. Recharts rendering has been retired.`})}case`vega-lite`:{let n=Hn(e);return n?t(Q,{type:`chart`,fallbackCode:JSON.stringify(e,null,2),children:t(In,{spec:n,artifactRunId:i})}):t(Z,{type:`chart`,error:`Invalid Vega-Lite specification`})}case`fusion-fragment`:{let n=e;return console.log(`[ArtifactContentRenderer] fusion-fragment:`,{hasTemplate:!!n.template,hasData:!!n.data,runId:i,hasVegaLiteChart:!!In}),n.template&&n.data?t(Q,{type:`fusion-fragment`,fallbackCode:JSON.stringify(e,null,2),children:t(Pe,{data:n.data,ChartComponent:In,artifactRunId:i,children:t(Ne,{code:JSON.stringify(n.template),data:n.data})})}):t(Q,{type:`fusion-fragment`,fallbackCode:JSON.stringify(e,null,2),children:t(Ne,{code:JSON.stringify(e)})})}case`table`:return t(Q,{type:`table`,fallbackCode:JSON.stringify(e,null,2),children:t(Un,{content:e})});case`markdown`:{let n=typeof e==`string`?e:String(e);return t(Q,{type:`markdown`,fallbackCode:n,children:o?t(o,{artifactRunId:i,children:n}):t(`pre`,{className:`overflow-x-auto p-3 bg-muted/10 rounded text-sm`,children:t(`code`,{children:n})})})}case`mockup`:return t(Q,{type:`expand`,fallbackCode:typeof e==`string`?e:r,children:t(qn,{content:e})});case`image`:return t(Q,{type:`image`,fallbackCode:r,children:t(Jn,{content:e,path:r})});default:return t(Wn,{content:e,path:r})}}var Xn=class{components={};registerComponent(e,t){this.components[e]=t}getComponent(e){return this.components[e]}};const Zn=B(null);function Qn({components:e,children:n}){let r=G(()=>{let t=new Xn;for(let[n,r]of Object.entries(e))t.registerComponent(n,r);return t},[e]);return t(Zn.Provider,{value:r,children:n})}function $n(){return U(Zn)}function er(e){let t=U(Zn);if(t)return t.getComponent(e)}const tr=`Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif`;function nr(e){let t=e.trim(),n=``,r=!1,i=!1;for(let e=0;e<t.length;e++){let a=t[e],o=e>0?t[e-1]:``;if(a===`"`&&!i&&o!==`\\`){r=!r,n+=a;continue}if(a===`'`&&!r&&o!==`\\`){i=!i,n+=a;continue}if((r||i)&&a===`\\`){let r=e;for(;t[r]===`\\`;)r++;if(t[r]===`n`){n+=`<br/>`,e=r;continue}}n+=a}return n}function rr(e){return e.replace(/<svg([^<>]*)>/i,(e,t)=>{let n=t.replace(/\swidth="[^"]*"/i,``).replace(/\sheight="[^"]*"/i,``);return/style="/i.test(n)?n=n.replace(/style="([^"]*)"/i,(e,t)=>`style="${t};width:100%;height:auto;display:block;max-width:100%;"`):n+=` style="width:100%;height:auto;display:block;max-width:100%;"`,/preserveAspectRatio=/i.test(n)||(n+=` preserveAspectRatio="xMidYMid meet"`),`<svg${n}>`})}let ir;function ar(){return ir||=import(`mermaid`).then(({default:e})=>(e.initialize({startOnLoad:!1,theme:`default`,securityLevel:`loose`,fontFamily:tr,suppressErrorRendering:!0,flowchart:{htmlLabels:!0,useMaxWidth:!0,nodeSpacing:40,rankSpacing:50,padding:12},sequence:{useMaxWidth:!0},themeVariables:{fontFamily:tr}}),e)),ir}function or({code:e,className:n}){let r=K(null),[i,a]=q(null),[o,s]=q(null),c=ke().replace(/:/g,`_`);return W(()=>{let t=!1;return(async()=>{if(!e.trim()){a(null),s(null);return}try{s(null);let n=`mermaid-${c}-${Date.now()}`,r=nr(e),{svg:i}=await(await ar()).render(n,r),o=rr(i);t||a(o)}catch(e){if(!t){let t=e instanceof Error?e.message:`Failed to render mermaid diagram`;s(t),a(null)}}})(),()=>{t=!0}},[e,c]),o?null:i?t(`div`,{ref:r,className:`my-4 w-full overflow-x-auto [&_svg]:mx-auto [&_svg]:w-full [&_svg]:h-auto [&_svg]:max-w-full ${n||``}`,dangerouslySetInnerHTML:{__html:i}}):t(`div`,{className:`my-4 p-4 bg-gray-50 dark:bg-gray-800 rounded-lg animate-pulse ${n||``}`,children:t(`div`,{className:`h-32 bg-gray-200 dark:bg-gray-700 rounded`})})}function sr(e){switch(e.split(`.`).pop()?.toLowerCase()){case`json`:return`json`;case`md`:case`txt`:case`csv`:case`yaml`:case`yml`:return`text`;case`png`:case`jpg`:case`jpeg`:case`gif`:case`webp`:case`pdf`:return`binary`;default:return`text`}}function cr({runId:e,path:t,parseJson:n=!0}){let{client:r}=Ie(),i=_n(),a=K(r);a.current=r;let o=K(i);o.current=i;let[s,c]=q({data:void 0,rawContent:void 0,isLoading:!0,error:void 0,contentType:void 0}),l=H(async()=>{if(!e){c({data:void 0,rawContent:void 0,isLoading:!1,error:`No run ID provided`,contentType:void 0});return}if(!t){c({data:void 0,rawContent:void 0,isLoading:!1,error:`No artifact path provided`,contentType:void 0});return}c(e=>({...e,isLoading:!0,error:void 0}));let r=a.current,i=o.current,s=sr(t);try{let a=yn(e,t,`inline`),o;o=i?await i.getOrFetch(a,async()=>(await r.files.getArtifactDownloadUrl(e,t,`inline`)).url):(await r.files.getArtifactDownloadUrl(e,t,`inline`)).url;let l=await fetch(o);if(!l.ok)throw Error(`Failed to fetch artifact: ${l.status} ${l.statusText}`);if(s===`binary`){c({data:o,rawContent:void 0,isLoading:!1,error:void 0,contentType:s,etag:l.headers.get(`etag`)?.replace(/^"(.*)"$/,`$1`)});return}let u=await l.text(),d;if(n&&s===`json`)try{d=JSON.parse(u)}catch{d=u}else d=u;c({data:d,rawContent:u,isLoading:!1,error:void 0,contentType:s,etag:l.headers.get(`etag`)?.replace(/^"(.*)"$/,`$1`)})}catch(e){let n=e instanceof Error?e.message:`Failed to fetch artifact`;console.error(`Failed to fetch artifact content:`,t,e),c({data:void 0,rawContent:void 0,isLoading:!1,error:n,contentType:s})}},[e,t,n]);W(()=>{l()},[l]);let u=H(()=>{c({data:void 0,rawContent:void 0,isLoading:!0,error:void 0,contentType:void 0}),l()},[l]);return{data:s.data,rawContent:s.rawContent,isLoading:s.isLoading,error:s.error,contentType:s.contentType,etag:s.etag,retry:u}}function lr(e){let t=e.trim();if(t.length<2)return!0;if(!t.startsWith(`{`))return!1;try{return JSON.parse(t),!1}catch(e){let n=e instanceof Error?e.message:``,r=[`unexpected end`,`unterminated string`,`expected`,`unexpected token`],i=n.toLowerCase();if(r.some(e=>i.includes(e))){let e=0,n=0,r=!1,i=!1;for(let a of t){if(i){i=!1;continue}if(a===`\\`){i=!0;continue}if(a===`"`){r=!r;continue}r||(a===`{`?e++:a===`}`?e--:a===`[`?n++:a===`]`&&n--)}return e>0||n>0||r}return!1}}function ur(e){try{let t=e.trim(),n=t.indexOf(`{`),r=t.lastIndexOf(`}`);return n!==-1&&r>n&&(t=t.slice(n,r+1)),JSON.parse(t)}catch{return null}}function dr(e){let t=typeof e.$schema==`string`&&e.$schema.includes(`vega`),n=e.library===`vega-lite`&&`spec`in e;return t||n?`vega-lite`:null}function fr({code:e}){let{artifactRunId:n}=zn();n||console.warn(`[VegaLiteCodeBlockHandler] artifactRunId is missing from CodeBlockContext`);let r=G(()=>lr(e),[e]),i=G(()=>{if(r)return null;let t=ur(e);return t?{library:`vega-lite`,spec:t}:null},[e,r]);return r?t(Z,{type:`chart`,message:`Loading chart...`}):i?t(Q,{type:`chart`,fallbackCode:e,children:t(In,{spec:i,artifactRunId:n})}):t(Z,{type:`chart`,error:`Invalid Vega-Lite specification`})}function pr({code:e}){let{artifactRunId:n}=zn();n||console.warn(`[ChartCodeBlockHandler] artifactRunId is missing from CodeBlockContext`);let r=G(()=>lr(e),[e]),i=G(()=>{if(r)return null;let t=ur(e);return!t||!dr(t)?null:t.library===`vega-lite`&&`spec`in t&&typeof t.spec==`object`?t:{library:`vega-lite`,spec:t}},[e,r]);return r?t(Z,{type:`chart`,message:`Loading chart...`}):i?t(Q,{type:`chart`,fallbackCode:e,children:t(In,{spec:i,artifactRunId:n})}):t(Z,{type:`chart`,error:`Invalid Vega-Lite chart specification`})}function mr({code:e}){let n=e.trim();return n?t(Q,{type:`mermaid`,fallbackCode:e,children:t(or,{code:n})}):t(Z,{type:`mermaid`,error:`Empty diagram`})}function hr({code:e}){let n=G(()=>{let t=e.trim();return t?Kn(Gn(t)):null},[e]);return n?t(Q,{type:`code`,fallbackCode:e,children:t(`div`,{style:{margin:`16px 0`,width:`100%`,overflowX:`auto`},dangerouslySetInnerHTML:{__html:n}})}):t(Z,{type:`code`,error:`Empty mockup`})}function gr({code:e,language:n}){let{artifactRunId:r}=zn(),i=e.trim(),a=G(()=>{if(!n?.includes(`:`))return`auto`;let e=n.split(`:`)[1];return[`chart`,`vega-lite`,`table`,`markdown`,`fusion-fragment`,`mockup`,`code`,`image`,`auto`].includes(e)?e:`auto`},[n]),{data:o,isLoading:s,error:c,contentType:l}=cr({runId:r,path:i});return r?s?t(Z,{type:`expand`,message:`Loading ${i}...`}):c?t(Z,{type:`expand`,error:`Failed to load artifact: ${c}`}):o===void 0?t(Z,{type:`expand`,error:`No content found in artifact`}):t(Yn,{content:o,renderType:a,path:i,runId:r,contentType:l}):t(Z,{type:`expand`,error:`No artifact run ID available`})}function _r(e){return e?.startsWith(`expand`)??!1}function vr(){return{chart:pr,"vega-lite":fr,vegalite:fr,mermaid:mr,mockup:hr,svg:hr}}const yr=new Set([`store`,`document`,`collection`,`interaction`,`prompt`,`agent`,`workflow`,`process`,`run`]);function br(e){return e.trim().replace(/^\/+/,``)}function xr(e){if(e.startsWith(`artifact:`))return{scheme:`artifact`,path:e.slice(9).trim()};if(e.startsWith(`image:`))return{scheme:`image`,path:e.slice(6).trim()};let t=e.indexOf(`:`);if(t>0){let n=e.slice(0,t);if(yr.has(n))return{scheme:n,path:br(e.slice(t+1))}}return{scheme:`standard`,path:e}}function Sr({rawUrl:e,artifactRunId:t,disposition:n=`inline`}){let{client:r}=Ie(),i=_n(),a=K(r);a.current=r;let o=K(i);o.current=i;let{scheme:s,path:c}=xr(e),[l,u]=q(()=>{if(s===`standard`)return{url:e,isLoading:!1,error:void 0};if(i&&(s===`artifact`||s===`image`)){let e;e=s===`artifact`&&t&&!vn(c)?yn(t,c,n):bn(c);let r=i.getUrl(e);if(r)return{url:r,isLoading:!1,error:void 0}}return{url:void 0,isLoading:!0,error:void 0}}),d=H(async()=>{if(s===`standard`)return;if(s!==`artifact`&&s!==`image`){u({url:void 0,isLoading:!1,error:`Unknown scheme: ${s}`});return}u(e=>({...e,isLoading:!0,error:void 0}));let e=a.current,r=o.current;try{let i;if(s===`artifact`){if(t&&!vn(c)){let a=yn(t,c,n);i=r?await r.getOrFetch(a,async()=>(await e.files.getArtifactDownloadUrl(t,c,n)).url):(await e.files.getArtifactDownloadUrl(t,c,n)).url}else{let t=bn(c);i=r?await r.getOrFetch(t,async()=>(await e.files.getDownloadUrl(c)).url):(await e.files.getDownloadUrl(c)).url}}else{let t=bn(c);i=r?await r.getOrFetch(t,async()=>(await e.files.getDownloadUrl(c)).url):(await e.files.getDownloadUrl(c)).url}u({url:i,isLoading:!1,error:void 0})}catch(e){let t=e instanceof Error?e.message:`Failed to resolve URL`;console.error(`Failed to resolve URL:`,c,e),u({url:void 0,isLoading:!1,error:t})}},[s,c,t,n]);W(()=>{if(l.url&&!l.error)return;let e=!1;return e||(async()=>{await d()})(),()=>{e=!0}},[d,l.url,l.error]);let f=H(()=>{u({url:void 0,isLoading:!0,error:void 0}),d()},[d]);return{url:l.url,isLoading:l.isLoading,error:l.error,scheme:s,retry:f}}function Cr({src:e,alt:r,caption:i,className:a,artifactRunId:o}){let s=e||``,{scheme:c}=xr(s);return c===`standard`?n(`figure`,{className:`my-4`,children:[t(`img`,{src:e,alt:r,className:a}),t(`figcaption`,{className:`mt-2 text-sm text-muted text-center italic`,children:i})]}):t(wr,{rawSrc:s,alt:r,caption:i,artifactRunId:o,className:a})}function wr({rawSrc:e,alt:r,caption:i,artifactRunId:a,className:o}){let{url:s,isLoading:c,error:l,retry:u}=Sr({rawUrl:e,artifactRunId:a,disposition:`inline`});return c?t(Z,{type:`image`,message:r?`Loading ${r}...`:void 0}):l?t(Z,{type:`image`,error:l,onRetry:u}):s?n(`figure`,{className:`my-4`,children:[t(`img`,{src:s,alt:r,className:o}),t(`figcaption`,{className:`mt-2 text-sm text-muted text-center italic`,children:i})]}):null}function Tr({node:e,src:n,alt:r,className:i,artifactRunId:a,ExistingImg:o,...s}){let c=n||``,{scheme:l}=xr(c);return l===`standard`?typeof o==`function`?t(o,{node:e,src:n,alt:r,...s}):t(`img`,{src:n,alt:r,className:i,...s}):t(Er,{rawSrc:c,alt:r,artifactRunId:a,className:i,rest:s})}function Er({rawSrc:e,alt:n,artifactRunId:r,className:i,rest:a}){let{url:o,isLoading:s,error:c,retry:l}=Sr({rawUrl:e,artifactRunId:r,disposition:`inline`});return s?t(Z,{type:`image`,message:n?`Loading ${n}...`:void 0}):c?t(Z,{type:`image`,error:c,onRetry:l}):o?t(`img`,{src:o,alt:n,className:i,...a}):null}function Dr({node:e,href:n,children:r,className:i,artifactRunId:a,onArtifactOpen:o,ExistingLink:s,...c}){let l=n||``,u=mn(l);if(u)return t(Or,{resource:u,rawHref:l,artifactRunId:a,className:i,ExistingLink:s,rest:c,children:r});let{scheme:d,path:f}=xr(l);return d===`standard`?typeof s==`function`?t(s,{node:e,href:n,className:i,...c,children:r}):t(`a`,{href:n,...c,className:i,target:`_blank`,rel:`noopener noreferrer`,children:r}):t(kr,{rawHref:l,artifactRunId:a,artifactPath:d===`artifact`?f:void 0,onArtifactOpen:o,className:i,rest:c,children:r})}function Or({resource:e,rawHref:n,artifactRunId:i,className:a,children:o,ExistingLink:s,rest:c}){let l=fn()(e,{workflowRunId:i,source:`markdown`,rawHref:n});return l.kind===`navigate`?typeof s==`function`?t(s,{href:l.href,className:a,...c,children:o}):t(`a`,{href:l.href,...c,className:a,target:`_blank`,rel:`noopener noreferrer`,children:o}):l.kind===`activate`?t(r,{variant:`link`,size:`none`,className:a,onClick:l.onActivate,children:o}):t(`span`,{className:a,children:o})}function kr({rawHref:e,artifactRunId:n,artifactPath:r,onArtifactOpen:i,className:a,children:o,rest:s}){let{url:c,isLoading:l,error:u,retry:d}=Sr({rawUrl:e,artifactRunId:n,disposition:`attachment`});return l?t(`span`,{className:`inline-flex items-center gap-1 text-muted`,children:t(Z,{type:`link`})}):u?t(`span`,{className:`inline-flex items-center gap-1`,children:t(Z,{type:`link`,error:u,onRetry:d})}):t(`a`,{href:c||`#`,...s,className:a,target:`_blank`,rel:`noopener noreferrer`,onClick:e=>{r&&/\.md$/i.test(r)&&i&&!e.metaKey&&!e.ctrlKey&&!e.shiftKey&&e.button===0&&(e.preventDefault(),i(r))},children:o})}const Ar=[`artifact:`,`image:`,`store:`,`document://`,`collection:`,`interaction:`,`prompt:`,`agent:`,`workflow:`,`process:`,`run:`],jr=/(!?\[[^[\]\n]*\]\()((?:artifact:|image:|store:|document:\/\/|collection:|interaction:|prompt:|agent:|workflow:|process:|run:)[^)[\n]+)(\))/g,Mr=/`[^`\n]*`/g,Nr=/(^|\n)(`{3,}|~{3,})[^\n]*\n[\s\S]*?\n\2(?=\n|$)/g,Pr=/\s+("(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*'|\([^)]*\))\s*$/;function Fr(e){return Ar.some(t=>e.startsWith(t))}function Ir(e){let t=e.trim();if(t.startsWith(`<`)){let n=t.indexOf(`>`);if(n>0&&Fr(t.slice(1,n).trim()))return e}let n=t.match(Pr)?.index??-1,r=(n>=0?t.slice(0,n):t).trim(),i=n>=0?t.slice(n):``;return Fr(r)?`<${r}>${i}`:e}function Lr(e){return e.replace(jr,(e,t,n,r)=>`${t}${Ir(n)}${r}`)}function Rr(e){let t=``,n=0;for(let r of e.matchAll(Mr))t+=Lr(e.slice(n,r.index)),t+=r[0],n=r.index+r[0].length;return t+=Lr(e.slice(n)),t}function zr(e){if(!e||!Ar.some(t=>e.includes(t)))return e;let t=``,n=0;for(let r of e.matchAll(Nr))t+=Rr(e.slice(n,r.index)),t+=r[0],n=r.index+r[0].length;return t+=Rr(e.slice(n)),t}const Br=/^([ \t]*):::([^\n]*?):::[ \t]*$/gm,Vr=/^\w+/;function Hr(e){return e?.includes(`:::`)?e.replace(Br,(e,t,n)=>{let r=n.trim(),i=Vr.exec(r);if(!i)return e;let a=i[0],o=r.slice(a.length).trim();return o?`${t}:::${a}\n${t}${o}\n${t}:::`:`${t}::${a}`}):e}const Ur=/(^|\n)(`{3,}|~{3,})[^\n]*\n[\s\S]*?\n\2(?=\n|$)/g,Wr=/`[^`\n]*`/g,Gr=/\\\$/g,Kr=/\\[^\s]/,qr=/[{}]/,Jr=/[_^][\w{]/,Yr=/^[a-zA-Z]$/,Xr=/^[a-zA-Z]\s*=/,Zr=/^\s/,Qr=/\s$/,$r=/[+*/-]$/,ei=/\^[+-]$/;function ti(e){return Kr.test(e)||qr.test(e)||Jr.test(e)||Yr.test(e)||Xr.test(e)}function ni(e){return!!(Zr.test(e)||Qr.test(e)||$r.test(e)&&!ei.test(e))}function ri(e){let t=[];for(let n=0;n<e.length;n++)if(e[n]===`$`&&!(n>0&&e[n-1]===`\\`)){if(n+1<e.length&&e[n+1]===`$`){n++;continue}n>0&&e[n-1]===`$`&&(n<2||e[n-2]!==`\\`)||t.push(n)}return t}function ii(e,t,n){let r=e.slice(t+1,n);return r.length===0||r.includes(`
6
- `)?null:r}function ai(e){let t=ri(e);if(t.length<2)return e;let n=new Set,r=new Set,i=Array(t.length-1);for(let n=0;n<t.length-1;n++)i[n]=ii(e,t[n],t[n+1]);let a=[];for(let e=0;e<t.length-1;e++){if(n.has(e))continue;let r=i[e];r!==null&&ti(r)&&(n.add(e),n.add(e+1),a.push([t[e],t[e+1]]))}let o=0;for(;o<t.length;){if(n.has(o)){o++;continue}let e=o+1;for(;e<t.length&&n.has(e);)e++;if(e>=t.length)break;if(e>o+1){r.add(t[o]),o++;continue}let a=i[o];if(a===null){o++;continue}ni(a)&&(r.add(t[o]),r.add(t[e])),n.add(o),n.add(e),o=e+1}for(let e=0;e<t.length;e++)n.has(e)||e+1<t.length&&n.has(e+1)&&r.add(t[e]);if(r.size===0&&a.length===0)return e;let s=[],c=0,l=Array.from(r).sort((e,t)=>e-t),u=0,d=0;for(;u<l.length||d<a.length;){let t=u<l.length?l[u]:1/0;if(t<(d<a.length?a[d][0]:1/0))t>c&&s.push(e.slice(c,t)),s.push(`\\$`),c=t+1,u++;else{let[t,n]=a[d];t>c&&s.push(e.slice(c,t));let r=e.slice(t,n+1);for(s.push(r.replace(Gr,`\\text{\\textdollar}`)),c=n+1;u<l.length&&l[u]<=n;)u++;d++}}return c<e.length&&s.push(e.slice(c)),s.join(``)}function oi(e){let t=[],n=0;for(let r of e.matchAll(Wr))t.push(ai(e.slice(n,r.index))),t.push(r[0]),n=r.index+r[0].length;return t.push(ai(e.slice(n))),t.join(``)}function si(e){if(!e?.includes(`$`))return e;let t=[],n=0;for(let r of e.matchAll(Ur))t.push(oi(e.slice(n,r.index))),t.push(r[0]),n=r.index+r[0].length;return t.push(oi(e.slice(n))),t.join(``)}const ci={note:`md-callout-info`,tip:`md-callout-info`,warning:`md-callout-attention`,important:`md-callout-attention`,caution:`md-callout-destructive`},li={note:`Note`,tip:`Tip`,warning:`Warning`,important:`Important`,caution:`Caution`};function ui(){return e=>{Ye(e,e=>{if(e.type!==`containerDirective`&&e.type!==`leafDirective`&&e.type!==`textDirective`)return;let t=e;t.data||={};let n=t.data,r=t.attributes||{},i=t.name;if(i===`pagebreak`){n.hName=`hr`,n.hProperties={className:`md-pagebreak`};return}if(i===`columns`){n.hName=`div`,n.hProperties={className:`md-columns`};return}if(i===`column`){n.hName=`div`;let e={className:`md-column`};r.width&&(e.style=`flex-basis:${r.width};flex-grow:0;flex-shrink:0`),n.hProperties=e;return}if(i in ci){n.hName=`div`,n.hProperties={className:`md-callout ${ci[i]}`,"data-callout-type":i};let e=li[i];if(e&&t.children){let n={type:`paragraph`,data:{hName:`p`,hProperties:{className:`md-callout-title`}},children:[{type:`text`,value:e}]};t.children.unshift(n)}return}n.hName=`div`,n.hProperties={className:`md-${i}`,...Object.fromEntries(Object.entries(r).filter(([e])=>e!==`class`))},r.class&&(n.hProperties.className+=` ${r.class}`)})}}const di=/(?:^|[^\\])\$/,fi=[];let pi,mi;function hi(){return mi||=import(`rehype-katex`).then(({default:e})=>(pi=e,e)),mi}function gi(e){let t=z.useMemo(()=>di.test(e),[e]),[n,r]=z.useState(()=>pi);return z.useEffect(()=>{if(!t||n)return;let e=!1;return hi().then(t=>{e||r(()=>t)}).catch(e=>{console.error(`Failed to load KaTeX; math will render unstyled`,e)}),()=>{e=!0}},[t,n]),z.useMemo(()=>n?[n]:fi,[n])}const _i=[`artifact:`,`image:`,`store:`,`document:`,`document://`,`collection:`,`interaction:`,`prompt:`,`agent:`,`workflow:`,`process:`,`run:`];function vi(e){return _i.some(t=>e.startsWith(t))?e:Be(e)}function yi(){return e=>{Ye(e,`html`,(e,t,n)=>{let r=e,i=n;if(typeof r.value==`string`&&/<!--[\s\S]*?-->/.test(r.value)&&i?.children&&typeof t==`number`)return i.children.splice(t,1),[Je,t]})}}const bi=vr();function xi({children:e,components:n,remarkPlugins:r=[],removeComments:i=!0,artifactRunId:a,onArtifactOpen:o,className:s,codeClassName:c,inlineCodeClassName:l,linkClassName:u,imageClassName:d,onProposalSelect:f,onProposalSubmit:p,preserveSourcePositions:m=!1}){let h=$n(),g=z.useMemo(()=>m?e:Hr(zr(si(e))),[e,m]),_=z.useMemo(()=>{let e=[We,Ue,ui,Ge,He,qe,Ke,...r];return i&&e.push(yi),e},[r,i]),v=gi(g),y=z.useMemo(()=>({handlers:{...Ve}}),[]),ee=z.useMemo(()=>{let e=n||{},r=e.code,i=e.a,s=e.img,f=({node:e,className:n,children:i,...a})=>{let o=/language-([\w-]+)/.exec(n||``),s=!o,u=o?o[1]:``;if(!s&&u){if(h){let e=h.getComponent(u);if(e){let n=String(i||``).trim();return t(e,{code:n,language:u})}}if(_r(u)){let e=String(i||``).trim();return t(gr,{code:e,language:u})}let e=bi[u];if(e){let n=String(i||``).trim();return t(e,{code:n,language:u})}}return typeof r==`function`?t(r,{node:e,className:n,...a,children:i}):t(`code`,{...a,className:s?`px-1.5 py-0.5 rounded ${l||``}`:` ${c||``}`,children:i})},p=e=>{let{node:n,href:r,children:s,...c}=e;return t(Dr,{node:n,href:r,className:u,artifactRunId:a,onArtifactOpen:o,ExistingLink:typeof i==`function`?i:void 0,...c,children:s})},m=e=>{let{node:n,src:r,alt:i,title:o,...c}=e;return o?t(Cr,{src:r,alt:i,caption:o,className:d,artifactRunId:a}):t(Tr,{node:n,src:r,alt:i,className:d,artifactRunId:a,ExistingImg:typeof s==`function`?s:void 0,...c})};return{...e,code:f,a:p,img:m}},[n,a,o,h,c,l,u,d]),b=t(Rn,{artifactRunId:a,onProposalSelect:f,onProposalSubmit:p,MarkdownRenderer:xi,children:t(ze,{remarkPlugins:_,rehypePlugins:v,remarkRehypeOptions:y,components:ee,urlTransform:vi,children:g})});return s?t(`div`,{className:`md-content ${s}`,children:b}):t(`div`,{className:`md-content`,children:b})}const Si=new Set([`list`,`blockquote`,`table`]),Ci=B(null),wi=B(!1),Ti=V(()=>import(`@vertesia/ui/rich-text`).then(e=>({default:e.VertesiaMarkdownComponentEditor}))),Ei=/^ {0,3}(#{1,6})[\t ]+(.+?)[\t ]*#*[\t ]*$/,Di=/^ {0,3}(`{3,}|~{3,})/;function Oi(){return typeof crypto<`u`&&`randomUUID`in crypto?crypto.randomUUID():`edit-${Date.now()}-${Math.random().toString(36).slice(2,10)}`}function ki(e,t,n){let r=t?.position?.start.offset,i=t?.position?.end.offset,a=typeof r==`number`&&typeof i==`number`&&r>=0&&i>=r,o=a?e.slice(r,i):``;return{block_id:a?`${n}:${r}:${i}`:`${n}:${Oi()}`,block_type:n,...a?{source_range:{start:r,end:i}}:{},exact_text:o,...a&&r>0?{prefix:e.slice(Math.max(0,r-80),r)}:{},...a&&i<e.length?{suffix:e.slice(i,Math.min(e.length,i+80))}:{}}}function Ai(e,t){let n=t.source_range?.start;if(typeof n!=`number`)return t;let r=Mi(e,n),i=Ni(e,t.exact_text,n,r);return{...t,...r.length>0?{heading_path:r}:{},occurrence_index:i}}function ji(e,t,n){return Ai(e,ki(e,t,n))}function Mi(e,t){let n=[],r=null,i=0;for(let a of e.slice(0,t).split(`
7
- `)){let e=Di.exec(a);if(e){let t=e[1]?.[0];r?t===r&&(r=null):r=t??null,i+=a.length+1;continue}if(!r){let e=Ei.exec(a);if(e){let t=e[1]?.length??1,r=e[2]?.trim();r&&(n.length=t-1,n[t-1]=r)}}if(i+=a.length+1,i>t)break}return n.filter(e=>!!e)}function Ni(e,t,n,r){if(!t)return 0;let i=0,a=e.indexOf(t);for(;a>=0&&a<n;){let n=Mi(e,a);n.length===r.length&&n.every((e,t)=>e===r[t])&&i++,a=e.indexOf(t,a+Math.max(1,t.length))}return i}function Pi(e){return e.kind===`store_document`?`store:${e.document_id}`:`artifact:${e.path} (run ${e.run_id})`}function Fi(...e){let t=0;for(let n of e)for(let e of n.matchAll(/`+/g))t=Math.max(t,e[0].length);return"`".repeat(Math.max(3,t+1))}function Ii(e,t){let n=t.user_change;if(!n)return;let{before:r,after:i}=n,a=t.anchor.source_range;if(a&&e.slice(a.start,a.end)===r)return e.slice(0,a.start)+i+e.slice(a.end);let o=t.anchor.prefix;if(o){let t=e.indexOf(o+r);if(t>=0&&e.indexOf(o+r,t+1)<0){let n=t+o.length;return e.slice(0,n)+i+e.slice(n+r.length)}}let s=e.indexOf(r);if(!(s<0||e.indexOf(r,s+1)>=0))return e.slice(0,s)+i+e.slice(s+r.length)}function Li(e){let t=Pi(e.resource),n=e.anchor.block_type.replace(`_`,` `);if(e.action===`edit`&&e.user_change&&e.applied){let r=Fi(e.user_change.before,e.user_change.after);return[`I already edited the ${n} in ${t} myself and the change is saved${e.updated_document_id?` as revision ${e.updated_document_id}`:``}.`,`Operation: ${e.operation_id}`,`This is a notification only. Do not apply this change again and do not modify the document in response; acknowledge briefly and use the latest content going forward.`,``,`Before:`,`${r}markdown`,e.user_change.before,r,``,`After:`,`${r}markdown`,e.user_change.after,r].join(`
8
- `)}if(e.action===`edit`&&e.user_change){let r=Fi(e.user_change.before,e.user_change.after);return[`Apply my edit to the ${n} in ${t}, then update the resource.`,`Operation: ${e.operation_id}`,`Preserve all content outside the selected block exactly; do not regenerate unrelated sections.`,``,`Before:`,`${r}markdown`,e.user_change.before,r,``,`After:`,`${r}markdown`,e.user_change.after,r].join(`
9
- `)}let r=Fi(e.anchor.exact_text);return[`Update the ${n} in ${t} based on this comment:`,`Operation: ${e.operation_id}`,`Preserve all content outside the selected block exactly; do not regenerate unrelated sections.`,``,e.comment??``,``,`Selected content:`,`${r}markdown`,e.anchor.exact_text,r].join(`
10
- `)}function Ri(){let e=U(Ci);if(!e)throw Error(`Collaborative Markdown blocks must be rendered inside CollaborativeMarkdownRenderer`);return e}function zi({anchor:e,mode:i,initialDraft:a}){let{t:o}=J(),{artifactRunId:s,readOnly:c,allowComments:l,cancelEditing:u,submit:d,updateDraft:f}=Ri(),[p,m]=q(i===`edit`?e.exact_text:i===`insert`?a??``:``),[h,g]=q(!1),_=i===`comment`?!l:c,v=e=>{m(e),f(e)},y=async()=>{if(!(!p.trim()||h)){g(!0);try{await d(e,i,i===`comment`?p.trim():p)}finally{g(!1)}}};return n(`div`,{className:`mb-2 space-y-2`,children:[i===`edit`||i===`insert`?t(De,{fallback:t(b,{value:p,onChange:e=>v(e.target.value),placeholder:o(`agent.editSelectionPlaceholder`),rows:6,autoFocus:!0}),children:t(Ti,{value:p,onChange:v,artifactRunId:s,editable:!c,externalValueSync:`manual`,autoFocus:!0})}):t(b,{value:p,onChange:e=>v(e.target.value),placeholder:o(`agent.commentOnSelectionPlaceholder`),rows:3,autoFocus:!0,disabled:!l}),n(`div`,{className:`flex justify-end gap-2`,children:[n(r,{variant:`outline`,size:`sm`,onClick:u,disabled:h,children:[t(Te,{className:`me-1 size-4`}),o(`store.cancelEdit`)]}),n(r,{size:`sm`,onClick:()=>void y(),disabled:_||!p.trim()||h,children:[t(F,{className:`me-1 size-4`}),o(`agent.send`)]})]})]})}function $(i,a,u){return function({node:d,children:f,...p}){let{t:m}=J(),{markdown:h,readOnly:g,allowComments:_,activeEditing:v,highlightChangesFrom:y,flashChangedBlocks:ee,beginEditing:b}=Ri(),te=U(wi),C=u?z.createElement(u,{node:d,...p},f):z.createElement(i,p,f);if(te)return C;let w=ki(h,d,a),T=!!(w.source_range&&w.exact_text),ne=!g&&T,E=_&&T,D=v?.anchor.block_id===w.block_id,O=D&&v?.mode===`edit`,k=ee&&!!w.exact_text&&!!y&&!y?.includes(w.exact_text),re=S(`group/collab relative rounded-md border transition-colors duration-700`,`-mx-2 -my-1 px-2 py-1`,O?`border-transparent`:D?`border-info bg-mixer-info/5`:ne||E?`border-transparent hover:border-mixer-info/30 hover:bg-mixer-muted/10`:`border-transparent`,k&&`border-mixer-success/50 bg-mixer-success/15 ring-1 ring-mixer-success/20`),j=ne||E||D?n(e,{children:[n(`div`,{className:S(`absolute end-1 top-1 z-10 flex items-center gap-0.5 rounded-md border bg-background p-0.5 shadow-sm`,(!ne&&!E||O)&&`hidden`,D?`opacity-100`:`pointer-events-none opacity-0 group-hover/collab:pointer-events-auto group-hover/collab:opacity-100 group-focus-within/collab:pointer-events-auto group-focus-within/collab:opacity-100`),children:[E?t(x,{description:m(`agent.commentOnSelection`),asChild:!0,children:t(r,{variant:`ghost`,size:`sm`,className:`h-7 w-7 p-0`,"aria-label":m(`agent.commentOnSelection`),onClick:()=>b(w,`comment`),children:t(ve,{className:`size-4`})})}):null,ne?t(x,{description:m(`agent.editSelection`),asChild:!0,children:t(r,{variant:`ghost`,size:`sm`,className:`h-7 w-7 p-0`,"aria-label":m(`agent.editSelection`),onClick:()=>b(w,`edit`),children:t(be,{className:`size-4`})})}):null,ne?n(o,{children:[t(x,{description:m(`agent.insertComponent`),asChild:!0,children:t(l,{asChild:!0,children:t(r,{variant:`ghost`,size:`sm`,className:`h-7 w-7 p-0`,"aria-label":m(`agent.insertComponent`),children:t(Se,{className:`size-4`})})})}),n(s,{align:`end`,className:`w-52`,children:[n(c,{onClick:()=>b(w,`insert`,m(`richText.paragraph`)),children:[t(xe,{}),m(`richText.paragraph`)]}),n(c,{onClick:()=>b(w,`insert`,`## ${m(`richText.heading2`)}`),children:[t(fe,{}),m(`richText.heading2`)]}),n(c,{onClick:()=>b(w,`insert`,`- ${m(`richText.bulletList`)}`),children:[t(he,{}),m(`richText.bulletList`)]}),n(c,{onClick:()=>b(w,`insert`,`> ${m(`richText.blockquote`)}`),children:[t(P,{}),m(`richText.blockquote`)]}),n(c,{onClick:()=>b(w,`insert`,"```\nCode\n```"),children:[t(oe,{}),m(`richText.codeBlock`)]}),n(c,{onClick:()=>b(w,`insert`,`| Column | Value |
276
+ `)),{type:n,value:r}}return typeof e==`number`||typeof e==`boolean`?{value:String(e),type:vn.Inline}:{value:e,type:vn.Object}}function bn({value:e,viewCode:n=!1}){let{t:r}=B();return e?t(`div`,{className:`relative w-full h-full flex flex-col`,children:n||!xn(e)?t(cn,{data:e}):t(`div`,{className:`flex-1 min-h-0 overflow-auto`,children:t(fn,{value:e})})}):t(`pre`,{className:`whitespace-pre-wrap`,children:r(`misc.noData`)})}function xn(e){return e==null||typeof e==`string`||typeof e==`number`||typeof e==`boolean`?!0:Array.isArray(e)?e.every(xn):typeof e==`object`&&Object.values(e).every(xn)}const Sn=new Set;function Cn(e){Sn.has(`markdown`)||(Sn.add(`markdown`),e.languages.registerFoldingRangeProvider(`markdown`,{provideFoldingRanges(e){let t=[],n=e.getLinesContent(),r=/^(#{1,6})\s/,i=[];for(let e=0;e<n.length;e++){let a=e+1,o=r.exec(n[e]);if(o){let e=o[1].length;for(;i.length>0&&i[i.length-1].level>=e;){let e=i.pop();e&&a-1>e.line&&t.push({start:e.line,end:a-1})}i.push({level:e,line:a})}}let a=n.length;for(;i.length>0;){let e=i.pop();e&&a>e.line&&t.push({start:e.line,end:a})}return t}}));for(let t of[`javascript`,`typescript`])Sn.has(t)||(Sn.add(t),e.languages.registerFoldingRangeProvider(t,{provideFoldingRanges(e){let t=e.getLinesContent(),n=/^(#{1,6})\s/,r=[],i=[],a=[],o=[],s=!1,c=!1,l=``;for(let e=0;e<t.length;e++){let u=e+1,d=t[e],f=s;for(let e=0;e<d.length;e++){let t=d[e];if(t===`\\`){e++;continue}if(c){t===l&&(c=!1);continue}if(s){t==="`"&&(s=!1);continue}if(t==="`"){s=!0;continue}if(t===`"`||t===`'`){c=!0,l=t;continue}if(t===`{`&&a.push(u),t===`}`&&a.length>0){let t=a.pop(),n=d.slice(e+1).trimStart().length>0?u-1:u;t!==void 0&&n>t&&r.push({start:t,end:n})}}if(f){let e=n.exec(d);if(e){let t=e[1].length;for(;o.length>0&&o[o.length-1].level>=t;){let e=o.pop();e&&u-1>e.line&&i.push({start:e.line,end:u-1})}o.push({level:t,line:u})}if(!s)for(;o.length>0;){let e=o.pop();e&&u>e.line&&i.push({start:e.line,end:u})}}}return[...r,...i]}}))}const wn=ne(()=>import(`@monaco-editor/react`).then(({Editor:e})=>({default:e})));let Tn;function En(){if(!(typeof document>`u`)){if(!Tn){let e=document.createElement(`div`);e.className=`monaco-editor`,e.style.position=`absolute`,e.style.top=`0`,e.style.left=`0`,e.style.zIndex=`10000`,document.body.appendChild(e),Tn=e}return Tn}}const Dn=new Map;let On=0;function kn(e){(e.languages.json?.jsonDefaults)?.setDiagnosticsOptions({validate:!0,enableSchemaRequest:!1,schemas:Array.from(Dn.entries()).map(([e,t])=>({uri:`vertesia://schemas/${encodeURIComponent(e)}`,fileMatch:[e],schema:t}))})}var An=class{VgetValue;VsetValue;constructor(e,t){this.VgetValue=e,this.VsetValue=t}getValue(){return this.VgetValue()}setValue(e){this.VsetValue(e||``)}};function jn({onChange:e,value:n,className:r,editorRef:i,language:a=`javascript`,path:o,debounceTimeout:s=0,options:c={},beforeMount:l,onMount:u,defaultValue:d,useCustomFolding:f=!1,jsonSchema:p}){let[m,h]=z(n||d||``),g=R(null),_=R(null),[v]=z(()=>p?`inmemory://vertesia/json/${++On}.json`:void 0),y=o??v,{theme:b}=D(),x=b===`system`?window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`:b,S=n||d||``,C=R(()=>m),w=R(e=>{h(e),g.current&&g.current.setValue(e)});I(()=>{C.current=()=>m},[m]),I(()=>(i&&(i.current=new An(()=>C.current(),e=>w.current(e))),()=>{i&&(i.current=void 0)}),[i]);let T=L(()=>{if(e)return s>0?ce(t=>e(t),s):e},[e,s]),E=F(async(e,t)=>{let n=e.getModel();if(n)for(let r of n.getValue().matchAll(/```[\s\S]*?```/g)){let i=n.getPositionAt(r.index).lineNumber,a=n.getPositionAt(r.index+r[0].length).lineNumber;e.setSelection(new t.Selection(i,1,a,1)),await e.getAction(`editor.createFoldingRangeFromSelection`)?.run()}},[]),O=F(e=>{let t=e||``;if(h(t),T){let e={docChanged:!0,state:{doc:{toString:()=>t,length:t.length}}};T(e)}},[T]),A=F((e,t)=>{g.current=e,_.current=t,p&&y&&a===`json`&&(Dn.set(y,p),kn(t)),f&&Cn(t),w.current=t=>{h(t),e.setValue(t)},t.editor.defineTheme(`errorLineTheme`,{base:x===`dark`?`vs-dark`:`vs`,inherit:!0,rules:[],colors:{"editorError.background":`#ffebee`,"editorError.border":`#f44336`}}),t.editor.setTheme(`errorLineTheme`),f&&setTimeout(()=>E(e,t),300),u?.(e,t)},[u,x,f,E,p,y,a]);I(()=>()=>{p&&y&&Dn.delete(y)&&_.current&&kn(_.current)},[p,y]),I(()=>{g.current?.hasTextFocus()||h(e=>S===e?e:(g.current&&g.current.setValue(S),S))},[S]),I(()=>{if(!S||!f||!g.current||!_.current||g.current.hasTextFocus())return;let e=g.current,t=_.current,n=setTimeout(()=>E(e,t),300);return()=>clearTimeout(n)},[S,f,E]);let j={fontSize:14,fontFamily:`monospace`,minimap:{enabled:!1},scrollBeyondLastLine:!1,wordWrap:`on`,lineNumbers:`on`,folding:!0,lineDecorationsWidth:10,lineNumbersMinChars:3,automaticLayout:!0,formatOnPaste:!0,formatOnType:!0,tabSize:2,insertSpaces:!0,fixedOverflowWidgets:!0,overflowWidgetsDomNode:En(),glyphMargin:!0,renderValidationDecorations:`on`,renderLineHighlight:`line`,hover:{enabled:`on`,delay:100},quickSuggestions:{other:!0,comments:!0,strings:!0},...c};return t(`div`,{className:k(r,`w-full h-full!`),children:t(ee,{fallback:t(`div`,{className:`h-full w-full`}),children:t(wn,{className:`h-full w-full`,height:`100%`,theme:x===`dark`?`vs-dark`:`light`,language:a,path:y,onChange:O,onMount:A,beforeMount:l,options:j,defaultValue:S})})})}function Mn({value:e,onChange:r,onValidChange:i,readonly:a=!1,height:o=`200px`,placeholder:s,className:c}){let{theme:l}=D(),u=R(void 0),[d,f]=z(null),p=L(()=>{if(e==null)return s??`{}`;try{return JSON.stringify(e,null,2)}catch{return`{}`}},[e,s]),m=F(()=>{if(!u.current||a)return;let e=u.current.getValue();try{let t=JSON.parse(e);f(null),i?.(t)}catch{f(`Invalid JSON`)}},[a,i]);return n(`div`,{className:c,children:[t(`div`,{className:`border rounded overflow-hidden`,style:{height:o},children:t(jn,{defaultValue:p,editorRef:u,language:`json`,theme:l===`dark`?`vs-dark`:`vs`,onChange:m,options:a?{readOnly:!0,domReadOnly:!0}:void 0})}),d&&t(`p`,{className:`text-xs text-destructive mt-1`,children:d})]})}function Nn(e){if(!e.current)return null;try{return JSON.parse(e.current.getValue())}catch{return null}}function Pn({title:e,viewCode:i,setViewCode:a}){return n(`div`,{className:`flex items-center gap-1 bg-muted mb-2 p-1 rounded`,children:[t(r,{variant:i?`ghost`:`primary`,size:`sm`,title:`Preview properties`,onClick:()=>a(!1),children:e}),t(r,{variant:i?`primary`:`ghost`,size:`sm`,title:`View in JSON format`,onClick:()=>a(!0),children:`JSON`})]})}function Fn(e){return e.replace(/([a-z0-9])([A-Z])/g,`$1 $2`).replace(/[_-]+/g,` `).replace(/\s+/g,` `).trim().replace(/^./,e=>e.toUpperCase())}function In(r){return r==null?`Failed to query`:typeof r==`string`?r:Array.isArray(r)?r.length===0?`None`:r.some(e=>e&&typeof e==`object`)?t(e,{children:r.map((e,r)=>n(`div`,{className:`flex gap-1`,children:[n(`span`,{className:`text-xs align-top pe-2 font-medium`,children:[r+1,`:`]}),t(`span`,{className:`text-xs`,children:In(e)})]},`item-${r}`))}):r.map(e=>String(e)).join(`, `):typeof r==`object`?t(e,{children:Object.entries(r).map(([e,r])=>n(`div`,{className:`flex gap-1`,children:[n(`span`,{className:`text-xs align-top pe-2 font-medium`,children:[Fn(e),`:`]}),t(`span`,{className:`text-xs`,children:In(r)})]},e))}):String(r)}function Ln({data:e,className:r}){let i=e?Object.entries(e):[];return t(`table`,{className:r||`mb-2 text-xs bg-muted rounded-sm w-full`,children:t(`tbody`,{children:i.map(([e,r])=>n(`tr`,{className:`align-top hover:bg-background border-y`,children:[t(`td`,{className:`align-top pe-4 p-2`,children:Fn(e)}),t(`td`,{className:`p-2`,children:In(r)})]},e))})})}const Rn=N(()=>({kind:`none`})),zn=Rn.Provider;function Bn(){return ie(Rn)}const Vn={store:`document`,document:`document`,collection:`collection`,interaction:`interaction`,prompt:`prompt`,agent:`agent`,workflow:`workflow`,process:`process`,run:`interaction_run`};function Hn(e){let t=e.indexOf(`:`);if(t<=0)return;let n=e.slice(0,t);if(!Object.hasOwn(Vn,n))return;let r=e.slice(t+1).trim().replace(/^\/+/,``);if(r)return{type:Vn[n],id:r}}var Un=Object.defineProperty,Wn=(e,t)=>Un(e,`name`,{value:t,configurable:!0}),Gn=!!(typeof window<`u`&&window.document&&window.document.createElement);function Kn(e,t,{checkForDefaultPrevented:n=!0}={}){return Wn(function(r){if(e?.(r),n===!1||!r||!r.defaultPrevented)return t?.(r)},`handleEvent`)}Wn(Kn,`composeEventHandlers`);function qn(e){if(!Gn)throw Error(`Cannot access window outside of the DOM`);return e?.ownerDocument?.defaultView??window}Wn(qn,`getOwnerWindow`);function Jn(e){if(!Gn)throw Error(`Cannot access document outside of the DOM`);return e?.ownerDocument??document}Wn(Jn,`getOwnerDocument`);function Yn(e,t=!1){let{activeElement:n}=Jn(e);if(!n?.nodeName)return null;if(Xn(n)&&n.contentDocument)return Yn(n.contentDocument.body,t);if(t){let e=n.getAttribute(`aria-activedescendant`);if(e){let t=Jn(n).getElementById(e);if(t)return t}}return n}Wn(Yn,`getActiveElement`);function Xn(e){return e.tagName===`IFRAME`}Wn(Xn,`isFrame`);var Zn=Object.defineProperty,Qn=(e,t)=>Zn(e,`name`,{value:t,configurable:!0});function $n(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}Qn($n,`setRef`);function er(...e){return t=>{let n=!1,r=e.map(e=>{let r=$n(e,t);return!n&&typeof r==`function`&&(n=!0),r});if(n)return()=>{for(let t=0;t<r.length;t++){let n=r[t];typeof n==`function`?n():$n(e[t],null)}}}}Qn(er,`composeRefs`);function tr(...e){return j.useCallback(er(...e),e)}Qn(tr,`useComposedRefs`);var nr=Object.defineProperty,rr=(e,t)=>nr(e,`name`,{value:t,configurable:!0});function ir(e,n){let r=j.createContext(n);r.displayName=e+`Context`;let i=rr(e=>{let{children:n,...i}=e,a=j.useMemo(()=>i,Object.values(i));return t(r.Provider,{value:a,children:n})},`Provider`);i.displayName=e+`Provider`;function a(t,i={}){let{optional:a=!1}=i,o=j.useContext(r);if(o)return o;if(n!==void 0)return n;if(!a)throw Error(`\`${t}\` must be used within \`${e}\``)}return rr(a,`useContext`),[i,a]}rr(ir,`createContext`);function ar(e,n=[]){let r=[];function i(n,i){let a=j.createContext(i);a.displayName=n+`Context`;let o=r.length;r=[...r,i];let s=rr(n=>{let{scope:r,children:i,...s}=n,c=r?.[e]?.[o]||a,l=j.useMemo(()=>s,Object.values(s));return t(c.Provider,{value:l,children:i})},`Provider`);s.displayName=n+`Provider`;function c(t,r,s={}){let{optional:c=!1}=s,l=r?.[e]?.[o]||a,u=j.useContext(l);if(u)return u;if(i!==void 0)return i;if(!c)throw Error(`\`${t}\` must be used within \`${n}\``)}return rr(c,`useContext`),[s,c]}rr(i,`createContext`);let a=rr(()=>{let t=r.map(e=>j.createContext(e));return rr(function(n){let r=n?.[e]||t;return j.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])},`useScope`)},`createScope`);return a.scopeName=e,[i,or(a,...n)]}rr(ar,`createContextScope`);function or(...e){let t=e[0];if(e.length===1)return t;let n=rr(()=>{let n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return rr(function(e){let r=n.reduce((t,{useScope:n,scopeName:r})=>{let i=n(e)[`__scope${r}`];return{...t,...i}},{});return j.useMemo(()=>({[`__scope${t.scopeName}`]:r}),[r])},`useComposedScopes`)},`createScope`);return n.scopeName=t.scopeName,n}rr(or,`composeContextScopes`);var sr=globalThis?.document?j.useLayoutEffect:()=>{},cr=Object.defineProperty,lr=(e,t)=>cr(e,`name`,{value:t,configurable:!0}),ur=j.useId||(()=>void 0),dr=0;function fr(e){let[t,n]=j.useState(ur());return sr(()=>{e||n(e=>e??String(dr++))},[e]),e||(t?`radix-${t}`:``)}lr(fr,`useId`);var pr=Object.defineProperty,mr=(e,t)=>pr(e,`name`,{value:t,configurable:!0}),hr=j.useEffectEvent,gr=j.useInsertionEffect;function _r(e){if(typeof hr==`function`)return hr(e);let t=j.useRef(()=>{throw Error(`Cannot call an event handler while rendering.`)});return typeof gr==`function`?gr(()=>{t.current=e}):sr(()=>{t.current=e}),j.useMemo(()=>((...e)=>t.current?.(...e)),[])}mr(_r,`useEffectEvent`);var vr=Object.defineProperty,yr=(e,t)=>vr(e,`name`,{value:t,configurable:!0}),br=j.useInsertionEffect||sr;function xr({prop:e,defaultProp:t,onChange:n=yr(()=>{},`onChange`),caller:r}){let[i,a,o]=Sr({defaultProp:t,onChange:n}),s=e!==void 0;return[s?e:i,j.useCallback(t=>{if(s){let n=Cr(t)?t(e):t;n!==e&&o.current?.(n)}else a(t)},[s,e,a,o])]}yr(xr,`useControllableState`);function Sr({defaultProp:e,onChange:t}){let[n,r]=j.useState(e),i=j.useRef(n),a=j.useRef(t);return br(()=>{a.current=t},[t]),j.useEffect(()=>{i.current!==n&&(a.current?.(n),i.current=n)},[n,i]),[n,r,a]}yr(Sr,`useUncontrolledState`);function Cr(e){return typeof e==`function`}yr(Cr,`isFunction`);var wr=Symbol(`RADIX:SYNC_STATE`);function Tr(e,t,n,r){let{prop:i,defaultProp:a,onChange:o,caller:s}=t,c=i!==void 0,l=_r(o),u=[{...n,state:a}];r&&u.push(r);let[d,f]=j.useReducer((t,n)=>{if(n.type===wr)return{...t,state:n.state};let r=e(t,n);return c&&!Object.is(r.state,t.state)&&l(r.state),r},...u),p=d.state,m=j.useRef(p);j.useEffect(()=>{m.current!==p&&(m.current=p,c||l(p))},[p,m,c]);let h=j.useMemo(()=>i===void 0?d:{...d,state:i},[d,i]);return j.useEffect(()=>{c&&!Object.is(i,d.state)&&f({type:wr,state:i})},[i,d.state,c]),[h,f]}yr(Tr,`useControllableStateReducer`);var Er=Object.defineProperty,Dr=(e,t)=>Er(e,`name`,{value:t,configurable:!0});function Or(e){let t=j.forwardRef((t,n)=>{let{children:r,...i}=t,a=null,o=!1,s=[];Ir(r)&&typeof Br==`function`&&(r=Br(r._payload)),j.Children.forEach(r,e=>{if(Pr(e)){o=!0;let t=e,n=`child`in t.props?t.props.child:t.props.children;Ir(n)&&typeof Br==`function`&&(n=Br(n._payload)),a=jr(t,n),s.push(a?.props?.children)}else s.push(e)}),a?a=j.cloneElement(a,void 0,s):!o&&j.Children.count(r)===1&&j.isValidElement(r)&&(a=r);let c=a?Nr(a):void 0,l=tr(n,c);if(!a){if(r||r===0)throw Error(o?zr(e):Rr(e));return r}let u=Mr(i,a.props??{});return a.type!==j.Fragment&&(u.ref=n?l:c),j.cloneElement(a,u)});return t.displayName=`${e}.Slot`,t}Dr(Or,`createSlot`);var kr=Symbol.for(`radix.slottable`);function Ar(e){let t=Dr(e=>`child`in e?e.children(e.child):e.children,`Slottable`);return t.displayName=`${e}.Slottable`,t.__radixId=kr,t}Dr(Ar,`createSlottable`);var jr=Dr((e,t)=>{if(`child`in e.props){let t=e.props.child;return j.isValidElement(t)?j.cloneElement(t,void 0,e.props.children(t.props.children)):null}return j.isValidElement(t)?t:null},`getSlottableElementFromSlottable`);function Mr(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}Dr(Mr,`mergeProps`);function Nr(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}Dr(Nr,`getElementRef`);function Pr(e){return j.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===kr}Dr(Pr,`isSlottable`);var Fr=Symbol.for(`react.lazy`);function Ir(e){return typeof e==`object`&&!!e&&`$$typeof`in e&&e.$$typeof===Fr&&`_payload`in e&&Lr(e._payload)}Dr(Ir,`isLazyComponent`);function Lr(e){return typeof e==`object`&&!!e&&`then`in e}Dr(Lr,`isPromiseLike`);var Rr=Dr(e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,`createSlotError`),zr=Dr(e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,`createSlottableError`),Br=j.use,Vr=Object.defineProperty,Hr=(e,t)=>Vr(e,`name`,{value:t,configurable:!0}),Ur=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,n)=>{let r=Or(`Primitive.${n}`),i=j.forwardRef((e,i)=>{let{asChild:a,...o}=e,s=a?r:n;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),t(s,{...o,ref:i})});return i.displayName=`Primitive.${n}`,{...e,[n]:i}},{});function Wr(e,t){e&&he.flushSync(()=>e.dispatchEvent(t))}Hr(Wr,`dispatchDiscreteCustomEvent`);var Gr=Object.defineProperty,Kr=j.forwardRef(((e,t)=>Gr(e,`name`,{value:t,configurable:!0}))(function(e,n){let{container:r,...i}=e,[a,o]=j.useState(!1);sr(()=>o(!0),[]);let s=r||a&&globalThis?.document?.body;return s?he.createPortal(t(Ur.div,{...i,ref:n}),s):null},`Portal`)),qr=Object.defineProperty,Jr=(e,t)=>qr(e,`name`,{value:t,configurable:!0});function Yr(e,t){return j.useReducer((e,n)=>t[e][n]??e,e)}Jr(Yr,`useStateMachine`);var Xr=Jr(e=>{let{present:t,children:n}=e,r=Zr(t),i=typeof n==`function`?n({present:r.isPresent}):j.Children.only(n),a=$r(r.ref,ti(i));return typeof n==`function`||r.isPresent?j.cloneElement(i,{ref:a}):null},`Presence`);function Zr(e){let[t,n]=j.useState(),r=j.useRef(null),i=j.useRef(e),a=j.useRef(`none`),o=j.useRef(void 0),[s,c]=Yr(e?`mounted`:`unmounted`,{mounted:{UNMOUNT:`unmounted`,ANIMATION_OUT:`unmountSuspended`},unmountSuspended:{MOUNT:`mounted`,ANIMATION_END:`unmounted`},unmounted:{MOUNT:`mounted`}});return j.useEffect(()=>{s===`mounted`?(a.current=o.current??ei(r.current),o.current=void 0):a.current=`none`},[s]),sr(()=>{let t=r.current,n=i.current;if(n!==e){let r=a.current,s=ei(t);e?(o.current=s,c(`MOUNT`)):s===`none`||t?.display===`none`?c(`UNMOUNT`):c(n&&r!==s?`ANIMATION_OUT`:`UNMOUNT`),i.current=e}},[e,c]),sr(()=>{if(t){let e,n=t.ownerDocument.defaultView??window,o=Jr(a=>{let o=ei(r.current).includes(CSS.escape(a.animationName));if(a.target===t&&o&&(c(`ANIMATION_END`),!i.current)){let r=t.style.animationFillMode;t.style.animationFillMode=`forwards`,e=n.setTimeout(()=>{t.style.animationFillMode===`forwards`&&(t.style.animationFillMode=r)})}},`handleAnimationEnd`),s=Jr(e=>{e.target===t&&(a.current=ei(r.current))},`handleAnimationStart`);return t.addEventListener(`animationstart`,s),t.addEventListener(`animationcancel`,o),t.addEventListener(`animationend`,o),()=>{n.clearTimeout(e),t.removeEventListener(`animationstart`,s),t.removeEventListener(`animationcancel`,o),t.removeEventListener(`animationend`,o)}}c(`ANIMATION_END`)},[t,c]),{isPresent:[`mounted`,`unmountSuspended`].includes(s),ref:j.useCallback(e=>{if(e){let t=getComputedStyle(e);r.current=t,o.current=ei(t)}else r.current=null;n(e)},[])}}Jr(Zr,`usePresence`);function Qr(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}Jr(Qr,`setRef`);function $r(...e){let t=j.useRef(e);return t.current=e,j.useCallback(e=>{let n=t.current,r=!1,i=n.map(t=>{let n=Qr(t,e);return!r&&typeof n==`function`&&(r=!0),n});if(r)return()=>{for(let e=0;e<i.length;e++){let t=i[e];typeof t==`function`?t():Qr(n[e],null)}}},[])}Jr($r,`useStableComposedRefs`);function ei(e){return e?.animationName||`none`}Jr(ei,`getAnimationName`);function ti(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}Jr(ti,`getElementRef`);var ni=Object.defineProperty,ri=(e,t)=>ni(e,`name`,{value:t,configurable:!0}),ii=`Dialog`,[ai,oi]=ar(ii),[si,ci]=ai(ii),li=ri(e=>{let{__scopeDialog:n,children:r,open:i,defaultOpen:a,onOpenChange:o,modal:s=!0}=e,c=j.useRef(null),l=j.useRef(null),[u,d]=xr({prop:i,defaultProp:a??!1,onChange:o,caller:ii}),[f,p]=j.useState(0),[m,h]=j.useState(0);return t(si,{scope:n,triggerRef:c,contentRef:l,contentId:fr(),titleId:fr(),descriptionId:fr(),titlePresent:f>0,descriptionPresent:m>0,setTitleCount:p,setDescriptionCount:h,open:u,onOpenChange:d,onOpenToggle:j.useCallback(()=>d(e=>!e),[d]),modal:s,children:r})},`Dialog`),ui=`DialogPortal`,[di,fi]=ai(ui,{forceMount:void 0}),pi=ri(e=>{let{__scopeDialog:n,forceMount:r,children:i,container:a}=e,o=ci(ui,n);return t(di,{scope:n,forceMount:r,children:j.Children.map(i,e=>t(Xr,{present:r||o.open,children:t(Kr,{asChild:!0,container:a,children:e})}))})},`DialogPortal`),mi=`DialogOverlay`,hi=j.forwardRef(ri(function(e,n){let r=fi(mi,e.__scopeDialog),{forceMount:i=r.forceMount,...a}=e,o=ci(mi,e.__scopeDialog);return o.modal?t(Xr,{present:i||o.open,children:t(_i,{...a,ref:n})}):null},`DialogOverlay`)),gi=Or(`DialogOverlay.RemoveScroll`),_i=j.forwardRef(ri(function(e,n){let{__scopeDialog:r,...i}=e,a=ci(mi,r),o=tr(n,pe());return t(_e,{as:gi,allowPinchZoom:!0,shards:[a.contentRef],children:t(Ur.div,{"data-state":ki(a.open),...i,ref:o,style:{pointerEvents:`auto`,...i.style}})})},`DialogOverlayImpl`)),vi=`DialogContent`,yi=j.forwardRef(ri(function(e,n){let r=fi(vi,e.__scopeDialog),{forceMount:i=r.forceMount,...a}=e,o=ci(vi,e.__scopeDialog);return t(Xr,{present:i||o.open,children:o.modal?t(bi,{...a,ref:n}):t(xi,{...a,ref:n})})},`DialogContent`)),bi=j.forwardRef(ri(function(e,n){let r=ci(vi,e.__scopeDialog),i=j.useRef(null),a=tr(n,r.contentRef,i);return j.useEffect(()=>{let e=i.current;if(e)return ve(e)},[]),t(Si,{...e,ref:a,trapFocus:r.open,disableOutsidePointerEvents:r.open,onCloseAutoFocus:Kn(e.onCloseAutoFocus,e=>{e.preventDefault(),r.triggerRef.current?.focus()}),onPointerDownOutside:Kn(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;(t.button===2||n)&&e.preventDefault()}),onFocusOutside:Kn(e.onFocusOutside,e=>e.preventDefault())})},`DialogContentModal`)),xi=j.forwardRef(ri(function(e,n){let r=ci(vi,e.__scopeDialog),i=j.useRef(!1),a=j.useRef(!1);return t(Si,{...e,ref:n,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(i.current||r.triggerRef.current?.focus(),t.preventDefault()),i.current=!1,a.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(i.current=!0,t.detail.originalEvent.type===`pointerdown`&&(a.current=!0));let n=t.target;r.triggerRef.current?.contains(n)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&a.current&&t.preventDefault()}})},`DialogContentNonModal`)),Si=j.forwardRef(ri(function(n,r){let{__scopeDialog:i,trapFocus:a,onOpenAutoFocus:o,onCloseAutoFocus:s,...c}=n,l=ci(vi,i);return ge(),t(e,{children:t(me,{asChild:!0,loop:!0,trapped:a,onMountAutoFocus:o,onUnmountAutoFocus:s,children:t(fe,{role:`dialog`,id:l.contentId,"aria-describedby":l.descriptionPresent?l.descriptionId:void 0,"aria-labelledby":l.titlePresent?l.titleId:void 0,"data-state":ki(l.open),...c,ref:r,deferPointerDownOutside:!0,onDismiss:()=>l.onOpenChange(!1)})})})},`DialogContentImpl`)),Ci=`DialogTitle`,wi=j.forwardRef(ri(function(e,n){let{__scopeDialog:r,...i}=e,a=ci(Ci,r),{setTitleCount:o}=a;return sr(()=>(o(e=>e+1),()=>o(e=>e-1)),[o]),t(Ur.h2,{id:a.titleId,...i,ref:n})},`DialogTitle`)),Ti=`DialogDescription`,Ei=j.forwardRef(ri(function(e,n){let{__scopeDialog:r,...i}=e,a=ci(Ti,r),{setDescriptionCount:o}=a;return sr(()=>(o(e=>e+1),()=>o(e=>e-1)),[o]),t(Ur.p,{id:a.descriptionId,...i,ref:n})},`DialogDescription`)),Di=`DialogClose`,Oi=j.forwardRef(ri(function(e,n){let{__scopeDialog:r,...i}=e,a=ci(Di,r);return t(Ur.button,{type:`button`,...i,ref:n,onClick:Kn(e.onClick,()=>a.onOpenChange(!1))})},`DialogClose`));function ki(e){return e?`open`:`closed`}ri(ki,`getState`);function Ai(...e){return xe(A(e))}const ji=N(null);function Mi(){return ie(ji)}function Ni(e){return e.startsWith(`agents/`)||e.startsWith(`documents/`)}function Pi(e,t,n=`inline`){return`artifact:${e}:${t}:${n}`}function Fi(e){return`file:${e}`}const Ii=ne(()=>import(`react-vega`).then(({VegaEmbed:e})=>({default:e})));function Li({error:e,chartTitle:r}){return t(`div`,{className:`flex items-center justify-center h-full bg-red-50 dark:bg-red-950 rounded-md p-4`,children:n(`div`,{className:`text-center`,children:[n(`p`,{className:`text-sm font-medium text-red-600 dark:text-red-400`,children:[`Cannot render `,r||`Vega-Lite`,` chart`]}),t(`p`,{className:`text-xs text-red-500 dark:text-red-500 mt-1 max-w-xs truncate`,children:e})]})})}function Ri(){return t(`output`,{className:`flex items-center justify-center w-full h-full`,children:t(ut,{className:`w-5 h-5 animate-spin text-gray-500 dark:text-gray-400`})})}function zi({isOpen:e,onClose:i,title:a,description:o,children:s}){let{t:c}=B();return t(li,{open:e,onOpenChange:e=>!e&&i(),children:n(pi,{children:[t(hi,{className:`fixed inset-0 z-50 bg-black/80 backdrop-blur-sm transition-all duration-300 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0`}),n(yi,{className:`fixed inset-2 sm:inset-4 z-50 flex flex-col bg-white dark:bg-gray-900 rounded-xl shadow-2xl transition-all duration-300 ease-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-98 data-[state=open]:zoom-in-98 data-[state=closed]:slide-out-to-bottom-2 data-[state=open]:slide-in-from-bottom-2`,onEscapeKeyDown:i,children:[t(Oi,{asChild:!0,children:t(r,{variant:`unstyled`,onClick:i,className:`absolute top-3 end-3 z-10 p-2 rounded-lg bg-white/80 dark:bg-gray-800/80 backdrop-blur-sm hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors duration-150 shadow-sm`,"aria-label":c(`agent.closeFullscreen`),children:t(Tt,{className:`w-5 h-5 text-gray-600 dark:text-gray-300`})})}),t(`div`,{className:`flex-1 overflow-auto p-4 sm:p-6 animate-in fade-in-0 duration-500 delay-150`,children:s}),t(`div`,{className:`flex items-center justify-between px-4 sm:px-6 py-3 border-t border-gray-200 dark:border-gray-800 bg-gray-50/50 dark:bg-gray-800/50 rounded-b-xl`,children:n(`div`,{className:`flex flex-col`,children:[t(wi,{className:`text-base font-semibold text-gray-900 dark:text-gray-100`,children:a||c(`agent.dashboard`)}),o&&t(Ei,{className:`text-sm text-gray-500 dark:text-gray-400 mt-0.5`,children:o})]})})]})]})})}function Bi(e,t){if(t===`chart`)return 280;let n=1;if(e.vconcat)n=Array.isArray(e.vconcat)?e.vconcat.length:1;else if(e.concat){let t=e.columns||2,r=Array.isArray(e.concat)?e.concat.length:1;n=Math.ceil(r/t)}else e.facet&&(n=2);return Math.max(500,n*280+40)}const Vi={categorical:[`#6366f1`,`#8b5cf6`,`#ec4899`,`#f43f5e`,`#f97316`,`#eab308`,`#22c55e`,`#14b8a6`,`#06b6d4`,`#3b82f6`],blues:[`#dbeafe`,`#93c5fd`,`#3b82f6`,`#1d4ed8`,`#1e3a8a`],purples:[`#f3e8ff`,`#c4b5fd`,`#8b5cf6`,`#6d28d9`,`#4c1d95`],greens:[`#dcfce7`,`#86efac`,`#22c55e`,`#15803d`,`#14532d`],diverging:[`#ef4444`,`#fca5a5`,`#fef3c7`,`#86efac`,`#22c55e`]};function Hi(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Ui(e){return Hi(e)}function Wi(e){let t=JSON.parse(JSON.stringify(e)),n=[`vconcat`,`hconcat`,`concat`];if(!n.some(e=>Array.isArray(t[e])))return t;let r=[];if(Array.isArray(t.params))for(let e of t.params)e&&typeof e==`object`&&e.name&&e.select&&r.push({name:e.name,param:e});if(r.length===0)return t;for(let{name:e,param:i}of r){let r=i.select?.fields||[],a=i.select?.bind===`legend`,o=null;for(let e of n)if(Array.isArray(t[e])){o=t[e];break}if(!o||o.length===0)continue;let s=0;for(let e=0;e<o.length;e++){let t=o[e];if(Ki(t,r)||a&&qi(t,r)){s=e;break}}let c=o[s];c.params||=[],c.params.push(i),t.params=(t.params??[]).filter(t=>t.name!==e)}return Array.isArray(t.params)&&t.params.length===0&&delete t.params,t}function Gi(e,t){if(!t||Object.keys(t).length===0)return e;let n=JSON.parse(JSON.stringify(e)),r=e=>{for(let n of e)n.name&&n.name in t&&(n.value=t[n.name])};Array.isArray(n.params)&&r(n.params);let i=e=>{if(Array.isArray(e)){for(let t of e)if(Array.isArray(t.params)&&r(t.params),t.vconcat&&i(t.vconcat),t.hconcat&&i(t.hconcat),t.concat&&i(t.concat),Array.isArray(t.layer))for(let e of t.layer)Array.isArray(e.params)&&r(e.params)}};if(n.vconcat&&i(n.vconcat),n.hconcat&&i(n.hconcat),n.concat&&i(n.concat),Array.isArray(n.layer))for(let e of n.layer)e&&Array.isArray(e.params)&&r(e.params);return n}function Ki(e,t){if(!e?.encoding)return!1;for(let n of t)for(let t of Object.values(e.encoding))if(t.field===n)return!0;if(Array.isArray(e.layer)){for(let n of e.layer)if(Ki(n,t))return!0}return!1}function qi(e,t){if(!e)return!1;let n=e=>{if(!e)return!1;let n=e.color?.field;return!!n&&t.includes(n)};if(n(e.encoding))return!0;if(Array.isArray(e.layer)){for(let t of e.layer)if(n(t.encoding))return!0}return!1}function Ji(e,t=[]){let n=[];if(!e||typeof e!=`object`)return n;if(e.data&&typeof e.data==`object`){let r=e.data.url;typeof r==`string`&&r.startsWith(`artifact:`)&&n.push({path:[...t,`data`],artifactPath:r.replace(/^artifact:/,``).trim()})}for(let r of[`layer`,`vconcat`,`hconcat`,`concat`,`spec`,`repeat`,`facet`])if(r in e){let i=e[r];Array.isArray(i)?i.forEach((e,i)=>{Ui(e)&&n.push(...Ji(e,[...t,r,String(i)]))}):Ui(i)&&n.push(...Ji(i,[...t,r]))}return n}function Yi(e,t){let n=JSON.parse(JSON.stringify(e));for(let[e,r]of t){let t=e.split(`.`),i=n;for(let e=0;e<t.length-1;e++){let n=i[t[e]];if(!Hi(n))break;i=n}let a=t[t.length-1],o=i[a];Hi(o)&&(delete o.url,o.values=r)}return n}function Xi(e){let t={background:`transparent`,view:{stroke:`transparent`},range:{category:Vi.categorical,diverging:Vi.diverging,heatmap:Vi.purples,ramp:Vi.blues},mark:{tooltip:!0},bar:{tooltip:!0,cornerRadiusTopLeft:4,cornerRadiusTopRight:4},line:{tooltip:!0,strokeWidth:2.5,strokeCap:`round`},point:{tooltip:!0,size:60,filled:!0},area:{tooltip:!0,fillOpacity:.7,line:!0},rect:{tooltip:!0,cornerRadius:2},arc:{tooltip:!0,cornerRadius:4},circle:{tooltip:!0,size:80}};return e?{...t,axis:{labelColor:`#a1a1aa`,titleColor:`#e4e4e7`,gridColor:`#3f3f46`,domainColor:`#52525b`,tickColor:`#52525b`,labelFont:`Inter, system-ui, sans-serif`,titleFont:`Inter, system-ui, sans-serif`,labelFontSize:11,titleFontSize:12,titleFontWeight:500},legend:{labelColor:`#a1a1aa`,titleColor:`#e4e4e7`,labelFont:`Inter, system-ui, sans-serif`,titleFont:`Inter, system-ui, sans-serif`,labelFontSize:11,titleFontSize:12,symbolSize:100},title:{color:`#fafafa`,font:`Inter, system-ui, sans-serif`,fontSize:14,fontWeight:600}}:{...t,axis:{labelColor:`#71717a`,titleColor:`#3f3f46`,gridColor:`#e4e4e7`,domainColor:`#d4d4d8`,tickColor:`#d4d4d8`,labelFont:`Inter, system-ui, sans-serif`,titleFont:`Inter, system-ui, sans-serif`,labelFontSize:11,titleFontSize:12,titleFontWeight:500},legend:{labelColor:`#71717a`,titleColor:`#3f3f46`,labelFont:`Inter, system-ui, sans-serif`,titleFont:`Inter, system-ui, sans-serif`,labelFontSize:11,titleFontSize:12,symbolSize:100},title:{color:`#18181b`,font:`Inter, system-ui, sans-serif`,fontSize:14,fontWeight:600}}}const Zi=re(function({spec:i,artifactRunId:a}){let{t:o}=B(),{title:s,description:c,options:l}=i,u=i.spec,[d,f]=z(!1),[p,m]=z(!1),[h,g]=z(null),[_,v]=z(!1),y=R(null),b=R(null),x=R(null),{client:S}=ye(),C=Mi(),w=R(S);w.current=S;let T=R(C);T.current=C;let[E,D]=z(null),[O,k]=z(!1),[A,j]=z(null),M=l?.mode||`chart`,N=M===`dashboard`,te=l?.enableFullscreen??N,P=l?.height||Bi(u,M);I(()=>{let e=Ji(u);if(e.length===0){D(u),k(!1),j(null);return}a?console.info(`[VegaLiteChart] resolving artifacts with runId:`,a,e.map(e=>e.artifactPath)):console.warn(`[VegaLiteChart] artifact references found but artifactRunId is missing!`,{references:e.map(e=>e.artifactPath),artifactRunId:a});let t=!1;return k(!0),j(null),(async()=>{let n=new Map,r=w.current,i=T.current;for(let o of e)try{let e=o.path.join(`.`),t;if(a&&!Ni(o.artifactPath)){let e=Pi(a,o.artifactPath,`inline`);t=i?await i.getOrFetch(e,async()=>(await r.files.getArtifactDownloadUrl(a,o.artifactPath,`inline`)).url):(await r.files.getArtifactDownloadUrl(a,o.artifactPath,`inline`)).url}else{let e=Fi(o.artifactPath);t=i?await i.getOrFetch(e,async()=>(await r.files.getDownloadUrl(o.artifactPath)).url):(await r.files.getDownloadUrl(o.artifactPath)).url}let s=await fetch(t);if(!s.ok)throw Error(`Failed to fetch artifact data: ${s.statusText}`);let c=o.artifactPath.toLowerCase().endsWith(`.csv`),l;if(c){let e=await s.text();l=be.parse(e,{header:!0,skipEmptyLines:!0,dynamicTyping:!0}).data}else{let e=await s.json();l=Array.isArray(e)?e:[e]}n.set(e,l)}catch(e){console.error(`Failed to resolve artifact: ${o.artifactPath}`,e),t||j(`Failed to load data from artifact: ${o.artifactPath}`);return}if(!t){let e=Yi(u,n);D(e),k(!1)}})(),()=>{t=!0}},[u,a]);let[ne,re]=z(!1),ie=R(!1);I(()=>{let e=()=>{let e=document.documentElement.classList.contains(`dark`);e!==ie.current&&(ie.current=e,re(e))};e();let t=new MutationObserver(e);return t.observe(document.documentElement,{attributes:!0,attributeFilter:[`class`]}),()=>t.disconnect()},[]);let[ae,oe]=z(0),se=R(0);I(()=>{if(!x.current)return;let e,t=new ResizeObserver(t=>{clearTimeout(e),e=setTimeout(()=>{let e=t[0]?.contentRect.width;e&&e!==se.current&&(se.current=e,oe(e))},100)});t.observe(x.current);let n=x.current.clientWidth;return se.current=n,oe(n),()=>{clearTimeout(e),t.disconnect()}},[]);let ce=L(()=>Ji(u).length>0,[u]),le=L(()=>{if(ce&&!E)return null;let e=E||u;return e?(l?.parameterValues&&(e=Gi(e,l.parameterValues)),Wi(e)):null},[E,u,ce,l?.parameterValues]),ue=F((e,t)=>{if(!e||typeof e!=`object`)return e;if(e.hconcat&&Array.isArray(e.hconcat)){let n=e.hconcat.length,r=(e.spacing??10)*(n-1),i=Math.floor((t-r)/n);return{...e,hconcat:e.hconcat.map(e=>ue(e,i))}}if(e.vconcat&&Array.isArray(e.vconcat))return{...e,vconcat:e.vconcat.map(e=>ue(e,t))};if(e.concat&&Array.isArray(e.concat)){let n=e.columns??e.concat.length,r=(e.spacing??10)*(n-1),i=Math.floor((t-r)/n);return{...e,concat:e.concat.map(e=>ue(e,i))}}let n=e.width;return n===`container`||typeof n==`number`&&n>t?{...e,width:t}:e},[]),de=F((e,t=!1)=>{if(!le)return null;let n=Xi(ne),r=t?typeof window<`u`?Math.min(window.innerWidth-80,1400):1200:ae>0?ae-24:500,i=`vconcat`in le||`hconcat`in le||`concat`in le,a=i?{type:`pad`,contains:`padding`}:{type:`fit`,contains:`padding`},o=le;i&&r&&(o=ue(le,r));let c=o.width,l=i?void 0:c===`container`?r:c??r,{width:u,...d}=o;return{$schema:`https://vega.github.io/schema/vega-lite/v6.json`,...!i&&l?{width:l}:{},height:t?void 0:e,autosize:a,...i?o:d,...s&&!le.title?{title:s}:{},config:{...n,...le.config}}},[le,s,ne,ae,ue]),fe=F(async()=>{let e=_?b.current:y.current;if(!(!e||p))try{(await e.toCanvas(2)).toBlob(async e=>{e&&(await navigator.clipboard.write([new ClipboardItem({"image/png":e})]),m(!0),setTimeout(()=>m(!1),2e3))},`image/png`)}catch(e){console.error(`Failed to copy chart:`,e)}},[p,_]),pe=F(async()=>{let e=_?b.current:y.current;if(!(!e||d)){f(!0);try{let t=await e.toImageURL(`png`,2),n=document.createElement(`a`);n.download=`${s||`chart`}.png`,n.href=t,n.click()}catch(e){console.error(`Failed to export chart:`,e)}finally{f(!1)}}},[s,d,_]),me=F(e=>{y.current=e,g(null)},[]),he=F(e=>{b.current=e},[]),ge=F(e=>{console.error(`Vega-Lite rendering error:`,e),g(e instanceof Error?e.message:`Unknown error`)},[]),_e=F(()=>{v(e=>!e)},[]);I(()=>{g(null)},[u]);let ve=({className:e})=>n(`div`,{className:Ai(`flex items-center gap-2`,e),children:[n(r,{variant:`unstyled`,onClick:fe,disabled:p,className:`text-xs px-2 py-1 rounded border border-gray-300 dark:border-gray-700 bg-gray-100 dark:bg-gray-800 text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700 cursor-pointer transition-colors disabled:opacity-50 flex items-center gap-1`,title:o(`agent.copyToClipboard`),children:[t(p?Ke:et,{className:`w-3 h-3`}),o(p?`agent.copied`:`agent.copy`)]}),n(r,{variant:`unstyled`,onClick:pe,disabled:d,className:`text-xs px-2 py-1 rounded border border-gray-300 dark:border-gray-700 bg-gray-100 dark:bg-gray-800 text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700 cursor-pointer transition-colors disabled:opacity-50 disabled:cursor-not-allowed flex items-center gap-1`,title:o(`agent.exportAsPng`),children:[t(tt,{className:`w-3 h-3`}),o(d?`agent.exporting`:`agent.export`)]}),te&&n(r,{variant:`unstyled`,onClick:_e,className:`text-xs px-2 py-1 rounded border border-gray-300 dark:border-gray-700 bg-gray-100 dark:bg-gray-800 text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700 cursor-pointer transition-colors flex items-center gap-1`,title:o(_?`agent.exitFullscreen`:`agent.fullscreen`),children:[t(_?pt:dt,{className:`w-3 h-3`}),o(_?`agent.exit`:`agent.fullscreen`)]})]});if(O||ce&&!E)return t(`div`,{className:`bg-white dark:bg-gray-900 rounded-lg border border-gray-200 dark:border-gray-800 shadow-sm`,children:n(`div`,{className:`flex flex-col gap-2 p-3`,children:[t(`div`,{className:`flex items-center justify-between`,children:t(`span`,{className:`font-medium text-sm text-gray-900 dark:text-gray-100`,children:s||`Chart`})}),t(`div`,{className:`flex items-center justify-center bg-gray-50 dark:bg-gray-800 rounded`,style:{width:`100%`,height:P},children:n(`div`,{className:`flex items-center gap-2 text-gray-500 dark:text-gray-400`,children:[t(ut,{className:`w-5 h-5 animate-spin`}),t(`span`,{className:`text-sm`,children:`Loading data from artifacts...`})]})})]})});if(A)return t(`div`,{className:`bg-white dark:bg-gray-900 rounded-lg border border-gray-200 dark:border-gray-800 shadow-sm`,children:n(`div`,{className:`flex flex-col gap-2 p-3`,children:[t(`div`,{className:`flex items-center justify-between`,children:t(`span`,{className:`font-medium text-sm text-gray-900 dark:text-gray-100`,children:s||`Chart`})}),t(`div`,{style:{width:`100%`,height:P},children:t(Li,{error:A,chartTitle:s})})]})});if(h)return t(`div`,{className:`bg-white dark:bg-gray-900 rounded-lg border border-gray-200 dark:border-gray-800 shadow-sm`,children:n(`div`,{className:`flex flex-col gap-2 p-3`,children:[t(`div`,{className:`flex items-center justify-between`,children:t(`span`,{className:`font-medium text-sm text-gray-900 dark:text-gray-100`,children:s||`Chart`})}),t(`div`,{style:{width:`100%`,height:P},children:t(Li,{error:h,chartTitle:s})})]})});let xe=de(P),V=de(0,!0);return xe?(typeof window<`u`&&localStorage.getItem(`DEBUG_VEGA_RENDERS`)&&console.log(`VegaLite rendering with spec:`,{title:s,hasData:!!xe.data?.values,dataLength:xe.data?.values?.length}),n(e,{children:[t(`div`,{className:Ai(`bg-white dark:bg-gray-900 rounded-lg border border-gray-200 dark:border-gray-800 shadow-sm`,N&&`border-2`),children:n(`div`,{className:`flex flex-col gap-2 p-3`,children:[n(`div`,{className:`flex items-center justify-between`,children:[n(`div`,{className:`flex items-center gap-2`,children:[t(`span`,{className:`font-medium text-sm text-gray-900 dark:text-gray-100`,children:s||(N?`Dashboard`:`Chart`)}),N&&t(`span`,{className:`text-xs px-2 py-0.5 rounded-full bg-indigo-100 dark:bg-indigo-900 text-indigo-700 dark:text-indigo-300`,children:`Interactive`})]}),t(ve,{})]}),c&&t(`span`,{className:`text-xs text-gray-500 dark:text-gray-400`,children:c}),t(`div`,{ref:x,className:`bg-white dark:bg-gray-900 rounded overflow-hidden`,style:{width:`100%`,height:P,minWidth:0},children:t(ee,{fallback:t(Ri,{}),children:t(Ii,{spec:xe,onEmbed:e=>me(e.view),onError:ge,options:{renderer:l?.renderer||`canvas`,actions:!1}})})})]})}),n(zi,{isOpen:_,onClose:()=>v(!1),title:s||(N?`Dashboard`:`Chart`),description:c,children:[t(`div`,{className:`w-full h-full min-h-[calc(100vh-200px)]`,children:V&&t(ee,{fallback:t(Ri,{}),children:t(Ii,{spec:V,onEmbed:e=>he(e.view),onError:ge,options:{renderer:l?.renderer||`canvas`,actions:!1}})})}),t(`div`,{className:`absolute bottom-6 end-6`,children:t(ve,{className:`bg-white dark:bg-gray-800 rounded-lg shadow-lg p-2 border border-gray-200 dark:border-gray-700`})})]})]})):null},(e,t)=>JSON.stringify(e.spec)===JSON.stringify(t.spec)&&e.artifactRunId===t.artifactRunId),Qi=M.createContext({});function $i({children:e,artifactRunId:n,onProposalSelect:r,onProposalSubmit:i,MarkdownRenderer:a}){let o=L(()=>({artifactRunId:n,onProposalSelect:r,onProposalSubmit:i,MarkdownRenderer:a}),[n,r,i,a]);return t(Qi.Provider,{value:o,children:e})}function ea(){return M.useContext(Qi)}const ta={chart:{icon:Ge,label:`chart`,defaultHeight:200},mermaid:{icon:rt,label:`diagram`,defaultHeight:150},proposal:{icon:ft,label:`options`,defaultHeight:100},code:{icon:$e,label:`code`,defaultHeight:80},image:{icon:ot,label:`image`,defaultHeight:150},link:{icon:ct,label:`link`,defaultHeight:24},expand:{icon:tt,label:`content`,defaultHeight:100},table:{icon:xt,label:`table`,defaultHeight:150},markdown:{icon:nt,label:`content`,defaultHeight:100},"fusion-fragment":{icon:$e,label:`fragment`,defaultHeight:150}};function U({type:e,error:i,onRetry:a,message:o,height:s}){let c=ta[e],l=s??c.defaultHeight,u=e===`link`;if(i)return n(`div`,{className:`flex items-center gap-2 rounded border border-destructive/30 bg-destructive/5 text-destructive ${u?`inline-flex px-2 py-1 text-sm`:`p-4`}`,style:u?void 0:{minHeight:l},children:[n(`span`,{className:`text-destructive`,children:[`Failed to load `,c.label]}),a&&t(r,{variant:`unstyled`,onClick:a,className:`ms-2 rounded bg-destructive/10 px-2 py-1 text-xs hover:bg-destructive/20 transition-colors text-destructive`,children:`Retry`})]});let d=c.icon;return u?n(`span`,{className:`inline-flex items-center gap-1 text-muted animate-pulse`,children:[t(d,{className:`h-3 w-3`}),t(`span`,{children:o||`Loading ${c.label}...`})]}):n(`div`,{className:`flex flex-col items-center justify-center gap-3 rounded border border-border bg-muted/30 animate-pulse`,style:{minHeight:l},children:[t(d,{className:`h-8 w-8 text-muted`}),t(`span`,{className:`text-sm text-muted`,children:o||`Loading ${c.label}...`}),t(`div`,{className:`flex gap-1`,children:[...[,,,]].map((e,n)=>t(`div`,{className:`h-2 w-2 rounded-full bg-muted animate-bounce`,style:{animationDelay:`${n*150}ms`}},`dot-${n}`))})]})}var na=class extends M.Component{constructor(e){super(e),this.state={hasError:!1}}static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(e,t){console.error(`CodeBlock rendering error (${this.props.type}):`,e,t),this.props.onError?.(e)}handleRetry=()=>{this.setState({hasError:!1,error:void 0})};render(){if(this.state.hasError){let{type:e,fallbackCode:r}=this.props;return n(`div`,{className:`space-y-2`,children:[t(U,{type:e,error:this.state.error?.message||`Rendering failed`,onRetry:this.handleRetry}),r&&n(`details`,{className:`text-sm`,children:[t(`summary`,{className:`cursor-pointer text-muted hover:text-foreground`,children:`Show raw content`}),t(`pre`,{className:`mt-2 overflow-x-auto rounded bg-muted/50 p-2 text-xs`,children:t(`code`,{children:r})})]})]})}return this.props.children}};function ra(e,t,n){let r=t.split(`.`).pop()?.toLowerCase();if(r===`svg`)return`mockup`;if([`png`,`jpg`,`jpeg`,`gif`,`webp`].includes(r||``))return`image`;if(r===`md`)return`markdown`;if(r===`csv`)return`table`;if(n===`json`&&typeof e==`object`&&e){let t=e;if(typeof t.$schema==`string`&&t.$schema.includes(`vega`)||t.library===`vega-lite`&&`spec`in t)return`vega-lite`;if(`template`in t&&`data`in t)return`fusion-fragment`;if(Array.isArray(e)&&e.length>0&&typeof e[0]==`object`)return`table`}return`code`}function ia(e){if(typeof e!=`object`||!e)return null;let t=e;return t.library===`vega-lite`&&`spec`in t&&typeof t.spec==`object`&&t.spec!==null?t:typeof t.$schema==`string`&&t.$schema.includes(`vega`)?{library:`vega-lite`,spec:t}:null}function aa({content:e}){let{headers:r,rows:i}=L(()=>{if(!Array.isArray(e)||e.length===0)return{headers:[],rows:[]};let t=e[0];if(typeof t!=`object`||!t)return{headers:[],rows:[]};let n=Object.keys(t);return{headers:n,rows:e.map(e=>n.map(t=>{let n=e[t];return n==null?``:typeof n==`object`?JSON.stringify(n):String(n)}))}},[e]);return r.length===0?t(U,{type:`table`,error:`No table data found`}):n(`div`,{className:`overflow-x-auto`,children:[n(`table`,{className:`min-w-full text-sm border-collapse`,children:[t(`thead`,{children:t(`tr`,{className:`border-b`,children:r.map(e=>t(`th`,{className:`px-3 py-2 text-start font-medium text-muted`,children:e},e))})}),t(`tbody`,{children:i.slice(0,100).map((e,n)=>t(`tr`,{className:`border-b border-muted/20`,children:e.map((e,n)=>t(`td`,{className:`px-3 py-2`,children:e},`cell-${n}`))},`row-${n}`))})]}),i.length>100&&n(`div`,{className:`text-sm text-muted py-2`,children:[`Showing 100 of `,i.length,` rows`]})]})}function oa({content:e,path:n}){let r=n.split(`.`).pop()?.toLowerCase()||``,i=typeof e==`string`?e:JSON.stringify(e,null,2);return t(`pre`,{className:`overflow-x-auto p-3 bg-muted/10 rounded text-sm`,children:t(`code`,{className:`language-${r}`,children:i})})}function sa(e){return de.sanitize(e,{USE_PROFILES:{svg:!0,svgFilters:!0},ADD_TAGS:[`use`],FORBID_TAGS:[`foreignObject`]})}function ca(e){return e.replace(/<svg([^>]*)>/i,(e,t)=>{let n=t;if(!/viewBox/i.test(n)){let e=/\swidth\s*=\s*["']?(\d+(?:\.\d+)?)/i.exec(n),t=/\sheight\s*=\s*["']?(\d+(?:\.\d+)?)/i.exec(n);e&&t&&(n+=` viewBox="0 0 ${e[1]} ${t[1]}"`)}return n=n.replace(/\swidth\s*=\s*(?:"[^"]*"|'[^']*'|[^\s>]+)/i,``).replace(/\sheight\s*=\s*(?:"[^"]*"|'[^']*'|[^\s>]+)/i,``),/style="/i.test(n)?n=n.replace(/style="([^"]*)"/i,(e,t)=>`style="${t};width:100%;height:auto;display:block;max-width:100%;"`):n+=` style="width:100%;height:auto;display:block;max-width:100%;"`,/preserveAspectRatio=/i.test(n)||(n+=` preserveAspectRatio="xMidYMid meet"`),`<svg${n}>`})}function la({content:e}){let n=L(()=>{let t=typeof e==`string`?e.trim():``;return t?ca(sa(t)):null},[e]);return n?t(`div`,{style:{margin:`16px 0`,width:`100%`,overflowX:`auto`},dangerouslySetInnerHTML:{__html:n}}):t(U,{type:`expand`,error:`Empty mockup`})}function ua({content:e,path:n}){let r=typeof e==`string`?e:``,i=n.split(`/`).pop()||`Artifact image`;return t(`img`,{src:r,alt:i,className:`max-w-full h-auto rounded`,loading:`lazy`})}function da({content:e,renderType:n,path:r,runId:i,contentType:a}){let{MarkdownRenderer:o}=ea();switch(L(()=>n===`auto`?ra(e,r,a):n,[e,r,a,n])){case`chart`:{let n=ia(e);return n?t(na,{type:`chart`,fallbackCode:JSON.stringify(e,null,2),children:t(Zi,{spec:n,artifactRunId:i})}):t(U,{type:`chart`,error:`Only Vega-Lite charts are supported. Recharts rendering has been retired.`})}case`vega-lite`:{let n=ia(e);return n?t(na,{type:`chart`,fallbackCode:JSON.stringify(e,null,2),children:t(Zi,{spec:n,artifactRunId:i})}):t(U,{type:`chart`,error:`Invalid Vega-Lite specification`})}case`fusion-fragment`:{let n=e;return console.log(`[ArtifactContentRenderer] fusion-fragment:`,{hasTemplate:!!n.template,hasData:!!n.data,runId:i,hasVegaLiteChart:!!Zi}),n.template&&n.data?t(na,{type:`fusion-fragment`,fallbackCode:JSON.stringify(e,null,2),children:t(ue,{data:n.data,ChartComponent:Zi,artifactRunId:i,children:t(le,{code:JSON.stringify(n.template),data:n.data})})}):t(na,{type:`fusion-fragment`,fallbackCode:JSON.stringify(e,null,2),children:t(le,{code:JSON.stringify(e)})})}case`table`:return t(na,{type:`table`,fallbackCode:JSON.stringify(e,null,2),children:t(aa,{content:e})});case`markdown`:{let n=typeof e==`string`?e:String(e);return t(na,{type:`markdown`,fallbackCode:n,children:o?t(o,{artifactRunId:i,children:n}):t(`pre`,{className:`overflow-x-auto p-3 bg-muted/10 rounded text-sm`,children:t(`code`,{children:n})})})}case`mockup`:return t(na,{type:`expand`,fallbackCode:typeof e==`string`?e:r,children:t(la,{content:e})});case`image`:return t(na,{type:`image`,fallbackCode:r,children:t(ua,{content:e,path:r})});default:return t(oa,{content:e,path:r})}}function fa(e,t){let n=t||{};return(e[e.length-1]===``?[...e,``]:e).join((n.padRight?` `:``)+`,`+(n.padLeft===!1?``:` `)).trim()}const pa=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,ma=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,ha={};function ga(e,t){return((t||ha).jsx?ma:pa).test(e)}const _a=/[ \t\n\f\r]/g;function va(e){return typeof e==`object`?e.type===`text`&&ya(e.value):ya(e)}function ya(e){return e.replace(_a,``)===``}var ba=class{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}};ba.prototype.normal={},ba.prototype.property={},ba.prototype.space=void 0;function xa(e,t){let n={},r={};for(let t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new ba(n,r,t)}function Sa(e){return e.toLowerCase()}var Ca=class{constructor(e,t){this.attribute=t,this.property=e}};Ca.prototype.attribute=``,Ca.prototype.booleanish=!1,Ca.prototype.boolean=!1,Ca.prototype.commaOrSpaceSeparated=!1,Ca.prototype.commaSeparated=!1,Ca.prototype.defined=!1,Ca.prototype.mustUseProperty=!1,Ca.prototype.number=!1,Ca.prototype.overloadedBoolean=!1,Ca.prototype.property=``,Ca.prototype.spaceSeparated=!1,Ca.prototype.space=void 0;var wa=Me({boolean:()=>W,booleanish:()=>G,commaOrSpaceSeparated:()=>Oa,commaSeparated:()=>Da,number:()=>K,overloadedBoolean:()=>Ea,spaceSeparated:()=>q});let Ta=0;const W=ka(),G=ka(),Ea=ka(),K=ka(),q=ka(),Da=ka(),Oa=ka();function ka(){return 2**++Ta}const Aa=Object.keys(wa);var ja=class extends Ca{constructor(e,t,n,r){let i=-1;if(super(e,t),Ma(this,`space`,r),typeof n==`number`)for(;++i<Aa.length;){let e=Aa[i];Ma(this,Aa[i],(n&wa[e])===wa[e])}}};ja.prototype.defined=!0;function Ma(e,t,n){n&&(e[t]=n)}function Na(e){let t={},n={};for(let[r,i]of Object.entries(e.properties)){let a=new ja(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),t[r]=a,n[Sa(r)]=r,n[Sa(a.attribute)]=r}return new ba(t,n,e.space)}const Pa=Na({properties:{ariaActiveDescendant:null,ariaAtomic:G,ariaAutoComplete:null,ariaBusy:G,ariaChecked:G,ariaColCount:K,ariaColIndex:K,ariaColSpan:K,ariaControls:q,ariaCurrent:null,ariaDescribedBy:q,ariaDetails:null,ariaDisabled:G,ariaDropEffect:q,ariaErrorMessage:null,ariaExpanded:G,ariaFlowTo:q,ariaGrabbed:G,ariaHasPopup:null,ariaHidden:G,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:q,ariaLevel:K,ariaLive:null,ariaModal:G,ariaMultiLine:G,ariaMultiSelectable:G,ariaOrientation:null,ariaOwns:q,ariaPlaceholder:null,ariaPosInSet:K,ariaPressed:G,ariaReadOnly:G,ariaRelevant:null,ariaRequired:G,ariaRoleDescription:q,ariaRowCount:K,ariaRowIndex:K,ariaRowSpan:K,ariaSelected:G,ariaSetSize:K,ariaSort:null,ariaValueMax:K,ariaValueMin:K,ariaValueNow:K,ariaValueText:null,role:null},transform(e,t){return t===`role`?t:`aria-`+t.slice(4).toLowerCase()}});function Fa(e,t){return t in e?e[t]:t}function Ia(e,t){return Fa(e,t.toLowerCase())}const La=Na({attributes:{acceptcharset:`accept-charset`,classname:`class`,htmlfor:`for`,httpequiv:`http-equiv`},mustUseProperty:[`checked`,`multiple`,`muted`,`selected`],properties:{abbr:null,accept:Da,acceptCharset:q,accessKey:q,action:null,allow:null,allowFullScreen:W,allowPaymentRequest:W,allowUserMedia:W,alt:null,as:null,async:W,autoCapitalize:null,autoComplete:q,autoFocus:W,autoPlay:W,blocking:q,capture:null,charSet:null,checked:W,cite:null,className:q,cols:K,colSpan:null,content:null,contentEditable:G,controls:W,controlsList:q,coords:K|Da,crossOrigin:null,data:null,dateTime:null,decoding:null,default:W,defer:W,dir:null,dirName:null,disabled:W,download:Ea,draggable:G,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:W,formTarget:null,headers:q,height:K,hidden:Ea,high:K,href:null,hrefLang:null,htmlFor:q,httpEquiv:q,id:null,imageSizes:null,imageSrcSet:null,inert:W,inputMode:null,integrity:null,is:null,isMap:W,itemId:null,itemProp:q,itemRef:q,itemScope:W,itemType:q,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:W,low:K,manifest:null,max:null,maxLength:K,media:null,method:null,min:null,minLength:K,multiple:W,muted:W,name:null,nonce:null,noModule:W,noValidate:W,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:W,optimum:K,pattern:null,ping:q,placeholder:null,playsInline:W,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:W,referrerPolicy:null,rel:q,required:W,reversed:W,rows:K,rowSpan:K,sandbox:q,scope:null,scoped:W,seamless:W,selected:W,shadowRootClonable:W,shadowRootDelegatesFocus:W,shadowRootMode:null,shape:null,size:K,sizes:null,slot:null,span:K,spellCheck:G,src:null,srcDoc:null,srcLang:null,srcSet:null,start:K,step:null,style:null,tabIndex:K,target:null,title:null,translate:null,type:null,typeMustMatch:W,useMap:null,value:G,width:K,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:q,axis:null,background:null,bgColor:null,border:K,borderColor:null,bottomMargin:K,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:W,declare:W,event:null,face:null,frame:null,frameBorder:null,hSpace:K,leftMargin:K,link:null,longDesc:null,lowSrc:null,marginHeight:K,marginWidth:K,noResize:W,noHref:W,noShade:W,noWrap:W,object:null,profile:null,prompt:null,rev:null,rightMargin:K,rules:null,scheme:null,scrolling:G,standby:null,summary:null,text:null,topMargin:K,valueType:null,version:null,vAlign:null,vLink:null,vSpace:K,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:W,disableRemotePlayback:W,prefix:null,property:null,results:K,security:null,unselectable:null},space:`html`,transform:Ia}),Ra=Na({attributes:{accentHeight:`accent-height`,alignmentBaseline:`alignment-baseline`,arabicForm:`arabic-form`,baselineShift:`baseline-shift`,capHeight:`cap-height`,className:`class`,clipPath:`clip-path`,clipRule:`clip-rule`,colorInterpolation:`color-interpolation`,colorInterpolationFilters:`color-interpolation-filters`,colorProfile:`color-profile`,colorRendering:`color-rendering`,crossOrigin:`crossorigin`,dataType:`datatype`,dominantBaseline:`dominant-baseline`,enableBackground:`enable-background`,fillOpacity:`fill-opacity`,fillRule:`fill-rule`,floodColor:`flood-color`,floodOpacity:`flood-opacity`,fontFamily:`font-family`,fontSize:`font-size`,fontSizeAdjust:`font-size-adjust`,fontStretch:`font-stretch`,fontStyle:`font-style`,fontVariant:`font-variant`,fontWeight:`font-weight`,glyphName:`glyph-name`,glyphOrientationHorizontal:`glyph-orientation-horizontal`,glyphOrientationVertical:`glyph-orientation-vertical`,hrefLang:`hreflang`,horizAdvX:`horiz-adv-x`,horizOriginX:`horiz-origin-x`,horizOriginY:`horiz-origin-y`,imageRendering:`image-rendering`,letterSpacing:`letter-spacing`,lightingColor:`lighting-color`,markerEnd:`marker-end`,markerMid:`marker-mid`,markerStart:`marker-start`,navDown:`nav-down`,navDownLeft:`nav-down-left`,navDownRight:`nav-down-right`,navLeft:`nav-left`,navNext:`nav-next`,navPrev:`nav-prev`,navRight:`nav-right`,navUp:`nav-up`,navUpLeft:`nav-up-left`,navUpRight:`nav-up-right`,onAbort:`onabort`,onActivate:`onactivate`,onAfterPrint:`onafterprint`,onBeforePrint:`onbeforeprint`,onBegin:`onbegin`,onCancel:`oncancel`,onCanPlay:`oncanplay`,onCanPlayThrough:`oncanplaythrough`,onChange:`onchange`,onClick:`onclick`,onClose:`onclose`,onCopy:`oncopy`,onCueChange:`oncuechange`,onCut:`oncut`,onDblClick:`ondblclick`,onDrag:`ondrag`,onDragEnd:`ondragend`,onDragEnter:`ondragenter`,onDragExit:`ondragexit`,onDragLeave:`ondragleave`,onDragOver:`ondragover`,onDragStart:`ondragstart`,onDrop:`ondrop`,onDurationChange:`ondurationchange`,onEmptied:`onemptied`,onEnd:`onend`,onEnded:`onended`,onError:`onerror`,onFocus:`onfocus`,onFocusIn:`onfocusin`,onFocusOut:`onfocusout`,onHashChange:`onhashchange`,onInput:`oninput`,onInvalid:`oninvalid`,onKeyDown:`onkeydown`,onKeyPress:`onkeypress`,onKeyUp:`onkeyup`,onLoad:`onload`,onLoadedData:`onloadeddata`,onLoadedMetadata:`onloadedmetadata`,onLoadStart:`onloadstart`,onMessage:`onmessage`,onMouseDown:`onmousedown`,onMouseEnter:`onmouseenter`,onMouseLeave:`onmouseleave`,onMouseMove:`onmousemove`,onMouseOut:`onmouseout`,onMouseOver:`onmouseover`,onMouseUp:`onmouseup`,onMouseWheel:`onmousewheel`,onOffline:`onoffline`,onOnline:`ononline`,onPageHide:`onpagehide`,onPageShow:`onpageshow`,onPaste:`onpaste`,onPause:`onpause`,onPlay:`onplay`,onPlaying:`onplaying`,onPopState:`onpopstate`,onProgress:`onprogress`,onRateChange:`onratechange`,onRepeat:`onrepeat`,onReset:`onreset`,onResize:`onresize`,onScroll:`onscroll`,onSeeked:`onseeked`,onSeeking:`onseeking`,onSelect:`onselect`,onShow:`onshow`,onStalled:`onstalled`,onStorage:`onstorage`,onSubmit:`onsubmit`,onSuspend:`onsuspend`,onTimeUpdate:`ontimeupdate`,onToggle:`ontoggle`,onUnload:`onunload`,onVolumeChange:`onvolumechange`,onWaiting:`onwaiting`,onZoom:`onzoom`,overlinePosition:`overline-position`,overlineThickness:`overline-thickness`,paintOrder:`paint-order`,panose1:`panose-1`,pointerEvents:`pointer-events`,referrerPolicy:`referrerpolicy`,renderingIntent:`rendering-intent`,shapeRendering:`shape-rendering`,stopColor:`stop-color`,stopOpacity:`stop-opacity`,strikethroughPosition:`strikethrough-position`,strikethroughThickness:`strikethrough-thickness`,strokeDashArray:`stroke-dasharray`,strokeDashOffset:`stroke-dashoffset`,strokeLineCap:`stroke-linecap`,strokeLineJoin:`stroke-linejoin`,strokeMiterLimit:`stroke-miterlimit`,strokeOpacity:`stroke-opacity`,strokeWidth:`stroke-width`,tabIndex:`tabindex`,textAnchor:`text-anchor`,textDecoration:`text-decoration`,textRendering:`text-rendering`,transformOrigin:`transform-origin`,typeOf:`typeof`,underlinePosition:`underline-position`,underlineThickness:`underline-thickness`,unicodeBidi:`unicode-bidi`,unicodeRange:`unicode-range`,unitsPerEm:`units-per-em`,vAlphabetic:`v-alphabetic`,vHanging:`v-hanging`,vIdeographic:`v-ideographic`,vMathematical:`v-mathematical`,vectorEffect:`vector-effect`,vertAdvY:`vert-adv-y`,vertOriginX:`vert-origin-x`,vertOriginY:`vert-origin-y`,wordSpacing:`word-spacing`,writingMode:`writing-mode`,xHeight:`x-height`,playbackOrder:`playbackorder`,timelineBegin:`timelinebegin`},properties:{about:Oa,accentHeight:K,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:K,amplitude:K,arabicForm:null,ascent:K,attributeName:null,attributeType:null,azimuth:K,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:K,by:null,calcMode:null,capHeight:K,className:q,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:K,diffuseConstant:K,direction:null,display:null,dur:null,divisor:K,dominantBaseline:null,download:W,dx:null,dy:null,edgeMode:null,editable:null,elevation:K,enableBackground:null,end:null,event:null,exponent:K,externalResourcesRequired:null,fill:null,fillOpacity:K,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:Da,g2:Da,glyphName:Da,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:K,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:K,horizOriginX:K,horizOriginY:K,id:null,ideographic:K,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:K,k:K,k1:K,k2:K,k3:K,k4:K,kernelMatrix:Oa,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:K,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:K,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:K,overlineThickness:K,paintOrder:null,panose1:null,path:null,pathLength:K,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:q,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:K,pointsAtY:K,pointsAtZ:K,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Oa,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Oa,rev:Oa,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Oa,requiredFeatures:Oa,requiredFonts:Oa,requiredFormats:Oa,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:K,specularExponent:K,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:K,strikethroughThickness:K,string:null,stroke:null,strokeDashArray:Oa,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:K,strokeOpacity:K,strokeWidth:null,style:null,surfaceScale:K,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Oa,tabIndex:K,tableValues:null,target:null,targetX:K,targetY:K,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Oa,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:K,underlineThickness:K,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:K,values:null,vAlphabetic:K,vMathematical:K,vectorEffect:null,vHanging:K,vIdeographic:K,version:null,vertAdvY:K,vertOriginX:K,vertOriginY:K,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:K,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:`svg`,transform:Fa}),za=Na({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:`xlink`,transform(e,t){return`xlink:`+t.slice(5).toLowerCase()}}),Ba=Na({attributes:{xmlnsxlink:`xmlns:xlink`},properties:{xmlnsXLink:null,xmlns:null},space:`xmlns`,transform:Ia}),Va=Na({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:`xml`,transform(e,t){return`xml:`+t.slice(3).toLowerCase()}}),Ha={classId:`classID`,dataType:`datatype`,itemId:`itemID`,strokeDashArray:`strokeDasharray`,strokeDashOffset:`strokeDashoffset`,strokeLineCap:`strokeLinecap`,strokeLineJoin:`strokeLinejoin`,strokeMiterLimit:`strokeMiterlimit`,typeOf:`typeof`,xLinkActuate:`xlinkActuate`,xLinkArcRole:`xlinkArcrole`,xLinkHref:`xlinkHref`,xLinkRole:`xlinkRole`,xLinkShow:`xlinkShow`,xLinkTitle:`xlinkTitle`,xLinkType:`xlinkType`,xmlnsXLink:`xmlnsXlink`},Ua=/[A-Z]/g,Wa=/-[a-z]/g,Ga=/^data[-\w.:]+$/i;function Ka(e,t){let n=Sa(t),r=t,i=Ca;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)===`data`&&Ga.test(t)){if(t.charAt(4)===`-`){let e=t.slice(5).replace(Wa,Ja);r=`data`+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!Wa.test(e)){let n=e.replace(Ua,qa);n.charAt(0)!==`-`&&(n=`-`+n),t=`data`+n}}i=ja}return new i(r,t)}function qa(e){return`-`+e.toLowerCase()}function Ja(e){return e.charAt(1).toUpperCase()}const Ya=xa([Pa,La,za,Ba,Va],`html`),Xa=xa([Pa,Ra,za,Ba,Va],`svg`);function Za(e){return e.join(` `).trim()}function Qa(e,t){if(typeof e!=`string`)throw TypeError(`First argument must be a string`);if(!e)return[];t||={};var n=1,r=1;function i(e){var t=e.match(to);t&&(n+=t.length);var i=e.lastIndexOf(co);r=~i?e.length-i:r+e.length}function a(){var e={line:n,column:r};return function(t){return t.position=new o(e),l(),t}}function o(e){this.start=e,this.end={line:n,column:r},this.source=t.source}o.prototype.content=e;function s(i){var a=Error(t.source+`:`+n+`:`+r+`: `+i);if(a.reason=i,a.filename=t.source,a.line=n,a.column=r,a.source=e,!t.silent)throw a}function c(t){var n=t.exec(e);if(n){var r=n[0];return i(r),e=e.slice(r.length),n}}function l(){c(no)}function u(e){var t;for(e||=[];t=d();)t!==!1&&e.push(t);return e}function d(){var t=a();if(lo==e.charAt(0)&&uo==e.charAt(1)){for(var n=2;fo!=e.charAt(n)&&(uo!=e.charAt(n)||lo!=e.charAt(n+1));)++n;if(n+=2,fo===e.charAt(n-1))return s(`End of comment missing`);var o=e.slice(2,n-2);return r+=2,i(o),e=e.slice(n),r+=2,t({type:po,comment:o})}}function f(){var e=a(),t=c(ro);if(t){if(d(),!c(io))return s(`property missing ':'`);var n=c(ao),r=e({type:mo,property:$a(t[0].replace(eo,fo)),value:n?$a(n[0].replace(eo,fo)):fo});return c(oo),r}}function p(){var e=[];u(e);for(var t;t=f();)t!==!1&&(e.push(t),u(e));return e}return l(),p()}function $a(e){return e?e.replace(so,fo):fo}var eo,to,no,ro,io,ao,oo,so,co,lo,uo,fo,po,mo,ho=Ae((()=>{eo=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,to=/\n/g,no=/^\s*/,ro=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,io=/^:\s*/,ao=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,oo=/^[;\s]*/,so=/^\s+|\s+$/g,co=`
277
+ `,lo=`/`,uo=`*`,fo=``,po=`comment`,mo=`declaration`})),go=Me({default:()=>_o});function _o(e,t){let n=null;if(!e||typeof e!=`string`)return n;let r=Qa(e),i=typeof t==`function`;return r.forEach(e=>{if(e.type!==`declaration`)return;let{property:r,value:a}=e;i?t(r,a,e):a&&(n||={},n[r]=a)}),n}var vo=Ae((()=>{ho()})),yo=je((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.camelCase=void 0;var t=/^--[a-zA-Z0-9_-]+$/,n=/-([a-z])/g,r=/^[^-]+$/,i=/^-(webkit|moz|ms|o|khtml)-/,a=/^-(ms)-/,o=function(e){return!e||r.test(e)||t.test(e)},s=function(e,t){return t.toUpperCase()},c=function(e,t){return`${t}-`};e.camelCase=function(e,t){return t===void 0&&(t={}),o(e)?e:(e=e.toLowerCase(),e=t.reactCompat?e.replace(a,c):e.replace(i,c),e.replace(n,s))}})),bo=je(((e,t)=>{var n=(e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}})((vo(),Fe(go))),r=yo();function i(e,t){var i={};return!e||typeof e!=`string`||(0,n.default)(e,function(e,n){e&&n&&(i[(0,r.camelCase)(e,t)]=n)}),i}i.default=i,t.exports=i}));const xo=Co(`end`),So=Co(`start`);function Co(e){return t;function t(t){let n=t&&t.position&&t.position[e]||{};if(typeof n.line==`number`&&n.line>0&&typeof n.column==`number`&&n.column>0)return{line:n.line,column:n.column,offset:typeof n.offset==`number`&&n.offset>-1?n.offset:void 0}}}function wo(e){let t=So(e),n=xo(e);if(t&&n)return{start:t,end:n}}function To(e){return!e||typeof e!=`object`?``:`position`in e||`type`in e?Do(e.position):`start`in e||`end`in e?Do(e):`line`in e||`column`in e?Eo(e):``}function Eo(e){return Oo(e&&e.line)+`:`+Oo(e&&e.column)}function Do(e){return Eo(e&&e.start)+`-`+Eo(e&&e.end)}function Oo(e){return e&&typeof e==`number`?e:1}var ko=class extends Error{constructor(e,t,n){super(),typeof t==`string`&&(n=t,t=void 0);let r=``,i={},a=!1;if(t&&(i=`line`in t&&`column`in t||`start`in t&&`end`in t?{place:t}:`type`in t?{ancestors:[t],place:t.position}:{...t}),typeof e==`string`?r=e:!i.cause&&e&&(a=!0,r=e.message,i.cause=e),!i.ruleId&&!i.source&&typeof n==`string`){let e=n.indexOf(`:`);e===-1?i.ruleId=n:(i.source=n.slice(0,e),i.ruleId=n.slice(e+1))}if(!i.place&&i.ancestors&&i.ancestors){let e=i.ancestors[i.ancestors.length-1];e&&(i.place=e.position)}let o=i.place&&`start`in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file=``,this.message=r,this.line=o?o.line:void 0,this.name=To(i.place)||`1:1`,this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=a&&i.cause&&typeof i.cause.stack==`string`?i.cause.stack:``,this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}};ko.prototype.file=``,ko.prototype.name=``,ko.prototype.reason=``,ko.prototype.message=``,ko.prototype.stack=``,ko.prototype.column=void 0,ko.prototype.line=void 0,ko.prototype.ancestors=void 0,ko.prototype.cause=void 0,ko.prototype.fatal=void 0,ko.prototype.place=void 0,ko.prototype.ruleId=void 0,ko.prototype.source=void 0;var Ao=Pe(bo(),1);const jo={}.hasOwnProperty,Mo=new Map,No=/[A-Z]/g,Po=new Set([`table`,`tbody`,`thead`,`tfoot`,`tr`]),Fo=new Set([`td`,`th`]);function Io(e,t){if(!t||t.Fragment===void 0)throw TypeError("Expected `Fragment` in options");let n=t.filePath||void 0,r;if(t.development){if(typeof t.jsxDEV!=`function`)throw TypeError("Expected `jsxDEV` in options when `development: true`");r=qo(n,t.jsxDEV)}else{if(typeof t.jsx!=`function`)throw TypeError("Expected `jsx` in production options");if(typeof t.jsxs!=`function`)throw TypeError("Expected `jsxs` in production options");r=Ko(n,t.jsx,t.jsxs)}let i={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||`react`,evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space===`svg`?Xa:Ya,stylePropertyNameCase:t.stylePropertyNameCase||`dom`,tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},a=Lo(i,e,void 0);return a&&typeof a!=`string`?a:i.create(e,i.Fragment,{children:a||void 0},void 0)}function Lo(e,t,n){if(t.type===`element`)return Ro(e,t,n);if(t.type===`mdxFlowExpression`||t.type===`mdxTextExpression`)return zo(e,t);if(t.type===`mdxJsxFlowElement`||t.type===`mdxJsxTextElement`)return Vo(e,t,n);if(t.type===`mdxjsEsm`)return Bo(e,t);if(t.type===`root`)return Ho(e,t,n);if(t.type===`text`)return Uo(e,t)}function Ro(e,t,n){let r=e.schema,i=r;t.tagName.toLowerCase()===`svg`&&r.space===`html`&&(i=Xa,e.schema=i),e.ancestors.push(t);let a=$o(e,t.tagName,!1),o=Jo(e,t),s=Xo(e,t);return Po.has(t.tagName)&&(s=s.filter(function(e){return typeof e!=`string`||!va(e)})),Wo(e,o,a,t),Go(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function zo(e,t){if(t.data&&t.data.estree&&e.evaluater){let n=t.data.estree.body[0];return n.type,e.evaluater.evaluateExpression(n.expression)}es(e,t.position)}function Bo(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);es(e,t.position)}function Vo(e,t,n){let r=e.schema,i=r;t.name===`svg`&&r.space===`html`&&(i=Xa,e.schema=i),e.ancestors.push(t);let a=t.name===null?e.Fragment:$o(e,t.name,!0),o=Yo(e,t),s=Xo(e,t);return Wo(e,o,a,t),Go(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function Ho(e,t,n){let r={};return Go(r,Xo(e,t)),e.create(t,e.Fragment,r,n)}function Uo(e,t){return t.value}function Wo(e,t,n,r){typeof n!=`string`&&n!==e.Fragment&&e.passNode&&(t.node=r)}function Go(e,t){if(t.length>0){let n=t.length>1?t:t[0];n&&(e.children=n)}}function Ko(e,t,n){return r;function r(e,r,i,a){let o=Array.isArray(i.children)?n:t;return a?o(r,i,a):o(r,i)}}function qo(e,t){return n;function n(n,r,i,a){let o=Array.isArray(i.children),s=So(n);return t(r,i,a,o,{columnNumber:s?s.column-1:void 0,fileName:e,lineNumber:s?s.line:void 0},void 0)}}function Jo(e,t){let n={},r,i;for(i in t.properties)if(i!==`children`&&jo.call(t.properties,i)){let a=Zo(e,i,t.properties[i]);if(a){let[i,o]=a;e.tableCellAlignToStyle&&i===`align`&&typeof o==`string`&&Fo.has(t.tagName)?r=o:n[i]=o}}if(r){let t=n.style||={};t[e.stylePropertyNameCase===`css`?`text-align`:`textAlign`]=r}return n}function Yo(e,t){let n={};for(let r of t.attributes)if(r.type===`mdxJsxExpressionAttribute`){if(r.data&&r.data.estree&&e.evaluater){let t=r.data.estree.body[0];t.type;let i=t.expression;i.type;let a=i.properties[0];a.type,Object.assign(n,e.evaluater.evaluateExpression(a.argument))}else es(e,t.position)}else{let i=r.name,a;if(r.value&&typeof r.value==`object`){if(r.value.data&&r.value.data.estree&&e.evaluater){let t=r.value.data.estree.body[0];t.type,a=e.evaluater.evaluateExpression(t.expression)}else es(e,t.position)}else a=r.value===null||r.value;n[i]=a}return n}function Xo(e,t){let n=[],r=-1,i=e.passKeys?new Map:Mo;for(;++r<t.children.length;){let a=t.children[r],o;if(e.passKeys){let e=a.type===`element`?a.tagName:a.type===`mdxJsxFlowElement`||a.type===`mdxJsxTextElement`?a.name:void 0;if(e){let t=i.get(e)||0;o=e+`-`+t,i.set(e,t+1)}}let s=Lo(e,a,o);s!==void 0&&n.push(s)}return n}function Zo(e,t,n){let r=Ka(e.schema,t);if(!(n==null||typeof n==`number`&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?fa(n):Za(n)),r.property===`style`){let t=typeof n==`object`?n:Qo(e,String(n));return e.stylePropertyNameCase===`css`&&(t=ts(t)),[`style`,t]}return[e.elementAttributeNameCase===`react`&&r.space?Ha[r.property]||r.property:r.attribute,n]}}function Qo(e,t){try{return(0,Ao.default)(t,{reactCompat:!0})}catch(t){if(e.ignoreInvalidStyle)return{};let n=t,r=new ko("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:n,ruleId:`style`,source:`hast-util-to-jsx-runtime`});throw r.file=e.filePath||void 0,r.url=`https://github.com/syntax-tree/hast-util-to-jsx-runtime#cannot-parse-style-attribute`,r}}function $o(e,t,n){let r;if(!n)r={type:`Literal`,value:t};else if(t.includes(`.`)){let e=t.split(`.`),n=-1,i;for(;++n<e.length;){let t=ga(e[n])?{type:`Identifier`,name:e[n]}:{type:`Literal`,value:e[n]};i=i?{type:`MemberExpression`,object:i,property:t,computed:!!(n&&t.type===`Literal`),optional:!1}:t}r=i}else r=ga(t)&&!/^[a-z]/.test(t)?{type:`Identifier`,name:t}:{type:`Literal`,value:t};if(r.type===`Literal`){let t=r.value;return jo.call(e.components,t)?e.components[t]:t}if(e.evaluater)return e.evaluater.evaluateExpression(r);es(e)}function es(e,t){let n=new ko("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:`mdx-estree`,source:`hast-util-to-jsx-runtime`});throw n.file=e.filePath||void 0,n.url=`https://github.com/syntax-tree/hast-util-to-jsx-runtime#cannot-handle-mdx-estrees-without-createevaluater`,n}function ts(e){let t={},n;for(n in e)jo.call(e,n)&&(t[ns(n)]=e[n]);return t}function ns(e){let t=e.replace(No,rs);return t.slice(0,3)===`ms-`&&(t=`-`+t),t}function rs(e){return`-`+e.toLowerCase()}const is={action:[`form`],cite:[`blockquote`,`del`,`ins`,`q`],data:[`object`],formAction:[`button`,`input`],href:[`a`,`area`,`base`,`link`],icon:[`menuitem`],itemId:null,manifest:[`html`],ping:[`a`,`area`],poster:[`video`],src:[`audio`,`embed`,`iframe`,`img`,`input`,`script`,`source`,`track`,`video`]},as={};function os(e,t){let n=t||as;return ss(e,typeof n.includeImageAlt!=`boolean`||n.includeImageAlt,typeof n.includeHtml!=`boolean`||n.includeHtml)}function ss(e,t,n){if(ls(e)){if(`value`in e)return e.type===`html`&&!n?``:e.value;if(t&&`alt`in e&&e.alt)return e.alt;if(`children`in e)return cs(e.children,t,n)}return Array.isArray(e)?cs(e,t,n):``}function cs(e,t,n){let r=[],i=-1;for(;++i<e.length;)r[i]=ss(e[i],t,n);return r.join(``)}function ls(e){return!!(e&&typeof e==`object`)}const us=document.createElement(`i`);function ds(e){let t=`&`+e+`;`;us.innerHTML=t;let n=us.textContent;return n.charCodeAt(n.length-1)===59&&e!==`semi`?!1:n!==t&&n}function J(e,t,n,r){let i=e.length,a=0,o;if(t=t<0?-t>i?0:i+t:t>i?i:t,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(t,n),e.splice(...o);else for(n&&e.splice(t,n);a<r.length;)o=r.slice(a,a+1e4),o.unshift(t,0),e.splice(...o),a+=1e4,t+=1e4}function fs(e,t){return e.length>0?(J(e,e.length,0,t),e):t}const ps={}.hasOwnProperty;function ms(e){let t={},n=-1;for(;++n<e.length;)hs(t,e[n]);return t}function hs(e,t){let n;for(n in t){let r=(ps.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n],a;if(i)for(a in i){ps.call(r,a)||(r[a]=[]);let e=i[a];gs(r[a],Array.isArray(e)?e:e?[e]:[])}}}function gs(e,t){let n=-1,r=[];for(;++n<t.length;)(t[n].add===`after`?e:r).push(t[n]);J(e,0,0,r)}function _s(e,t){let n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)==65535||(n&65535)==65534||n>1114111?`�`:String.fromCodePoint(n)}function vs(e){return e.replace(/[\t\n\r ]+/g,` `).replace(/^ | $/g,``).toLowerCase().toUpperCase()}const ys=Os(/[A-Za-z]/),bs=Os(/[\dA-Za-z]/),xs=Os(/[#-'*+\--9=?A-Z^-~]/);function Ss(e){return e!==null&&(e<32||e===127)}const Cs=Os(/\d/),ws=Os(/[\dA-Fa-f]/),Ts=Os(/[!-/:-@[-`{-~]/);function Y(e){return e!==null&&e<-2}function X(e){return e!==null&&(e<0||e===32)}function Z(e){return e===-2||e===-1||e===32}const Es=Os(/\p{P}|\p{S}/u),Ds=Os(/\s/);function Os(e){return t;function t(t){return t!==null&&t>-1&&e.test(String.fromCharCode(t))}}function ks(e){let t=[],n=-1,r=0,i=0;for(;++n<e.length;){let a=e.charCodeAt(n),o=``;if(a===37&&bs(e.charCodeAt(n+1))&&bs(e.charCodeAt(n+2)))i=2;else if(a<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(a))||(o=String.fromCharCode(a));else if(a>55295&&a<57344){let t=e.charCodeAt(n+1);a<56320&&t>56319&&t<57344?(o=String.fromCharCode(a,t),i=1):o=`�`}else o=String.fromCharCode(a);o&&=(t.push(e.slice(r,n),encodeURIComponent(o)),r=n+i+1,``),i&&=(n+=i,0)}return t.join(``)+e.slice(r)}function Q(e,t,n,r){let i=r?r-1:1/0,a=0;return o;function o(r){return Z(r)?(e.enter(n),s(r)):t(r)}function s(r){return Z(r)&&a++<i?(e.consume(r),s):(e.exit(n),t(r))}}const As={tokenize:js};function js(e){let t=e.attempt(this.parser.constructs.contentInitial,r,i),n;return t;function r(n){if(n===null){e.consume(n);return}return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),Q(e,t,`linePrefix`)}function i(t){return e.enter(`paragraph`),a(t)}function a(t){let r=e.enter(`chunkText`,{contentType:`text`,previous:n});return n&&(n.next=r),n=r,o(t)}function o(t){if(t===null){e.exit(`chunkText`),e.exit(`paragraph`),e.consume(t);return}return Y(t)?(e.consume(t),e.exit(`chunkText`),a):(e.consume(t),o)}}const Ms={tokenize:Ps},Ns={tokenize:Fs};function Ps(e){let t=this,n=[],r=0,i,a,o;return s;function s(i){if(r<n.length){let a=n[r];return t.containerState=a[1],e.attempt(a[0].continuation,c,l)(i)}return l(i)}function c(e){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&v();let n=t.events.length,a=n,o;for(;a--;)if(t.events[a][0]===`exit`&&t.events[a][1].type===`chunkFlow`){o=t.events[a][1].end;break}_(r);let s=n;for(;s<t.events.length;)t.events[s][1].end={...o},s++;return J(t.events,a+1,0,t.events.slice(n)),t.events.length=s,l(e)}return s(e)}function l(a){if(r===n.length){if(!i)return f(a);if(i.currentConstruct&&i.currentConstruct.concrete)return m(a);t.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(Ns,u,d)(a)}function u(e){return i&&v(),_(r),f(e)}function d(e){return t.parser.lazy[t.now().line]=r!==n.length,o=t.now().offset,m(e)}function f(n){return t.containerState={},e.attempt(Ns,p,m)(n)}function p(e){return r++,n.push([t.currentConstruct,t.containerState]),f(e)}function m(n){if(n===null){i&&v(),_(0),e.consume(n);return}return i||=t.parser.flow(t.now()),e.enter(`chunkFlow`,{_tokenizer:i,contentType:`flow`,previous:a}),h(n)}function h(n){if(n===null){g(e.exit(`chunkFlow`),!0),_(0),e.consume(n);return}return Y(n)?(e.consume(n),g(e.exit(`chunkFlow`)),r=0,t.interrupt=void 0,s):(e.consume(n),h)}function g(e,n){let s=t.sliceStream(e);if(n&&s.push(null),e.previous=a,a&&(a.next=e),a=e,i.defineSkip(e.start),i.write(s),t.parser.lazy[e.start.line]){let e=i.events.length;for(;e--;)if(i.events[e][1].start.offset<o&&(!i.events[e][1].end||i.events[e][1].end.offset>o))return;let n=t.events.length,a=n,s,c;for(;a--;)if(t.events[a][0]===`exit`&&t.events[a][1].type===`chunkFlow`){if(s){c=t.events[a][1].end;break}s=!0}for(_(r),e=n;e<t.events.length;)t.events[e][1].end={...c},e++;J(t.events,a+1,0,t.events.slice(n)),t.events.length=e}}function _(r){let i=n.length;for(;i-->r;){let r=n[i];t.containerState=r[1],r[0].exit.call(t,e)}n.length=r}function v(){i.write([null]),a=void 0,i=void 0,t.containerState._closeFlow=void 0}}function Fs(e,t,n){return Q(e,e.attempt(this.parser.constructs.document,t,n),`linePrefix`,this.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)}function Is(e){if(e===null||X(e)||Ds(e))return 1;if(Es(e))return 2}function Ls(e,t,n){let r=[],i=-1;for(;++i<e.length;){let a=e[i].resolveAll;a&&!r.includes(a)&&(t=a(t,n),r.push(a))}return t}const Rs={name:`attention`,resolveAll:zs,tokenize:Bs};function zs(e,t){let n=-1,r,i,a,o,s,c,l,u;for(;++n<e.length;)if(e[n][0]===`enter`&&e[n][1].type===`attentionSequence`&&e[n][1]._close){for(r=n;r--;)if(e[r][0]===`exit`&&e[r][1].type===`attentionSequence`&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;c=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;let d={...e[r][1].end},f={...e[n][1].start};Vs(d,-c),Vs(f,c),o={type:c>1?`strongSequence`:`emphasisSequence`,start:d,end:{...e[r][1].end}},s={type:c>1?`strongSequence`:`emphasisSequence`,start:{...e[n][1].start},end:f},a={type:c>1?`strongText`:`emphasisText`,start:{...e[r][1].end},end:{...e[n][1].start}},i={type:c>1?`strong`:`emphasis`,start:{...o.start},end:{...s.end}},e[r][1].end={...o.start},e[n][1].start={...s.end},l=[],e[r][1].end.offset-e[r][1].start.offset&&(l=fs(l,[[`enter`,e[r][1],t],[`exit`,e[r][1],t]])),l=fs(l,[[`enter`,i,t],[`enter`,o,t],[`exit`,o,t],[`enter`,a,t]]),l=fs(l,Ls(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),l=fs(l,[[`exit`,a,t],[`enter`,s,t],[`exit`,s,t],[`exit`,i,t]]),e[n][1].end.offset-e[n][1].start.offset?(u=2,l=fs(l,[[`enter`,e[n][1],t],[`exit`,e[n][1],t]])):u=0,J(e,r-1,n-r+3,l),n=r+l.length-u-2;break}}for(n=-1;++n<e.length;)e[n][1].type===`attentionSequence`&&(e[n][1].type=`data`);return e}function Bs(e,t){let n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=Is(r),a;return o;function o(t){return a=t,e.enter(`attentionSequence`),s(t)}function s(o){if(o===a)return e.consume(o),s;let c=e.exit(`attentionSequence`),l=Is(o),u=!l||l===2&&i||n.includes(o),d=!i||i===2&&l||n.includes(r);return c._open=!!(a===42?u:u&&(i||!d)),c._close=!!(a===42?d:d&&(l||!u)),t(o)}}function Vs(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const Hs={name:`autolink`,tokenize:Us};function Us(e,t,n){let r=0;return i;function i(t){return e.enter(`autolink`),e.enter(`autolinkMarker`),e.consume(t),e.exit(`autolinkMarker`),e.enter(`autolinkProtocol`),a}function a(t){return ys(t)?(e.consume(t),o):t===64?n(t):l(t)}function o(e){return e===43||e===45||e===46||bs(e)?(r=1,s(e)):l(e)}function s(t){return t===58?(e.consume(t),r=0,c):(t===43||t===45||t===46||bs(t))&&r++<32?(e.consume(t),s):(r=0,l(t))}function c(r){return r===62?(e.exit(`autolinkProtocol`),e.enter(`autolinkMarker`),e.consume(r),e.exit(`autolinkMarker`),e.exit(`autolink`),t):r===null||r===32||r===60||Ss(r)?n(r):(e.consume(r),c)}function l(t){return t===64?(e.consume(t),u):xs(t)?(e.consume(t),l):n(t)}function u(e){return bs(e)?d(e):n(e)}function d(n){return n===46?(e.consume(n),r=0,u):n===62?(e.exit(`autolinkProtocol`).type=`autolinkEmail`,e.enter(`autolinkMarker`),e.consume(n),e.exit(`autolinkMarker`),e.exit(`autolink`),t):f(n)}function f(t){if((t===45||bs(t))&&r++<63){let n=t===45?f:d;return e.consume(t),n}return n(t)}}const Ws={partial:!0,tokenize:Gs};function Gs(e,t,n){return r;function r(t){return Z(t)?Q(e,i,`linePrefix`)(t):i(t)}function i(e){return e===null||Y(e)?t(e):n(e)}}const Ks={continuation:{tokenize:Js},exit:Ys,name:`blockQuote`,tokenize:qs};function qs(e,t,n){let r=this;return i;function i(t){if(t===62){let n=r.containerState;return n.open||=(e.enter(`blockQuote`,{_container:!0}),!0),e.enter(`blockQuotePrefix`),e.enter(`blockQuoteMarker`),e.consume(t),e.exit(`blockQuoteMarker`),a}return n(t)}function a(n){return Z(n)?(e.enter(`blockQuotePrefixWhitespace`),e.consume(n),e.exit(`blockQuotePrefixWhitespace`),e.exit(`blockQuotePrefix`),t):(e.exit(`blockQuotePrefix`),t(n))}}function Js(e,t,n){let r=this;return i;function i(t){return Z(t)?Q(e,a,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):a(t)}function a(r){return e.attempt(Ks,t,n)(r)}}function Ys(e){e.exit(`blockQuote`)}const Xs={name:`characterEscape`,tokenize:Zs};function Zs(e,t,n){return r;function r(t){return e.enter(`characterEscape`),e.enter(`escapeMarker`),e.consume(t),e.exit(`escapeMarker`),i}function i(r){return Ts(r)?(e.enter(`characterEscapeValue`),e.consume(r),e.exit(`characterEscapeValue`),e.exit(`characterEscape`),t):n(r)}}const Qs={name:`characterReference`,tokenize:$s};function $s(e,t,n){let r=this,i=0,a,o;return s;function s(t){return e.enter(`characterReference`),e.enter(`characterReferenceMarker`),e.consume(t),e.exit(`characterReferenceMarker`),c}function c(t){return t===35?(e.enter(`characterReferenceMarkerNumeric`),e.consume(t),e.exit(`characterReferenceMarkerNumeric`),l):(e.enter(`characterReferenceValue`),a=31,o=bs,u(t))}function l(t){return t===88||t===120?(e.enter(`characterReferenceMarkerHexadecimal`),e.consume(t),e.exit(`characterReferenceMarkerHexadecimal`),e.enter(`characterReferenceValue`),a=6,o=ws,u):(e.enter(`characterReferenceValue`),a=7,o=Cs,u(t))}function u(s){if(s===59&&i){let i=e.exit(`characterReferenceValue`);return o===bs&&!ds(r.sliceSerialize(i))?n(s):(e.enter(`characterReferenceMarker`),e.consume(s),e.exit(`characterReferenceMarker`),e.exit(`characterReference`),t)}return o(s)&&i++<a?(e.consume(s),u):n(s)}}const ec={partial:!0,tokenize:rc},tc={concrete:!0,name:`codeFenced`,tokenize:nc};function nc(e,t,n){let r=this,i={partial:!0,tokenize:x},a=0,o=0,s;return c;function c(e){return l(e)}function l(t){let n=r.events[r.events.length-1];return a=n&&n[1].type===`linePrefix`?n[2].sliceSerialize(n[1],!0).length:0,s=t,e.enter(`codeFenced`),e.enter(`codeFencedFence`),e.enter(`codeFencedFenceSequence`),u(t)}function u(t){return t===s?(o++,e.consume(t),u):o<3?n(t):(e.exit(`codeFencedFenceSequence`),Z(t)?Q(e,d,`whitespace`)(t):d(t))}function d(n){return n===null||Y(n)?(e.exit(`codeFencedFence`),r.interrupt?t(n):e.check(ec,h,b)(n)):(e.enter(`codeFencedFenceInfo`),e.enter(`chunkString`,{contentType:`string`}),f(n))}function f(t){return t===null||Y(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),d(t)):Z(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),Q(e,p,`whitespace`)(t)):t===96&&t===s?n(t):(e.consume(t),f)}function p(t){return t===null||Y(t)?d(t):(e.enter(`codeFencedFenceMeta`),e.enter(`chunkString`,{contentType:`string`}),m(t))}function m(t){return t===null||Y(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceMeta`),d(t)):t===96&&t===s?n(t):(e.consume(t),m)}function h(t){return e.attempt(i,b,g)(t)}function g(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),_}function _(t){return a>0&&Z(t)?Q(e,v,`linePrefix`,a+1)(t):v(t)}function v(t){return t===null||Y(t)?e.check(ec,h,b)(t):(e.enter(`codeFlowValue`),y(t))}function y(t){return t===null||Y(t)?(e.exit(`codeFlowValue`),v(t)):(e.consume(t),y)}function b(n){return e.exit(`codeFenced`),t(n)}function x(e,t,n){let i=0;return a;function a(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),c}function c(t){return e.enter(`codeFencedFence`),Z(t)?Q(e,l,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):l(t)}function l(t){return t===s?(e.enter(`codeFencedFenceSequence`),u(t)):n(t)}function u(t){return t===s?(i++,e.consume(t),u):i>=o?(e.exit(`codeFencedFenceSequence`),Z(t)?Q(e,d,`whitespace`)(t):d(t)):n(t)}function d(r){return r===null||Y(r)?(e.exit(`codeFencedFence`),t(r)):n(r)}}}function rc(e,t,n){let r=this;return i;function i(t){return t===null?n(t):(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),a)}function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}const ic={name:`codeIndented`,tokenize:oc},ac={partial:!0,tokenize:sc};function oc(e,t,n){let r=this;return i;function i(t){return e.enter(`codeIndented`),Q(e,a,`linePrefix`,5)(t)}function a(e){let t=r.events[r.events.length-1];return t&&t[1].type===`linePrefix`&&t[2].sliceSerialize(t[1],!0).length>=4?o(e):n(e)}function o(t){return t===null?c(t):Y(t)?e.attempt(ac,o,c)(t):(e.enter(`codeFlowValue`),s(t))}function s(t){return t===null||Y(t)?(e.exit(`codeFlowValue`),o(t)):(e.consume(t),s)}function c(n){return e.exit(`codeIndented`),t(n)}}function sc(e,t,n){let r=this;return i;function i(t){return r.parser.lazy[r.now().line]?n(t):Y(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),i):Q(e,a,`linePrefix`,5)(t)}function a(e){let a=r.events[r.events.length-1];return a&&a[1].type===`linePrefix`&&a[2].sliceSerialize(a[1],!0).length>=4?t(e):Y(e)?i(e):n(e)}}const cc={name:`codeText`,previous:uc,resolve:lc,tokenize:dc};function lc(e){let t=e.length-4,n=3,r,i;if((e[n][1].type===`lineEnding`||e[n][1].type===`space`)&&(e[t][1].type===`lineEnding`||e[t][1].type===`space`)){for(r=n;++r<t;)if(e[r][1].type===`codeTextData`){e[n][1].type=`codeTextPadding`,e[t][1].type=`codeTextPadding`,n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)i===void 0?r!==t&&e[r][1].type!==`lineEnding`&&(i=r):(r===t||e[r][1].type===`lineEnding`)&&(e[i][1].type=`codeTextData`,r!==i+2&&(e[i][1].end=e[r-1][1].end,e.splice(i+2,r-i-2),t-=r-i-2,r=i+2),i=void 0);return e}function uc(e){return e!==96||this.events[this.events.length-1][1].type===`characterEscape`}function dc(e,t,n){let r=0,i,a;return o;function o(t){return e.enter(`codeText`),e.enter(`codeTextSequence`),s(t)}function s(t){return t===96?(e.consume(t),r++,s):(e.exit(`codeTextSequence`),c(t))}function c(t){return t===null?n(t):t===32?(e.enter(`space`),e.consume(t),e.exit(`space`),c):t===96?(a=e.enter(`codeTextSequence`),i=0,u(t)):Y(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),c):(e.enter(`codeTextData`),l(t))}function l(t){return t===null||t===32||t===96||Y(t)?(e.exit(`codeTextData`),c(t)):(e.consume(t),l)}function u(n){return n===96?(e.consume(n),i++,u):i===r?(e.exit(`codeTextSequence`),e.exit(`codeText`),t(n)):(a.type=`codeTextData`,l(n))}}var fc=class{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return e<this.left.length?this.left[e]:this.right[this.right.length-e+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(e,t){let n=t??1/0;return n<this.left.length?this.left.slice(e,n):e>this.left.length?this.right.slice(this.right.length-n+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-n+this.left.length).reverse())}splice(e,t,n){let r=t||0;this.setCursor(Math.trunc(e));let i=this.right.splice(this.right.length-r,1/0);return n&&pc(this.left,n),i.reverse()}pop(){return this.setCursor(1/0),this.left.pop()}push(e){this.setCursor(1/0),this.left.push(e)}pushMany(e){this.setCursor(1/0),pc(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),pc(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0)){if(e<this.left.length){let t=this.left.splice(e,1/0);pc(this.right,t.reverse())}else{let t=this.right.splice(this.left.length+this.right.length-e,1/0);pc(this.left,t.reverse())}}}};function pc(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function mc(e){let t={},n=-1,r,i,a,o,s,c,l,u=new fc(e);for(;++n<u.length;){for(;n in t;)n=t[n];if(r=u.get(n),n&&r[1].type===`chunkFlow`&&u.get(n-1)[1].type===`listItemPrefix`&&(c=r[1]._tokenizer.events,a=0,a<c.length&&c[a][1].type===`lineEndingBlank`&&(a+=2),a<c.length&&c[a][1].type===`content`))for(;++a<c.length&&c[a][1].type!==`content`;)c[a][1].type===`chunkText`&&(c[a][1]._isInFirstContentOfListItem=!0,a++);if(r[0]===`enter`)r[1].contentType&&(Object.assign(t,hc(u,n)),n=t[n],l=!0);else if(r[1]._container){for(a=n,i=void 0;a--;)if(o=u.get(a),o[1].type===`lineEnding`||o[1].type===`lineEndingBlank`)o[0]===`enter`&&(i&&(u.get(i)[1].type=`lineEndingBlank`),o[1].type=`lineEnding`,i=a);else if(o[1].type!==`linePrefix`&&o[1].type!==`listItemIndent`)break;i&&(r[1].end={...u.get(i)[1].start},s=u.slice(i,n),s.unshift(r),u.splice(i,n-i+1,s))}}return J(e,0,1/0,u.slice(0)),!l}function hc(e,t){let n=e.get(t)[1],r=e.get(t)[2],i=t-1,a=[],o=n._tokenizer;o||(o=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));let s=o.events,c=[],l={},u,d,f=-1,p=n,m=0,h=0,g=[h];for(;p;){for(;e.get(++i)[1]!==p;);a.push(i),p._tokenizer||(u=r.sliceStream(p),p.next||u.push(null),d&&o.defineSkip(p.start),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(u),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),d=p,p=p.next}for(p=n;++f<s.length;)s[f][0]===`exit`&&s[f-1][0]===`enter`&&s[f][1].type===s[f-1][1].type&&s[f][1].start.line!==s[f][1].end.line&&(h=f+1,g.push(h),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(o.events=[],p?(p._tokenizer=void 0,p.previous=void 0):g.pop(),f=g.length;f--;){let t=s.slice(g[f],g[f+1]),n=a.pop();c.push([n,n+t.length-1]),e.splice(n,2,t)}for(c.reverse(),f=-1;++f<c.length;)l[m+c[f][0]]=m+c[f][1],m+=c[f][1]-c[f][0]-1;return l}const gc={resolve:vc,tokenize:yc},_c={partial:!0,tokenize:bc};function vc(e){return mc(e),e}function yc(e,t){let n;return r;function r(t){return e.enter(`content`),n=e.enter(`chunkContent`,{contentType:`content`}),i(t)}function i(t){return t===null?a(t):Y(t)?e.check(_c,o,a)(t):(e.consume(t),i)}function a(n){return e.exit(`chunkContent`),e.exit(`content`),t(n)}function o(t){return e.consume(t),e.exit(`chunkContent`),n.next=e.enter(`chunkContent`,{contentType:`content`,previous:n}),n=n.next,i}}function bc(e,t,n){let r=this;return i;function i(t){return e.exit(`chunkContent`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),Q(e,a,`linePrefix`)}function a(i){if(i===null||Y(i))return n(i);let a=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes(`codeIndented`)&&a&&a[1].type===`linePrefix`&&a[2].sliceSerialize(a[1],!0).length>=4?t(i):e.interrupt(r.parser.constructs.flow,n,t)(i)}}function xc(e,t,n,r,i,a,o,s,c){let l=c||1/0,u=0;return d;function d(t){return t===60?(e.enter(r),e.enter(i),e.enter(a),e.consume(t),e.exit(a),f):t===null||t===32||t===41||Ss(t)?n(t):(e.enter(r),e.enter(o),e.enter(s),e.enter(`chunkString`,{contentType:`string`}),h(t))}function f(n){return n===62?(e.enter(a),e.consume(n),e.exit(a),e.exit(i),e.exit(r),t):(e.enter(s),e.enter(`chunkString`,{contentType:`string`}),p(n))}function p(t){return t===62?(e.exit(`chunkString`),e.exit(s),f(t)):t===null||t===60||Y(t)?n(t):(e.consume(t),t===92?m:p)}function m(t){return t===60||t===62||t===92?(e.consume(t),p):p(t)}function h(i){return!u&&(i===null||i===41||X(i))?(e.exit(`chunkString`),e.exit(s),e.exit(o),e.exit(r),t(i)):u<l&&i===40?(e.consume(i),u++,h):i===41?(e.consume(i),u--,h):i===null||i===32||i===40||Ss(i)?n(i):(e.consume(i),i===92?g:h)}function g(t){return t===40||t===41||t===92?(e.consume(t),h):h(t)}}function Sc(e,t,n,r,i,a){let o=this,s=0,c;return l;function l(t){return e.enter(r),e.enter(i),e.consume(t),e.exit(i),e.enter(a),u}function u(l){return s>999||l===null||l===91||l===93&&!c||l===94&&!s&&`_hiddenFootnoteSupport`in o.parser.constructs?n(l):l===93?(e.exit(a),e.enter(i),e.consume(l),e.exit(i),e.exit(r),t):Y(l)?(e.enter(`lineEnding`),e.consume(l),e.exit(`lineEnding`),u):(e.enter(`chunkString`,{contentType:`string`}),d(l))}function d(t){return t===null||t===91||t===93||Y(t)||s++>999?(e.exit(`chunkString`),u(t)):(e.consume(t),c||=!Z(t),t===92?f:d)}function f(t){return t===91||t===92||t===93?(e.consume(t),s++,d):d(t)}}function Cc(e,t,n,r,i,a){let o;return s;function s(t){return t===34||t===39||t===40?(e.enter(r),e.enter(i),e.consume(t),e.exit(i),o=t===40?41:t,c):n(t)}function c(n){return n===o?(e.enter(i),e.consume(n),e.exit(i),e.exit(r),t):(e.enter(a),l(n))}function l(t){return t===o?(e.exit(a),c(o)):t===null?n(t):Y(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),Q(e,l,`linePrefix`)):(e.enter(`chunkString`,{contentType:`string`}),u(t))}function u(t){return t===o||t===null||Y(t)?(e.exit(`chunkString`),l(t)):(e.consume(t),t===92?d:u)}function d(t){return t===o||t===92?(e.consume(t),u):u(t)}}function wc(e,t){let n;return r;function r(i){return Y(i)?(e.enter(`lineEnding`),e.consume(i),e.exit(`lineEnding`),n=!0,r):Z(i)?Q(e,r,n?`linePrefix`:`lineSuffix`)(i):t(i)}}const Tc={name:`definition`,tokenize:Dc},Ec={partial:!0,tokenize:Oc};function Dc(e,t,n){let r=this,i;return a;function a(t){return e.enter(`definition`),o(t)}function o(t){return Sc.call(r,e,s,n,`definitionLabel`,`definitionLabelMarker`,`definitionLabelString`)(t)}function s(t){return i=vs(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),t===58?(e.enter(`definitionMarker`),e.consume(t),e.exit(`definitionMarker`),c):n(t)}function c(t){return X(t)?wc(e,l)(t):l(t)}function l(t){return xc(e,u,n,`definitionDestination`,`definitionDestinationLiteral`,`definitionDestinationLiteralMarker`,`definitionDestinationRaw`,`definitionDestinationString`)(t)}function u(t){return e.attempt(Ec,d,d)(t)}function d(t){return Z(t)?Q(e,f,`whitespace`)(t):f(t)}function f(a){return a===null||Y(a)?(e.exit(`definition`),r.parser.defined.push(i),t(a)):n(a)}}function Oc(e,t,n){return r;function r(t){return X(t)?wc(e,i)(t):n(t)}function i(t){return Cc(e,a,n,`definitionTitle`,`definitionTitleMarker`,`definitionTitleString`)(t)}function a(t){return Z(t)?Q(e,o,`whitespace`)(t):o(t)}function o(e){return e===null||Y(e)?t(e):n(e)}}const kc={name:`hardBreakEscape`,tokenize:Ac};function Ac(e,t,n){return r;function r(t){return e.enter(`hardBreakEscape`),e.consume(t),i}function i(r){return Y(r)?(e.exit(`hardBreakEscape`),t(r)):n(r)}}const jc={name:`headingAtx`,resolve:Mc,tokenize:Nc};function Mc(e,t){let n=e.length-2,r=3,i,a;return e[r][1].type===`whitespace`&&(r+=2),n-2>r&&e[n][1].type===`whitespace`&&(n-=2),e[n][1].type===`atxHeadingSequence`&&(r===n-1||n-4>r&&e[n-2][1].type===`whitespace`)&&(n-=r+1===n?2:4),n>r&&(i={type:`atxHeadingText`,start:e[r][1].start,end:e[n][1].end},a={type:`chunkText`,start:e[r][1].start,end:e[n][1].end,contentType:`text`},J(e,r,n-r+1,[[`enter`,i,t],[`enter`,a,t],[`exit`,a,t],[`exit`,i,t]])),e}function Nc(e,t,n){let r=0;return i;function i(t){return e.enter(`atxHeading`),a(t)}function a(t){return e.enter(`atxHeadingSequence`),o(t)}function o(t){return t===35&&r++<6?(e.consume(t),o):t===null||X(t)?(e.exit(`atxHeadingSequence`),s(t)):n(t)}function s(n){return n===35?(e.enter(`atxHeadingSequence`),c(n)):n===null||Y(n)?(e.exit(`atxHeading`),t(n)):Z(n)?Q(e,s,`whitespace`)(n):(e.enter(`atxHeadingText`),l(n))}function c(t){return t===35?(e.consume(t),c):(e.exit(`atxHeadingSequence`),s(t))}function l(t){return t===null||t===35||X(t)?(e.exit(`atxHeadingText`),s(t)):(e.consume(t),l)}}const Pc=`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.search.section.summary.table.tbody.td.tfoot.th.thead.title.tr.track.ul`.split(`.`),Fc=[`pre`,`script`,`style`,`textarea`],Ic={concrete:!0,name:`htmlFlow`,resolveTo:zc,tokenize:Bc},Lc={partial:!0,tokenize:Hc},Rc={partial:!0,tokenize:Vc};function zc(e){let t=e.length;for(;t--&&(e[t][0]!==`enter`||e[t][1].type!==`htmlFlow`););return t>1&&e[t-2][1].type===`linePrefix`&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function Bc(e,t,n){let r=this,i,a,o,s,c;return l;function l(e){return u(e)}function u(t){return e.enter(`htmlFlow`),e.enter(`htmlFlowData`),e.consume(t),d}function d(s){return s===33?(e.consume(s),f):s===47?(e.consume(s),a=!0,h):s===63?(e.consume(s),i=3,r.interrupt?t:P):ys(s)?(e.consume(s),o=String.fromCharCode(s),g):n(s)}function f(a){return a===45?(e.consume(a),i=2,p):a===91?(e.consume(a),i=5,s=0,m):ys(a)?(e.consume(a),i=4,r.interrupt?t:P):n(a)}function p(i){return i===45?(e.consume(i),r.interrupt?t:P):n(i)}function m(i){return i===`CDATA[`.charCodeAt(s++)?(e.consume(i),s===6?r.interrupt?t:O:m):n(i)}function h(t){return ys(t)?(e.consume(t),o=String.fromCharCode(t),g):n(t)}function g(s){if(s===null||s===47||s===62||X(s)){let c=s===47,l=o.toLowerCase();return!c&&!a&&Fc.includes(l)?(i=1,r.interrupt?t(s):O(s)):Pc.includes(o.toLowerCase())?(i=6,c?(e.consume(s),_):r.interrupt?t(s):O(s)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(s):a?v(s):y(s))}return s===45||bs(s)?(e.consume(s),o+=String.fromCharCode(s),g):n(s)}function _(i){return i===62?(e.consume(i),r.interrupt?t:O):n(i)}function v(t){return Z(t)?(e.consume(t),v):E(t)}function y(t){return t===47?(e.consume(t),E):t===58||t===95||ys(t)?(e.consume(t),b):Z(t)?(e.consume(t),y):E(t)}function b(t){return t===45||t===46||t===58||t===95||bs(t)?(e.consume(t),b):x(t)}function x(t){return t===61?(e.consume(t),S):Z(t)?(e.consume(t),x):y(t)}function S(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),c=t,C):Z(t)?(e.consume(t),S):w(t)}function C(t){return t===c?(e.consume(t),c=null,T):t===null||Y(t)?n(t):(e.consume(t),C)}function w(t){return t===null||t===34||t===39||t===47||t===60||t===61||t===62||t===96||X(t)?x(t):(e.consume(t),w)}function T(e){return e===47||e===62||Z(e)?y(e):n(e)}function E(t){return t===62?(e.consume(t),D):n(t)}function D(t){return t===null||Y(t)?O(t):Z(t)?(e.consume(t),D):n(t)}function O(t){return t===45&&i===2?(e.consume(t),M):t===60&&i===1?(e.consume(t),ee):t===62&&i===4?(e.consume(t),ne):t===63&&i===3?(e.consume(t),P):t===93&&i===5?(e.consume(t),te):Y(t)&&(i===6||i===7)?(e.exit(`htmlFlowData`),e.check(Lc,re,k)(t)):t===null||Y(t)?(e.exit(`htmlFlowData`),k(t)):(e.consume(t),O)}function k(t){return e.check(Rc,A,re)(t)}function A(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),j}function j(t){return t===null||Y(t)?k(t):(e.enter(`htmlFlowData`),O(t))}function M(t){return t===45?(e.consume(t),P):O(t)}function ee(t){return t===47?(e.consume(t),o=``,N):O(t)}function N(t){if(t===62){let n=o.toLowerCase();return Fc.includes(n)?(e.consume(t),ne):O(t)}return ys(t)&&o.length<8?(e.consume(t),o+=String.fromCharCode(t),N):O(t)}function te(t){return t===93?(e.consume(t),P):O(t)}function P(t){return t===62?(e.consume(t),ne):t===45&&i===2?(e.consume(t),P):O(t)}function ne(t){return t===null||Y(t)?(e.exit(`htmlFlowData`),re(t)):(e.consume(t),ne)}function re(n){return e.exit(`htmlFlow`),t(n)}}function Vc(e,t,n){let r=this;return i;function i(t){return Y(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),a):n(t)}function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}function Hc(e,t,n){return r;function r(r){return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),e.attempt(Ws,t,n)}}const Uc={name:`htmlText`,tokenize:Wc};function Wc(e,t,n){let r=this,i,a,o;return s;function s(t){return e.enter(`htmlText`),e.enter(`htmlTextData`),e.consume(t),c}function c(t){return t===33?(e.consume(t),l):t===47?(e.consume(t),x):t===63?(e.consume(t),y):ys(t)?(e.consume(t),w):n(t)}function l(t){return t===45?(e.consume(t),u):t===91?(e.consume(t),a=0,m):ys(t)?(e.consume(t),v):n(t)}function u(t){return t===45?(e.consume(t),p):n(t)}function d(t){return t===null?n(t):t===45?(e.consume(t),f):Y(t)?(o=d,ee(t)):(e.consume(t),d)}function f(t){return t===45?(e.consume(t),p):d(t)}function p(e){return e===62?M(e):e===45?f(e):d(e)}function m(t){return t===`CDATA[`.charCodeAt(a++)?(e.consume(t),a===6?h:m):n(t)}function h(t){return t===null?n(t):t===93?(e.consume(t),g):Y(t)?(o=h,ee(t)):(e.consume(t),h)}function g(t){return t===93?(e.consume(t),_):h(t)}function _(t){return t===62?M(t):t===93?(e.consume(t),_):h(t)}function v(t){return t===null||t===62?M(t):Y(t)?(o=v,ee(t)):(e.consume(t),v)}function y(t){return t===null?n(t):t===63?(e.consume(t),b):Y(t)?(o=y,ee(t)):(e.consume(t),y)}function b(e){return e===62?M(e):y(e)}function x(t){return ys(t)?(e.consume(t),S):n(t)}function S(t){return t===45||bs(t)?(e.consume(t),S):C(t)}function C(t){return Y(t)?(o=C,ee(t)):Z(t)?(e.consume(t),C):M(t)}function w(t){return t===45||bs(t)?(e.consume(t),w):t===47||t===62||X(t)?T(t):n(t)}function T(t){return t===47?(e.consume(t),M):t===58||t===95||ys(t)?(e.consume(t),E):Y(t)?(o=T,ee(t)):Z(t)?(e.consume(t),T):M(t)}function E(t){return t===45||t===46||t===58||t===95||bs(t)?(e.consume(t),E):D(t)}function D(t){return t===61?(e.consume(t),O):Y(t)?(o=D,ee(t)):Z(t)?(e.consume(t),D):T(t)}function O(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),i=t,k):Y(t)?(o=O,ee(t)):Z(t)?(e.consume(t),O):(e.consume(t),A)}function k(t){return t===i?(e.consume(t),i=void 0,j):t===null?n(t):Y(t)?(o=k,ee(t)):(e.consume(t),k)}function A(t){return t===null||t===34||t===39||t===60||t===61||t===96?n(t):t===47||t===62||X(t)?T(t):(e.consume(t),A)}function j(e){return e===47||e===62||X(e)?T(e):n(e)}function M(r){return r===62?(e.consume(r),e.exit(`htmlTextData`),e.exit(`htmlText`),t):n(r)}function ee(t){return e.exit(`htmlTextData`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),N}function N(t){return Z(t)?Q(e,te,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):te(t)}function te(t){return e.enter(`htmlTextData`),o(t)}}const Gc={name:`labelEnd`,resolveAll:Yc,resolveTo:Xc,tokenize:Zc},Kc={tokenize:Qc},qc={tokenize:$c},Jc={tokenize:el};function Yc(e){let t=-1,n=[];for(;++t<e.length;){let r=e[t][1];if(n.push(e[t]),r.type===`labelImage`||r.type===`labelLink`||r.type===`labelEnd`){let e=r.type===`labelImage`?4:2;r.type=`data`,t+=e}}return e.length!==n.length&&J(e,0,e.length,n),e}function Xc(e,t){let n=e.length,r=0,i,a,o,s;for(;n--;)if(i=e[n][1],a){if(i.type===`link`||i.type===`labelLink`&&i._inactive)break;e[n][0]===`enter`&&i.type===`labelLink`&&(i._inactive=!0)}else if(o){if(e[n][0]===`enter`&&(i.type===`labelImage`||i.type===`labelLink`)&&!i._balanced&&(a=n,i.type!==`labelLink`)){r=2;break}}else i.type===`labelEnd`&&(o=n);let c={type:e[a][1].type===`labelLink`?`link`:`image`,start:{...e[a][1].start},end:{...e[e.length-1][1].end}},l={type:`label`,start:{...e[a][1].start},end:{...e[o][1].end}},u={type:`labelText`,start:{...e[a+r+2][1].end},end:{...e[o-2][1].start}};return s=[[`enter`,c,t],[`enter`,l,t]],s=fs(s,e.slice(a+1,a+r+3)),s=fs(s,[[`enter`,u,t]]),s=fs(s,Ls(t.parser.constructs.insideSpan.null,e.slice(a+r+4,o-3),t)),s=fs(s,[[`exit`,u,t],e[o-2],e[o-1],[`exit`,l,t]]),s=fs(s,e.slice(o+1)),s=fs(s,[[`exit`,c,t]]),J(e,a,e.length,s),e}function Zc(e,t,n){let r=this,i=r.events.length,a,o;for(;i--;)if((r.events[i][1].type===`labelImage`||r.events[i][1].type===`labelLink`)&&!r.events[i][1]._balanced){a=r.events[i][1];break}return s;function s(t){return a?a._inactive?d(t):(o=r.parser.defined.includes(vs(r.sliceSerialize({start:a.end,end:r.now()}))),e.enter(`labelEnd`),e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelEnd`),c):n(t)}function c(t){return t===40?e.attempt(Kc,u,o?u:d)(t):t===91?e.attempt(qc,u,o?l:d)(t):o?u(t):d(t)}function l(t){return e.attempt(Jc,u,d)(t)}function u(e){return t(e)}function d(e){return a._balanced=!0,n(e)}}function Qc(e,t,n){return r;function r(t){return e.enter(`resource`),e.enter(`resourceMarker`),e.consume(t),e.exit(`resourceMarker`),i}function i(t){return X(t)?wc(e,a)(t):a(t)}function a(t){return t===41?u(t):xc(e,o,s,`resourceDestination`,`resourceDestinationLiteral`,`resourceDestinationLiteralMarker`,`resourceDestinationRaw`,`resourceDestinationString`,32)(t)}function o(t){return X(t)?wc(e,c)(t):u(t)}function s(e){return n(e)}function c(t){return t===34||t===39||t===40?Cc(e,l,n,`resourceTitle`,`resourceTitleMarker`,`resourceTitleString`)(t):u(t)}function l(t){return X(t)?wc(e,u)(t):u(t)}function u(r){return r===41?(e.enter(`resourceMarker`),e.consume(r),e.exit(`resourceMarker`),e.exit(`resource`),t):n(r)}}function $c(e,t,n){let r=this;return i;function i(t){return Sc.call(r,e,a,o,`reference`,`referenceMarker`,`referenceString`)(t)}function a(e){return r.parser.defined.includes(vs(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(e):n(e)}function o(e){return n(e)}}function el(e,t,n){return r;function r(t){return e.enter(`reference`),e.enter(`referenceMarker`),e.consume(t),e.exit(`referenceMarker`),i}function i(r){return r===93?(e.enter(`referenceMarker`),e.consume(r),e.exit(`referenceMarker`),e.exit(`reference`),t):n(r)}}const tl={name:`labelStartImage`,resolveAll:Gc.resolveAll,tokenize:nl};function nl(e,t,n){let r=this;return i;function i(t){return e.enter(`labelImage`),e.enter(`labelImageMarker`),e.consume(t),e.exit(`labelImageMarker`),a}function a(t){return t===91?(e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelImage`),o):n(t)}function o(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):t(e)}}const rl={name:`labelStartLink`,resolveAll:Gc.resolveAll,tokenize:il};function il(e,t,n){let r=this;return i;function i(t){return e.enter(`labelLink`),e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelLink`),a}function a(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):t(e)}}const al={name:`lineEnding`,tokenize:ol};function ol(e,t){return n;function n(n){return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),Q(e,t,`linePrefix`)}}const sl={name:`thematicBreak`,tokenize:cl};function cl(e,t,n){let r=0,i;return a;function a(t){return e.enter(`thematicBreak`),o(t)}function o(e){return i=e,s(e)}function s(a){return a===i?(e.enter(`thematicBreakSequence`),c(a)):r>=3&&(a===null||Y(a))?(e.exit(`thematicBreak`),t(a)):n(a)}function c(t){return t===i?(e.consume(t),r++,c):(e.exit(`thematicBreakSequence`),Z(t)?Q(e,s,`whitespace`)(t):s(t))}}const ll={continuation:{tokenize:pl},exit:hl,name:`list`,tokenize:fl},ul={partial:!0,tokenize:gl},dl={partial:!0,tokenize:ml};function fl(e,t,n){let r=this,i=r.events[r.events.length-1],a=i&&i[1].type===`linePrefix`?i[2].sliceSerialize(i[1],!0).length:0,o=0;return s;function s(t){let i=r.containerState.type||(t===42||t===43||t===45?`listUnordered`:`listOrdered`);if(i===`listUnordered`?!r.containerState.marker||t===r.containerState.marker:Cs(t)){if(r.containerState.type||(r.containerState.type=i,e.enter(i,{_container:!0})),i===`listUnordered`)return e.enter(`listItemPrefix`),t===42||t===45?e.check(sl,n,l)(t):l(t);if(!r.interrupt||t===49)return e.enter(`listItemPrefix`),e.enter(`listItemValue`),c(t)}return n(t)}function c(t){return Cs(t)&&++o<10?(e.consume(t),c):(!r.interrupt||o<2)&&(r.containerState.marker?t===r.containerState.marker:t===41||t===46)?(e.exit(`listItemValue`),l(t)):n(t)}function l(t){return e.enter(`listItemMarker`),e.consume(t),e.exit(`listItemMarker`),r.containerState.marker=r.containerState.marker||t,e.check(Ws,r.interrupt?n:u,e.attempt(ul,f,d))}function u(e){return r.containerState.initialBlankLine=!0,a++,f(e)}function d(t){return Z(t)?(e.enter(`listItemPrefixWhitespace`),e.consume(t),e.exit(`listItemPrefixWhitespace`),f):n(t)}function f(n){return r.containerState.size=a+r.sliceSerialize(e.exit(`listItemPrefix`),!0).length,t(n)}}function pl(e,t,n){let r=this;return r.containerState._closeFlow=void 0,e.check(Ws,i,a);function i(n){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Q(e,t,`listItemIndent`,r.containerState.size+1)(n)}function a(n){return r.containerState.furtherBlankLines||!Z(n)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(n)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(dl,t,o)(n))}function o(i){return r.containerState._closeFlow=!0,r.interrupt=void 0,Q(e,e.attempt(ll,t,n),`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(i)}}function ml(e,t,n){let r=this;return Q(e,i,`listItemIndent`,r.containerState.size+1);function i(e){let i=r.events[r.events.length-1];return i&&i[1].type===`listItemIndent`&&i[2].sliceSerialize(i[1],!0).length===r.containerState.size?t(e):n(e)}}function hl(e){e.exit(this.containerState.type)}function gl(e,t,n){let r=this;return Q(e,i,`listItemPrefixWhitespace`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:5);function i(e){let i=r.events[r.events.length-1];return!Z(e)&&i&&i[1].type===`listItemPrefixWhitespace`?t(e):n(e)}}const _l={name:`setextUnderline`,resolveTo:vl,tokenize:yl};function vl(e,t){let n=e.length,r,i,a;for(;n--;)if(e[n][0]===`enter`){if(e[n][1].type===`content`){r=n;break}e[n][1].type===`paragraph`&&(i=n)}else e[n][1].type===`content`&&e.splice(n,1),!a&&e[n][1].type===`definition`&&(a=n);let o={type:`setextHeading`,start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type=`setextHeadingText`,a?(e.splice(i,0,[`enter`,o,t]),e.splice(a+1,0,[`exit`,e[r][1],t]),e[r][1].end={...e[a][1].end}):e[r][1]=o,e.push([`exit`,o,t]),e}function yl(e,t,n){let r=this,i;return a;function a(t){let a=r.events.length,s;for(;a--;)if(r.events[a][1].type!==`lineEnding`&&r.events[a][1].type!==`linePrefix`&&r.events[a][1].type!==`content`){s=r.events[a][1].type===`paragraph`;break}return!r.parser.lazy[r.now().line]&&(r.interrupt||s)?(e.enter(`setextHeadingLine`),i=t,o(t)):n(t)}function o(t){return e.enter(`setextHeadingLineSequence`),s(t)}function s(t){return t===i?(e.consume(t),s):(e.exit(`setextHeadingLineSequence`),Z(t)?Q(e,c,`lineSuffix`)(t):c(t))}function c(r){return r===null||Y(r)?(e.exit(`setextHeadingLine`),t(r)):n(r)}}const bl={tokenize:xl};function xl(e){let t=this,n=e.attempt(Ws,r,e.attempt(this.parser.constructs.flowInitial,i,Q(e,e.attempt(this.parser.constructs.flow,i,e.attempt(gc,i)),`linePrefix`)));return n;function r(r){if(r===null){e.consume(r);return}return e.enter(`lineEndingBlank`),e.consume(r),e.exit(`lineEndingBlank`),t.currentConstruct=void 0,n}function i(r){if(r===null){e.consume(r);return}return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),t.currentConstruct=void 0,n}}const Sl={resolveAll:El()},Cl=Tl(`string`),wl=Tl(`text`);function Tl(e){return{resolveAll:El(e===`text`?Dl:void 0),tokenize:t};function t(t){let n=this,r=this.parser.constructs[e],i=t.attempt(r,a,o);return a;function a(e){return c(e)?i(e):o(e)}function o(e){if(e===null){t.consume(e);return}return t.enter(`data`),t.consume(e),s}function s(e){return c(e)?(t.exit(`data`),i(e)):(t.consume(e),s)}function c(e){if(e===null)return!0;let t=r[e],i=-1;if(t)for(;++i<t.length;){let e=t[i];if(!e.previous||e.previous.call(n,n.previous))return!0}return!1}}}function El(e){return t;function t(t,n){let r=-1,i;for(;++r<=t.length;)i===void 0?t[r]&&t[r][1].type===`data`&&(i=r,r++):(!t[r]||t[r][1].type!==`data`)&&(r!==i+2&&(t[i][1].end=t[r-1][1].end,t.splice(i+2,r-i-2),r=i+2),i=void 0);return e?e(t,n):t}}function Dl(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type===`lineEnding`)&&e[n-1][1].type===`data`){let r=e[n-1][1],i=t.sliceStream(r),a=i.length,o=-1,s=0,c;for(;a--;){let e=i[a];if(typeof e==`string`){for(o=e.length;e.charCodeAt(o-1)===32;)s++,o--;if(o)break;o=-1}else if(e===-2)c=!0,s++;else if(e!==-1){a++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(s=0),s){let i={type:n===e.length||c||s<2?`lineSuffix`:`hardBreakTrailing`,start:{_bufferIndex:a?o:r.start._bufferIndex+o,_index:r.start._index+a,line:r.end.line,column:r.end.column-s,offset:r.end.offset-s},end:{...r.end}};r.end={...i.start},r.start.offset===r.end.offset?Object.assign(r,i):(e.splice(n,0,[`enter`,i,t],[`exit`,i,t]),n+=2)}n++}return e}var Ol=Me({attentionMarkers:()=>Il,contentInitial:()=>Al,disable:()=>Ll,document:()=>kl,flow:()=>Ml,flowInitial:()=>jl,insideSpan:()=>Fl,string:()=>Nl,text:()=>Pl});const kl={42:ll,43:ll,45:ll,48:ll,49:ll,50:ll,51:ll,52:ll,53:ll,54:ll,55:ll,56:ll,57:ll,62:Ks},Al={91:Tc},jl={[-2]:ic,[-1]:ic,32:ic},Ml={35:jc,42:sl,45:[_l,sl],60:Ic,61:_l,95:sl,96:tc,126:tc},Nl={38:Qs,92:Xs},Pl={[-5]:al,[-4]:al,[-3]:al,33:tl,38:Qs,42:Rs,60:[Hs,Uc],91:rl,92:[kc,Xs],93:Gc,95:Rs,96:cc},Fl={null:[Rs,Sl]},Il={null:[42,95]},Ll={null:[]};function Rl(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0},i={},a=[],o=[],s=[],c={attempt:C(x),check:C(S),consume:v,enter:y,exit:b,interrupt:C(S,{interrupt:!0})},l={code:null,containerState:{},defineSkip:h,events:[],now:m,parser:e,previous:null,sliceSerialize:f,sliceStream:p,write:d},u=t.tokenize.call(l,c);return t.resolveAll&&a.push(t),l;function d(e){return o=fs(o,e),g(),o[o.length-1]===null?(w(t,0),l.events=Ls(a,l.events,l),l.events):[]}function f(e,t){return Bl(p(e),t)}function p(e){return zl(o,e)}function m(){let{_bufferIndex:e,_index:t,line:n,column:i,offset:a}=r;return{_bufferIndex:e,_index:t,line:n,column:i,offset:a}}function h(e){i[e.line]=e.column,E()}function g(){let e;for(;r._index<o.length;){let t=o[r._index];if(typeof t==`string`)for(e=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===e&&r._bufferIndex<t.length;)_(t.charCodeAt(r._bufferIndex));else _(t)}}function _(e){u=u(e)}function v(e){Y(e)?(r.line++,r.column=1,r.offset+=e===-3?2:1,E()):e!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===o[r._index].length&&(r._bufferIndex=-1,r._index++)),l.previous=e}function y(e,t){let n=t||{};return n.type=e,n.start=m(),l.events.push([`enter`,n,l]),s.push(n),n}function b(e){let t=s.pop();return t.end=m(),l.events.push([`exit`,t,l]),t}function x(e,t){w(e,t.from)}function S(e,t){t.restore()}function C(e,t){return n;function n(n,r,i){let a,o,s,u;return Array.isArray(n)?f(n):`tokenize`in n?f([n]):d(n);function d(e){return t;function t(t){let n=t!==null&&e[t],r=t!==null&&e.null;return f([...Array.isArray(n)?n:n?[n]:[],...Array.isArray(r)?r:r?[r]:[]])(t)}}function f(e){return a=e,o=0,e.length===0?i:p(e[o])}function p(e){return n;function n(n){return u=T(),s=e,e.partial||(l.currentConstruct=e),e.name&&l.parser.constructs.disable.null.includes(e.name)?h(n):e.tokenize.call(t?Object.assign(Object.create(l),t):l,c,m,h)(n)}}function m(t){return e(s,u),r}function h(e){return u.restore(),++o<a.length?p(a[o]):i}}}function w(e,t){e.resolveAll&&!a.includes(e)&&a.push(e),e.resolve&&J(l.events,t,l.events.length-t,e.resolve(l.events.slice(t),l)),e.resolveTo&&(l.events=e.resolveTo(l.events,l))}function T(){let e=m(),t=l.previous,n=l.currentConstruct,i=l.events.length,a=Array.from(s);return{from:i,restore:o};function o(){r=e,l.previous=t,l.currentConstruct=n,l.events.length=i,s=a,E()}}function E(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function zl(e,t){let n=t.start._index,r=t.start._bufferIndex,i=t.end._index,a=t.end._bufferIndex,o;if(n===i)o=[e[n].slice(r,a)];else{if(o=e.slice(n,i),r>-1){let e=o[0];typeof e==`string`?o[0]=e.slice(r):o.shift()}a>0&&o.push(e[i].slice(0,a))}return o}function Bl(e,t){let n=-1,r=[],i;for(;++n<e.length;){let a=e[n],o;if(typeof a==`string`)o=a;else switch(a){case-5:o=`\r`;break;case-4:o=`
278
+ `;break;case-3:o=`\r
279
+ `;break;case-2:o=t?` `:` `;break;case-1:if(!t&&i)continue;o=` `;break;default:o=String.fromCharCode(a)}i=a===-2,r.push(o)}return r.join(``)}function Vl(e){let t={constructs:ms([Ol,...(e||{}).extensions||[]]),content:n(As),defined:[],document:n(Ms),flow:n(bl),lazy:{},string:n(Cl),text:n(wl)};return t;function n(e){return n;function n(n){return Rl(t,e,n)}}}function Hl(e){for(;!mc(e););return e}const Ul=/[\0\t\n\r]/g;function Wl(){let e=1,t=``,n=!0,r;return i;function i(i,a,o){let s=[],c,l,u,d,f;for(i=t+(typeof i==`string`?i.toString():new TextDecoder(a||void 0).decode(i)),u=0,t=``,n&&=(i.charCodeAt(0)===65279&&u++,void 0);u<i.length;){if(Ul.lastIndex=u,c=Ul.exec(i),d=c&&c.index!==void 0?c.index:i.length,f=i.charCodeAt(d),!c){t=i.slice(u);break}if(f===10&&u===d&&r)s.push(-3),r=void 0;else switch(r&&=(s.push(-5),void 0),u<d&&(s.push(i.slice(u,d)),e+=d-u),f){case 0:s.push(65533),e++;break;case 9:for(l=Math.ceil(e/4)*4,s.push(-2);e++<l;)s.push(-1);break;case 10:s.push(-4),e=1;break;default:r=!0,e=1}u=d+1}return o&&(r&&s.push(-5),t&&s.push(t),s.push(null)),s}}const Gl=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function Kl(e){return e.replace(Gl,ql)}function ql(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){let e=n.charCodeAt(1),t=e===120||e===88;return _s(n.slice(t?2:1),t?16:10)}return ds(n)||e}const Jl={}.hasOwnProperty;function Yl(e,t,n){return typeof t!=`string`&&(n=t,t=void 0),Xl(n)(Hl(Vl(n).document().write(Wl()(e,t,!0))))}function Xl(e){let t={transforms:[],canContainEols:[`emphasis`,`fragment`,`heading`,`paragraph`,`strong`],enter:{autolink:a(me),autolinkProtocol:T,autolinkEmail:T,atxHeading:a(ue),blockQuote:a(oe),characterEscape:T,characterReference:T,codeFenced:a(se),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:a(se,o),codeText:a(B,o),codeTextData:T,data:T,codeFlowValue:T,definition:a(ce),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:a(le),hardBreakEscape:a(de),hardBreakTrailing:a(de),htmlFlow:a(fe,o),htmlFlowData:T,htmlText:a(fe,o),htmlTextData:T,image:a(pe),label:o,link:a(me),listItem:a(ge),listItemValue:f,listOrdered:a(he,d),listUnordered:a(he),paragraph:a(_e),reference:F,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:a(ue),strong:a(ve),thematicBreak:a(be)},exit:{atxHeading:c(),atxHeadingSequence:x,autolink:c(),autolinkEmail:z,autolinkProtocol:R,blockQuote:c(),characterEscapeValue:E,characterReferenceMarkerHexadecimal:I,characterReferenceMarkerNumeric:I,characterReferenceValue:ae,characterReference:L,codeFenced:c(g),codeFencedFence:h,codeFencedFenceInfo:p,codeFencedFenceMeta:m,codeFlowValue:E,codeIndented:c(_),codeText:c(j),codeTextData:E,data:E,definition:c(),definitionDestinationString:b,definitionLabelString:v,definitionTitleString:y,emphasis:c(),hardBreakEscape:c(O),hardBreakTrailing:c(O),htmlFlow:c(k),htmlFlowData:E,htmlText:c(A),htmlTextData:E,image:c(ee),label:te,labelText:N,lineEnding:D,link:c(M),listItem:c(),listOrdered:c(),listUnordered:c(),paragraph:c(),referenceString:ie,resourceDestinationString:P,resourceTitleString:ne,resource:re,setextHeading:c(w),setextHeadingLineSequence:C,setextHeadingText:S,strong:c(),thematicBreak:c()}};Ql(t,(e||{}).mdastExtensions||[]);let n={};return r;function r(e){let r={type:`root`,children:[]},a={stack:[r],tokenStack:[],config:t,enter:s,exit:l,buffer:o,resume:u,data:n},c=[],d=-1;for(;++d<e.length;)(e[d][1].type===`listOrdered`||e[d][1].type===`listUnordered`)&&(e[d][0]===`enter`?c.push(d):d=i(e,c.pop(),d));for(d=-1;++d<e.length;){let n=t[e[d][0]];Jl.call(n,e[d][1].type)&&n[e[d][1].type].call(Object.assign({sliceSerialize:e[d][2].sliceSerialize},a),e[d][1])}if(a.tokenStack.length>0){let e=a.tokenStack[a.tokenStack.length-1];(e[1]||eu).call(a,void 0,e[0])}for(r.position={start:Zl(e.length>0?e[0][1].start:{line:1,column:1,offset:0}),end:Zl(e.length>0?e[e.length-2][1].end:{line:1,column:1,offset:0})},d=-1;++d<t.transforms.length;)r=t.transforms[d](r)||r;return r}function i(e,t,n){let r=t-1,i=-1,a=!1,o,s,c,l;for(;++r<=n;){let t=e[r];switch(t[1].type){case`listUnordered`:case`listOrdered`:case`blockQuote`:t[0]===`enter`?i++:i--,l=void 0;break;case`lineEndingBlank`:t[0]===`enter`&&(o&&!l&&!i&&!c&&(c=r),l=void 0);break;case`linePrefix`:case`listItemValue`:case`listItemMarker`:case`listItemPrefix`:case`listItemPrefixWhitespace`:break;default:l=void 0}if(!i&&t[0]===`enter`&&t[1].type===`listItemPrefix`||i===-1&&t[0]===`exit`&&(t[1].type===`listUnordered`||t[1].type===`listOrdered`)){if(o){let i=r;for(s=void 0;i--;){let t=e[i];if(t[1].type===`lineEnding`||t[1].type===`lineEndingBlank`){if(t[0]===`exit`)continue;s&&(e[s][1].type=`lineEndingBlank`,a=!0),t[1].type=`lineEnding`,s=i}else if(t[1].type!==`linePrefix`&&t[1].type!==`blockQuotePrefix`&&t[1].type!==`blockQuotePrefixWhitespace`&&t[1].type!==`blockQuoteMarker`&&t[1].type!==`listItemIndent`)break}c&&(!s||c<s)&&(o._spread=!0),o.end=Object.assign({},s?e[s][1].start:t[1].end),e.splice(s||r,0,[`exit`,o,t[2]]),r++,n++}if(t[1].type===`listItemPrefix`){let i={type:`listItem`,_spread:!1,start:Object.assign({},t[1].start),end:void 0};o=i,e.splice(r,0,[`enter`,i,t[2]]),r++,n++,c=void 0,l=!0}}}return e[t][1]._spread=a,n}function a(e,t){return n;function n(n){s.call(this,e(n),n),t&&t.call(this,n)}}function o(){this.stack.push({type:`fragment`,children:[]})}function s(e,t,n){this.stack[this.stack.length-1].children.push(e),this.stack.push(e),this.tokenStack.push([t,n||void 0]),e.position={start:Zl(t.start),end:void 0}}function c(e){return t;function t(t){e&&e.call(this,t),l.call(this,t)}}function l(e,t){let n=this.stack.pop(),r=this.tokenStack.pop();if(r)r[0].type!==e.type&&(t?t.call(this,e,r[0]):(r[1]||eu).call(this,e,r[0]));else throw Error("Cannot close `"+e.type+"` ("+To({start:e.start,end:e.end})+`): it’s not open`);n.position.end=Zl(e.end)}function u(){return os(this.stack.pop())}function d(){this.data.expectingFirstListItemValue=!0}function f(e){if(this.data.expectingFirstListItemValue){let t=this.stack[this.stack.length-2];t.start=Number.parseInt(this.sliceSerialize(e),10),this.data.expectingFirstListItemValue=void 0}}function p(){let e=this.resume(),t=this.stack[this.stack.length-1];t.lang=e}function m(){let e=this.resume(),t=this.stack[this.stack.length-1];t.meta=e}function h(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function g(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,``),this.data.flowCodeInside=void 0}function _(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e.replace(/(\r?\n|\r)$/g,``)}function v(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=vs(this.sliceSerialize(e)).toLowerCase()}function y(){let e=this.resume(),t=this.stack[this.stack.length-1];t.title=e}function b(){let e=this.resume(),t=this.stack[this.stack.length-1];t.url=e}function x(e){let t=this.stack[this.stack.length-1];t.depth||=this.sliceSerialize(e).length}function S(){this.data.setextHeadingSlurpLineEnding=!0}function C(e){let t=this.stack[this.stack.length-1];t.depth=this.sliceSerialize(e).codePointAt(0)===61?1:2}function w(){this.data.setextHeadingSlurpLineEnding=void 0}function T(e){let t=this.stack[this.stack.length-1].children,n=t[t.length-1];(!n||n.type!==`text`)&&(n=ye(),n.position={start:Zl(e.start),end:void 0},t.push(n)),this.stack.push(n)}function E(e){let t=this.stack.pop();t.value+=this.sliceSerialize(e),t.position.end=Zl(e.end)}function D(e){let n=this.stack[this.stack.length-1];if(this.data.atHardBreak){let t=n.children[n.children.length-1];t.position.end=Zl(e.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(n.type)&&(T.call(this,e),E.call(this,e))}function O(){this.data.atHardBreak=!0}function k(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function A(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function j(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function M(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||`shortcut`;e.type+=`Reference`,e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}function ee(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||`shortcut`;e.type+=`Reference`,e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}function N(e){let t=this.sliceSerialize(e),n=this.stack[this.stack.length-2];n.label=Kl(t),n.identifier=vs(t).toLowerCase()}function te(){let e=this.stack[this.stack.length-1],t=this.resume(),n=this.stack[this.stack.length-1];this.data.inReference=!0,n.type===`link`?n.children=e.children:n.alt=t}function P(){let e=this.resume(),t=this.stack[this.stack.length-1];t.url=e}function ne(){let e=this.resume(),t=this.stack[this.stack.length-1];t.title=e}function re(){this.data.inReference=void 0}function F(){this.data.referenceType=`collapsed`}function ie(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=vs(this.sliceSerialize(e)).toLowerCase(),this.data.referenceType=`full`}function I(e){this.data.characterReferenceType=e.type}function ae(e){let t=this.sliceSerialize(e),n=this.data.characterReferenceType,r;n?(r=_s(t,n===`characterReferenceMarkerNumeric`?10:16),this.data.characterReferenceType=void 0):r=ds(t);let i=this.stack[this.stack.length-1];i.value+=r}function L(e){let t=this.stack.pop();t.position.end=Zl(e.end)}function R(e){E.call(this,e);let t=this.stack[this.stack.length-1];t.url=this.sliceSerialize(e)}function z(e){E.call(this,e);let t=this.stack[this.stack.length-1];t.url=`mailto:`+this.sliceSerialize(e)}function oe(){return{type:`blockquote`,children:[]}}function se(){return{type:`code`,lang:null,meta:null,value:``}}function B(){return{type:`inlineCode`,value:``}}function ce(){return{type:`definition`,identifier:``,label:null,title:null,url:``}}function le(){return{type:`emphasis`,children:[]}}function ue(){return{type:`heading`,depth:0,children:[]}}function de(){return{type:`break`}}function fe(){return{type:`html`,value:``}}function pe(){return{type:`image`,title:null,url:``,alt:null}}function me(){return{type:`link`,title:null,url:``,children:[]}}function he(e){return{type:`list`,ordered:e.type===`listOrdered`,start:null,spread:e._spread,children:[]}}function ge(e){return{type:`listItem`,spread:e._spread,checked:null,children:[]}}function _e(){return{type:`paragraph`,children:[]}}function ve(){return{type:`strong`,children:[]}}function ye(){return{type:`text`,value:``}}function be(){return{type:`thematicBreak`}}}function Zl(e){return{line:e.line,column:e.column,offset:e.offset}}function Ql(e,t){let n=-1;for(;++n<t.length;){let r=t[n];Array.isArray(r)?Ql(e,r):$l(e,r)}}function $l(e,t){let n;for(n in t)if(Jl.call(t,n))switch(n){case`canContainEols`:{let r=t[n];r&&e[n].push(...r);break}case`transforms`:{let r=t[n];r&&e[n].push(...r);break}case`enter`:case`exit`:{let r=t[n];r&&Object.assign(e[n],r);break}}}function eu(e,t){throw Error(e?"Cannot close `"+e.type+"` ("+To({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+To({start:t.start,end:t.end})+`) is open`:"Cannot close document, a token (`"+t.type+"`, "+To({start:t.start,end:t.end})+`) is still open`)}function tu(e){let t=this;t.parser=n;function n(n){return Yl(n,{...t.data(`settings`),...e,extensions:t.data(`micromarkExtensions`)||[],mdastExtensions:t.data(`fromMarkdownExtensions`)||[]})}}function nu(e,t){let n={type:`element`,tagName:`blockquote`,properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function ru(e,t){let n={type:`element`,tagName:`br`,properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:`text`,value:`
280
+ `}]}function iu(e,t){let n=t.value?t.value+`
281
+ `:``,r={},i=t.lang?t.lang.split(/\s+/):[];i.length>0&&(r.className=[`language-`+i[0]]);let a={type:`element`,tagName:`code`,properties:r,children:[{type:`text`,value:n}]};return t.meta&&(a.data={meta:t.meta}),e.patch(t,a),a=e.applyData(t,a),a={type:`element`,tagName:`pre`,properties:{},children:[a]},e.patch(t,a),a}function au(e,t){let n={type:`element`,tagName:`del`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function ou(e,t){let n={type:`element`,tagName:`em`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function su(e,t){let n=typeof e.options.clobberPrefix==`string`?e.options.clobberPrefix:`user-content-`,r=String(t.identifier).toUpperCase(),i=ks(r.toLowerCase()),a=e.footnoteOrder.indexOf(r),o,s=e.footnoteCounts.get(r);s===void 0?(s=0,e.footnoteOrder.push(r),o=e.footnoteOrder.length):o=a+1,s+=1,e.footnoteCounts.set(r,s);let c={type:`element`,tagName:`a`,properties:{href:`#`+n+`fn-`+i,id:n+`fnref-`+i+(s>1?`-`+s:``),dataFootnoteRef:!0,ariaDescribedBy:[`footnote-label`]},children:[{type:`text`,value:String(o)}]};e.patch(t,c);let l={type:`element`,tagName:`sup`,properties:{},children:[c]};return e.patch(t,l),e.applyData(t,l)}function cu(e,t){let n={type:`element`,tagName:`h`+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function lu(e,t){if(e.options.allowDangerousHtml){let n={type:`raw`,value:t.value};return e.patch(t,n),e.applyData(t,n)}}function uu(e,t){let n=t.referenceType,r=`]`;if(n===`collapsed`?r+=`[]`:n===`full`&&(r+=`[`+(t.label||t.identifier)+`]`),t.type===`imageReference`)return[{type:`text`,value:`![`+t.alt+r}];let i=e.all(t),a=i[0];a&&a.type===`text`?a.value=`[`+a.value:i.unshift({type:`text`,value:`[`});let o=i[i.length-1];return o&&o.type===`text`?o.value+=r:i.push({type:`text`,value:r}),i}function du(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return uu(e,t);let i={src:ks(r.url||``),alt:t.alt};r.title!==null&&r.title!==void 0&&(i.title=r.title);let a={type:`element`,tagName:`img`,properties:i,children:[]};return e.patch(t,a),e.applyData(t,a)}function fu(e,t){let n={src:ks(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);let r={type:`element`,tagName:`img`,properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)}function pu(e,t){let n={type:`text`,value:t.value.replace(/\r?\n|\r/g,` `)};e.patch(t,n);let r={type:`element`,tagName:`code`,properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)}function mu(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return uu(e,t);let i={href:ks(r.url||``)};r.title!==null&&r.title!==void 0&&(i.title=r.title);let a={type:`element`,tagName:`a`,properties:i,children:e.all(t)};return e.patch(t,a),e.applyData(t,a)}function hu(e,t){let n={href:ks(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);let r={type:`element`,tagName:`a`,properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function gu(e,t,n){let r=e.all(t),i=n?_u(n):vu(t),a={},o=[];if(typeof t.checked==`boolean`){let e=r[0],n;e&&e.type===`element`&&e.tagName===`p`?n=e:(n={type:`element`,tagName:`p`,properties:{},children:[]},r.unshift(n)),n.children.length>0&&n.children.unshift({type:`text`,value:` `}),n.children.unshift({type:`element`,tagName:`input`,properties:{type:`checkbox`,checked:t.checked,disabled:!0},children:[]}),a.className=[`task-list-item`]}let s=-1;for(;++s<r.length;){let e=r[s];(i||s!==0||e.type!==`element`||e.tagName!==`p`)&&o.push({type:`text`,value:`
282
+ `}),e.type===`element`&&e.tagName===`p`&&!i?o.push(...e.children):o.push(e)}let c=r[r.length-1];c&&(i||c.type!==`element`||c.tagName!==`p`)&&o.push({type:`text`,value:`
283
+ `});let l={type:`element`,tagName:`li`,properties:a,children:o};return e.patch(t,l),e.applyData(t,l)}function _u(e){let t=!1;if(e.type===`list`){t=e.spread||!1;let n=e.children,r=-1;for(;!t&&++r<n.length;)t=vu(n[r])}return t}function vu(e){return e.spread??e.children.length>1}function yu(e,t){let n={},r=e.all(t),i=-1;for(typeof t.start==`number`&&t.start!==1&&(n.start=t.start);++i<r.length;){let e=r[i];if(e.type===`element`&&e.tagName===`li`&&e.properties&&Array.isArray(e.properties.className)&&e.properties.className.includes(`task-list-item`)){n.className=[`contains-task-list`];break}}let a={type:`element`,tagName:t.ordered?`ol`:`ul`,properties:n,children:e.wrap(r,!0)};return e.patch(t,a),e.applyData(t,a)}function bu(e,t){let n={type:`element`,tagName:`p`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function xu(e,t){let n={type:`root`,children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function Su(e,t){let n={type:`element`,tagName:`strong`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Cu(e,t){let n=e.all(t),r=n.shift(),i=[];if(r){let n={type:`element`,tagName:`thead`,properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],n),i.push(n)}if(n.length>0){let r={type:`element`,tagName:`tbody`,properties:{},children:e.wrap(n,!0)},a=So(t.children[1]),o=xo(t.children[t.children.length-1]);a&&o&&(r.position={start:a,end:o}),i.push(r)}let a={type:`element`,tagName:`table`,properties:{},children:e.wrap(i,!0)};return e.patch(t,a),e.applyData(t,a)}function wu(e,t,n){let r=n?n.children:void 0,i=(r?r.indexOf(t):1)===0?`th`:`td`,a=n&&n.type===`table`?n.align:void 0,o=a?a.length:t.children.length,s=-1,c=[];for(;++s<o;){let n=t.children[s],r={},o=a?a[s]:void 0;o&&(r.align=o);let l={type:`element`,tagName:i,properties:r,children:[]};n&&(l.children=e.all(n),e.patch(n,l),l=e.applyData(n,l)),c.push(l)}let l={type:`element`,tagName:`tr`,properties:{},children:e.wrap(c,!0)};return e.patch(t,l),e.applyData(t,l)}function Tu(e,t){let n={type:`element`,tagName:`td`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Eu(e){let t=String(e),n=/\r?\n|\r/g,r=n.exec(t),i=0,a=[];for(;r;)a.push(Du(t.slice(i,r.index),i>0,!0),r[0]),i=r.index+r[0].length,r=n.exec(t);return a.push(Du(t.slice(i),i>0,!1)),a.join(``)}function Du(e,t,n){let r=0,i=e.length;if(t){let t=e.codePointAt(r);for(;t===9||t===32;)r++,t=e.codePointAt(r)}if(n){let t=e.codePointAt(i-1);for(;t===9||t===32;)i--,t=e.codePointAt(i-1)}return i>r?e.slice(r,i):``}function Ou(e,t){let n={type:`text`,value:Eu(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function ku(e,t){let n={type:`element`,tagName:`hr`,properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const Au={blockquote:nu,break:ru,code:iu,delete:au,emphasis:ou,footnoteReference:su,heading:cu,html:lu,imageReference:du,image:fu,inlineCode:pu,linkReference:mu,link:hu,listItem:gu,list:yu,paragraph:bu,root:xu,strong:Su,table:Cu,tableCell:Tu,tableRow:wu,text:Ou,thematicBreak:ku,toml:ju,yaml:ju,definition:ju,footnoteDefinition:ju};function ju(){}const Mu=typeof self==`object`?self:globalThis,Nu=(e,t)=>{switch(e){case`Function`:case`SharedWorker`:case`Worker`:case`eval`:case`setInterval`:case`setTimeout`:throw TypeError(`unable to deserialize `+e)}return new Mu[e](t)},Pu=(e,t)=>{let n=(t,n)=>(e.set(n,t),t),r=i=>{if(e.has(i))return e.get(i);let[a,o]=t[i];switch(a){case 0:case-1:return n(o,i);case 1:{let e=n([],i);for(let t of o)e.push(r(t));return e}case 2:{let e=n({},i);for(let[t,n]of o)e[r(t)]=r(n);return e}case 3:return n(new Date(o),i);case 4:{let{source:e,flags:t}=o;return n(new RegExp(e,t),i)}case 5:{let e=n(new Map,i);for(let[t,n]of o)e.set(r(t),r(n));return e}case 6:{let e=n(new Set,i);for(let t of o)e.add(r(t));return e}case 7:{let{name:e,message:t}=o;return n(typeof Mu[e]==`function`?Nu(e,t):Error(t),i)}case 8:return n(BigInt(o),i);case`BigInt`:return n(Object(BigInt(o)),i);case`ArrayBuffer`:return n(new Uint8Array(o).buffer,o);case`DataView`:{let{buffer:e}=new Uint8Array(o);return n(new DataView(e),o)}}return n(Nu(a,o),i)};return r},Fu=e=>Pu(new Map,e)(0),{toString:Iu}={},{keys:Lu}=Object,Ru=e=>{let t=typeof e;if(t!==`object`||!e)return[0,t];let n=Iu.call(e).slice(8,-1);switch(n){case`Array`:return[1,``];case`Object`:return[2,``];case`Date`:return[3,``];case`RegExp`:return[4,``];case`Map`:return[5,``];case`Set`:return[6,``];case`DataView`:return[1,n]}return n.includes(`Array`)?[1,n]:e instanceof Error?[7,e.name||`Error`]:[2,n]},zu=([e,t])=>e===0&&(t===`function`||t===`symbol`),Bu=(e,t,n,r)=>{let i=(e,t)=>{let i=r.push(e)-1;return n.set(t,i),i},a=r=>{if(n.has(r))return n.get(r);let[o,s]=Ru(r);switch(o){case 0:{let t=r;switch(s){case`bigint`:o=8,t=r.toString();break;case`function`:case`symbol`:if(e)throw TypeError(`unable to serialize `+s);t=null;break;case`undefined`:return i([-1],r)}return i([o,t],r)}case 1:{if(s){let e=r;return s===`DataView`?e=new Uint8Array(r.buffer):s===`ArrayBuffer`&&(e=new Uint8Array(r)),i([s,[...e]],r)}let e=[],t=i([o,e],r);for(let t of r)e.push(a(t));return t}case 2:{if(s)switch(s){case`BigInt`:return i([s,r.toString()],r);case`Boolean`:case`Number`:case`String`:return i([s,r.valueOf()],r)}if(t&&`toJSON`in r)return a(r.toJSON());let n=[],c=i([o,n],r);for(let t of Lu(r))(e||!zu(Ru(r[t])))&&n.push([a(t),a(r[t])]);return c}case 3:return i([o,isNaN(r.getTime())?``:r.toISOString()],r);case 4:{let{source:e,flags:t}=r;return i([o,{source:e,flags:t}],r)}case 5:{let t=[],n=i([o,t],r);for(let[n,i]of r)(e||!(zu(Ru(n))||zu(Ru(i))))&&t.push([a(n),a(i)]);return n}case 6:{let t=[],n=i([o,t],r);for(let n of r)(e||!zu(Ru(n)))&&t.push(a(n));return n}}let{message:c}=r;return i([o,{name:s,message:c}],r)};return a},Vu=(e,{json:t,lossy:n}={})=>{let r=[];return Bu(!(t||n),!!t,new Map,r)(e),r};var Hu=typeof structuredClone==`function`?(e,t)=>t&&(`json`in t||`lossy`in t)?Fu(Vu(e,t)):structuredClone(e):(e,t)=>Fu(Vu(e,t));function Uu(e,t){let n=[{type:`text`,value:`↩`}];return t>1&&n.push({type:`element`,tagName:`sup`,properties:{},children:[{type:`text`,value:String(t)}]}),n}function Wu(e,t){return`Back to reference `+(e+1)+(t>1?`-`+t:``)}function Gu(e){let t=typeof e.options.clobberPrefix==`string`?e.options.clobberPrefix:`user-content-`,n=e.options.footnoteBackContent||Uu,r=e.options.footnoteBackLabel||Wu,i=e.options.footnoteLabel||`Footnotes`,a=e.options.footnoteLabelTagName||`h2`,o=e.options.footnoteLabelProperties||{className:[`sr-only`]},s=[],c=-1;for(;++c<e.footnoteOrder.length;){let i=e.footnoteById.get(e.footnoteOrder[c]);if(!i)continue;let a=e.all(i),o=String(i.identifier).toUpperCase(),l=ks(o.toLowerCase()),u=0,d=[],f=e.footnoteCounts.get(o);for(;f!==void 0&&++u<=f;){d.length>0&&d.push({type:`text`,value:` `});let e=typeof n==`string`?n:n(c,u);typeof e==`string`&&(e={type:`text`,value:e}),d.push({type:`element`,tagName:`a`,properties:{href:`#`+t+`fnref-`+l+(u>1?`-`+u:``),dataFootnoteBackref:``,ariaLabel:typeof r==`string`?r:r(c,u),className:[`data-footnote-backref`]},children:Array.isArray(e)?e:[e]})}let p=a[a.length-1];if(p&&p.type===`element`&&p.tagName===`p`){let e=p.children[p.children.length-1];e&&e.type===`text`?e.value+=` `:p.children.push({type:`text`,value:` `}),p.children.push(...d)}else a.push(...d);let m={type:`element`,tagName:`li`,properties:{id:t+`fn-`+l},children:e.wrap(a,!0)};e.patch(i,m),s.push(m)}if(s.length!==0)return{type:`element`,tagName:`section`,properties:{dataFootnotes:!0,className:[`footnotes`]},children:[{type:`element`,tagName:a,properties:{...Hu(o),id:`footnote-label`},children:[{type:`text`,value:i}]},{type:`text`,value:`
284
+ `},{type:`element`,tagName:`ol`,properties:{},children:e.wrap(s,!0)},{type:`text`,value:`
285
+ `}]}}const Ku=(function(e){if(e==null)return Zu;if(typeof e==`function`)return Xu(e);if(typeof e==`object`)return Array.isArray(e)?qu(e):Ju(e);if(typeof e==`string`)return Yu(e);throw Error(`Expected function, string, or object as test`)});function qu(e){let t=[],n=-1;for(;++n<e.length;)t[n]=Ku(e[n]);return Xu(r);function r(...e){let n=-1;for(;++n<t.length;)if(t[n].apply(this,e))return!0;return!1}}function Ju(e){let t=e;return Xu(n);function n(n){let r=n,i;for(i in e)if(r[i]!==t[i])return!1;return!0}}function Yu(e){return Xu(t);function t(t){return t&&t.type===e}}function Xu(e){return t;function t(t,n,r){return!!(Qu(t)&&e.call(this,t,typeof n==`number`?n:void 0,r||void 0))}}function Zu(){return!0}function Qu(e){return typeof e==`object`&&!!e&&`type`in e}function $u(e){return e}const ed=[];function td(e,t,n,r){let i;typeof t==`function`&&typeof n!=`function`?(r=n,n=t):i=t;let a=Ku(i),o=r?-1:1;s(e,void 0,[])();function s(e,i,c){let l=e&&typeof e==`object`?e:{};if(typeof l.type==`string`){let t=typeof l.tagName==`string`?l.tagName:typeof l.name==`string`?l.name:void 0;Object.defineProperty(u,"name",{value:`node (`+$u(e.type+(t?`<`+t+`>`:``))+`)`})}return u;function u(){let l=ed,u,d,f;if((!t||a(e,i,c[c.length-1]||void 0))&&(l=nd(n(e,c)),l[0]===!1))return l;if(`children`in e&&e.children){let t=e;if(t.children&&l[0]!==`skip`)for(d=(r?t.children.length:-1)+o,f=c.concat(t);d>-1&&d<t.children.length;){let e=t.children[d];if(u=s(e,d,f)(),u[0]===!1)return u;d=typeof u[1]==`number`?u[1]:d+o}}return l}}}function nd(e){return Array.isArray(e)?e:typeof e==`number`?[!0,e]:e==null?ed:[e]}function rd(e,t,n,r){let i,a,o;typeof t==`function`&&typeof n!=`function`?(a=void 0,o=t,i=n):(a=t,o=n,i=r),td(e,a,s,i);function s(e,t){let n=t[t.length-1],r=n?n.children.indexOf(e):void 0;return o(e,r,n)}}const id={}.hasOwnProperty,ad={};function od(e,t){let n=t||ad,r=new Map,i=new Map,a={all:s,applyData:cd,definitionById:r,footnoteById:i,footnoteCounts:new Map,footnoteOrder:[],handlers:{...Au,...n.handlers},one:o,options:n,patch:sd,wrap:ud};return rd(e,function(e){if(e.type===`definition`||e.type===`footnoteDefinition`){let t=e.type===`definition`?r:i,n=String(e.identifier).toUpperCase();t.has(n)||t.set(n,e)}}),a;function o(e,t){let n=e.type,r=a.handlers[n];if(id.call(a.handlers,n)&&r)return r(a,e,t);if(a.options.passThrough&&a.options.passThrough.includes(n)){if(`children`in e){let{children:t,...n}=e,r=Hu(n);return r.children=a.all(e),r}return Hu(e)}return(a.options.unknownHandler||ld)(a,e,t)}function s(e){let t=[];if(`children`in e){let n=e.children,r=-1;for(;++r<n.length;){let i=a.one(n[r],e);if(i){if(r&&n[r-1].type===`break`&&(!Array.isArray(i)&&i.type===`text`&&(i.value=dd(i.value)),!Array.isArray(i)&&i.type===`element`)){let e=i.children[0];e&&e.type===`text`&&(e.value=dd(e.value))}Array.isArray(i)?t.push(...i):t.push(i)}}}return t}}function sd(e,t){e.position&&(t.position=wo(e))}function cd(e,t){let n=t;if(e&&e.data){let t=e.data.hName,r=e.data.hChildren,i=e.data.hProperties;typeof t==`string`&&(n.type===`element`?n.tagName=t:n={type:`element`,tagName:t,properties:{},children:`children`in n?n.children:[n]}),n.type===`element`&&i&&Object.assign(n.properties,Hu(i)),`children`in n&&n.children&&r!=null&&(n.children=r)}return n}function ld(e,t){let n=t.data||{},r=`value`in t&&!(id.call(n,`hProperties`)||id.call(n,`hChildren`))?{type:`text`,value:t.value}:{type:`element`,tagName:`div`,properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function ud(e,t){let n=[],r=-1;for(t&&n.push({type:`text`,value:`
286
+ `});++r<e.length;)r&&n.push({type:`text`,value:`
287
+ `}),n.push(e[r]);return t&&e.length>0&&n.push({type:`text`,value:`
288
+ `}),n}function dd(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function fd(e,t){let n=od(e,t),r=n.one(e,void 0),i=Gu(n),a=Array.isArray(r)?{type:`root`,children:r}:r||{type:`root`,children:[]};return i&&(`children`in a,a.children.push({type:`text`,value:`
289
+ `},i)),a}function pd(e,t){return e&&`run`in e?async function(n,r){let i=fd(n,{file:r,...t});await e.run(i,r)}:function(n,r){return fd(n,{file:r,...e||t})}}function md(e){if(e)throw e}var hd=je(((e,t)=>{var n=Object.prototype.hasOwnProperty,r=Object.prototype.toString,i=Object.defineProperty,a=Object.getOwnPropertyDescriptor,o=function(e){return typeof Array.isArray==`function`?Array.isArray(e):r.call(e)===`[object Array]`},s=function(e){if(!e||r.call(e)!==`[object Object]`)return!1;var t=n.call(e,`constructor`),i=e.constructor&&e.constructor.prototype&&n.call(e.constructor.prototype,`isPrototypeOf`);if(e.constructor&&!t&&!i)return!1;for(var a in e);return a===void 0||n.call(e,a)},c=function(e,t){i&&t.name===`__proto__`?i(e,t.name,{enumerable:!0,configurable:!0,value:t.newValue,writable:!0}):e[t.name]=t.newValue},l=function(e,t){if(t===`__proto__`){if(!n.call(e,t))return;if(a)return a(e,t).value}return e[t]};t.exports=function e(){var t,n,r,i,a,u,d=arguments[0],f=1,p=arguments.length,m=!1;for(typeof d==`boolean`&&(m=d,d=arguments[1]||{},f=2),(d==null||typeof d!=`object`&&typeof d!=`function`)&&(d={});f<p;++f)if(t=arguments[f],t!=null)for(n in t)r=l(d,n),i=l(t,n),d!==i&&(m&&i&&(s(i)||(a=o(i)))?(a?(a=!1,u=r&&o(r)?r:[]):u=r&&s(r)?r:{},c(d,{name:n,newValue:e(m,u,i)})):i!==void 0&&c(d,{name:n,newValue:i}));return d}}));function gd(e){if(typeof e!=`object`||!e)return!1;let t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function _d(){let e=[],t={run:n,use:r};return t;function n(...t){let n=-1,r=t.pop();if(typeof r!=`function`)throw TypeError(`Expected function as last argument, not `+r);i(null,...t);function i(a,...o){let s=e[++n],c=-1;if(a){r(a);return}for(;++c<t.length;)(o[c]===null||o[c]===void 0)&&(o[c]=t[c]);t=o,s?vd(s,i)(...o):r(null,...o)}}function r(n){if(typeof n!=`function`)throw TypeError("Expected `middelware` to be a function, not "+n);return e.push(n),t}}function vd(e,t){let n;return r;function r(...t){let r=e.length>t.length,o;r&&t.push(i);try{o=e.apply(this,t)}catch(e){let t=e;if(r&&n)throw t;return i(t)}r||(o&&o.then&&typeof o.then==`function`?o.then(a,i):o instanceof Error?i(o):a(o))}function i(e,...r){n||(n=!0,t(e,...r))}function a(e){i(null,e)}}const yd={basename:bd,dirname:xd,extname:Sd,join:Cd,sep:`/`};function bd(e,t){if(t!==void 0&&typeof t!=`string`)throw TypeError(`"ext" argument must be a string`);Ed(e);let n=0,r=-1,i=e.length,a;if(t===void 0||t.length===0||t.length>e.length){for(;i--;)if(e.codePointAt(i)===47){if(a){n=i+1;break}}else r<0&&(a=!0,r=i+1);return r<0?``:e.slice(n,r)}if(t===e)return``;let o=-1,s=t.length-1;for(;i--;)if(e.codePointAt(i)===47){if(a){n=i+1;break}}else o<0&&(a=!0,o=i+1),s>-1&&(e.codePointAt(i)===t.codePointAt(s--)?s<0&&(r=i):(s=-1,r=o));return n===r?r=o:r<0&&(r=e.length),e.slice(n,r)}function xd(e){if(Ed(e),e.length===0)return`.`;let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||=!0;return t<0?e.codePointAt(0)===47?`/`:`.`:t===1&&e.codePointAt(0)===47?`//`:e.slice(0,t)}function Sd(e){Ed(e);let t=e.length,n=-1,r=0,i=-1,a=0,o;for(;t--;){let s=e.codePointAt(t);if(s===47){if(o){r=t+1;break}continue}n<0&&(o=!0,n=t+1),s===46?i<0?i=t:a!==1&&(a=1):i>-1&&(a=-1)}return i<0||n<0||a===0||a===1&&i===n-1&&i===r+1?``:e.slice(i,n)}function Cd(...e){let t=-1,n;for(;++t<e.length;)Ed(e[t]),e[t]&&(n=n===void 0?e[t]:n+`/`+e[t]);return n===void 0?`.`:wd(n)}function wd(e){Ed(e);let t=e.codePointAt(0)===47,n=Td(e,!t);return n.length===0&&!t&&(n=`.`),n.length>0&&e.codePointAt(e.length-1)===47&&(n+=`/`),t?`/`+n:n}function Td(e,t){let n=``,r=0,i=-1,a=0,o=-1,s,c;for(;++o<=e.length;){if(o<e.length)s=e.codePointAt(o);else if(s===47)break;else s=47;if(s===47){if(i!==o-1&&a!==1){if(i!==o-1&&a===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(c=n.lastIndexOf(`/`),c!==n.length-1){c<0?(n=``,r=0):(n=n.slice(0,c),r=n.length-1-n.lastIndexOf(`/`)),i=o,a=0;continue}}else if(n.length>0){n=``,r=0,i=o,a=0;continue}}t&&(n=n.length>0?n+`/..`:`..`,r=2)}else n.length>0?n+=`/`+e.slice(i+1,o):n=e.slice(i+1,o),r=o-i-1}i=o,a=0}else s===46&&a>-1?a++:a=-1}return n}function Ed(e){if(typeof e!=`string`)throw TypeError(`Path must be a string. Received `+JSON.stringify(e))}const Dd={cwd:Od};function Od(){return`/`}function kd(e){return!!(typeof e==`object`&&e&&`href`in e&&e.href&&`protocol`in e&&e.protocol&&e.auth===void 0)}function Ad(e){if(typeof e==`string`)e=new URL(e);else if(!kd(e)){let t=TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code=`ERR_INVALID_ARG_TYPE`,t}if(e.protocol!==`file:`){let e=TypeError(`The URL must be of scheme file`);throw e.code=`ERR_INVALID_URL_SCHEME`,e}return jd(e)}function jd(e){if(e.hostname!==``){let e=TypeError(`File URL host must be "localhost" or empty on darwin`);throw e.code=`ERR_INVALID_FILE_URL_HOST`,e}let t=e.pathname,n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){let e=t.codePointAt(n+2);if(e===70||e===102){let e=TypeError(`File URL path must not include encoded / characters`);throw e.code=`ERR_INVALID_FILE_URL_PATH`,e}}return decodeURIComponent(t)}const Md=[`history`,`path`,`basename`,`stem`,`extname`,`dirname`];var Nd=class{constructor(e){let t;t=e?kd(e)?{path:e}:typeof e==`string`||Ld(e)?{value:e}:e:{},this.cwd=`cwd`in t?``:Dd.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let n=-1;for(;++n<Md.length;){let e=Md[n];e in t&&t[e]!==void 0&&t[e]!==null&&(this[e]=e===`history`?[...t[e]]:t[e])}let r;for(r in t)Md.includes(r)||(this[r]=t[r])}get basename(){return typeof this.path==`string`?yd.basename(this.path):void 0}set basename(e){Fd(e,`basename`),Pd(e,`basename`),this.path=yd.join(this.dirname||``,e)}get dirname(){return typeof this.path==`string`?yd.dirname(this.path):void 0}set dirname(e){Id(this.basename,`dirname`),this.path=yd.join(e||``,this.basename)}get extname(){return typeof this.path==`string`?yd.extname(this.path):void 0}set extname(e){if(Pd(e,`extname`),Id(this.dirname,`extname`),e){if(e.codePointAt(0)!==46)throw Error("`extname` must start with `.`");if(e.includes(`.`,1))throw Error("`extname` cannot contain multiple dots")}this.path=yd.join(this.dirname,this.stem+(e||``))}get path(){return this.history[this.history.length-1]}set path(e){kd(e)&&(e=Ad(e)),Fd(e,`path`),this.path!==e&&this.history.push(e)}get stem(){return typeof this.path==`string`?yd.basename(this.path,this.extname):void 0}set stem(e){Fd(e,`stem`),Pd(e,`stem`),this.path=yd.join(this.dirname||``,e+(this.extname||``))}fail(e,t,n){let r=this.message(e,t,n);throw r.fatal=!0,r}info(e,t,n){let r=this.message(e,t,n);return r.fatal=void 0,r}message(e,t,n){let r=new ko(e,t,n);return this.path&&(r.name=this.path+`:`+r.name,r.file=this.path),r.fatal=!1,this.messages.push(r),r}toString(e){return this.value===void 0?``:typeof this.value==`string`?this.value:new TextDecoder(e||void 0).decode(this.value)}};function Pd(e,t){if(e&&e.includes(yd.sep))throw Error("`"+t+"` cannot be a path: did not expect `"+yd.sep+"`")}function Fd(e,t){if(!e)throw Error("`"+t+"` cannot be empty")}function Id(e,t){if(!e)throw Error("Setting `"+t+"` requires `path` to be set too")}function Ld(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}const Rd=(function(e){let t=this.constructor.prototype,n=t[e],r=function(){return n.apply(r,arguments)};return Object.setPrototypeOf(r,t),r});var zd=Pe(hd(),1);const Bd={}.hasOwnProperty,Vd=new class e extends Rd{constructor(){super(`copy`),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=_d()}copy(){let t=new e,n=-1;for(;++n<this.attachers.length;){let e=this.attachers[n];t.use(...e)}return t.data((0,zd.default)(!0,{},this.namespace)),t}data(e,t){return typeof e==`string`?arguments.length===2?(Wd(`data`,this.frozen),this.namespace[e]=t,this):Bd.call(this.namespace,e)&&this.namespace[e]||void 0:e?(Wd(`data`,this.frozen),this.namespace=e,this):this.namespace}freeze(){if(this.frozen)return this;let e=this;for(;++this.freezeIndex<this.attachers.length;){let[t,...n]=this.attachers[this.freezeIndex];if(n[0]===!1)continue;n[0]===!0&&(n[0]=void 0);let r=t.call(e,...n);typeof r==`function`&&this.transformers.use(r)}return this.frozen=!0,this.freezeIndex=1/0,this}parse(e){this.freeze();let t=qd(e),n=this.parser||this.Parser;return Hd(`parse`,n),n(String(t),t)}process(e,t){let n=this;return this.freeze(),Hd(`process`,this.parser||this.Parser),Ud(`process`,this.compiler||this.Compiler),t?r(void 0,t):new Promise(r);function r(r,i){let a=qd(e),o=n.parse(a);n.run(o,a,function(e,t,r){if(e||!t||!r)return s(e);let i=t,a=n.stringify(i,r);Yd(a)?r.value=a:r.result=a,s(e,r)});function s(e,n){e||!n?i(e):r?r(n):t(void 0,n)}}}processSync(e){let t=!1,n;return this.freeze(),Hd(`processSync`,this.parser||this.Parser),Ud(`processSync`,this.compiler||this.Compiler),this.process(e,r),Kd(`processSync`,`process`,t),n;function r(e,r){t=!0,md(e),n=r}}run(e,t,n){Gd(e),this.freeze();let r=this.transformers;return!n&&typeof t==`function`&&(n=t,t=void 0),n?i(void 0,n):new Promise(i);function i(i,a){let o=qd(t);r.run(e,o,s);function s(t,r,o){let s=r||e;t?a(t):i?i(s):n(void 0,s,o)}}}runSync(e,t){let n=!1,r;return this.run(e,t,i),Kd(`runSync`,`run`,n),r;function i(e,t){md(e),r=t,n=!0}}stringify(e,t){this.freeze();let n=qd(t),r=this.compiler||this.Compiler;return Ud(`stringify`,r),Gd(e),r(e,n)}use(e,...t){let n=this.attachers,r=this.namespace;if(Wd(`use`,this.frozen),e!=null){if(typeof e==`function`)s(e,t);else if(typeof e==`object`)Array.isArray(e)?o(e):a(e);else throw TypeError("Expected usable value, not `"+e+"`")}return this;function i(e){if(typeof e==`function`)s(e,[]);else if(typeof e==`object`){if(Array.isArray(e)){let[t,...n]=e;s(t,n)}else a(e)}else throw TypeError("Expected usable value, not `"+e+"`")}function a(e){if(!(`plugins`in e)&&!(`settings`in e))throw Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");o(e.plugins),e.settings&&(r.settings=(0,zd.default)(!0,r.settings,e.settings))}function o(e){let t=-1;if(e!=null){if(Array.isArray(e))for(;++t<e.length;){let n=e[t];i(n)}else throw TypeError("Expected a list of plugins, not `"+e+"`")}}function s(e,t){let r=-1,i=-1;for(;++r<n.length;)if(n[r][0]===e){i=r;break}if(i===-1)n.push([e,...t]);else if(t.length>0){let[r,...a]=t,o=n[i][1];gd(o)&&gd(r)&&(r=(0,zd.default)(!0,o,r)),n[i]=[e,r,...a]}}}}().freeze();function Hd(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `parser`")}function Ud(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `compiler`")}function Wd(e,t){if(t)throw Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function Gd(e){if(!gd(e)||typeof e.type!=`string`)throw TypeError("Expected node, got `"+e+"`")}function Kd(e,t,n){if(!n)throw Error("`"+e+"` finished async. Use `"+t+"` instead")}function qd(e){return Jd(e)?e:new Nd(e)}function Jd(e){return!!(e&&typeof e==`object`&&`message`in e&&`messages`in e)}function Yd(e){return typeof e==`string`||Xd(e)}function Xd(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}const Zd=[],Qd={allowDangerousHtml:!0},$d=/^(https?|ircs?|mailto|xmpp)$/i,ef=[{from:`astPlugins`,id:`remove-buggy-html-in-markdown-parser`},{from:`allowDangerousHtml`,id:`remove-buggy-html-in-markdown-parser`},{from:`allowNode`,id:`replace-allownode-allowedtypes-and-disallowedtypes`,to:`allowElement`},{from:`allowedTypes`,id:`replace-allownode-allowedtypes-and-disallowedtypes`,to:`allowedElements`},{from:`className`,id:`remove-classname`},{from:`disallowedTypes`,id:`replace-allownode-allowedtypes-and-disallowedtypes`,to:`disallowedElements`},{from:`escapeHtml`,id:`remove-buggy-html-in-markdown-parser`},{from:`includeElementIndex`,id:`#remove-includeelementindex`},{from:`includeNodeIndex`,id:`change-includenodeindex-to-includeelementindex`},{from:`linkTarget`,id:`remove-linktarget`},{from:`plugins`,id:`change-plugins-to-remarkplugins`,to:`remarkPlugins`},{from:`rawSourcePos`,id:`#remove-rawsourcepos`},{from:`renderers`,id:`change-renderers-to-components`,to:`components`},{from:`source`,id:`change-source-to-children`,to:`children`},{from:`sourcePos`,id:`#remove-sourcepos`},{from:`transformImageUri`,id:`#add-urltransform`,to:`urlTransform`},{from:`transformLinkUri`,id:`#add-urltransform`,to:`urlTransform`}];function tf(e){let t=nf(e),n=rf(e);return af(t.runSync(t.parse(n),n),e)}function nf(e){let t=e.rehypePlugins||Zd,n=e.remarkPlugins||Zd,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...Qd}:Qd;return Vd().use(tu).use(n).use(pd,r).use(t)}function rf(e){let t=e.children||``,n=new Nd;return typeof t==`string`?n.value=t:``+t,n}function af(r,i){let a=i.allowedElements,o=i.allowElement,s=i.components,c=i.disallowedElements,l=i.skipHtml,u=i.unwrapDisallowed,d=i.urlTransform||of;for(let e of ef)Object.hasOwn(i,e.from)&&``+e.from+(e.to?"use `"+e.to+"` instead":`remove it`)+e.id;return rd(r,f),Io(r,{Fragment:e,components:s,ignoreInvalidStyle:!0,jsx:t,jsxs:n,passKeys:!0,passNode:!0});function f(e,t,n){if(e.type===`raw`&&n&&typeof t==`number`)return l?n.children.splice(t,1):n.children[t]={type:`text`,value:e.value},t;if(e.type===`element`){let t;for(t in is)if(Object.hasOwn(is,t)&&Object.hasOwn(e.properties,t)){let n=e.properties[t],r=is[t];(r===null||r.includes(e.tagName))&&(e.properties[t]=d(String(n||``),t,e))}}if(e.type===`element`){let r=a?!a.includes(e.tagName):c?c.includes(e.tagName):!1;if(!r&&o&&typeof t==`number`&&(r=!o(e,t,n)),r&&n&&typeof t==`number`)return u&&e.children?n.children.splice(t,1,...e.children):n.children.splice(t,1),t}}}function of(e){let t=e.indexOf(`:`),n=e.indexOf(`?`),r=e.indexOf(`#`),i=e.indexOf(`/`);return t===-1||i!==-1&&t>i||n!==-1&&t>n||r!==-1&&t>r||$d.test(e.slice(0,t))?e:``}const sf={enter:{defList:cf,defListTerm:uf,defListDescription:ff},exit:{defList:lf,defListTerm:df,defListDescription:pf}};function cf(e){this.enter({type:`defList`,children:[]},e)}function lf(e){this.exit(e)}function uf(e){this.enter({type:`defListTerm`,children:[]},e)}function df(e){this.exit(e)}function ff(e){this.enter({type:`defListDescription`,spread:!!e._loose,children:[]},e)}function pf(e){this.exit(e)}const mf={join:[(e,t,n,r)=>{if(n.type===`defList`)return e.type===`defListDescription`&&t.type===`defListTerm`||`spread`in t&&t.spread?1:0}],unsafe:[{character:`:`,atBreak:!0,after:`(?:[ \r
290
+ ])`}],handlers:{defList:(e,t,n,r)=>{let i=n.enter(`defList`),a=n.containerFlow(e,r);return i(),a},defListTerm:(e,t,n,r)=>{let i=n.enter(`defListTerm`),a=n.enter(`phrasing`),o=n.containerPhrasing(e,{...r,before:`
291
+ `,after:`
292
+ `});return a(),i(),o},defListDescription:(e,t,n,r)=>{let i=n.enter(`defListDescription`),a=n.indentLines(n.containerFlow(e,r),o);return i(),a;function o(e,t,n){return t?n?``:` `.repeat(4)+e:n?`:`+` `.repeat(3):`:`+` `.repeat(3)+e}}}};function hf(e,t,n){let r={type:String(e)};return n==null&&(typeof t==`string`||Array.isArray(t))?n=t:Object.assign(r,t),Array.isArray(n)?r.children=n:n!=null&&(r.value=String(n)),r}const $={defList:`defList`,defListTerm:`defListTerm`,defListDescriptionMarker:`defListDescriptionMarker`,defListDescriptionPrefix:`defListDescriptionPrefix`,defListDescriptionPrefixWhitespace:`defListDescriptionPrefixWhitespace`,defListDescription:`defListDescription`};function gf(e){let t=e._tokenizer.events,n,r,i;for(let e=t.length-1;e>=0;e--){let a=t[e];if(a[1].type===`paragraph`){if(a[0]===`exit`)r=e;else{n=e,i=a[1].start.offset;for(let n=e-1;n>=0;n--){let e=t[n];if(e[1].type!==`content`){if(e[1].type===`linePrefix`){i=e[1].start.offset;break}break}}break}}}return n!=null&&r!=null&&i!=null?{flowEvents:t,paragraph:{enterIndex:n,exitIndex:r,startOffset:i}}:{flowEvents:t}}function _f(e){let t=e._tokenizer.events,n=[],r=[],i=[],a=[],o,s,c,l,u=[],d=[];for(let f=t.length-1;f>=0;f--){let p=t[f],m=p[1];if(m.start.offset>=e.end.offset){a.push(f);continue}switch(m.type){case`paragraph`:o==null&&p[0]===`enter`?o=f:s==null&&p[0]===`exit`&&(s=f);break;case`content`:p[0]===`enter`?c=f:p[0]===`exit`&&(l=f);break;default:e.start.offset<=m.start.offset&&m.end.offset<=e.end.offset?(m.type===`chunkText`&&(m.previous&&m.previous.start.offset<e.start.offset&&(m.previous.next=void 0,m.previous=void 0),m.next&&e.end.offset<m.next.end.offset&&(m.next.previous=void 0,m.next=void 0)),o==null&&s==null?r.unshift(p):o==null&&s!=null?i.unshift(p):n.unshift(p),a.push(f)):(o==null&&s!=null&&u.unshift(p),c==null&&l!=null&&d.unshift(p))}if(m.end.offset<=e.start.offset)break}s!=null&&(u.length>=1?t[s][1].end=Object.assign({},u[u.length-1][1].end):o!=null&&a.push(o,s)),l!=null&&(d.length>=1?t[l][1].end=Object.assign({},d[d.length-1][1].end):c!=null&&a.push(c,l)),a.sort((e,t)=>t-e);for(let e of a)J(t,e,1,[]);return{leadingChildEvents:n,termChildEvents:i,trailingChildEvents:r}}function vf(e,t,n){let r=e[t][1];r.previous!=null&&(r.previous.next=void 0,r.previous=void 0);let i=_f(r),a=e[n][2],o=[];if(i.termChildEvents.length>0){let e={type:$.defListTerm,start:Object.assign({},r.start),end:Object.assign({},r.end)};o.push([`enter`,e,a]),o.push(...i.leadingChildEvents),o.push(...i.termChildEvents),o.push(...i.trailingChildEvents),o.push([`exit`,e,a])}else o.push(...i.leadingChildEvents),o.push(...i.trailingChildEvents);return J(e,n,1,[]),J(e,t,1,o),e}const yf=new Set([`linePrefix`,`blockQuotePrefix`,`blockQuoteMarker`,`blockQuotePrefixWhitespace`]),bf={name:`defList`,tokenize:kf,continuation:{tokenize:Af},resolveAll:wf,exit:Nf},xf={tokenize:Mf,partial:!0},Sf={tokenize:jf,partial:!0},Cf={document:{58:bf,null:[]}};function wf(e,t){let n=0;for(;n<e.length;){let r=e[n];r[0]===`enter`&&r[1].type===$.defList&&(n+=Tf(n,e,t)),n++}let r=[];for(n=0;n<e.length;){let t=e[n];if(t[0]===`enter`&&t[1].type===$.defList&&r.push(t[1]),t[0]===`exit`&&t[1].type===$.defList){let i=!1,a=1;for(;n+a<e.length;){let t=e[n+a];if(t[0]===`enter`&&t[1].type===$.defList){i=!0;break}if(!yf.has(t[1].type))break;a++}i?(t[1].end=Object.assign({},e[n+a][1].end),J(e,n,a+1,[]),n-=a):t[1]=r.pop()}n++}return e}function Tf(e,t,n){let r=0,i,a=!0,o=e+1;for(o+=Df(e,t);o<t.length;){let l=t[o];if(l[0]===`enter`&&l[1].type===$.defList&&(o+=Tf(o,t,n)),l[0]===`exit`&&l[1].type===$.defList){o+=c(o,t),i=void 0,r=o-e;break}if(l[0]===`exit`&&l[1].type===$.defListDescriptionPrefix&&(a||(o+=c(o,t),i=void 0),o+=s(o,t,l[1]._loose),a=!1),l[0]===`enter`&&l[1].type===$.defListDescriptionPrefix){if(t[o-1][1].type===`lineEndingBlank`)l[1]._loose=!0;else if(t[o-1][1].type===`chunkFlow`){let e=t[o-1][1]._tokenizer.events;e[e.length-1][1].type===`lineEndingBlank`&&(l[1]._loose=!0)}}o++}return r;function s(e,t,r){return i={type:$.defListDescription,start:Object.assign({},t[e+1][1].start),end:Object.assign({},t[e+1][1].end),_loose:r},J(t,e+1,0,[[`enter`,i,n]]),1}function c(e,t){return i.end=Object.assign({},t[e-1][1].end),J(t,e,0,[[`exit`,i,n]]),1}}function Ef(e,t,n,r){let i=e[t][2],a=gf(e[t][1]).paragraph;if(a==null){let t=e[n],r={type:$.defListTerm,start:Object.assign({},t[1].start),end:Object.assign({},t[1].start)};return J(e,n,0,[[`enter`,r,i],[`exit`,r,i]]),n}let o=e[t][2].parser.lazy,s=0,c;for(let n=t;n>=0;n--){let t=e[n];if(t[1].type!==`chunkFlow`){s=n+1;break}if(t[1].start.offset<a.startOffset){s=n+1;break}if(t[0]===`exit`){if(r&&!o[t[1].start.line]){s=n+1;break}c=n}else vf(e,n,c),c=void 0}return s}function Df(e,t){let n,r,i;for(let a=e-1;a>=0;a--)if(!yf.has(t[a][1].type)){if(a===e-1&&t[a][1].type===`blockQuote`&&t[a][0]===`exit`){i=a,r=t[a];continue}t[a][1].type===`chunkFlow`&&(n=a);break}let a=t[e];J(t,e,1,[]),i!=null&&J(t,i,1,[]);let o=Ef(t,n,e,r!=null);return i!=null&&(r[1].end=Object.assign({},t[o-1][1].end),J(t,o,0,[r]),o+=1),a[1].start=Object.assign({},t[o][1].start),J(t,o,0,[a]),o-e}function Of(e){if(e.length<=1)return!1;let t=e[e.length-1][2].parser.lazy,n=!1,r,i;for(let t=e.length-1;t>=0;t--){let a=e[t];if(!yf.has(a[1].type)){if(t===e.length-1&&a[1].type===`blockQuote`&&a[0]===`exit`){n=!0;continue}if(a[1].type===`chunkFlow`)a[0]===`enter`&&(i??=a[1]._tokenizer?.events,r=a);else break}}if(i!=null&&r!=null){let e=0;for(let a=i.length-1;a>=0;a--){let o=i[a],s=o[1];if(s.start.offset<r[1].start.offset)break;if(o[0]===`enter`&&s.type===`lineEndingBlank`){if(e>=1)break;e++}if(s.type!==`lineEnding`&&s.type!==`linePrefix`&&s.type!==`lineEndingBlank`&&s.type!==`content`)return n&&!t[s.end.line]?!1:s.type===`paragraph`||s.type===`chunkContent`||s.type===`tableHead`||s.type===`tableRow`}}return!1}function kf(e,t,n){let r=this;r.containerState??={};let i=r.events[r.events.length-1],a=i&&i[1].type===`linePrefix`?i[2].sliceSerialize(i[1],!0).length:0;if(r.containerState.type==null){if(Of(r.events))e.enter($.defList,{_container:!0}),r.containerState.type=$.defList;else return n}return o;function o(t){return t===58?(e.enter($.defListDescriptionPrefix,{_loose:r.containerState?.lastBlankLine}),r.containerState.lastBlankLine=void 0,e.enter($.defListDescriptionMarker),e.consume(t),e.exit($.defListDescriptionMarker),e.check(Ws,s,e.attempt(xf,l,c))):n(t)}function s(e){return r.containerState.initialBlankLine=!0,a++,l(e)}function c(t){return Z(t)?(e.enter($.defListDescriptionPrefixWhitespace),e.consume(t),e.exit($.defListDescriptionPrefixWhitespace),l):n(t)}function l(n){return r.containerState.size=a+r.sliceSerialize(e.exit($.defListDescriptionPrefix),!0).length,t(n)}}function Af(e,t,n){let r=this;return r.containerState._closeFlow=void 0,e.check(Ws,i,a);function i(n){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines??r.containerState.initialBlankLine,r.containerState.lastBlankLine=!0,Q(e,t,`linePrefix`,r.containerState.size+1)(n)}function a(n){return r.containerState.furtherBlankLines??!Z(n)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(n)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,r.containerState.lastBlankLine=void 0,e.attempt(Sf,t,o)(n))}function o(i){return r.containerState._closeFlow=!0,r.interrupt=void 0,Q(e,e.attempt(bf,t,n),`linePrefix`,r.parser.constructs.disable.null!=null&&r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(i)}}function jf(e,t,n){let r=this;return Q(e,i,`linePrefix`,r.containerState.size+1);function i(e){let i=r.events[r.events.length-1];return i&&i[1].type===`linePrefix`&&i[2].sliceSerialize(i[1],!0).length===r.containerState.size?t(e):n(e)}}function Mf(e,t,n){let r=this;return Q(e,i,$.defListDescriptionPrefixWhitespace,r.parser.constructs.disable.null!=null&&r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:5);function i(e){let i=r.events[r.events.length-1];return!Z(e)&&i&&i[1].type===$.defListDescriptionPrefixWhitespace?t(e):n(e)}}function Nf(e){e.exit($.defList)}const Pf=(e,t,n)=>{let r=e.all(t),i=[];for(let e=0;e<r.length;e++)i.push(hf(`text`,`
293
+ `)),i.push(r[e]);r.length>0&&i.push(hf(`text`,`
294
+ `));let a={type:`element`,tagName:`dl`,children:i,properties:{}};return e.patch(t,a),a},Ff=(e,t,n)=>{let r={type:`element`,tagName:`dt`,properties:{},children:e.all(t)};return e.patch(t,r),r},If=(e,t,n)=>{let r=[],i=e.all(t);for(let e=0;e<i.length;e++){let n=i[e];(t.spread||e!==0||n.type!==`element`||n.tagName!==`p`)&&r.push(hf(`text`,`
295
+ `)),!t.spread&&n.type===`element`&&n.tagName===`p`?r.push(...n.children):r.push(n)}let a=r[r.length-1];a&&(t.spread||!(`tagName`in a)||a.tagName!==`p`)&&r.push(hf(`text`,`
296
+ `));let o={type:`element`,tagName:`dd`,properties:{},children:r};return e.patch(t,o),o},Lf={[$.defList]:Pf,[$.defListTerm]:Ff,[$.defListDescription]:If},Rf=Ku([`break`,`delete`,`emphasis`,`footnote`,`footnoteReference`,`image`,`imageReference`,`inlineCode`,`inlineMath`,`link`,`linkReference`,`mdxJsxTextElement`,`mdxTextExpression`,`strong`,`text`,`textDirective`]);function zf(){let e=this.data(),t=e.micromarkExtensions??=[],n=e.fromMarkdownExtensions??=[],r=e.toMarkdownExtensions??=[];t.push(Cf),n.push(sf),r.push(mf)}function Bf(e,t){let n=String(e);if(typeof t!=`string`)throw TypeError(`Expected character`);let r=0,i=n.indexOf(t);for(;i!==-1;)r++,i=n.indexOf(t,i+t.length);return r}const Vf=`AElig.AMP.Aacute.Acirc.Agrave.Aring.Atilde.Auml.COPY.Ccedil.ETH.Eacute.Ecirc.Egrave.Euml.GT.Iacute.Icirc.Igrave.Iuml.LT.Ntilde.Oacute.Ocirc.Ograve.Oslash.Otilde.Ouml.QUOT.REG.THORN.Uacute.Ucirc.Ugrave.Uuml.Yacute.aacute.acirc.acute.aelig.agrave.amp.aring.atilde.auml.brvbar.ccedil.cedil.cent.copy.curren.deg.divide.eacute.ecirc.egrave.eth.euml.frac12.frac14.frac34.gt.iacute.icirc.iexcl.igrave.iquest.iuml.laquo.lt.macr.micro.middot.nbsp.not.ntilde.oacute.ocirc.ograve.ordf.ordm.oslash.otilde.ouml.para.plusmn.pound.quot.raquo.reg.sect.shy.sup1.sup2.sup3.szlig.thorn.times.uacute.ucirc.ugrave.uml.uuml.yacute.yen.yuml`.split(`.`),Hf={0:`�`,128:`€`,130:`‚`,131:`ƒ`,132:`„`,133:`…`,134:`†`,135:`‡`,136:`ˆ`,137:`‰`,138:`Š`,139:`‹`,140:`Œ`,142:`Ž`,145:`‘`,146:`’`,147:`“`,148:`”`,149:`•`,150:`–`,151:`—`,152:`˜`,153:`™`,154:`š`,155:`›`,156:`œ`,158:`ž`,159:`Ÿ`};function Uf(e){let t=typeof e==`string`?e.charCodeAt(0):e;return t>=48&&t<=57}function Wf(e){let t=typeof e==`string`?e.charCodeAt(0):e;return t>=97&&t<=102||t>=65&&t<=70||t>=48&&t<=57}function Gf(e){let t=typeof e==`string`?e.charCodeAt(0):e;return t>=97&&t<=122||t>=65&&t<=90}function Kf(e){return Gf(e)||Uf(e)}const qf=[``,`Named character references must be terminated by a semicolon`,`Numeric character references must be terminated by a semicolon`,`Named character references cannot be empty`,`Numeric character references cannot be empty`,`Named character references must be known`,`Numeric character references cannot be disallowed`,`Numeric character references cannot be outside the permissible Unicode range`];function Jf(e,t){let n=t||{},r=typeof n.additional==`string`?n.additional.charCodeAt(0):n.additional,i=[],a=0,o=-1,s=``,c,l;n.position&&(`start`in n.position||`indent`in n.position?(l=n.position.indent,c=n.position.start):c=n.position);let u=(c?c.line:0)||1,d=(c?c.column:0)||1,f=m(),p;for(a--;++a<=e.length;)if(p===10&&(d=(l?l[o]:0)||1),p=e.charCodeAt(a),p===38){let t=e.charCodeAt(a+1);if(t===9||t===10||t===12||t===32||t===38||t===60||Number.isNaN(t)||r&&t===r){s+=String.fromCharCode(p),d++;continue}let o=a+1,c=o,l=o,u;if(t===35){l=++c;let t=e.charCodeAt(l);t===88||t===120?(u=`hexadecimal`,l=++c):u=`decimal`}else u=`named`;let _=``,v=``,y=``,b=u===`named`?Kf:u===`decimal`?Uf:Wf;for(l--;++l<=e.length;){let t=e.charCodeAt(l);if(!b(t))break;y+=String.fromCharCode(t),u===`named`&&Vf.includes(y)&&(_=y,v=ds(y))}let x=e.charCodeAt(l)===59;if(x){l++;let e=u===`named`&&ds(y);e&&(_=y,v=e)}let S=1+l-o,C=``;if(!(!x&&n.nonTerminated===!1)){if(!y)u!==`named`&&h(4,S);else if(u===`named`){if(x&&!v)h(5,1);else if(_!==y&&(l=c+_.length,S=1+l-c,x=!1),!x){let t=_?1:3;if(n.attribute){let n=e.charCodeAt(l);n===61?(h(t,S),v=``):Kf(n)?v=``:h(t,S)}else h(t,S)}C=v}else{x||h(2,S);let e=Number.parseInt(y,u===`hexadecimal`?16:10);if(Yf(e))h(7,S),C=`�`;else if(e in Hf)h(6,S),C=Hf[e];else{let t=``;Xf(e)&&h(6,S),e>65535&&(e-=65536,t+=String.fromCharCode(e>>>10|55296),e=56320|e&1023),C=t+String.fromCharCode(e)}}}if(C){g(),f=m(),a=l-1,d+=l-o+1,i.push(C);let t=m();t.offset++,n.reference&&n.reference.call(n.referenceContext||void 0,C,{start:f,end:t},e.slice(o-1,l)),f=t}else y=e.slice(o-1,l),s+=y,d+=y.length,a=l-1}else p===10&&(u++,o++,d=0),Number.isNaN(p)?g():(s+=String.fromCharCode(p),d++);return i.join(``);function m(){return{line:u,column:d,offset:a+((c?c.offset:0)||0)}}function h(e,t){let r;n.warning&&(r=m(),r.column+=t,r.offset+=t,n.warning.call(n.warningContext||void 0,qf[e],r,e))}function g(){s&&=(i.push(s),n.text&&n.text.call(n.textContext||void 0,s,{start:f,end:m()}),``)}}function Yf(e){return e>=55296&&e<=57343||e>1114111}function Xf(e){return e>=1&&e<=8||e===11||e>=13&&e<=31||e>=127&&e<=159||e>=64976&&e<=65007||(e&65535)==65535||(e&65535)==65534}const Zf=/["&'<>`]/g,Qf=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,$f=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,ep=/[|\\{}()[\]^$+*?.]/g,tp=new WeakMap;function np(e,t){if(e=e.replace(t.subset?rp(t.subset):Zf,r),t.subset||t.escapeOnly)return e;return e.replace(Qf,n).replace($f,r);function n(e,n,r){return t.format((e.charCodeAt(0)-55296)*1024+e.charCodeAt(1)-56320+65536,r.charCodeAt(n+2),t)}function r(e,n,r){return t.format(e.charCodeAt(0),r.charCodeAt(n+1),t)}}function rp(e){let t=tp.get(e);return t||(t=ip(e),tp.set(e,t)),t}function ip(e){let t=[],n=-1;for(;++n<e.length;)t.push(e[n].replace(ep,`\\$&`));return RegExp(`(?:`+t.join(`|`)+`)`,`g`)}function ap(e){return`&#x`+e.toString(16).toUpperCase()+`;`}function op(e,t){return np(e,Object.assign({format:ap},t))}const sp={}.hasOwnProperty,cp={},lp=/^[^\t\n\r "#'.<=>`}]+$/,up=/^[^\t\n\r "'<=>`}]+$/;function dp(){return{canContainEols:[`textDirective`],enter:{directiveContainer:pp,directiveContainerAttributes:bp,directiveContainerLabel:vp,directiveLeaf:mp,directiveLeafAttributes:bp,directiveText:hp,directiveTextAttributes:bp},exit:{directiveContainer:Ep,directiveContainerAttributeClassValue:Sp,directiveContainerAttributeIdValue:xp,directiveContainerAttributeName:wp,directiveContainerAttributeValue:Cp,directiveContainerAttributes:Tp,directiveContainerLabel:yp,directiveContainerName:_p,directiveLeaf:Ep,directiveLeafAttributeClassValue:Sp,directiveLeafAttributeIdValue:xp,directiveLeafAttributeName:wp,directiveLeafAttributeValue:Cp,directiveLeafAttributes:Tp,directiveLeafName:_p,directiveText:Ep,directiveTextAttributeClassValue:Sp,directiveTextAttributeIdValue:xp,directiveTextAttributeName:wp,directiveTextAttributeValue:Cp,directiveTextAttributes:Tp,directiveTextName:_p}}}function fp(e){let t=e||cp;if(t.quote!==`"`&&t.quote!==`'`&&t.quote!==null&&t.quote!==void 0)throw Error("Invalid quote `"+t.quote+"`, expected `'` or `\"`");return n.peek=Dp,{handlers:{containerDirective:n,leafDirective:n,textDirective:n},unsafe:[{character:`\r`,inConstruct:[`leafDirectiveLabel`,`containerDirectiveLabel`]},{character:`
297
+ `,inConstruct:[`leafDirectiveLabel`,`containerDirectiveLabel`]},{before:`[^:]`,character:`:`,after:`[A-Za-z]`,inConstruct:[`phrasing`]},{atBreak:!0,character:`:`,after:`:`}]};function n(e,t,n,i){let a=n.createTracker(i),o=kp(e),s=n.enter(e.type),c=a.move(o+(e.name||``)),l;if(e.type===`containerDirective`){let t=(e.children||[])[0];l=Op(t)?t:void 0}else l=e;if(l&&l.children&&l.children.length>0){let t=n.enter(`label`),r=`${e.type}Label`,i=n.enter(r);c+=a.move(`[`),c+=a.move(n.containerPhrasing(l,{...a.current(),before:c,after:`]`})),c+=a.move(`]`),i(),t()}if(c+=a.move(r(e,n)),e.type===`containerDirective`){let t=(e.children||[])[0],r=e;Op(t)&&(r=Object.assign({},e,{children:e.children.slice(1)})),r&&r.children&&r.children.length>0&&(c+=a.move(`
298
+ `),c+=a.move(n.containerFlow(r,a.current()))),c+=a.move(`
299
+ `+o)}return s(),c}function r(e,n){let r=e.attributes||{},a=[],o,s,c,l;for(l in r)if(sp.call(r,l)&&r[l]!==void 0&&r[l]!==null){let u=String(r[l]);if(l===`id`)c=t.preferShortcut!==!1&&lp.test(u)?`#`+u:i(`id`,u,e,n);else if(l===`class`){let r=u.split(/[\t\n\r ]+/g),a=[],c=[],l=-1;for(;++l<r.length;)(t.preferShortcut!==!1&&lp.test(r[l])?c:a).push(r[l]);o=a.length>0?i(`class`,a.join(` `),e,n):``,s=c.length>0?`.`+c.join(`.`):``}else a.push(i(l,u,e,n))}return o&&a.unshift(o),s&&a.unshift(s),c&&a.unshift(c),a.length>0?`{`+a.join(` `)+`}`:``}function i(e,n,r,i){if(t.collapseEmptyAttributes!==!1&&!n)return e;if(t.preferUnquoted&&up.test(n))return e+`=`+n;let a=t.quote||i.options.quote||`"`,o=a===`"`?`'`:`"`,s=t.quoteSmart&&Bf(n,a)>Bf(n,o)?o:a,c=r.type===`textDirective`?[s]:[s,`
300
+ `,`\r`];return e+`=`+s+op(n,{subset:c})+s}}function pp(e){gp.call(this,`containerDirective`,e)}function mp(e){gp.call(this,`leafDirective`,e)}function hp(e){gp.call(this,`textDirective`,e)}function gp(e,t){this.enter({type:e,name:``,attributes:{},children:[]},t)}function _p(e){let t=this.stack[this.stack.length-1];t.type===`containerDirective`||t.type===`leafDirective`||t.type,t.name=this.sliceSerialize(e)}function vp(e){this.enter({type:`paragraph`,data:{directiveLabel:!0},children:[]},e)}function yp(e){this.exit(e)}function bp(){this.data.directiveAttributes=[],this.buffer()}function xp(e){this.data.directiveAttributes.push([`id`,Jf(this.sliceSerialize(e),{attribute:!0})])}function Sp(e){this.data.directiveAttributes.push([`class`,Jf(this.sliceSerialize(e),{attribute:!0})])}function Cp(e){let t=this.data.directiveAttributes;t[t.length-1][1]=Jf(this.sliceSerialize(e),{attribute:!0})}function wp(e){this.data.directiveAttributes.push([this.sliceSerialize(e),``])}function Tp(){let e=this.data.directiveAttributes,t={},n=-1;for(;++n<e.length;){let r=e[n];r[0]===`class`&&t.class?t.class+=` `+r[1]:t[r[0]]=r[1]}this.data.directiveAttributes=void 0,this.resume();let r=this.stack[this.stack.length-1];r.type===`containerDirective`||r.type===`leafDirective`||r.type,r.attributes=t}function Ep(e){this.exit(e)}function Dp(){return`:`}function Op(e){return!!(e&&e.type===`paragraph`&&e.data&&e.data.directiveLabel)}function kp(e){let t=0;return e.type===`containerDirective`?(td(e,function(e,n){if(e.type===`containerDirective`){let e=n.length,r=0;for(;e--;)n[e].type===`containerDirective`&&r++;r>t&&(t=r)}}),t+=3):t=e.type===`leafDirective`?2:1,`:`.repeat(t)}function Ap(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m){let h,g;return _;function _(t){return e.enter(r),e.enter(i),e.consume(t),e.exit(i),v}function v(t){return t===35?(h=o,y(t)):t===46?(h=s,y(t)):m&&Z(t)?Q(e,v,`whitespace`)(t):!m&&X(t)?wc(e,v)(t):t===null||Y(t)||Ds(t)||Es(t)&&t!==45&&t!==95?A(t):(e.enter(a),e.enter(c),e.consume(t),S)}function y(t){let n=h+`Marker`;return e.enter(a),e.enter(h),e.enter(n),e.consume(t),e.exit(n),b}function b(t){if(t===null||t===34||t===35||t===39||t===46||t===60||t===61||t===62||t===96||t===125||X(t))return n(t);let r=h+`Value`;return e.enter(r),e.consume(t),x}function x(t){if(t===null||t===34||t===39||t===60||t===61||t===62||t===96)return n(t);if(t===35||t===46||t===125||X(t)){let n=h+`Value`;return e.exit(n),e.exit(h),e.exit(a),v(t)}return e.consume(t),x}function S(t){return t===null||Y(t)||Ds(t)||Es(t)&&t!==45&&t!==46&&t!==58&&t!==95?(e.exit(c),m&&Z(t)?Q(e,C,`whitespace`)(t):!m&&X(t)?wc(e,C)(t):C(t)):(e.consume(t),S)}function C(t){return t===61?(e.enter(l),e.consume(t),e.exit(l),w):(e.exit(a),v(t))}function w(t){return t===null||t===60||t===61||t===62||t===96||t===125||m&&Y(t)?n(t):t===34||t===39?(e.enter(u),e.enter(f),e.consume(t),e.exit(f),g=t,E):m&&Z(t)?Q(e,w,`whitespace`)(t):!m&&X(t)?wc(e,w)(t):(e.enter(d),e.enter(p),e.consume(t),g=void 0,T)}function T(t){return t===null||t===34||t===39||t===60||t===61||t===62||t===96?n(t):t===125||X(t)?(e.exit(p),e.exit(d),e.exit(a),v(t)):(e.consume(t),T)}function E(t){return t===g?(e.enter(f),e.consume(t),e.exit(f),e.exit(u),e.exit(a),k):(e.enter(d),D(t))}function D(t){return t===g?(e.exit(d),E(t)):t===null?n(t):Y(t)?m?n(t):wc(e,D)(t):(e.enter(p),e.consume(t),O)}function O(t){return t===g||t===null||Y(t)?(e.exit(p),D(t)):(e.consume(t),O)}function k(e){return e===125||X(e)?v(e):A(e)}function A(a){return a===125?(e.enter(i),e.consume(a),e.exit(i),e.exit(r),t):n(a)}}function jp(e,t,n,r,i,a,o){let s=0,c=0,l;return u;function u(t){return e.enter(r),e.enter(i),e.consume(t),e.exit(i),d}function d(n){return n===93?(e.enter(i),e.consume(n),e.exit(i),e.exit(r),t):(e.enter(a),f(n))}function f(t){if(t===93&&!c)return h(t);let n=e.enter(`chunkText`,{_contentTypeTextTrailing:!0,contentType:`text`,previous:l});return l&&(l.next=n),l=n,p(t)}function p(t){return t===null||s>999||t===91&&++c>32?n(t):t===93&&!c--?(e.exit(`chunkText`),h(t)):Y(t)?o?n(t):(e.consume(t),e.exit(`chunkText`),f):(e.consume(t),t===92?m:p)}function m(t){return t===91||t===92||t===93?(e.consume(t),s++,p):p(t)}function h(n){return e.exit(a),e.enter(i),e.consume(n),e.exit(i),e.exit(r),t}}function Mp(e,t,n,r){let i=this;return a;function a(t){return t===null||Y(t)||Es(t)||Ds(t)?n(t):(e.enter(r),e.consume(t),o)}function o(a){return a===null||Y(a)||Ds(a)||Es(a)&&a!==45&&a!==95?(e.exit(r),i.previous===45||i.previous===95?n(a):t(a)):(e.consume(a),o)}}const Np={tokenize:Lp,concrete:!0},Pp={tokenize:Rp,partial:!0},Fp={tokenize:zp,partial:!0},Ip={tokenize:Bp,partial:!0};function Lp(e,t,n){let r=this,i=r.events[r.events.length-1],a=i&&i[1].type===`linePrefix`?i[2].sliceSerialize(i[1],!0).length:0,o=0,s;return c;function c(t){return e.enter(`directiveContainer`),e.enter(`directiveContainerFence`),e.enter(`directiveContainerSequence`),l(t)}function l(t){return t===58?(e.consume(t),o++,l):o<3?n(t):(e.exit(`directiveContainerSequence`),Mp.call(r,e,u,n,`directiveContainerName`)(t))}function u(t){return t===91?e.attempt(Pp,d,d)(t):d(t)}function d(t){return t===123?e.attempt(Fp,f,f)(t):f(t)}function f(t){return Q(e,p,`whitespace`)(t)}function p(i){return e.exit(`directiveContainerFence`),i===null?C(i):Y(i)?r.interrupt?t(i):e.attempt(Ip,m,C)(i):n(i)}function m(t){return t===null?C(t):Y(t)?e.check(Ip,y,C)(t):(e.enter(`directiveContainerContent`),h(t))}function h(t){return e.attempt({tokenize:w,partial:!0},S,a?Q(e,g,`linePrefix`,a+1):g)(t)}function g(t){return t===null?S(t):Y(t)?e.check(Ip,v,S)(t):v(t)}function _(t){if(t===null){let n=e.exit(`chunkDocument`);return r.parser.lazy[n.start.line]=!1,S(t)}return Y(t)?e.check(Ip,b,x)(t):(e.consume(t),_)}function v(t){let n=e.enter(`chunkDocument`,{contentType:`document`,previous:s});return s&&(s.next=n),s=n,_(t)}function y(t){return e.enter(`directiveContainerContent`),h(t)}function b(t){e.consume(t);let n=e.exit(`chunkDocument`);return r.parser.lazy[n.start.line]=!1,h}function x(t){let n=e.exit(`chunkDocument`);return r.parser.lazy[n.start.line]=!1,S(t)}function S(t){return e.exit(`directiveContainerContent`),C(t)}function C(n){return e.exit(`directiveContainer`),t(n)}function w(e,t,n){let i=0;return Q(e,a,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4);function a(t){return e.enter(`directiveContainerFence`),e.enter(`directiveContainerSequence`),s(t)}function s(t){return t===58?(e.consume(t),i++,s):i<o?n(t):(e.exit(`directiveContainerSequence`),Q(e,c,`whitespace`)(t))}function c(r){return r===null||Y(r)?(e.exit(`directiveContainerFence`),t(r)):n(r)}}}function Rp(e,t,n){return jp(e,t,n,`directiveContainerLabel`,`directiveContainerLabelMarker`,`directiveContainerLabelString`,!0)}function zp(e,t,n){return Ap(e,t,n,`directiveContainerAttributes`,`directiveContainerAttributesMarker`,`directiveContainerAttribute`,`directiveContainerAttributeId`,`directiveContainerAttributeClass`,`directiveContainerAttributeName`,`directiveContainerAttributeInitializerMarker`,`directiveContainerAttributeValueLiteral`,`directiveContainerAttributeValue`,`directiveContainerAttributeValueMarker`,`directiveContainerAttributeValueData`,!0)}function Bp(e,t,n){let r=this;return i;function i(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),a}function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}const Vp={tokenize:Wp},Hp={tokenize:Gp,partial:!0},Up={tokenize:Kp,partial:!0};function Wp(e,t,n){let r=this;return i;function i(t){return e.enter(`directiveLeaf`),e.enter(`directiveLeafSequence`),e.consume(t),a}function a(t){return t===58?(e.consume(t),e.exit(`directiveLeafSequence`),Mp.call(r,e,o,n,`directiveLeafName`)):n(t)}function o(t){return t===91?e.attempt(Hp,s,s)(t):s(t)}function s(t){return t===123?e.attempt(Up,c,c)(t):c(t)}function c(t){return Q(e,l,`whitespace`)(t)}function l(r){return r===null||Y(r)?(e.exit(`directiveLeaf`),t(r)):n(r)}}function Gp(e,t,n){return jp(e,t,n,`directiveLeafLabel`,`directiveLeafLabelMarker`,`directiveLeafLabelString`,!0)}function Kp(e,t,n){return Ap(e,t,n,`directiveLeafAttributes`,`directiveLeafAttributesMarker`,`directiveLeafAttribute`,`directiveLeafAttributeId`,`directiveLeafAttributeClass`,`directiveLeafAttributeName`,`directiveLeafAttributeInitializerMarker`,`directiveLeafAttributeValueLiteral`,`directiveLeafAttributeValue`,`directiveLeafAttributeValueMarker`,`directiveLeafAttributeValueData`,!0)}const qp={tokenize:Zp,previous:Xp},Jp={tokenize:Qp,partial:!0},Yp={tokenize:$p,partial:!0};function Xp(e){return e!==58||this.events[this.events.length-1][1].type===`characterEscape`}function Zp(e,t,n){let r=this;return i;function i(t){return e.enter(`directiveText`),e.enter(`directiveTextMarker`),e.consume(t),e.exit(`directiveTextMarker`),Mp.call(r,e,a,n,`directiveTextName`)}function a(t){return t===58?n(t):t===91?e.attempt(Jp,o,o)(t):o(t)}function o(t){return t===123?e.attempt(Yp,s,s)(t):s(t)}function s(n){return e.exit(`directiveText`),t(n)}}function Qp(e,t,n){return jp(e,t,n,`directiveTextLabel`,`directiveTextLabelMarker`,`directiveTextLabelString`)}function $p(e,t,n){return Ap(e,t,n,`directiveTextAttributes`,`directiveTextAttributesMarker`,`directiveTextAttribute`,`directiveTextAttributeId`,`directiveTextAttributeClass`,`directiveTextAttributeName`,`directiveTextAttributeInitializerMarker`,`directiveTextAttributeValueLiteral`,`directiveTextAttributeValue`,`directiveTextAttributeValueMarker`,`directiveTextAttributeValueData`)}function em(){return{text:{58:qp},flow:{58:[Np,Vp]}}}function tm(){let e=this.data(),t=e.micromarkExtensions||=[],n=e.fromMarkdownExtensions||=[],r=e.toMarkdownExtensions||=[];t.push(em()),n.push(dp()),r.push(fp())}function nm(e){if(typeof e!=`string`)throw TypeError(`Expected a string`);return e.replace(/[|\\{}()[\]^$+*?.]/g,`\\$&`).replace(/-/g,`\\x2d`)}function rm(e,t,n){let r=Ku((n||{}).ignore||[]),i=im(t),a=-1;for(;++a<i.length;)td(e,`text`,o);function o(e,t){let n=-1,i;for(;++n<t.length;){let e=t[n],a=i?i.children:void 0;if(r(e,a?a.indexOf(e):void 0,i))return;i=e}if(i)return s(e,t)}function s(e,t){let n=t[t.length-1],r=i[a][0],o=i[a][1],s=0,c=n.children.indexOf(e),l=!1,u=[];r.lastIndex=0;let d=r.exec(e.value);for(;d;){let n=d.index,i={index:d.index,input:d.input,stack:[...t,e]},a=o(...d,i);if(typeof a==`string`&&(a=a.length>0?{type:`text`,value:a}:void 0),a===!1?r.lastIndex=n+1:(s!==n&&u.push({type:`text`,value:e.value.slice(s,n)}),Array.isArray(a)?u.push(...a):a&&u.push(a),s=n+d[0].length,l=!0),!r.global)break;d=r.exec(e.value)}return l?(s<e.value.length&&u.push({type:`text`,value:e.value.slice(s)}),n.children.splice(c,1,...u)):u=[e],c+u.length}}function im(e){let t=[];if(!Array.isArray(e))throw TypeError(`Expected find and replace tuple or list of tuples`);let n=!e[0]||Array.isArray(e[0])?e:[e],r=-1;for(;++r<n.length;){let e=n[r];t.push([am(e[0]),om(e[1])])}return t}function am(e){return typeof e==`string`?new RegExp(nm(e),`g`):e}function om(e){return typeof e==`function`?e:function(){return e}}const sm=`phrasing`,cm=[`autolink`,`link`,`image`,`label`];function lm(){return{transforms:[_m],enter:{literalAutolink:dm,literalAutolinkEmail:fm,literalAutolinkHttp:fm,literalAutolinkWww:fm},exit:{literalAutolink:gm,literalAutolinkEmail:hm,literalAutolinkHttp:pm,literalAutolinkWww:mm}}}function um(){return{unsafe:[{character:`@`,before:`[+\\-.\\w]`,after:`[\\-.\\w]`,inConstruct:sm,notInConstruct:cm},{character:`.`,before:`[Ww]`,after:`[\\-.\\w]`,inConstruct:sm,notInConstruct:cm},{character:`:`,before:`[ps]`,after:`\\/`,inConstruct:sm,notInConstruct:cm}]}}function dm(e){this.enter({type:`link`,title:null,url:``,children:[]},e)}function fm(e){this.config.enter.autolinkProtocol.call(this,e)}function pm(e){this.config.exit.autolinkProtocol.call(this,e)}function mm(e){this.config.exit.data.call(this,e);let t=this.stack[this.stack.length-1];t.type,t.url=`http://`+this.sliceSerialize(e)}function hm(e){this.config.exit.autolinkEmail.call(this,e)}function gm(e){this.exit(e)}function _m(e){rm(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,vm],[/(?<=^|\s|\p{P}|\p{S})([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/gu,ym]],{ignore:[`link`,`linkReference`]})}function vm(e,t,n,r,i){let a=``;if(!Sm(i)||(/^w/i.test(t)&&(n=t+n,t=``,a=`http://`),!bm(n)))return!1;let o=xm(n+r);if(!o[0])return!1;let s={type:`link`,title:null,url:a+t+o[0],children:[{type:`text`,value:t+o[0]}]};return o[1]?[s,{type:`text`,value:o[1]}]:s}function ym(e,t,n,r){return!Sm(r,!0)||/[-\d_]$/.test(n)?!1:{type:`link`,title:null,url:`mailto:`+t+`@`+n,children:[{type:`text`,value:t+`@`+n}]}}function bm(e){let t=e.split(`.`);return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))}function xm(e){let t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(`)`),i=Bf(e,`(`),a=Bf(e,`)`);for(;r!==-1&&i>a;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(`)`),a++;return[e,n]}function Sm(e,t){let n=e.input.charCodeAt(e.index-1);return(e.index===0||Ds(n)||Es(n))&&(!t||n!==47)}Mm.peek=jm;function Cm(){this.buffer()}function wm(e){this.enter({type:`footnoteReference`,identifier:``,label:``},e)}function Tm(){this.buffer()}function Em(e){this.enter({type:`footnoteDefinition`,identifier:``,label:``,children:[]},e)}function Dm(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=vs(this.sliceSerialize(e)).toLowerCase(),n.label=t}function Om(e){this.exit(e)}function km(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=vs(this.sliceSerialize(e)).toLowerCase(),n.label=t}function Am(e){this.exit(e)}function jm(){return`[`}function Mm(e,t,n,r){let i=n.createTracker(r),a=i.move(`[^`),o=n.enter(`footnoteReference`),s=n.enter(`reference`);return a+=i.move(n.safe(n.associationId(e),{after:`]`,before:a})),s(),o(),a+=i.move(`]`),a}function Nm(){return{enter:{gfmFootnoteCallString:Cm,gfmFootnoteCall:wm,gfmFootnoteDefinitionLabelString:Tm,gfmFootnoteDefinition:Em},exit:{gfmFootnoteCallString:Dm,gfmFootnoteCall:Om,gfmFootnoteDefinitionLabelString:km,gfmFootnoteDefinition:Am}}}function Pm(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:Mm},unsafe:[{character:`[`,inConstruct:[`label`,`phrasing`,`reference`]}]};function n(e,n,r,i){let a=r.createTracker(i),o=a.move(`[^`),s=r.enter(`footnoteDefinition`),c=r.enter(`label`);return o+=a.move(r.safe(r.associationId(e),{before:o,after:`]`})),c(),o+=a.move(`]:`),e.children&&e.children.length>0&&(a.shift(4),o+=a.move((t?`
301
+ `:` `)+r.indentLines(r.containerFlow(e,a.current()),t?Im:Fm))),s(),o}}function Fm(e,t,n){return t===0?e:Im(e,t,n)}function Im(e,t,n){return(n?``:` `)+e}const Lm=[`autolink`,`destinationLiteral`,`destinationRaw`,`reference`,`titleQuote`,`titleApostrophe`];Hm.peek=Um;function Rm(){return{canContainEols:[`delete`],enter:{strikethrough:Bm},exit:{strikethrough:Vm}}}function zm(){return{unsafe:[{character:`~`,inConstruct:`phrasing`,notInConstruct:Lm}],handlers:{delete:Hm}}}function Bm(e){this.enter({type:`delete`,children:[]},e)}function Vm(e){this.exit(e)}function Hm(e,t,n,r){let i=n.createTracker(r),a=n.enter(`strikethrough`),o=i.move(`~~`);return o+=n.containerPhrasing(e,{...i.current(),before:o,after:`~`}),o+=i.move(`~~`),a(),o}function Um(){return`~`}function Wm(e){return e.length}function Gm(e,t){let n=t||{},r=(n.align||[]).concat(),i=n.stringLength||Wm,a=[],o=[],s=[],c=[],l=0,u=-1;for(;++u<e.length;){let t=[],r=[],a=-1;for(e[u].length>l&&(l=e[u].length);++a<e[u].length;){let o=Km(e[u][a]);if(n.alignDelimiters!==!1){let e=i(o);r[a]=e,(c[a]===void 0||e>c[a])&&(c[a]=e)}t.push(o)}o[u]=t,s[u]=r}let d=-1;if(typeof r==`object`&&`length`in r)for(;++d<l;)a[d]=qm(r[d]);else{let e=qm(r);for(;++d<l;)a[d]=e}d=-1;let f=[],p=[];for(;++d<l;){let e=a[d],t=``,r=``;e===99?(t=`:`,r=`:`):e===108?t=`:`:e===114&&(r=`:`);let i=n.alignDelimiters===!1?1:Math.max(1,c[d]-t.length-r.length),o=t+`-`.repeat(i)+r;n.alignDelimiters!==!1&&(i=t.length+i+r.length,i>c[d]&&(c[d]=i),p[d]=i),f[d]=o}o.splice(1,0,f),s.splice(1,0,p),u=-1;let m=[];for(;++u<o.length;){let e=o[u],t=s[u];d=-1;let r=[];for(;++d<l;){let i=e[d]||``,o=``,s=``;if(n.alignDelimiters!==!1){let e=c[d]-(t[d]||0),n=a[d];n===114?o=` `.repeat(e):n===99?e%2?(o=` `.repeat(e/2+.5),s=` `.repeat(e/2-.5)):(o=` `.repeat(e/2),s=o):s=` `.repeat(e)}n.delimiterStart!==!1&&!d&&r.push(`|`),n.padding!==!1&&(n.alignDelimiters!==!1||i!==``)&&(n.delimiterStart!==!1||d)&&r.push(` `),n.alignDelimiters!==!1&&r.push(o),r.push(i),n.alignDelimiters!==!1&&r.push(s),n.padding!==!1&&r.push(` `),(n.delimiterEnd!==!1||d!==l-1)&&r.push(`|`)}m.push(n.delimiterEnd===!1?r.join(``).replace(/ +$/,``):r.join(``))}return m.join(`
302
+ `)}function Km(e){return e==null?``:String(e)}function qm(e){let t=typeof e==`string`?e.codePointAt(0):0;return t===67||t===99?99:t===76||t===108?108:t===82||t===114?114:0}function Jm(e,t,n,r){let i=n.enter(`blockquote`),a=n.createTracker(r);a.move(`> `),a.shift(2);let o=n.indentLines(n.containerFlow(e,a.current()),Ym);return i(),o}function Ym(e,t,n){return`>`+(n?``:` `)+e}function Xm(e,t){return Zm(e,t.inConstruct,!0)&&!Zm(e,t.notInConstruct,!1)}function Zm(e,t,n){if(typeof t==`string`&&(t=[t]),!t||t.length===0)return n;let r=-1;for(;++r<t.length;)if(e.includes(t[r]))return!0;return!1}function Qm(e,t,n,r){let i=-1;for(;++i<n.unsafe.length;)if(n.unsafe[i].character===`
303
+ `&&Xm(n.stack,n.unsafe[i]))return/[ \t]/.test(r.before)?``:` `;return`\\
304
+ `}function $m(e,t){let n=String(e),r=n.indexOf(t),i=r,a=0,o=0;if(typeof t!=`string`)throw TypeError(`Expected substring`);for(;r!==-1;)r===i?++a>o&&(o=a):a=1,i=r+t.length,r=n.indexOf(t,i);return o}function eh(e,t){return!!(t.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function th(e){let t=e.options.fence||"`";if(t!=="`"&&t!==`~`)throw Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function nh(e,t,n,r){let i=th(n),a=e.value||``,o=i==="`"?`GraveAccent`:`Tilde`;if(eh(e,n)){let e=n.enter(`codeIndented`),t=n.indentLines(a,rh);return e(),t}let s=n.createTracker(r),c=i.repeat(Math.max($m(a,i)+1,3)),l=n.enter(`codeFenced`),u=s.move(c);if(e.lang){let t=n.enter(`codeFencedLang${o}`);u+=s.move(n.safe(e.lang,{before:u,after:` `,encode:["`"],...s.current()})),t()}if(e.lang&&e.meta){let t=n.enter(`codeFencedMeta${o}`);u+=s.move(` `),u+=s.move(n.safe(e.meta,{before:u,after:`
305
+ `,encode:["`"],...s.current()})),t()}return u+=s.move(`
306
+ `),a&&(u+=s.move(a+`
307
+ `)),u+=s.move(c),l(),u}function rh(e,t,n){return(n?``:` `)+e}function ih(e){let t=e.options.quote||`"`;if(t!==`"`&&t!==`'`)throw Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function ah(e,t,n,r){let i=ih(n),a=i===`"`?`Quote`:`Apostrophe`,o=n.enter(`definition`),s=n.enter(`label`),c=n.createTracker(r),l=c.move(`[`);return l+=c.move(n.safe(n.associationId(e),{before:l,after:`]`,...c.current()})),l+=c.move(`]: `),s(),!e.url||/[\0- \u007F]/.test(e.url)?(s=n.enter(`destinationLiteral`),l+=c.move(`<`),l+=c.move(n.safe(e.url,{before:l,after:`>`,...c.current()})),l+=c.move(`>`)):(s=n.enter(`destinationRaw`),l+=c.move(n.safe(e.url,{before:l,after:e.title?` `:`
308
+ `,...c.current()}))),s(),e.title&&(s=n.enter(`title${a}`),l+=c.move(` `+i),l+=c.move(n.safe(e.title,{before:l,after:i,...c.current()})),l+=c.move(i),s()),o(),l}function oh(e){let t=e.options.emphasis||`*`;if(t!==`*`&&t!==`_`)throw Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function sh(e){return`&#x`+e.toString(16).toUpperCase()+`;`}function ch(e,t,n){let r=Is(e),i=Is(t);return r===void 0?i===void 0?n===`_`?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:r===1?i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}lh.peek=uh;function lh(e,t,n,r){let i=oh(n),a=n.enter(`emphasis`),o=n.createTracker(r),s=o.move(i),c=o.move(n.containerPhrasing(e,{after:i,before:s,...o.current()})),l=c.charCodeAt(0),u=ch(r.before.charCodeAt(r.before.length-1),l,i);u.inside&&(c=sh(l)+c.slice(1));let d=c.charCodeAt(c.length-1),f=ch(r.after.charCodeAt(0),d,i);f.inside&&(c=c.slice(0,-1)+sh(d));let p=o.move(i);return a(),n.attentionEncodeSurroundingInfo={after:f.outside,before:u.outside},s+c+p}function uh(e,t,n){return n.options.emphasis||`*`}function dh(e,t){let n=!1;return rd(e,function(e){if(`value`in e&&/\r?\n|\r/.test(e.value)||e.type===`break`)return n=!0,!1}),!!((!e.depth||e.depth<3)&&os(e)&&(t.options.setext||n))}function fh(e,t,n,r){let i=Math.max(Math.min(6,e.depth||1),1),a=n.createTracker(r);if(dh(e,n)){let t=n.enter(`headingSetext`),r=n.enter(`phrasing`),o=n.containerPhrasing(e,{...a.current(),before:`
309
+ `,after:`
310
+ `});return r(),t(),o+`
311
+ `+(i===1?`=`:`-`).repeat(o.length-(Math.max(o.lastIndexOf(`\r`),o.lastIndexOf(`
312
+ `))+1))}let o=`#`.repeat(i),s=n.enter(`headingAtx`),c=n.enter(`phrasing`);a.move(o+` `);let l=n.containerPhrasing(e,{before:`# `,after:`
313
+ `,...a.current()});return/^[\t ]/.test(l)&&(l=sh(l.charCodeAt(0))+l.slice(1)),l=l?o+` `+l:o,n.options.closeAtx&&(l+=` `+o),c(),s(),l}ph.peek=mh;function ph(e){return e.value||``}function mh(){return`<`}hh.peek=gh;function hh(e,t,n,r){let i=ih(n),a=i===`"`?`Quote`:`Apostrophe`,o=n.enter(`image`),s=n.enter(`label`),c=n.createTracker(r),l=c.move(`![`);return l+=c.move(n.safe(e.alt,{before:l,after:`]`,...c.current()})),l+=c.move(`](`),s(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(s=n.enter(`destinationLiteral`),l+=c.move(`<`),l+=c.move(n.safe(e.url,{before:l,after:`>`,...c.current()})),l+=c.move(`>`)):(s=n.enter(`destinationRaw`),l+=c.move(n.safe(e.url,{before:l,after:e.title?` `:`)`,...c.current()}))),s(),e.title&&(s=n.enter(`title${a}`),l+=c.move(` `+i),l+=c.move(n.safe(e.title,{before:l,after:i,...c.current()})),l+=c.move(i),s()),l+=c.move(`)`),o(),l}function gh(){return`!`}_h.peek=vh;function _h(e,t,n,r){let i=e.referenceType,a=n.enter(`imageReference`),o=n.enter(`label`),s=n.createTracker(r),c=s.move(`![`),l=n.safe(e.alt,{before:c,after:`]`,...s.current()});c+=s.move(l+`][`),o();let u=n.stack;n.stack=[],o=n.enter(`reference`);let d=n.safe(n.associationId(e),{before:c,after:`]`,...s.current()});return o(),n.stack=u,a(),i===`full`||!l||l!==d?c+=s.move(d+`]`):i===`shortcut`?c=c.slice(0,-1):c+=s.move(`]`),c}function vh(){return`!`}yh.peek=bh;function yh(e,t,n){let r=e.value||``,i="`",a=-1;for(;RegExp("(^|[^`])"+i+"([^`]|$)").test(r);)i+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=` `+r+` `);++a<n.unsafe.length;){let e=n.unsafe[a],t=n.compilePattern(e),i;if(e.atBreak)for(;i=t.exec(r);){let e=i.index;r.charCodeAt(e)===10&&r.charCodeAt(e-1)===13&&e--,r=r.slice(0,e)+` `+r.slice(i.index+1)}}return i+r+i}function bh(){return"`"}function xh(e,t){let n=os(e);return!!(!t.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type===`text`&&(n===e.url||`mailto:`+n===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}Sh.peek=Ch;function Sh(e,t,n,r){let i=ih(n),a=i===`"`?`Quote`:`Apostrophe`,o=n.createTracker(r),s,c;if(xh(e,n)){let t=n.stack;n.stack=[],s=n.enter(`autolink`);let r=o.move(`<`);return r+=o.move(n.containerPhrasing(e,{before:r,after:`>`,...o.current()})),r+=o.move(`>`),s(),n.stack=t,r}s=n.enter(`link`),c=n.enter(`label`);let l=o.move(`[`);return l+=o.move(n.containerPhrasing(e,{before:l,after:`](`,...o.current()})),l+=o.move(`](`),c(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(c=n.enter(`destinationLiteral`),l+=o.move(`<`),l+=o.move(n.safe(e.url,{before:l,after:`>`,...o.current()})),l+=o.move(`>`)):(c=n.enter(`destinationRaw`),l+=o.move(n.safe(e.url,{before:l,after:e.title?` `:`)`,...o.current()}))),c(),e.title&&(c=n.enter(`title${a}`),l+=o.move(` `+i),l+=o.move(n.safe(e.title,{before:l,after:i,...o.current()})),l+=o.move(i),c()),l+=o.move(`)`),s(),l}function Ch(e,t,n){return xh(e,n)?`<`:`[`}wh.peek=Th;function wh(e,t,n,r){let i=e.referenceType,a=n.enter(`linkReference`),o=n.enter(`label`),s=n.createTracker(r),c=s.move(`[`),l=n.containerPhrasing(e,{before:c,after:`]`,...s.current()});c+=s.move(l+`][`),o();let u=n.stack;n.stack=[],o=n.enter(`reference`);let d=n.safe(n.associationId(e),{before:c,after:`]`,...s.current()});return o(),n.stack=u,a(),i===`full`||!l||l!==d?c+=s.move(d+`]`):i===`shortcut`?c=c.slice(0,-1):c+=s.move(`]`),c}function Th(){return`[`}function Eh(e){let t=e.options.bullet||`*`;if(t!==`*`&&t!==`+`&&t!==`-`)throw Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function Dh(e){let t=Eh(e),n=e.options.bulletOther;if(!n)return t===`*`?`-`:`*`;if(n!==`*`&&n!==`+`&&n!==`-`)throw Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function Oh(e){let t=e.options.bulletOrdered||`.`;if(t!==`.`&&t!==`)`)throw Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function kh(e){let t=e.options.rule||`*`;if(t!==`*`&&t!==`-`&&t!==`_`)throw Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function Ah(e,t,n,r){let i=n.enter(`list`),a=n.bulletCurrent,o=e.ordered?Oh(n):Eh(n),s=e.ordered?o===`.`?`)`:`.`:Dh(n),c=t&&n.bulletLastUsed?o===n.bulletLastUsed:!1;if(!e.ordered){let t=e.children?e.children[0]:void 0;if((o===`*`||o===`-`)&&t&&(!t.children||!t.children[0])&&n.stack[n.stack.length-1]===`list`&&n.stack[n.stack.length-2]===`listItem`&&n.stack[n.stack.length-3]===`list`&&n.stack[n.stack.length-4]===`listItem`&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(c=!0),kh(n)===o&&t){let t=-1;for(;++t<e.children.length;){let n=e.children[t];if(n&&n.type===`listItem`&&n.children&&n.children[0]&&n.children[0].type===`thematicBreak`){c=!0;break}}}}c&&(o=s),n.bulletCurrent=o;let l=n.containerFlow(e,r);return n.bulletLastUsed=o,n.bulletCurrent=a,i(),l}function jh(e){let t=e.options.listItemIndent||`one`;if(t!==`tab`&&t!==`one`&&t!==`mixed`)throw Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}function Mh(e,t,n,r){let i=jh(n),a=n.bulletCurrent||Eh(n);t&&t.type===`list`&&t.ordered&&(a=(typeof t.start==`number`&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+a);let o=a.length+1;(i===`tab`||i===`mixed`&&(t&&t.type===`list`&&t.spread||e.spread))&&(o=Math.ceil(o/4)*4);let s=n.createTracker(r);s.move(a+` `.repeat(o-a.length)),s.shift(o);let c=n.enter(`listItem`),l=n.indentLines(n.containerFlow(e,s.current()),u);return c(),l;function u(e,t,n){return t?(n?``:` `.repeat(o))+e:(n?a:a+` `.repeat(o-a.length))+e}}function Nh(e,t,n,r){let i=n.enter(`paragraph`),a=n.enter(`phrasing`),o=n.containerPhrasing(e,r);return a(),i(),o}function Ph(e,t,n,r){return(e.children.some(function(e){return Rf(e)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function Fh(e){let t=e.options.strong||`*`;if(t!==`*`&&t!==`_`)throw Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}Ih.peek=Lh;function Ih(e,t,n,r){let i=Fh(n),a=n.enter(`strong`),o=n.createTracker(r),s=o.move(i+i),c=o.move(n.containerPhrasing(e,{after:i,before:s,...o.current()})),l=c.charCodeAt(0),u=ch(r.before.charCodeAt(r.before.length-1),l,i);u.inside&&(c=sh(l)+c.slice(1));let d=c.charCodeAt(c.length-1),f=ch(r.after.charCodeAt(0),d,i);f.inside&&(c=c.slice(0,-1)+sh(d));let p=o.move(i+i);return a(),n.attentionEncodeSurroundingInfo={after:f.outside,before:u.outside},s+c+p}function Lh(e,t,n){return n.options.strong||`*`}function Rh(e,t,n,r){return n.safe(e.value,r)}function zh(e){let t=e.options.ruleRepetition||3;if(t<3)throw Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function Bh(e,t,n){let r=(kh(n)+(n.options.ruleSpaces?` `:``)).repeat(zh(n));return n.options.ruleSpaces?r.slice(0,-1):r}const Vh={blockquote:Jm,break:Qm,code:nh,definition:ah,emphasis:lh,hardBreak:Qm,heading:fh,html:ph,image:hh,imageReference:_h,inlineCode:yh,link:Sh,linkReference:wh,list:Ah,listItem:Mh,paragraph:Nh,root:Ph,strong:Ih,text:Rh,thematicBreak:Bh};function Hh(){return{enter:{table:Uh,tableData:qh,tableHeader:qh,tableRow:Gh},exit:{codeText:Jh,table:Wh,tableData:Kh,tableHeader:Kh,tableRow:Kh}}}function Uh(e){let t=e._align;this.enter({type:`table`,align:t.map(function(e){return e===`none`?null:e}),children:[]},e),this.data.inTable=!0}function Wh(e){this.exit(e),this.data.inTable=void 0}function Gh(e){this.enter({type:`tableRow`,children:[]},e)}function Kh(e){this.exit(e)}function qh(e){this.enter({type:`tableCell`,children:[]},e)}function Jh(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,Yh));let n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function Yh(e,t){return t===`|`?t:e}function Xh(e){let t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,i=t.stringLength,a=n?` `:`|`;return{unsafe:[{character:`\r`,inConstruct:`tableCell`},{character:`
314
+ `,inConstruct:`tableCell`},{atBreak:!0,character:`|`,after:`[ :-]`},{character:`|`,inConstruct:`tableCell`},{atBreak:!0,character:`:`,after:`-`},{atBreak:!0,character:`-`,after:`[:|-]`}],handlers:{inlineCode:f,table:o,tableCell:c,tableRow:s}};function o(e,t,n,r){return l(u(e,n,r),e.align)}function s(e,t,n,r){let i=l([d(e,n,r)]);return i.slice(0,i.indexOf(`
315
+ `))}function c(e,t,n,r){let i=n.enter(`tableCell`),o=n.enter(`phrasing`),s=n.containerPhrasing(e,{...r,before:a,after:a});return o(),i(),s}function l(e,t){return Gm(e,{align:t,alignDelimiters:r,padding:n,stringLength:i})}function u(e,t,n){let r=e.children,i=-1,a=[],o=t.enter(`table`);for(;++i<r.length;)a[i]=d(r[i],t,n);return o(),a}function d(e,t,n){let r=e.children,i=-1,a=[],o=t.enter(`tableRow`);for(;++i<r.length;)a[i]=c(r[i],e,t,n);return o(),a}function f(e,t,n){let r=Vh.inlineCode(e,t,n);return n.stack.includes(`tableCell`)&&(r=r.replace(/\|/g,`\\$&`)),r}}function Zh(){return{exit:{taskListCheckValueChecked:$h,taskListCheckValueUnchecked:$h,paragraph:eg}}}function Qh(){return{unsafe:[{atBreak:!0,character:`-`,after:`[:|-]`}],handlers:{listItem:tg}}}function $h(e){let t=this.stack[this.stack.length-2];t.type,t.checked=e.type===`taskListCheckValueChecked`}function eg(e){let t=this.stack[this.stack.length-2];if(t&&t.type===`listItem`&&typeof t.checked==`boolean`){let e=this.stack[this.stack.length-1];e.type;let n=e.children[0];if(n&&n.type===`text`){let r=t.children,i=-1,a;for(;++i<r.length;){let e=r[i];if(e.type===`paragraph`){a=e;break}}a===e&&(n.value=n.value.slice(1),n.value.length===0?e.children.shift():e.position&&n.position&&typeof n.position.start.offset==`number`&&(n.position.start.column++,n.position.start.offset++,e.position.start=Object.assign({},n.position.start)))}}this.exit(e)}function tg(e,t,n,r){let i=e.children[0],a=typeof e.checked==`boolean`&&i&&i.type===`paragraph`,o=`[`+(e.checked?`x`:` `)+`] `,s=n.createTracker(r);a&&s.move(o);let c=Vh.listItem(e,t,n,{...r,...s.current()});return a&&(c=c.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,l)),c;function l(e){return e+o}}function ng(){return[lm(),Nm(),Rm(),Hh(),Zh()]}function rg(e){return{extensions:[um(),Pm(e),zm(),Xh(e),Qh()]}}const ig={tokenize:vg,partial:!0},ag={tokenize:yg,partial:!0},og={tokenize:bg,partial:!0},sg={tokenize:xg,partial:!0},cg={tokenize:Sg,partial:!0},lg={name:`wwwAutolink`,tokenize:gg,previous:Cg},ug={name:`protocolAutolink`,tokenize:_g,previous:wg},dg={name:`emailAutolink`,tokenize:hg,previous:Tg},fg={};function pg(){return{text:fg}}let mg=48;for(;mg<123;)fg[mg]=dg,mg++,mg===58?mg=65:mg===91&&(mg=97);fg[43]=dg,fg[45]=dg,fg[46]=dg,fg[95]=dg,fg[72]=[dg,ug],fg[104]=[dg,ug],fg[87]=[dg,lg],fg[119]=[dg,lg];function hg(e,t,n){let r=this,i,a;return o;function o(t){return!Eg(t)||!Tg.call(r,r.previous)||Dg(r.events)?n(t):(e.enter(`literalAutolink`),e.enter(`literalAutolinkEmail`),s(t))}function s(t){return Eg(t)?(e.consume(t),s):t===64?(e.consume(t),c):n(t)}function c(t){return t===46?e.check(cg,u,l)(t):t===45||t===95||bs(t)?(a=!0,e.consume(t),c):u(t)}function l(t){return e.consume(t),i=!0,c}function u(o){return a&&i&&ys(r.previous)?(e.exit(`literalAutolinkEmail`),e.exit(`literalAutolink`),t(o)):n(o)}}function gg(e,t,n){let r=this;return i;function i(t){return t!==87&&t!==119||!Cg.call(r,r.previous)||Dg(r.events)?n(t):(e.enter(`literalAutolink`),e.enter(`literalAutolinkWww`),e.check(ig,e.attempt(ag,e.attempt(og,a),n),n)(t))}function a(n){return e.exit(`literalAutolinkWww`),e.exit(`literalAutolink`),t(n)}}function _g(e,t,n){let r=this,i=``,a=!1;return o;function o(t){return(t===72||t===104)&&wg.call(r,r.previous)&&!Dg(r.events)?(e.enter(`literalAutolink`),e.enter(`literalAutolinkHttp`),i+=String.fromCodePoint(t),e.consume(t),s):n(t)}function s(t){if(ys(t)&&i.length<5)return i+=String.fromCodePoint(t),e.consume(t),s;if(t===58){let n=i.toLowerCase();if(n===`http`||n===`https`)return e.consume(t),c}return n(t)}function c(t){return t===47?(e.consume(t),a?l:(a=!0,c)):n(t)}function l(t){return t===null||Ss(t)||X(t)||Ds(t)||Es(t)?n(t):e.attempt(ag,e.attempt(og,u),n)(t)}function u(n){return e.exit(`literalAutolinkHttp`),e.exit(`literalAutolink`),t(n)}}function vg(e,t,n){let r=0;return i;function i(t){return(t===87||t===119)&&r<3?(r++,e.consume(t),i):t===46&&r===3?(e.consume(t),a):n(t)}function a(e){return e===null?n(e):t(e)}}function yg(e,t,n){let r,i,a;return o;function o(t){return t===46||t===95?e.check(sg,c,s)(t):t===null||X(t)||Ds(t)||t!==45&&Es(t)?c(t):(a=!0,e.consume(t),o)}function s(t){return t===95?r=!0:(i=r,r=void 0),e.consume(t),o}function c(e){return i||r||!a?n(e):t(e)}}function bg(e,t){let n=0,r=0;return i;function i(o){return o===40?(n++,e.consume(o),i):o===41&&r<n?a(o):o===33||o===34||o===38||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===60||o===63||o===93||o===95||o===126?e.check(sg,t,a)(o):o===null||X(o)||Ds(o)?t(o):(e.consume(o),i)}function a(t){return t===41&&r++,e.consume(t),i}}function xg(e,t,n){return r;function r(o){return o===33||o===34||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===63||o===95||o===126?(e.consume(o),r):o===38?(e.consume(o),a):o===93?(e.consume(o),i):o===60||o===null||X(o)||Ds(o)?t(o):n(o)}function i(e){return e===null||e===40||e===91||X(e)||Ds(e)?t(e):r(e)}function a(e){return ys(e)?o(e):n(e)}function o(t){return t===59?(e.consume(t),r):ys(t)?(e.consume(t),o):n(t)}}function Sg(e,t,n){return r;function r(t){return e.consume(t),i}function i(e){return bs(e)?n(e):t(e)}}function Cg(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||X(e)}function wg(e){return!ys(e)}function Tg(e){return!(e===47||Eg(e))}function Eg(e){return e===43||e===45||e===46||e===95||bs(e)}function Dg(e){let t=e.length,n=!1;for(;t--;){let r=e[t][1];if((r.type===`labelLink`||r.type===`labelImage`)&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const Og={tokenize:Ig,partial:!0};function kg(){return{document:{91:{name:`gfmFootnoteDefinition`,tokenize:Ng,continuation:{tokenize:Pg},exit:Fg}},text:{91:{name:`gfmFootnoteCall`,tokenize:Mg},93:{name:`gfmPotentialFootnoteCall`,add:`after`,tokenize:Ag,resolveTo:jg}}}}function Ag(e,t,n){let r=this,i=r.events.length,a=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),o;for(;i--;){let e=r.events[i][1];if(e.type===`labelImage`){o=e;break}if(e.type===`gfmFootnoteCall`||e.type===`labelLink`||e.type===`label`||e.type===`image`||e.type===`link`)break}return s;function s(i){if(!o||!o._balanced)return n(i);let s=vs(r.sliceSerialize({start:o.end,end:r.now()}));return s.codePointAt(0)!==94||!a.includes(s.slice(1))?n(i):(e.enter(`gfmFootnoteCallLabelMarker`),e.consume(i),e.exit(`gfmFootnoteCallLabelMarker`),t(i))}}function jg(e,t){let n=e.length;for(;n--;)if(e[n][1].type===`labelImage`&&e[n][0]===`enter`){e[n][1];break}e[n+1][1].type=`data`,e[n+3][1].type=`gfmFootnoteCallLabelMarker`;let r={type:`gfmFootnoteCall`,start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},i={type:`gfmFootnoteCallMarker`,start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;let a={type:`gfmFootnoteCallString`,start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},o={type:`chunkString`,contentType:`string`,start:Object.assign({},a.start),end:Object.assign({},a.end)},s=[e[n+1],e[n+2],[`enter`,r,t],e[n+3],e[n+4],[`enter`,i,t],[`exit`,i,t],[`enter`,a,t],[`enter`,o,t],[`exit`,o,t],[`exit`,a,t],e[e.length-2],e[e.length-1],[`exit`,r,t]];return e.splice(n,e.length-n+1,...s),e}function Mg(e,t,n){let r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),a=0,o;return s;function s(t){return e.enter(`gfmFootnoteCall`),e.enter(`gfmFootnoteCallLabelMarker`),e.consume(t),e.exit(`gfmFootnoteCallLabelMarker`),c}function c(t){return t===94?(e.enter(`gfmFootnoteCallMarker`),e.consume(t),e.exit(`gfmFootnoteCallMarker`),e.enter(`gfmFootnoteCallString`),e.enter(`chunkString`).contentType=`string`,l):n(t)}function l(s){if(a>999||s===93&&!o||s===null||s===91||X(s))return n(s);if(s===93){e.exit(`chunkString`);let a=e.exit(`gfmFootnoteCallString`);return i.includes(vs(r.sliceSerialize(a)))?(e.enter(`gfmFootnoteCallLabelMarker`),e.consume(s),e.exit(`gfmFootnoteCallLabelMarker`),e.exit(`gfmFootnoteCall`),t):n(s)}return X(s)||(o=!0),a++,e.consume(s),s===92?u:l}function u(t){return t===91||t===92||t===93?(e.consume(t),a++,l):l(t)}}function Ng(e,t,n){let r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),a,o=0,s;return c;function c(t){return e.enter(`gfmFootnoteDefinition`)._container=!0,e.enter(`gfmFootnoteDefinitionLabel`),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),l}function l(t){return t===94?(e.enter(`gfmFootnoteDefinitionMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionMarker`),e.enter(`gfmFootnoteDefinitionLabelString`),e.enter(`chunkString`).contentType=`string`,u):n(t)}function u(t){if(o>999||t===93&&!s||t===null||t===91||X(t))return n(t);if(t===93){e.exit(`chunkString`);let n=e.exit(`gfmFootnoteDefinitionLabelString`);return a=vs(r.sliceSerialize(n)),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),e.exit(`gfmFootnoteDefinitionLabel`),f}return X(t)||(s=!0),o++,e.consume(t),t===92?d:u}function d(t){return t===91||t===92||t===93?(e.consume(t),o++,u):u(t)}function f(t){return t===58?(e.enter(`definitionMarker`),e.consume(t),e.exit(`definitionMarker`),i.includes(a)||i.push(a),Q(e,p,`gfmFootnoteDefinitionWhitespace`)):n(t)}function p(e){return t(e)}}function Pg(e,t,n){return e.check(Ws,t,e.attempt(Og,t,n))}function Fg(e){e.exit(`gfmFootnoteDefinition`)}function Ig(e,t,n){let r=this;return Q(e,i,`gfmFootnoteDefinitionIndent`,5);function i(e){let i=r.events[r.events.length-1];return i&&i[1].type===`gfmFootnoteDefinitionIndent`&&i[2].sliceSerialize(i[1],!0).length===4?t(e):n(e)}}function Lg(e){let t=(e||{}).singleTilde,n={name:`strikethrough`,tokenize:i,resolveAll:r};return t??=!0,{text:{126:n},insideSpan:{null:[n]},attentionMarkers:{null:[126]}};function r(e,t){let n=-1;for(;++n<e.length;)if(e[n][0]===`enter`&&e[n][1].type===`strikethroughSequenceTemporary`&&e[n][1]._close){let r=n;for(;r--;)if(e[r][0]===`exit`&&e[r][1].type===`strikethroughSequenceTemporary`&&e[r][1]._open&&e[n][1].end.offset-e[n][1].start.offset===e[r][1].end.offset-e[r][1].start.offset){e[n][1].type=`strikethroughSequence`,e[r][1].type=`strikethroughSequence`;let i={type:`strikethrough`,start:Object.assign({},e[r][1].start),end:Object.assign({},e[n][1].end)},a={type:`strikethroughText`,start:Object.assign({},e[r][1].end),end:Object.assign({},e[n][1].start)},o=[[`enter`,i,t],[`enter`,e[r][1],t],[`exit`,e[r][1],t],[`enter`,a,t]],s=t.parser.constructs.insideSpan.null;s&&J(o,o.length,0,Ls(s,e.slice(r+1,n),t)),J(o,o.length,0,[[`exit`,a,t],[`enter`,e[n][1],t],[`exit`,e[n][1],t],[`exit`,i,t]]),J(e,r-1,n-r+3,o),n=r+o.length-2;break}}for(n=-1;++n<e.length;)e[n][1].type===`strikethroughSequenceTemporary`&&(e[n][1].type=`data`);return e}function i(e,n,r){let i=this.previous,a=this.events,o=0;return s;function s(t){return i===126&&a[a.length-1][1].type!==`characterEscape`?r(t):(e.enter(`strikethroughSequenceTemporary`),c(t))}function c(a){let s=Is(i);if(a===126)return o>1?r(a):(e.consume(a),o++,c);if(o<2&&!t)return r(a);let l=e.exit(`strikethroughSequenceTemporary`),u=Is(a);return l._open=!u||u===2&&!!s,l._close=!s||s===2&&!!u,n(a)}}}var Rg=class{constructor(){this.map=[]}add(e,t,n){zg(this,e,t,n)}consume(e){if(this.map.sort(function(e,t){return e[0]-t[0]}),this.map.length===0)return;let t=this.map.length,n=[];for(;t>0;)--t,n.push(e.slice(this.map[t][0]+this.map[t][1]),this.map[t][2]),e.length=this.map[t][0];n.push(e.slice()),e.length=0;let r=n.pop();for(;r;){for(let t of r)e.push(t);r=n.pop()}this.map.length=0}};function zg(e,t,n,r){let i=0;if(n!==0||r.length!==0){for(;i<e.map.length;){if(e.map[i][0]===t){e.map[i][1]+=n,e.map[i][2].push(...r);return}i+=1}e.map.push([t,n,r])}}function Bg(e,t){let n=!1,r=[];for(;t<e.length;){let i=e[t];if(n){if(i[0]===`enter`)i[1].type===`tableContent`&&r.push(e[t+1][1].type===`tableDelimiterMarker`?`left`:`none`);else if(i[1].type===`tableContent`){if(e[t-1][1].type===`tableDelimiterMarker`){let e=r.length-1;r[e]=r[e]===`left`?`center`:`right`}}else if(i[1].type===`tableDelimiterRow`)break}else i[0]===`enter`&&i[1].type===`tableDelimiterRow`&&(n=!0);t+=1}return r}function Vg(){return{flow:{null:{name:`table`,tokenize:Hg,resolveAll:Ug}}}}function Hg(e,t,n){let r=this,i=0,a=0,o;return s;function s(e){let t=r.events.length-1;for(;t>-1;){let e=r.events[t][1].type;if(e===`lineEnding`||e===`linePrefix`)t--;else break}let i=t>-1?r.events[t][1].type:null,a=i===`tableHead`||i===`tableRow`?S:c;return a===S&&r.parser.lazy[r.now().line]?n(e):a(e)}function c(t){return e.enter(`tableHead`),e.enter(`tableRow`),l(t)}function l(e){return e===124?u(e):(o=!0,a+=1,u(e))}function u(t){return t===null?n(t):Y(t)?a>1?(a=0,r.interrupt=!0,e.exit(`tableRow`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),p):n(t):Z(t)?Q(e,u,`whitespace`)(t):(a+=1,o&&(o=!1,i+=1),t===124?(e.enter(`tableCellDivider`),e.consume(t),e.exit(`tableCellDivider`),o=!0,u):(e.enter(`data`),d(t)))}function d(t){return t===null||t===124||X(t)?(e.exit(`data`),u(t)):(e.consume(t),t===92?f:d)}function f(t){return t===92||t===124?(e.consume(t),d):d(t)}function p(t){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(t):(e.enter(`tableDelimiterRow`),o=!1,Z(t)?Q(e,m,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):m(t))}function m(t){return t===45||t===58?g(t):t===124?(o=!0,e.enter(`tableCellDivider`),e.consume(t),e.exit(`tableCellDivider`),h):x(t)}function h(t){return Z(t)?Q(e,g,`whitespace`)(t):g(t)}function g(t){return t===58?(a+=1,o=!0,e.enter(`tableDelimiterMarker`),e.consume(t),e.exit(`tableDelimiterMarker`),_):t===45?(a+=1,_(t)):t===null||Y(t)?b(t):x(t)}function _(t){return t===45?(e.enter(`tableDelimiterFiller`),v(t)):x(t)}function v(t){return t===45?(e.consume(t),v):t===58?(o=!0,e.exit(`tableDelimiterFiller`),e.enter(`tableDelimiterMarker`),e.consume(t),e.exit(`tableDelimiterMarker`),y):(e.exit(`tableDelimiterFiller`),y(t))}function y(t){return Z(t)?Q(e,b,`whitespace`)(t):b(t)}function b(n){return n===124?m(n):n===null||Y(n)?!o||i!==a?x(n):(e.exit(`tableDelimiterRow`),e.exit(`tableHead`),t(n)):x(n)}function x(e){return n(e)}function S(t){return e.enter(`tableRow`),C(t)}function C(n){return n===124?(e.enter(`tableCellDivider`),e.consume(n),e.exit(`tableCellDivider`),C):n===null||Y(n)?(e.exit(`tableRow`),t(n)):Z(n)?Q(e,C,`whitespace`)(n):(e.enter(`data`),w(n))}function w(t){return t===null||t===124||X(t)?(e.exit(`data`),C(t)):(e.consume(t),t===92?T:w)}function T(t){return t===92||t===124?(e.consume(t),w):w(t)}}function Ug(e,t){let n=-1,r=!0,i=0,a=[0,0,0,0],o=[0,0,0,0],s=!1,c=0,l,u,d,f=new Rg;for(;++n<e.length;){let p=e[n],m=p[1];p[0]===`enter`?m.type===`tableHead`?(s=!1,c!==0&&(Gg(f,t,c,l,u),u=void 0,c=0),l={type:`table`,start:Object.assign({},m.start),end:Object.assign({},m.end)},f.add(n,0,[[`enter`,l,t]])):m.type===`tableRow`||m.type===`tableDelimiterRow`?(r=!0,d=void 0,a=[0,0,0,0],o=[0,n+1,0,0],s&&(s=!1,u={type:`tableBody`,start:Object.assign({},m.start),end:Object.assign({},m.end)},f.add(n,0,[[`enter`,u,t]])),i=m.type===`tableDelimiterRow`?2:u?3:1):i&&(m.type===`data`||m.type===`tableDelimiterMarker`||m.type===`tableDelimiterFiller`)?(r=!1,o[2]===0&&(a[1]!==0&&(o[0]=o[1],d=Wg(f,t,a,i,void 0,d),a=[0,0,0,0]),o[2]=n)):m.type===`tableCellDivider`&&(r?r=!1:(a[1]!==0&&(o[0]=o[1],d=Wg(f,t,a,i,void 0,d)),a=o,o=[a[1],n,0,0])):m.type===`tableHead`?(s=!0,c=n):m.type===`tableRow`||m.type===`tableDelimiterRow`?(c=n,a[1]===0?o[1]!==0&&(d=Wg(f,t,o,i,n,d)):(o[0]=o[1],d=Wg(f,t,a,i,n,d)),i=0):i&&(m.type===`data`||m.type===`tableDelimiterMarker`||m.type===`tableDelimiterFiller`)&&(o[3]=n)}for(c!==0&&Gg(f,t,c,l,u),f.consume(t.events),n=-1;++n<t.events.length;){let e=t.events[n];e[0]===`enter`&&e[1].type===`table`&&(e[1]._align=Bg(t.events,n))}return e}function Wg(e,t,n,r,i,a){let o=r===1?`tableHeader`:r===2?`tableDelimiter`:`tableData`;n[0]!==0&&(a.end=Object.assign({},Kg(t.events,n[0])),e.add(n[0],0,[[`exit`,a,t]]));let s=Kg(t.events,n[1]);if(a={type:o,start:Object.assign({},s),end:Object.assign({},s)},e.add(n[1],0,[[`enter`,a,t]]),n[2]!==0){let i=Kg(t.events,n[2]),a=Kg(t.events,n[3]),o={type:`tableContent`,start:Object.assign({},i),end:Object.assign({},a)};if(e.add(n[2],0,[[`enter`,o,t]]),r!==2){let r=t.events[n[2]],i=t.events[n[3]];if(r[1].end=Object.assign({},i[1].end),r[1].type=`chunkText`,r[1].contentType=`text`,n[3]>n[2]+1){let t=n[2]+1,r=n[3]-n[2]-1;e.add(t,r,[])}}e.add(n[3]+1,0,[[`exit`,o,t]])}return i!==void 0&&(a.end=Object.assign({},Kg(t.events,i)),e.add(i,0,[[`exit`,a,t]]),a=void 0),a}function Gg(e,t,n,r,i){let a=[],o=Kg(t.events,n);i&&(i.end=Object.assign({},o),a.push([`exit`,i,t])),r.end=Object.assign({},o),a.push([`exit`,r,t]),e.add(n+1,0,a)}function Kg(e,t){let n=e[t],r=n[0]===`enter`?`start`:`end`;return n[1][r]}const qg={name:`tasklistCheck`,tokenize:Yg};function Jg(){return{text:{91:qg}}}function Yg(e,t,n){let r=this;return i;function i(t){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(t):(e.enter(`taskListCheck`),e.enter(`taskListCheckMarker`),e.consume(t),e.exit(`taskListCheckMarker`),a)}function a(t){return X(t)?(e.enter(`taskListCheckValueUnchecked`),e.consume(t),e.exit(`taskListCheckValueUnchecked`),o):t===88||t===120?(e.enter(`taskListCheckValueChecked`),e.consume(t),e.exit(`taskListCheckValueChecked`),o):n(t)}function o(t){return t===93?(e.enter(`taskListCheckMarker`),e.consume(t),e.exit(`taskListCheckMarker`),e.exit(`taskListCheck`),s):n(t)}function s(r){return Y(r)?t(r):Z(r)?e.check({tokenize:Xg},t,n)(r):n(r)}}function Xg(e,t,n){return Q(e,r,`whitespace`);function r(e){return e===null?n(e):t(e)}}function Zg(e){return ms([pg(),kg(),Lg(e),Vg(),Jg()])}const Qg={};function $g(e){let t=this,n=e||Qg,r=t.data(),i=r.micromarkExtensions||=[],a=r.fromMarkdownExtensions||=[],o=r.toMarkdownExtensions||=[];i.push(Zg(n)),a.push(ng()),o.push(rg(n))}const e_=/^\[!(NOTE|TIP|IMPORTANT|WARNING|CAUTION)\]/i,t_=/^\[!(NOTE|TIP|IMPORTANT|WARNING|CAUTION)(\/.*)?\]/i,n_=({legacyTitle:e=!1,tagName:t=`div`,classNames:n=``}={})=>r=>{rd(r,`blockquote`,(r,i,a)=>{let o=``,s=``,c=!0,l=r.children.map(t=>{if(c&&t.type===`paragraph`){let n=t.children[0],r=n.type===`text`?n.value:``,i=e?t_:e_,a=r.match(i);if(a&&(c=!1,o=a[1].toLocaleLowerCase(),s=e&&a[2]||o.toLocaleUpperCase(),r.includes(`
316
+ `)&&(t.children[0]={type:`text`,value:r.replace(i,``).replace(/^\n+/,``)}),!r.includes(`
317
+ `))){let e=[];t.children.forEach((t,n)=>{n!=0&&(n!=1||t.type!==`break`)&&e.push(t)}),t.children=[...e]}}return t});o&&(r.data={hName:t,hProperties:{className:[`markdown-alert`,`markdown-alert-${o}`,...n.split(` `).filter(e=>e.length)],dir:`auto`}},l.unshift({type:`paragraph`,children:[r_(o),{type:`text`,value:s.replace(/^\//,``)}],data:{hProperties:{className:`markdown-alert-title`,dir:`auto`}}})),r.children=[...l]})};function r_(e){return{type:`emphasis`,data:{hName:`svg`,hProperties:{className:[`octicon`],viewBox:`0 0 16 16`,width:`16`,height:`16`,ariaHidden:`true`}},children:[{type:`emphasis`,data:{hName:`path`,hProperties:{d:i_[e]??``}},children:[]}]}}const i_={note:`M0 8a8 8 0 1 1 16 0A8 8 0 0 1 0 8Zm8-6.5a6.5 6.5 0 1 0 0 13 6.5 6.5 0 0 0 0-13ZM6.5 7.75A.75.75 0 0 1 7.25 7h1a.75.75 0 0 1 .75.75v2.75h.25a.75.75 0 0 1 0 1.5h-2a.75.75 0 0 1 0-1.5h.25v-2h-.25a.75.75 0 0 1-.75-.75ZM8 6a1 1 0 1 1 0-2 1 1 0 0 1 0 2Z`,tip:`M8 1.5c-2.363 0-4 1.69-4 3.75 0 .984.424 1.625.984 2.304l.214.253c.223.264.47.556.673.848.284.411.537.896.621 1.49a.75.75 0 0 1-1.484.211c-.04-.282-.163-.547-.37-.847a8.456 8.456 0 0 0-.542-.68c-.084-.1-.173-.205-.268-.32C3.201 7.75 2.5 6.766 2.5 5.25 2.5 2.31 4.863 0 8 0s5.5 2.31 5.5 5.25c0 1.516-.701 2.5-1.328 3.259-.095.115-.184.22-.268.319-.207.245-.383.453-.541.681-.208.3-.33.565-.37.847a.751.751 0 0 1-1.485-.212c.084-.593.337-1.078.621-1.489.203-.292.45-.584.673-.848.075-.088.147-.173.213-.253.561-.679.985-1.32.985-2.304 0-2.06-1.637-3.75-4-3.75ZM5.75 12h4.5a.75.75 0 0 1 0 1.5h-4.5a.75.75 0 0 1 0-1.5ZM6 15.25a.75.75 0 0 1 .75-.75h2.5a.75.75 0 0 1 0 1.5h-2.5a.75.75 0 0 1-.75-.75Z`,important:`M0 1.75C0 .784.784 0 1.75 0h12.5C15.216 0 16 .784 16 1.75v9.5A1.75 1.75 0 0 1 14.25 13H8.06l-2.573 2.573A1.458 1.458 0 0 1 3 14.543V13H1.75A1.75 1.75 0 0 1 0 11.25Zm1.75-.25a.25.25 0 0 0-.25.25v9.5c0 .138.112.25.25.25h2a.75.75 0 0 1 .75.75v2.19l2.72-2.72a.749.749 0 0 1 .53-.22h6.5a.25.25 0 0 0 .25-.25v-9.5a.25.25 0 0 0-.25-.25Zm7 2.25v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 9a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z`,warning:`M6.457 1.047c.659-1.234 2.427-1.234 3.086 0l6.082 11.378A1.75 1.75 0 0 1 14.082 15H1.918a1.75 1.75 0 0 1-1.543-2.575Zm1.763.707a.25.25 0 0 0-.44 0L1.698 13.132a.25.25 0 0 0 .22.368h12.164a.25.25 0 0 0 .22-.368Zm.53 3.996v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 11a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z`,caution:`M4.47.22A.749.749 0 0 1 5 0h6c.199 0 .389.079.53.22l4.25 4.25c.141.14.22.331.22.53v6a.749.749 0 0 1-.22.53l-4.25 4.25A.749.749 0 0 1 11 16H5a.749.749 0 0 1-.53-.22L.22 11.53A.749.749 0 0 1 0 11V5c0-.199.079-.389.22-.53Zm.84 1.28L1.5 5.31v5.38l3.81 3.81h5.38l3.81-3.81V5.31L10.69 1.5ZM8 4a.75.75 0 0 1 .75.75v3.5a.75.75 0 0 1-1.5 0v-3.5A.75.75 0 0 1 8 4Zm0 8a1 1 0 1 1 0-2 1 1 0 0 1 0 2Z`};function a_(){return{enter:{mathFlow:e,mathFlowFenceMeta:t,mathText:a},exit:{mathFlow:i,mathFlowFence:r,mathFlowFenceMeta:n,mathFlowValue:s,mathText:o,mathTextData:s}};function e(e){this.enter({type:`math`,meta:null,value:``,data:{hName:`pre`,hChildren:[{type:`element`,tagName:`code`,properties:{className:[`language-math`,`math-display`]},children:[]}]}},e)}function t(){this.buffer()}function n(){let e=this.resume(),t=this.stack[this.stack.length-1];t.type,t.meta=e}function r(){this.data.mathFlowInside||(this.buffer(),this.data.mathFlowInside=!0)}function i(e){let t=this.resume().replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,``),n=this.stack[this.stack.length-1];n.type,this.exit(e),n.value=t;let r=n.data.hChildren[0];r.type,r.tagName,r.children.push({type:`text`,value:t}),this.data.mathFlowInside=void 0}function a(e){this.enter({type:`inlineMath`,value:``,data:{hName:`code`,hProperties:{className:[`language-math`,`math-inline`]},hChildren:[]}},e),this.buffer()}function o(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,this.exit(e),n.value=t,n.data.hChildren.push({type:`text`,value:t})}function s(e){this.config.enter.data.call(this,e),this.config.exit.data.call(this,e)}}function o_(e){let t=(e||{}).singleDollarTextMath;return t??=!0,r.peek=i,{unsafe:[{character:`\r`,inConstruct:`mathFlowMeta`},{character:`
318
+ `,inConstruct:`mathFlowMeta`},{character:`$`,after:t?void 0:`\\$`,inConstruct:`phrasing`},{character:`$`,inConstruct:`mathFlowMeta`},{atBreak:!0,character:`$`,after:`\\$`}],handlers:{math:n,inlineMath:r}};function n(e,t,n,r){let i=e.value||``,a=n.createTracker(r),o=`$`.repeat(Math.max($m(i,`$`)+1,2)),s=n.enter(`mathFlow`),c=a.move(o);if(e.meta){let t=n.enter(`mathFlowMeta`);c+=a.move(n.safe(e.meta,{after:`
319
+ `,before:c,encode:[`$`],...a.current()})),t()}return c+=a.move(`
320
+ `),i&&(c+=a.move(i+`
321
+ `)),c+=a.move(o),s(),c}function r(e,n,r){let i=e.value||``,a=1;for(t||a++;RegExp(`(^|[^$])`+`\\$`.repeat(a)+`([^$]|$)`).test(i);)a++;let o=`$`.repeat(a);/[^ \r\n]/.test(i)&&(/^[ \r\n]/.test(i)&&/[ \r\n]$/.test(i)||/^\$|\$$/.test(i))&&(i=` `+i+` `);let s=-1;for(;++s<r.unsafe.length;){let e=r.unsafe[s];if(!e.atBreak)continue;let t=r.compilePattern(e),n;for(;n=t.exec(i);){let e=n.index;i.codePointAt(e)===10&&i.codePointAt(e-1)===13&&e--,i=i.slice(0,e)+` `+i.slice(n.index+1)}}return o+i+o}function i(){return`$`}}const s_={tokenize:l_,concrete:!0,name:`mathFlow`},c_={tokenize:u_,partial:!0};function l_(e,t,n){let r=this,i=r.events[r.events.length-1],a=i&&i[1].type===`linePrefix`?i[2].sliceSerialize(i[1],!0).length:0,o=0;return s;function s(t){return e.enter(`mathFlow`),e.enter(`mathFlowFence`),e.enter(`mathFlowFenceSequence`),c(t)}function c(t){return t===36?(e.consume(t),o++,c):o<2?n(t):(e.exit(`mathFlowFenceSequence`),Q(e,l,`whitespace`)(t))}function l(t){return t===null||Y(t)?d(t):(e.enter(`mathFlowFenceMeta`),e.enter(`chunkString`,{contentType:`string`}),u(t))}function u(t){return t===null||Y(t)?(e.exit(`chunkString`),e.exit(`mathFlowFenceMeta`),d(t)):t===36?n(t):(e.consume(t),u)}function d(n){return e.exit(`mathFlowFence`),r.interrupt?t(n):e.attempt(c_,f,g)(n)}function f(t){return e.attempt({tokenize:_,partial:!0},g,p)(t)}function p(t){return(a?Q(e,m,`linePrefix`,a+1):m)(t)}function m(t){return t===null?g(t):Y(t)?e.attempt(c_,f,g)(t):(e.enter(`mathFlowValue`),h(t))}function h(t){return t===null||Y(t)?(e.exit(`mathFlowValue`),m(t)):(e.consume(t),h)}function g(n){return e.exit(`mathFlow`),t(n)}function _(e,t,n){let i=0;return Q(e,a,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4);function a(t){return e.enter(`mathFlowFence`),e.enter(`mathFlowFenceSequence`),s(t)}function s(t){return t===36?(i++,e.consume(t),s):i<o?n(t):(e.exit(`mathFlowFenceSequence`),Q(e,c,`whitespace`)(t))}function c(r){return r===null||Y(r)?(e.exit(`mathFlowFence`),t(r)):n(r)}}}function u_(e,t,n){let r=this;return i;function i(n){return n===null?t(n):(e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),a)}function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}function d_(e){let t=(e||{}).singleDollarTextMath;return t??=!0,{tokenize:n,resolve:f_,previous:p_,name:`mathText`};function n(e,n,r){let i=0,a,o;return s;function s(t){return e.enter(`mathText`),e.enter(`mathTextSequence`),c(t)}function c(n){return n===36?(e.consume(n),i++,c):i<2&&!t?r(n):(e.exit(`mathTextSequence`),l(n))}function l(t){return t===null?r(t):t===36?(o=e.enter(`mathTextSequence`),a=0,d(t)):t===32?(e.enter(`space`),e.consume(t),e.exit(`space`),l):Y(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),l):(e.enter(`mathTextData`),u(t))}function u(t){return t===null||t===32||t===36||Y(t)?(e.exit(`mathTextData`),l(t)):(e.consume(t),u)}function d(t){return t===36?(e.consume(t),a++,d):a===i?(e.exit(`mathTextSequence`),e.exit(`mathText`),n(t)):(o.type=`mathTextData`,u(t))}}}function f_(e){let t=e.length-4,n=3,r,i;if((e[n][1].type===`lineEnding`||e[n][1].type===`space`)&&(e[t][1].type===`lineEnding`||e[t][1].type===`space`)){for(r=n;++r<t;)if(e[r][1].type===`mathTextData`){e[t][1].type=`mathTextPadding`,e[n][1].type=`mathTextPadding`,n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)i===void 0?r!==t&&e[r][1].type!==`lineEnding`&&(i=r):(r===t||e[r][1].type===`lineEnding`)&&(e[i][1].type=`mathTextData`,r!==i+2&&(e[i][1].end=e[r-1][1].end,e.splice(i+2,r-i-2),t-=r-i-2,r=i+2),i=void 0);return e}function p_(e){return e!==36||this.events[this.events.length-1][1].type===`characterEscape`}function m_(e){return{flow:{36:s_},text:{36:d_(e)}}}const h_={};function g_(e){let t=this,n=e||h_,r=t.data(),i=r.micromarkExtensions||=[],a=r.fromMarkdownExtensions||=[],o=r.toMarkdownExtensions||=[];i.push(m_(n)),a.push(a_()),o.push(o_(n))}const __=(function(e){if(e==null)return S_;if(typeof e==`string`)return b_(e);if(typeof e==`object`)return Array.isArray(e)?v_(e):y_(e);if(typeof e==`function`)return x_(e);throw Error(`Expected function, string, or object as test`)});function v_(e){let t=[],n=-1;for(;++n<e.length;)t[n]=__(e[n]);return x_(r);function r(...e){let n=-1;for(;++n<t.length;)if(t[n].call(this,...e))return!0;return!1}}function y_(e){return x_(t);function t(t){let n;for(n in e)if(t[n]!==e[n])return!1;return!0}}function b_(e){return x_(t);function t(t){return t&&t.type===e}}function x_(e){return t;function t(t,...n){return!!(t&&typeof t==`object`&&`type`in t&&e.call(this,t,...n))}}function S_(){return!0}function C_(e){return e}const w_=(function(e,t,n,r){typeof t==`function`&&typeof n!=`function`&&(r=n,n=t,t=null);let i=__(t),a=r?-1:1;o(e,void 0,[])();function o(e,s,c){let l=e&&typeof e==`object`?e:{};if(typeof l.type==`string`){let t=typeof l.tagName==`string`?l.tagName:typeof l.name==`string`?l.name:void 0;Object.defineProperty(u,"name",{value:`node (`+C_(e.type+(t?`<`+t+`>`:``))+`)`})}return u;function u(){let l=[],u,d,f;if((!t||i(e,s,c[c.length-1]||null))&&(l=T_(n(e,c)),l[0]===!1))return l;if(e.children&&l[0]!==`skip`)for(d=(r?e.children.length:-1)+a,f=c.concat(e);d>-1&&d<e.children.length;){if(u=o(e.children[d],d,f)(),u[0]===!1)return u;d=typeof u[1]==`number`?u[1]:d+a}return l}}});function T_(e){return Array.isArray(e)?e:typeof e==`number`?[!0,e]:[e]}const E_=(function(e,t,n,r){typeof t==`function`&&typeof n!=`function`&&(r=n,n=t,t=null),w_(e,t,i,r);function i(e,t){let r=t[t.length-1];return n(e,r?r.children.indexOf(e):null,r)}});function D_(){return e=>{E_(e,[`text`],(e,t,n)=>{if(e.type!==`text`)return;let{value:r}=e,i=r.split(/\^/);if(i.length===1||i.length%2==0)return;let a=i.map((e,t)=>t%2==0?{type:`text`,value:e}:{type:`superscript`,data:{hName:`sup`},children:[{type:`text`,value:e}]});n.children.splice(t,1,...a)}),E_(e,[`text`],(e,t,n)=>{if(e.type!==`text`)return;let{value:r}=e,i=r.split(/\~/);if(i.length===1||i.length%2==0)return;let a=i.map((e,t)=>t%2==0?{type:`text`,value:e}:{type:`subscript`,data:{hName:`sub`},children:[{type:`text`,value:e}]});n.children.splice(t,1,...a)})}}var O_=class{components={};registerComponent(e,t){this.components[e]=t}getComponent(e){return this.components[e]}};const k_=N(null);function A_({components:e,children:n}){let r=L(()=>{let t=new O_;for(let[n,r]of Object.entries(e))t.registerComponent(n,r);return t},[e]);return t(k_.Provider,{value:r,children:n})}function j_(){return ie(k_)}function M_(e){let t=ie(k_);if(t)return t.getComponent(e)}const N_=`Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif`;function P_(e){let t=e.trim(),n=``,r=!1,i=!1;for(let e=0;e<t.length;e++){let a=t[e],o=e>0?t[e-1]:``;if(a===`"`&&!i&&o!==`\\`){r=!r,n+=a;continue}if(a===`'`&&!r&&o!==`\\`){i=!i,n+=a;continue}if((r||i)&&a===`\\`){let r=e;for(;t[r]===`\\`;)r++;if(t[r]===`n`){n+=`<br/>`,e=r;continue}}n+=a}return n}function F_(e){return e.replace(/<svg([^<>]*)>/i,(e,t)=>{let n=t.replace(/\swidth="[^"]*"/i,``).replace(/\sheight="[^"]*"/i,``);return/style="/i.test(n)?n=n.replace(/style="([^"]*)"/i,(e,t)=>`style="${t};width:100%;height:auto;display:block;max-width:100%;"`):n+=` style="width:100%;height:auto;display:block;max-width:100%;"`,/preserveAspectRatio=/i.test(n)||(n+=` preserveAspectRatio="xMidYMid meet"`),`<svg${n}>`})}let I_;function L_(){return I_||=import(`mermaid`).then(({default:e})=>(e.initialize({startOnLoad:!1,theme:`default`,securityLevel:`loose`,fontFamily:N_,suppressErrorRendering:!0,flowchart:{htmlLabels:!0,useMaxWidth:!0,nodeSpacing:40,rankSpacing:50,padding:12},sequence:{useMaxWidth:!0},themeVariables:{fontFamily:N_}}),e)),I_}function R_({code:e,className:n}){let r=R(null),[i,a]=z(null),[o,s]=z(null),c=ae().replace(/:/g,`_`);return I(()=>{let t=!1;return(async()=>{if(!e.trim()){a(null),s(null);return}try{s(null);let n=`mermaid-${c}-${Date.now()}`,r=P_(e),{svg:i}=await(await L_()).render(n,r),o=F_(i);t||a(o)}catch(e){if(!t){let t=e instanceof Error?e.message:`Failed to render mermaid diagram`;s(t),a(null)}}})(),()=>{t=!0}},[e,c]),o?null:i?t(`div`,{ref:r,className:`my-4 w-full overflow-x-auto [&_svg]:mx-auto [&_svg]:w-full [&_svg]:h-auto [&_svg]:max-w-full ${n||``}`,dangerouslySetInnerHTML:{__html:i}}):t(`div`,{className:`my-4 p-4 bg-gray-50 dark:bg-gray-800 rounded-lg animate-pulse ${n||``}`,children:t(`div`,{className:`h-32 bg-gray-200 dark:bg-gray-700 rounded`})})}function z_(e){switch(e.split(`.`).pop()?.toLowerCase()){case`json`:return`json`;case`md`:case`txt`:case`csv`:case`yaml`:case`yml`:return`text`;case`png`:case`jpg`:case`jpeg`:case`gif`:case`webp`:case`pdf`:return`binary`;default:return`text`}}function B_({runId:e,path:t,parseJson:n=!0}){let{client:r}=ye(),i=Mi(),a=R(r);a.current=r;let o=R(i);o.current=i;let[s,c]=z({data:void 0,rawContent:void 0,isLoading:!0,error:void 0,contentType:void 0}),l=F(async()=>{if(!e){c({data:void 0,rawContent:void 0,isLoading:!1,error:`No run ID provided`,contentType:void 0});return}if(!t){c({data:void 0,rawContent:void 0,isLoading:!1,error:`No artifact path provided`,contentType:void 0});return}c(e=>({...e,isLoading:!0,error:void 0}));let r=a.current,i=o.current,s=z_(t);try{let a=Pi(e,t,`inline`),o;o=i?await i.getOrFetch(a,async()=>(await r.files.getArtifactDownloadUrl(e,t,`inline`)).url):(await r.files.getArtifactDownloadUrl(e,t,`inline`)).url;let l=await fetch(o);if(!l.ok)throw Error(`Failed to fetch artifact: ${l.status} ${l.statusText}`);if(s===`binary`){c({data:o,rawContent:void 0,isLoading:!1,error:void 0,contentType:s,etag:l.headers.get(`etag`)?.replace(/^"(.*)"$/,`$1`)});return}let u=await l.text(),d;if(n&&s===`json`)try{d=JSON.parse(u)}catch{d=u}else d=u;c({data:d,rawContent:u,isLoading:!1,error:void 0,contentType:s,etag:l.headers.get(`etag`)?.replace(/^"(.*)"$/,`$1`)})}catch(e){let n=e instanceof Error?e.message:`Failed to fetch artifact`;console.error(`Failed to fetch artifact content:`,t,e),c({data:void 0,rawContent:void 0,isLoading:!1,error:n,contentType:s})}},[e,t,n]);I(()=>{l()},[l]);let u=F(()=>{c({data:void 0,rawContent:void 0,isLoading:!0,error:void 0,contentType:void 0}),l()},[l]);return{data:s.data,rawContent:s.rawContent,isLoading:s.isLoading,error:s.error,contentType:s.contentType,etag:s.etag,retry:u}}function V_(e){let t=e.trim();if(t.length<2)return!0;if(!t.startsWith(`{`))return!1;try{return JSON.parse(t),!1}catch(e){let n=e instanceof Error?e.message:``,r=[`unexpected end`,`unterminated string`,`expected`,`unexpected token`],i=n.toLowerCase();if(r.some(e=>i.includes(e))){let e=0,n=0,r=!1,i=!1;for(let a of t){if(i){i=!1;continue}if(a===`\\`){i=!0;continue}if(a===`"`){r=!r;continue}r||(a===`{`?e++:a===`}`?e--:a===`[`?n++:a===`]`&&n--)}return e>0||n>0||r}return!1}}function H_(e){try{let t=e.trim(),n=t.indexOf(`{`),r=t.lastIndexOf(`}`);return n!==-1&&r>n&&(t=t.slice(n,r+1)),JSON.parse(t)}catch{return null}}function U_(e){let t=typeof e.$schema==`string`&&e.$schema.includes(`vega`),n=e.library===`vega-lite`&&`spec`in e;return t||n?`vega-lite`:null}function W_({code:e}){let{artifactRunId:n}=ea();n||console.warn(`[VegaLiteCodeBlockHandler] artifactRunId is missing from CodeBlockContext`);let r=L(()=>V_(e),[e]),i=L(()=>{if(r)return null;let t=H_(e);return t?{library:`vega-lite`,spec:t}:null},[e,r]);return r?t(U,{type:`chart`,message:`Loading chart...`}):i?t(na,{type:`chart`,fallbackCode:e,children:t(Zi,{spec:i,artifactRunId:n})}):t(U,{type:`chart`,error:`Invalid Vega-Lite specification`})}function G_({code:e}){let{artifactRunId:n}=ea();n||console.warn(`[ChartCodeBlockHandler] artifactRunId is missing from CodeBlockContext`);let r=L(()=>V_(e),[e]),i=L(()=>{if(r)return null;let t=H_(e);return!t||!U_(t)?null:t.library===`vega-lite`&&`spec`in t&&typeof t.spec==`object`?t:{library:`vega-lite`,spec:t}},[e,r]);return r?t(U,{type:`chart`,message:`Loading chart...`}):i?t(na,{type:`chart`,fallbackCode:e,children:t(Zi,{spec:i,artifactRunId:n})}):t(U,{type:`chart`,error:`Invalid Vega-Lite chart specification`})}function K_({code:e}){let n=e.trim();return n?t(na,{type:`mermaid`,fallbackCode:e,children:t(R_,{code:n})}):t(U,{type:`mermaid`,error:`Empty diagram`})}function q_({code:e}){let n=L(()=>{let t=e.trim();return t?ca(sa(t)):null},[e]);return n?t(na,{type:`code`,fallbackCode:e,children:t(`div`,{style:{margin:`16px 0`,width:`100%`,overflowX:`auto`},dangerouslySetInnerHTML:{__html:n}})}):t(U,{type:`code`,error:`Empty mockup`})}function J_({code:e,language:n}){let{artifactRunId:r}=ea(),i=e.trim(),a=L(()=>{if(!n?.includes(`:`))return`auto`;let e=n.split(`:`)[1];return[`chart`,`vega-lite`,`table`,`markdown`,`fusion-fragment`,`mockup`,`code`,`image`,`auto`].includes(e)?e:`auto`},[n]),{data:o,isLoading:s,error:c,contentType:l}=B_({runId:r,path:i});return r?s?t(U,{type:`expand`,message:`Loading ${i}...`}):c?t(U,{type:`expand`,error:`Failed to load artifact: ${c}`}):o===void 0?t(U,{type:`expand`,error:`No content found in artifact`}):t(da,{content:o,renderType:a,path:i,runId:r,contentType:l}):t(U,{type:`expand`,error:`No artifact run ID available`})}function Y_(e){return e?.startsWith(`expand`)??!1}function X_(){return{chart:G_,"vega-lite":W_,vegalite:W_,mermaid:K_,mockup:q_,svg:q_}}const Z_=new Set([`store`,`document`,`collection`,`interaction`,`prompt`,`agent`,`workflow`,`process`,`run`]);function Q_(e){return e.trim().replace(/^\/+/,``)}function $_(e){if(e.startsWith(`artifact:`))return{scheme:`artifact`,path:e.slice(9).trim()};if(e.startsWith(`image:`))return{scheme:`image`,path:e.slice(6).trim()};let t=e.indexOf(`:`);if(t>0){let n=e.slice(0,t);if(Z_.has(n))return{scheme:n,path:Q_(e.slice(t+1))}}return{scheme:`standard`,path:e}}function ev({rawUrl:e,artifactRunId:t,disposition:n=`inline`}){let{client:r}=ye(),i=Mi(),a=R(r);a.current=r;let o=R(i);o.current=i;let{scheme:s,path:c}=$_(e),[l,u]=z(()=>{if(s===`standard`)return{url:e,isLoading:!1,error:void 0};if(i&&(s===`artifact`||s===`image`)){let e;e=s===`artifact`&&t&&!Ni(c)?Pi(t,c,n):Fi(c);let r=i.getUrl(e);if(r)return{url:r,isLoading:!1,error:void 0}}return{url:void 0,isLoading:!0,error:void 0}}),d=F(async()=>{if(s===`standard`)return;if(s!==`artifact`&&s!==`image`){u({url:void 0,isLoading:!1,error:`Unknown scheme: ${s}`});return}u(e=>({...e,isLoading:!0,error:void 0}));let e=a.current,r=o.current;try{let i;if(s===`artifact`){if(t&&!Ni(c)){let a=Pi(t,c,n);i=r?await r.getOrFetch(a,async()=>(await e.files.getArtifactDownloadUrl(t,c,n)).url):(await e.files.getArtifactDownloadUrl(t,c,n)).url}else{let t=Fi(c);i=r?await r.getOrFetch(t,async()=>(await e.files.getDownloadUrl(c)).url):(await e.files.getDownloadUrl(c)).url}}else{let t=Fi(c);i=r?await r.getOrFetch(t,async()=>(await e.files.getDownloadUrl(c)).url):(await e.files.getDownloadUrl(c)).url}u({url:i,isLoading:!1,error:void 0})}catch(e){let t=e instanceof Error?e.message:`Failed to resolve URL`;console.error(`Failed to resolve URL:`,c,e),u({url:void 0,isLoading:!1,error:t})}},[s,c,t,n]);I(()=>{if(l.url&&!l.error)return;let e=!1;return e||(async()=>{await d()})(),()=>{e=!0}},[d,l.url,l.error]);let f=F(()=>{u({url:void 0,isLoading:!0,error:void 0}),d()},[d]);return{url:l.url,isLoading:l.isLoading,error:l.error,scheme:s,retry:f}}function tv({src:e,alt:r,caption:i,className:a,artifactRunId:o}){let s=e||``,{scheme:c}=$_(s);return c===`standard`?n(`figure`,{className:`my-4`,children:[t(`img`,{src:e,alt:r,className:a}),t(`figcaption`,{className:`mt-2 text-sm text-muted text-center italic`,children:i})]}):t(nv,{rawSrc:s,alt:r,caption:i,artifactRunId:o,className:a})}function nv({rawSrc:e,alt:r,caption:i,artifactRunId:a,className:o}){let{url:s,isLoading:c,error:l,retry:u}=ev({rawUrl:e,artifactRunId:a,disposition:`inline`});return c?t(U,{type:`image`,message:r?`Loading ${r}...`:void 0}):l?t(U,{type:`image`,error:l,onRetry:u}):s?n(`figure`,{className:`my-4`,children:[t(`img`,{src:s,alt:r,className:o}),t(`figcaption`,{className:`mt-2 text-sm text-muted text-center italic`,children:i})]}):null}function rv({node:e,src:n,alt:r,className:i,artifactRunId:a,ExistingImg:o,...s}){let c=n||``,{scheme:l}=$_(c);return l===`standard`?typeof o==`function`?t(o,{node:e,src:n,alt:r,...s}):t(`img`,{src:n,alt:r,className:i,...s}):t(iv,{rawSrc:c,alt:r,artifactRunId:a,className:i,rest:s})}function iv({rawSrc:e,alt:n,artifactRunId:r,className:i,rest:a}){let{url:o,isLoading:s,error:c,retry:l}=ev({rawUrl:e,artifactRunId:r,disposition:`inline`});return s?t(U,{type:`image`,message:n?`Loading ${n}...`:void 0}):c?t(U,{type:`image`,error:c,onRetry:l}):o?t(`img`,{src:o,alt:n,className:i,...a}):null}function av({node:e,href:n,children:r,className:i,artifactRunId:a,onArtifactOpen:o,ExistingLink:s,...c}){let l=n||``,u=Hn(l);if(u)return t(ov,{resource:u,rawHref:l,artifactRunId:a,className:i,ExistingLink:s,rest:c,children:r});let{scheme:d,path:f}=$_(l);return d===`standard`?typeof s==`function`?t(s,{node:e,href:n,className:i,...c,children:r}):t(`a`,{href:n,...c,className:i,target:`_blank`,rel:`noopener noreferrer`,children:r}):t(sv,{rawHref:l,artifactRunId:a,artifactPath:d===`artifact`?f:void 0,onArtifactOpen:o,className:i,rest:c,children:r})}function ov({resource:e,rawHref:n,artifactRunId:i,className:a,children:o,ExistingLink:s,rest:c}){let l=Bn()(e,{workflowRunId:i,source:`markdown`,rawHref:n});return l.kind===`navigate`?typeof s==`function`?t(s,{href:l.href,className:a,...c,children:o}):t(`a`,{href:l.href,...c,className:a,target:`_blank`,rel:`noopener noreferrer`,children:o}):l.kind===`activate`?t(r,{variant:`link`,size:`none`,className:a,onClick:l.onActivate,children:o}):t(`span`,{className:a,children:o})}function sv({rawHref:e,artifactRunId:n,artifactPath:r,onArtifactOpen:i,className:a,children:o,rest:s}){let{url:c,isLoading:l,error:u,retry:d}=ev({rawUrl:e,artifactRunId:n,disposition:`attachment`});return l?t(`span`,{className:`inline-flex items-center gap-1 text-muted`,children:t(U,{type:`link`})}):u?t(`span`,{className:`inline-flex items-center gap-1`,children:t(U,{type:`link`,error:u,onRetry:d})}):t(`a`,{href:c||`#`,...s,className:a,target:`_blank`,rel:`noopener noreferrer`,onClick:e=>{r&&/\.md$/i.test(r)&&i&&!e.metaKey&&!e.ctrlKey&&!e.shiftKey&&e.button===0&&(e.preventDefault(),i(r))},children:o})}const cv=[`artifact:`,`image:`,`store:`,`document://`,`collection:`,`interaction:`,`prompt:`,`agent:`,`workflow:`,`process:`,`run:`],lv=/(!?\[[^[\]\n]*\]\()((?:artifact:|image:|store:|document:\/\/|collection:|interaction:|prompt:|agent:|workflow:|process:|run:)[^)[\n]+)(\))/g,uv=/`[^`\n]*`/g,dv=/(^|\n)(`{3,}|~{3,})[^\n]*\n[\s\S]*?\n\2(?=\n|$)/g,fv=/\s+("(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*'|\([^)]*\))\s*$/;function pv(e){return cv.some(t=>e.startsWith(t))}function mv(e){let t=e.trim();if(t.startsWith(`<`)){let n=t.indexOf(`>`);if(n>0&&pv(t.slice(1,n).trim()))return e}let n=t.match(fv)?.index??-1,r=(n>=0?t.slice(0,n):t).trim(),i=n>=0?t.slice(n):``;return pv(r)?`<${r}>${i}`:e}function hv(e){return e.replace(lv,(e,t,n,r)=>`${t}${mv(n)}${r}`)}function gv(e){let t=``,n=0;for(let r of e.matchAll(uv))t+=hv(e.slice(n,r.index)),t+=r[0],n=r.index+r[0].length;return t+=hv(e.slice(n)),t}function _v(e){if(!e||!cv.some(t=>e.includes(t)))return e;let t=``,n=0;for(let r of e.matchAll(dv))t+=gv(e.slice(n,r.index)),t+=r[0],n=r.index+r[0].length;return t+=gv(e.slice(n)),t}const vv=/^([ \t]*):::([^\n]*?):::[ \t]*$/gm,yv=/^\w+/;function bv(e){return e?.includes(`:::`)?e.replace(vv,(e,t,n)=>{let r=n.trim(),i=yv.exec(r);if(!i)return e;let a=i[0],o=r.slice(a.length).trim();return o?`${t}:::${a}\n${t}${o}\n${t}:::`:`${t}::${a}`}):e}const xv=/(^|\n)(`{3,}|~{3,})[^\n]*\n[\s\S]*?\n\2(?=\n|$)/g,Sv=/`[^`\n]*`/g,Cv=/\\\$/g,wv=/\\[^\s]/,Tv=/[{}]/,Ev=/[_^][\w{]/,Dv=/^[a-zA-Z]$/,Ov=/^[a-zA-Z]\s*=/,kv=/^\s/,Av=/\s$/,jv=/[+*/-]$/,Mv=/\^[+-]$/;function Nv(e){return wv.test(e)||Tv.test(e)||Ev.test(e)||Dv.test(e)||Ov.test(e)}function Pv(e){return!!(kv.test(e)||Av.test(e)||jv.test(e)&&!Mv.test(e))}function Fv(e){let t=[];for(let n=0;n<e.length;n++)if(e[n]===`$`&&!(n>0&&e[n-1]===`\\`)){if(n+1<e.length&&e[n+1]===`$`){n++;continue}n>0&&e[n-1]===`$`&&(n<2||e[n-2]!==`\\`)||t.push(n)}return t}function Iv(e,t,n){let r=e.slice(t+1,n);return r.length===0||r.includes(`
322
+ `)?null:r}function Lv(e){let t=Fv(e);if(t.length<2)return e;let n=new Set,r=new Set,i=Array(t.length-1);for(let n=0;n<t.length-1;n++)i[n]=Iv(e,t[n],t[n+1]);let a=[];for(let e=0;e<t.length-1;e++){if(n.has(e))continue;let r=i[e];r!==null&&Nv(r)&&(n.add(e),n.add(e+1),a.push([t[e],t[e+1]]))}let o=0;for(;o<t.length;){if(n.has(o)){o++;continue}let e=o+1;for(;e<t.length&&n.has(e);)e++;if(e>=t.length)break;if(e>o+1){r.add(t[o]),o++;continue}let a=i[o];if(a===null){o++;continue}Pv(a)&&(r.add(t[o]),r.add(t[e])),n.add(o),n.add(e),o=e+1}for(let e=0;e<t.length;e++)n.has(e)||e+1<t.length&&n.has(e+1)&&r.add(t[e]);if(r.size===0&&a.length===0)return e;let s=[],c=0,l=Array.from(r).sort((e,t)=>e-t),u=0,d=0;for(;u<l.length||d<a.length;){let t=u<l.length?l[u]:1/0;if(t<(d<a.length?a[d][0]:1/0))t>c&&s.push(e.slice(c,t)),s.push(`\\$`),c=t+1,u++;else{let[t,n]=a[d];t>c&&s.push(e.slice(c,t));let r=e.slice(t,n+1);for(s.push(r.replace(Cv,`\\text{\\textdollar}`)),c=n+1;u<l.length&&l[u]<=n;)u++;d++}}return c<e.length&&s.push(e.slice(c)),s.join(``)}function Rv(e){let t=[],n=0;for(let r of e.matchAll(Sv))t.push(Lv(e.slice(n,r.index))),t.push(r[0]),n=r.index+r[0].length;return t.push(Lv(e.slice(n))),t.join(``)}function zv(e){if(!e?.includes(`$`))return e;let t=[],n=0;for(let r of e.matchAll(xv))t.push(Rv(e.slice(n,r.index))),t.push(r[0]),n=r.index+r[0].length;return t.push(Rv(e.slice(n))),t.join(``)}const Bv={note:`md-callout-info`,tip:`md-callout-info`,warning:`md-callout-attention`,important:`md-callout-attention`,caution:`md-callout-destructive`},Vv={note:`Note`,tip:`Tip`,warning:`Warning`,important:`Important`,caution:`Caution`};function Hv(){return e=>{rd(e,e=>{if(e.type!==`containerDirective`&&e.type!==`leafDirective`&&e.type!==`textDirective`)return;let t=e;t.data||={};let n=t.data,r=t.attributes||{},i=t.name;if(i===`pagebreak`){n.hName=`hr`,n.hProperties={className:`md-pagebreak`};return}if(i===`columns`){n.hName=`div`,n.hProperties={className:`md-columns`};return}if(i===`column`){n.hName=`div`;let e={className:`md-column`};r.width&&(e.style=`flex-basis:${r.width};flex-grow:0;flex-shrink:0`),n.hProperties=e;return}if(i in Bv){n.hName=`div`,n.hProperties={className:`md-callout ${Bv[i]}`,"data-callout-type":i};let e=Vv[i];if(e&&t.children){let n={type:`paragraph`,data:{hName:`p`,hProperties:{className:`md-callout-title`}},children:[{type:`text`,value:e}]};t.children.unshift(n)}return}n.hName=`div`,n.hProperties={className:`md-${i}`,...Object.fromEntries(Object.entries(r).filter(([e])=>e!==`class`))},r.class&&(n.hProperties.className+=` ${r.class}`)})}}const Uv=/(?:^|[^\\])\$/,Wv=[];let Gv,Kv;function qv(){return Kv||=import(`rehype-katex`).then(({default:e})=>(Gv=e,e)),Kv}function Jv(e){let t=M.useMemo(()=>Uv.test(e),[e]),[n,r]=M.useState(()=>Gv);return M.useEffect(()=>{if(!t||n)return;let e=!1;return qv().then(t=>{e||r(()=>t)}).catch(e=>{console.error(`Failed to load KaTeX; math will render unstyled`,e)}),()=>{e=!0}},[t,n]),M.useMemo(()=>n?[n]:Wv,[n])}const Yv=[`artifact:`,`image:`,`store:`,`document:`,`document://`,`collection:`,`interaction:`,`prompt:`,`agent:`,`workflow:`,`process:`,`run:`];function Xv(e){return Yv.some(t=>e.startsWith(t))?e:of(e)}function Zv(){return e=>{rd(e,`html`,(e,t,n)=>{let r=e,i=n;if(typeof r.value==`string`&&/<!--[\s\S]*?-->/.test(r.value)&&i?.children&&typeof t==`number`)return i.children.splice(t,1),[`skip`,t]})}}const Qv=X_();function $v({children:e,components:n,remarkPlugins:r=[],removeComments:i=!0,artifactRunId:a,onArtifactOpen:o,className:s,codeClassName:c,inlineCodeClassName:l,linkClassName:u,imageClassName:d,onProposalSelect:f,onProposalSubmit:p,preserveSourcePositions:m=!1}){let h=j_(),g=M.useMemo(()=>m?e:bv(_v(zv(e))),[e,m]),_=M.useMemo(()=>{let e=[$g,tm,Hv,n_,zf,D_,g_,...r];return i&&e.push(Zv),e},[r,i]),v=Jv(g),y=M.useMemo(()=>({handlers:{...Lf}}),[]),b=M.useMemo(()=>{let e=n||{},r=e.code,i=e.a,s=e.img,f=({node:e,className:n,children:i,...a})=>{let o=/language-([\w-]+)/.exec(n||``),s=!o,u=o?o[1]:``;if(!s&&u){if(h){let e=h.getComponent(u);if(e){let n=String(i||``).trim();return t(e,{code:n,language:u})}}if(Y_(u)){let e=String(i||``).trim();return t(J_,{code:e,language:u})}let e=Qv[u];if(e){let n=String(i||``).trim();return t(e,{code:n,language:u})}}return typeof r==`function`?t(r,{node:e,className:n,...a,children:i}):t(`code`,{...a,className:s?`px-1.5 py-0.5 rounded ${l||``}`:` ${c||``}`,children:i})},p=e=>{let{node:n,href:r,children:s,...c}=e;return t(av,{node:n,href:r,className:u,artifactRunId:a,onArtifactOpen:o,ExistingLink:typeof i==`function`?i:void 0,...c,children:s})},m=e=>{let{node:n,src:r,alt:i,title:o,...c}=e;return o?t(tv,{src:r,alt:i,caption:o,className:d,artifactRunId:a}):t(rv,{node:n,src:r,alt:i,className:d,artifactRunId:a,ExistingImg:typeof s==`function`?s:void 0,...c})};return{...e,code:f,a:p,img:m}},[n,a,o,h,c,l,u,d]),x=t($i,{artifactRunId:a,onProposalSelect:f,onProposalSubmit:p,MarkdownRenderer:$v,children:t(tf,{remarkPlugins:_,rehypePlugins:v,remarkRehypeOptions:y,components:b,urlTransform:Xv,children:g})});return s?t(`div`,{className:`md-content ${s}`,children:x}):t(`div`,{className:`md-content`,children:x})}const ey=new Set([`list`,`blockquote`,`table`]),ty=N(null),ny=N(!1),ry=ne(()=>import(`@vertesia/ui/rich-text`).then(e=>({default:e.VertesiaMarkdownComponentEditor}))),iy=/^ {0,3}(#{1,6})[\t ]+(.+?)[\t ]*#*[\t ]*$/,ay=/^ {0,3}(`{3,}|~{3,})/;function oy(){return typeof crypto<`u`&&`randomUUID`in crypto?crypto.randomUUID():`edit-${Date.now()}-${Math.random().toString(36).slice(2,10)}`}function sy(e,t,n){let r=t?.position?.start.offset,i=t?.position?.end.offset,a=typeof r==`number`&&typeof i==`number`&&r>=0&&i>=r,o=a?e.slice(r,i):``;return{block_id:a?`${n}:${r}:${i}`:`${n}:${oy()}`,block_type:n,...a?{source_range:{start:r,end:i}}:{},exact_text:o,...a&&r>0?{prefix:e.slice(Math.max(0,r-80),r)}:{},...a&&i<e.length?{suffix:e.slice(i,Math.min(e.length,i+80))}:{}}}function cy(e,t){let n=t.source_range?.start;if(typeof n!=`number`)return t;let r=uy(e,n),i=dy(e,t.exact_text,n,r);return{...t,...r.length>0?{heading_path:r}:{},occurrence_index:i}}function ly(e,t,n){return cy(e,sy(e,t,n))}function uy(e,t){let n=[],r=null,i=0;for(let a of e.slice(0,t).split(`
323
+ `)){let e=ay.exec(a);if(e){let t=e[1]?.[0];r?t===r&&(r=null):r=t??null,i+=a.length+1;continue}if(!r){let e=iy.exec(a);if(e){let t=e[1]?.length??1,r=e[2]?.trim();r&&(n.length=t-1,n[t-1]=r)}}if(i+=a.length+1,i>t)break}return n.filter(e=>!!e)}function dy(e,t,n,r){if(!t)return 0;let i=0,a=e.indexOf(t);for(;a>=0&&a<n;){let n=uy(e,a);n.length===r.length&&n.every((e,t)=>e===r[t])&&i++,a=e.indexOf(t,a+Math.max(1,t.length))}return i}function fy(e){return e.kind===`store_document`?`store:${e.document_id}`:`artifact:${e.path} (run ${e.run_id})`}function py(...e){let t=0;for(let n of e)for(let e of n.matchAll(/`+/g))t=Math.max(t,e[0].length);return"`".repeat(Math.max(3,t+1))}function my(e,t){let n=t.user_change;if(!n)return;let{before:r,after:i}=n,a=t.anchor.source_range;if(a&&e.slice(a.start,a.end)===r)return e.slice(0,a.start)+i+e.slice(a.end);let o=t.anchor.prefix;if(o){let t=e.indexOf(o+r);if(t>=0&&e.indexOf(o+r,t+1)<0){let n=t+o.length;return e.slice(0,n)+i+e.slice(n+r.length)}}let s=e.indexOf(r);if(!(s<0||e.indexOf(r,s+1)>=0))return e.slice(0,s)+i+e.slice(s+r.length)}function hy(e){let t=fy(e.resource),n=e.anchor.block_type.replace(`_`,` `);if(e.action===`edit`&&e.user_change&&e.applied){let r=py(e.user_change.before,e.user_change.after);return[`I already edited the ${n} in ${t} myself and the change is saved${e.updated_document_id?` as revision ${e.updated_document_id}`:``}.`,`Operation: ${e.operation_id}`,`This is a notification only. Do not apply this change again and do not modify the document in response; acknowledge briefly and use the latest content going forward.`,``,`Before:`,`${r}markdown`,e.user_change.before,r,``,`After:`,`${r}markdown`,e.user_change.after,r].join(`
324
+ `)}if(e.action===`edit`&&e.user_change){let r=py(e.user_change.before,e.user_change.after);return[`Apply my edit to the ${n} in ${t}, then update the resource.`,`Operation: ${e.operation_id}`,`Preserve all content outside the selected block exactly; do not regenerate unrelated sections.`,``,`Before:`,`${r}markdown`,e.user_change.before,r,``,`After:`,`${r}markdown`,e.user_change.after,r].join(`
325
+ `)}let r=py(e.anchor.exact_text);return[`Update the ${n} in ${t} based on this comment:`,`Operation: ${e.operation_id}`,`Preserve all content outside the selected block exactly; do not regenerate unrelated sections.`,``,e.comment??``,``,`Selected content:`,`${r}markdown`,e.anchor.exact_text,r].join(`
326
+ `)}function gy(){let e=ie(ty);if(!e)throw Error(`Collaborative Markdown blocks must be rendered inside CollaborativeMarkdownRenderer`);return e}function _y({anchor:e,mode:i,initialDraft:a}){let{t:o}=B(),{artifactRunId:s,readOnly:c,allowComments:l,cancelEditing:u,submit:d,updateDraft:f}=gy(),[p,m]=z(i===`edit`?e.exact_text:i===`insert`?a??``:``),[h,g]=z(!1),_=i===`comment`?!l:c,v=e=>{m(e),f(e)},y=async()=>{if(!(!p.trim()||h)){g(!0);try{await d(e,i,i===`comment`?p.trim():p)}finally{g(!1)}}};return n(`div`,{className:`mb-2 space-y-2`,children:[i===`edit`||i===`insert`?t(ee,{fallback:t(x,{value:p,onChange:e=>v(e.target.value),placeholder:o(`agent.editSelectionPlaceholder`),rows:6,autoFocus:!0}),children:t(ry,{value:p,onChange:v,artifactRunId:s,editable:!c,externalValueSync:`manual`,autoFocus:!0})}):t(x,{value:p,onChange:e=>v(e.target.value),placeholder:o(`agent.commentOnSelectionPlaceholder`),rows:3,autoFocus:!0,disabled:!l}),n(`div`,{className:`flex justify-end gap-2`,children:[n(r,{variant:`outline`,size:`sm`,onClick:u,disabled:h,children:[t(Tt,{className:`me-1 size-4`}),o(`store.cancelEdit`)]}),n(r,{size:`sm`,onClick:()=>void y(),disabled:_||!p.trim()||h,children:[t(vt,{className:`me-1 size-4`}),o(`agent.send`)]})]})]})}function vy(i,a,u){return function({node:d,children:f,...p}){let{t:m}=B(),{markdown:h,readOnly:g,allowComments:_,activeEditing:v,highlightChangesFrom:y,flashChangedBlocks:b,beginEditing:x}=gy(),w=ie(ny),T=u?M.createElement(u,{node:d,...p},f):M.createElement(i,p,f);if(w)return T;let E=sy(h,d,a),D=!!(E.source_range&&E.exact_text),O=!g&&D,k=_&&D,A=v?.anchor.block_id===E.block_id,j=A&&v?.mode===`edit`,ee=b&&!!E.exact_text&&!!y&&!y?.includes(E.exact_text),N=C(`group/collab relative rounded-md border transition-colors duration-700`,`-mx-2 -my-1 px-2 py-1`,j?`border-transparent`:A?`border-info bg-mixer-info/5`:O||k?`border-transparent hover:border-mixer-info/30 hover:bg-mixer-muted/10`:`border-transparent`,ee&&`border-mixer-success/50 bg-mixer-success/15 ring-1 ring-mixer-success/20`),te=O||k||A?n(e,{children:[n(`div`,{className:C(`absolute end-1 top-1 z-10 flex items-center gap-0.5 rounded-md border bg-background p-0.5 shadow-sm`,(!O&&!k||j)&&`hidden`,A?`opacity-100`:`pointer-events-none opacity-0 group-hover/collab:pointer-events-auto group-hover/collab:opacity-100 group-focus-within/collab:pointer-events-auto group-focus-within/collab:opacity-100`),children:[k?t(S,{description:m(`agent.commentOnSelection`),asChild:!0,children:t(r,{variant:`ghost`,size:`sm`,className:`h-7 w-7 p-0`,"aria-label":m(`agent.commentOnSelection`),onClick:()=>x(E,`comment`),children:t(ft,{className:`size-4`})})}):null,O?t(S,{description:m(`agent.editSelection`),asChild:!0,children:t(r,{variant:`ghost`,size:`sm`,className:`h-7 w-7 p-0`,"aria-label":m(`agent.editSelection`),onClick:()=>x(E,`edit`),children:t(mt,{className:`size-4`})})}):null,O?n(o,{children:[t(S,{description:m(`agent.insertComponent`),asChild:!0,children:t(l,{asChild:!0,children:t(r,{variant:`ghost`,size:`sm`,className:`h-7 w-7 p-0`,"aria-label":m(`agent.insertComponent`),children:t(gt,{className:`size-4`})})})}),n(s,{align:`end`,className:`w-52`,children:[n(c,{onClick:()=>x(E,`insert`,m(`richText.paragraph`)),children:[t(ht,{}),m(`richText.paragraph`)]}),n(c,{onClick:()=>x(E,`insert`,`## ${m(`richText.heading2`)}`),children:[t(at,{}),m(`richText.heading2`)]}),n(c,{onClick:()=>x(E,`insert`,`- ${m(`richText.bulletList`)}`),children:[t(lt,{}),m(`richText.bulletList`)]}),n(c,{onClick:()=>x(E,`insert`,`> ${m(`richText.blockquote`)}`),children:[t(_t,{}),m(`richText.blockquote`)]}),n(c,{onClick:()=>x(E,`insert`,"```\nCode\n```"),children:[t(Qe,{}),m(`richText.codeBlock`)]}),n(c,{onClick:()=>x(E,`insert`,`| Column | Value |
11
327
  | --- | --- |
12
- | A | 1 |`),children:[t(R,{}),m(`richText.table`)]}),n(c,{onClick:()=>b(w,`insert`,`[${m(`agent.insertLink`)}](https://example.com)`),children:[t(me,{}),m(`agent.insertLink`)]}),n(c,{onClick:()=>b(w,`insert`,'```chart\n{"$schema":"https://vega.github.io/schema/vega-lite/v5.json","data":{"values":[{"category":"A","value":1}]},"mark":"bar","encoding":{"x":{"field":"category","type":"nominal"},"y":{"field":"value","type":"quantitative"}}}\n```'),children:[t(A,{}),m(`agent.insertChart`)]})]})]}):null]}),D&&v?t(zi,{anchor:v.anchor,mode:v.mode,initialDraft:v.initialDraft},`${v.anchor.block_id}:${v.mode}:${v.initialDraft??``}`):null]}):null,M=Si.has(a)?t(wi.Provider,{value:!0,children:C}):C;return n(`div`,{className:re,"data-collaborative-block":w.block_id,children:[O?null:M,j]})}}function Bi({children:e,resource:i,baseVersion:a,artifactRunId:o,components:s,readOnly:c=!1,allowComments:l=!c,highlightChangesFrom:u,highlightVersion:d=0,onAction:f,className:p,...m}){let{t:h}=J(),[g,_]=q(),[v,y]=q(),[ee,x]=q(!1),S=K(``);W(()=>{if(!u||d<=0)return;x(!0);let e=window.setTimeout(()=>x(!1),1800);return()=>window.clearTimeout(e)},[u,d]),W(()=>{let t=g?.anchor.source_range;if(!g||!t||e.slice(t.start,t.end)===g.anchor.exact_text)return;let n=S.current,r=g.mode===`edit`?g.anchor.exact_text:g.mode===`insert`?g.initialDraft??``:``;n.trim()&&n!==r&&y({...g,draft:n}),_(void 0)},[g,e]);let te=G(()=>({...s,p:$(`p`,`paragraph`,s?.p),h1:$(`h1`,`heading`,s?.h1),h2:$(`h2`,`heading`,s?.h2),h3:$(`h3`,`heading`,s?.h3),h4:$(`h4`,`heading`,s?.h4),h5:$(`h5`,`heading`,s?.h5),h6:$(`h6`,`heading`,s?.h6),ul:$(`ul`,`list`,s?.ul),ol:$(`ol`,`list`,s?.ol),blockquote:$(`blockquote`,`blockquote`,s?.blockquote),pre:$(`pre`,`code_block`,s?.pre),table:$(`table`,`table`,s?.table),hr:$(`hr`,`separator`,s?.hr)}),[s]),C=H((t,n,r)=>{if(n===`comment`&&!l||n!==`comment`&&c)return;let i=Ai(e,t);S.current=n===`edit`?i.exact_text:r??``,_({anchor:i,mode:n,initialDraft:r})},[l,e,c]),w=H(()=>{S.current=``,_(void 0)},[]),T=H(e=>{S.current=e},[]),ne=H(async(e,t,n)=>{if(t===`comment`&&!l||t!==`comment`&&c)return;let r=t===`insert`?`${e.exact_text.replace(/\s+$/,``)}\n\n${n.trim()}`:n;await f({operation_id:Oi(),resource:i,base_version:a,action:t===`insert`?`edit`:t,anchor:e,...t===`comment`?{comment:n}:{user_change:{before:e.exact_text,after:r}}}),S.current=``,_(void 0)},[l,a,f,c,i]),E=G(()=>({markdown:e,artifactRunId:o,readOnly:c,allowComments:l,activeEditing:g,highlightChangesFrom:u,flashChangedBlocks:ee,beginEditing:C,cancelEditing:w,updateDraft:T,submit:ne}),[g,l,o,C,w,ee,u,e,c,ne,T]);return n(Ci.Provider,{value:E,children:[v?n(`div`,{className:`not-prose mb-3 rounded-md border border-mixer-attention/35 bg-mixer-attention/10 p-3`,children:[n(`div`,{className:`flex items-start justify-between gap-3`,children:[n(`div`,{children:[t(`div`,{className:`text-sm font-semibold text-foreground`,children:h(`agent.documentEditingDraftPreserved`)}),t(`div`,{className:`mt-0.5 text-xs leading-4 text-muted`,children:h(`agent.documentEditingDraftPreservedDescription`)})]}),t(r,{variant:`ghost`,size:`sm`,className:`h-7 w-7 shrink-0 p-0`,onClick:()=>y(void 0),"aria-label":h(`agent.close`),children:t(Te,{className:`size-4`})})]}),t(b,{className:`mt-2`,value:v.draft,onChange:e=>y(t=>t&&{...t,draft:e.target.value}),rows:4})]}):null,t(xi,{...m,artifactRunId:o,className:p,components:te,preserveSourcePositions:!0,children:e})]})}function Vi(e){return e.split(/(\s+)/).filter(e=>e.length>0)}function Hi(e,t,n){if(!n)return;let r=e[e.length-1];r&&r.type===t?r.text+=n:e.push({type:t,text:n})}function Ui(e,t,n){let r=e.length+1,i=t.length+1,a=new Uint32Array(r*i);for(let n=e.length-1;n>=0;n--)for(let r=t.length-1;r>=0;r--)a[n*i+r]=e[n]===t[r]?a[(n+1)*i+r+1]+1:Math.max(a[(n+1)*i+r],a[n*i+r+1]);let o=0,s=0;for(;o<e.length&&s<t.length;)e[o]===t[s]?(Hi(n,`equal`,e[o]),o++,s++):a[(o+1)*i+s]>=a[o*i+s+1]?(Hi(n,`removed`,e[o]),o++):(Hi(n,`added`,t[s]),s++);Hi(n,`removed`,e.slice(o).join(``)),Hi(n,`added`,t.slice(s).join(``))}function Wi(e,t){if(e===t)return e?[{type:`equal`,text:e}]:[];let n=Vi(e),r=Vi(t),i=0;for(;i<n.length&&i<r.length&&n[i]===r[i];)i++;let a=n.length,o=r.length;for(;a>i&&o>i&&n[a-1]===r[o-1];)a--,o--;let s=[];Hi(s,`equal`,n.slice(0,i).join(``));let c=n.slice(i,a),l=r.slice(i,o);return c.length*l.length>36e4?(Hi(s,`removed`,c.join(``)),Hi(s,`added`,l.join(``))):Ui(c,l,s),Hi(s,`equal`,n.slice(a).join(``)),s}function Gi(e,t){let n=[],r=0;for(;r<e.length&&r<t.length&&e[r]===t[r];)n.push({type:`equal`,line:e[r]}),r++;let i=e.length,a=t.length,o=[];for(;i>r&&a>r&&e[i-1]===t[a-1];)i--,a--,o.unshift({type:`equal`,line:e[i]});let s=e.slice(r,i),c=t.slice(r,a);if(s.length*c.length>36e4){for(let e of s)n.push({type:`removed`,line:e});for(let e of c)n.push({type:`added`,line:e});return[...n,...o]}let l=s.length+1,u=c.length+1,d=new Uint32Array(l*u);for(let e=s.length-1;e>=0;e--)for(let t=c.length-1;t>=0;t--)d[e*u+t]=s[e]===c[t]?d[(e+1)*u+t+1]+1:Math.max(d[(e+1)*u+t],d[e*u+t+1]);let f=0,p=0;for(;f<s.length&&p<c.length;)s[f]===c[p]?(n.push({type:`equal`,line:s[f]}),f++,p++):d[(f+1)*u+p]>=d[f*u+p+1]?(n.push({type:`removed`,line:s[f]}),f++):(n.push({type:`added`,line:c[p]}),p++);for(;f<s.length;)n.push({type:`removed`,line:s[f++]});for(;p<c.length;)n.push({type:`added`,line:c[p++]});return[...n,...o]}function Ki(e){return e.match(/[^\n]*\n|[^\n]+$/g)??[]}function qi(e,t){if(!e.includes(`
328
+ | A | 1 |`),children:[t(bt,{}),m(`richText.table`)]}),n(c,{onClick:()=>x(E,`insert`,`[${m(`agent.insertLink`)}](https://example.com)`),children:[t(ct,{}),m(`agent.insertLink`)]}),n(c,{onClick:()=>x(E,`insert`,'```chart\n{"$schema":"https://vega.github.io/schema/vega-lite/v5.json","data":{"values":[{"category":"A","value":1}]},"mark":"bar","encoding":{"x":{"field":"category","type":"nominal"},"y":{"field":"value","type":"quantitative"}}}\n```'),children:[t(Ge,{}),m(`agent.insertChart`)]})]})]}):null]}),A&&v?t(_y,{anchor:v.anchor,mode:v.mode,initialDraft:v.initialDraft},`${v.anchor.block_id}:${v.mode}:${v.initialDraft??``}`):null]}):null,P=ey.has(a)?t(ny.Provider,{value:!0,children:T}):T;return n(`div`,{className:N,"data-collaborative-block":E.block_id,children:[j?null:P,te]})}}function yy({children:e,resource:i,baseVersion:a,artifactRunId:o,components:s,readOnly:c=!1,allowComments:l=!c,highlightChangesFrom:u,highlightVersion:d=0,onAction:f,className:p,...m}){let{t:h}=B(),[g,_]=z(),[v,y]=z(),[b,S]=z(!1),C=R(``);I(()=>{if(!u||d<=0)return;S(!0);let e=window.setTimeout(()=>S(!1),1800);return()=>window.clearTimeout(e)},[u,d]),I(()=>{let t=g?.anchor.source_range;if(!g||!t||e.slice(t.start,t.end)===g.anchor.exact_text)return;let n=C.current,r=g.mode===`edit`?g.anchor.exact_text:g.mode===`insert`?g.initialDraft??``:``;n.trim()&&n!==r&&y({...g,draft:n}),_(void 0)},[g,e]);let w=L(()=>({...s,p:vy(`p`,`paragraph`,s?.p),h1:vy(`h1`,`heading`,s?.h1),h2:vy(`h2`,`heading`,s?.h2),h3:vy(`h3`,`heading`,s?.h3),h4:vy(`h4`,`heading`,s?.h4),h5:vy(`h5`,`heading`,s?.h5),h6:vy(`h6`,`heading`,s?.h6),ul:vy(`ul`,`list`,s?.ul),ol:vy(`ol`,`list`,s?.ol),blockquote:vy(`blockquote`,`blockquote`,s?.blockquote),pre:vy(`pre`,`code_block`,s?.pre),table:vy(`table`,`table`,s?.table),hr:vy(`hr`,`separator`,s?.hr)}),[s]),T=F((t,n,r)=>{if(n===`comment`&&!l||n!==`comment`&&c)return;let i=cy(e,t);C.current=n===`edit`?i.exact_text:r??``,_({anchor:i,mode:n,initialDraft:r})},[l,e,c]),E=F(()=>{C.current=``,_(void 0)},[]),D=F(e=>{C.current=e},[]),O=F(async(e,t,n)=>{if(t===`comment`&&!l||t!==`comment`&&c)return;let r=t===`insert`?`${e.exact_text.replace(/\s+$/,``)}\n\n${n.trim()}`:n;await f({operation_id:oy(),resource:i,base_version:a,action:t===`insert`?`edit`:t,anchor:e,...t===`comment`?{comment:n}:{user_change:{before:e.exact_text,after:r}}}),C.current=``,_(void 0)},[l,a,f,c,i]),k=L(()=>({markdown:e,artifactRunId:o,readOnly:c,allowComments:l,activeEditing:g,highlightChangesFrom:u,flashChangedBlocks:b,beginEditing:T,cancelEditing:E,updateDraft:D,submit:O}),[g,l,o,T,E,b,u,e,c,O,D]);return n(ty.Provider,{value:k,children:[v?n(`div`,{className:`not-prose mb-3 rounded-md border border-mixer-attention/35 bg-mixer-attention/10 p-3`,children:[n(`div`,{className:`flex items-start justify-between gap-3`,children:[n(`div`,{children:[t(`div`,{className:`text-sm font-semibold text-foreground`,children:h(`agent.documentEditingDraftPreserved`)}),t(`div`,{className:`mt-0.5 text-xs leading-4 text-muted`,children:h(`agent.documentEditingDraftPreservedDescription`)})]}),t(r,{variant:`ghost`,size:`sm`,className:`h-7 w-7 shrink-0 p-0`,onClick:()=>y(void 0),"aria-label":h(`agent.close`),children:t(Tt,{className:`size-4`})})]}),t(x,{className:`mt-2`,value:v.draft,onChange:e=>y(t=>t&&{...t,draft:e.target.value}),rows:4})]}):null,t($v,{...m,artifactRunId:o,className:p,components:w,preserveSourcePositions:!0,children:e})]})}function by(e){return e.split(/(\s+)/).filter(e=>e.length>0)}function xy(e,t,n){if(!n)return;let r=e[e.length-1];r&&r.type===t?r.text+=n:e.push({type:t,text:n})}function Sy(e,t,n){let r=e.length+1,i=t.length+1,a=new Uint32Array(r*i);for(let n=e.length-1;n>=0;n--)for(let r=t.length-1;r>=0;r--)a[n*i+r]=e[n]===t[r]?a[(n+1)*i+r+1]+1:Math.max(a[(n+1)*i+r],a[n*i+r+1]);let o=0,s=0;for(;o<e.length&&s<t.length;)e[o]===t[s]?(xy(n,`equal`,e[o]),o++,s++):a[(o+1)*i+s]>=a[o*i+s+1]?(xy(n,`removed`,e[o]),o++):(xy(n,`added`,t[s]),s++);xy(n,`removed`,e.slice(o).join(``)),xy(n,`added`,t.slice(s).join(``))}function Cy(e,t){if(e===t)return e?[{type:`equal`,text:e}]:[];let n=by(e),r=by(t),i=0;for(;i<n.length&&i<r.length&&n[i]===r[i];)i++;let a=n.length,o=r.length;for(;a>i&&o>i&&n[a-1]===r[o-1];)a--,o--;let s=[];xy(s,`equal`,n.slice(0,i).join(``));let c=n.slice(i,a),l=r.slice(i,o);return c.length*l.length>36e4?(xy(s,`removed`,c.join(``)),xy(s,`added`,l.join(``))):Sy(c,l,s),xy(s,`equal`,n.slice(a).join(``)),s}function wy(e,t){let n=[],r=0;for(;r<e.length&&r<t.length&&e[r]===t[r];)n.push({type:`equal`,line:e[r]}),r++;let i=e.length,a=t.length,o=[];for(;i>r&&a>r&&e[i-1]===t[a-1];)i--,a--,o.unshift({type:`equal`,line:e[i]});let s=e.slice(r,i),c=t.slice(r,a);if(s.length*c.length>36e4){for(let e of s)n.push({type:`removed`,line:e});for(let e of c)n.push({type:`added`,line:e});return[...n,...o]}let l=s.length+1,u=c.length+1,d=new Uint32Array(l*u);for(let e=s.length-1;e>=0;e--)for(let t=c.length-1;t>=0;t--)d[e*u+t]=s[e]===c[t]?d[(e+1)*u+t+1]+1:Math.max(d[(e+1)*u+t],d[e*u+t+1]);let f=0,p=0;for(;f<s.length&&p<c.length;)s[f]===c[p]?(n.push({type:`equal`,line:s[f]}),f++,p++):d[(f+1)*u+p]>=d[f*u+p+1]?(n.push({type:`removed`,line:s[f]}),f++):(n.push({type:`added`,line:c[p]}),p++);for(;f<s.length;)n.push({type:`removed`,line:s[f++]});for(;p<c.length;)n.push({type:`added`,line:c[p++]});return[...n,...o]}function Ty(e){return e.match(/[^\n]*\n|[^\n]+$/g)??[]}function Ey(e,t){if(!e.includes(`
13
329
  `)&&!t.includes(`
14
- `))return Wi(e,t);if(e===t)return e?[{type:`equal`,text:e}]:[];let n=[],r=Gi(Ki(e),Ki(t)),i=0;for(;i<r.length;){let e=r[i];if(e.type===`equal`){Hi(n,`equal`,e.line),i++;continue}let t=``,a=``;for(;i<r.length&&r[i].type!==`equal`;){let e=r[i++];e.type===`removed`&&(t+=e.line),e.type===`added`&&(a+=e.line)}for(let e of Wi(t,a))Hi(n,e.type,e.text)}return n}function Ji(e,t){if(e===t)return[];let n=[],r=Gi(e.split(`
330
+ `))return Cy(e,t);if(e===t)return e?[{type:`equal`,text:e}]:[];let n=[],r=wy(Ty(e),Ty(t)),i=0;for(;i<r.length;){let e=r[i];if(e.type===`equal`){xy(n,`equal`,e.line),i++;continue}let t=``,a=``;for(;i<r.length&&r[i].type!==`equal`;){let e=r[i++];e.type===`removed`&&(t+=e.line),e.type===`added`&&(a+=e.line)}for(let e of Cy(t,a))xy(n,e.type,e.text)}return n}function Dy(e,t){if(e===t)return[];let n=[],r=wy(e.split(`
15
331
  `),t.split(`
16
- `)),i=0,a,o=()=>{a!==void 0&&(n.push({startLine:a,endLine:Math.max(a,i-1)}),a=void 0)};for(let e of r){if(e.type===`equal`){o(),i++;continue}a??=i,e.type===`added`&&i++}return o(),n}function Yi(e,t){let n=[],r=Gi(e,t),i=0,a=0;for(;a<r.length;){if(r[a].type===`equal`){i++,a++;continue}let e=i,t=[];for(;a<r.length&&r[a].type!==`equal`;){let e=r[a++];e.type===`removed`&&i++,e.type===`added`&&t.push(e.line)}n.push({start:e,end:i,replacement:t})}return n}function Xi(e,t){return e.start===t.start&&e.end===t.end&&e.replacement.length===t.replacement.length&&e.replacement.every((e,n)=>e===t.replacement[n])}function Zi(e,t){let n=e.start===e.end,r=t.start===t.end;return n&&r?e.start===t.start:n?e.start>=t.start&&e.start<=t.end:r?t.start>=e.start&&t.start<=e.end:e.start<t.end&&t.start<e.end}function Qi(e,t,n){if(t===n)return{status:`rebased`,content:t};if(t===e)return{status:`rebased`,content:n};if(n===e)return{status:`rebased`,content:t};let r=e.split(`
17
- `),i=Yi(r,t.split(`
18
- `)),a=Yi(r,n.split(`
19
- `)),o=[];for(let e of i){let n=!1;for(let r of a){if(Xi(e,r)){n=!0;break}if(Zi(e,r))return{status:`conflict`,content:t}}n||o.push(e)}let s=[...a,...o].sort((e,t)=>e.start-t.start||e.end-t.end),c=[],l=0;for(let e of s)c.push(...r.slice(l,e.start),...e.replacement),l=e.end;return c.push(...r.slice(l)),{status:`rebased`,content:c.join(`
20
- `)}}function $i(e,t,n={}){if(e===t)return;let r=n.context??2,i=Gi(e.split(`
332
+ `)),i=0,a,o=()=>{a!==void 0&&(n.push({startLine:a,endLine:Math.max(a,i-1)}),a=void 0)};for(let e of r){if(e.type===`equal`){o(),i++;continue}a??=i,e.type===`added`&&i++}return o(),n}function Oy(e,t){let n=[],r=wy(e,t),i=0,a=0;for(;a<r.length;){if(r[a].type===`equal`){i++,a++;continue}let e=i,t=[];for(;a<r.length&&r[a].type!==`equal`;){let e=r[a++];e.type===`removed`&&i++,e.type===`added`&&t.push(e.line)}n.push({start:e,end:i,replacement:t})}return n}function ky(e,t){return e.start===t.start&&e.end===t.end&&e.replacement.length===t.replacement.length&&e.replacement.every((e,n)=>e===t.replacement[n])}function Ay(e,t){let n=e.start===e.end,r=t.start===t.end;return n&&r?e.start===t.start:n?e.start>=t.start&&e.start<=t.end:r?t.start>=e.start&&t.start<=e.end:e.start<t.end&&t.start<e.end}function jy(e,t,n){if(t===n)return{status:`rebased`,content:t};if(t===e)return{status:`rebased`,content:n};if(n===e)return{status:`rebased`,content:t};let r=e.split(`
333
+ `),i=Oy(r,t.split(`
334
+ `)),a=Oy(r,n.split(`
335
+ `)),o=[];for(let e of i){let n=!1;for(let r of a){if(ky(e,r)){n=!0;break}if(Ay(e,r))return{status:`conflict`,content:t}}n||o.push(e)}let s=[...a,...o].sort((e,t)=>e.start-t.start||e.end-t.end),c=[],l=0;for(let e of s)c.push(...r.slice(l,e.start),...e.replacement),l=e.end;return c.push(...r.slice(l)),{status:`rebased`,content:c.join(`
336
+ `)}}function My(e,t,n={}){if(e===t)return;let r=n.context??2,i=wy(e.split(`
21
337
  `),t.split(`
22
338
  `)),a=[];for(let e=0;e<i.length;e++){if(i[e].type===`equal`)continue;let t=a[a.length-1];t&&e-t.end<=r*2?t.end=e+1:a.push({start:e,end:e+1})}if(a.length===0)return;let o=[],s=1,c=1,l=0;for(let e of a){let t=Math.max(e.start-r,l===0?0:l);for(;l<t;l++)i[l].type!==`added`&&s++,i[l].type!==`removed`&&c++;let n=Math.min(e.end+r,i.length),a=0,u=0,d=[];for(let e=t;e<n;e++){let t=i[e];t.type===`equal`?(d.push(` ${t.line}`),a++,u++):t.type===`removed`?(d.push(`-${t.line}`),a++):(d.push(`+${t.line}`),u++)}for(o.push(`@@ -${s},${a} +${c},${u} @@`,...d);l<n;l++)i[l].type!==`added`&&s++,i[l].type!==`removed`&&c++}let u=o.join(`
23
- `);if(!(n.maxChars!==void 0&&u.length>n.maxChars))return u}const ea=V(()=>import(`@vertesia/ui/rich-text`).then(e=>({default:e.VertesiaMarkdownDocumentEditor})));function ta(e,t){return e?.path===t?e.event_class===`artifact_updated`||e.event_class===`activity`&&e.tool_status===`completed`&&(e.tool===`edit_artifact`||e.tool===`write_artifact`):!1}function na(e,t){if(!Array.isArray(t?.changes)||t.changes.length===0)return;let n=e;for(let e of t.changes){if(!e||typeof e!=`object`||Array.isArray(e))return;let t=e;if(t.operation!==`replace`||typeof t.before!=`string`||typeof t.after!=`string`||!n.includes(t.before))return;if(t.replace_all===!0)n=n.split(t.before).join(t.after);else{if(n.indexOf(t.before)!==n.lastIndexOf(t.before))return;n=n.replace(t.before,t.after)}}return n}function ra(e){if(!(!e||typeof e!=`object`||!(`status`in e)))return typeof e.status==`number`?e.status:void 0}function ia({regions:e,totalLines:n,onNavigate:r}){let{t:i}=J();return e.length===0?null:t(`nav`,{className:`absolute inset-y-12 end-1 z-10 w-3 rounded-full border border-mixer-muted/25 bg-muted/20`,"aria-label":i(`agent.changeRuler`),children:e.map(e=>{let a=e.startLine/Math.max(1,n)*100,o=Math.max(1.5,(e.endLine-e.startLine+1)/Math.max(1,n)*100);return t(x,{description:i(`agent.changedRegion`,{line:e.startLine+1}),asChild:!0,children:t(`button`,{type:`button`,className:`absolute inset-x-0 rounded-full bg-attention transition-colors hover:bg-info focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-info`,style:{top:`${Math.min(98.5,a)}%`,height:`${Math.min(100-a,o)}%`},onClick:()=>r(e.startLine),"aria-label":i(`agent.changedRegion`,{line:e.startLine+1})})},`${e.startLine}:${e.endLine}`)})})}function aa(e,t){return Ji(e,t)}function oa({runId:e,path:a,initialContent:o=``,refreshKey:s=0,refreshDetails:c,readOnly:l=!1,allowComments:u=!1,viewMode:f=`components`,baselineContent:p,className:m,onAction:h,onSendMessage:g,onSendChangesToAgent:v,hasUnsentChanges:y=!1,isSendingChanges:ee=!1,sendChangesDisabled:b=!1,toolbarStatus:x,onContentChange:C,onDocumentEdit:w,onSaveStatusChange:T,flushChangesRef:E}){let{client:D}=Ie(),{t:O}=J(),k=ne(),[A,j]=q(o),[M,ie]=q(),[ae,oe]=q(),[se,ce]=q(0),[le,ue]=q(!!e),[fe,N]=q(!1),[pe,me]=q(!1),[he,ge]=q(),[_e,ve]=q(),[ye,be]=q(!1),xe=!l||u,Se=f!==`document`||_e?`idle`:fe||pe?`saving`:M?`saved`:`idle`;W(()=>{T?.(Se)},[Se,T]);let P=K(A),F=K(M),I=K(0),L=K(void 0),R=K(void 0),Ce=K(!1),we=K(void 0),Te=K(()=>Promise.resolve(!1)),Ee=K(!1),z=K(!1),B=K(null),V=K(M),Oe=K(o),U=K(void 0),ke=K(o),Ae=K(null),je=G(()=>aa(p??A,A),[p,A]),Me=G(()=>A.split(`
24
- `).length,[A]),Ne=H(e=>{U.current=e,ve(e)},[]);W(()=>{P.current=A},[A]),W(()=>{F.current=M},[M]),W(()=>{f===`document`&&(z.current=!1,Ee.current=!1)},[f]);let Pe=H(async t=>{if(!e)return;let n=++I.current;ue(!0),ge(void 0);for(let r=0;r<=60;r++)try{let t=await D.agents.getArtifactContent(e,a);if(I.current!==n)return;let r=P.current;r&&r!==t.content&&(oe(r),ce(e=>e+1)),P.current=t.content,F.current=t.generation,ke.current=t.content,!Ee.current&&R.current===void 0&&!Ce.current&&(V.current=t.generation,Oe.current=t.content),j(t.content),ie(t.generation),ge(void 0),ue(!1),C?.(t.content,t.generation);return}catch(e){if(I.current!==n||!t||ra(e)!==404||r===60){if(I.current!==n)return;ge(te(e,O(`agent.failedToLoadArtifact`))),ue(!1);return}await new Promise(e=>setTimeout(e,500))}},[D,C,a,e,O]);W(()=>(I.current++,P.current=o,F.current=void 0,ke.current=o,V.current=void 0,Oe.current=o,U.current=void 0,Ee.current=!1,z.current=!1,j(o),ie(void 0),oe(void 0),ge(void 0),ve(void 0),be(!1),me(!1),ue(!!e),e&&Pe(!0),()=>{I.current++}),[o,Pe,e]),W(()=>{if(!e||s<=0||U.current)return;let t=P.current,n=na(t,c);n!==void 0&&n!==t&&(P.current=n,F.current=void 0,oe(t),ce(e=>e+1),j(n),ie(void 0),C?.(n)),Pe(!1)},[Pe,C,c,s,e]);let Fe=H((e,t)=>{let n=P.current;P.current=e,F.current=t,Oe.current=e,V.current=t,R.current=void 0,Ne(void 0),B.current?.getMarkdown()!==e&&B.current?.commands.setContent(e,{contentType:`markdown`,emitUpdate:!1}),n!==e&&(oe(n),ce(e=>e+1)),j(e),ie(t),me(!1),C?.(e,t)},[C,Ne]),Y=H(async(t,n,r)=>{if(!e)return!1;P.current=n,R.current=void 0,j(n),me(!1),be(!0);let i,o;try{let s=await D.agents.getArtifactContent(e,a);i=s.content,o=s.generation,ke.current=s.content;let c=Qi(t,n,s.content);if(c.status===`conflict`)return Ne({baseContent:t,localContent:n,remoteContent:s.content,remoteGeneration:s.generation,pendingAction:r}),!1;let l=s.generation;if(c.content!==s.content)try{l=(await D.agents.updateArtifactContent(e,a,{content:c.content,generation:s.generation})).generation}catch(e){if(ra(e)===412)return Ne({baseContent:s.content,localContent:c.content,remoteContent:s.content,remoteGeneration:s.generation,pendingAction:r}),!1;throw e}return Fe(c.content,l),k({status:`success`,title:O(`agent.artifactConflictRebased`),duration:3e3}),{content:c.content,generation:l}}catch(e){return Ne({baseContent:t,localContent:n,remoteContent:i,remoteGeneration:o,pendingAction:r}),k({status:`error`,title:O(`agent.artifactConflictTitle`),description:te(e,O(`agent.failedToLoadArtifact`)),duration:5e3}),!1}finally{be(!1)}},[Fe,D.agents,a,e,O,k,Ne]),Le=H(async t=>{if(t.action===`comment`){await h?.(t);return}if(U.current){k({status:`warning`,title:O(`agent.artifactConflictTitle`),duration:3e3});return}if(!e||!F.current){k({status:`warning`,title:O(`agent.artifactEditingUnavailable`),duration:3e3});return}let n=P.current,r=Ii(n,t);if(r===void 0){k({status:`error`,title:O(`agent.documentEditApplyFailed`),description:O(`agent.documentEditApplyFailedDescription`),duration:5e3});return}try{let i=await D.agents.updateArtifactContent(e,a,{content:r,generation:F.current});P.current=r,F.current=i.generation,Oe.current=r,V.current=i.generation,oe(n),ce(e=>e+1),j(r),ie(i.generation),C?.(r,i.generation),await h?.({...t,applied:!0,base_version:i.generation}),ke.current=r}catch(e){if(ra(e)===412){let e=await Y(n,r,t);e&&(await h?.({...t,applied:!0,base_version:e.generation}),ke.current=e.content);return}k({status:`error`,title:O(`agent.documentEditApplyFailed`),description:te(e,O(`store.errorSavingTextDefault`)),duration:5e3})}},[D,h,C,a,Y,e,O,k]),Re=H(()=>{if(!e)return Promise.resolve(!1);if(we.current)return we.current;let t=(async()=>{Ce.current=!0,N(!0);try{for(;R.current!==void 0;){let t=R.current;R.current=void 0;let n=V.current;if(!n)throw Error(O(`agent.artifactEditingUnavailable`));let r=await D.agents.updateArtifactContent(e,a,{content:t,generation:n});F.current=r.generation,V.current=r.generation,Oe.current=t,ie(r.generation),C?.(P.current,r.generation)}return me(!1),!0}catch(e){return ra(e)===412?!!await Y(Oe.current,P.current):(k({status:`error`,title:O(`agent.documentEditApplyFailed`),description:te(e,O(`store.errorSavingTextDefault`)),duration:5e3}),!1)}finally{Ce.current=!1,N(!1)}})();return we.current=t,t.finally(()=>{we.current===t&&(we.current=void 0)}),t},[D.agents,C,a,Y,e,O,k]);Te.current=Re;let ze=H(async()=>{L.current!==void 0&&(clearTimeout(L.current),L.current=void 0);let t=B.current?.getMarkdown();t!==void 0&&t!==P.current&&(P.current=t,j(t),C?.(t,F.current),R.current=t);let n=U.current;if(n&&!await Y(n.baseContent,P.current))return!1;for(;R.current!==void 0||we.current;)if(!await Re())return!1;if(!e||!F.current)return!1;let r=ke.current;return ke.current=P.current,{previous:r,current:P.current}},[C,Re,Y,e]);W(()=>{if(E)return E.current=ze,()=>{E.current===ze&&(E.current=null)}},[E,ze]);let Be=H(e=>{if(e===P.current||Ee.current&&R.current===void 0&&!Ce.current&&e===Oe.current)return;if(!z.current){P.current=e,j(e);return}P.current=e,j(e),w?.(),C?.(e,F.current);let t=U.current;if(t){Ne({...t,localContent:e}),me(!1);return}me(!0),R.current=e,L.current!==void 0&&clearTimeout(L.current),L.current=setTimeout(()=>{L.current=void 0,Re()},400)},[C,w,Re,Ne]),Ve=H(e=>{Ee.current=e,e&&(z.current=!0),(e||R.current===void 0&&!Ce.current)&&(V.current=F.current,Oe.current=P.current)},[]),He=H(async()=>{let e=U.current;if(!e||ye)return;let t=await Y(e.baseContent,P.current,e.pendingAction);t&&e.pendingAction&&(await h?.({...e.pendingAction,applied:!0,base_version:t.generation}),ke.current=t.content)},[ye,h,Y]),Ue=H(e=>{let t=Ae.current?.querySelector(`.vertesia-markdown-document-editor-content`);if(!t)return;let n=Math.min(1,e/Math.max(1,Me-1));t.scrollTo({top:n*Math.max(0,t.scrollHeight-t.clientHeight),behavior:`smooth`})},[Me]);return W(()=>()=>{L.current!==void 0&&clearTimeout(L.current);let e=B.current?.getMarkdown();e!==void 0&&e!==P.current&&(P.current=e,R.current=e),R.current!==void 0&&Te.current()},[]),n(`div`,{className:m??`relative h-full min-h-0 overflow-y-auto px-4 py-3`,children:[_e?t(`div`,{className:`absolute inset-x-4 top-3 z-30`,role:`alert`,children:t(d,{status:`warning`,title:O(`agent.artifactConflictTitle`),className:`shadow-lg`,children:n(`div`,{className:`space-y-3`,children:[t(`p`,{children:O(`agent.artifactConflictDescription`)}),t(`div`,{className:`flex justify-end`,children:n(r,{variant:`outline`,size:`sm`,disabled:ye,onClick:()=>void He(),children:[ye?t(_,{size:`sm`}):null,O(`agent.artifactConflictRetry`)]})})]})})}):null,le&&!A?t(i,{className:`h-full min-h-[200px]`,children:t(_,{size:`lg`})}):he&&!A?n(i,{className:`h-full min-h-[200px] flex-col gap-3 text-center text-muted`,children:[t(`span`,{children:he}),t(r,{variant:`outline`,size:`sm`,onClick:()=>void Pe(!1),children:O(`agent.retry`)})]}):f===`document`?t(De,{fallback:t(i,{className:`h-full min-h-[200px]`,children:t(_,{size:`lg`})}),children:t(`div`,{className:`flex h-full min-h-0 flex-col`,children:n(`div`,{ref:Ae,className:`relative min-h-0 flex-1`,children:[t(ea,{value:A,onChange:Be,artifactRunId:e,editable:!l&&!!e,externalValueSync:`when-blurred`,onFocusChange:Ve,onEditor:e=>{B.current=e},onSendComment:g&&e&&!_e&&xe?g:void 0,onSendChangesToAgent:v,hasUnsentChanges:y,isSendingChanges:ee,sendChangesDisabled:b||!e||!!_e,toolbarStatus:x,contentClassName:`pe-5`}),t(ia,{regions:je,totalLines:Me,onNavigate:Ue}),!T&&Se!==`idle`?n(`div`,{className:S(`pointer-events-none absolute bottom-3 end-6 flex items-center gap-1.5 rounded-full`,`border border-mixer-muted/25 bg-background/90 px-2.5 py-1 text-[11px] shadow-sm`,fe||pe?`text-muted`:`text-success`),children:[fe||pe?t(_,{size:`sm`}):t(re,{className:`size-3`}),O(fe||pe?`agent.savingWorkingCopy`:`agent.savedToWorkingCopy`)]}):null]})})}):t(`div`,{className:`vprose prose-sm mx-auto max-w-5xl`,children:t(Bi,{artifactRunId:e,resource:{kind:`agent_artifact`,run_id:e??`pending`,path:a},baseVersion:M,readOnly:l||!e||!!_e,allowComments:xe&&!!e&&!_e,highlightChangesFrom:ae,highlightVersion:se,onAction:Le,children:A})}),le&&A?t(`div`,{className:`absolute end-3 top-3 rounded-full bg-background/80 p-2 shadow-sm`,children:t(de,{className:`size-4 animate-pulse text-muted`})}):null]})}function sa({percent:e}){return t(`div`,{className:`w-full bg-gray-200 rounded-full h-2.5 dark:bg-gray-700`,children:t(`div`,{className:`bg-blue-600 h-2.5 rounded-full`,style:{width:`${e}%`}})})}function ca({className:e,properties:r}){return t(ee,{className:e,children:t(`tbody`,{children:r.map(e=>n(`tr`,{children:[n(`td`,{className:`w-1/3 font-semibold gap-2`,children:[t(`span`,{children:e.name}),e.description&&t(x,{description:e.description,placement:`top`,children:t(pe,{className:`size-3 ms-2 text-muted-foreground`})})]}),t(`td`,{className:`w-2/3`,children:e.value??`undefined`})]},e.name))})})}function la({content:e,...n}){let r=K(null);return W(()=>{if(!r.current)return;let t=new DOMParser().parseFromString(e,`image/svg+xml`).querySelector(`svg`);if(!t){console.warn(`SvgIcon: No <svg> element found in provided string`),r.current.innerHTML=``;return}Object.entries(n).forEach(([e,n])=>{if(n==null)return;let r=e===`className`?`class`:e;t.setAttribute(r,String(n))}),r.current.innerHTML=``,r.current.appendChild(t)}),t(`span`,{ref:r})}function ua(e){return n=>t(la,{content:e,...n})}function da(e){return{name:e.getNameSignature(),type:e.getTypeSignature(),description:e.description,extractable:e.extractable}}var fa;(function(e){e.string=`string`,e.number=`number`,e.integer=`integer`,e.boolean=`boolean`,e.object=`object`,e.any=`any`,e.text=`text`,e.media=`media`,e.document=`document`})(fa||={});function pa(e){e=e.trim();let t=!1,n=!1;e.endsWith(`?`)&&(n=!0,e=e.substring(0,e.length-1).trim()),e.endsWith(`[]`)&&(t=!0,e=e.substring(0,e.length-2).trim());let r=fa[e];if(!r)throw Error(`Unknown type "${e}"`);return{name:r,isArray:t,isNullable:n,isObject:r===fa.object}}function ma(){let e=Object.values(fa),t=[...e];for(let n of e)t.push(`${n}[]`);return e.sort(),t}const ha=ma();function ga({value:e,onChange:i,onCancel:a,onSave:o}){let{t:s}=J(),[c,l]=q(!1);return e?n(`div`,{className:`flex items-center`,children:[t(`div`,{className:`flex-1`,children:t(_a,{value:e.name,onChange:t=>{i({...e,name:t})},onCancel:a,onSave:o})}),t(`div`,{className:`px-1 font-semibold`,children:`:`}),t(`div`,{className:`flex-1`,children:t(va,{value:e.type,onChange:t=>{i({...e,type:t})},onCancel:a,onSave:o})}),n(`div`,{children:[t(r,{variant:`ghost`,size:`xs`,onClick:()=>l(!0),title:s(`widgets.schema.editDescription`),children:t(k,{className:`size-4`})}),t(ya,{value:e.description,isOpen:c,onClose:t=>{t!==void 0&&typeof t==`string`&&i({...e,description:t},!0),l(!1)}})]})]}):null}function _a({value:e,onChange:n,onCancel:r,onSave:i}){let a=K(null);return W(()=>{a.current?.focus()},[]),t(`input`,{onKeyUp:e=>{switch(e.key){case`Enter`:i?.();break;case`Escape`:r?.()}},ref:a,value:e,onChange:e=>{n(e.target.value)},className:v.INPUT_UNSTYLED,style:{fontSize:`inherit`,width:``,display:`inline`}})}function va({value:e,onChange:n,onCancel:r,onSave:i}){return t(g,{className:v.INPUT_UNSTYLED,options:ha,value:e||``,onBlur:()=>{i?.()},onChange:n,onKeyDown:(e,t)=>{t||(e.key===`Enter`?i?.():e.key===`Escape`&&r?.())},popupClass:`schema-type-suggest-popup z-90`})}function ya({value:e,isOpen:r,onClose:i}){let{t:a}=J();return n(f,{isOpen:r,onClose:i,children:[t(h,{children:a(`widgets.schema.editDescription`)}),t(ba,{value:e,onSave:i})]})}function ba({value:i,onSave:a}){let{t:o}=J(),s=K(null),[c,l]=q(i||``);return W(()=>{s.current?.focus()},[]),n(e,{children:[t(p,{className:`h-max`,children:t(`textarea`,{ref:s,className:`dark:bg-gray-800 w-full h-full dark:text-white`,value:c,onChange:e=>l(e.target.value)})}),t(m,{children:t(r,{onClick:()=>a(c),children:o(`store.saveChanges`)})})]})}function xa({value:e}){let{t:r}=J();if(!e)return null;let i=e.extractable===!1;return n(`div`,{className:`w-full flex items-baseline gap-2 min-w-0`,children:[t(`div`,{className:`truncate`,children:e.name||``}),t(`div`,{className:`text-sm text-muted shrink-0`,children:e.type||``}),i&&t(`span`,{className:`shrink-0 text-[10px] uppercase tracking-wide text-attention border border-attention/40 bg-attention/10 rounded px-1.5 py-0.5`,title:r(`widgets.schema.extractFromDocumentHint`),children:r(`widgets.schema.noExtract`)})]})}function Sa(e,t,n){if(e.properties){let r=e.properties,i={};for(let e of Object.keys(r)){let a=r[e];e===t?i[n]=a:i[e]=a}e.properties=i}e.required&&=e.required.map(e=>e===t?n:e)}function Ca(e,t,n){if(Array.isArray(e.required)){let r=e.required.indexOf(t);n?r<0&&e.required.push(t):r>-1&&e.required.splice(r,1)}else n&&(e.required=[t])}function wa(e,t){let n=t.name===`any`?void 0:t.isNullable?[t.name,`null`]:t.name;if(t.isArray){if(e.type=`array`,e.properties=void 0,!e.items||Array.isArray(e.items))e.items={type:n,properties:t.isObject?{}:void 0};else{let r=e.items;r.type=n,t.isObject&&!r.properties&&(r.properties={})}}else e.type=n,e.items=void 0,t.isObject?e.properties||={}:e.properties=void 0}function Ta(e,t){e.properties&&(delete e.properties[t],Array.isArray(e.required)&&(e.required=e.required.filter(e=>e!==t)))}function Ea(e,t,n,r=!1){if(e.type!==`object`)throw Error(`Cannot add property to a non-object schema`);e.properties||={};let i={};return wa(i,n),e.properties[t]=i,r&&(Array.isArray(e.required)?Aa(e.required,t):e.required=[t]),i}function Da(e){let t=!1,n=!1,r,i=e.type;if(Array.isArray(i))for(let e of i)e===`null`?t=!0:r||=e;else r=i;r||=`any`,r===`array`&&(n=!0,r=Oa(e.items));let a=r;switch(e.editor){case`textarea`:a=`text`;break;case`media`:a=`media`;break;case`document`:a=`document`}return{isNullable:t,isArray:n,isObject:r===`object`,name:a}}function Oa(e){if(!e)return`any`;let t;return t=ka(Array.isArray(e)?e[0].type:e.type),(t===`array`||t===`null`)&&(t=`any`),t}function ka(e){return e?Array.isArray(e)?e.find(e=>e!==`null`)||`any`:e:`any`}function Aa(e,t){e.includes(t)||e.push(t)}let ja=0;var Ma=class e{source;onChange=()=>{};schema;root;constructor(e,t){this.schema=e?typeof e==`string`?JSON.parse(e):e:{title:t,type:`object`,properties:{}},this.schema.properties||(this.schema.properties={}),this.root=new Na(``,this.schema,this),this.root.loadChildren()}get isEmpty(){return!this.root.children||this.root.children.length===0}get children(){return this.root.children??[]}reload(){return this.root=new Na(``,this.schema,this),this.root.loadChildren(),this.onChange?.(this),this}withSource(e,t){return this.source={uri:t,name:e},this}withChangeListener(e){return this.onChange=e,this}replaceSchema(e){this.schema=e||{title:this.schema.title,type:`object`,properties:{}},this.reload()}clone(){let t=new e(this.schema);return t.source=this.source,this.onChange&&t.withChangeListener(this.onChange),t}},Na=class e{schema;loader;parent;name;isRequired=!1;type;children;constructor(e,t,n,r){if(this.schema=t,this.loader=n,this.parent=r,this.name=e,this.type=Da(t),this.parent){let t=this.parent._getPropertiesSchema().required;this.isRequired=t&&Array.isArray(t)?t.includes(e):!1}}get title(){return typeof this.schema.title==`string`?this.schema.title:void 0}set title(e){this.schema.title=e}get description(){return this.schema.description}set description(e){this.schema.description=e}get extractable(){return this.schema[`x-extract`]!==!1}set extractable(e){e?delete this.schema[`x-extract`]:this.schema[`x-extract`]=!1}get isParent(){return this.type.isObject}get isNew(){return!!this.schema.isNew}set isNew(e){e?this.schema.isNew=!0:delete this.schema.isNew}resetIsNew(){let e=this.isNew;return this.isNew=!1,e}getNameSignature(){return`${this.name}${this.isRequired?``:`?`}`}getTypeSignature(){return`${this.type.name}${this.type.isArray?`[]`:``}${this.type.isNullable?`?`:``}`}getSignature(){return`${this.getNameSignature()}: ${this.getTypeSignature()}`}reloadTree(){this.loader.reload()}loadChildren(){this.children=[];let e=this.schema.items?.properties;this.schema.items&&e?this._loadChildren(e,this.children):this.schema.properties&&this._loadChildren(this.schema.properties,this.children)}_loadChildren(t,n){for(let r of Object.keys(t)){let i=t[r],a=new e(r,i,this.loader,this);n.push(a),a.isParent&&a.loadChildren()}}_getPropertiesSchema(){return this.type.isArray&&this.type.isObject?this.schema.items:this.schema}findAvailableChildName(e){let t=this._getPropertiesSchema().properties||{},n;do n=e+ ++ja;while(t[n]);return n}addChild(t,n,r=!1){if(!this.type.isObject)throw Error(`Cannot add child to a non object node`);this.children||=[];let i=Ea(this._getPropertiesSchema(),t,n,r),a=new e(t,i,this.loader,this);return this.children.push(a),a}remove(){return this.parent?.type.isObject?(Ta(this.parent._getPropertiesSchema(),this.name),this.parent.children&&(this.parent.children=this.parent.children.filter(e=>e.name!==this.name)),!0):!1}update(e){let t=!1;e.name!=null&&this.name!==e.name&&(this.parent&&Sa(this.parent._getPropertiesSchema(),this.name,e.name),this.name=e.name,t=!0),e.isRequired!=null&&this.isRequired!==e.isRequired&&(this.parent&&Ca(this.parent._getPropertiesSchema(),this.name,e.isRequired),this.isRequired=e.isRequired,t=!0);let n=e.type?.name;n===`any`&&(n=void 0);let r=n!==this.schema.type;return e.type&&(wa(this.schema,e.type),this.type=e.type,this.type.isObject?this.children||=[]:this.children=void 0,t=!0),this.schema.editor&&e.editor===null?(this.schema.editor=void 0,t=!0):e.editor?(this.schema.editor=e.editor,t=!0):r&&(this.schema.editor=void 0,t=!0),e.description!==this.description&&(this.description=e.description,t=!0),e.extractable!=null&&this.extractable!==e.extractable&&(this.extractable=e.extractable,t=!0),t}getUpdateFromNameAndTypeSignature(e,t){let n=e.trim(),r=!0;n.endsWith(`?`)&&(n=n.substring(0,n.length-1).trim(),r=!1);let i=pa(t),a;return i.name===`text`?(i.name=fa.string,a=`textarea`):i.name===`media`?(i.name=fa.any,a=`media`):i.name===`document`?(i.name=fa.any,a=`document`):a=null,{name:n,type:i,isRequired:r,editor:a}}updateFromNameAndTypeSignature(e,t){return this.update(this.getUpdateFromNameAndTypeSignature(e,t))}updateFromSignature(e){e=e.trim();let t=e.indexOf(`:`);if(t<0)throw Error(`Expecting a name and a type separated by a colon`);let n=e.substring(0,t),r=e.substring(t+1);return this.updateFromNameAndTypeSignature(n,r)}};function Pa(e){let[t,n]=q(new Ma(e||{type:`object`,properties:{}}).withChangeListener(e=>{n(e.clone())}));return t}const Fa=`block text-sm sm:leading-6 rounded-md border-0 py-1.5 px-4`,Ia=`${Fa} hover:shadow-xs hover:ring-1 hover:ring-inset hover:ring-ring`,La=`${Fa} shadow-xs ring-1 ring-inset ring-ring`;function Ra({value:e,onChange:r,onDelete:i,outlineOnHover:a=!1,editOnClick:o=!0,placeholder:s,viewer:c,editor:l,skipClickOutside:u,isEditing:d=!1,readonly:f=!1,onValidate:p}){let{on:m,off:h,isOn:g}=w(d),[_,v]=q();return n(`div`,{className:``,children:[g&&!f?t(Ba,{value:e,onSave:e=>{if(p){let t=p(e);if(t){v(t);return}v(void 0)}r(e)&&h()},onCancel:h,editor:l,skipClickOutside:e=>u?u(e):!1}):t(za,{value:e,onEdit:m,viewer:c,placeholder:s,outlineOnHover:a,editOnClick:o,onDelete:i,readonly:f}),_&&t(`div`,{className:`text-red-500 text-sm`,children:_})]})}function za({viewer:e,value:i,onEdit:a,editOnClick:o,outlineOnHover:s,placeholder:c,onDelete:l,readonly:u}){let d=()=>{o&&a()},f=e=>{e.key===`Enter`&&a()},p=`invisible group-hover:visible`;return n(`div`,{role:o?`button`:void 0,tabIndex:0,onKeyUp:f,onClick:d,className:E(`flex justify-start items-center group`,s?Ia:Fa,{"cursor-pointer":o}),children:[t(e,{value:i,placeholder:c}),n(`div`,{className:`ms-auto flex gap-2`,children:[!u&&l&&t(r,{variant:`ghost`,size:`sm`,className:p,onClick:l,children:t(Ce,{className:`size-4`})}),u?null:t(r,{variant:`ghost`,size:`sm`,className:p,onClick:a,children:t(I,{className:`size-4`})})]})]})}function Ba({editor:e,value:n,onSave:r,onCancel:i,skipClickOutside:a}){let[o,s]=q(n),c=K(n),[l,u]=q(null),d=()=>{r(c.current)},f=C(d,a);return t(`div`,{ref:f,children:t(`div`,{className:La,children:t(`div`,{className:`w-full`,onClick:e=>e.stopPropagation(),children:t(e,{value:o,onChange:(e,t=!1)=>{s(e),c.current=e,t&&(l&&clearTimeout(l),u(setTimeout(()=>{r(e)},500)))},onSave:d,onCancel:i})})})})}function Va(e){return!!e.target.closest?.(`.schema-type-suggest-popup`)}function Ha({schema:e,readonly:r=!1}){let{t:i}=J();return n(`div`,{className:`space-y-1`,children:[n(`div`,{className:`flex items-center gap-2 px-2 py-1 text-xs font-medium text-muted-foreground border-b border-border`,children:[t(`div`,{className:`flex-1 min-w-0`,children:i(`widgets.schema.propertyColumn`)}),!r&&t(`div`,{className:`shrink-0 w-28 text-end pe-1`,title:i(`widgets.schema.extractFromDocumentHint`),children:i(`widgets.schema.extractFromDocument`)}),t(`div`,{className:`w-8 shrink-0`})]}),n(`ul`,{className:``,children:[e.children.map(e=>Ua(e,r)),r?null:t(Ja,{parent:e.root})]})]})}function Ua(e,n){return e.isParent?t(Ga,{property:e,readonly:n},e.name):t(Wa,{node:e,readonly:n},e.name)}function Wa({node:e,readonly:n}){return t(`li`,{className:`border-b border-border/40 last:border-0`,children:t(qa,{property:e,readonly:n})})}function Ga({property:e,readonly:i}){let[a,o]=q(!0),s=a?M:ie;return n(`li`,{className:`border-b border-border/40 last:border-0`,children:[n(`div`,{className:`flex items-center w-full gap-1`,children:[t(`div`,{className:`flex-1 min-w-0`,children:t(qa,{property:e,readonly:i})}),t(r,{variant:`ghost`,size:`icon`,onClick:()=>o(!a),"aria-label":a?`Collapse ${e.name}`:`Expand ${e.name}`,"aria-expanded":a,className:`shrink-0`,children:t(s,{className:`size-4 cn-rtl-flip`})})]}),a&&n(`ul`,{className:`ms-4 border-s border-gray-400 border-dashed`,children:[(e.children||[]).map(e=>Ua(e,i)),i?null:t(Ja,{parent:e})]})]})}function Ka(e){if(!e)return`Name is required`;if(!/^[a-zA-Z0-9_]+[?]?$/.test(e))return`Only letters, numbers, underscores or question mark are allowed (a-zA-Z0-9_?)`}function qa({property:e,readonly:r}){let{t:i}=J(),a=ne(),o=t=>{try{t.description&&typeof t.description!=`string`&&(t.description=void 0);let n=e.getUpdateFromNameAndTypeSignature(t.name,t.type);e.update({...n,description:t.description,extractable:t.extractable})&&e.reloadTree()}catch(e){return a({status:`error`,title:i(`widgets.schema.invalidPropertyDeclaration`),description:te(e),duration:9e3}),!1}return!0},s=t=>{e.update({extractable:t})&&e.reloadTree()},c=e.resetIsNew(),l=da(e);return n(`div`,{className:`flex items-center gap-2 w-full min-w-0 py-0.5`,children:[t(`div`,{className:`flex-1 min-w-0`,children:t(Ra,{value:l,onChange:o,onDelete:()=>{e.remove(),e.reloadTree()},editor:ga,viewer:xa,outlineOnHover:!0,isEditing:c,skipClickOutside:Va,readonly:r,onValidate:e=>Ka(e.name)})}),r?e.extractable===!1?t(`div`,{className:`shrink-0 w-28 flex justify-end pe-1`,children:t(`span`,{className:`text-[10px] uppercase tracking-wide text-attention border border-attention/40 bg-attention/10 rounded px-1.5 py-0.5`,title:i(`widgets.schema.extractFromDocumentHint`),children:i(`widgets.schema.noExtract`)})}):null:t(`div`,{className:`shrink-0 w-28 flex items-center justify-end gap-1.5 pe-1`,children:t(y,{size:`sm`,value:e.extractable,onChange:s,"aria-label":`${i(`widgets.schema.extractFromDocument`)}: ${e.name}`})})]})}function Ja({parent:e}){return n(r,{variant:`ghost`,onClick:()=>{let t=e.findAvailableChildName(`new_property_`),n=e.addChild(t,{isObject:!1,isArray:!1,isNullable:!1,name:fa.string},!0);n.isNew=!0,e.reloadTree()},children:[t(Se,{className:`size-4`}),`Add property`]})}function Ya(e){return e.isFile}function Xa(e){return e.isDirectory}function Za({onDrop:e,message:i,buttonLabel:a,allowFolders:o=!0,className:s=``}){let{t:c}=J(),l=a??c(`upload.uploadFiles`),[u,d]=q(!1),f=K(null),p=e=>{e.preventDefault(),e.dataTransfer.types.includes(`Files`)&&d(!0)},m=e=>{e.preventDefault(),f.current&&!f.current.contains(e.relatedTarget)&&d(!1)},h=async t=>{if(t.preventDefault(),d(!1),t.dataTransfer.items&&t.dataTransfer.items.length>0){let n=Array.from(t.dataTransfer.items),r=[],i=new Set,a=async e=>{if(Ya(e)){let t=await new Promise(t=>{e.file(n=>{Object.defineProperty(n,"webkitRelativePath",{writable:!0,value:e.fullPath.substring(1)}),t(n)})});!t.name.startsWith(`.`)&&t.size>0&&r.push(t);let n=e.fullPath.substring(1).split(`/`).slice(0,-1).join(`/`);n&&i.add(n)}else if(Xa(e)){let t=e.createReader(),n=await new Promise(e=>{t.readEntries(t=>{e(t)})});await Promise.all(n.map(a));let r=e.fullPath.substring(1);r&&i.add(r)}};try{if(await Promise.all(n.map(e=>{let t=e.webkitGetAsEntry?e.webkitGetAsEntry():e;return t?a(t):Promise.resolve()})),r.length>0){let t=new Set(Array.from(i).map(e=>e.split(`/`)[0]).filter(Boolean)).size,n=r.length,a=``;a=t>0?c(`upload.preparingFolder`,{count:t,folderCount:t,fileCount:n}):c(`upload.preparingFiles`,{count:n}),e(r,{count:r.length,message:a})}}catch(n){console.error(`Error processing dropped files:`,n);let r=Array.from(t.dataTransfer.files);r.length>0&&e(r)}}else t.dataTransfer.files&&t.dataTransfer.files.length>0&&e(Array.from(t.dataTransfer.files))},g=t=>{if(t&&t.length>0){let n=Array.from(t);if(n.some(e=>e.webkitRelativePath?.includes(`/`))){let t=new Set(n.map(e=>e.webkitRelativePath.split(`/`)[0]).filter(Boolean)).size,r=n.length,i=c(`upload.preparingFolder`,{count:t,folderCount:t,fileCount:r});e(n,{count:n.length,message:i})}else e(n,{count:n.length,message:c(`upload.preparingFiles`,{count:n.length})})}};return n(`div`,{className:`flex flex-col items-center justify-center py-12 border-2 rounded-lg transition-colors ${u?`border-color-primary bg-color-primary/10`:`border-dashed border-color-border`} ${s}`,onDragOver:p,onDragLeave:m,onDrop:h,children:[t(we,{className:`h-12 w-12 mb-3 transition-colors ${u?`text-primary`:`text-muted/50`}`}),t(`p`,{className:`text-muted`,children:i}),n(`div`,{className:`flex gap-2 justify-center mt-2`,children:[t(r,{onClick:()=>{let e=document.createElement(`input`);e.type=`file`,e.multiple=!0,e.accept=`*`,e?.click(),e.onchange=()=>{g(e.files)}},children:l}),o&&t(r,{onClick:()=>{let e=document.createElement(`input`);e.type=`file`,e.multiple=!0,e.accept=`*`,e.webkitdirectory=!0,e?.click(),e.onchange=()=>{g(e.files)}},children:c(`upload.selectFolder`)})]})]})}function Qa({title:e,count:r,icon:i=t(j,{className:`h-4 w-4 text-green-500`}),items:a}){let{t:o}=J(),[s,c]=q(!1),l=ke();return n(`div`,{className:`border border-color-border rounded-md overflow-hidden`,children:[n(`button`,{type:`button`,"aria-expanded":s,"aria-controls":l,className:`w-full flex items-center justify-between p-3 bg-color-muted/10 cursor-pointer text-start bg-transparent border-0 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring`,onClick:()=>c(!s),children:[n(`span`,{className:`flex items-center`,children:[t(`span`,{className:`me-2`,children:i}),t(`span`,{className:`font-medium`,children:e}),t(`span`,{className:`ms-2 px-2 py-0.5 bg-color-muted/20 rounded-full text-xs`,children:r})]}),t(`span`,{className:`text-muted`,"aria-hidden":`true`,children:t(`svg`,{className:`h-5 w-5 transition-transform ${s?`transform rotate-180`:``}`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,"aria-hidden":`true`,children:t(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M19 9l-7 7-7-7`})})})]}),s&&t(`div`,{id:l,className:`p-3 border-t border-color-border max-h-48 overflow-y-auto`,children:a.length>0?t(`ul`,{className:`space-y-1`,children:a.map(e=>t(`li`,{className:`text-sm py-1 px-2 rounded hover:bg-color-muted/10`,children:e},e))}):t(`div`,{className:`text-sm text-muted py-2`,children:o(`upload.noItems`)})})]})}function $a({files:e,className:r=``,location:i,collection:a}){let{t:o}=J(),s=e.filter(e=>e.status===`success`),c=e.filter(e=>e.status===`updated`),l=e.filter(e=>e.status===`skipped`),u=e.filter(e=>e.status===`failed`),d=s.length,f=c.length,p=l.length,m=u.length,h=e.length;return n(`div`,{className:`flex flex-col py-2 ${r}`,children:[n(`div`,{className:`flex items-center mb-4`,children:[t(`div`,{className:`size-8 me-4 rounded-full bg-success/10 flex items-center justify-center`,children:t(j,{className:`size-4 text-success`})}),t(`div`,{children:n(`p`,{className:`text-muted`,children:[o(`upload.filesProcessed`,{count:h}),a?o(`upload.inCollection`,{collection:a}):``,i?o(`upload.inFolder`,{location:i}):``]})})]}),n(`div`,{className:`space-y-3 mt-2`,children:[d>0&&t(Qa,{title:o(`upload.successfullyUploaded`),count:d,icon:t(j,{className:`h-4 w-4 text-green-500`}),items:s.map(e=>e.name)}),f>0&&t(Qa,{title:o(`upload.successfullyUpdated`),count:f,icon:t(j,{className:`h-4 w-4 text-blue-500`}),items:c.map(e=>e.name)}),p>0&&t(Qa,{title:o(`upload.skippedAlreadyExisted`),count:p,icon:t(O,{className:`h-4 w-4 text-amber-500`}),items:l.map(e=>e.name)}),m>0&&t(Qa,{title:o(`upload.failedToUpload`),count:m,icon:t(Ee,{className:`h-4 w-4 text-red-500`}),items:u.map(e=>e.name)})]})]})}const eo=`#text`,to=`#comment`,no=`#cdata`,ro=`DECLARATION_TAG`,io={tagColor:`#d43900`,textColor:`#333`,attributeKeyColor:`#2a7ab0`,attributeValueColor:`#008000`,separatorColor:`#333`,commentColor:`#aaa`,cdataColor:`#1d781d`,fontFamily:`monospace`},ao={attributeKeyColor:`#FFD700`,attributeValueColor:`#FF4500`,tagColor:`#87CEFA`,textColor:`#00FF00`,separatorColor:`#FFD700`,commentColor:`#BEBEBE`,cdataColor:`#33CC66`,fontFamily:`monospace`},oo=B({theme:io,collapsible:!1,indentSize:2}),so=()=>U(oo),co=new Xe({preserveOrder:!0,ignoreAttributes:!1,attributeNamePrefix:``,allowBooleanAttributes:!0,commentPropName:to,cdataPropName:no,parseTagValue:!1});function lo(e){try{let t=new DOMParser().parseFromString(e,`application/xml`),n=t.documentElement.localName===`parsererror`?t.documentElement:void 0;if(n)throw Error(n.textContent?.trim()||`Invalid XML!`);let r=co.parse(e);if(e.trim().length>0&&r.length===0)throw Error(`Invalid XML!`);return{json:r,valid:!0}}catch(e){return{json:null,valid:!1,errorMessage:`Fail to parse: ${e instanceof Error?e.message:String(e)}`}}}function uo(e){return G(()=>lo(e),[e])}function fo(e){let{indentation:r,children:i,isInline:a}=e,{theme:o}=so();return n(`div`,{style:{color:o.cdataColor},children:[t(`span`,{children:`${r}<![CDATA[`}),i,t(`span`,{children:`${a?``:r}]]>`})]})}function po(e){let{collapsible:n,theme:r}=so(),{collapsed:i}=e;return n?t(`span`,{style:{position:`relative`},children:t(`span`,{style:{position:`absolute`,right:`0`,border:0,padding:0,background:`none`},children:t(mo,{fill:r.separatorColor,style:{transform:`rotate(${i?0:90}deg)`,transition:`transform 0.2s`}})})}):null}function mo({...e}){return t(`svg`,{width:`16px`,height:`16px`,viewBox:`0 0 24 24`,"aria-hidden":`true`,...e,children:t(`path`,{d:`M9 17.898C9 18.972 10.2649 19.546 11.0731 18.8388L17.3838 13.3169C18.1806 12.6197 18.1806 11.3801 17.3838 10.6829L11.0731 5.16108C10.2649 4.45388 9 5.02785 9 6.1018V17.898Z`})})}function ho(e){let{collapsible:t,initialCollapsedDepth:n}=so(),[r,i]=q(()=>Ze(n)||!t?!1:e>=n);return W(()=>{i(Ze(n)||!t?!1:e>=n)},[n,e,t]),{collapsed:r,buttonProps:t?{onClick:()=>i(e=>!e),role:`button`,style:{cursor:`pointer`}}:{}}}function go(e){let{indentation:r,children:i,isInline:a,level:o}=e,{theme:s}=so(),{collapsed:c,buttonProps:l}=ho(o);return n(`div`,{style:{color:s.commentColor},children:[n(`span`,{...l,children:[t(`span`,{children:r}),t(po,{collapsed:c}),t(`span`,{children:`<!-- `})]}),!c&&i,c&&`...`,t(`span`,{children:`${a||c?` `:r}-->`})]})}function _o(e){let{attributes:r}=e,{theme:i}=so();return r?t(`span`,{children:Object.entries(r).map(([e,r])=>n(`span`,{children:[t(`span`,{style:{color:i.attributeKeyColor},children:` ${e}`}),t(`span`,{style:{color:i.separatorColor},children:`=`}),t(`span`,{style:{color:i.attributeValueColor},children:`"${r}"`})]},`attribute-${e}`))}):null}function vo(e){let{indentation:r,tagKey:i,attributes:a}=e,{theme:o}=so();return n(`div`,{children:[t(`span`,{style:{color:o.separatorColor},children:`${r}<?`}),t(`span`,{style:{color:o.tagColor},children:`${i.slice(1)}`}),t(_o,{attributes:a}),t(`span`,{style:{color:o.separatorColor},children:`?>`})]})}function yo(e,t){return Array(t*e+1).join(` `)}function bo(e){return typeof e==`string`&&e.includes(`
25
- `)}function xo(e){return typeof e!=`string`&&e.length===1&&`#text`in e[0]&&!bo(e[0][`#text`])}function So(e){switch(e){case eo:case no:case to:return e;default:return e.startsWith(`?`)?ro:`TAG`}}function Co(e){let t=e[`:@`],n=Qe(e,`:@`),[[r,i]]=Object.entries(n);return{attributes:t,tagKey:r,subElements:i,type:So(r)}}function wo(e){return e?Object.keys(e).length>0:!1}function To(r){let{indentation:i,tagKey:a,attributes:o,children:s,isInline:c,hasChildren:l,level:u}=r,{collapsed:d,buttonProps:f}=ho(u),{theme:p}=so();return n(`div`,{children:[n(`span`,{...f,children:[t(`span`,{children:i}),t(po,{collapsed:d}),t(`span`,{style:{color:p.separatorColor},children:`<`}),t(`span`,{style:{color:p.tagColor},children:`${a}`}),!d&&t(_o,{attributes:o}),d&&wo(o)&&` ...`,t(`span`,{style:{color:p.separatorColor},children:l?`>`:` />`})]}),l&&n(e,{children:[!d&&s,d&&`...`,t(`span`,{style:{color:p.separatorColor},children:`${c||d?``:i}</`}),t(`span`,{style:{color:p.tagColor},children:`${a}`}),t(`span`,{style:{color:p.separatorColor},children:`>`})]})]})}function Eo(e){let{hasSiblings:n,text:r,indentation:i,isText:a}=e,{theme:o}=so(),s=a?{color:o.textColor}:void 0;return bo(r)||n?t(`div`,{style:s,children:r.split(`
26
- `).filter(e=>!!e.trim()).map((e,n)=>t(`div`,{children:`${i}${e.trim()}`},`line-${n}`))}):t(`span`,{style:s,children:r})}function Do(n){let{elements:r,level:i=0,isText:a=!0}=n,{indentSize:o}=so();return!Array.isArray(r)||r.length===0?null:t(e,{children:r.map((e,n)=>{let{tagKey:s,attributes:c,subElements:l,type:u}=Co(e),d=r.length>1,f=yo(o,i),p=`${i}-${n}`,m=xo(l);switch(u){case eo:return t(Eo,{text:l,indentation:f,hasSiblings:d,isText:a},p);case to:return t(go,{isInline:m,indentation:f,level:i,children:t(Do,{elements:l,level:i+1,isText:!1})},p);case no:return t(fo,{indentation:f,isInline:m,children:t(Do,{elements:l,level:i+1,isText:!1})},p);case ro:return t(vo,{indentation:f,tagKey:s,attributes:c},p);default:return t(To,{indentation:f,tagKey:s,attributes:c,isInline:m,hasChildren:l.length>0,level:i,children:t(Do,{elements:l,level:i+1})},p)}})})}function Oo(){return t(`div`,{children:`Invalid XML!`})}function ko(e){let{theme:n,xml:r,collapsible:i=!1,indentSize:a=2,invalidXml:o,initalCollapsedDepth:s,initialCollapsedDepth:c}=e,[l,u]=q(()=>document.documentElement.classList.contains(`dark`));W(()=>{let e=document.documentElement,t=new MutationObserver(()=>{u(e.classList.contains(`dark`))});return t.observe(e,{attributes:!0,attributeFilter:[`class`]}),()=>t.disconnect()},[]);let d=G(()=>({...l?ao:io,...n}),[l,n]),{json:f,valid:p}=uo(r),m=G(()=>({theme:d,collapsible:i,indentSize:a,initialCollapsedDepth:c??s}),[d,i,a,s,c]);return p?t(oo.Provider,{value:m,children:t(`div`,{className:`rxv-container`,style:{whiteSpace:`pre-wrap`,fontFamily:d.fontFamily,overflowWrap:`break-word`},children:t(Do,{elements:f})})}):o||t(Oo,{})}export{dn as AgentResourceResolverProvider,Ct as ArrayPropertySchema,Yn as ArtifactContentRenderer,oa as ArtifactEditingSurface,pr as ChartCodeBlockHandler,Q as CodeBlockErrorBoundary,Rn as CodeBlockHandlerProvider,Z as CodeBlockPlaceholder,Qn as CodeBlockRendererProvider,Bi as CollaborativeMarkdownRenderer,Za as DropZone,gr as ExpandCodeBlockHandler,et as FieldSetContextProvider,st as Form,nt as FormContext,at as FormContextProvider,vt as FormError,_t as FormHelper,gt as FormLabel,lt as GeneratedForm,ot as Input,Pt as JSONCode,Gt as JSONDisplay,rn as JSONEditor,on as JSONSwitcher,ln as JSONTable,Rt as JSONView,Mt as ManageObjectEntry,jt as ManagedListProperty,Ot as ManagedObject,Dt as ManagedObjectBase,kt as ManagedObjectProperty,At as ManagedProperty,Nt as ManagedScalarEntry,Ma as ManagedSchema,Cr as MarkdownFigure,Tr as MarkdownImage,Dr as MarkdownLink,xi as MarkdownRenderer,mr as MermaidCodeBlockHandler,or as MermaidDiagram,nn as MonacoEditor,Et as Node,sa as Progress,ca as PropertiesView,ga as PropertyEditor,_a as PropertyNameEditor,xt as PropertySchema,xa as PropertyViewer,ft as ScalarField,bt as Schema,Ha as SchemaEditor,Na as SchemaNode,la as SvgIcon,Qa as UploadResultCategory,$a as UploadSummary,tn as VEditorApi,ko as XMLViewer,na as applyArtifactRefreshChanges,Ii as applyMarkdownEditingChange,wt as computeTitleFromName,vr as createDefaultCodeBlockHandlers,ji as createMarkdownBlockAnchor,ua as createSvgIcon,$i as createUnifiedLineDiff,qi as diffTextSegments,Wi as diffWordSegments,Li as formatMarkdownEditingAction,da as getEditableSchemaProperty,an as getJSONEditorValue,Ji as getTextLineChangeRegions,ta as isArtifactRefreshEvent,_r as isExpandLanguage,lr as isIncompleteJson,mn as parseAgentResourceHref,xr as parseUrlScheme,Qi as rebaseTextChanges,Lt as renderJsonLine,fn as useAgentResourceResolver,cr as useArtifactContent,er as useCodeBlockComponent,zn as useCodeBlockContext,$n as useCodeBlockRendererRegistry,tt as useFieldSet,it as useForm,Sr as useResolvedUrl,Pa as useSchema,Ka as validatePropertyName};
339
+ `);if(!(n.maxChars!==void 0&&u.length>n.maxChars))return u}const Ny=ne(()=>import(`@vertesia/ui/rich-text`).then(e=>({default:e.VertesiaMarkdownDocumentEditor})));function Py(e,t){return e?.path===t?e.event_class===`artifact_updated`||e.event_class===`activity`&&e.tool_status===`completed`&&(e.tool===`edit_artifact`||e.tool===`write_artifact`):!1}function Fy(e,t){if(!Array.isArray(t?.changes)||t.changes.length===0)return;let n=e;for(let e of t.changes){if(!e||typeof e!=`object`||Array.isArray(e))return;let t=e;if(t.operation!==`replace`||typeof t.before!=`string`||typeof t.after!=`string`||!n.includes(t.before))return;if(t.replace_all===!0)n=n.split(t.before).join(t.after);else{if(n.indexOf(t.before)!==n.lastIndexOf(t.before))return;n=n.replace(t.before,t.after)}}return n}function Iy(e){if(!(!e||typeof e!=`object`||!(`status`in e)))return typeof e.status==`number`?e.status:void 0}function Ly({regions:e,totalLines:n,onNavigate:r}){let{t:i}=B();return e.length===0?null:t(`nav`,{className:`absolute inset-y-12 end-1 z-10 w-3 rounded-full border border-mixer-muted/25 bg-muted/20`,"aria-label":i(`agent.changeRuler`),children:e.map(e=>{let a=e.startLine/Math.max(1,n)*100,o=Math.max(1.5,(e.endLine-e.startLine+1)/Math.max(1,n)*100);return t(S,{description:i(`agent.changedRegion`,{line:e.startLine+1}),asChild:!0,children:t(`button`,{type:`button`,className:`absolute inset-x-0 rounded-full bg-attention transition-colors hover:bg-info focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-info`,style:{top:`${Math.min(98.5,a)}%`,height:`${Math.min(100-a,o)}%`},onClick:()=>r(e.startLine),"aria-label":i(`agent.changedRegion`,{line:e.startLine+1})})},`${e.startLine}:${e.endLine}`)})})}function Ry(e,t){return Dy(e,t)}function zy({runId:e,path:a,initialContent:o=``,refreshKey:s=0,refreshDetails:c,readOnly:l=!1,allowComments:u=!1,viewMode:f=`components`,baselineContent:p,className:m,onAction:h,onSendMessage:g,onSendChangesToAgent:v,hasUnsentChanges:y=!1,isSendingChanges:b=!1,sendChangesDisabled:x=!1,toolbarStatus:S,onContentChange:T,onDocumentEdit:E,onSaveStatusChange:D,flushChangesRef:k}){let{client:A}=ye(),{t:j}=B(),M=O(),[N,te]=z(o),[P,ne]=z(),[re,ie]=z(),[ae,oe]=z(0),[se,ce]=z(!!e),[le,ue]=z(!1),[de,fe]=z(!1),[pe,me]=z(),[he,ge]=z(),[_e,ve]=z(!1),be=!l||u,xe=f!==`document`||he?`idle`:le||de?`saving`:P?`saved`:`idle`;I(()=>{D?.(xe)},[xe,D]);let V=R(N),Se=R(P),Ce=R(0),we=R(void 0),Te=R(void 0),Ee=R(!1),De=R(void 0),Oe=R(()=>Promise.resolve(!1)),ke=R(!1),Ae=R(!1),je=R(null),Me=R(P),Ne=R(o),Pe=R(void 0),Fe=R(o),Ie=R(null),Le=L(()=>Ry(p??N,N),[p,N]),Re=L(()=>N.split(`
340
+ `).length,[N]),ze=F(e=>{Pe.current=e,ge(e)},[]);I(()=>{V.current=N},[N]),I(()=>{Se.current=P},[P]),I(()=>{f===`document`&&(Ae.current=!1,ke.current=!1)},[f]);let Be=F(async t=>{if(!e)return;let n=++Ce.current;ce(!0),me(void 0);for(let r=0;r<=60;r++)try{let t=await A.agents.getArtifactContent(e,a);if(Ce.current!==n)return;let r=V.current;r&&r!==t.content&&(ie(r),oe(e=>e+1)),V.current=t.content,Se.current=t.generation,Fe.current=t.content,!ke.current&&Te.current===void 0&&!Ee.current&&(Me.current=t.generation,Ne.current=t.content),te(t.content),ne(t.generation),me(void 0),ce(!1),T?.(t.content,t.generation);return}catch(e){if(Ce.current!==n||!t||Iy(e)!==404||r===60){if(Ce.current!==n)return;me(w(e,j(`agent.failedToLoadArtifact`))),ce(!1);return}await new Promise(e=>setTimeout(e,500))}},[A,T,a,e,j]);I(()=>(Ce.current++,V.current=o,Se.current=void 0,Fe.current=o,Me.current=void 0,Ne.current=o,Pe.current=void 0,ke.current=!1,Ae.current=!1,te(o),ne(void 0),ie(void 0),me(void 0),ge(void 0),ve(!1),fe(!1),ce(!!e),e&&Be(!0),()=>{Ce.current++}),[o,Be,e]),I(()=>{if(!e||s<=0||Pe.current)return;let t=V.current,n=Fy(t,c);n!==void 0&&n!==t&&(V.current=n,Se.current=void 0,ie(t),oe(e=>e+1),te(n),ne(void 0),T?.(n)),Be(!1)},[Be,T,c,s,e]);let Ve=F((e,t)=>{let n=V.current;V.current=e,Se.current=t,Ne.current=e,Me.current=t,Te.current=void 0,ze(void 0),je.current?.getMarkdown()!==e&&je.current?.commands.setContent(e,{contentType:`markdown`,emitUpdate:!1}),n!==e&&(ie(n),oe(e=>e+1)),te(e),ne(t),fe(!1),T?.(e,t)},[T,ze]),He=F(async(t,n,r)=>{if(!e)return!1;V.current=n,Te.current=void 0,te(n),fe(!1),ve(!0);let i,o;try{let s=await A.agents.getArtifactContent(e,a);i=s.content,o=s.generation,Fe.current=s.content;let c=jy(t,n,s.content);if(c.status===`conflict`)return ze({baseContent:t,localContent:n,remoteContent:s.content,remoteGeneration:s.generation,pendingAction:r}),!1;let l=s.generation;if(c.content!==s.content)try{l=(await A.agents.updateArtifactContent(e,a,{content:c.content,generation:s.generation})).generation}catch(e){if(Iy(e)===412)return ze({baseContent:s.content,localContent:c.content,remoteContent:s.content,remoteGeneration:s.generation,pendingAction:r}),!1;throw e}return Ve(c.content,l),M({status:`success`,title:j(`agent.artifactConflictRebased`),duration:3e3}),{content:c.content,generation:l}}catch(e){return ze({baseContent:t,localContent:n,remoteContent:i,remoteGeneration:o,pendingAction:r}),M({status:`error`,title:j(`agent.artifactConflictTitle`),description:w(e,j(`agent.failedToLoadArtifact`)),duration:5e3}),!1}finally{ve(!1)}},[Ve,A.agents,a,e,j,M,ze]),Ue=F(async t=>{if(t.action===`comment`){await h?.(t);return}if(Pe.current){M({status:`warning`,title:j(`agent.artifactConflictTitle`),duration:3e3});return}if(!e||!Se.current){M({status:`warning`,title:j(`agent.artifactEditingUnavailable`),duration:3e3});return}let n=V.current,r=my(n,t);if(r===void 0){M({status:`error`,title:j(`agent.documentEditApplyFailed`),description:j(`agent.documentEditApplyFailedDescription`),duration:5e3});return}try{let i=await A.agents.updateArtifactContent(e,a,{content:r,generation:Se.current});V.current=r,Se.current=i.generation,Ne.current=r,Me.current=i.generation,ie(n),oe(e=>e+1),te(r),ne(i.generation),T?.(r,i.generation),await h?.({...t,applied:!0,base_version:i.generation}),Fe.current=r}catch(e){if(Iy(e)===412){let e=await He(n,r,t);e&&(await h?.({...t,applied:!0,base_version:e.generation}),Fe.current=e.content);return}M({status:`error`,title:j(`agent.documentEditApplyFailed`),description:w(e,j(`store.errorSavingTextDefault`)),duration:5e3})}},[A,h,T,a,He,e,j,M]),We=F(()=>{if(!e)return Promise.resolve(!1);if(De.current)return De.current;let t=(async()=>{Ee.current=!0,ue(!0);try{for(;Te.current!==void 0;){let t=Te.current;Te.current=void 0;let n=Me.current;if(!n)throw Error(j(`agent.artifactEditingUnavailable`));let r=await A.agents.updateArtifactContent(e,a,{content:t,generation:n});Se.current=r.generation,Me.current=r.generation,Ne.current=t,ne(r.generation),T?.(V.current,r.generation)}return fe(!1),!0}catch(e){return Iy(e)===412?!!await He(Ne.current,V.current):(M({status:`error`,title:j(`agent.documentEditApplyFailed`),description:w(e,j(`store.errorSavingTextDefault`)),duration:5e3}),!1)}finally{Ee.current=!1,ue(!1)}})();return De.current=t,t.finally(()=>{De.current===t&&(De.current=void 0)}),t},[A.agents,T,a,He,e,j,M]);Oe.current=We;let H=F(async()=>{we.current!==void 0&&(clearTimeout(we.current),we.current=void 0);let t=je.current?.getMarkdown();t!==void 0&&t!==V.current&&(V.current=t,te(t),T?.(t,Se.current),Te.current=t);let n=Pe.current;if(n&&!await He(n.baseContent,V.current))return!1;for(;Te.current!==void 0||De.current;)if(!await We())return!1;if(!e||!Se.current)return!1;let r=Fe.current;return Fe.current=V.current,{previous:r,current:V.current}},[T,We,He,e]);I(()=>{if(k)return k.current=H,()=>{k.current===H&&(k.current=null)}},[k,H]);let Ge=F(e=>{if(e===V.current||ke.current&&Te.current===void 0&&!Ee.current&&e===Ne.current)return;if(!Ae.current){V.current=e,te(e);return}V.current=e,te(e),E?.(),T?.(e,Se.current);let t=Pe.current;if(t){ze({...t,localContent:e}),fe(!1);return}fe(!0),Te.current=e,we.current!==void 0&&clearTimeout(we.current),we.current=setTimeout(()=>{we.current=void 0,We()},400)},[T,E,We,ze]),qe=F(e=>{ke.current=e,e&&(Ae.current=!0),(e||Te.current===void 0&&!Ee.current)&&(Me.current=Se.current,Ne.current=V.current)},[]),Je=F(async()=>{let e=Pe.current;if(!e||_e)return;let t=await He(e.baseContent,V.current,e.pendingAction);t&&e.pendingAction&&(await h?.({...e.pendingAction,applied:!0,base_version:t.generation}),Fe.current=t.content)},[_e,h,He]),Ye=F(e=>{let t=Ie.current?.querySelector(`.vertesia-markdown-document-editor-content`);if(!t)return;let n=Math.min(1,e/Math.max(1,Re-1));t.scrollTo({top:n*Math.max(0,t.scrollHeight-t.clientHeight),behavior:`smooth`})},[Re]);return I(()=>()=>{we.current!==void 0&&clearTimeout(we.current);let e=je.current?.getMarkdown();e!==void 0&&e!==V.current&&(V.current=e,Te.current=e),Te.current!==void 0&&Oe.current()},[]),n(`div`,{className:m??`relative h-full min-h-0 overflow-y-auto px-4 py-3`,children:[he?t(`div`,{className:`absolute inset-x-4 top-3 z-30`,role:`alert`,children:t(d,{status:`warning`,title:j(`agent.artifactConflictTitle`),className:`shadow-lg`,children:n(`div`,{className:`space-y-3`,children:[t(`p`,{children:j(`agent.artifactConflictDescription`)}),t(`div`,{className:`flex justify-end`,children:n(r,{variant:`outline`,size:`sm`,disabled:_e,onClick:()=>void Je(),children:[_e?t(_,{size:`sm`}):null,j(`agent.artifactConflictRetry`)]})})]})})}):null,se&&!N?t(i,{className:`h-full min-h-[200px]`,children:t(_,{size:`lg`})}):pe&&!N?n(i,{className:`h-full min-h-[200px] flex-col gap-3 text-center text-muted`,children:[t(`span`,{children:pe}),t(r,{variant:`outline`,size:`sm`,onClick:()=>void Be(!1),children:j(`agent.retry`)})]}):f===`document`?t(ee,{fallback:t(i,{className:`h-full min-h-[200px]`,children:t(_,{size:`lg`})}),children:t(`div`,{className:`flex h-full min-h-0 flex-col`,children:n(`div`,{ref:Ie,className:`relative min-h-0 flex-1`,children:[t(Ny,{value:N,onChange:Ge,artifactRunId:e,editable:!l&&!!e,externalValueSync:`when-blurred`,onFocusChange:qe,onEditor:e=>{je.current=e},onSendComment:g&&e&&!he&&be?g:void 0,onSendChangesToAgent:v,hasUnsentChanges:y,isSendingChanges:b,sendChangesDisabled:x||!e||!!he,toolbarStatus:S,contentClassName:`pe-5`}),t(Ly,{regions:Le,totalLines:Re,onNavigate:Ye}),!D&&xe!==`idle`?n(`div`,{className:C(`pointer-events-none absolute bottom-3 end-6 flex items-center gap-1.5 rounded-full`,`border border-mixer-muted/25 bg-background/90 px-2.5 py-1 text-[11px] shadow-sm`,le||de?`text-muted`:`text-success`),children:[le||de?t(_,{size:`sm`}):t(Ke,{className:`size-3`}),j(le||de?`agent.savingWorkingCopy`:`agent.savedToWorkingCopy`)]}):null]})})}):t(`div`,{className:`vprose prose-sm mx-auto max-w-5xl`,children:t(yy,{artifactRunId:e,resource:{kind:`agent_artifact`,run_id:e??`pending`,path:a},baseVersion:P,readOnly:l||!e||!!he,allowComments:be&&!!e&&!he,highlightChangesFrom:re,highlightVersion:ae,onAction:Ue,children:N})}),se&&N?t(`div`,{className:`absolute end-3 top-3 rounded-full bg-background/80 p-2 shadow-sm`,children:t(it,{className:`size-4 animate-pulse text-muted`})}):null]})}function By({percent:e}){return t(`div`,{className:`w-full bg-gray-200 rounded-full h-2.5 dark:bg-gray-700`,children:t(`div`,{className:`bg-blue-600 h-2.5 rounded-full`,style:{width:`${e}%`}})})}function Vy({className:e,properties:r}){return t(b,{className:e,children:t(`tbody`,{children:r.map(e=>n(`tr`,{children:[n(`td`,{className:`w-1/3 font-semibold gap-2`,children:[t(`span`,{children:e.name}),e.description&&t(S,{description:e.description,placement:`top`,children:t(st,{className:`size-3 ms-2 text-muted-foreground`})})]}),t(`td`,{className:`w-2/3`,children:e.value??`undefined`})]},e.name))})})}function Hy({content:e,...n}){let r=R(null);return I(()=>{if(!r.current)return;let t=new DOMParser().parseFromString(e,`image/svg+xml`).querySelector(`svg`);if(!t){console.warn(`SvgIcon: No <svg> element found in provided string`),r.current.innerHTML=``;return}Object.entries(n).forEach(([e,n])=>{if(n==null)return;let r=e===`className`?`class`:e;t.setAttribute(r,String(n))}),r.current.innerHTML=``,r.current.appendChild(t)}),t(`span`,{ref:r})}function Uy(e){return n=>t(Hy,{content:e,...n})}function Wy(e){return{name:e.getNameSignature(),type:e.getTypeSignature(),description:e.description,extractable:e.extractable}}var Gy;(function(e){e.string=`string`,e.number=`number`,e.integer=`integer`,e.boolean=`boolean`,e.object=`object`,e.any=`any`,e.text=`text`,e.media=`media`,e.document=`document`})(Gy||={});function Ky(e){e=e.trim();let t=!1,n=!1;e.endsWith(`?`)&&(n=!0,e=e.substring(0,e.length-1).trim()),e.endsWith(`[]`)&&(t=!0,e=e.substring(0,e.length-2).trim());let r=Gy[e];if(!r)throw Error(`Unknown type "${e}"`);return{name:r,isArray:t,isNullable:n,isObject:r===Gy.object}}function qy(){let e=Object.values(Gy),t=[...e];for(let n of e)t.push(`${n}[]`);return e.sort(),t}const Jy=qy();function Yy({value:e,onChange:i,onCancel:a,onSave:o}){let{t:s}=B(),[c,l]=z(!1);return e?n(`div`,{className:`flex items-center`,children:[t(`div`,{className:`flex-1`,children:t(Xy,{value:e.name,onChange:t=>{i({...e,name:t})},onCancel:a,onSave:o})}),t(`div`,{className:`px-1 font-semibold`,children:`:`}),t(`div`,{className:`flex-1`,children:t(Zy,{value:e.type,onChange:t=>{i({...e,type:t})},onCancel:a,onSave:o})}),n(`div`,{children:[t(r,{variant:`ghost`,size:`xs`,onClick:()=>l(!0),title:s(`widgets.schema.editDescription`),children:t(St,{className:`size-4`})}),t(Qy,{value:e.description,isOpen:c,onClose:t=>{t!==void 0&&typeof t==`string`&&i({...e,description:t},!0),l(!1)}})]})]}):null}function Xy({value:e,onChange:n,onCancel:r,onSave:i}){let a=R(null);return I(()=>{a.current?.focus()},[]),t(`input`,{onKeyUp:e=>{switch(e.key){case`Enter`:i?.();break;case`Escape`:r?.()}},ref:a,value:e,onChange:e=>{n(e.target.value)},className:v.INPUT_UNSTYLED,style:{fontSize:`inherit`,width:``,display:`inline`}})}function Zy({value:e,onChange:n,onCancel:r,onSave:i}){return t(g,{className:v.INPUT_UNSTYLED,options:Jy,value:e||``,onBlur:()=>{i?.()},onChange:n,onKeyDown:(e,t)=>{t||(e.key===`Enter`?i?.():e.key===`Escape`&&r?.())},popupClass:`schema-type-suggest-popup z-90`})}function Qy({value:e,isOpen:r,onClose:i}){let{t:a}=B();return n(f,{isOpen:r,onClose:i,children:[t(h,{children:a(`widgets.schema.editDescription`)}),t($y,{value:e,onSave:i})]})}function $y({value:i,onSave:a}){let{t:o}=B(),s=R(null),[c,l]=z(i||``);return I(()=>{s.current?.focus()},[]),n(e,{children:[t(p,{className:`h-max`,children:t(`textarea`,{ref:s,className:`dark:bg-gray-800 w-full h-full dark:text-white`,value:c,onChange:e=>l(e.target.value)})}),t(m,{children:t(r,{onClick:()=>a(c),children:o(`store.saveChanges`)})})]})}function eb({value:e}){let{t:r}=B();if(!e)return null;let i=e.extractable===!1;return n(`div`,{className:`w-full flex items-baseline gap-2 min-w-0`,children:[t(`div`,{className:`truncate`,children:e.name||``}),t(`div`,{className:`text-sm text-muted shrink-0`,children:e.type||``}),i&&t(`span`,{className:`shrink-0 text-[10px] uppercase tracking-wide text-attention border border-attention/40 bg-attention/10 rounded px-1.5 py-0.5`,title:r(`widgets.schema.extractFromDocumentHint`),children:r(`widgets.schema.noExtract`)})]})}function tb(e,t,n){if(e.properties){let r=e.properties,i={};for(let e of Object.keys(r)){let a=r[e];e===t?i[n]=a:i[e]=a}e.properties=i}e.required&&=e.required.map(e=>e===t?n:e)}function nb(e,t,n){if(Array.isArray(e.required)){let r=e.required.indexOf(t);n?r<0&&e.required.push(t):r>-1&&e.required.splice(r,1)}else n&&(e.required=[t])}function rb(e,t){let n=t.name===`any`?void 0:t.isNullable?[t.name,`null`]:t.name;if(t.isArray){if(e.type=`array`,e.properties=void 0,!e.items||Array.isArray(e.items))e.items={type:n,properties:t.isObject?{}:void 0};else{let r=e.items;r.type=n,t.isObject&&!r.properties&&(r.properties={})}}else e.type=n,e.items=void 0,t.isObject?e.properties||={}:e.properties=void 0}function ib(e,t){e.properties&&(delete e.properties[t],Array.isArray(e.required)&&(e.required=e.required.filter(e=>e!==t)))}function ab(e,t,n,r=!1){if(e.type!==`object`)throw Error(`Cannot add property to a non-object schema`);e.properties||={};let i={};return rb(i,n),e.properties[t]=i,r&&(Array.isArray(e.required)?lb(e.required,t):e.required=[t]),i}function ob(e){let t=!1,n=!1,r,i=e.type;if(Array.isArray(i))for(let e of i)e===`null`?t=!0:r||=e;else r=i;r||=`any`,r===`array`&&(n=!0,r=sb(e.items));let a=r;switch(e.editor){case`textarea`:a=`text`;break;case`media`:a=`media`;break;case`document`:a=`document`}return{isNullable:t,isArray:n,isObject:r===`object`,name:a}}function sb(e){if(!e)return`any`;let t;return t=cb(Array.isArray(e)?e[0].type:e.type),(t===`array`||t===`null`)&&(t=`any`),t}function cb(e){return e?Array.isArray(e)?e.find(e=>e!==`null`)||`any`:e:`any`}function lb(e,t){e.includes(t)||e.push(t)}let ub=0;var db=class e{source;onChange=()=>{};schema;root;constructor(e,t){this.schema=e?typeof e==`string`?JSON.parse(e):e:{title:t,type:`object`,properties:{}},this.schema.properties||(this.schema.properties={}),this.root=new fb(``,this.schema,this),this.root.loadChildren()}get isEmpty(){return!this.root.children||this.root.children.length===0}get children(){return this.root.children??[]}reload(){return this.root=new fb(``,this.schema,this),this.root.loadChildren(),this.onChange?.(this),this}withSource(e,t){return this.source={uri:t,name:e},this}withChangeListener(e){return this.onChange=e,this}replaceSchema(e){this.schema=e||{title:this.schema.title,type:`object`,properties:{}},this.reload()}clone(){let t=new e(this.schema);return t.source=this.source,this.onChange&&t.withChangeListener(this.onChange),t}},fb=class e{schema;loader;parent;name;isRequired=!1;type;children;constructor(e,t,n,r){if(this.schema=t,this.loader=n,this.parent=r,this.name=e,this.type=ob(t),this.parent){let t=this.parent._getPropertiesSchema().required;this.isRequired=t&&Array.isArray(t)?t.includes(e):!1}}get title(){return typeof this.schema.title==`string`?this.schema.title:void 0}set title(e){this.schema.title=e}get description(){return this.schema.description}set description(e){this.schema.description=e}get extractable(){return this.schema[`x-extract`]!==!1}set extractable(e){e?delete this.schema[`x-extract`]:this.schema[`x-extract`]=!1}get isParent(){return this.type.isObject}get isNew(){return!!this.schema.isNew}set isNew(e){e?this.schema.isNew=!0:delete this.schema.isNew}resetIsNew(){let e=this.isNew;return this.isNew=!1,e}getNameSignature(){return`${this.name}${this.isRequired?``:`?`}`}getTypeSignature(){return`${this.type.name}${this.type.isArray?`[]`:``}${this.type.isNullable?`?`:``}`}getSignature(){return`${this.getNameSignature()}: ${this.getTypeSignature()}`}reloadTree(){this.loader.reload()}loadChildren(){this.children=[];let e=this.schema.items?.properties;this.schema.items&&e?this._loadChildren(e,this.children):this.schema.properties&&this._loadChildren(this.schema.properties,this.children)}_loadChildren(t,n){for(let r of Object.keys(t)){let i=t[r],a=new e(r,i,this.loader,this);n.push(a),a.isParent&&a.loadChildren()}}_getPropertiesSchema(){return this.type.isArray&&this.type.isObject?this.schema.items:this.schema}findAvailableChildName(e){let t=this._getPropertiesSchema().properties||{},n;do n=e+ ++ub;while(t[n]);return n}addChild(t,n,r=!1){if(!this.type.isObject)throw Error(`Cannot add child to a non object node`);this.children||=[];let i=ab(this._getPropertiesSchema(),t,n,r),a=new e(t,i,this.loader,this);return this.children.push(a),a}remove(){return this.parent?.type.isObject?(ib(this.parent._getPropertiesSchema(),this.name),this.parent.children&&(this.parent.children=this.parent.children.filter(e=>e.name!==this.name)),!0):!1}update(e){let t=!1;e.name!=null&&this.name!==e.name&&(this.parent&&tb(this.parent._getPropertiesSchema(),this.name,e.name),this.name=e.name,t=!0),e.isRequired!=null&&this.isRequired!==e.isRequired&&(this.parent&&nb(this.parent._getPropertiesSchema(),this.name,e.isRequired),this.isRequired=e.isRequired,t=!0);let n=e.type?.name;n===`any`&&(n=void 0);let r=n!==this.schema.type;return e.type&&(rb(this.schema,e.type),this.type=e.type,this.type.isObject?this.children||=[]:this.children=void 0,t=!0),this.schema.editor&&e.editor===null?(this.schema.editor=void 0,t=!0):e.editor?(this.schema.editor=e.editor,t=!0):r&&(this.schema.editor=void 0,t=!0),e.description!==this.description&&(this.description=e.description,t=!0),e.extractable!=null&&this.extractable!==e.extractable&&(this.extractable=e.extractable,t=!0),t}getUpdateFromNameAndTypeSignature(e,t){let n=e.trim(),r=!0;n.endsWith(`?`)&&(n=n.substring(0,n.length-1).trim(),r=!1);let i=Ky(t),a;return i.name===`text`?(i.name=Gy.string,a=`textarea`):i.name===`media`?(i.name=Gy.any,a=`media`):i.name===`document`?(i.name=Gy.any,a=`document`):a=null,{name:n,type:i,isRequired:r,editor:a}}updateFromNameAndTypeSignature(e,t){return this.update(this.getUpdateFromNameAndTypeSignature(e,t))}updateFromSignature(e){e=e.trim();let t=e.indexOf(`:`);if(t<0)throw Error(`Expecting a name and a type separated by a colon`);let n=e.substring(0,t),r=e.substring(t+1);return this.updateFromNameAndTypeSignature(n,r)}};function pb(e){let[t,n]=z(new db(e||{type:`object`,properties:{}}).withChangeListener(e=>{n(e.clone())}));return t}const mb=`block text-sm sm:leading-6 rounded-md border-0 py-1.5 px-4`,hb=`${mb} hover:shadow-xs hover:ring-1 hover:ring-inset hover:ring-ring`,gb=`${mb} shadow-xs ring-1 ring-inset ring-ring`;function _b({value:e,onChange:r,onDelete:i,outlineOnHover:a=!1,editOnClick:o=!0,placeholder:s,viewer:c,editor:l,skipClickOutside:u,isEditing:d=!1,readonly:f=!1,onValidate:p}){let{on:m,off:h,isOn:g}=E(d),[_,v]=z();return n(`div`,{className:``,children:[g&&!f?t(yb,{value:e,onSave:e=>{if(p){let t=p(e);if(t){v(t);return}v(void 0)}r(e)&&h()},onCancel:h,editor:l,skipClickOutside:e=>u?u(e):!1}):t(vb,{value:e,onEdit:m,viewer:c,placeholder:s,outlineOnHover:a,editOnClick:o,onDelete:i,readonly:f}),_&&t(`div`,{className:`text-red-500 text-sm`,children:_})]})}function vb({viewer:e,value:i,onEdit:a,editOnClick:o,outlineOnHover:s,placeholder:c,onDelete:l,readonly:u}){let d=()=>{o&&a()},f=e=>{e.key===`Enter`&&a()},p=`invisible group-hover:visible`;return n(`div`,{role:o?`button`:void 0,tabIndex:0,onKeyUp:f,onClick:d,className:k(`flex justify-start items-center group`,s?hb:mb,{"cursor-pointer":o}),children:[t(e,{value:i,placeholder:c}),n(`div`,{className:`ms-auto flex gap-2`,children:[!u&&l&&t(r,{variant:`ghost`,size:`sm`,className:p,onClick:l,children:t(Ct,{className:`size-4`})}),u?null:t(r,{variant:`ghost`,size:`sm`,className:p,onClick:a,children:t(yt,{className:`size-4`})})]})]})}function yb({editor:e,value:n,onSave:r,onCancel:i,skipClickOutside:a}){let[o,s]=z(n),c=R(n),[l,u]=z(null),d=()=>{r(c.current)},f=T(d,a);return t(`div`,{ref:f,children:t(`div`,{className:gb,children:t(`div`,{className:`w-full`,onClick:e=>e.stopPropagation(),children:t(e,{value:o,onChange:(e,t=!1)=>{s(e),c.current=e,t&&(l&&clearTimeout(l),u(setTimeout(()=>{r(e)},500)))},onSave:d,onCancel:i})})})})}function bb(e){return!!e.target.closest?.(`.schema-type-suggest-popup`)}function xb({schema:e,readonly:r=!1}){let{t:i}=B();return n(`div`,{className:`space-y-1`,children:[n(`div`,{className:`flex items-center gap-2 px-2 py-1 text-xs font-medium text-muted-foreground border-b border-border`,children:[t(`div`,{className:`flex-1 min-w-0`,children:i(`widgets.schema.propertyColumn`)}),!r&&t(`div`,{className:`shrink-0 w-28 text-end pe-1`,title:i(`widgets.schema.extractFromDocumentHint`),children:i(`widgets.schema.extractFromDocument`)}),t(`div`,{className:`w-8 shrink-0`})]}),n(`ul`,{className:``,children:[e.children.map(e=>Sb(e,r)),r?null:t(Db,{parent:e.root})]})]})}function Sb(e,n){return e.isParent?t(wb,{property:e,readonly:n},e.name):t(Cb,{node:e,readonly:n},e.name)}function Cb({node:e,readonly:n}){return t(`li`,{className:`border-b border-border/40 last:border-0`,children:t(Eb,{property:e,readonly:n})})}function wb({property:e,readonly:i}){let[a,o]=z(!0),s=a?qe:Je;return n(`li`,{className:`border-b border-border/40 last:border-0`,children:[n(`div`,{className:`flex items-center w-full gap-1`,children:[t(`div`,{className:`flex-1 min-w-0`,children:t(Eb,{property:e,readonly:i})}),t(r,{variant:`ghost`,size:`icon`,onClick:()=>o(!a),"aria-label":a?`Collapse ${e.name}`:`Expand ${e.name}`,"aria-expanded":a,className:`shrink-0`,children:t(s,{className:`size-4 cn-rtl-flip`})})]}),a&&n(`ul`,{className:`ms-4 border-s border-gray-400 border-dashed`,children:[(e.children||[]).map(e=>Sb(e,i)),i?null:t(Db,{parent:e})]})]})}function Tb(e){if(!e)return`Name is required`;if(!/^[a-zA-Z0-9_]+[?]?$/.test(e))return`Only letters, numbers, underscores or question mark are allowed (a-zA-Z0-9_?)`}function Eb({property:e,readonly:r}){let{t:i}=B(),a=O(),o=t=>{try{t.description&&typeof t.description!=`string`&&(t.description=void 0);let n=e.getUpdateFromNameAndTypeSignature(t.name,t.type);e.update({...n,description:t.description,extractable:t.extractable})&&e.reloadTree()}catch(e){return a({status:`error`,title:i(`widgets.schema.invalidPropertyDeclaration`),description:w(e),duration:9e3}),!1}return!0},s=t=>{e.update({extractable:t})&&e.reloadTree()},c=e.resetIsNew(),l=Wy(e);return n(`div`,{className:`flex items-center gap-2 w-full min-w-0 py-0.5`,children:[t(`div`,{className:`flex-1 min-w-0`,children:t(_b,{value:l,onChange:o,onDelete:()=>{e.remove(),e.reloadTree()},editor:Yy,viewer:eb,outlineOnHover:!0,isEditing:c,skipClickOutside:bb,readonly:r,onValidate:e=>Tb(e.name)})}),r?e.extractable===!1?t(`div`,{className:`shrink-0 w-28 flex justify-end pe-1`,children:t(`span`,{className:`text-[10px] uppercase tracking-wide text-attention border border-attention/40 bg-attention/10 rounded px-1.5 py-0.5`,title:i(`widgets.schema.extractFromDocumentHint`),children:i(`widgets.schema.noExtract`)})}):null:t(`div`,{className:`shrink-0 w-28 flex items-center justify-end gap-1.5 pe-1`,children:t(y,{size:`sm`,value:e.extractable,onChange:s,"aria-label":`${i(`widgets.schema.extractFromDocument`)}: ${e.name}`})})]})}function Db({parent:e}){return n(r,{variant:`ghost`,onClick:()=>{let t=e.findAvailableChildName(`new_property_`),n=e.addChild(t,{isObject:!1,isArray:!1,isNullable:!1,name:Gy.string},!0);n.isNew=!0,e.reloadTree()},children:[t(gt,{className:`size-4`}),`Add property`]})}function Ob(e){return e.isFile}function kb(e){return e.isDirectory}function Ab({onDrop:e,message:i,buttonLabel:a,allowFolders:o=!0,className:s=``}){let{t:c}=B(),l=a??c(`upload.uploadFiles`),[u,d]=z(!1),f=R(null),p=e=>{e.preventDefault(),e.dataTransfer.types.includes(`Files`)&&d(!0)},m=e=>{e.preventDefault(),f.current&&!f.current.contains(e.relatedTarget)&&d(!1)},h=async t=>{if(t.preventDefault(),d(!1),t.dataTransfer.items&&t.dataTransfer.items.length>0){let n=Array.from(t.dataTransfer.items),r=[],i=new Set,a=async e=>{if(Ob(e)){let t=await new Promise(t=>{e.file(n=>{Object.defineProperty(n,"webkitRelativePath",{writable:!0,value:e.fullPath.substring(1)}),t(n)})});!t.name.startsWith(`.`)&&t.size>0&&r.push(t);let n=e.fullPath.substring(1).split(`/`).slice(0,-1).join(`/`);n&&i.add(n)}else if(kb(e)){let t=e.createReader(),n=await new Promise(e=>{t.readEntries(t=>{e(t)})});await Promise.all(n.map(a));let r=e.fullPath.substring(1);r&&i.add(r)}};try{if(await Promise.all(n.map(e=>{let t=e.webkitGetAsEntry?e.webkitGetAsEntry():e;return t?a(t):Promise.resolve()})),r.length>0){let t=new Set(Array.from(i).map(e=>e.split(`/`)[0]).filter(Boolean)).size,n=r.length,a=``;a=t>0?c(`upload.preparingFolder`,{count:t,folderCount:t,fileCount:n}):c(`upload.preparingFiles`,{count:n}),e(r,{count:r.length,message:a})}}catch(n){console.error(`Error processing dropped files:`,n);let r=Array.from(t.dataTransfer.files);r.length>0&&e(r)}}else t.dataTransfer.files&&t.dataTransfer.files.length>0&&e(Array.from(t.dataTransfer.files))},g=t=>{if(t&&t.length>0){let n=Array.from(t);if(n.some(e=>e.webkitRelativePath?.includes(`/`))){let t=new Set(n.map(e=>e.webkitRelativePath.split(`/`)[0]).filter(Boolean)).size,r=n.length,i=c(`upload.preparingFolder`,{count:t,folderCount:t,fileCount:r});e(n,{count:n.length,message:i})}else e(n,{count:n.length,message:c(`upload.preparingFiles`,{count:n.length})})}};return n(`div`,{className:`flex flex-col items-center justify-center py-12 border-2 rounded-lg transition-colors ${u?`border-color-primary bg-color-primary/10`:`border-dashed border-color-border`} ${s}`,onDragOver:p,onDragLeave:m,onDrop:h,children:[t(wt,{className:`h-12 w-12 mb-3 transition-colors ${u?`text-primary`:`text-muted/50`}`}),t(`p`,{className:`text-muted`,children:i}),n(`div`,{className:`flex gap-2 justify-center mt-2`,children:[t(r,{onClick:()=>{let e=document.createElement(`input`);e.type=`file`,e.multiple=!0,e.accept=`*`,e?.click(),e.onchange=()=>{g(e.files)}},children:l}),o&&t(r,{onClick:()=>{let e=document.createElement(`input`);e.type=`file`,e.multiple=!0,e.accept=`*`,e.webkitdirectory=!0,e?.click(),e.onchange=()=>{g(e.files)}},children:c(`upload.selectFolder`)})]})]})}function jb({title:e,count:r,icon:i=t(Xe,{className:`h-4 w-4 text-green-500`}),items:a}){let{t:o}=B(),[s,c]=z(!1),l=ae();return n(`div`,{className:`border border-color-border rounded-md overflow-hidden`,children:[n(`button`,{type:`button`,"aria-expanded":s,"aria-controls":l,className:`w-full flex items-center justify-between p-3 bg-color-muted/10 cursor-pointer text-start bg-transparent border-0 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring`,onClick:()=>c(!s),children:[n(`span`,{className:`flex items-center`,children:[t(`span`,{className:`me-2`,children:i}),t(`span`,{className:`font-medium`,children:e}),t(`span`,{className:`ms-2 px-2 py-0.5 bg-color-muted/20 rounded-full text-xs`,children:r})]}),t(`span`,{className:`text-muted`,"aria-hidden":`true`,children:t(`svg`,{className:`h-5 w-5 transition-transform ${s?`transform rotate-180`:``}`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,"aria-hidden":`true`,children:t(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M19 9l-7 7-7-7`})})})]}),s&&t(`div`,{id:l,className:`p-3 border-t border-color-border max-h-48 overflow-y-auto`,children:a.length>0?t(`ul`,{className:`space-y-1`,children:a.map(e=>t(`li`,{className:`text-sm py-1 px-2 rounded hover:bg-color-muted/10`,children:e},e))}):t(`div`,{className:`text-sm text-muted py-2`,children:o(`upload.noItems`)})})]})}function Mb({files:e,className:r=``,location:i,collection:a}){let{t:o}=B(),s=e.filter(e=>e.status===`success`),c=e.filter(e=>e.status===`updated`),l=e.filter(e=>e.status===`skipped`),u=e.filter(e=>e.status===`failed`),d=s.length,f=c.length,p=l.length,m=u.length,h=e.length;return n(`div`,{className:`flex flex-col py-2 ${r}`,children:[n(`div`,{className:`flex items-center mb-4`,children:[t(`div`,{className:`size-8 me-4 rounded-full bg-success/10 flex items-center justify-center`,children:t(Xe,{className:`size-4 text-success`})}),t(`div`,{children:n(`p`,{className:`text-muted`,children:[o(`upload.filesProcessed`,{count:h}),a?o(`upload.inCollection`,{collection:a}):``,i?o(`upload.inFolder`,{location:i}):``]})})]}),n(`div`,{className:`space-y-3 mt-2`,children:[d>0&&t(jb,{title:o(`upload.successfullyUploaded`),count:d,icon:t(Xe,{className:`h-4 w-4 text-green-500`}),items:s.map(e=>e.name)}),f>0&&t(jb,{title:o(`upload.successfullyUpdated`),count:f,icon:t(Xe,{className:`h-4 w-4 text-blue-500`}),items:c.map(e=>e.name)}),p>0&&t(jb,{title:o(`upload.skippedAlreadyExisted`),count:p,icon:t(Ye,{className:`h-4 w-4 text-amber-500`}),items:l.map(e=>e.name)}),m>0&&t(jb,{title:o(`upload.failedToUpload`),count:m,icon:t(Ze,{className:`h-4 w-4 text-red-500`}),items:u.map(e=>e.name)})]})]})}const Nb=`#text`,Pb=`#comment`,Fb=`#cdata`,Ib=`DECLARATION_TAG`,Lb={tagColor:`#d43900`,textColor:`#333`,attributeKeyColor:`#2a7ab0`,attributeValueColor:`#008000`,separatorColor:`#333`,commentColor:`#aaa`,cdataColor:`#1d781d`,fontFamily:`monospace`},Rb={attributeKeyColor:`#FFD700`,attributeValueColor:`#FF4500`,tagColor:`#87CEFA`,textColor:`#00FF00`,separatorColor:`#FFD700`,commentColor:`#BEBEBE`,cdataColor:`#33CC66`,fontFamily:`monospace`},zb=N({theme:Lb,collapsible:!1,indentSize:2}),Bb=()=>ie(zb),Vb=new V({preserveOrder:!0,ignoreAttributes:!1,attributeNamePrefix:``,allowBooleanAttributes:!0,commentPropName:Pb,cdataPropName:Fb,parseTagValue:!1});function Hb(e){try{let t=new DOMParser().parseFromString(e,`application/xml`),n=t.documentElement.localName===`parsererror`?t.documentElement:void 0;if(n)throw Error(n.textContent?.trim()||`Invalid XML!`);let r=Vb.parse(e);if(e.trim().length>0&&r.length===0)throw Error(`Invalid XML!`);return{json:r,valid:!0}}catch(e){return{json:null,valid:!1,errorMessage:`Fail to parse: ${e instanceof Error?e.message:String(e)}`}}}function Ub(e){return L(()=>Hb(e),[e])}function Wb(e){let{indentation:r,children:i,isInline:a}=e,{theme:o}=Bb();return n(`div`,{style:{color:o.cdataColor},children:[t(`span`,{children:`${r}<![CDATA[`}),i,t(`span`,{children:`${a?``:r}]]>`})]})}function Gb(e){let{collapsible:n,theme:r}=Bb(),{collapsed:i}=e;return n?t(`span`,{style:{position:`relative`},children:t(`span`,{style:{position:`absolute`,right:`0`,border:0,padding:0,background:`none`},children:t(Kb,{fill:r.separatorColor,style:{transform:`rotate(${i?0:90}deg)`,transition:`transform 0.2s`}})})}):null}function Kb({...e}){return t(`svg`,{width:`16px`,height:`16px`,viewBox:`0 0 24 24`,"aria-hidden":`true`,...e,children:t(`path`,{d:`M9 17.898C9 18.972 10.2649 19.546 11.0731 18.8388L17.3838 13.3169C18.1806 12.6197 18.1806 11.3801 17.3838 10.6829L11.0731 5.16108C10.2649 4.45388 9 5.02785 9 6.1018V17.898Z`})})}function qb(e){let{collapsible:t,initialCollapsedDepth:n}=Bb(),[r,i]=z(()=>Se(n)||!t?!1:e>=n);return I(()=>{i(Se(n)||!t?!1:e>=n)},[n,e,t]),{collapsed:r,buttonProps:t?{onClick:()=>i(e=>!e),role:`button`,style:{cursor:`pointer`}}:{}}}function Jb(e){let{indentation:r,children:i,isInline:a,level:o}=e,{theme:s}=Bb(),{collapsed:c,buttonProps:l}=qb(o);return n(`div`,{style:{color:s.commentColor},children:[n(`span`,{...l,children:[t(`span`,{children:r}),t(Gb,{collapsed:c}),t(`span`,{children:`<!-- `})]}),!c&&i,c&&`...`,t(`span`,{children:`${a||c?` `:r}-->`})]})}function Yb(e){let{attributes:r}=e,{theme:i}=Bb();return r?t(`span`,{children:Object.entries(r).map(([e,r])=>n(`span`,{children:[t(`span`,{style:{color:i.attributeKeyColor},children:` ${e}`}),t(`span`,{style:{color:i.separatorColor},children:`=`}),t(`span`,{style:{color:i.attributeValueColor},children:`"${r}"`})]},`attribute-${e}`))}):null}function Xb(e){let{indentation:r,tagKey:i,attributes:a}=e,{theme:o}=Bb();return n(`div`,{children:[t(`span`,{style:{color:o.separatorColor},children:`${r}<?`}),t(`span`,{style:{color:o.tagColor},children:`${i.slice(1)}`}),t(Yb,{attributes:a}),t(`span`,{style:{color:o.separatorColor},children:`?>`})]})}function Zb(e,t){return Array(t*e+1).join(` `)}function Qb(e){return typeof e==`string`&&e.includes(`
341
+ `)}function $b(e){return typeof e!=`string`&&e.length===1&&`#text`in e[0]&&!Qb(e[0][`#text`])}function ex(e){switch(e){case Nb:case Fb:case Pb:return e;default:return e.startsWith(`?`)?Ib:`TAG`}}function tx(e){let t=e[`:@`],n=Ce(e,`:@`),[[r,i]]=Object.entries(n);return{attributes:t,tagKey:r,subElements:i,type:ex(r)}}function nx(e){return e?Object.keys(e).length>0:!1}function rx(r){let{indentation:i,tagKey:a,attributes:o,children:s,isInline:c,hasChildren:l,level:u}=r,{collapsed:d,buttonProps:f}=qb(u),{theme:p}=Bb();return n(`div`,{children:[n(`span`,{...f,children:[t(`span`,{children:i}),t(Gb,{collapsed:d}),t(`span`,{style:{color:p.separatorColor},children:`<`}),t(`span`,{style:{color:p.tagColor},children:`${a}`}),!d&&t(Yb,{attributes:o}),d&&nx(o)&&` ...`,t(`span`,{style:{color:p.separatorColor},children:l?`>`:` />`})]}),l&&n(e,{children:[!d&&s,d&&`...`,t(`span`,{style:{color:p.separatorColor},children:`${c||d?``:i}</`}),t(`span`,{style:{color:p.tagColor},children:`${a}`}),t(`span`,{style:{color:p.separatorColor},children:`>`})]})]})}function ix(e){let{hasSiblings:n,text:r,indentation:i,isText:a}=e,{theme:o}=Bb(),s=a?{color:o.textColor}:void 0;return Qb(r)||n?t(`div`,{style:s,children:r.split(`
342
+ `).filter(e=>!!e.trim()).map((e,n)=>t(`div`,{children:`${i}${e.trim()}`},`line-${n}`))}):t(`span`,{style:s,children:r})}function ax(n){let{elements:r,level:i=0,isText:a=!0}=n,{indentSize:o}=Bb();return!Array.isArray(r)||r.length===0?null:t(e,{children:r.map((e,n)=>{let{tagKey:s,attributes:c,subElements:l,type:u}=tx(e),d=r.length>1,f=Zb(o,i),p=`${i}-${n}`,m=$b(l);switch(u){case Nb:return t(ix,{text:l,indentation:f,hasSiblings:d,isText:a},p);case Pb:return t(Jb,{isInline:m,indentation:f,level:i,children:t(ax,{elements:l,level:i+1,isText:!1})},p);case Fb:return t(Wb,{indentation:f,isInline:m,children:t(ax,{elements:l,level:i+1,isText:!1})},p);case Ib:return t(Xb,{indentation:f,tagKey:s,attributes:c},p);default:return t(rx,{indentation:f,tagKey:s,attributes:c,isInline:m,hasChildren:l.length>0,level:i,children:t(ax,{elements:l,level:i+1})},p)}})})}function ox(){return t(`div`,{children:`Invalid XML!`})}function sx(e){let{theme:n,xml:r,collapsible:i=!1,indentSize:a=2,invalidXml:o,initalCollapsedDepth:s,initialCollapsedDepth:c}=e,[l,u]=z(()=>document.documentElement.classList.contains(`dark`));I(()=>{let e=document.documentElement,t=new MutationObserver(()=>{u(e.classList.contains(`dark`))});return t.observe(e,{attributes:!0,attributeFilter:[`class`]}),()=>t.disconnect()},[]);let d=L(()=>({...l?Rb:Lb,...n}),[l,n]),{json:f,valid:p}=Ub(r),m=L(()=>({theme:d,collapsible:i,indentSize:a,initialCollapsedDepth:c??s}),[d,i,a,s,c]);return p?t(zb.Provider,{value:m,children:t(`div`,{className:`rxv-container`,style:{whiteSpace:`pre-wrap`,fontFamily:d.fontFamily,overflowWrap:`break-word`},children:t(ax,{elements:f})})}):o||t(ox,{})}export{zn as AgentResourceResolverProvider,Xt as ArrayPropertySchema,da as ArtifactContentRenderer,zy as ArtifactEditingSurface,G_ as ChartCodeBlockHandler,na as CodeBlockErrorBoundary,$i as CodeBlockHandlerProvider,U as CodeBlockPlaceholder,A_ as CodeBlockRendererProvider,yy as CollaborativeMarkdownRenderer,Ab as DropZone,J_ as ExpandCodeBlockHandler,Dt as FieldSetContextProvider,Pt as Form,kt as FormContext,Mt as FormContextProvider,Gt as FormError,Wt as FormHelper,Ut as FormLabel,It as GeneratedForm,Nt as Input,cn as JSONCode,bn as JSONDisplay,Mn as JSONEditor,Pn as JSONSwitcher,Ln as JSONTable,fn as JSONView,on as ManageObjectEntry,an as ManagedListProperty,tn as ManagedObject,en as ManagedObjectBase,nn as ManagedObjectProperty,rn as ManagedProperty,sn as ManagedScalarEntry,db as ManagedSchema,tv as MarkdownFigure,rv as MarkdownImage,av as MarkdownLink,$v as MarkdownRenderer,K_ as MermaidCodeBlockHandler,R_ as MermaidDiagram,jn as MonacoEditor,$t as Node,By as Progress,Vy as PropertiesView,Yy as PropertyEditor,Xy as PropertyNameEditor,Jt as PropertySchema,eb as PropertyViewer,zt as ScalarField,qt as Schema,xb as SchemaEditor,fb as SchemaNode,Hy as SvgIcon,jb as UploadResultCategory,Mb as UploadSummary,An as VEditorApi,sx as XMLViewer,Fy as applyArtifactRefreshChanges,my as applyMarkdownEditingChange,Zt as computeTitleFromName,X_ as createDefaultCodeBlockHandlers,ly as createMarkdownBlockAnchor,Uy as createSvgIcon,My as createUnifiedLineDiff,Ey as diffTextSegments,Cy as diffWordSegments,hy as formatMarkdownEditingAction,Wy as getEditableSchemaProperty,Nn as getJSONEditorValue,Dy as getTextLineChangeRegions,Py as isArtifactRefreshEvent,Y_ as isExpandLanguage,V_ as isIncompleteJson,Hn as parseAgentResourceHref,$_ as parseUrlScheme,jy as rebaseTextChanges,dn as renderJsonLine,Bn as useAgentResourceResolver,B_ as useArtifactContent,M_ as useCodeBlockComponent,ea as useCodeBlockContext,j_ as useCodeBlockRendererRegistry,Ot as useFieldSet,jt as useForm,ev as useResolvedUrl,pb as useSchema,Tb as validatePropertyName};
27
343
  //# sourceMappingURL=vertesia-ui-widgets.js.map