@kanyun-ai-infra/band-cli 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (96) hide show
  1. package/bundled/examples/aitutor-tool/band/views/release/package.json +1 -1
  2. package/bundled/examples/aitutor-tool/band/views/tool-preview/package.json +1 -1
  3. package/bundled/examples/analysis/band/views/intake/package.json +1 -1
  4. package/bundled/examples/compliance/band/views/compliance/package.json +1 -1
  5. package/bundled/examples/content-review/band/views/checklist/package.json +1 -1
  6. package/bundled/examples/rush-site/band/views/rush-db/package.json +1 -1
  7. package/bundled/examples/rush-site/band/views/rush-deploy/package.json +1 -1
  8. package/bundled/examples/video/band/views/timeline/package.json +1 -1
  9. package/bundled/kernel/fixture.js +1 -1
  10. package/bundled/kernel/index.js +1 -1
  11. package/bundled/official/activity/package.json +4 -4
  12. package/bundled/official/approval/package.json +4 -4
  13. package/bundled/official/artifacts/package.json +4 -4
  14. package/bundled/official/chat/package.json +4 -4
  15. package/bundled/official/chunks/chunk-DIL5YSVK.js +1 -0
  16. package/bundled/official/comment/dist/index.js +2 -2
  17. package/bundled/official/comment/package.json +4 -4
  18. package/bundled/official/header/package.json +4 -4
  19. package/bundled/official/home/package.json +4 -4
  20. package/bundled/official/layouts/package.json +4 -4
  21. package/bundled/official/library/dist/index.js +1 -1
  22. package/bundled/official/library/package.json +4 -4
  23. package/bundled/official/members/dist/index.js +1 -1
  24. package/bundled/official/members/package.json +4 -4
  25. package/bundled/official/memory/dist/index.js +2 -2
  26. package/bundled/official/memory/package.json +4 -4
  27. package/bundled/official/native/package.json +2 -2
  28. package/bundled/official/params-form/package.json +4 -4
  29. package/bundled/official/plugins/package.json +4 -4
  30. package/bundled/official/project/dist/index.js +1 -1
  31. package/bundled/official/project/package.json +4 -4
  32. package/bundled/official/queue/package.json +4 -4
  33. package/bundled/official/settings/dist/index.js +1 -1
  34. package/bundled/official/settings/package.json +4 -4
  35. package/bundled/official/settings/plugin.yaml +7 -0
  36. package/bundled/official/shell/dist/index.js +1 -1
  37. package/bundled/official/shell/package.json +4 -4
  38. package/bundled/official/stages/package.json +4 -4
  39. package/bundled/official/threads/package.json +4 -4
  40. package/bundled/official/turn-bar/package.json +4 -4
  41. package/bundled/official/turn-trace/package.json +4 -4
  42. package/bundled/official/version-switch/dist/index.js +1 -1
  43. package/bundled/official/version-switch/package.json +4 -4
  44. package/bundled/official/viewer-entity/package.json +2 -2
  45. package/bundled/official/viewer-external/package.json +2 -2
  46. package/bundled/official/viewer-image/package.json +2 -2
  47. package/bundled/official/viewer-media/index.js +2 -2
  48. package/bundled/official/viewer-media/package.json +2 -2
  49. package/bundled/official/viewer-storyboard/index.js +2 -2
  50. package/bundled/official/viewer-storyboard/package.json +2 -2
  51. package/bundled/official/viewer-text/dist/index.js +2 -2
  52. package/bundled/official/viewer-text/package.json +4 -4
  53. package/bundled/official/viewer-tool/package.json +2 -2
  54. package/bundled/official/viewer-web/package.json +2 -2
  55. package/bundled/official/viewer-web-app/package.json +2 -2
  56. package/bundled/official/workshops/dist/index.js +2 -2
  57. package/bundled/official/workshops/package.json +4 -4
  58. package/bundled/official/workshops/plugin.yaml +2 -2
  59. package/bundled/skills/band-plugin/SKILL.md +20 -273
  60. package/bundled/skills/band-plugin/references/code.md +58 -0
  61. package/bundled/skills/band-plugin/references/dev.md +37 -0
  62. package/bundled/skills/band-plugin/references/execution.md +26 -0
  63. package/bundled/skills/band-plugin/references/manifest.md +65 -0
  64. package/bundled/skills/band-plugin/references/placement.md +34 -0
  65. package/bundled/skills/band-plugin/references/reuse.md +38 -0
  66. package/bundled/skills/band-plugin/references/rules.md +13 -0
  67. package/bundled/skills/band-plugin/references/shape.md +17 -0
  68. package/bundled/skills/band-plugin/references/testing-publish.md +35 -0
  69. package/bundled/skills/band-plugin/references/viewer-comments.md +25 -0
  70. package/bundled/skills/band-plugin/templates/dev/fixture.ts +15 -0
  71. package/bundled/skills/band-plugin/templates/dev/resources.ts +6 -0
  72. package/bundled/skills/band-plugin/templates/panel/index.ts +24 -0
  73. package/bundled/skills/band-plugin/templates/panel/package.json +12 -0
  74. package/bundled/skills/band-plugin/templates/panel/plugin.yaml +5 -0
  75. package/bundled/skills/band-plugin/templates/toolbar-dock/plugin.yaml +11 -0
  76. package/dev-host/Inspector.tsx +28 -10
  77. package/dev-host/app.tsx +11 -6
  78. package/dev-host/host.css +11 -0
  79. package/dev-host/main.tsx +5 -0
  80. package/dist/bin.js +3 -3
  81. package/dist/build-plugin.d.ts +1 -1
  82. package/dist/build-plugin.js +1 -1
  83. package/dist/{chunk-TN7Z3OF6.js → chunk-LGYGWMSY.js} +19 -17
  84. package/dist/{chunk-VVJNG5GV.js → chunk-Q2XJXNVH.js} +22 -15
  85. package/dist/{chunk-RAD6MMSL.js → chunk-XPLYTHNX.js} +1 -1
  86. package/dist/{dev-server-RAZQ32W7.js → dev-server-Q7NTJ3QD.js} +116 -11
  87. package/dist/fixture.d.ts +11 -0
  88. package/dist/index.d.ts +2 -2
  89. package/dist/index.js +3 -3
  90. package/dist/vite.d.ts +1 -1
  91. package/dist/vite.js +2 -2
  92. package/dist/{workshop-repo-CO6YMDee.d.ts → workshop-repo-DqoVdcGu.d.ts} +10 -10
  93. package/package.json +10 -7
  94. package/src/dev-managers.ts +16 -0
  95. package/src/inspector-plugins.ts +18 -0
  96. package/bundled/official/chunks/chunk-JI6ZNGOE.js +0 -1
@@ -1,2 +1,2 @@
1
- import"../../chunks/chunk-NUFRM6SI.js";import{ccount,highlight,tokenStyle}from"../../chunks/chunk-PSLWCPAE.js";import{relocateTextRange}from"../../chunks/chunk-Z47EOZYW.js";import"../../chunks/chunk-NUFRM6SI.js";import{MATERIAL_TEXT_MAX_BYTES,materialError,materialViewer,readMaterialText}from"../../chunks/chunk-N6N56MWF.js";import{mountDockButtons}from"../../chunks/chunk-TWQQ2CCT.js";import{__export}from"../../chunks/chunk-JFPQMFKF.js";import{ErrorNote,Mount,THREAD_EVENTS,reactMount,scrollIntoPanel,useArtifactRole,useCtxData,useSlotEntries,withImeGuard as withImeGuard2}from"@kanyun-ai-infra/band-plugin-react";import{definePlugin}from"@kanyun-ai-infra/band-plugin-sdk";import{useCallback as useCallback2,useEffect as useEffect4,useLayoutEffect,useMemo as useMemo2,useRef as useRef2,useState as useState4,useSyncExternalStore}from"react";import{createPortal}from"react-dom";import{useMemo}from"react";import{Fragment,jsx,jsxs}from"react/jsx-runtime";var emptyOptions={};function toString(value,options){const settings=options||emptyOptions;const includeImageAlt=typeof settings.includeImageAlt==="boolean"?settings.includeImageAlt:true;const includeHtml=typeof settings.includeHtml==="boolean"?settings.includeHtml:true;return one(value,includeImageAlt,includeHtml)}function one(value,includeImageAlt,includeHtml){if(node(value)){if("value"in value){return value.type==="html"&&!includeHtml?"":value.value}if(includeImageAlt&&"alt"in value&&value.alt){return value.alt}if("children"in value){return all(value.children,includeImageAlt,includeHtml)}}if(Array.isArray(value)){return all(value,includeImageAlt,includeHtml)}return""}function all(values,includeImageAlt,includeHtml){const result=[];let index2=-1;while(++index2<values.length){result[index2]=one(values[index2],includeImageAlt,includeHtml)}return result.join("")}function node(value){return Boolean(value&&typeof value==="object")}var element=document.createElement("i");function decodeNamedCharacterReference(value){const characterReference2="&"+value+";";element.innerHTML=characterReference2;const character=element.textContent;if(character.charCodeAt(character.length-1)===59&&value!=="semi"){return false}return character===characterReference2?false:character}function splice(list2,start,remove,items){const end=list2.length;let chunkStart=0;let parameters;if(start<0){start=-start>end?0:end+start}else{start=start>end?end:start}remove=remove>0?remove:0;if(items.length<1e4){parameters=Array.from(items);parameters.unshift(start,remove);list2.splice(...parameters)}else{if(remove)list2.splice(start,remove);while(chunkStart<items.length){parameters=items.slice(chunkStart,chunkStart+1e4);parameters.unshift(start,0);list2.splice(...parameters);chunkStart+=1e4;start+=1e4}}}function push(list2,items){if(list2.length>0){splice(list2,list2.length,0,items);return list2}return items}var hasOwnProperty={}.hasOwnProperty;function combineExtensions(extensions){const all2={};let index2=-1;while(++index2<extensions.length){syntaxExtension(all2,extensions[index2])}return all2}function syntaxExtension(all2,extension2){let hook;for(hook in extension2){const maybe=hasOwnProperty.call(all2,hook)?all2[hook]:void 0;const left=maybe||(all2[hook]={});const right=extension2[hook];let code2;if(right){for(code2 in right){if(!hasOwnProperty.call(left,code2))left[code2]=[];const value=right[code2];constructs(left[code2],Array.isArray(value)?value:value?[value]:[])}}}}function constructs(existing,list2){let index2=-1;const before=[];while(++index2<list2.length){;(list2[index2].add==="after"?existing:before).push(list2[index2])}splice(existing,0,0,before)}function decodeNumericCharacterReference(value,base){const code2=Number.parseInt(value,base);if(code2<9||code2===11||code2>13&&code2<32||code2>126&&code2<160||code2>55295&&code2<57344||code2>64975&&code2<65008||(code2&65535)===65535||(code2&65535)===65534||code2>1114111){return"\uFFFD"}return String.fromCodePoint(code2)}function normalizeIdentifier(value){return value.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}var asciiAlpha=regexCheck(/[A-Za-z]/);var asciiAlphanumeric=regexCheck(/[\dA-Za-z]/);var asciiAtext=regexCheck(/[#-'*+\--9=?A-Z^-~]/);function asciiControl(code2){return code2!==null&&(code2<32||code2===127)}var asciiDigit=regexCheck(/\d/);var asciiHexDigit=regexCheck(/[\dA-Fa-f]/);var asciiPunctuation=regexCheck(/[!-/:-@[-`{-~]/);function markdownLineEnding(code2){return code2!==null&&code2<-2}function markdownLineEndingOrSpace(code2){return code2!==null&&(code2<0||code2===32)}function markdownSpace(code2){return code2===-2||code2===-1||code2===32}var unicodePunctuation=regexCheck(/\p{P}|\p{S}/u);var unicodeWhitespace=regexCheck(/\s/);function regexCheck(regex){return check;function check(code2){return code2!==null&&code2>-1&&regex.test(String.fromCharCode(code2))}}function normalizeUri(value){const result=[];let index2=-1;let start=0;let skip=0;while(++index2<value.length){const code2=value.charCodeAt(index2);let replace2="";if(code2===37&&asciiAlphanumeric(value.charCodeAt(index2+1))&&asciiAlphanumeric(value.charCodeAt(index2+2))){skip=2}else if(code2<128){if(!/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(code2))){replace2=String.fromCharCode(code2)}}else if(code2>55295&&code2<57344){const next=value.charCodeAt(index2+1);if(code2<56320&&next>56319&&next<57344){replace2=String.fromCharCode(code2,next);skip=1}else{replace2="\uFFFD"}}else{replace2=String.fromCharCode(code2)}if(replace2){result.push(value.slice(start,index2),encodeURIComponent(replace2));start=index2+skip+1;replace2=""}if(skip){index2+=skip;skip=0}}return result.join("")+value.slice(start)}function factorySpace(effects,ok3,type,max){const limit=max?max-1:Infinity;let size=0;return start;function start(code2){if(markdownSpace(code2)){effects.enter(type);return prefix(code2)}return ok3(code2)}function prefix(code2){if(markdownSpace(code2)&&size++<limit){effects.consume(code2);return prefix}effects.exit(type);return ok3(code2)}}function factorySpaceMinMax(effects,ok3,nok,type,min,max){let size=0;return start;function start(code2){if(max>0&&markdownSpace(code2)){effects.enter(type);return prefix(code2)}return after(code2)}function prefix(code2){if(markdownSpace(code2)&&size<max){effects.consume(code2);size++;return prefix}effects.exit(type);return after(code2)}function after(code2){return size>=min?ok3(code2):nok(code2)}}var content={tokenize:initializeContent};function initializeContent(effects){const contentStart=effects.attempt(this.parser.constructs.contentInitial,afterContentStartConstruct,paragraphInitial);let previous3;return contentStart;function afterContentStartConstruct(code2){if(code2===null){effects.consume(code2);return}effects.enter("lineEnding");effects.consume(code2);effects.exit("lineEnding");return factorySpace(effects,contentStart,"linePrefix")}function paragraphInitial(code2){effects.enter("paragraph");return lineStart(code2)}function lineStart(code2){const token=effects.enter("chunkText",{contentType:"text",previous:previous3});if(previous3){previous3.next=token}previous3=token;return data(code2)}function data(code2){if(code2===null){effects.exit("chunkText");effects.exit("paragraph");effects.consume(code2);return}if(markdownLineEnding(code2)){effects.consume(code2);effects.exit("chunkText");return lineStart}effects.consume(code2);return data}}var EditMap=class{constructor(){this.index=new Map;this.map=[]}add(index2,remove,add){addImplementation(this,index2,remove,add,false)}addBefore(index2,remove,add){addImplementation(this,index2,remove,add,true)}consume(events){this.map.sort(function(a,b){return a[0]-b[0]});if(this.map.length===0){return}let index2=this.map.length;const vecs=[];while(index2>0){index2-=1;vecs.push(events.slice(this.map[index2][0]+this.map[index2][1]),this.map[index2][2]);events.length=this.map[index2][0]}vecs.push(events.slice());events.length=0;let slice=vecs.pop();while(slice){for(const element2 of slice){events.push(element2)}slice=vecs.pop()}this.map.length=0;this.index.clear()}};function addImplementation(editMap,at,remove,add,before){if(remove===0&&add.length===0){return}const existing=editMap.index.get(at);if(existing){existing[1]+=remove;if(before){add.push(...existing[2]);existing[2]=add}else{existing[2].push(...add)}return}const change=[at,remove,add];editMap.map.push(change);editMap.index.set(at,change)}var document2={tokenize:initializeDocument};var containerConstruct={tokenize:tokenizeContainer};function initializeDocument(effects){const self=this;const stack=[];let continued=0;let childFlow;let childToken;let lineStartOffset;return start;function start(code2){if(continued<stack.length){const item=stack[continued];self.containerState=item[1];return effects.attempt(item[0].continuation,documentContinue,checkNewContainers)(code2)}return checkNewContainers(code2)}function documentContinue(code2){continued++;if(self.containerState._closeFlow){self.containerState._closeFlow=void 0;if(childFlow){closeFlow()}const indexBeforeExits=self.events.length;let indexBeforeFlow=indexBeforeExits;let point3;while(indexBeforeFlow--){if(self.events[indexBeforeFlow][0]==="exit"&&self.events[indexBeforeFlow][1].type==="chunkFlow"){point3=self.events[indexBeforeFlow][1].end;break}}exitContainers(continued);let index2=indexBeforeExits;while(index2<self.events.length){self.events[index2][1].end={...point3};index2++}const editMap=new EditMap;editMap.add(indexBeforeFlow+1,0,self.events.slice(indexBeforeExits));editMap.add(indexBeforeExits,index2-indexBeforeExits,[]);editMap.consume(self.events);return checkNewContainers(code2)}return start(code2)}function checkNewContainers(code2){if(continued===stack.length){if(!childFlow){return documentContinued(code2)}if(childFlow.currentConstruct&&childFlow.currentConstruct.concrete){return flowStart(code2)}self.interrupt=Boolean(childFlow.currentConstruct&&!childFlow._gfmTableDynamicInterruptHack)}self.containerState={};return effects.check(containerConstruct,thereIsANewContainer,thereIsNoNewContainer)(code2)}function thereIsANewContainer(code2){if(childFlow){closeFlow()}exitContainers(continued);return documentContinued(code2)}function thereIsNoNewContainer(code2){self.parser.lazy[self.now().line]=continued!==stack.length;lineStartOffset=self.now().offset;return flowStart(code2)}function documentContinued(code2){self.containerState={};return effects.attempt(containerConstruct,containerContinue,flowStart)(code2)}function containerContinue(code2){continued++;stack.push([self.currentConstruct,self.containerState]);return documentContinued(code2)}function flowStart(code2){if(code2===null){if(childFlow){closeFlow()}exitContainers(0);effects.consume(code2);return}childFlow=childFlow||self.parser.flow(self.now());effects.enter("chunkFlow",{_tokenizer:childFlow,contentType:"flow",previous:childToken});return flowContinue(code2)}function flowContinue(code2){if(code2===null){writeToChild(effects.exit("chunkFlow"),true);exitContainers(0);effects.consume(code2);return}if(markdownLineEnding(code2)){effects.consume(code2);writeToChild(effects.exit("chunkFlow"));continued=0;self.interrupt=void 0;return start}effects.consume(code2);return flowContinue}function writeToChild(token,endOfFile){const stream=self.sliceStream(token);if(endOfFile){stream.push(null)}token.previous=childToken;if(childToken){childToken.next=token}childToken=token;childFlow.defineSkip(token.start);childFlow.write(stream);if(self.parser.lazy[token.start.line]){let index2=childFlow.events.length;while(index2--){if(childFlow.events[index2][1].start.offset<lineStartOffset&&(!childFlow.events[index2][1].end||childFlow.events[index2][1].end.offset>lineStartOffset)){return}}const indexBeforeExits=self.events.length;let indexBeforeFlow=indexBeforeExits;let seen;let point3;while(indexBeforeFlow--){if(self.events[indexBeforeFlow][0]==="exit"&&self.events[indexBeforeFlow][1].type==="chunkFlow"){if(seen){point3=self.events[indexBeforeFlow][1].end;break}seen=true}}exitContainers(continued);index2=indexBeforeExits;while(index2<self.events.length){self.events[index2][1].end={...point3};index2++}const editMap=new EditMap;editMap.add(indexBeforeFlow+1,0,self.events.slice(indexBeforeExits));editMap.add(indexBeforeExits,index2-indexBeforeExits,[]);editMap.consume(self.events)}}function exitContainers(size){let index2=stack.length;while(index2-- >size){const entry=stack[index2];self.containerState=entry[1];entry[0].exit.call(self,effects)}stack.length=size}function closeFlow(){childFlow.write([null]);childToken=void 0;childFlow=void 0;self.containerState._closeFlow=void 0}}function tokenizeContainer(effects,ok3,nok){return factorySpace(effects,effects.attempt(this.parser.constructs.document,ok3,nok),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function classifyCharacter(code2){if(code2===null||markdownLineEndingOrSpace(code2)||unicodeWhitespace(code2)){return 1}if(unicodePunctuation(code2)){return 2}}function resolveAll(constructs2,events,context){const called=[];let index2=-1;while(++index2<constructs2.length){const resolve=constructs2[index2].resolveAll;if(resolve&&!called.includes(resolve)){events=resolve(events,context);called.push(resolve)}}return events}var attention={name:"attention",resolveAll:resolveAllAttention,tokenize:tokenizeAttention};function resolveAllAttention(events,context){let index2=-1;let nextEvents;while(++index2<events.length){if(events[index2][0]==="enter"&&events[index2][1].type==="attentionSequence"&&events[index2][1]._close){let open=index2;while(open--){if(events[open][0]==="exit"&&events[open][1].type==="attentionSequence"&&events[open][1]._open&&context.sliceSerialize(events[open][1]).charCodeAt(0)===context.sliceSerialize(events[index2][1]).charCodeAt(0)){if((events[open][1]._close||events[index2][1]._open)&&(events[index2][1].end.offset-events[index2][1].start.offset)%3&&!((events[open][1].end.offset-events[open][1].start.offset+events[index2][1].end.offset-events[index2][1].start.offset)%3)){continue}const use=events[open][1].end.offset-events[open][1].start.offset>1&&events[index2][1].end.offset-events[index2][1].start.offset>1?2:1;const start={...events[open][1].end};const end={...events[index2][1].start};movePoint(start,-use);movePoint(end,use);const openingSequence={type:use>1?"strongSequence":"emphasisSequence",start,end:{...events[open][1].end}};const closingSequence={type:use>1?"strongSequence":"emphasisSequence",start:{...events[index2][1].start},end};const text4={type:use>1?"strongText":"emphasisText",start:{...events[open][1].end},end:{...events[index2][1].start}};const group={type:use>1?"strong":"emphasis",start:{...openingSequence.start},end:{...closingSequence.end}};events[open][1].end={...openingSequence.start};events[index2][1].start={...closingSequence.end};nextEvents=[];if(events[open][1].end.offset-events[open][1].start.offset){nextEvents=push(nextEvents,[["enter",events[open][1],context],["exit",events[open][1],context]])}nextEvents=push(nextEvents,[["enter",group,context],["enter",openingSequence,context],["exit",openingSequence,context],["enter",text4,context]]);nextEvents=push(nextEvents,resolveAll(context.parser.constructs.insideSpan.null,events.slice(open+1,index2),context));nextEvents=push(nextEvents,[["exit",text4,context],["enter",closingSequence,context],["exit",closingSequence,context],["exit",group,context]]);let offset=0;if(events[index2][1].end.offset-events[index2][1].start.offset){offset=2;nextEvents=push(nextEvents,[["enter",events[index2][1],context],["exit",events[index2][1],context]])}splice(events,open-1,index2-open+3,nextEvents);index2=open+nextEvents.length-offset-2;break}}}}index2=-1;while(++index2<events.length){if(events[index2][1].type==="attentionSequence"){events[index2][1].type="data"}}return events}function tokenizeAttention(effects,ok3){const attentionMarkers2=this.parser.constructs.attentionMarkers.null;const previous3=this.previous;const before=classifyCharacter(previous3);let marker;return start;function start(code2){marker=code2;effects.enter("attentionSequence");return inside(code2)}function inside(code2){if(code2===marker){effects.consume(code2);return inside}const token=effects.exit("attentionSequence");const after=classifyCharacter(code2);const open=!after||after===2&&before||attentionMarkers2.includes(code2)&&code2!==42&&code2!==95;const close=!before||before===2&&after||attentionMarkers2.includes(previous3)&&previous3!==42&&previous3!==95;token._open=Boolean(marker===42?open:open&&(before||!close));token._close=Boolean(marker===42?close:close&&(after||!open));return ok3(code2)}}function movePoint(point3,offset){point3.column+=offset;point3.offset+=offset;point3._bufferIndex+=offset}var autolink={name:"autolink",tokenize:tokenizeAutolink};function tokenizeAutolink(effects,ok3,nok){let size=0;return start;function start(code2){effects.enter("autolink");effects.enter("autolinkMarker");effects.consume(code2);effects.exit("autolinkMarker");effects.enter("autolinkProtocol");return open}function open(code2){if(asciiAlpha(code2)){effects.consume(code2);return schemeOrEmailAtext}if(code2===64){return nok(code2)}return emailAtext(code2)}function schemeOrEmailAtext(code2){if(code2===43||code2===45||code2===46||asciiAlphanumeric(code2)){size=1;return schemeInsideOrEmailAtext(code2)}return emailAtext(code2)}function schemeInsideOrEmailAtext(code2){if(code2===58){effects.consume(code2);size=0;return urlInside}if((code2===43||code2===45||code2===46||asciiAlphanumeric(code2))&&size++<32){effects.consume(code2);return schemeInsideOrEmailAtext}size=0;return emailAtext(code2)}function urlInside(code2){if(code2===62){effects.exit("autolinkProtocol");effects.enter("autolinkMarker");effects.consume(code2);effects.exit("autolinkMarker");effects.exit("autolink");return ok3}if(code2===null||code2===32||code2===60||asciiControl(code2)){return nok(code2)}effects.consume(code2);return urlInside}function emailAtext(code2){if(code2===64){effects.consume(code2);return emailAtSignOrDot}if(asciiAtext(code2)){effects.consume(code2);return emailAtext}return nok(code2)}function emailAtSignOrDot(code2){return asciiAlphanumeric(code2)?emailLabel(code2):nok(code2)}function emailLabel(code2){if(code2===46){effects.consume(code2);size=0;return emailAtSignOrDot}if(code2===62){effects.exit("autolinkProtocol").type="autolinkEmail";effects.enter("autolinkMarker");effects.consume(code2);effects.exit("autolinkMarker");effects.exit("autolink");return ok3}return emailValue(code2)}function emailValue(code2){if((code2===45||asciiAlphanumeric(code2))&&size++<63){const next=code2===45?emailValue:emailLabel;effects.consume(code2);return next}return nok(code2)}}var blankLine={partial:true,tokenize:tokenizeBlankLine};function tokenizeBlankLine(effects,ok3,nok){return start;function start(code2){return markdownSpace(code2)?factorySpace(effects,after,"linePrefix")(code2):after(code2)}function after(code2){return code2===null||markdownLineEnding(code2)?ok3(code2):nok(code2)}}var blockQuote={continuation:{tokenize:tokenizeBlockQuoteContinuation},exit,name:"blockQuote",tokenize:tokenizeBlockQuoteStart};function tokenizeBlockQuoteStart(effects,ok3,nok){const self=this;return start;function start(code2){if(code2===62){const state=self.containerState;if(!state.open){effects.enter("blockQuote",{_container:true});state.open=true}effects.enter("blockQuotePrefix");effects.enter("blockQuoteMarker");effects.consume(code2);effects.exit("blockQuoteMarker");return after}return nok(code2)}function after(code2){if(markdownSpace(code2)){effects.enter("blockQuotePrefixWhitespace");effects.consume(code2);effects.exit("blockQuotePrefixWhitespace");effects.exit("blockQuotePrefix");return ok3}effects.exit("blockQuotePrefix");return ok3(code2)}}function tokenizeBlockQuoteContinuation(effects,ok3,nok){const self=this;return contStart;function contStart(code2){if(markdownSpace(code2)){return factorySpace(effects,contBefore,"linePrefix",self.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(code2)}return contBefore(code2)}function contBefore(code2){return effects.attempt(blockQuote,ok3,nok)(code2)}}function exit(effects){effects.exit("blockQuote")}var characterEscape={name:"characterEscape",tokenize:tokenizeCharacterEscape};function tokenizeCharacterEscape(effects,ok3,nok){return start;function start(code2){effects.enter("characterEscape");effects.enter("escapeMarker");effects.consume(code2);effects.exit("escapeMarker");return inside}function inside(code2){if(asciiPunctuation(code2)){effects.enter("characterEscapeValue");effects.consume(code2);effects.exit("characterEscapeValue");effects.exit("characterEscape");return ok3}return nok(code2)}}var characterReference={name:"characterReference",tokenize:tokenizeCharacterReference};function tokenizeCharacterReference(effects,ok3,nok){const self=this;let size=0;let max;let test;return start;function start(code2){effects.enter("characterReference");effects.enter("characterReferenceMarker");effects.consume(code2);effects.exit("characterReferenceMarker");return open}function open(code2){if(code2===35){effects.enter("characterReferenceMarkerNumeric");effects.consume(code2);effects.exit("characterReferenceMarkerNumeric");return numeric}effects.enter("characterReferenceValue");max=31;test=asciiAlphanumeric;return value(code2)}function numeric(code2){if(code2===88||code2===120){effects.enter("characterReferenceMarkerHexadecimal");effects.consume(code2);effects.exit("characterReferenceMarkerHexadecimal");effects.enter("characterReferenceValue");max=6;test=asciiHexDigit;return value}effects.enter("characterReferenceValue");max=7;test=asciiDigit;return value(code2)}function value(code2){if(code2===59&&size){const token=effects.exit("characterReferenceValue");if(test===asciiAlphanumeric&&!decodeNamedCharacterReference(self.sliceSerialize(token))){return nok(code2)}effects.enter("characterReferenceMarker");effects.consume(code2);effects.exit("characterReferenceMarker");effects.exit("characterReference");return ok3}if(test(code2)&&size++<max){effects.consume(code2);return value}return nok(code2)}}var nonLazyContinuation={partial:true,tokenize:tokenizeNonLazyContinuation};function tokenizeNonLazyContinuation(effects,ok3,nok){const self=this;return start;function start(code2){if(code2===null){return nok(code2)}effects.enter("lineEnding");effects.consume(code2);effects.exit("lineEnding");return after}function after(code2){return self.parser.lazy[self.now().line]?nok(code2):ok3(code2)}}var codeFenced={concrete:true,name:"codeFenced",tokenize:tokenizeCodeFenced};function tokenizeCodeFenced(effects,ok3,nok){const self=this;const closeStart={partial:true,tokenize:tokenizeCloseStart};let initialPrefix=0;let sizeOpen=0;let marker;return start;function start(code2){return beforeSequenceOpen(code2)}function beforeSequenceOpen(code2){const tail=self.events[self.events.length-1];initialPrefix=tail&&tail[1].type==="linePrefix"?tail[2].sliceSerialize(tail[1],true).length:0;marker=code2;effects.enter("codeFenced");effects.enter("codeFencedFence");effects.enter("codeFencedFenceSequence");return sequenceOpen(code2)}function sequenceOpen(code2){if(code2===marker){sizeOpen++;effects.consume(code2);return sequenceOpen}if(sizeOpen<3){return nok(code2)}effects.exit("codeFencedFenceSequence");return markdownSpace(code2)?factorySpace(effects,infoBefore,"whitespace")(code2):infoBefore(code2)}function infoBefore(code2){if(code2===null||markdownLineEnding(code2)){effects.exit("codeFencedFence");return self.interrupt?ok3(code2):effects.check(nonLazyContinuation,atNonLazyBreak,after)(code2)}effects.enter("codeFencedFenceInfo");effects.enter("chunkString",{contentType:"string"});return info(code2)}function info(code2){if(code2===null||markdownLineEnding(code2)){effects.exit("chunkString");effects.exit("codeFencedFenceInfo");return infoBefore(code2)}if(markdownSpace(code2)){effects.exit("chunkString");effects.exit("codeFencedFenceInfo");return factorySpace(effects,metaBefore,"whitespace")(code2)}if(code2===96&&code2===marker){return nok(code2)}effects.consume(code2);return info}function metaBefore(code2){if(code2===null||markdownLineEnding(code2)){return infoBefore(code2)}effects.enter("codeFencedFenceMeta");effects.enter("chunkString",{contentType:"string"});return meta(code2)}function meta(code2){if(code2===null||markdownLineEnding(code2)){effects.exit("chunkString");effects.exit("codeFencedFenceMeta");return infoBefore(code2)}if(code2===96&&code2===marker){return nok(code2)}effects.consume(code2);return meta}function atNonLazyBreak(code2){return effects.attempt(closeStart,after,contentBefore)(code2)}function contentBefore(code2){effects.enter("lineEnding");effects.consume(code2);effects.exit("lineEnding");return contentStart}function contentStart(code2){return initialPrefix>0&&markdownSpace(code2)?factorySpace(effects,beforeContentChunk,"linePrefix",initialPrefix+1)(code2):beforeContentChunk(code2)}function beforeContentChunk(code2){if(code2===null||markdownLineEnding(code2)){return effects.check(nonLazyContinuation,atNonLazyBreak,after)(code2)}effects.enter("codeFlowValue");return contentChunk(code2)}function contentChunk(code2){if(code2===null||markdownLineEnding(code2)){effects.exit("codeFlowValue");return beforeContentChunk(code2)}effects.consume(code2);return contentChunk}function after(code2){effects.exit("codeFenced");return ok3(code2)}function tokenizeCloseStart(effects2,ok4,nok2){let size=0;return startBefore;function startBefore(code2){effects2.enter("lineEnding");effects2.consume(code2);effects2.exit("lineEnding");return start2}function start2(code2){effects2.enter("codeFencedFence");return markdownSpace(code2)?factorySpace(effects2,beforeSequenceClose,"linePrefix",self.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(code2):beforeSequenceClose(code2)}function beforeSequenceClose(code2){if(code2===marker){effects2.enter("codeFencedFenceSequence");return sequenceClose(code2)}return nok2(code2)}function sequenceClose(code2){if(code2===marker){size++;effects2.consume(code2);return sequenceClose}if(size>=sizeOpen){effects2.exit("codeFencedFenceSequence");return markdownSpace(code2)?factorySpace(effects2,sequenceCloseAfter,"whitespace")(code2):sequenceCloseAfter(code2)}return nok2(code2)}function sequenceCloseAfter(code2){if(code2===null||markdownLineEnding(code2)){effects2.exit("codeFencedFence");return ok4(code2)}return nok2(code2)}}}var codeIndented={name:"codeIndented",tokenize:tokenizeCodeIndented};var furtherStart={partial:true,tokenize:tokenizeFurtherStart};function tokenizeCodeIndented(effects,ok3,nok){return start;function start(code2){effects.enter("codeIndented");return factorySpaceMinMax(effects,atBreak,nok,"linePrefix",4,4)(code2)}function atBreak(code2){if(code2===null){return after(code2)}if(markdownLineEnding(code2)){return effects.attempt(furtherStart,atBreak,after)(code2)}effects.enter("codeFlowValue");return inside(code2)}function inside(code2){if(code2===null||markdownLineEnding(code2)){effects.exit("codeFlowValue");return atBreak(code2)}effects.consume(code2);return inside}function after(code2){effects.exit("codeIndented");return ok3(code2)}}function tokenizeFurtherStart(effects,ok3,nok){const self=this;return furtherStart2;function furtherStart2(code2){if(self.parser.lazy[self.now().line]){return nok(code2)}if(markdownLineEnding(code2)){effects.enter("lineEnding");effects.consume(code2);effects.exit("lineEnding");return furtherStart2}return factorySpaceMinMax(effects,ok3,onNotEnoughPrefix,"linePrefix",4,4)(code2)}function onNotEnoughPrefix(code2){return markdownLineEnding(code2)?furtherStart2(code2):nok(code2)}}var codeText={name:"codeText",previous,resolve:resolveCodeText,tokenize:tokenizeCodeText};function resolveCodeText(events){let tailExitIndex=events.length-4;let headEnterIndex=3;let index2;let enter;if((events[headEnterIndex][1].type==="lineEnding"||events[headEnterIndex][1].type==="space")&&(events[tailExitIndex][1].type==="lineEnding"||events[tailExitIndex][1].type==="space")){index2=headEnterIndex;while(++index2<tailExitIndex){if(events[index2][1].type==="codeTextData"){events[headEnterIndex][1].type="codeTextPadding";events[tailExitIndex][1].type="codeTextPadding";headEnterIndex+=2;tailExitIndex-=2;break}}}index2=headEnterIndex-1;tailExitIndex++;while(++index2<=tailExitIndex){if(enter===void 0){if(index2!==tailExitIndex&&events[index2][1].type!=="lineEnding"){enter=index2}}else if(index2===tailExitIndex||events[index2][1].type==="lineEnding"){events[enter][1].type="codeTextData";if(index2!==enter+2){events[enter][1].end=events[index2-1][1].end;events.splice(enter+2,index2-enter-2);tailExitIndex-=index2-enter-2;index2=enter+2}enter=void 0}}return events}function previous(code2){return code2!==96||this.events[this.events.length-1][1].type==="characterEscape"}function tokenizeCodeText(effects,ok3,nok){const self=this;let sizeOpen=0;let size;let token;return start;function start(code2){effects.enter("codeText");effects.enter("codeTextSequence");return sequenceOpen(code2)}function sequenceOpen(code2){if(code2===96){effects.consume(code2);sizeOpen++;return sequenceOpen}effects.exit("codeTextSequence");return between(code2)}function between(code2){if(code2===null){return nok(code2)}if(code2===32){effects.enter("space");effects.consume(code2);effects.exit("space");return between}if(code2===96){token=effects.enter("codeTextSequence");size=0;return sequenceClose(code2)}if(markdownLineEnding(code2)){effects.enter("lineEnding");effects.consume(code2);effects.exit("lineEnding");return between}effects.enter("codeTextData");return data(code2)}function data(code2){if(code2===null||code2===32||code2===96||markdownLineEnding(code2)){effects.exit("codeTextData");return between(code2)}effects.consume(code2);return data}function sequenceClose(code2){if(code2===96){effects.consume(code2);size++;return sequenceClose}if(size===sizeOpen){effects.exit("codeTextSequence");effects.exit("codeText");return ok3(code2)}token.type="codeTextData";return data(code2)}}var SpliceBuffer=class{constructor(initial){this.left=initial?[...initial]:[];this.right=[]}get(index2){if(index2<0||index2>=this.left.length+this.right.length){throw new RangeError("Cannot access index `"+index2+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`")}if(index2<this.left.length)return this.left[index2];return this.right[this.right.length-index2+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){this.setCursor(0);return this.right.pop()}slice(start,end){const stop=end===null||end===void 0?Number.POSITIVE_INFINITY:end;if(stop<this.left.length){return this.left.slice(start,stop)}if(start>this.left.length){return this.right.slice(this.right.length-stop+this.left.length,this.right.length-start+this.left.length).reverse()}return this.left.slice(start).concat(this.right.slice(this.right.length-stop+this.left.length).reverse())}splice(start,deleteCount,items){const count=deleteCount||0;this.setCursor(Math.trunc(start));const removed=this.right.splice(this.right.length-count,Number.POSITIVE_INFINITY);if(items)chunkedPush(this.left,items);return removed.reverse()}pop(){this.setCursor(Number.POSITIVE_INFINITY);return this.left.pop()}push(item){this.setCursor(Number.POSITIVE_INFINITY);this.left.push(item)}pushMany(items){this.setCursor(Number.POSITIVE_INFINITY);chunkedPush(this.left,items)}unshift(item){this.setCursor(0);this.right.push(item)}unshiftMany(items){this.setCursor(0);chunkedPush(this.right,items.reverse())}setCursor(n){if(n===this.left.length||n>this.left.length&&this.right.length===0||n<0&&this.left.length===0)return;if(n<this.left.length){const removed=this.left.splice(n,Number.POSITIVE_INFINITY);chunkedPush(this.right,removed.reverse())}else{const removed=this.right.splice(this.left.length+this.right.length-n,Number.POSITIVE_INFINITY);chunkedPush(this.left,removed.reverse())}}};function chunkedPush(list2,right){let chunkStart=0;if(right.length<1e4){list2.push(...right)}else{while(chunkStart<right.length){list2.push(...right.slice(chunkStart,chunkStart+1e4));chunkStart+=1e4}}}function subtokenize(eventsArray){const jumps={};let index2=-1;let event;let lineIndex;let otherIndex;let otherEvent;let parameters;let subevents;let more;const events=new SpliceBuffer(eventsArray);while(++index2<events.length){while(index2 in jumps){index2=jumps[index2]}event=events.get(index2);if(index2&&event[1].type==="chunkFlow"&&events.get(index2-1)[1].type==="listItemPrefix"){subevents=event[1]._tokenizer.events;otherIndex=0;if(otherIndex<subevents.length&&subevents[otherIndex][1].type==="lineEndingBlank"){otherIndex+=2}if(otherIndex<subevents.length&&subevents[otherIndex][1].type==="content"){while(++otherIndex<subevents.length){if(subevents[otherIndex][1].type==="content"){break}if(subevents[otherIndex][1].type==="chunkText"){subevents[otherIndex][1]._isInFirstContentOfListItem=true;otherIndex++}}}}if(event[0]==="enter"){if(event[1].contentType){Object.assign(jumps,subcontent(events,index2));index2=jumps[index2];more=true}}else if(event[1]._container){otherIndex=index2;lineIndex=void 0;while(otherIndex--){otherEvent=events.get(otherIndex);if(otherEvent[1].type==="lineEnding"||otherEvent[1].type==="lineEndingBlank"){if(otherEvent[0]==="enter"){if(lineIndex){events.get(lineIndex)[1].type="lineEndingBlank"}otherEvent[1].type="lineEnding";lineIndex=otherIndex}}else if(otherEvent[1].type==="linePrefix"||otherEvent[1].type==="listItemIndent"){}else{break}}if(lineIndex){event[1].end={...events.get(lineIndex)[1].start};parameters=events.slice(lineIndex,index2);parameters.unshift(event);events.splice(lineIndex,index2-lineIndex+1,parameters)}}}splice(eventsArray,0,Number.POSITIVE_INFINITY,events.slice(0));return!more}function subcontent(events,eventIndex){const token=events.get(eventIndex)[1];const context=events.get(eventIndex)[2];let startPosition=eventIndex-1;const startPositions=[];let tokenizer=token._tokenizer;if(!tokenizer){tokenizer=context.parser[token.contentType](token.start);if(token._contentTypeTextTrailing){tokenizer._contentTypeTextTrailing=true}}const childEvents=tokenizer.events;const jumps=[];const gaps={};let stream;let previous3;let index2=-1;let current=token;let adjust=0;let start=0;const breaks=[start];while(current){while(events.get(++startPosition)[1]!==current){}startPositions.push(startPosition);if(!current._tokenizer){stream=context.sliceStream(current);if(!current.next){stream.push(null)}if(previous3){tokenizer.defineSkip(current.start)}if(current._isInFirstContentOfListItem){tokenizer._gfmTasklistFirstContentOfListItem=true}tokenizer.write(stream);if(current._isInFirstContentOfListItem){tokenizer._gfmTasklistFirstContentOfListItem=void 0}}previous3=current;current=current.next}current=token;while(++index2<childEvents.length){if(childEvents[index2][0]==="exit"&&childEvents[index2-1][0]==="enter"&&childEvents[index2][1].type===childEvents[index2-1][1].type&&childEvents[index2][1].start.line!==childEvents[index2][1].end.line){start=index2+1;breaks.push(start);current._tokenizer=void 0;current.previous=void 0;current=current.next}}tokenizer.events=[];if(current){current._tokenizer=void 0;current.previous=void 0}else{breaks.pop()}index2=breaks.length;while(index2--){const slice=childEvents.slice(breaks[index2],breaks[index2+1]);const start2=startPositions.pop();jumps.push([start2,start2+slice.length-1]);events.splice(start2,2,slice)}jumps.reverse();index2=-1;while(++index2<jumps.length){gaps[adjust+jumps[index2][0]]=adjust+jumps[index2][1];adjust+=jumps[index2][1]-jumps[index2][0]-1}return gaps}var content2={resolve:resolveContent,tokenize:tokenizeContent};var continuationConstruct={partial:true,tokenize:tokenizeContinuation};function resolveContent(events){subtokenize(events);return events}function tokenizeContent(effects,ok3){let previous3;return chunkStart;function chunkStart(code2){effects.enter("content");previous3=effects.enter("chunkContent",{contentType:"content"});return chunkInside(code2)}function chunkInside(code2){if(code2===null){return contentEnd(code2)}if(markdownLineEnding(code2)){return effects.check(continuationConstruct,contentContinue,contentEnd)(code2)}effects.consume(code2);return chunkInside}function contentEnd(code2){effects.exit("chunkContent");effects.exit("content");return ok3(code2)}function contentContinue(code2){effects.consume(code2);effects.exit("chunkContent");previous3.next=effects.enter("chunkContent",{contentType:"content",previous:previous3});previous3=previous3.next;return chunkInside}}function tokenizeContinuation(effects,ok3,nok){const self=this;return startLookahead;function startLookahead(code2){effects.exit("chunkContent");effects.enter("lineEnding");effects.consume(code2);effects.exit("lineEnding");return factorySpace(effects,prefixed,"linePrefix")}function prefixed(code2){if(code2===null||markdownLineEnding(code2)){return nok(code2)}const tail=self.events[self.events.length-1];if(!self.parser.constructs.disable.null.includes("codeIndented")&&tail&&tail[1].type==="linePrefix"&&tail[2].sliceSerialize(tail[1],true).length>=4){return ok3(code2)}return effects.interrupt(self.parser.constructs.flow,nok,ok3)(code2)}}function factoryDestination(effects,ok3,nok,type,literalType,literalMarkerType,rawType,stringType,max){const limit=max||Number.POSITIVE_INFINITY;let balance=0;return start;function start(code2){if(code2===60){effects.enter(type);effects.enter(literalType);effects.enter(literalMarkerType);effects.consume(code2);effects.exit(literalMarkerType);return enclosedBefore}if(code2===null||code2===32||code2===41||asciiControl(code2)){return nok(code2)}effects.enter(type);effects.enter(rawType);effects.enter(stringType);effects.enter("chunkString",{contentType:"string"});return raw(code2)}function enclosedBefore(code2){if(code2===62){effects.enter(literalMarkerType);effects.consume(code2);effects.exit(literalMarkerType);effects.exit(literalType);effects.exit(type);return ok3}effects.enter(stringType);effects.enter("chunkString",{contentType:"string"});return enclosed(code2)}function enclosed(code2){if(code2===62){effects.exit("chunkString");effects.exit(stringType);return enclosedBefore(code2)}if(code2===null||code2===60||markdownLineEnding(code2)){return nok(code2)}effects.consume(code2);return code2===92?enclosedEscape:enclosed}function enclosedEscape(code2){if(code2===60||code2===62||code2===92){effects.consume(code2);return enclosed}return enclosed(code2)}function raw(code2){if(!balance&&(code2===null||code2===41||markdownLineEndingOrSpace(code2))){effects.exit("chunkString");effects.exit(stringType);effects.exit(rawType);effects.exit(type);return ok3(code2)}if(balance<limit&&code2===40){effects.consume(code2);balance++;return raw}if(code2===41){effects.consume(code2);balance--;return raw}if(code2===null||code2===32||code2===40||asciiControl(code2)){return nok(code2)}effects.consume(code2);return code2===92?rawEscape:raw}function rawEscape(code2){if(code2===40||code2===41||code2===92){effects.consume(code2);return raw}return raw(code2)}}function factoryLabel(effects,ok3,nok,type,markerType,stringType){const self=this;let size=0;let seen;return start;function start(code2){effects.enter(type);effects.enter(markerType);effects.consume(code2);effects.exit(markerType);effects.enter(stringType);return atBreak}function atBreak(code2){if(size>999||code2===null||code2===91||code2===93&&!seen||code2===94&&!size&&"_hiddenFootnoteSupport"in self.parser.constructs){return nok(code2)}if(code2===93){effects.exit(stringType);effects.enter(markerType);effects.consume(code2);effects.exit(markerType);effects.exit(type);return ok3}if(markdownLineEnding(code2)){effects.enter("lineEnding");effects.consume(code2);effects.exit("lineEnding");return atBreak}effects.enter("chunkString",{contentType:"string"});return labelInside(code2)}function labelInside(code2){if(code2===null||code2===91||code2===93||markdownLineEnding(code2)||size++>999){effects.exit("chunkString");return atBreak(code2)}effects.consume(code2);if(!seen)seen=!markdownSpace(code2);return code2===92?labelEscape:labelInside}function labelEscape(code2){if(code2===91||code2===92||code2===93){effects.consume(code2);size++;return labelInside}return labelInside(code2)}}function factoryTitle(effects,ok3,nok,type,markerType,stringType){let marker;return start;function start(code2){if(code2===34||code2===39||code2===40){effects.enter(type);effects.enter(markerType);effects.consume(code2);effects.exit(markerType);marker=code2===40?41:code2;return begin}return nok(code2)}function begin(code2){if(code2===marker){effects.enter(markerType);effects.consume(code2);effects.exit(markerType);effects.exit(type);return ok3}effects.enter(stringType);return atBreak(code2)}function atBreak(code2){if(code2===marker){effects.exit(stringType);return begin(marker)}if(code2===null){return nok(code2)}if(markdownLineEnding(code2)){effects.enter("lineEnding");effects.consume(code2);effects.exit("lineEnding");return factorySpace(effects,atBreak,"linePrefix")}effects.enter("chunkString",{contentType:"string"});return inside(code2)}function inside(code2){if(code2===marker||code2===null||markdownLineEnding(code2)){effects.exit("chunkString");return atBreak(code2)}effects.consume(code2);return code2===92?escape:inside}function escape(code2){if(code2===marker||code2===92){effects.consume(code2);return inside}return inside(code2)}}function factoryWhitespace(effects,ok3){let seen;return start;function start(code2){if(markdownLineEnding(code2)){effects.enter("lineEnding");effects.consume(code2);effects.exit("lineEnding");seen=true;return start}if(markdownSpace(code2)){return factorySpace(effects,start,seen?"linePrefix":"lineSuffix")(code2)}return ok3(code2)}}var definition={name:"definition",tokenize:tokenizeDefinition};var titleBefore={partial:true,tokenize:tokenizeTitleBefore};function tokenizeDefinition(effects,ok3,nok){const self=this;let identifier;return start;function start(code2){effects.enter("definition");return before(code2)}function before(code2){return factoryLabel.call(self,effects,labelAfter,nok,"definitionLabel","definitionLabelMarker","definitionLabelString")(code2)}function labelAfter(code2){identifier=normalizeIdentifier(self.sliceSerialize(self.events[self.events.length-1][1]).slice(1,-1));if(code2===58){effects.enter("definitionMarker");effects.consume(code2);effects.exit("definitionMarker");return markerAfter}return nok(code2)}function markerAfter(code2){return markdownLineEndingOrSpace(code2)?factoryWhitespace(effects,destinationBefore)(code2):destinationBefore(code2)}function destinationBefore(code2){return factoryDestination(effects,destinationAfter,nok,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(code2)}function destinationAfter(code2){return effects.attempt(titleBefore,after,after)(code2)}function after(code2){return markdownSpace(code2)?factorySpace(effects,afterWhitespace,"whitespace")(code2):afterWhitespace(code2)}function afterWhitespace(code2){if(code2===null||markdownLineEnding(code2)){effects.exit("definition");self.parser.defined.push(identifier);return ok3(code2)}return nok(code2)}}function tokenizeTitleBefore(effects,ok3,nok){return titleBefore2;function titleBefore2(code2){return markdownLineEndingOrSpace(code2)?factoryWhitespace(effects,beforeMarker)(code2):nok(code2)}function beforeMarker(code2){return factoryTitle(effects,titleAfter,nok,"definitionTitle","definitionTitleMarker","definitionTitleString")(code2)}function titleAfter(code2){return markdownSpace(code2)?factorySpace(effects,titleAfterOptionalWhitespace,"whitespace")(code2):titleAfterOptionalWhitespace(code2)}function titleAfterOptionalWhitespace(code2){return code2===null||markdownLineEnding(code2)?ok3(code2):nok(code2)}}var hardBreakEscape={name:"hardBreakEscape",tokenize:tokenizeHardBreakEscape};function tokenizeHardBreakEscape(effects,ok3,nok){return start;function start(code2){effects.enter("hardBreakEscape");effects.consume(code2);return after}function after(code2){if(markdownLineEnding(code2)){effects.exit("hardBreakEscape");return ok3(code2)}return nok(code2)}}var headingAtx={name:"headingAtx",resolve:resolveHeadingAtx,tokenize:tokenizeHeadingAtx};function resolveHeadingAtx(events,context){let contentEnd=events.length-2;let contentStart=3;if(events[contentStart][1].type==="whitespace"){contentStart+=2}if(contentEnd-2>contentStart&&events[contentEnd][1].type==="whitespace"){contentEnd-=2}if(events[contentEnd][1].type==="atxHeadingSequence"&&(contentStart===contentEnd-1||contentEnd-4>contentStart&&events[contentEnd-2][1].type==="whitespace")){contentEnd-=contentStart+1===contentEnd?2:4}if(contentEnd>contentStart){const content3={type:"atxHeadingText",start:events[contentStart][1].start,end:events[contentEnd][1].end};const text4={type:"chunkText",start:events[contentStart][1].start,end:events[contentEnd][1].end,contentType:"text"};splice(events,contentStart,contentEnd-contentStart+1,[["enter",content3,context],["enter",text4,context],["exit",text4,context],["exit",content3,context]])}return events}function tokenizeHeadingAtx(effects,ok3,nok){let size=0;return start;function start(code2){effects.enter("atxHeading");return before(code2)}function before(code2){effects.enter("atxHeadingSequence");return sequenceOpen(code2)}function sequenceOpen(code2){if(code2===35&&size++<6){effects.consume(code2);return sequenceOpen}if(code2===null||markdownLineEndingOrSpace(code2)){effects.exit("atxHeadingSequence");return atBreak(code2)}return nok(code2)}function atBreak(code2){if(code2===35){effects.enter("atxHeadingSequence");return sequenceFurther(code2)}if(code2===null||markdownLineEnding(code2)){effects.exit("atxHeading");return ok3(code2)}if(markdownSpace(code2)){return factorySpace(effects,atBreak,"whitespace")(code2)}effects.enter("atxHeadingText");return data(code2)}function sequenceFurther(code2){if(code2===35){effects.consume(code2);return sequenceFurther}effects.exit("atxHeadingSequence");return atBreak(code2)}function data(code2){if(code2===null||code2===35||markdownLineEndingOrSpace(code2)){effects.exit("atxHeadingText");return atBreak(code2)}effects.consume(code2);return data}}var htmlBlockNames=["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"];var htmlRawNames=["pre","script","style","textarea"];var htmlFlow={concrete:true,name:"htmlFlow",resolveTo:resolveToHtmlFlow,tokenize:tokenizeHtmlFlow};var blankLineBefore={partial:true,tokenize:tokenizeBlankLineBefore};function resolveToHtmlFlow(events){let index2=events.length;while(index2--){if(events[index2][0]==="enter"&&events[index2][1].type==="htmlFlow"){break}}if(index2>1&&events[index2-2][1].type==="linePrefix"){events[index2][1].start=events[index2-2][1].start;events[index2+1][1].start=events[index2-2][1].start;events.splice(index2-2,2)}return events}function tokenizeHtmlFlow(effects,ok3,nok){const self=this;let marker;let closingTag;let buffer;let index2;let markerB;return start;function start(code2){return before(code2)}function before(code2){effects.enter("htmlFlow");effects.enter("htmlFlowData");effects.consume(code2);return open}function open(code2){if(code2===33){effects.consume(code2);return declarationOpen}if(code2===47){effects.consume(code2);closingTag=true;return tagCloseStart}if(code2===63){effects.consume(code2);marker=3;return self.interrupt?ok3:continuationDeclarationInside}if(asciiAlpha(code2)){effects.consume(code2);buffer=String.fromCharCode(code2);return tagName}return nok(code2)}function declarationOpen(code2){if(code2===45){effects.consume(code2);marker=2;return commentOpenInside}if(code2===91){effects.consume(code2);marker=5;index2=0;return cdataOpenInside}if(asciiAlpha(code2)){effects.consume(code2);marker=4;return self.interrupt?ok3:continuationDeclarationInside}return nok(code2)}function commentOpenInside(code2){if(code2===45){effects.consume(code2);return self.interrupt?ok3:continuationDeclarationInside}return nok(code2)}function cdataOpenInside(code2){const value="CDATA[";if(code2===value.charCodeAt(index2++)){effects.consume(code2);if(index2===value.length){return self.interrupt?ok3:continuation}return cdataOpenInside}return nok(code2)}function tagCloseStart(code2){if(asciiAlpha(code2)){effects.consume(code2);buffer=String.fromCharCode(code2);return tagName}return nok(code2)}function tagName(code2){if(code2===null||code2===47||code2===62||markdownLineEndingOrSpace(code2)){const slash=code2===47;const name=buffer.toLowerCase();if(!slash&&!closingTag&&htmlRawNames.includes(name)){marker=1;return self.interrupt?ok3(code2):continuation(code2)}if(htmlBlockNames.includes(buffer.toLowerCase())){marker=6;if(slash){effects.consume(code2);return basicSelfClosing}return self.interrupt?ok3(code2):continuation(code2)}marker=7;return self.interrupt&&!self.parser.lazy[self.now().line]?nok(code2):closingTag?completeClosingTagAfter(code2):completeAttributeNameBefore(code2)}if(code2===45||asciiAlphanumeric(code2)){effects.consume(code2);buffer+=String.fromCharCode(code2);return tagName}return nok(code2)}function basicSelfClosing(code2){if(code2===62){effects.consume(code2);return self.interrupt?ok3:continuation}return nok(code2)}function completeClosingTagAfter(code2){if(markdownSpace(code2)){effects.consume(code2);return completeClosingTagAfter}return completeEnd(code2)}function completeAttributeNameBefore(code2){if(code2===47){effects.consume(code2);return completeEnd}if(code2===58||code2===95||asciiAlpha(code2)){effects.consume(code2);return completeAttributeName}if(markdownSpace(code2)){effects.consume(code2);return completeAttributeNameBefore}return completeEnd(code2)}function completeAttributeName(code2){if(code2===45||code2===46||code2===58||code2===95||asciiAlphanumeric(code2)){effects.consume(code2);return completeAttributeName}return completeAttributeNameAfter(code2)}function completeAttributeNameAfter(code2){if(code2===61){effects.consume(code2);return completeAttributeValueBefore}if(markdownSpace(code2)){effects.consume(code2);return completeAttributeNameAfter}return completeAttributeNameBefore(code2)}function completeAttributeValueBefore(code2){if(code2===null||code2===60||code2===61||code2===62||code2===96){return nok(code2)}if(code2===34||code2===39){effects.consume(code2);markerB=code2;return completeAttributeValueQuoted}if(markdownSpace(code2)){effects.consume(code2);return completeAttributeValueBefore}return completeAttributeValueUnquoted(code2)}function completeAttributeValueQuoted(code2){if(code2===markerB){effects.consume(code2);markerB=null;return completeAttributeValueQuotedAfter}if(code2===null||markdownLineEnding(code2)){return nok(code2)}effects.consume(code2);return completeAttributeValueQuoted}function completeAttributeValueUnquoted(code2){if(code2===null||code2===34||code2===39||code2===47||code2===60||code2===61||code2===62||code2===96||markdownLineEndingOrSpace(code2)){return completeAttributeNameAfter(code2)}effects.consume(code2);return completeAttributeValueUnquoted}function completeAttributeValueQuotedAfter(code2){if(code2===47||code2===62||markdownSpace(code2)){return completeAttributeNameBefore(code2)}return nok(code2)}function completeEnd(code2){if(code2===62){effects.consume(code2);return completeAfter}return nok(code2)}function completeAfter(code2){if(code2===null||markdownLineEnding(code2)){return continuation(code2)}if(markdownSpace(code2)){effects.consume(code2);return completeAfter}return nok(code2)}function continuation(code2){if(code2===45&&marker===2){effects.consume(code2);return continuationCommentInside}if(code2===60&&marker===1){effects.consume(code2);return continuationRawTagOpen}if(code2===62&&marker===4){effects.consume(code2);return continuationClose}if(code2===63&&marker===3){effects.consume(code2);return continuationDeclarationInside}if(code2===93&&marker===5){effects.consume(code2);return continuationCdataInside}if(markdownLineEnding(code2)&&(marker===6||marker===7)){effects.exit("htmlFlowData");return effects.check(blankLineBefore,continuationAfter,continuationStart)(code2)}if(code2===null||markdownLineEnding(code2)){effects.exit("htmlFlowData");return continuationStart(code2)}effects.consume(code2);return continuation}function continuationStart(code2){return effects.check(nonLazyContinuation,continuationStartNonLazy,continuationAfter)(code2)}function continuationStartNonLazy(code2){effects.enter("lineEnding");effects.consume(code2);effects.exit("lineEnding");return continuationBefore}function continuationBefore(code2){if(code2===null||markdownLineEnding(code2)){return continuationStart(code2)}effects.enter("htmlFlowData");return continuation(code2)}function continuationCommentInside(code2){if(code2===45){effects.consume(code2);return continuationDeclarationInside}return continuation(code2)}function continuationRawTagOpen(code2){if(code2===47){effects.consume(code2);buffer="";return continuationRawEndTag}return continuation(code2)}function continuationRawEndTag(code2){if(code2===62){const name=buffer.toLowerCase();if(htmlRawNames.includes(name)){effects.consume(code2);return continuationClose}return continuation(code2)}if(asciiAlpha(code2)&&buffer.length<8){effects.consume(code2);buffer+=String.fromCharCode(code2);return continuationRawEndTag}return continuation(code2)}function continuationCdataInside(code2){if(code2===93){effects.consume(code2);return continuationDeclarationInside}return continuation(code2)}function continuationDeclarationInside(code2){if(code2===62){effects.consume(code2);return continuationClose}if(code2===45&&marker===2){effects.consume(code2);return continuationDeclarationInside}return continuation(code2)}function continuationClose(code2){if(code2===null||markdownLineEnding(code2)){effects.exit("htmlFlowData");return continuationAfter(code2)}effects.consume(code2);return continuationClose}function continuationAfter(code2){effects.exit("htmlFlow");return ok3(code2)}}function tokenizeBlankLineBefore(effects,ok3,nok){return start;function start(code2){effects.enter("lineEnding");effects.consume(code2);effects.exit("lineEnding");return effects.attempt(blankLine,ok3,nok)}}var htmlText={name:"htmlText",tokenize:tokenizeHtmlText};function tokenizeHtmlText(effects,ok3,nok){const self=this;let marker;let index2;let returnState;return start;function start(code2){effects.enter("htmlText");effects.enter("htmlTextData");effects.consume(code2);return open}function open(code2){if(code2===33){effects.consume(code2);return declarationOpen}if(code2===47){effects.consume(code2);return tagCloseStart}if(code2===63){effects.consume(code2);return instruction}if(asciiAlpha(code2)){effects.consume(code2);return tagOpen}return nok(code2)}function declarationOpen(code2){if(code2===45){effects.consume(code2);return commentOpenInside}if(code2===91){effects.consume(code2);index2=0;return cdataOpenInside}if(asciiAlpha(code2)){effects.consume(code2);return declaration}return nok(code2)}function commentOpenInside(code2){if(code2===45){effects.consume(code2);return commentEnd}return nok(code2)}function comment(code2){if(code2===null){return nok(code2)}if(code2===45){effects.consume(code2);return commentClose}if(markdownLineEnding(code2)){returnState=comment;return lineEndingBefore(code2)}effects.consume(code2);return comment}function commentClose(code2){if(code2===45){effects.consume(code2);return commentEnd}return comment(code2)}function commentEnd(code2){return code2===62?end(code2):code2===45?commentClose(code2):comment(code2)}function cdataOpenInside(code2){const value="CDATA[";if(code2===value.charCodeAt(index2++)){effects.consume(code2);return index2===value.length?cdata:cdataOpenInside}return nok(code2)}function cdata(code2){if(code2===null){return nok(code2)}if(code2===93){effects.consume(code2);return cdataClose}if(markdownLineEnding(code2)){returnState=cdata;return lineEndingBefore(code2)}effects.consume(code2);return cdata}function cdataClose(code2){if(code2===93){effects.consume(code2);return cdataEnd}return cdata(code2)}function cdataEnd(code2){if(code2===62){return end(code2)}if(code2===93){effects.consume(code2);return cdataEnd}return cdata(code2)}function declaration(code2){if(code2===null||code2===62){return end(code2)}if(markdownLineEnding(code2)){returnState=declaration;return lineEndingBefore(code2)}effects.consume(code2);return declaration}function instruction(code2){if(code2===null){return nok(code2)}if(code2===63){effects.consume(code2);return instructionClose}if(markdownLineEnding(code2)){returnState=instruction;return lineEndingBefore(code2)}effects.consume(code2);return instruction}function instructionClose(code2){return code2===62?end(code2):instruction(code2)}function tagCloseStart(code2){if(asciiAlpha(code2)){effects.consume(code2);return tagClose}return nok(code2)}function tagClose(code2){if(code2===45||asciiAlphanumeric(code2)){effects.consume(code2);return tagClose}return tagCloseBetween(code2)}function tagCloseBetween(code2){if(markdownLineEnding(code2)){returnState=tagCloseBetween;return lineEndingBefore(code2)}if(markdownSpace(code2)){effects.consume(code2);return tagCloseBetween}return end(code2)}function tagOpen(code2){if(code2===45||asciiAlphanumeric(code2)){effects.consume(code2);return tagOpen}if(code2===47||code2===62||markdownLineEndingOrSpace(code2)){return tagOpenBetween(code2)}return nok(code2)}function tagOpenBetween(code2){if(code2===47){effects.consume(code2);return end}if(code2===58||code2===95||asciiAlpha(code2)){effects.consume(code2);return tagOpenAttributeName}if(markdownLineEnding(code2)){returnState=tagOpenBetween;return lineEndingBefore(code2)}if(markdownSpace(code2)){effects.consume(code2);return tagOpenBetween}return end(code2)}function tagOpenAttributeName(code2){if(code2===45||code2===46||code2===58||code2===95||asciiAlphanumeric(code2)){effects.consume(code2);return tagOpenAttributeName}return tagOpenAttributeNameAfter(code2)}function tagOpenAttributeNameAfter(code2){if(code2===61){effects.consume(code2);return tagOpenAttributeValueBefore}if(markdownLineEnding(code2)){returnState=tagOpenAttributeNameAfter;return lineEndingBefore(code2)}if(markdownSpace(code2)){effects.consume(code2);return tagOpenAttributeNameAfter}return tagOpenBetween(code2)}function tagOpenAttributeValueBefore(code2){if(code2===null||code2===60||code2===61||code2===62||code2===96){return nok(code2)}if(code2===34||code2===39){effects.consume(code2);marker=code2;return tagOpenAttributeValueQuoted}if(markdownLineEnding(code2)){returnState=tagOpenAttributeValueBefore;return lineEndingBefore(code2)}if(markdownSpace(code2)){effects.consume(code2);return tagOpenAttributeValueBefore}effects.consume(code2);return tagOpenAttributeValueUnquoted}function tagOpenAttributeValueQuoted(code2){if(code2===marker){effects.consume(code2);marker=void 0;return tagOpenAttributeValueQuotedAfter}if(code2===null){return nok(code2)}if(markdownLineEnding(code2)){returnState=tagOpenAttributeValueQuoted;return lineEndingBefore(code2)}effects.consume(code2);return tagOpenAttributeValueQuoted}function tagOpenAttributeValueUnquoted(code2){if(code2===null||code2===34||code2===39||code2===60||code2===61||code2===96){return nok(code2)}if(code2===47||code2===62||markdownLineEndingOrSpace(code2)){return tagOpenBetween(code2)}effects.consume(code2);return tagOpenAttributeValueUnquoted}function tagOpenAttributeValueQuotedAfter(code2){if(code2===47||code2===62||markdownLineEndingOrSpace(code2)){return tagOpenBetween(code2)}return nok(code2)}function end(code2){if(code2===62){effects.consume(code2);effects.exit("htmlTextData");effects.exit("htmlText");return ok3}return nok(code2)}function lineEndingBefore(code2){effects.exit("htmlTextData");effects.enter("lineEnding");effects.consume(code2);effects.exit("lineEnding");return lineEndingAfter}function lineEndingAfter(code2){return markdownSpace(code2)?factorySpace(effects,lineEndingAfterPrefix,"linePrefix",self.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(code2):lineEndingAfterPrefix(code2)}function lineEndingAfterPrefix(code2){effects.enter("htmlTextData");return returnState(code2)}}var labelEnd={name:"labelEnd",resolveAll:resolveAllLabelEnd,resolveTo:resolveToLabelEnd,tokenize:tokenizeLabelEnd};var resourceConstruct={tokenize:tokenizeResource};var referenceFullConstruct={tokenize:tokenizeReferenceFull};var referenceCollapsedConstruct={tokenize:tokenizeReferenceCollapsed};function resolveAllLabelEnd(events){let index2=-1;const newEvents=[];while(++index2<events.length){const token=events[index2][1];newEvents.push(events[index2]);if(token.type==="labelImage"||token.type==="labelLink"||token.type==="labelEnd"){const offset=token.type==="labelImage"?4:2;token.type="data";index2+=offset}}if(events.length!==newEvents.length){splice(events,0,events.length,newEvents)}return events}function resolveToLabelEnd(events,context){let index2=events.length;let offset=0;let open;let close;let media;while(index2--){const token=events[index2][1];if(open){if(token.type==="link"||token.type==="labelLink"&&token._inactive){break}if(events[index2][0]==="enter"&&token.type==="labelLink"){token._inactive=true}}else if(close){if(events[index2][0]==="enter"&&(token.type==="labelImage"||token.type==="labelLink")&&!token._balanced){open=index2;if(token.type!=="labelLink"){offset=2;break}}}else if(token.type==="labelEnd"){close=index2}}const group={type:events[open][1].type==="labelLink"?"link":"image",start:{...events[open][1].start},end:{...events[events.length-1][1].end}};const label={type:"label",start:{...events[open][1].start},end:{...events[close][1].end}};const text4={type:"labelText",start:{...events[open+offset+2][1].end},end:{...events[close-2][1].start}};media=[["enter",group,context],["enter",label,context]];media=push(media,events.slice(open+1,open+offset+3));media=push(media,[["enter",text4,context]]);media=push(media,resolveAll(context.parser.constructs.insideSpan.null,events.slice(open+offset+4,close-3),context));media=push(media,[["exit",text4,context],events[close-2],events[close-1],["exit",label,context]]);media=push(media,events.slice(close+1));media=push(media,[["exit",group,context]]);splice(events,open,events.length,media);return events}function tokenizeLabelEnd(effects,ok3,nok){const self=this;const labelStarts=self._labelStarts;let labelStart;let defined;if(labelStarts){while(labelStarts.length>0&&labelStarts[labelStarts.length-1]._balanced){labelStarts.pop()}labelStart=labelStarts[labelStarts.length-1]}return start;function start(code2){if(!labelStart){return nok(code2)}if(labelStart._inactive){return labelEndNok(code2)}defined=self.parser.defined.includes(normalizeIdentifier(self.sliceSerialize({start:labelStart.end,end:self.now()})));effects.enter("labelEnd");effects.enter("labelMarker");effects.consume(code2);effects.exit("labelMarker");effects.exit("labelEnd");return after}function after(code2){if(code2===40){return effects.attempt(resourceConstruct,labelEndOk,defined?labelEndOk:labelEndNok)(code2)}if(code2===91){return effects.attempt(referenceFullConstruct,labelEndOk,defined?referenceNotFull:labelEndNok)(code2)}return defined?labelEndOk(code2):labelEndNok(code2)}function referenceNotFull(code2){return effects.attempt(referenceCollapsedConstruct,labelEndOk,labelEndNok)(code2)}function labelEndOk(code2){labelStarts.pop();return ok3(code2)}function labelEndNok(code2){labelStart._balanced=true;return nok(code2)}}function tokenizeResource(effects,ok3,nok){return resourceStart;function resourceStart(code2){effects.enter("resource");effects.enter("resourceMarker");effects.consume(code2);effects.exit("resourceMarker");return resourceBefore}function resourceBefore(code2){return markdownLineEndingOrSpace(code2)?factoryWhitespace(effects,resourceOpen)(code2):resourceOpen(code2)}function resourceOpen(code2){if(code2===41){return resourceEnd(code2)}return factoryDestination(effects,resourceDestinationAfter,resourceDestinationMissing,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(code2)}function resourceDestinationAfter(code2){return markdownLineEndingOrSpace(code2)?factoryWhitespace(effects,resourceBetween)(code2):resourceEnd(code2)}function resourceDestinationMissing(code2){return nok(code2)}function resourceBetween(code2){if(code2===34||code2===39||code2===40){return factoryTitle(effects,resourceTitleAfter,nok,"resourceTitle","resourceTitleMarker","resourceTitleString")(code2)}return resourceEnd(code2)}function resourceTitleAfter(code2){return markdownLineEndingOrSpace(code2)?factoryWhitespace(effects,resourceEnd)(code2):resourceEnd(code2)}function resourceEnd(code2){if(code2===41){effects.enter("resourceMarker");effects.consume(code2);effects.exit("resourceMarker");effects.exit("resource");return ok3}return nok(code2)}}function tokenizeReferenceFull(effects,ok3,nok){const self=this;return referenceFull;function referenceFull(code2){return factoryLabel.call(self,effects,referenceFullAfter,referenceFullMissing,"reference","referenceMarker","referenceString")(code2)}function referenceFullAfter(code2){return self.parser.defined.includes(normalizeIdentifier(self.sliceSerialize(self.events[self.events.length-1][1]).slice(1,-1)))?ok3(code2):nok(code2)}function referenceFullMissing(code2){return nok(code2)}}function tokenizeReferenceCollapsed(effects,ok3,nok){return referenceCollapsedStart;function referenceCollapsedStart(code2){effects.enter("reference");effects.enter("referenceMarker");effects.consume(code2);effects.exit("referenceMarker");return referenceCollapsedOpen}function referenceCollapsedOpen(code2){if(code2===93){effects.enter("referenceMarker");effects.consume(code2);effects.exit("referenceMarker");effects.exit("reference");return ok3}return nok(code2)}}var labelStartImage={name:"labelStartImage",resolveAll:labelEnd.resolveAll,tokenize:tokenizeLabelStartImage};function tokenizeLabelStartImage(effects,ok3,nok){const self=this;let labelImage;return start;function start(code2){effects.enter("labelImage");effects.enter("labelImageMarker");effects.consume(code2);effects.exit("labelImageMarker");return open}function open(code2){if(code2===91){effects.enter("labelMarker");effects.consume(code2);effects.exit("labelMarker");labelImage=effects.exit("labelImage");return after}return nok(code2)}function after(code2){if(code2===94&&"_hiddenFootnoteSupport"in self.parser.constructs){return nok(code2)}self._labelStarts=self._labelStarts||[];self._labelStarts.push(labelImage);return ok3(code2)}}var labelStartLink={name:"labelStartLink",resolveAll:labelEnd.resolveAll,tokenize:tokenizeLabelStartLink};function tokenizeLabelStartLink(effects,ok3,nok){const self=this;let labelLink;return start;function start(code2){effects.enter("labelLink");effects.enter("labelMarker");effects.consume(code2);effects.exit("labelMarker");labelLink=effects.exit("labelLink");return after}function after(code2){if(code2===94&&"_hiddenFootnoteSupport"in self.parser.constructs){return nok(code2)}self._labelStarts=self._labelStarts||[];self._labelStarts.push(labelLink);return ok3(code2)}}var lineEnding={name:"lineEnding",tokenize:tokenizeLineEnding};function tokenizeLineEnding(effects,ok3){return start;function start(code2){effects.enter("lineEnding");effects.consume(code2);effects.exit("lineEnding");return factorySpace(effects,ok3,"linePrefix")}}var thematicBreak={name:"thematicBreak",tokenize:tokenizeThematicBreak};function tokenizeThematicBreak(effects,ok3,nok){let size=0;let marker;return start;function start(code2){effects.enter("thematicBreak");return before(code2)}function before(code2){marker=code2;return atBreak(code2)}function atBreak(code2){if(code2===marker){effects.enter("thematicBreakSequence");return sequence(code2)}if(size>=3&&(code2===null||markdownLineEnding(code2))){effects.exit("thematicBreak");return ok3(code2)}return nok(code2)}function sequence(code2){if(code2===marker){effects.consume(code2);size++;return sequence}effects.exit("thematicBreakSequence");return markdownSpace(code2)?factorySpace(effects,atBreak,"whitespace")(code2):atBreak(code2)}}var list={continuation:{tokenize:tokenizeListContinuation},exit:tokenizeListEnd,name:"list",tokenize:tokenizeListStart};var listItemPrefixWhitespaceConstruct={partial:true,tokenize:tokenizeListItemPrefixWhitespace};var indentConstruct={partial:true,tokenize:tokenizeIndent};function tokenizeListStart(effects,ok3,nok){const self=this;const tail=self.events[self.events.length-1];let initialSize=tail&&tail[1].type==="linePrefix"?tail[2].sliceSerialize(tail[1],true).length:0;let size=0;return start;function start(code2){const kind=self.containerState.type||(code2===42||code2===43||code2===45?"listUnordered":"listOrdered");if(kind==="listUnordered"?!self.containerState.marker||code2===self.containerState.marker:asciiDigit(code2)){if(!self.containerState.type){self.containerState.type=kind;effects.enter(kind,{_container:true})}if(kind==="listUnordered"){effects.enter("listItemPrefix");return code2===42||code2===45?effects.check(thematicBreak,nok,atMarker)(code2):atMarker(code2)}if(!self.interrupt||code2===49){effects.enter("listItemPrefix");effects.enter("listItemValue");return inside(code2)}}return nok(code2)}function inside(code2){if(asciiDigit(code2)&&++size<10){effects.consume(code2);return inside}if((!self.interrupt||size<2)&&(self.containerState.marker?code2===self.containerState.marker:code2===41||code2===46)){effects.exit("listItemValue");return atMarker(code2)}return nok(code2)}function atMarker(code2){effects.enter("listItemMarker");effects.consume(code2);effects.exit("listItemMarker");self.containerState.marker=self.containerState.marker||code2;return effects.check(blankLine,self.interrupt?nok:onBlank,effects.attempt(listItemPrefixWhitespaceConstruct,endOfPrefix,otherPrefix))}function onBlank(code2){self.containerState.initialBlankLine=true;initialSize++;return endOfPrefix(code2)}function otherPrefix(code2){if(markdownSpace(code2)){effects.enter("listItemPrefixWhitespace");effects.consume(code2);effects.exit("listItemPrefixWhitespace");return endOfPrefix}return nok(code2)}function endOfPrefix(code2){self.containerState.size=initialSize+self.sliceSerialize(effects.exit("listItemPrefix"),true).length;return ok3(code2)}}function tokenizeListContinuation(effects,ok3,nok){const self=this;self.containerState._closeFlow=void 0;return effects.check(blankLine,onBlank,notBlank);function onBlank(code2){self.containerState.furtherBlankLines=self.containerState.furtherBlankLines||self.containerState.initialBlankLine;return factorySpace(effects,ok3,"listItemIndent",self.containerState.size+1)(code2)}function notBlank(code2){if(self.containerState.furtherBlankLines||!markdownSpace(code2)){self.containerState.furtherBlankLines=void 0;self.containerState.initialBlankLine=void 0;return notInCurrentItem(code2)}self.containerState.furtherBlankLines=void 0;self.containerState.initialBlankLine=void 0;return effects.attempt(indentConstruct,ok3,notInCurrentItem)(code2)}function notInCurrentItem(code2){self.containerState._closeFlow=true;self.interrupt=void 0;return factorySpace(effects,effects.attempt(list,ok3,nok),"linePrefix",self.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(code2)}}function tokenizeIndent(effects,ok3,nok){const self=this;return factorySpace(effects,afterPrefix,"listItemIndent",self.containerState.size+1);function afterPrefix(code2){const tail=self.events[self.events.length-1];return tail&&tail[1].type==="listItemIndent"&&tail[2].sliceSerialize(tail[1],true).length===self.containerState.size?ok3(code2):nok(code2)}}function tokenizeListEnd(effects){effects.exit(this.containerState.type)}function tokenizeListItemPrefixWhitespace(effects,ok3,nok){const self=this;return factorySpace(effects,afterPrefix,"listItemPrefixWhitespace",self.parser.constructs.disable.null.includes("codeIndented")?void 0:4+1);function afterPrefix(code2){const tail=self.events[self.events.length-1];return!markdownSpace(code2)&&tail&&tail[1].type==="listItemPrefixWhitespace"?ok3(code2):nok(code2)}}var setextUnderline={name:"setextUnderline",resolveTo:resolveToSetextUnderline,tokenize:tokenizeSetextUnderline};function resolveToSetextUnderline(events,context){const editMap=new EditMap;let index2=events.length;let content3;let text4;let definition2;while(index2--){if(events[index2][0]==="enter"){if(events[index2][1].type==="content"){content3=index2;break}if(events[index2][1].type==="paragraph"){text4=index2}}else{if(events[index2][1].type==="content"){editMap.add(index2,1,[])}if(!definition2&&events[index2][1].type==="definition"){definition2=index2}}}const heading={type:"setextHeading",start:{...events[content3][1].start},end:{...events[events.length-1][1].end}};events[text4][1].type="setextHeadingText";if(definition2){editMap.add(text4,0,[["enter",heading,context]]);editMap.add(definition2+1,0,[["exit",events[content3][1],context]]);events[content3][1].end={...events[definition2][1].end}}else{events[content3][1]=heading}editMap.add(events.length,0,[["exit",heading,context]]);editMap.consume(events);return events}function tokenizeSetextUnderline(effects,ok3,nok){const self=this;let marker;return start;function start(code2){let index2=self.events.length;let paragraph;while(index2--){if(self.events[index2][1].type!=="lineEnding"&&self.events[index2][1].type!=="linePrefix"&&self.events[index2][1].type!=="content"){paragraph=self.events[index2][1].type==="paragraph";break}}if(!self.parser.lazy[self.now().line]&&(self.interrupt||paragraph)){effects.enter("setextHeadingLine");marker=code2;return before(code2)}return nok(code2)}function before(code2){effects.enter("setextHeadingLineSequence");return inside(code2)}function inside(code2){if(code2===marker){effects.consume(code2);return inside}effects.exit("setextHeadingLineSequence");return markdownSpace(code2)?factorySpace(effects,after,"lineSuffix")(code2):after(code2)}function after(code2){if(code2===null||markdownLineEnding(code2)){effects.exit("setextHeadingLine");return ok3(code2)}return nok(code2)}}var flow={tokenize:initializeFlow};function initializeFlow(effects){const self=this;const initial=effects.attempt(blankLine,atBlankEnding,effects.attempt(this.parser.constructs.flowInitial,afterConstruct,factorySpace(effects,effects.attempt(this.parser.constructs.flow,afterConstruct,effects.attempt(content2,afterConstruct)),"linePrefix")));return initial;function atBlankEnding(code2){if(code2===null){effects.consume(code2);return}effects.enter("lineEndingBlank");effects.consume(code2);effects.exit("lineEndingBlank");self.currentConstruct=void 0;return initial}function afterConstruct(code2){if(code2===null){effects.consume(code2);return}effects.enter("lineEnding");effects.consume(code2);effects.exit("lineEnding");self.currentConstruct=void 0;return initial}}var resolver={resolveAll:createResolver()};var string=initializeFactory("string");var text=initializeFactory("text");function initializeFactory(field){return{resolveAll:createResolver(field==="text"?resolveAllLineSuffixes:void 0),tokenize:initializeText};function initializeText(effects){const self=this;const constructs2=this.parser.constructs[field];const text4=effects.attempt(constructs2,start,notText);return start;function start(code2){return atBreak(code2)?text4(code2):notText(code2)}function notText(code2){if(code2===null){effects.consume(code2);return}effects.enter("data");effects.consume(code2);return data}function data(code2){if(atBreak(code2)){effects.exit("data");return text4(code2)}effects.consume(code2);return data}function atBreak(code2){if(code2===null){return true}const list2=constructs2[code2];let index2=-1;if(list2){while(++index2<list2.length){const item=list2[index2];if(!item.previous||item.previous.call(self,self.previous)){return true}}}return false}}}function createResolver(extraResolver){return resolveAllText;function resolveAllText(events,context){let index2=-1;let enter;while(++index2<=events.length){if(enter===void 0){if(events[index2]&&events[index2][1].type==="data"){enter=index2;index2++}}else if(!events[index2]||events[index2][1].type!=="data"){if(index2!==enter+2){events[enter][1].end=events[index2-1][1].end;events.splice(enter+2,index2-enter-2);index2=enter+2}enter=void 0}}return extraResolver?extraResolver(events,context):events}}function resolveAllLineSuffixes(events,context){const editMap=new EditMap;let eventIndex=0;while(++eventIndex<=events.length){if((eventIndex===events.length||events[eventIndex][1].type==="lineEnding")&&events[eventIndex-1][1].type==="data"){const data=events[eventIndex-1][1];const chunks=context.sliceStream(data);let index2=chunks.length;let bufferIndex=-1;let size=0;let tabs;while(index2--){const chunk=chunks[index2];if(typeof chunk==="string"){bufferIndex=chunk.length;while(chunk.charCodeAt(bufferIndex-1)===32){size++;bufferIndex--}if(bufferIndex){break}bufferIndex=-1}else if(chunk===-2){tabs=true;size++}else if(chunk===-1){}else{index2++;break}}if(context._contentTypeTextTrailing&&eventIndex===events.length){size=0}if(size){const token={type:eventIndex===events.length||tabs||size<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:index2?bufferIndex:data.start._bufferIndex+bufferIndex,_index:data.start._index+index2,line:data.end.line,column:data.end.column-size,offset:data.end.offset-size},end:{...data.end}};data.end={...token.start};if(data.start.offset===data.end.offset){Object.assign(data,token)}else{editMap.add(eventIndex,0,[["enter",token,context],["exit",token,context]])}}eventIndex++}}editMap.consume(events);return events}var constructs_exports={};__export(constructs_exports,{attentionMarkers:()=>attentionMarkers,contentInitial:()=>contentInitial,disable:()=>disable,document:()=>document3,flow:()=>flow2,flowInitial:()=>flowInitial,insideSpan:()=>insideSpan,string:()=>string2,text:()=>text2});var document3={[42]:list,[43]:list,[45]:list,[48]:list,[49]:list,[50]:list,[51]:list,[52]:list,[53]:list,[54]:list,[55]:list,[56]:list,[57]:list,[62]:blockQuote};var contentInitial={[91]:definition};var flowInitial={[-2]:codeIndented,[-1]:codeIndented,[32]:codeIndented};var flow2={[35]:headingAtx,[42]:thematicBreak,[45]:[setextUnderline,thematicBreak],[60]:htmlFlow,[61]:setextUnderline,[95]:thematicBreak,[96]:codeFenced,[126]:codeFenced};var string2={[38]:characterReference,[92]:characterEscape};var text2={[-5]:lineEnding,[-4]:lineEnding,[-3]:lineEnding,[33]:labelStartImage,[38]:characterReference,[42]:attention,[60]:[autolink,htmlText],[91]:labelStartLink,[92]:[hardBreakEscape,characterEscape],[93]:labelEnd,[95]:attention,[96]:codeText};var insideSpan={null:[attention,resolver]};var attentionMarkers={null:[42,95]};var disable={null:[]};function createTokenizer(parser,initialize,from){let point3={_bufferIndex:-1,_index:0,line:from&&from.line||1,column:from&&from.column||1,offset:from&&from.offset||0};const columnStart={};const resolveAllConstructs=[];let chunks=[];let stack=[];let consumed=true;const effects={attempt:constructFactory(onsuccessfulconstruct),check:constructFactory(onsuccessfulcheck),consume,enter,exit:exit3,interrupt:constructFactory(onsuccessfulcheck,{interrupt:true})};const context={code:null,containerState:{},defineSkip,events:[],now,parser,previous:null,sliceSerialize,sliceStream,write};let state=initialize.tokenize.call(context,effects);let expectedCode;if(initialize.resolveAll){resolveAllConstructs.push(initialize)}return context;function write(slice){chunks=push(chunks,slice);main();if(chunks[chunks.length-1]!==null){return[]}addResult(initialize,0);context.events=resolveAll(resolveAllConstructs,context.events,context);return context.events}function sliceSerialize(token,expandTabs){return serializeChunks(sliceStream(token),expandTabs)}function sliceStream(token){return sliceChunks(chunks,token)}function now(){const{_bufferIndex,_index,line,column,offset}=point3;return{_bufferIndex,_index,line,column,offset}}function defineSkip(value){columnStart[value.line]=value.column;accountForPotentialSkip()}function main(){while(point3._index<chunks.length){const chunk=chunks[point3._index];if(typeof chunk==="string"){const chunkIndex=point3._index;if(point3._bufferIndex<0){point3._bufferIndex=0}while(point3._index===chunkIndex&&point3._bufferIndex<chunk.length){go(chunk.charCodeAt(point3._bufferIndex))}}else{go(chunk)}}}function go(code2){consumed=void 0;expectedCode=code2;state=state(code2)}function consume(code2){if(markdownLineEnding(code2)){point3.line++;point3.column=1;point3.offset+=code2===-3?2:1;accountForPotentialSkip()}else if(code2!==-1){point3.column++;point3.offset++}if(point3._bufferIndex<0){point3._index++}else{point3._bufferIndex++;if(point3._bufferIndex===chunks[point3._index].length){point3._bufferIndex=-1;point3._index++}}context.previous=code2;consumed=true}function enter(type,fields){const token=fields||{};token.type=type;token.start=now();context.events.push(["enter",token,context]);stack.push(token);return token}function exit3(type){const token=stack.pop();token.end=now();context.events.push(["exit",token,context]);return token}function onsuccessfulconstruct(construct,info){addResult(construct,info.from)}function onsuccessfulcheck(_,info){info.restore()}function constructFactory(onreturn,fields){return hook;function hook(constructs2,returnState,bogusState){let listOfConstructs;let constructIndex;let currentConstruct;let info;return Array.isArray(constructs2)?handleListOfConstructs(constructs2):"tokenize"in constructs2?handleListOfConstructs([constructs2]):handleMapOfConstructs(constructs2);function handleMapOfConstructs(map){return start;function start(code2){const left=code2!==null&&map[code2];const all2=code2!==null&&map.null;const list2=[...Array.isArray(left)?left:left?[left]:[],...Array.isArray(all2)?all2:all2?[all2]:[]];return handleListOfConstructs(list2)(code2)}}function handleListOfConstructs(list2){listOfConstructs=list2;constructIndex=0;if(list2.length===0){return bogusState}return handleConstruct(list2[constructIndex])}function handleConstruct(construct){return start;function start(code2){info=store();currentConstruct=construct;if(!construct.partial){context.currentConstruct=construct}if(construct.name&&context.parser.constructs.disable.null.includes(construct.name)){return nok(code2)}return construct.tokenize.call(fields?Object.assign(Object.create(context),fields):context,effects,ok3,nok)(code2)}}function ok3(code2){consumed=true;onreturn(currentConstruct,info);return returnState}function nok(code2){consumed=true;info.restore();if(++constructIndex<listOfConstructs.length){return handleConstruct(listOfConstructs[constructIndex])}return bogusState}}}function addResult(construct,from2){if(construct.resolveAll&&!resolveAllConstructs.includes(construct)){resolveAllConstructs.push(construct)}if(construct.resolve){splice(context.events,from2,context.events.length-from2,construct.resolve(context.events.slice(from2),context))}if(construct.resolveTo){context.events=construct.resolveTo(context.events,context)}}function store(){const startPoint=now();const startPrevious=context.previous;const startCurrentConstruct=context.currentConstruct;const startEventsIndex=context.events.length;const startStack=Array.from(stack);return{from:startEventsIndex,restore};function restore(){point3=startPoint;context.previous=startPrevious;context.currentConstruct=startCurrentConstruct;context.events.length=startEventsIndex;stack=startStack;accountForPotentialSkip()}}function accountForPotentialSkip(){if(point3.line in columnStart&&point3.column<2){point3.column=columnStart[point3.line];point3.offset+=columnStart[point3.line]-1}}}function sliceChunks(chunks,token){const startIndex=token.start._index;const startBufferIndex=token.start._bufferIndex;const endIndex=token.end._index;const endBufferIndex=token.end._bufferIndex;let view;if(startIndex===endIndex){view=[chunks[startIndex].slice(startBufferIndex,endBufferIndex)]}else{view=chunks.slice(startIndex,endIndex);if(startBufferIndex>-1){const head=view[0];if(typeof head==="string"){view[0]=head.slice(startBufferIndex)}else{view.shift()}}if(endBufferIndex>0){view.push(chunks[endIndex].slice(0,endBufferIndex))}}return view}function serializeChunks(chunks,expandTabs){let index2=-1;const result=[];let atTab;while(++index2<chunks.length){const chunk=chunks[index2];let value;if(typeof chunk==="string"){value=chunk}else{switch(chunk){case-5:{value="\r";break}case-4:{value="\n";break}case-3:{value="\r\n";break}case-2:{value=expandTabs?" ":" ";break}case-1:{if(!expandTabs&&atTab){continue}value=" ";break}default:{value=String.fromCharCode(chunk)}}}atTab=chunk===-2;result.push(value)}return result.join("")}function parse(options){const settings=options||{};const constructs2=combineExtensions([constructs_exports,...settings.extensions||[]]);const parser={constructs:constructs2,content:create(content),defined:[],document:create(document2),flow:create(flow),lazy:{},string:create(string),text:create(text)};return parser;function create(initial){return creator;function creator(from){return createTokenizer(parser,initial,from)}}}function postprocess(events){while(!subtokenize(events)){}return events}var search=/[\0\t\n\r]/g;function preprocess(){let column=1;let buffer="";let start=true;let atCarriageReturn;return preprocessor;function preprocessor(value,encoding,end){value=buffer+(typeof value==="string"?value.toString():new TextDecoder(encoding||void 0).decode(value));const chunks=[];let startPosition=0;buffer="";if(start){if(value.charCodeAt(0)===65279){startPosition++}start=void 0}while(startPosition<value.length){search.lastIndex=startPosition;const match=search.exec(value);const endPosition=match&&match.index!==void 0?match.index:value.length;const code2=value.charCodeAt(endPosition);if(!match){buffer=value.slice(startPosition);break}if(code2===10&&startPosition===endPosition&&atCarriageReturn){chunks.push(-3);atCarriageReturn=void 0}else{if(atCarriageReturn){chunks.push(-5);atCarriageReturn=void 0}if(startPosition<endPosition){chunks.push(value.slice(startPosition,endPosition));column+=endPosition-startPosition}switch(code2){case 0:{chunks.push(65533);column++;break}case 9:{const next=Math.ceil(column/4)*4;chunks.push(-2);while(column++<next){chunks.push(-1)}break}case 10:{chunks.push(-4);column=1;break}default:{atCarriageReturn=true;column=1}}}startPosition=endPosition+1}if(end){if(atCarriageReturn){chunks.push(-5)}if(buffer){chunks.push(buffer)}chunks.push(null)}return chunks}}var characterEscapeOrReference=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function decodeString(value){return value.replace(characterEscapeOrReference,decode)}function decode($0,$1,$2){if($1){return $1}const head=$2.charCodeAt(0);if(head===35){const head2=$2.charCodeAt(1);const hex=head2===120||head2===88;return decodeNumericCharacterReference($2.slice(hex?2:1),hex?16:10)}return decodeNamedCharacterReference($2)||$0}function stringifyPosition(value){if(!value||typeof value!=="object"){return""}if("position"in value||"type"in value){return position(value.position)}if("start"in value||"end"in value){return position(value)}if("line"in value||"column"in value){return point(value)}return""}function point(point3){return index(point3&&point3.line)+":"+index(point3&&point3.column)}function position(pos){return point(pos&&pos.start)+"-"+point(pos&&pos.end)}function index(value){return value&&typeof value==="number"?value:1}var own={}.hasOwnProperty;function fromMarkdown(value,encoding,options){if(encoding&&typeof encoding==="object"){options=encoding;encoding=void 0}return compiler(options)(postprocess(parse(options).document().write(preprocess()(value,encoding,true))))}function compiler(options){const config={afterExit:[],beforeEnter:[],transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:opener(link),autolinkProtocol:onenterdata,autolinkEmail:onenterdata,atxHeading:opener(heading),blockQuote:opener(blockQuote2),characterEscape:onenterdata,characterReference:onenterdata,codeFenced:opener(codeFlow),codeFencedFenceInfo:buffer,codeFencedFenceMeta:buffer,codeIndented:opener(codeFlow,buffer),codeText:opener(codeText2,buffer),codeTextData:onenterdata,data:onenterdata,codeFlowValue:onenterdata,definition:opener(definition2),definitionDestinationString:buffer,definitionLabelString:buffer,definitionTitleString:buffer,emphasis:opener(emphasis),hardBreakEscape:opener(hardBreak),hardBreakTrailing:opener(hardBreak),htmlFlow:opener(html,buffer),htmlFlowData:onenterdata,htmlText:opener(html,buffer),htmlTextData:onenterdata,image:opener(image),label:buffer,link:opener(link),listItem:opener(listItem),listItemValue:onenterlistitemvalue,listOrdered:opener(list2,onenterlistordered),listUnordered:opener(list2),paragraph:opener(paragraph),reference:onenterreference,referenceString:buffer,resourceDestinationString:buffer,resourceTitleString:buffer,setextHeading:opener(heading),strong:opener(strong),thematicBreak:opener(thematicBreak2)},exit:{atxHeading:closer(),atxHeadingSequence:onexitatxheadingsequence,autolink:closer(),autolinkEmail:onexitautolinkemail,autolinkProtocol:onexitautolinkprotocol,blockQuote:closer(),characterEscapeValue:onexitdata,characterReferenceMarkerHexadecimal:onexitcharacterreferencemarker,characterReferenceMarkerNumeric:onexitcharacterreferencemarker,characterReferenceValue:onexitcharacterreferencevalue,characterReference:onexitcharacterreference,codeFenced:closer(onexitcodefenced),codeFencedFence:onexitcodefencedfence,codeFencedFenceInfo:onexitcodefencedfenceinfo,codeFencedFenceMeta:onexitcodefencedfencemeta,codeFlowValue:onexitdata,codeIndented:closer(onexitcodeindented),codeText:closer(onexitcodetext),codeTextData:onexitdata,data:onexitdata,definition:closer(),definitionDestinationString:onexitdefinitiondestinationstring,definitionLabelString:onexitdefinitionlabelstring,definitionTitleString:onexitdefinitiontitlestring,emphasis:closer(),hardBreakEscape:closer(onexithardbreak),hardBreakTrailing:closer(onexithardbreak),htmlFlow:closer(onexithtmlflow),htmlFlowData:onexitdata,htmlText:closer(onexithtmltext),htmlTextData:onexitdata,image:closer(onexitimage),label:onexitlabel,labelText:onexitlabeltext,lineEnding:onexitlineending,link:closer(onexitlink),listItem:closer(),listOrdered:closer(),listUnordered:closer(),paragraph:closer(),referenceString:onexitreferencestring,resourceDestinationString:onexitresourcedestinationstring,resourceTitleString:onexitresourcetitlestring,resource:onexitresource,setextHeading:closer(onexitsetextheading),setextHeadingLineSequence:onexitsetextheadinglinesequence,setextHeadingText:onexitsetextheadingtext,strong:closer(),thematicBreak:closer()}};configure(config,(options||{}).mdastExtensions||[]);const data={};return compile;function compile(events){let tree={type:"root",children:[],position:void 0};const context={stack:[tree],tokenStack:[],config,enter,exit:exit3,buffer,resume,data};const listStack=[];const prepared=[];let index2=-1;while(++index2<events.length){prepared.push(events[index2]);if(events[index2][1].type==="listOrdered"||events[index2][1].type==="listUnordered"){if(events[index2][0]==="enter"){listStack.push(prepared.length-1)}else{const tail=listStack.pop();prepareList(prepared,tail)}}}events=prepared;index2=-1;while(++index2<events.length){const handler=config[events[index2][0]];if(events[index2][0]==="enter"&&config.beforeEnter.length>0){callListeners(config.beforeEnter,{...context,sliceSerialize:events[index2][2].sliceSerialize},events[index2][1])}if(own.call(handler,events[index2][1].type)){handler[events[index2][1].type].call({...context,sliceSerialize:events[index2][2].sliceSerialize},events[index2][1])}if(events[index2][0]==="exit"&&config.afterExit.length>0){callListeners(config.afterExit,{...context,sliceSerialize:events[index2][2].sliceSerialize},events[index2][1])}}if(context.tokenStack.length>0){const tail=context.tokenStack[context.tokenStack.length-1];const handler=tail[1]||defaultOnError;handler.call(context,void 0,tail[0])}tree.position={start:point2(events.length>0?events[0][1].start:{line:1,column:1,offset:0}),end:point2(events.length>0?events[events.length-2][1].end:{line:1,column:1,offset:0})};index2=-1;while(++index2<config.transforms.length){tree=config.transforms[index2](tree)||tree}return tree}function callListeners(listeners,context,token){let index2=-1;while(++index2<listeners.length){listeners[index2].call(context,token)}}function prepareList(events,start){const end=events.length-1;let index2=start-1;let containerBalance=-1;let listSpread=false;let listItem2;let lineIndex;let firstBlankLineIndex;let atMarker;const insertions=[];while(++index2<=end){const event=events[index2];switch(event[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{if(event[0]==="enter"){containerBalance++}else{containerBalance--}atMarker=void 0;break}case"lineEndingBlank":{if(event[0]==="enter"){if(listItem2&&!atMarker&&!containerBalance&&!firstBlankLineIndex){firstBlankLineIndex=index2}atMarker=void 0}break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":{break}default:{atMarker=void 0}}if(!containerBalance&&event[0]==="enter"&&event[1].type==="listItemPrefix"||containerBalance===-1&&event[0]==="exit"&&(event[1].type==="listUnordered"||event[1].type==="listOrdered")){if(listItem2){let tailIndex=index2;lineIndex=void 0;while(tailIndex--){const tailEvent=events[tailIndex];if(tailEvent[1].type==="lineEnding"||tailEvent[1].type==="lineEndingBlank"){if(tailEvent[0]==="exit")continue;if(lineIndex){events[lineIndex][1].type="lineEndingBlank";listSpread=true}tailEvent[1].type="lineEnding";lineIndex=tailIndex}else if(tailEvent[1].type==="linePrefix"||tailEvent[1].type==="blockQuotePrefix"||tailEvent[1].type==="blockQuotePrefixWhitespace"||tailEvent[1].type==="blockQuoteMarker"||tailEvent[1].type==="listItemIndent"){}else{break}}if(firstBlankLineIndex&&(!lineIndex||firstBlankLineIndex<lineIndex)){listItem2._spread=true}listItem2.end=Object.assign({},lineIndex?events[lineIndex][1].start:event[1].end);insertions.push({at:lineIndex||index2,event:["exit",listItem2,event[2]]})}if(event[1].type==="listItemPrefix"){const item={type:"listItem",_spread:false,start:Object.assign({},event[1].start),end:void 0};listItem2=item;insertions.push({at:index2,event:["enter",item,event[2]]});firstBlankLineIndex=void 0;atMarker=true}}}const listEvents=events.splice(start);let insertion=0;index2=-1;while(++index2<listEvents.length){while(insertion<insertions.length&&insertions[insertion].at===start+index2){events.push(insertions[insertion++].event)}events.push(listEvents[index2])}events[start][1]._spread=listSpread}function opener(create,and){return open;function open(token){enter.call(this,create(token),token);if(and)and.call(this,token)}}function buffer(){this.stack.push({type:"fragment",children:[]})}function enter(node2,token,errorHandler){const parent=this.stack[this.stack.length-1];const siblings=parent.children;siblings.push(node2);this.stack.push(node2);this.tokenStack.push([token,errorHandler||void 0]);node2.position={start:point2(token.start),end:void 0}}function closer(and){return close;function close(token){if(and)and.call(this,token);exit3.call(this,token)}}function exit3(token,onExitError){const node2=this.stack.pop();const open=this.tokenStack.pop();if(!open){throw new Error("Cannot close `"+token.type+"` ("+stringifyPosition({start:token.start,end:token.end})+"): it\u2019s not open")}if(open[0].type!==token.type){if(onExitError){onExitError.call(this,token,open[0])}else{const handler=open[1]||defaultOnError;handler.call(this,token,open[0])}}node2.position.end=point2(token.end)}function resume(){return toString(this.stack.pop())}function onenterlistordered(){this.data.expectingFirstListItemValue=true}function onenterlistitemvalue(token){if(this.data.expectingFirstListItemValue){const ancestor=this.stack[this.stack.length-2];ancestor.start=Number.parseInt(this.sliceSerialize(token),10);this.data.expectingFirstListItemValue=void 0}}function onexitcodefencedfenceinfo(){const data2=this.resume();const node2=this.stack[this.stack.length-1];node2.lang=data2}function onexitcodefencedfencemeta(){const data2=this.resume();const node2=this.stack[this.stack.length-1];node2.meta=data2}function onexitcodefencedfence(){if(this.data.flowCodeInside)return;this.buffer();this.data.flowCodeInside=true}function onexitcodefenced(){const data2=this.resume();const node2=this.stack[this.stack.length-1];node2.value=data2.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,"");this.data.flowCodeInside=void 0}function onexitcodeindented(){const data2=this.resume();const node2=this.stack[this.stack.length-1];node2.value=data2.replace(/(\r?\n|\r)$/g,"")}function onexitdefinitionlabelstring(token){const label=this.resume();const node2=this.stack[this.stack.length-1];node2.label=label;node2.identifier=normalizeIdentifier(this.sliceSerialize(token)).toLowerCase()}function onexitdefinitiontitlestring(){const data2=this.resume();const node2=this.stack[this.stack.length-1];node2.title=data2}function onexitdefinitiondestinationstring(){const data2=this.resume();const node2=this.stack[this.stack.length-1];node2.url=data2}function onexitatxheadingsequence(token){const node2=this.stack[this.stack.length-1];if(!node2.depth){const depth=this.sliceSerialize(token).length;node2.depth=depth}}function onexitsetextheadingtext(){this.data.setextHeadingSlurpLineEnding=true}function onexitsetextheadinglinesequence(token){const node2=this.stack[this.stack.length-1];node2.depth=this.sliceSerialize(token).codePointAt(0)===61?1:2}function onexitsetextheading(){this.data.setextHeadingSlurpLineEnding=void 0}function onenterdata(token){const node2=this.stack[this.stack.length-1];const siblings=node2.children;let tail=siblings[siblings.length-1];if(!tail||tail.type!=="text"){tail=text4();tail.position={start:point2(token.start),end:void 0};siblings.push(tail)}this.stack.push(tail)}function onexitdata(token){const tail=this.stack.pop();tail.value+=this.sliceSerialize(token);tail.position.end=point2(token.end)}function onexitlineending(token){const context=this.stack[this.stack.length-1];if(this.data.atHardBreak){const tail=context.children[context.children.length-1];tail.position.end=point2(token.end);this.data.atHardBreak=void 0;return}if(!this.data.setextHeadingSlurpLineEnding&&config.canContainEols.includes(context.type)){onenterdata.call(this,token);onexitdata.call(this,token)}}function onexithardbreak(){this.data.atHardBreak=true}function onexithtmlflow(){const data2=this.resume();const node2=this.stack[this.stack.length-1];node2.value=data2}function onexithtmltext(){const data2=this.resume();const node2=this.stack[this.stack.length-1];node2.value=data2}function onexitcodetext(){const data2=this.resume();const node2=this.stack[this.stack.length-1];node2.value=data2}function onexitlink(){const node2=this.stack[this.stack.length-1];if(this.data.inReference){const referenceType=this.data.referenceType||"shortcut";node2.type+="Reference";node2.referenceType=referenceType;delete node2.url;delete node2.title}else{delete node2.identifier;delete node2.label}this.data.referenceType=void 0}function onexitimage(){const node2=this.stack[this.stack.length-1];if(this.data.inReference){const referenceType=this.data.referenceType||"shortcut";node2.type+="Reference";node2.referenceType=referenceType;delete node2.url;delete node2.title}else{delete node2.identifier;delete node2.label}this.data.referenceType=void 0}function onexitlabeltext(token){const string3=this.sliceSerialize(token);const ancestor=this.stack[this.stack.length-2];ancestor.label=decodeString(string3);ancestor.identifier=normalizeIdentifier(string3).toLowerCase()}function onexitlabel(){const fragment=this.stack[this.stack.length-1];const value=this.resume();const node2=this.stack[this.stack.length-1];this.data.inReference=true;if(node2.type==="link"){const children=fragment.children;node2.children=children}else{node2.alt=value}}function onexitresourcedestinationstring(){const data2=this.resume();const node2=this.stack[this.stack.length-1];node2.url=data2}function onexitresourcetitlestring(){const data2=this.resume();const node2=this.stack[this.stack.length-1];node2.title=data2}function onexitresource(){this.data.inReference=void 0}function onenterreference(){this.data.referenceType="collapsed"}function onexitreferencestring(token){const label=this.resume();const node2=this.stack[this.stack.length-1];node2.label=label;node2.identifier=normalizeIdentifier(this.sliceSerialize(token)).toLowerCase();this.data.referenceType="full"}function onexitcharacterreferencemarker(token){this.data.characterReferenceType=token.type}function onexitcharacterreferencevalue(token){const data2=this.sliceSerialize(token);const type=this.data.characterReferenceType;let value;if(type){value=decodeNumericCharacterReference(data2,type==="characterReferenceMarkerNumeric"?10:16);this.data.characterReferenceType=void 0}else{const result=decodeNamedCharacterReference(data2);value=result}const tail=this.stack[this.stack.length-1];tail.value+=value}function onexitcharacterreference(token){const tail=this.stack.pop();tail.position.end=point2(token.end)}function onexitautolinkprotocol(token){onexitdata.call(this,token);const node2=this.stack[this.stack.length-1];node2.url=this.sliceSerialize(token)}function onexitautolinkemail(token){onexitdata.call(this,token);const node2=this.stack[this.stack.length-1];node2.url="mailto:"+this.sliceSerialize(token)}function blockQuote2(){return{type:"blockquote",children:[],position:void 0}}function codeFlow(){return{type:"code",lang:null,meta:null,value:"",position:void 0}}function codeText2(){return{type:"inlineCode",value:"",position:void 0}}function definition2(){return{type:"definition",identifier:"",label:null,title:null,url:"",position:void 0}}function emphasis(){return{type:"emphasis",children:[],position:void 0}}function heading(){return{type:"heading",depth:0,children:[],position:void 0}}function hardBreak(){return{type:"break",position:void 0}}function html(){return{type:"html",value:"",position:void 0}}function image(){return{type:"image",title:null,url:"",alt:null,position:void 0}}function link(){return{type:"link",title:null,url:"",children:[],position:void 0}}function list2(token){return{type:"list",ordered:token.type==="listOrdered",start:null,spread:token._spread,children:[],position:void 0}}function listItem(token){return{type:"listItem",spread:token._spread,checked:null,children:[],position:void 0}}function paragraph(){return{type:"paragraph",children:[],position:void 0}}function strong(){return{type:"strong",children:[],position:void 0}}function text4(){return{type:"text",value:"",position:void 0}}function thematicBreak2(){return{type:"thematicBreak",position:void 0}}}function point2(d){return{line:d.line,column:d.column,offset:d.offset}}function configure(combined,extensions){let index2=-1;while(++index2<extensions.length){const value=extensions[index2];if(Array.isArray(value)){configure(combined,value)}else{extension(combined,value)}}}function extension(combined,extension2){let key;for(key in extension2){if(own.call(extension2,key)){switch(key){case"canContainEols":{const right=extension2[key];if(right){combined[key].push(...right)}break}case"transforms":{const right=extension2[key];if(right){combined[key].push(...right)}break}case"afterExit":case"beforeEnter":{const right=extension2[key];if(right){combined[key].push(right)}break}case"enter":case"exit":{const right=extension2[key];if(right){Object.assign(combined[key],right)}break}}}}}function defaultOnError(left,right){if(left){throw new Error("Cannot close `"+left.type+"` ("+stringifyPosition({start:left.start,end:left.end})+"): a different token (`"+right.type+"`, "+stringifyPosition({start:right.start,end:right.end})+") is open")}throw new Error("Cannot close document, a token (`"+right.type+"`, "+stringifyPosition({start:right.start,end:right.end})+") is still open")}function ok(){}function escapeStringRegexp(string3){if(typeof string3!=="string"){throw new TypeError("Expected a string")}return string3.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}var convert=(function(test){if(test===null||test===void 0){return ok2}if(typeof test==="function"){return castFactory(test)}if(typeof test==="object"){return Array.isArray(test)?anyFactory(test):propertiesFactory(test)}if(typeof test==="string"){return typeFactory(test)}throw new Error("Expected function, string, or object as test")});function anyFactory(tests){const checks=[];let index2=-1;while(++index2<tests.length){checks[index2]=convert(tests[index2])}return castFactory(any);function any(...parameters){let index3=-1;while(++index3<checks.length){if(checks[index3].apply(this,parameters))return true}return false}}function propertiesFactory(check){const checkAsRecord=check;return castFactory(all2);function all2(node2){const nodeAsRecord=node2;let key;for(key in check){if(nodeAsRecord[key]!==checkAsRecord[key])return false}return true}}function typeFactory(check){return castFactory(type);function type(node2){return node2&&node2.type===check}}function castFactory(testFunction){return check;function check(value,index2,parent){return Boolean(looksLikeANode(value)&&testFunction.call(this,value,typeof index2==="number"?index2:void 0,parent||void 0))}}function ok2(){return true}function looksLikeANode(value){return value!==null&&typeof value==="object"&&"type"in value}function color(d){return d}var empty=[];var CONTINUE=true;var EXIT=false;var SKIP="skip";function visitParents(tree,test,visitor,reverse){let check;if(typeof test==="function"&&typeof visitor!=="function"){reverse=visitor;visitor=test}else{check=test}const is2=convert(check);const step2=reverse?-1:1;factory(tree,void 0,[])();function factory(node2,index2,parents){const value=node2&&typeof node2==="object"?node2:{};if(typeof value.type==="string"){const name=typeof value.tagName==="string"?value.tagName:typeof value.name==="string"?value.name:void 0;Object.defineProperty(visit,"name",{value:"node ("+color(node2.type+(name?"<"+name+">":""))+")"})}return visit;function visit(){let result=empty;let subresult;let offset;let grandparents;if(!test||is2(node2,index2,parents[parents.length-1]||void 0)){result=toResult(visitor(node2,parents));if(result[0]===EXIT){return result}}if("children"in node2&&node2.children){const nodeAsParent=node2;if(nodeAsParent.children&&result[0]!==SKIP){offset=(reverse?nodeAsParent.children.length:-1)+step2;grandparents=parents.concat(nodeAsParent);while(offset>-1&&offset<nodeAsParent.children.length){const child=nodeAsParent.children[offset];subresult=factory(child,offset,grandparents)();if(subresult[0]===EXIT){return subresult}offset=typeof subresult[1]==="number"?subresult[1]:offset+step2}}}return result}}}function toResult(value){if(Array.isArray(value)){return value}if(typeof value==="number"){return[CONTINUE,value]}return value===null||value===void 0?empty:[value]}function findAndReplace(tree,list2,options){const settings=options||{};const ignored=convert(settings.ignore||[]);const pairs=toPairs(list2);let pairIndex=-1;while(++pairIndex<pairs.length){visitParents(tree,"text",visitor)}function visitor(node2,parents){let index2=-1;let grandparent;while(++index2<parents.length){const parent=parents[index2];const siblings=grandparent?grandparent.children:void 0;if(ignored(parent,siblings?siblings.indexOf(parent):void 0,grandparent)){return}grandparent=parent}if(grandparent){return handler(node2,parents)}}function handler(node2,parents){const parent=parents[parents.length-1];const find=pairs[pairIndex][0];const replace2=pairs[pairIndex][1];let start=0;const siblings=parent.children;const index2=siblings.indexOf(node2);let change=false;let nodes=[];find.lastIndex=0;let match=find.exec(node2.value);while(match){const position2=match.index;const matchObject={index:match.index,input:match.input,stack:[...parents,node2]};let value=replace2(...match,matchObject);if(typeof value==="string"){value=value.length>0?{type:"text",value}:void 0}if(value===false){find.lastIndex=position2+1}else{if(start!==position2){add({type:"text",value:node2.value.slice(start,position2)})}if(Array.isArray(value)){for(const child of value)add(child)}else if(value){add(value)}start=position2+match[0].length;change=true}if(!find.global){break}match=find.exec(node2.value)}if(change){if(start<node2.value.length){add({type:"text",value:node2.value.slice(start)})}parent.children.splice(index2,1,...nodes)}else{nodes=[node2]}return index2+nodes.length;function add(child){const previous3=nodes[nodes.length-1];if(previous3&&previous3.type==="text"&&child.type==="text"){previous3.value+=child.value}else{nodes.push(child)}}}}function toPairs(tupleOrList){if(!Array.isArray(tupleOrList)){throw new TypeError("Expected find and replace tuple or list of tuples")}const result=[];const list2=!tupleOrList[0]||Array.isArray(tupleOrList[0])?tupleOrList:[tupleOrList];let index2=-1;while(++index2<list2.length){const tuple=list2[index2];result.push([toExpression(tuple[0]),toFunction(tuple[1])])}return result}function toExpression(find){return typeof find==="string"?new RegExp(escapeStringRegexp(find),"g"):find}function toFunction(replace2){return typeof replace2==="function"?replace2:function(){return replace2}}function gfmAutolinkLiteralFromMarkdown(){return{transforms:[transformGfmAutolinkLiterals],enter:{literalAutolink:enterLiteralAutolink,literalAutolinkEmail:enterLiteralAutolinkValue,literalAutolinkHttp:enterLiteralAutolinkValue,literalAutolinkWww:enterLiteralAutolinkValue},exit:{literalAutolink:exitLiteralAutolink,literalAutolinkEmail:exitLiteralAutolinkEmail,literalAutolinkHttp:exitLiteralAutolinkHttp,literalAutolinkWww:exitLiteralAutolinkWww}}}function enterLiteralAutolink(token){this.enter({type:"link",title:null,url:"",children:[]},token)}function enterLiteralAutolinkValue(token){this.config.enter.autolinkProtocol.call(this,token)}function exitLiteralAutolinkHttp(token){this.config.exit.autolinkProtocol.call(this,token)}function exitLiteralAutolinkWww(token){this.config.exit.data.call(this,token);const node2=this.stack[this.stack.length-1];ok(node2.type==="link");node2.url="http://"+this.sliceSerialize(token)}function exitLiteralAutolinkEmail(token){this.config.exit.autolinkEmail.call(this,token)}function exitLiteralAutolink(token){this.exit(token)}function transformGfmAutolinkLiterals(tree){findAndReplace(tree,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,findUrl],[/(?<=^|\s|\p{P}|\p{S})([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/gu,findEmail]],{ignore:["link","linkReference"]})}function findUrl(_,protocol,domain2,path2,match){let prefix="";if(!previous2(match)){return false}if(/^w/i.test(protocol)){domain2=protocol+domain2;protocol="";prefix="http://"}if(!isCorrectDomain(domain2)){return false}const parts=splitUrl(domain2+path2);if(!parts[0])return false;const result={type:"link",title:null,url:prefix+protocol+parts[0],children:[{type:"text",value:protocol+parts[0]}]};if(parts[1]){return[result,{type:"text",value:parts[1]}]}return result}function findEmail(_,atext,label,match){if(!previous2(match,true)||/[-\d_]$/.test(label)){return false}return{type:"link",title:null,url:"mailto:"+atext+"@"+label,children:[{type:"text",value:atext+"@"+label}]}}function isCorrectDomain(domain2){const parts=domain2.split(".");if(parts.length<2||parts[parts.length-1]&&(/_/.test(parts[parts.length-1])||!/[a-zA-Z\d]/.test(parts[parts.length-1]))||parts[parts.length-2]&&(/_/.test(parts[parts.length-2])||!/[a-zA-Z\d]/.test(parts[parts.length-2]))){return false}return true}function splitUrl(url){const trailExec=/[!"&'),.:;<>?\]}]+$/.exec(url);if(!trailExec){return[url,void 0]}url=url.slice(0,trailExec.index);let trail2=trailExec[0];let closingParenIndex=trail2.indexOf(")");const openingParens=ccount(url,"(");let closingParens=ccount(url,")");while(closingParenIndex!==-1&&openingParens>closingParens){url+=trail2.slice(0,closingParenIndex+1);trail2=trail2.slice(closingParenIndex+1);closingParenIndex=trail2.indexOf(")");closingParens++}return[url,trail2]}function previous2(match,email){const code2=match.input.charCodeAt(match.index-1);return(match.index===0||unicodeWhitespace(code2)||unicodePunctuation(code2))&&(!email||code2!==47)}footnoteReference.peek=footnoteReferencePeek;function enterFootnoteCallString(){this.buffer()}function enterFootnoteCall(token){this.enter({type:"footnoteReference",identifier:"",label:""},token)}function enterFootnoteDefinitionLabelString(){this.buffer()}function enterFootnoteDefinition(token){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},token)}function exitFootnoteCallString(token){const label=this.resume();const node2=this.stack[this.stack.length-1];ok(node2.type==="footnoteReference");node2.identifier=normalizeIdentifier(this.sliceSerialize(token)).toLowerCase();node2.label=label}function exitFootnoteCall(token){this.exit(token)}function exitFootnoteDefinitionLabelString(token){const label=this.resume();const node2=this.stack[this.stack.length-1];ok(node2.type==="footnoteDefinition");node2.identifier=normalizeIdentifier(this.sliceSerialize(token)).toLowerCase();node2.label=label}function exitFootnoteDefinition(token){this.exit(token)}function footnoteReferencePeek(){return"["}function footnoteReference(node2,_,state,info){const tracker=state.createTracker(info);let value=tracker.move("[^");const exit3=state.enter("footnoteReference");const subexit=state.enter("reference");value+=tracker.move(state.safe(state.associationId(node2),{after:"]",before:value}));subexit();exit3();value+=tracker.move("]");return value}function gfmFootnoteFromMarkdown(){return{enter:{gfmFootnoteCallString:enterFootnoteCallString,gfmFootnoteCall:enterFootnoteCall,gfmFootnoteDefinitionLabelString:enterFootnoteDefinitionLabelString,gfmFootnoteDefinition:enterFootnoteDefinition},exit:{gfmFootnoteCallString:exitFootnoteCallString,gfmFootnoteCall:exitFootnoteCall,gfmFootnoteDefinitionLabelString:exitFootnoteDefinitionLabelString,gfmFootnoteDefinition:exitFootnoteDefinition}}}handleDelete.attention=attentionDelete;handleDelete.peek=peekDelete;function gfmStrikethroughFromMarkdown(){return{canContainEols:["delete"],enter:{strikethrough:enterStrikethrough},exit:{strikethrough:exitStrikethrough}}}function enterStrikethrough(token){this.enter({type:"delete",children:[],position:void 0},token)}function exitStrikethrough(token){this.exit(token)}function handleDelete(node2,_,state,info){const tracker=state.createTracker(info);const sequence=state.stack.includes("strikethrough")?"~":"~~";const exit3=state.enter("strikethrough");let value=tracker.move(sequence);value+=state.containerPhrasing(node2,{...tracker.current(),before:value,after:"~"});value+=tracker.move(sequence);exit3();return value}function attentionDelete(){return{construct:"strikethrough",markers:["~"],sizes:[2,1]}}function peekDelete(){return"~"}function gfmTableFromMarkdown(){return{enter:{table:enterTable,tableData:enterCell,tableHeader:enterCell,tableRow:enterRow},exit:{codeText:exitCodeText,table:exitTable,tableData:exit2,tableHeader:exit2,tableRow:exit2}}}function enterTable(token){const align=token._align;ok(align,"expected `_align` on table");this.enter({type:"table",align:align.map(function(d){return d==="none"?null:d}),children:[]},token);this.data.inTable=true}function exitTable(token){this.exit(token);this.data.inTable=void 0}function enterRow(token){this.enter({type:"tableRow",children:[]},token)}function exit2(token){this.exit(token)}function enterCell(token){this.enter({type:"tableCell",children:[]},token)}function exitCodeText(token){let value=this.resume();if(this.data.inTable){value=value.replace(/\\([\\|])/g,replace)}const node2=this.stack[this.stack.length-1];ok(node2.type==="inlineCode");node2.value=value;this.exit(token)}function replace($0,$1){return $1==="|"?$1:$0}function gfmTaskListItemFromMarkdown(){return{exit:{taskListCheckValueChecked:exitCheck,taskListCheckValueUnchecked:exitCheck,paragraph:exitParagraphWithTaskListItem}}}function exitCheck(token){const node2=this.stack[this.stack.length-2];ok(node2.type==="listItem");node2.checked=token.type==="taskListCheckValueChecked"}function exitParagraphWithTaskListItem(token){const parent=this.stack[this.stack.length-2];if(parent&&parent.type==="listItem"&&typeof parent.checked==="boolean"){const node2=this.stack[this.stack.length-1];ok(node2.type==="paragraph");const head=node2.children[0];if(head&&head.type==="text"){const siblings=parent.children;let index2=-1;let firstParaghraph;while(++index2<siblings.length){const sibling=siblings[index2];if(sibling.type==="paragraph"){firstParaghraph=sibling;break}}if(firstParaghraph===node2){head.value=head.value.slice(1);if(head.value.length===0){node2.children.shift()}else if(node2.position&&head.position&&typeof head.position.start.offset==="number"){head.position.start.column++;head.position.start.offset++;node2.position.start=Object.assign({},head.position.start)}}}}this.exit(token)}function gfmFromMarkdown(){return[gfmAutolinkLiteralFromMarkdown(),gfmFootnoteFromMarkdown(),gfmStrikethroughFromMarkdown(),gfmTableFromMarkdown(),gfmTaskListItemFromMarkdown()]}var wwwPrefix={tokenize:tokenizeWwwPrefix,partial:true};var domain={tokenize:tokenizeDomain,partial:true};var path={tokenize:tokenizePath,partial:true};var trail={tokenize:tokenizeTrail,partial:true};var emailDomainDotTrail={tokenize:tokenizeEmailDomainDotTrail,partial:true};var wwwAutolink={name:"wwwAutolink",tokenize:tokenizeWwwAutolink,previous:previousWww};var protocolAutolink={name:"protocolAutolink",tokenize:tokenizeProtocolAutolink,previous:previousProtocol};var emailAutolink={name:"emailAutolink",tokenize:tokenizeEmailAutolink,previous:previousEmail};var text3={};function gfmAutolinkLiteral(){return{text:text3}}var code=48;while(code<123){text3[code]=emailAutolink;code++;if(code===58)code=65;else if(code===91)code=97}text3[43]=emailAutolink;text3[45]=emailAutolink;text3[46]=emailAutolink;text3[95]=emailAutolink;text3[72]=[emailAutolink,protocolAutolink];text3[104]=[emailAutolink,protocolAutolink];text3[87]=[emailAutolink,wwwAutolink];text3[119]=[emailAutolink,wwwAutolink];function tokenizeEmailAutolink(effects,ok3,nok){const self=this;let dot;let data;return start;function start(code2){if(!gfmAtext(code2)||!previousEmail.call(self,self.previous)||previousUnbalanced(self.events)){return nok(code2)}effects.enter("literalAutolink");effects.enter("literalAutolinkEmail");return atext(code2)}function atext(code2){if(gfmAtext(code2)){effects.consume(code2);return atext}if(code2===64){effects.consume(code2);return emailDomain}return nok(code2)}function emailDomain(code2){if(code2===46){return effects.check(emailDomainDotTrail,emailDomainAfter,emailDomainDot)(code2)}if(code2===45||code2===95||asciiAlphanumeric(code2)){data=true;effects.consume(code2);return emailDomain}return emailDomainAfter(code2)}function emailDomainDot(code2){effects.consume(code2);dot=true;return emailDomain}function emailDomainAfter(code2){if(data&&dot&&asciiAlpha(self.previous)){effects.exit("literalAutolinkEmail");effects.exit("literalAutolink");return ok3(code2)}return nok(code2)}}function tokenizeWwwAutolink(effects,ok3,nok){const self=this;return wwwStart;function wwwStart(code2){if(code2!==87&&code2!==119||!previousWww.call(self,self.previous)||previousUnbalanced(self.events)){return nok(code2)}effects.enter("literalAutolink");effects.enter("literalAutolinkWww");return effects.check(wwwPrefix,effects.attempt(domain,effects.attempt(path,wwwAfter),nok),nok)(code2)}function wwwAfter(code2){effects.exit("literalAutolinkWww");effects.exit("literalAutolink");return ok3(code2)}}function tokenizeProtocolAutolink(effects,ok3,nok){const self=this;let buffer="";let seen=false;return protocolStart;function protocolStart(code2){if((code2===72||code2===104)&&previousProtocol.call(self,self.previous)&&!previousUnbalanced(self.events)){effects.enter("literalAutolink");effects.enter("literalAutolinkHttp");buffer+=String.fromCodePoint(code2);effects.consume(code2);return protocolPrefixInside}return nok(code2)}function protocolPrefixInside(code2){if(asciiAlpha(code2)&&buffer.length<5){buffer+=String.fromCodePoint(code2);effects.consume(code2);return protocolPrefixInside}if(code2===58){const protocol=buffer.toLowerCase();if(protocol==="http"||protocol==="https"){effects.consume(code2);return protocolSlashesInside}}return nok(code2)}function protocolSlashesInside(code2){if(code2===47){effects.consume(code2);if(seen){return afterProtocol}seen=true;return protocolSlashesInside}return nok(code2)}function afterProtocol(code2){return code2===null||asciiControl(code2)||markdownLineEndingOrSpace(code2)||unicodeWhitespace(code2)||unicodePunctuation(code2)?nok(code2):effects.attempt(domain,effects.attempt(path,protocolAfter),nok)(code2)}function protocolAfter(code2){effects.exit("literalAutolinkHttp");effects.exit("literalAutolink");return ok3(code2)}}function tokenizeWwwPrefix(effects,ok3,nok){let size=0;return wwwPrefixInside;function wwwPrefixInside(code2){if((code2===87||code2===119)&&size<3){size++;effects.consume(code2);return wwwPrefixInside}if(code2===46&&size===3){effects.consume(code2);return wwwPrefixAfter}return nok(code2)}function wwwPrefixAfter(code2){return code2===null?nok(code2):ok3(code2)}}function tokenizeDomain(effects,ok3,nok){let underscoreInLastSegment;let underscoreInLastLastSegment;let seen;return domainInside;function domainInside(code2){if(code2===46||code2===95){return effects.check(trail,domainAfter,domainAtPunctuation)(code2)}if(code2===null||markdownLineEndingOrSpace(code2)||unicodeWhitespace(code2)||code2!==45&&unicodePunctuation(code2)){return domainAfter(code2)}seen=true;effects.consume(code2);return domainInside}function domainAtPunctuation(code2){if(code2===95){underscoreInLastSegment=true}else{underscoreInLastLastSegment=underscoreInLastSegment;underscoreInLastSegment=void 0}effects.consume(code2);return domainInside}function domainAfter(code2){if(underscoreInLastLastSegment||underscoreInLastSegment||!seen){return nok(code2)}return ok3(code2)}}function tokenizePath(effects,ok3){let sizeOpen=0;let sizeClose=0;return pathInside;function pathInside(code2){if(code2===40){sizeOpen++;effects.consume(code2);return pathInside}if(code2===41&&sizeClose<sizeOpen){return pathAtPunctuation(code2)}if(code2===33||code2===34||code2===38||code2===39||code2===41||code2===42||code2===44||code2===46||code2===58||code2===59||code2===60||code2===63||code2===93||code2===95||code2===126){return effects.check(trail,ok3,pathAtPunctuation)(code2)}if(code2===null||markdownLineEndingOrSpace(code2)||unicodeWhitespace(code2)){return ok3(code2)}effects.consume(code2);return pathInside}function pathAtPunctuation(code2){if(code2===41){sizeClose++}effects.consume(code2);return pathInside}}function tokenizeTrail(effects,ok3,nok){return trail2;function trail2(code2){if(code2===33||code2===34||code2===39||code2===41||code2===42||code2===44||code2===46||code2===58||code2===59||code2===63||code2===95||code2===126){effects.consume(code2);return trail2}if(code2===38){effects.consume(code2);return trailCharacterReferenceStart}if(code2===93){effects.consume(code2);return trailBracketAfter}if(code2===60||code2===null||markdownLineEndingOrSpace(code2)||unicodeWhitespace(code2)){return ok3(code2)}return nok(code2)}function trailBracketAfter(code2){if(code2===null||code2===40||code2===91||markdownLineEndingOrSpace(code2)||unicodeWhitespace(code2)){return ok3(code2)}return trail2(code2)}function trailCharacterReferenceStart(code2){return asciiAlpha(code2)?trailCharacterReferenceInside(code2):nok(code2)}function trailCharacterReferenceInside(code2){if(code2===59){effects.consume(code2);return trail2}if(asciiAlpha(code2)){effects.consume(code2);return trailCharacterReferenceInside}return nok(code2)}}function tokenizeEmailDomainDotTrail(effects,ok3,nok){return start;function start(code2){effects.consume(code2);return after}function after(code2){return asciiAlphanumeric(code2)?nok(code2):ok3(code2)}}function previousWww(code2){return code2===null||code2===40||code2===42||code2===95||code2===91||code2===93||code2===126||markdownLineEndingOrSpace(code2)}function previousProtocol(code2){return!asciiAlpha(code2)}function previousEmail(code2){return!(code2===47||gfmAtext(code2))}function gfmAtext(code2){return code2===43||code2===45||code2===46||code2===95||asciiAlphanumeric(code2)}function previousUnbalanced(events){let index2=events.length;let result=false;while(index2--){const token=events[index2][1];if((token.type==="labelLink"||token.type==="labelImage")&&!token._balanced){result=true;break}if(token._gfmAutolinkLiteralWalkedInto){result=false;break}}if(events.length>0&&!result){events[events.length-1][1]._gfmAutolinkLiteralWalkedInto=true}return result}var indent={tokenize:tokenizeIndent2,partial:true};function gfmFootnote(){return{document:{[91]:{name:"gfmFootnoteDefinition",tokenize:tokenizeDefinitionStart,continuation:{tokenize:tokenizeDefinitionContinuation},exit:gfmFootnoteDefinitionEnd}},text:{[91]:{name:"gfmFootnoteCall",tokenize:tokenizeGfmFootnoteCall},[93]:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:tokenizePotentialGfmFootnoteCall,resolveTo:resolveToPotentialGfmFootnoteCall}}}}function tokenizePotentialGfmFootnoteCall(effects,ok3,nok){const self=this;let index2=self.events.length;const defined=self.parser.gfmFootnotes||(self.parser.gfmFootnotes=[]);let labelStart;while(index2--){const token=self.events[index2][1];if(token.type==="labelImage"){labelStart=token;break}if(token.type==="gfmFootnoteCall"||token.type==="labelLink"||token.type==="label"||token.type==="image"||token.type==="link"){break}}return start;function start(code2){if(!labelStart||!labelStart._balanced){return nok(code2)}const id=normalizeIdentifier(self.sliceSerialize({start:labelStart.end,end:self.now()}));if(id.codePointAt(0)!==94||!defined.includes(id.slice(1))){return nok(code2)}effects.enter("gfmFootnoteCallLabelMarker");effects.consume(code2);effects.exit("gfmFootnoteCallLabelMarker");return ok3(code2)}}function resolveToPotentialGfmFootnoteCall(events,context){let index2=events.length;let labelStart;while(index2--){if(events[index2][1].type==="labelImage"&&events[index2][0]==="enter"){labelStart=events[index2][1];break}}events[index2+1][1].type="data";events[index2+3][1].type="gfmFootnoteCallLabelMarker";const call={type:"gfmFootnoteCall",start:Object.assign({},events[index2+3][1].start),end:Object.assign({},events[events.length-1][1].end)};const marker={type:"gfmFootnoteCallMarker",start:Object.assign({},events[index2+3][1].end),end:Object.assign({},events[index2+3][1].end)};marker.end.column++;marker.end.offset++;marker.end._bufferIndex++;const string3={type:"gfmFootnoteCallString",start:Object.assign({},marker.end),end:Object.assign({},events[events.length-1][1].start)};const chunk={type:"chunkString",contentType:"string",start:Object.assign({},string3.start),end:Object.assign({},string3.end)};const replacement=[events[index2+1],events[index2+2],["enter",call,context],events[index2+3],events[index2+4],["enter",marker,context],["exit",marker,context],["enter",string3,context],["enter",chunk,context],["exit",chunk,context],["exit",string3,context],events[events.length-2],events[events.length-1],["exit",call,context]];events.splice(index2,events.length-index2+1,...replacement);return events}function tokenizeGfmFootnoteCall(effects,ok3,nok){const self=this;const defined=self.parser.gfmFootnotes||(self.parser.gfmFootnotes=[]);let size=0;let data;return start;function start(code2){effects.enter("gfmFootnoteCall");effects.enter("gfmFootnoteCallLabelMarker");effects.consume(code2);effects.exit("gfmFootnoteCallLabelMarker");return callStart}function callStart(code2){if(code2!==94)return nok(code2);effects.enter("gfmFootnoteCallMarker");effects.consume(code2);effects.exit("gfmFootnoteCallMarker");effects.enter("gfmFootnoteCallString");effects.enter("chunkString").contentType="string";return callData}function callData(code2){if(size>999||code2===93&&!data||code2===null||code2===91||markdownLineEndingOrSpace(code2)){return nok(code2)}if(code2===93){effects.exit("chunkString");const token=effects.exit("gfmFootnoteCallString");if(!defined.includes(normalizeIdentifier(self.sliceSerialize(token)))){return nok(code2)}effects.enter("gfmFootnoteCallLabelMarker");effects.consume(code2);effects.exit("gfmFootnoteCallLabelMarker");effects.exit("gfmFootnoteCall");return ok3}if(!markdownLineEndingOrSpace(code2)){data=true}size++;effects.consume(code2);return code2===92?callEscape:callData}function callEscape(code2){if(code2===91||code2===92||code2===93){effects.consume(code2);size++;return callData}return callData(code2)}}function tokenizeDefinitionStart(effects,ok3,nok){const self=this;const defined=self.parser.gfmFootnotes||(self.parser.gfmFootnotes=[]);let identifier;let size=0;let data;return start;function start(code2){effects.enter("gfmFootnoteDefinition")._container=true;effects.enter("gfmFootnoteDefinitionLabel");effects.enter("gfmFootnoteDefinitionLabelMarker");effects.consume(code2);effects.exit("gfmFootnoteDefinitionLabelMarker");return labelAtMarker}function labelAtMarker(code2){if(code2===94){effects.enter("gfmFootnoteDefinitionMarker");effects.consume(code2);effects.exit("gfmFootnoteDefinitionMarker");effects.enter("gfmFootnoteDefinitionLabelString");effects.enter("chunkString").contentType="string";return labelInside}return nok(code2)}function labelInside(code2){if(size>999||code2===93&&!data||code2===null||code2===91||markdownLineEndingOrSpace(code2)){return nok(code2)}if(code2===93){effects.exit("chunkString");const token=effects.exit("gfmFootnoteDefinitionLabelString");identifier=normalizeIdentifier(self.sliceSerialize(token));effects.enter("gfmFootnoteDefinitionLabelMarker");effects.consume(code2);effects.exit("gfmFootnoteDefinitionLabelMarker");effects.exit("gfmFootnoteDefinitionLabel");return labelAfter}if(!markdownLineEndingOrSpace(code2)){data=true}size++;effects.consume(code2);return code2===92?labelEscape:labelInside}function labelEscape(code2){if(code2===91||code2===92||code2===93){effects.consume(code2);size++;return labelInside}return labelInside(code2)}function labelAfter(code2){if(code2===58){effects.enter("definitionMarker");effects.consume(code2);effects.exit("definitionMarker");if(!defined.includes(identifier)){defined.push(identifier)}return factorySpace(effects,whitespaceAfter,"gfmFootnoteDefinitionWhitespace")}return nok(code2)}function whitespaceAfter(code2){return ok3(code2)}}function tokenizeDefinitionContinuation(effects,ok3,nok){return effects.check(blankLine,ok3,effects.attempt(indent,ok3,nok))}function gfmFootnoteDefinitionEnd(effects){effects.exit("gfmFootnoteDefinition")}function tokenizeIndent2(effects,ok3,nok){const self=this;return factorySpace(effects,afterPrefix,"gfmFootnoteDefinitionIndent",4+1);function afterPrefix(code2){const tail=self.events[self.events.length-1];return tail&&tail[1].type==="gfmFootnoteDefinitionIndent"&&tail[2].sliceSerialize(tail[1],true).length===4?ok3(code2):nok(code2)}}function gfmStrikethrough(options){const options_=options||{};let single=options_.singleTilde;const tokenizer={name:"strikethrough",tokenize:tokenizeStrikethrough,resolveAll:resolveAllStrikethrough};if(single===null||single===void 0){single=true}return{text:{[126]:tokenizer},insideSpan:{null:[tokenizer]},attentionMarkers:{null:[126]}};function resolveAllStrikethrough(events,context){let index2=-1;while(++index2<events.length){if(events[index2][0]==="enter"&&events[index2][1].type==="strikethroughSequenceTemporary"&&events[index2][1]._close){let open=index2;while(open--){if(events[open][0]==="exit"&&events[open][1].type==="strikethroughSequenceTemporary"&&events[open][1]._open&&events[index2][1].end.offset-events[index2][1].start.offset===events[open][1].end.offset-events[open][1].start.offset){events[index2][1].type="strikethroughSequence";events[open][1].type="strikethroughSequence";const strikethrough={type:"strikethrough",start:Object.assign({},events[open][1].start),end:Object.assign({},events[index2][1].end)};const text4={type:"strikethroughText",start:Object.assign({},events[open][1].end),end:Object.assign({},events[index2][1].start)};const nextEvents=[["enter",strikethrough,context],["enter",events[open][1],context],["exit",events[open][1],context],["enter",text4,context]];const insideSpan2=context.parser.constructs.insideSpan.null;if(insideSpan2){splice(nextEvents,nextEvents.length,0,resolveAll(insideSpan2,events.slice(open+1,index2),context))}splice(nextEvents,nextEvents.length,0,[["exit",text4,context],["enter",events[index2][1],context],["exit",events[index2][1],context],["exit",strikethrough,context]]);splice(events,open-1,index2-open+3,nextEvents);index2=open+nextEvents.length-2;break}}}}index2=-1;while(++index2<events.length){if(events[index2][1].type==="strikethroughSequenceTemporary"){events[index2][1].type="data"}}return events}function tokenizeStrikethrough(effects,ok3,nok){const previous3=this.previous;const events=this.events;let size=0;return start;function start(code2){if(previous3===126&&events[events.length-1][1].type!=="characterEscape"){return nok(code2)}effects.enter("strikethroughSequenceTemporary");return more(code2)}function more(code2){const before=classifyCharacter(previous3);if(code2===126){if(size>1)return nok(code2);effects.consume(code2);size++;return more}if(size<2&&!single)return nok(code2);const token=effects.exit("strikethroughSequenceTemporary");const after=classifyCharacter(code2);token._open=!after||after===2&&Boolean(before);token._close=!before||before===2&&Boolean(after);return ok3(code2)}}}var EditMap2=class{constructor(){this.map=[];this.index=new Map}add(index2,remove,add){addImplementation2(this,index2,remove,add)}consume(events){this.map.sort(function(a,b){return a[0]-b[0]});if(this.map.length===0){return}let index2=this.map.length;const vecs=[];while(index2>0){index2-=1;vecs.push(events.slice(this.map[index2][0]+this.map[index2][1]),this.map[index2][2]);events.length=this.map[index2][0]}vecs.push(events.slice());events.length=0;let slice=vecs.pop();while(slice){for(const element2 of slice){events.push(element2)}slice=vecs.pop()}this.map.length=0;this.index.clear()}};function addImplementation2(editMap,at,remove,add){if(remove===0&&add.length===0){return}const existing=editMap.index.get(at);if(existing){existing[1]+=remove;existing[2].push(...add);return}const change=[at,remove,add];editMap.map.push(change);editMap.index.set(at,change)}function gfmTableAlign(events,index2){let inDelimiterRow=false;const align=[];while(index2<events.length){const event=events[index2];if(inDelimiterRow){if(event[0]==="enter"){if(event[1].type==="tableContent"){align.push(events[index2+1][1].type==="tableDelimiterMarker"?"left":"none")}}else if(event[1].type==="tableContent"){if(events[index2-1][1].type==="tableDelimiterMarker"){const alignIndex=align.length-1;align[alignIndex]=align[alignIndex]==="left"?"center":"right"}}else if(event[1].type==="tableDelimiterRow"){break}}else if(event[0]==="enter"&&event[1].type==="tableDelimiterRow"){inDelimiterRow=true}index2+=1}return align}function gfmTable(){return{flow:{null:{name:"table",tokenize:tokenizeTable,resolveAll:resolveTable}}}}function tokenizeTable(effects,ok3,nok){const self=this;let size=0;let sizeB=0;let seen;return start;function start(code2){let index2=self.events.length-1;while(index2>-1){const{type}=self.events[index2][1];if(type==="lineEnding"||type==="linePrefix"){index2--}else{break}}const tail=index2>-1?self.events[index2][1].type:null;const next=tail==="tableHead"||tail==="tableRow"?bodyRowStart:headRowBefore;if(next===bodyRowStart&&self.parser.lazy[self.now().line]){return nok(code2)}return next(code2)}function headRowBefore(code2){effects.enter("tableHead");effects.enter("tableRow");return headRowStart(code2)}function headRowStart(code2){if(code2===124){return headRowBreak(code2)}seen=true;sizeB+=1;return headRowBreak(code2)}function headRowBreak(code2){if(code2===null){return nok(code2)}if(markdownLineEnding(code2)){if(sizeB>1){sizeB=0;self.interrupt=true;effects.exit("tableRow");effects.enter("lineEnding");effects.consume(code2);effects.exit("lineEnding");return headDelimiterStart}return nok(code2)}if(markdownSpace(code2)){return factorySpace(effects,headRowBreak,"whitespace")(code2)}sizeB+=1;if(seen){seen=false;size+=1}if(code2===124){effects.enter("tableCellDivider");effects.consume(code2);effects.exit("tableCellDivider");seen=true;return headRowBreak}effects.enter("data");return headRowData(code2)}function headRowData(code2){if(code2===null||code2===124||markdownLineEndingOrSpace(code2)){effects.exit("data");return headRowBreak(code2)}effects.consume(code2);return code2===92?headRowEscape:headRowData}function headRowEscape(code2){if(code2===92||code2===124){effects.consume(code2);return headRowData}return headRowData(code2)}function headDelimiterStart(code2){self.interrupt=false;if(self.parser.lazy[self.now().line]){return nok(code2)}effects.enter("tableDelimiterRow");seen=false;if(markdownSpace(code2)){return factorySpace(effects,headDelimiterBefore,"linePrefix",self.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(code2)}return headDelimiterBefore(code2)}function headDelimiterBefore(code2){if(code2===45||code2===58){return headDelimiterValueBefore(code2)}if(code2===124){seen=true;effects.enter("tableCellDivider");effects.consume(code2);effects.exit("tableCellDivider");return headDelimiterCellBefore}return headDelimiterNok(code2)}function headDelimiterCellBefore(code2){if(markdownSpace(code2)){return factorySpace(effects,headDelimiterValueBefore,"whitespace")(code2)}return headDelimiterValueBefore(code2)}function headDelimiterValueBefore(code2){if(code2===58){sizeB+=1;seen=true;effects.enter("tableDelimiterMarker");effects.consume(code2);effects.exit("tableDelimiterMarker");return headDelimiterLeftAlignmentAfter}if(code2===45){sizeB+=1;return headDelimiterLeftAlignmentAfter(code2)}if(code2===null||markdownLineEnding(code2)){return headDelimiterCellAfter(code2)}return headDelimiterNok(code2)}function headDelimiterLeftAlignmentAfter(code2){if(code2===45){effects.enter("tableDelimiterFiller");return headDelimiterFiller(code2)}return headDelimiterNok(code2)}function headDelimiterFiller(code2){if(code2===45){effects.consume(code2);return headDelimiterFiller}if(code2===58){seen=true;effects.exit("tableDelimiterFiller");effects.enter("tableDelimiterMarker");effects.consume(code2);effects.exit("tableDelimiterMarker");return headDelimiterRightAlignmentAfter}effects.exit("tableDelimiterFiller");return headDelimiterRightAlignmentAfter(code2)}function headDelimiterRightAlignmentAfter(code2){if(markdownSpace(code2)){return factorySpace(effects,headDelimiterCellAfter,"whitespace")(code2)}return headDelimiterCellAfter(code2)}function headDelimiterCellAfter(code2){if(code2===124){return headDelimiterBefore(code2)}if(code2===null||markdownLineEnding(code2)){if(!seen||size!==sizeB){return headDelimiterNok(code2)}effects.exit("tableDelimiterRow");effects.exit("tableHead");return ok3(code2)}return headDelimiterNok(code2)}function headDelimiterNok(code2){return nok(code2)}function bodyRowStart(code2){effects.enter("tableRow");return bodyRowBreak(code2)}function bodyRowBreak(code2){if(code2===124){effects.enter("tableCellDivider");effects.consume(code2);effects.exit("tableCellDivider");return bodyRowBreak}if(code2===null||markdownLineEnding(code2)){effects.exit("tableRow");return ok3(code2)}if(markdownSpace(code2)){return factorySpace(effects,bodyRowBreak,"whitespace")(code2)}effects.enter("data");return bodyRowData(code2)}function bodyRowData(code2){if(code2===null||code2===124||markdownLineEndingOrSpace(code2)){effects.exit("data");return bodyRowBreak(code2)}effects.consume(code2);return code2===92?bodyRowEscape:bodyRowData}function bodyRowEscape(code2){if(code2===92||code2===124){effects.consume(code2);return bodyRowData}return bodyRowData(code2)}}function resolveTable(events,context){let index2=-1;let inFirstCellAwaitingPipe=true;let rowKind=0;let lastCell=[0,0,0,0];let cell=[0,0,0,0];let afterHeadAwaitingFirstBodyRow=false;let lastTableEnd=0;let currentTable;let currentBody;let currentCell;const map=new EditMap2;while(++index2<events.length){const event=events[index2];const token=event[1];if(event[0]==="enter"){if(token.type==="tableHead"){afterHeadAwaitingFirstBodyRow=false;if(lastTableEnd!==0){flushTableEnd(map,context,lastTableEnd,currentTable,currentBody);currentBody=void 0;lastTableEnd=0}currentTable={type:"table",start:Object.assign({},token.start),end:Object.assign({},token.end)};map.add(index2,0,[["enter",currentTable,context]])}else if(token.type==="tableRow"||token.type==="tableDelimiterRow"){inFirstCellAwaitingPipe=true;currentCell=void 0;lastCell=[0,0,0,0];cell=[0,index2+1,0,0];if(afterHeadAwaitingFirstBodyRow){afterHeadAwaitingFirstBodyRow=false;currentBody={type:"tableBody",start:Object.assign({},token.start),end:Object.assign({},token.end)};map.add(index2,0,[["enter",currentBody,context]])}rowKind=token.type==="tableDelimiterRow"?2:currentBody?3:1}else if(rowKind&&(token.type==="data"||token.type==="tableDelimiterMarker"||token.type==="tableDelimiterFiller")){inFirstCellAwaitingPipe=false;if(cell[2]===0){if(lastCell[1]!==0){cell[0]=cell[1];currentCell=flushCell(map,context,lastCell,rowKind,void 0,currentCell);lastCell=[0,0,0,0]}cell[2]=index2}}else if(token.type==="tableCellDivider"){if(inFirstCellAwaitingPipe){inFirstCellAwaitingPipe=false}else{if(lastCell[1]!==0){cell[0]=cell[1];currentCell=flushCell(map,context,lastCell,rowKind,void 0,currentCell)}lastCell=cell;cell=[lastCell[1],index2,0,0]}}}else if(token.type==="tableHead"){afterHeadAwaitingFirstBodyRow=true;lastTableEnd=index2}else if(token.type==="tableRow"||token.type==="tableDelimiterRow"){lastTableEnd=index2;if(lastCell[1]!==0){cell[0]=cell[1];currentCell=flushCell(map,context,lastCell,rowKind,index2,currentCell)}else if(cell[1]!==0){currentCell=flushCell(map,context,cell,rowKind,index2,currentCell)}rowKind=0}else if(rowKind&&(token.type==="data"||token.type==="tableDelimiterMarker"||token.type==="tableDelimiterFiller")){cell[3]=index2}}if(lastTableEnd!==0){flushTableEnd(map,context,lastTableEnd,currentTable,currentBody)}map.consume(context.events);index2=-1;while(++index2<context.events.length){const event=context.events[index2];if(event[0]==="enter"&&event[1].type==="table"){event[1]._align=gfmTableAlign(context.events,index2)}}return events}function flushCell(map,context,range,rowKind,rowEnd,previousCell){const groupName=rowKind===1?"tableHeader":rowKind===2?"tableDelimiter":"tableData";const valueName="tableContent";if(range[0]!==0){previousCell.end=Object.assign({},getPoint(context.events,range[0]));map.add(range[0],0,[["exit",previousCell,context]])}const now=getPoint(context.events,range[1]);previousCell={type:groupName,start:Object.assign({},now),end:Object.assign({},now)};map.add(range[1],0,[["enter",previousCell,context]]);if(range[2]!==0){const relatedStart=getPoint(context.events,range[2]);const relatedEnd=getPoint(context.events,range[3]);const valueToken={type:valueName,start:Object.assign({},relatedStart),end:Object.assign({},relatedEnd)};map.add(range[2],0,[["enter",valueToken,context]]);if(rowKind!==2){const start=context.events[range[2]];const end=context.events[range[3]];start[1].end=Object.assign({},end[1].end);start[1].type="chunkText";start[1].contentType="text";if(range[3]>range[2]+1){const a=range[2]+1;const b=range[3]-range[2]-1;map.add(a,b,[])}}map.add(range[3]+1,0,[["exit",valueToken,context]])}if(rowEnd!==void 0){previousCell.end=Object.assign({},getPoint(context.events,rowEnd));map.add(rowEnd,0,[["exit",previousCell,context]]);previousCell=void 0}return previousCell}function flushTableEnd(map,context,index2,table,tableBody){const exits=[];const related=getPoint(context.events,index2);if(tableBody){tableBody.end=Object.assign({},related);exits.push(["exit",tableBody,context])}table.end=Object.assign({},related);exits.push(["exit",table,context]);map.add(index2+1,0,exits)}function getPoint(events,index2){const event=events[index2];const side=event[0]==="enter"?"start":"end";return event[1][side]}var tasklistCheck={name:"tasklistCheck",tokenize:tokenizeTasklistCheck};function gfmTaskListItem(){return{text:{[91]:tasklistCheck}}}function tokenizeTasklistCheck(effects,ok3,nok){const self=this;return open;function open(code2){if(self.previous!==null||!self._gfmTasklistFirstContentOfListItem){return nok(code2)}effects.enter("taskListCheck");effects.enter("taskListCheckMarker");effects.consume(code2);effects.exit("taskListCheckMarker");return inside}function inside(code2){if(markdownLineEndingOrSpace(code2)){effects.enter("taskListCheckValueUnchecked");effects.consume(code2);effects.exit("taskListCheckValueUnchecked");return close}if(code2===88||code2===120){effects.enter("taskListCheckValueChecked");effects.consume(code2);effects.exit("taskListCheckValueChecked");return close}return nok(code2)}function close(code2){if(code2===93){effects.enter("taskListCheckMarker");effects.consume(code2);effects.exit("taskListCheckMarker");effects.exit("taskListCheck");return after}return nok(code2)}function after(code2){if(markdownLineEnding(code2)){return ok3(code2)}if(markdownSpace(code2)){return effects.check({tokenize:spaceThenNonSpace},ok3,nok)(code2)}return nok(code2)}}function spaceThenNonSpace(effects,ok3,nok){return factorySpace(effects,after,"whitespace");function after(code2){return code2===null?nok(code2):ok3(code2)}}function gfm(options){return combineExtensions([gfmAutolinkLiteral(),gfmFootnote(),gfmStrikethrough(options),gfmTable(),gfmTaskListItem()])}var codes={carriageReturn:-5,lineFeed:-4,carriageReturnLineFeed:-3,horizontalTab:-2,virtualSpace:-1,eof:null,nul:0,soh:1,stx:2,etx:3,eot:4,enq:5,ack:6,bel:7,bs:8,ht:9,lf:10,vt:11,ff:12,cr:13,so:14,si:15,dle:16,dc1:17,dc2:18,dc3:19,dc4:20,nak:21,syn:22,etb:23,can:24,em:25,sub:26,esc:27,fs:28,gs:29,rs:30,us:31,space:32,exclamationMark:33,quotationMark:34,numberSign:35,dollarSign:36,percentSign:37,ampersand:38,apostrophe:39,leftParenthesis:40,rightParenthesis:41,asterisk:42,plusSign:43,comma:44,dash:45,dot:46,slash:47,digit0:48,digit1:49,digit2:50,digit3:51,digit4:52,digit5:53,digit6:54,digit7:55,digit8:56,digit9:57,colon:58,semicolon:59,lessThan:60,equalsTo:61,greaterThan:62,questionMark:63,atSign:64,uppercaseA:65,uppercaseB:66,uppercaseC:67,uppercaseD:68,uppercaseE:69,uppercaseF:70,uppercaseG:71,uppercaseH:72,uppercaseI:73,uppercaseJ:74,uppercaseK:75,uppercaseL:76,uppercaseM:77,uppercaseN:78,uppercaseO:79,uppercaseP:80,uppercaseQ:81,uppercaseR:82,uppercaseS:83,uppercaseT:84,uppercaseU:85,uppercaseV:86,uppercaseW:87,uppercaseX:88,uppercaseY:89,uppercaseZ:90,leftSquareBracket:91,backslash:92,rightSquareBracket:93,caret:94,underscore:95,graveAccent:96,lowercaseA:97,lowercaseB:98,lowercaseC:99,lowercaseD:100,lowercaseE:101,lowercaseF:102,lowercaseG:103,lowercaseH:104,lowercaseI:105,lowercaseJ:106,lowercaseK:107,lowercaseL:108,lowercaseM:109,lowercaseN:110,lowercaseO:111,lowercaseP:112,lowercaseQ:113,lowercaseR:114,lowercaseS:115,lowercaseT:116,lowercaseU:117,lowercaseV:118,lowercaseW:119,lowercaseX:120,lowercaseY:121,lowercaseZ:122,leftCurlyBrace:123,verticalBar:124,rightCurlyBrace:125,tilde:126,del:127,byteOrderMarker:65279,replacementCharacter:65533};var constants={attentionSideAfter:2,attentionSideBefore:1,atxHeadingOpeningFenceSizeMax:6,autolinkDomainSizeMax:63,autolinkSchemeSizeMax:32,cdataOpeningString:"CDATA[",characterGroupPunctuation:2,characterGroupWhitespace:1,characterReferenceDecimalSizeMax:7,characterReferenceHexadecimalSizeMax:6,characterReferenceNamedSizeMax:31,codeFencedSequenceSizeMin:3,contentTypeContent:"content",contentTypeDocument:"document",contentTypeFlow:"flow",contentTypeString:"string",contentTypeText:"text",hardBreakPrefixSizeMin:2,htmlBasic:6,htmlCdata:5,htmlComment:2,htmlComplete:7,htmlDeclaration:4,htmlInstruction:3,htmlRawSizeMax:8,htmlRaw:1,linkResourceDestinationBalanceMax:32,linkReferenceSizeMax:999,listItemValueSizeMax:10,numericBaseDecimal:10,numericBaseHexadecimal:16,tabSize:4,thematicBreakMarkerCountMin:3,v8MaxSafeChunkSize:1e4};import{useSettledText,withImeGuard}from"@kanyun-ai-infra/band-plugin-react";import{useCallback,useEffect,useRef,useState}from"react";import{jsx as jsx2,jsxs as jsxs2}from"react/jsx-runtime";import{useEffect as useEffect3,useState as useState3}from"react";import{Fragment as Fragment2,createElement,useEffect as useEffect2,useState as useState2}from"react";import{jsx as jsx3,jsxs as jsxs3}from"react/jsx-runtime";import{jsx as jsx4,jsxs as jsxs4}from"react/jsx-runtime";import{Fragment as Fragment3,jsx as jsx5,jsxs as jsxs5}from"react/jsx-runtime";if(typeof document!=="undefined"&&document.head){const css='/* src/viewer-text.css */\n.band-viewer-text {\n height: 100%;\n overflow: auto;\n overscroll-behavior: contain;\n padding: 20px 24px 32px 30px;\n background: var(--panel);\n border-radius: 10px;\n line-height: 1.75;\n font-size: var(--fs-lead);\n}\n.band-viewer-text:where(.state) {\n font-size: var(--fs-meta);\n color: var(--muted);\n}\n.band-viewer-text-frame {\n display: flex;\n flex-direction: column;\n height: 100%;\n min-height: 0;\n}\n.band-viewer-text-frame > :where(.band-viewer-text) {\n flex: 1;\n min-height: 0;\n}\n.band-viewer-text-findbtn {\n display: grid;\n place-items: center;\n width: 28px;\n height: 28px;\n margin-top: -8px;\n margin-right: -10px;\n border: 0;\n border-radius: var(--r-sm);\n background: var(--panel);\n color: var(--muted);\n cursor: pointer;\n}\n.band-viewer-text-findbtn:hover {\n background: var(--fill-2);\n color: var(--ink);\n}\n.band-viewer-text-findbtn:focus-visible {\n outline: 2px solid var(--accent);\n outline-offset: -2px;\n}\n.band-viewer-text-findbtn svg,\n.band-viewer-text-find svg {\n width: 15px;\n height: 15px;\n display: block;\n fill: none;\n stroke: currentColor;\n stroke-width: 1.5;\n stroke-linecap: round;\n stroke-linejoin: round;\n}\n.band-viewer-text:focus {\n outline: none;\n}\n.band-viewer-text-findlayer {\n position: sticky;\n top: -12px;\n z-index: 3;\n height: 0;\n display: flex;\n justify-content: flex-end;\n align-items: flex-start;\n}\n.band-viewer-text-find {\n display: flex;\n align-items: center;\n gap: 2px;\n width: min(340px, 100%);\n box-sizing: border-box;\n margin-top: -12px;\n margin-right: -14px;\n padding: 4px 4px 4px 10px;\n border-radius: var(--r);\n background: var(--panel);\n box-shadow: var(--shadow-pop);\n font-size: var(--fs-ui);\n line-height: 1.4;\n color: var(--muted);\n animation: band-viewer-text-find-in var(--sixteenth) var(--ease);\n}\n@keyframes band-viewer-text-find-in {\n from {\n opacity: 0;\n transform: translateY(-4px);\n }\n}\n.band-viewer-text-find input {\n flex: 1;\n min-width: 0;\n margin-left: 6px;\n border: 0;\n padding: 4px 0;\n background: none;\n color: var(--ink);\n font: inherit;\n outline: none;\n}\n.band-viewer-text-find input::placeholder {\n color: var(--muted);\n}\n.band-viewer-text-find output {\n flex: none;\n padding: 0 6px;\n font-variant-numeric: tabular-nums;\n color: var(--muted);\n}\n.band-viewer-text-find output.none {\n color: var(--bad);\n}\n.band-viewer-text-find-btn {\n flex: none;\n display: grid;\n place-items: center;\n width: 26px;\n height: 26px;\n border: 0;\n border-radius: var(--r-sm);\n background: none;\n color: var(--muted);\n cursor: pointer;\n}\n.band-viewer-text-find-btn:hover:not(:disabled) {\n background: var(--fill);\n color: var(--ink);\n}\n.band-viewer-text-find-btn:focus-visible {\n outline: 2px solid var(--accent);\n outline-offset: -2px;\n}\n.band-viewer-text-find-btn:disabled {\n color: var(--muted);\n opacity: 0.5;\n cursor: default;\n}\n::highlight(band-viewer-text-find) {\n background-color: var(--warn-soft);\n}\n::highlight(band-viewer-text-find-current) {\n background-color: var(--warn);\n color: var(--panel);\n}\n@media (prefers-reduced-motion: reduce) {\n .band-viewer-text-find {\n animation: none;\n }\n}\n.band-viewer-text-toolbar {\n display: flex;\n justify-content: flex-end;\n flex-wrap: wrap;\n gap: 4px;\n padding-bottom: 6px;\n}\n.band-viewer-text-toolbar:where([hidden]) {\n display: none;\n}\n.band-viewer-text-block {\n position: relative;\n max-width: 68ch;\n padding: 2px 0;\n}\n.band-viewer-text-aside {\n display: flex;\n flex-wrap: wrap;\n gap: 4px 12px;\n}\n.band-viewer-text-aside:has(> .band-viewer-text-aside-item:not(:empty)) {\n margin: -2px 0 6px;\n}\n.band-viewer-text-aside-item {\n min-width: 0;\n max-width: 100%;\n}\n.band-viewer-text-aside-item:empty {\n display: none;\n}\n.band-viewer-text-content {\n min-width: 0;\n}\n.band-viewer-text-content > :where(*) {\n margin: 6px 0;\n}\n.band-viewer-text-content h1 {\n font-size: var(--fs-h2);\n line-height: 1.35;\n font-weight: 600;\n}\n.band-viewer-text-content :where(h2) {\n margin-top: 18px;\n font-size: var(--fs-lead);\n font-weight: 600;\n}\n.band-viewer-text-content :where(h3, h4, h5, h6) {\n margin-top: 12px;\n font-size: var(--fs-body);\n font-weight: 600;\n}\n.band-viewer-text-content :where(h5, h6) {\n color: var(--muted);\n}\n.band-viewer-text-content blockquote {\n padding-left: 12px;\n border-left: 3px solid var(--rule-strong);\n color: var(--muted);\n}\n.band-viewer-text-content :where(ul, ol) {\n padding-left: 1.5em;\n}\n.band-viewer-text-content :where(li + li, li > ul, li > ol) {\n margin-top: 2px;\n}\n.band-viewer-text-tasks {\n list-style: none;\n}\n.band-viewer-text-content :where(.band-viewer-text-tasks) {\n padding-left: 0.25em;\n}\n.band-viewer-text-task {\n display: flex;\n gap: 8px;\n align-items: baseline;\n}\n.band-viewer-text-content hr {\n height: 0;\n margin: 16px 0;\n border: 0;\n border-top: var(--hairline) solid var(--rule-strong);\n}\n.band-viewer-text-content :where(:not(pre) > code) {\n padding: 0 4px;\n border-radius: 4px;\n background: var(--fill);\n font-family: var(--mono);\n font-size: 0.9em;\n}\n.band-viewer-text-a {\n padding: 0;\n border: 0;\n background: none;\n color: var(--accent-text);\n font: inherit;\n text-decoration: none;\n cursor: pointer;\n}\n.band-viewer-text-a:where(:hover) {\n text-decoration: underline;\n}\n.band-viewer-text-a:where(:focus-visible) {\n outline: none;\n border-radius: 3px;\n box-shadow: 0 0 0 2px var(--accent);\n}\n.band-viewer-text-img {\n display: block;\n max-width: 100%;\n height: auto;\n border-radius: 8px;\n}\n.band-viewer-text-imgalt,\n.band-viewer-text-imglink {\n font-size: var(--fs-ui);\n}\n.band-viewer-text-imgalt {\n color: var(--muted);\n}\n.band-viewer-text-table {\n max-width: 100%;\n overflow-x: auto;\n border-radius: 6px;\n}\n.band-viewer-text-table:where(:focus-visible) {\n outline: none;\n box-shadow: 0 0 0 2px var(--accent);\n}\n.band-viewer-text-table table {\n width: max-content;\n min-width: 100%;\n border-collapse: collapse;\n font-size: var(--fs-body);\n line-height: 1.6;\n}\n.band-viewer-text-table :where(th, td) {\n max-width: 32ch;\n overflow-wrap: break-word;\n padding: 6px 12px;\n border-bottom: var(--hairline) solid var(--rule-strong);\n text-align: left;\n vertical-align: top;\n}\n.band-viewer-text-table :where(th) {\n font-weight: 600;\n white-space: nowrap;\n}\n.band-viewer-text-code {\n margin: 8px 0;\n border-radius: 8px;\n background: var(--sunk);\n box-shadow: inset 0 0 0 1px var(--rule);\n overflow: hidden;\n}\n.band-viewer-text-code figcaption {\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: 2px 4px 0 12px;\n font-size: var(--fs-meta);\n color: var(--muted);\n}\n.band-viewer-text-code pre {\n margin: 0;\n padding: 4px 12px 10px;\n overflow: auto;\n font-family: var(--mono);\n font-size: var(--fs-ui);\n line-height: 1.6;\n}\n.band-viewer-text-fnref {\n font-size: var(--fs-meta);\n color: var(--accent-text);\n}\n.band-viewer-text-footnotes {\n margin-top: 20px;\n padding-top: 8px;\n border-top: var(--hairline) solid var(--rule);\n font-size: var(--fs-ui);\n color: var(--muted);\n}\n.band-viewer-text-footnotes ol {\n padding-left: 1.5em;\n}\n:where(.band-viewer-text.plain) .band-viewer-text-content p {\n white-space: pre-wrap;\n font-family: var(--mono);\n font-size: var(--fs-ui);\n}\n.band-viewer-text-files {\n display: flex;\n flex-wrap: wrap;\n margin-bottom: 12px;\n}\n.band-viewer-text-empty {\n font-size: var(--fs-ui);\n color: var(--muted);\n}\n.band-viewer-text-more {\n display: flex;\n flex-wrap: wrap;\n gap: 8px;\n align-items: center;\n margin-top: 16px;\n font-size: var(--fs-ui);\n color: var(--muted);\n}\n.band-viewer-text-add {\n position: absolute;\n top: 4px;\n left: -27px;\n display: grid;\n place-items: center;\n box-sizing: border-box;\n width: 22px;\n height: 22px;\n padding: 0;\n border: 1px solid var(--rule);\n border-radius: 50%;\n background: var(--panel);\n color: var(--muted);\n cursor: pointer;\n opacity: 0;\n}\n.band-viewer-text-add svg,\n.band-viewer-text-bubble svg {\n display: block;\n width: 14px;\n height: 14px;\n fill: none;\n stroke: currentColor;\n stroke-width: 1.5;\n stroke-linecap: round;\n stroke-linejoin: round;\n}\n.band-viewer-text-add:where(:hover) {\n border-color: var(--rule-strong);\n color: var(--ink);\n}\n.band-viewer-text-add:where(:focus-visible) {\n outline: 2px solid var(--accent);\n outline-offset: 1px;\n}\n.band-viewer-text-bubble {\n position: absolute;\n z-index: 4;\n translate: -50% -100%;\n box-shadow: var(--shadow-pop);\n animation: band-viewer-text-bubble-in var(--sixteenth) var(--ease);\n}\n.band-viewer-text-bubble:where([data-below]) {\n translate: -50% 0;\n}\n@keyframes band-viewer-text-bubble-in {\n from {\n opacity: 0;\n }\n}\n@media (prefers-reduced-motion: reduce) {\n .band-viewer-text-bubble {\n animation: none;\n }\n}\n@media (hover: none) {\n .band-viewer-text-add {\n opacity: 0.6;\n }\n}\n:where(.band-viewer-text-block:hover) .band-viewer-text-add,\n.band-viewer-text-add:where(:focus-visible) {\n opacity: 1;\n}\n.band-viewer-text-block:where([data-compare])::before {\n content: "";\n position: absolute;\n inset: 2px auto 2px -10px;\n width: 3px;\n border-radius: 2px;\n background: var(--muted);\n}\n.band-viewer-text-block:where([data-compare=added])::before {\n background: var(--accent);\n}\n.band-viewer-text[data-text-commenting=true] [data-text-comment-start] {\n cursor: crosshair;\n}\n.band-viewer-text [data-text-comment-hover] {\n outline: 1.5px solid var(--accent);\n outline-offset: 3px;\n border-radius: 3px;\n background: color-mix(in srgb, var(--accent) 9%, transparent);\n}\n.band-viewer-text-data {\n margin: 0;\n white-space: pre-wrap;\n overflow-wrap: anywhere;\n font-family: var(--mono);\n font-size: var(--fs-ui);\n line-height: 1.6;\n}\n.band-viewer-text-csv :where(td) {\n white-space: pre-wrap;\n}\n';let el=document.head.querySelector('style[data-band-style="@kanyun-ai-infra/band-viewer-text"]');if(!el){el=document.createElement("style");el.setAttribute("data-band-style","@kanyun-ai-infra/band-viewer-text");document.head.prepend(el)}el.textContent=css}function nextBubble(j){if(j.phase==="done")return null;if(j.baseBelow)return null;if(!j.occluded)return null;if(j.phase==="design"){return j.otherFits?{side:"below",phase:"flipped"}:{side:"above",phase:"done"}}return{side:"above",phase:"done"}}var SRC_START="data-src-start";var SRC_END="data-src-end";function srcProps(node2){const s=node2.position?.start.offset;const e=node2.position?.end.offset;return typeof s==="number"&&typeof e==="number"?{[SRC_START]:s,[SRC_END]:e}:{}}var WINDOW=16;function alignOffsets(text4,source,base){const at=source.indexOf(text4);if(at>=0)return Array.from({length:text4.length+1},(_,i)=>base+at+i);const map=[];let j=0;for(let i=0;i<text4.length;i++){const limit=Math.min(source.length,j+WINDOW);let k=j;while(k<limit&&source[k]!==text4[i])k++;if(k<limit){map.push(base+k);j=k+1}else map.push(base+j)}map.push(base+j);return map}var cache=new WeakMap;function segOf(el,source){const start=Number(el.getAttribute(SRC_START));const end=Number(el.getAttribute(SRC_END));if(!Number.isInteger(start)||!Number.isInteger(end)||end<start)return null;const text4=el.textContent??"";const hit=cache.get(el);if(hit&&hit.source===source&&hit.seg.text===text4&&hit.seg.start===start)return hit.seg;const seg={el,start,end,text:text4,map:alignOffsets(text4,source.slice(start,end),start)};cache.set(el,{source,seg});return seg}function segmentsIn(roots,source){const out=[];for(const root of roots){for(const el of root.querySelectorAll(`[${SRC_START}]`)){const seg=segOf(el,source);if(seg)out.push(seg)}}return out}function charIndex(seg,node2,offset){const r=seg.el.ownerDocument.createRange();r.selectNodeContents(seg.el);r.setEnd(node2,offset);return r.toString().length}function selectionToSource(range,roots,source){let first=null;let last=null;for(const seg of segmentsIn(roots,source)){if(!range.intersectsNode(seg.el))continue;const a=seg.el.contains(range.startContainer)?charIndex(seg,range.startContainer,range.startOffset):0;const b=seg.el.contains(range.endContainer)?charIndex(seg,range.endContainer,range.endOffset):seg.text.length;if(b<=a)continue;if(!first)first={seg,a};last={seg,b}}if(!first||!last)return null;const start=first.a>0?first.seg.map[first.a-1]+1:first.seg.map[0];const end=last.seg.map[last.b-1]+1;if(end<=start)return null;return{start,end,text:range.toString()}}function pieces(seg,a,b){const doc=seg.el.ownerDocument;const walker=doc.createTreeWalker(seg.el,4);const out=[];let at=0;for(let n=walker.nextNode();n;n=walker.nextNode()){const len=n.data.length;const s=Math.max(a,at);const e=Math.min(b,at+len);if(e>s){const r=doc.createRange();r.setStart(n,s-at);r.setEnd(n,e-at);out.push(r)}at+=len;if(at>=b)break}return out}function firstAtOrAfter(map,x){const n=map.length-1;for(let i=0;i<n;i++)if(map[i]>=x)return i;return n}function sourceToBoxes(roots,source,start,end){const rects=[];for(const seg of segmentsIn(roots,source)){if(seg.end<=start||seg.start>=end)continue;const a=firstAtOrAfter(seg.map,start);const b=firstAtOrAfter(seg.map,end);for(const r of pieces(seg,a,b)){for(const box of r.getClientRects?.()??[]){if(box.width>0&&box.height>0)rects.push(box)}}}return mergeLines(rects)}function mergeLines(rects){const out=[];for(const r of rects){const prev=out.at(-1);if(prev){const overlap=Math.min(prev.bottom,r.bottom)-Math.max(prev.top,r.top);const minH=Math.min(prev.bottom-prev.top,r.bottom-r.top);const gap=r.left-prev.right;if(overlap>minH/2&&gap<=2&&gap>=-(prev.right-prev.left)){out[out.length-1]={left:Math.min(prev.left,r.left),top:Math.min(prev.top,r.top),right:Math.max(prev.right,r.right),bottom:Math.max(prev.bottom,r.bottom)};continue}}out.push({left:r.left,top:r.top,right:r.right,bottom:r.bottom})}return out}var COMMENT_START="data-text-comment-start";var COMMENT_END="data-text-comment-end";var HOVER="data-text-comment-hover";function commentProps(node2){const start=node2.position?.start.offset;const end=node2.position?.end.offset;return typeof start==="number"&&typeof end==="number"?{[COMMENT_START]:start,[COMMENT_END]:end}:{}}function readTextSelection(article,source){const sel=article.ownerDocument.getSelection();if(!sel||sel.isCollapsed||!sel.rangeCount)return null;const range=sel.getRangeAt(0);const roots=[...article.querySelectorAll(".band-viewer-text-content")];if(![range.startContainer,range.endContainer].every(n=>roots.some(r=>r.contains(n))))return null;const pick=selectionToSource(range,roots,source);return pick?.text.trim()?pick:null}function bindCommentMode(article,source,comment){let hovered=null;let saved=null;let pressed=null;const targetOf=target=>{if(!(target instanceof Element))return null;const block=target.closest(`[${COMMENT_START}]`);return block&&article.contains(block)&&block.closest(".band-viewer-text-content")?block:null};const selection=()=>readTextSelection(article,source);const hover=event=>{const next=targetOf(event.target);if(next===hovered)return;hovered?.removeAttribute(HOVER);hovered=next;hovered?.setAttribute(HOVER,"")};const leave=()=>{hovered?.removeAttribute(HOVER);hovered=null};const down=event=>{saved=selection();pressed={x:event.clientX,y:event.clientY}};const cancel=()=>{pressed=null;saved=null};const click=event=>{const block=targetOf(event.target);if(!block||event.button!==0)return;const pointer=event.detail>0;const dragged=pointer&&pressed&&Math.hypot(event.clientX-pressed.x,event.clientY-pressed.y)>=4;pressed=null;if(dragged){saved=null;return}const start=Number(block.getAttribute(COMMENT_START));const end=Number(block.getAttribute(COMMENT_END));const selected=selection()??(pointer?saved:null);const pick=selected&&selected.start<end&&selected.end>start?selected:{start,end,text:block.textContent??""};saved=null;if(!Number.isInteger(pick.start)||!Number.isInteger(pick.end)||pick.end<=pick.start)return;event.preventDefault();event.stopPropagation();leave();article.ownerDocument.getSelection()?.removeAllRanges();comment(pick)};article.addEventListener("pointerover",hover);article.addEventListener("pointerleave",leave);article.addEventListener("pointerdown",down,true);article.ownerDocument.addEventListener("pointercancel",cancel,true);article.addEventListener("click",click,true);return()=>{leave();article.removeEventListener("pointerover",hover);article.removeEventListener("pointerleave",leave);article.removeEventListener("pointerdown",down,true);article.ownerDocument.removeEventListener("pointercancel",cancel,true);article.removeEventListener("click",click,true)}}var MAX_DIFF_BLOCKS=2500;var norm=s=>s.replace(/\s+/g," ").trim();function diffBlocks(a,b){if(a.length>MAX_DIFF_BLOCKS||b.length>MAX_DIFF_BLOCKS)return null;const x=a.map(norm);const y=b.map(norm);const w=y.length+1;const dp=new Uint32Array((x.length+1)*w);for(let i2=x.length-1;i2>=0;i2--){for(let j2=y.length-1;j2>=0;j2--){dp[i2*w+j2]=x[i2]===y[j2]?(dp[(i2+1)*w+j2+1]??0)+1:Math.max(dp[(i2+1)*w+j2]??0,dp[i2*w+j2+1]??0)}}const removed=new Set;const added=new Set;let i=0;let j=0;while(i<x.length&&j<y.length){if(x[i]===y[j]){i++;j++}else if((dp[(i+1)*w+j]??0)>=(dp[i*w+j+1]??0)){removed.add(i++)}else{added.add(j++)}}while(i<x.length)removed.add(i++);while(j<y.length)added.add(j++);return{removed,added}}var groups=new Map;function joinTextCompare(artifactId,peer){let group=groups.get(artifactId);if(!group){group=new Set;groups.set(artifactId,group)}const members=group;members.add(peer);const others=()=>[...members].filter(p=>p!==peer);for(const p of others())p.changed();return{others,notify(){for(const p of others())p.changed()},scroll(ratio){for(const p of others())p.scrollTo(ratio)},leave(){members.delete(peer);if(members.size===0&&groups.get(artifactId)===members)groups.delete(artifactId);for(const p of members)p.changed()}}}function marksAgainst(me,mine,other){const out=new Map;const theirs=other?.blocks()??null;if(!mine||!theirs||!other||other.versionId===me.versionId)return out;const iAmNew=me.createdAt>other.createdAt;const d=iAmNew?diffBlocks(theirs,mine):diffBlocks(mine,theirs);if(!d)return out;for(const i of iAmNew?d.added:d.removed)out.set(i,iAmNew?"added":"removed");return out}var BOM=String.fromCharCode(65279);var stripBom=s=>s.startsWith(BOM)?s.slice(1):s;function formatJson(src){const s=stripBom(src);try{JSON.parse(s)}catch{return null}let out="";let depth=0;const newline=()=>`
2
- ${" ".repeat(depth)}`;for(let i=0;i<s.length;i++){const c=s[i];if(c==='"'){let j=i+1;while(j<s.length&&s[j]!=='"')j+=s[j]==="\\"?2:1;out+=s.slice(i,j+1);i=j}else if(c==="{"||c==="["){let j=i+1;while(j<s.length&&/\s/.test(s[j]))j++;if(s[j]===(c==="{"?"}":"]")){out+=c==="{"?"{}":"[]";i=j}else{depth++;out+=c+newline()}}else if(c==="}"||c==="]"){depth--;out+=newline()+c}else if(c===","){out+=`,${newline()}`}else if(c===":"){out+=": "}else if(!/\s/.test(c)){out+=c}}return out}function parseCsv(src){const s=stripBom(src);const rows=[];let row=[];let at=0;const n=s.length;if(n===0)return rows;for(;;){let field="";if(s[at]==='"'){at++;for(;;){const q=s.indexOf('"',at);if(q<0)return null;field+=s.slice(at,q);if(s[q+1]==='"'){field+='"';at=q+2}else{at=q+1;break}}if(at<n&&s[at]!==","&&s[at]!=="\n"&&s[at]!=="\r")return null}else{let end=at;while(end<n&&s[end]!==","&&s[end]!=="\n"&&s[end]!=="\r")end++;field=s.slice(at,end);at=end}row.push(field);if(at>=n)break;if(s[at]===","){at++;continue}at+=s[at]==="\r"&&s[at+1]==="\n"?2:1;rows.push(row);row=[];if(at>=n)return rows}rows.push(row);return rows}var DATA_LIMIT=2e5;function DataBody({text:text4,format}){const content3=useMemo(()=>body(text4,format),[text4,format]);return jsx("div",{className:"band-viewer-text-content",children:content3})}function body(text4,format){if(text4.length>DATA_LIMIT)return jsxs(Fragment,{children:[jsxs("p",{className:"band-viewer-text-empty",children:["\u6587\u4EF6\u8F83\u5927\uFF0C\u53EA\u663E\u793A\u5F00\u5934 ",DATA_LIMIT/1e4," \u4E07\u5B57\u7684\u539F\u6587\uFF0C\u4E0D\u6392\u7248"]}),jsx("pre",{className:"band-viewer-text-data",children:text4.slice(0,DATA_LIMIT)})]});if(format==="csv"){const rows=parseCsv(text4);if(rows&&rows.length>0)return jsx(CsvTable,{rows})}else{const pretty=formatJson(text4);if(pretty!==null)return jsx("pre",{className:"band-viewer-text-data",children:pretty})}if(!text4.trim())return jsx("p",{className:"band-viewer-text-empty",children:"\u8FD9\u4EFD\u6587\u4EF6\u662F\u7A7A\u7684"});return jsx("pre",{className:"band-viewer-text-data",children:text4})}function CsvTable({rows}){const cols=rows.reduce((n,r)=>Math.max(n,r.length),0);const cells=(r,Tag)=>Array.from({length:cols},(_,i)=>jsx(Tag,{children:r[i]??""},i));const[head=[],...rest]=rows;return jsx("div",{className:"band-viewer-text-table band-viewer-text-csv",tabIndex:0,children:jsxs("table",{children:[jsx("thead",{children:jsx("tr",{children:cells(head,"th")})}),rest.length>0&&jsx("tbody",{children:rest.map((r,i)=>jsx("tr",{children:cells(r,"td")},i))})]})})}var cjkCharacter=new RegExp(["\\p{Script_Extensions=Han}","\\p{Script_Extensions=Hiragana}","\\p{Script_Extensions=Katakana}","\\p{Script_Extensions=Hangul}","\\p{Script_Extensions=Bopomofo}"].join("|"),"u");function isCjkCharacter(code2){return code2!==null&&code2>=0&&cjkCharacter.test(String.fromCodePoint(code2))}var tokenizeCjkFriendlyAttention=function(effects,ok3,nok){const configuredAttentionMarkers=this.parser.constructs.attentionMarkers.null;if(configuredAttentionMarkers===void 0){throw new Error("micromark CommonMark attention markers are unavailable")}const attentionMarkers2=configuredAttentionMarkers;const previous3=this.previous;const before=classifyCharacter(previous3);let marker=codes.eof;return start;function start(code2){if(code2!==codes.asterisk)return nok(code2);marker=code2;effects.enter("attentionSequence");return inside(code2)}function inside(code2){if(code2===marker){effects.consume(code2);return inside}const token=effects.exit("attentionSequence");const after=classifyCharacter(code2);const open=!after||after===constants.characterGroupPunctuation&&Boolean(before)||attentionMarkers2.includes(code2);const commonMarkClose=!before||before===constants.characterGroupPunctuation&&Boolean(after)||attentionMarkers2.includes(previous3);const markerCount=token.end.offset-token.start.offset;const cjkStrongClose=markerCount>=2&&unicodePunctuation(previous3)&&isCjkCharacter(code2);const close=commonMarkClose||cjkStrongClose;token._open=open;token._close=close;return ok3(code2)}};var cjkFriendlyAttention={name:"cjkFriendlyAttention",resolveAll:attention.resolveAll,tokenize:tokenizeCjkFriendlyAttention};var cjkFriendlyStrongExtension={text:{[codes.asterisk]:cjkFriendlyAttention}};function cjkFriendlyStrong(){return cjkFriendlyStrongExtension}var TEXT_MIME=/^text\/(markdown|plain)/;var TEXT_EXT=/\.(md|markdown|txt)$/i;var MARKDOWN=(path2,mime)=>/^text\/markdown/.test(mime)||/\.(md|markdown)$/i.test(path2);var DATA_MIME=/^(application\/json|text\/csv)\b/;var DATA_EXT=/\.(json|csv)$/i;var isText=e=>TEXT_MIME.test(e.mime)||TEXT_EXT.test(e.path);var isData=e=>!isText(e)&&(DATA_MIME.test(e.mime)||DATA_EXT.test(e.path));function textEntries(v){return[...v.entries.filter(isText),...v.entries.filter(isData)].map(e=>e.path)}function dataFormat(v,path2){const e=v.entries.find(x=>x.path===path2);if(!e||!isData(e))return null;if(/^application\/json\b/.test(e.mime))return"json";if(/^text\/csv\b/.test(e.mime))return"csv";return/\.json$/i.test(e.path)?"json":"csv"}function textEntry(v){const all2=textEntries(v);const named=all2.filter(p=>/(^|\/)(readme|index)\.(md|markdown)$/i.test(p)).sort((a,b)=>a.split("/").length-b.split("/").length);return named[0]??all2[0]??null}function legacyEntry(v){return v.entries.find(e=>TEXT_MIME.test(e.mime))?.path??v.entries.find(e=>TEXT_EXT.test(e.path))?.path??null}function isMarkdown(v,path2){const e=v.entries.find(x=>x.path===path2);return MARKDOWN(path2,e?.mime??"")}function parseDoc(src,format){if(format==="plain")return{format,source:src,...plainBlocks(src)};const root=fromMarkdown(src,{extensions:[gfm(),cjkFriendlyStrong()],mdastExtensions:[gfmFromMarkdown()]});const definitions=new Map;const footnotes=new Map;collectTargets(root.children,definitions,footnotes);const blocks=[];for(const node2 of root.children){if(node2.type==="definition"||node2.type==="footnoteDefinition")continue;const start=node2.position?.start.offset??0;const end=node2.position?.end.offset??start;const headingId=node2.type==="heading"?takeHeadingId(node2,src):void 0;const text4=node2.type==="html"?node2.value:toString(node2);blocks.push({node:node2,start,end,text:lf(text4).trim(),...headingId?{headingId}:{}})}return{format,source:src,blocks,definitions,footnotes}}var lf=s=>s.replace(/\r\n?/g,"\n");var HEADING_ID=/[ \t]*\{#([a-z0-9][a-z0-9-]{0,63})\}$/;function takeHeadingId(node2,src){const last=node2.children.at(-1);if(last?.type!=="text")return void 0;const m=HEADING_ID.exec(last.value);const end=last.position?.end.offset;if(!m||typeof end!=="number"||!last.position)return void 0;const tail=m[0];if(src.slice(end-tail.length,end)!==tail)return void 0;last.value=last.value.slice(0,-tail.length);last.position={start:last.position.start,end:{...last.position.end,offset:end-tail.length,column:last.position.end.column-tail.length}};if(last.value==="")node2.children.pop();return m[1]}function plainBlocks(src){const blocks=[];let start=-1;let end=0;const flush=()=>{if(start<0)return;const value=lf(src.slice(start,end));const position2={start:{line:1,column:1,offset:start},end:{line:1,column:1,offset:end}};blocks.push({node:{type:"paragraph",position:position2,children:[{type:"text",value,position:position2}]},start,end,text:value.trim()});start=-1};for(let at=0;at<=src.length;){const nl=src.indexOf("\n",at);const lineEnd=nl<0?src.length:nl;const contentEnd=lineEnd>at&&src[lineEnd-1]==="\r"?lineEnd-1:lineEnd;if(src.slice(at,contentEnd).trim()){if(start<0)start=at;end=contentEnd}else flush();if(nl<0)break;at=nl+1}flush();return{blocks,definitions:new Map,footnotes:new Map}}function collectTargets(nodes,definitions,footnotes){for(const node2 of nodes){if(node2.type==="definition"){const id=node2.identifier.toUpperCase();if(!definitions.has(id))definitions.set(id,node2)}else if(node2.type==="footnoteDefinition"){const id=node2.identifier.toUpperCase();if(!footnotes.has(id))footnotes.set(id,node2)}if("children"in node2)collectTargets(node2.children,definitions,footnotes)}}var CONTEXT=32;function blockAnchor(doc,i,path2){const b=doc.blocks[i];if(!b)throw new Error(`\u6CA1\u6709\u7B2C ${i} \u5757`);return rangeAnchor(doc,path2,b.start,b.end,b.text,`\u7B2C ${i+1} \u5757`)}var LABEL_MAX=40;function rangeAnchor(doc,path2,start,end,shown,fallback="\u9009\u4E2D\u7684\u6587\u5B57"){let s=start;let e=end;while(s<e&&/\s/.test(doc.source[s]??""))s++;while(e>s&&/\s/.test(doc.source[e-1]??""))e--;if(s===e)[s,e]=[start,end];const exact=doc.source.slice(s,e);const prefix=doc.source.slice(Math.max(0,s-CONTEXT),s);const suffix=doc.source.slice(e,e+CONTEXT);const text4=lf(shown).trim();return{payload:{path:path2,label:text4.replace(/\s+/g," ").slice(0,LABEL_MAX)||fallback,quote:{exact,...prefix?{prefix}:{},...suffix?{suffix}:{}},pos:{start:s,end:e}},snapshot:text4}}function blockAt(doc,at){const i=doc.blocks.findIndex(b=>b.start<=at&&at<b.end);return i<0?null:i}function placeOf(anchor,doc,ctx){if(anchor.kind!=="text-range")return{at:"none"};const p=anchor.payload;const file=typeof p.path==="string"?p.path:ctx.legacyPath??ctx.path;if(file!==ctx.path){return ctx.paths.includes(file)?{at:"elsewhere",path:file}:{at:"none"}}const quote=p.quote;if(quote&&typeof quote.exact==="string"){const pos=p.pos;const placed=relocateTextRange({quote:{exact:quote.exact,...typeof quote.prefix==="string"?{prefix:quote.prefix}:{},...typeof quote.suffix==="string"?{suffix:quote.suffix}:{}},...typeof pos?.start==="number"&&typeof pos.end==="number"?{pos:{start:pos.start,end:pos.end}}:{}},doc.source,at=>blockAt(doc,at)!==null);if(placed.status==="orphan")return{at:"none"};const block=blockAt(doc,placed.start);return block===null?{at:"none"}:{at:"block",block,start:placed.start,end:placed.end,status:placed.status}}const n=typeof p.block==="number"?p.block:null;const whole=i=>{const b=doc.blocks[i];return{at:"block",block:i,start:b.start,end:b.end}};if(anchor.snapshot===void 0){return anchor.versionId===ctx.versionId&&n!==null&&doc.blocks[n]?whole(n):{at:"none"}}const snap=lf(anchor.snapshot).trim();const from=n??0;let best=null;doc.blocks.forEach((b,i)=>{if(b.text!==snap&&lf(doc.source.slice(b.start,b.end)).trim()!==snap)return;if(best===null||Math.abs(i-from)<Math.abs(best-from))best=i});return best===null?{at:"none"}:whole(best)}function resolvePath(from,href){const clean=href.split(/[?#]/)[0]??"";if(!clean)return null;let decoded;try{decoded=decodeURIComponent(clean)}catch{return null}const parts=decoded.startsWith("/")?[]:from.split("/").slice(0,-1);for(const seg of decoded.split("/")){if(seg===""||seg===".")continue;if(seg===".."){if(parts.length===0)return null;parts.pop()}else parts.push(seg)}return parts.join("/")||null}var RENDER_LIMIT=1e6;function initialBlockCount(doc){const n=doc.blocks.findIndex(b=>b.end>RENDER_LIMIT);return n<0?doc.blocks.length:Math.max(1,n)}var FIND_SKIP="data-find-skip";function textNodes(root){const out=[];const walker=root.ownerDocument.createTreeWalker(root,4);for(let n=walker.nextNode();n;n=walker.nextNode()){if(n.parentElement?.closest(`[${FIND_SKIP}]`))continue;out.push(n)}return out}function fold(s){let out="";for(const ch of s){const low=ch.toLowerCase();out+=low.length===ch.length?low:ch}return out}function findRanges(roots,query){const q=fold(query);if(q.trim()==="")return[];const out=[];for(const root of roots){const nodes=textNodes(root);const text4=fold(nodes.map(t=>t.data).join(""));let n=0;let base=0;const at=(pos,end)=>{while(n<nodes.length){const t=nodes[n];const next=base+t.data.length;if(pos<next||end&&pos===next)return[t,pos-base];base=next;n++}return null};for(let i=text4.indexOf(q);i!==-1;i=text4.indexOf(q,i+q.length)){const start=at(i,false);const stop=start&&at(i+q.length,true);if(!start||!stop)break;const range=root.ownerDocument.createRange();range.setStart(...start);range.setEnd(...stop);out.push(range)}}return out}function step(index2,total,dir){if(total===0)return 0;return(index2+dir+total)%total}function isFindKey(e){return(e.metaKey||e.ctrlKey)&&!e.shiftKey&&!e.altKey&&e.key.toLowerCase()==="f"}function claimsFind(frame,target){const doc=frame.ownerDocument;const node2=target!==null&&typeof target.nodeType==="number"?target:null;const idle=!node2||node2===doc.body||node2===doc.documentElement;const modal=doc.querySelector("dialog[open][data-band-layer='dialog'], [role='dialog'][aria-modal='true']");if(modal)return modal.contains(frame)&&(idle||modal.contains(node2));return idle||frame.contains(node2)}var ALL="band-viewer-text-find";var CURRENT="band-viewer-text-find-current";function registry(){return typeof Highlight==="function"&&typeof CSS!=="undefined"&&CSS.highlights?CSS.highlights:null}function usePaint(){const mine=useRef({});const paint=useCallback((ranges,current)=>{const reg=registry();if(!reg)return;const all2=new Highlight(...ranges);reg.set(ALL,all2);mine.current.all=all2;if(current){const cur=new Highlight(current);reg.set(CURRENT,cur);mine.current.current=cur}else if(reg.get(CURRENT)===mine.current.current)reg.delete(CURRENT)},[]);const unpaint=useCallback(()=>{const reg=registry();if(!reg)return;if(mine.current.all&&reg.get(ALL)===mine.current.all)reg.delete(ALL);if(mine.current.current&&reg.get(CURRENT)===mine.current.current)reg.delete(CURRENT);mine.current={}},[]);return{paint,unpaint}}function reveal(article,range){if(typeof range.getBoundingClientRect!=="function")return;const r=range.getBoundingClientRect();const view=article.getBoundingClientRect();if(r.height===0&&r.width===0)return;if(r.top>=view.top+48&&r.bottom<=view.bottom-24)return;article.scrollTop+=r.top-view.top-view.height/2+r.height/2}var ROOTS=".band-viewer-text-content";function SearchIcon(){return jsxs2("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[jsx2("circle",{cx:"7",cy:"7",r:"4.5"}),jsx2("path",{d:"M10.5 10.5 14 14"})]})}function FindBar({article,query,onQuery,foldedText,expand,focusSeq,focused,onClose}){const[index2,setIndex]=useState(0);const[ranges,setRanges]=useState([]);const input=useRef(null);const{paint,unpaint}=usePaint();const{settled:term,imeProps}=useSettledText(query);useEffect(()=>{if(focused.current===focusSeq)return;focused.current=focusSeq;input.current?.focus();input.current?.select()},[focusSeq,focused]);useEffect(()=>{if(foldedText===void 0||term.trim()==="")return;if(fold(foldedText).includes(fold(term)))expand()},[foldedText,term,expand]);useEffect(()=>{const el=article.current;if(!el)return;const run=()=>{const next=findRanges([...el.querySelectorAll(ROOTS)],term);setRanges(next);setIndex(i=>i<next.length?i:0)};run();if(typeof MutationObserver==="undefined")return;let frame=0;const observer=new MutationObserver(records=>{const own2=r=>(r.target instanceof Element?r.target:r.target.parentElement)?.closest(".band-viewer-text-findlayer");if(records.every(own2))return;cancelAnimationFrame(frame);frame=requestAnimationFrame(run)});observer.observe(el,{childList:true,subtree:true,characterData:true});return()=>{cancelAnimationFrame(frame);observer.disconnect()}},[article,term]);useEffect(()=>{const current=ranges[index2]??null;paint(ranges,current);const el=article.current;if(el&&current)reveal(el,current)},[article,ranges,index2,paint]);useEffect(()=>unpaint,[unpaint]);const onEscape=withImeGuard(e=>{if(e.key!=="Escape")return;e.preventDefault();e.stopPropagation();onClose()});const total=ranges.length;const go=dir=>setIndex(i=>step(i,total,dir));const empty2=term.trim()==="";const status=empty2?"":total===0?"\u65E0\u7ED3\u679C":`${index2+1}/${total}`;return jsxs2("div",{className:"band-viewer-text-find",role:"search",onKeyDown:onEscape,children:[jsx2(SearchIcon,{}),jsx2("input",{ref:input,type:"text","aria-label":"\u5728\u6587\u4E2D\u67E5\u627E",placeholder:"\u5728\u6587\u4E2D\u67E5\u627E",value:query,onChange:e=>{onQuery(e.target.value);setIndex(0)},...imeProps,onKeyDown:withImeGuard(e=>{if(e.key==="Enter"){e.preventDefault();go(e.shiftKey?-1:1)}})}),jsx2("output",{className:total===0&&!empty2?"none":void 0,"aria-live":"polite",children:status}),jsx2("button",{type:"button",className:"band-viewer-text-find-btn","aria-label":"\u4E0A\u4E00\u5904",title:"\u4E0A\u4E00\u5904\uFF08Shift \u56DE\u8F66\uFF09",disabled:total===0,onClick:()=>go(-1),children:jsx2("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:jsx2("path",{d:"M4 10l4-4 4 4"})})}),jsx2("button",{type:"button",className:"band-viewer-text-find-btn","aria-label":"\u4E0B\u4E00\u5904",title:"\u4E0B\u4E00\u5904\uFF08\u56DE\u8F66\uFF09",disabled:total===0,onClick:()=>go(1),children:jsx2("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:jsx2("path",{d:"M4 6l4 4 4-4"})})}),jsx2("button",{type:"button",className:"band-viewer-text-find-btn","aria-label":"\u5173\u95ED\u67E5\u627E",title:"\u5173\u95ED\uFF08Esc\uFF09",onClick:onClose,children:jsx2("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:jsx2("path",{d:"M4.5 4.5l7 7M11.5 4.5l-7 7"})})})]})}function newRenderCtx(base){return{...base,footnoteOrder:[],footnoteCounts:new Map}}var SAFE_PROTOCOLS=new Set(["http:","https:","mailto:"]);function safeExternal(url){try{return SAFE_PROTOCOLS.has(new URL(url).protocol)?url:null}catch{return null}}function isAbsolute(url){return/^[a-z][a-z0-9+.-]*:/i.test(url)||url.startsWith("//")}function renderNode(node2,key,c){switch(node2.type){case"text":return jsx3("span",{...srcProps(node2),children:node2.value},key);case"paragraph":return jsx3("p",{...commentProps(node2),children:renderChildren(node2.children,c)},key);case"heading":return createElement(`h${node2.depth}`,{key,...commentProps(node2)},...renderChildren(node2.children,c));case"blockquote":return jsx3("blockquote",{children:renderChildren(node2.children,c)},key);case"thematicBreak":return jsx3("hr",{},key);case"break":return jsx3("br",{},key);case"strong":return jsx3("strong",{children:renderChildren(node2.children,c)},key);case"emphasis":return jsx3("em",{children:renderChildren(node2.children,c)},key);case"delete":return jsx3("del",{children:renderChildren(node2.children,c)},key);case"inlineCode":return jsx3("code",{...srcProps(node2),children:node2.value.replace(/\r?\n|\r/g," ")},key);case"html":return jsx3("span",{...srcProps(node2),children:node2.value},key);case"code":return jsx3(CodeBlock,{code:node2.value,lang:node2.lang??void 0,src:srcProps(node2),comment:commentProps(node2)},key);case"list":return renderList(node2,key,c);case"listItem":return renderListItem(node2,listItemLoose(node2),key,c);case"table":return renderTable(node2,key,c);case"link":return renderLink(node2.url,renderChildren(node2.children,{...c,inLink:true}),key,c);case"linkReference":{const d=c.definitions.get(node2.identifier.toUpperCase());if(!d)return jsxs3("span",{children:["[",renderChildren(node2.children,c),"]"]},key);return renderLink(d.url,renderChildren(node2.children,{...c,inLink:true}),key,c)}case"image":return jsx3(MarkdownImage,{url:node2.url,alt:node2.alt??"",c},`${key}:${node2.url}`);case"imageReference":{const d=c.definitions.get(node2.identifier.toUpperCase());if(!d)return`![${node2.alt??""}]`;return jsx3(MarkdownImage,{url:d.url,alt:node2.alt??"",c},`${key}:${d.url}`)}case"footnoteReference":return renderFootnoteReference(node2,key,c);default:return null}}function renderChildren(nodes,c){return nodes.map((n,i)=>renderNode(n,i,c))}function renderLink(url,children,key,c){const href=normalizeUri(url);const external=safeExternal(href);if(external){return jsx3("a",{className:"band-viewer-text-a",href:external,target:"_blank",rel:"noopener noreferrer",children},key)}const path2=isAbsolute(url)||url.startsWith("#")?null:c.resolveFile(url);if(path2&&c.openFile&&c.openable?.(path2)){const open=c.openFile;return jsx3("button",{type:"button",className:"band-viewer-text-a band-viewer-text-filelink",title:path2,onClick:()=>open(path2),children},key)}return jsx3("span",{children},key)}function MarkdownImage({url,alt,c}){const path2=isAbsolute(url)?null:c.resolveFile(url);const{fileUrl}=c;const[state,setState]=useState2(path2?"loading":"failed");useEffect2(()=>{if(!path2)return;let live=true;setState("loading");fileUrl(path2).then(src=>live&&setState({src}),()=>live&&setState("failed"));return()=>{live=false}},[path2,fileUrl]);const label=alt||url.split("/").pop()||"\u56FE\u7247";if(!path2){const external=safeExternal(normalizeUri(url));if(external&&!c.inLink){return jsxs3("a",{className:"band-viewer-text-a band-viewer-text-imglink",href:external,target:"_blank",rel:"noopener noreferrer",title:"\u5916\u94FE\u56FE\u7247\u4E0D\u81EA\u52A8\u52A0\u8F7D\uFF0C\u70B9\u5F00\u5728\u65B0\u6807\u7B7E\u9875\u67E5\u770B",children:["\u56FE\u7247\uFF1A",label]})}return jsxs3("span",{className:"band-viewer-text-imgalt",children:["\u56FE\u7247\uFF1A",label]})}if(state==="loading"){return jsxs3("span",{className:"band-viewer-text-imgalt","aria-busy":"true",children:["\u56FE\u7247\u52A0\u8F7D\u4E2D\uFF1A",label]})}if(state==="failed"){return jsxs3("span",{className:"band-viewer-text-imgalt",children:["\u56FE\u7247\u6253\u4E0D\u5F00\uFF1A",label]})}return jsx3("img",{className:"band-viewer-text-img",src:state.src,alt,loading:"lazy",decoding:"async",onError:()=>setState("failed")})}function listItemLoose(item){return item.spread??item.children.length>1}function renderList(node2,key,c){const loose=(node2.spread??false)||node2.children.some(listItemLoose);const task=node2.children.some(it=>typeof it.checked==="boolean");const props={key};if(typeof node2.start==="number"&&node2.start!==1)props.start=node2.start;if(task)props.className="band-viewer-text-tasks";return createElement(node2.ordered?"ol":"ul",props,...node2.children.map((it,i)=>renderListItem(it,loose,i,c)))}function renderListItem(item,loose,key,c){const parts=item.children.map((child,i)=>child.type==="paragraph"&&!loose?jsx3("span",{children:renderChildren(child.children,c)},i):renderNode(child,i,c));if(typeof item.checked!=="boolean")return jsx3("li",{...commentProps(item),children:parts},key);return jsxs3("li",{className:"band-viewer-text-task",...commentProps(item),children:[jsx3("input",{type:"checkbox",className:"checkbox",checked:item.checked,disabled:true,"aria-label":item.checked?"\u5DF2\u5B8C\u6210":"\u672A\u5B8C\u6210"}),jsx3("div",{children:parts})]},key)}function renderTable(node2,key,c){const align=node2.align??[];const[head,...body2]=node2.children;const cols=Math.max(align.length,head?.children.length??0);const row=(r,tag,k)=>{const cells=[];for(let i=0;i<cols;i++){const cell=r.children[i];const a=align[i];cells.push(createElement(tag,{key:i,style:a?{textAlign:a}:void 0},...cell?renderChildren(cell.children,c):[]))}return jsx3("tr",{...commentProps(r),children:cells},k)};return jsx3("div",{className:"band-viewer-text-table",tabIndex:0,children:jsxs3("table",{children:[head&&jsx3("thead",{children:row(head,"th",0)}),body2.length>0&&jsx3("tbody",{children:body2.map((r,i)=>row(r,"td",i+1))})]})},key)}function renderFootnoteReference(node2,key,c){const id=node2.identifier.toUpperCase();const seen=c.footnoteCounts.get(id);if(seen===void 0)c.footnoteOrder.push(id);c.footnoteCounts.set(id,(seen??0)+1);return jsx3("sup",{className:"band-viewer-text-fnref",children:c.footnoteOrder.indexOf(id)+1},key)}function FootnoteSection({c}){const items=[];for(let i=0;i<c.footnoteOrder.length;i++){const id=c.footnoteOrder[i];const d=c.footnotes.get(id);if(d)items.push(jsx3("li",{children:renderChildren(d.children,c)},id))}if(items.length===0)return null;return jsx3("section",{className:"band-viewer-text-footnotes","aria-label":"\u811A\u6CE8",children:jsx3("ol",{children:items})})}var COPIED_MS=1600;function CodeBlock({code:code2,lang,src,comment}){const[copied,setCopied]=useState2(false);const label=lang?/^[\w+#-]+/.exec(lang)?.[0]:void 0;const[lines,setLines]=useState2(null);useEffect2(()=>{let live=true;setLines(null);highlight(code2,label).then(l=>live&&setLines(l));return()=>{live=false}},[code2,label]);useEffect2(()=>{if(!copied)return;const t=setTimeout(()=>setCopied(false),COPIED_MS);return()=>clearTimeout(t)},[copied]);const copy=()=>{navigator.clipboard?.writeText(code2).then(()=>setCopied(true),()=>{})};return jsxs3("figure",{className:"band-viewer-text-code",children:[jsxs3("figcaption",{children:[jsx3("span",{children:label??"\u4EE3\u7801"}),jsx3("button",{type:"button",className:"btn sm ghost",onClick:copy,"aria-live":"polite","data-find-skip":"",children:copied?"\u5DF2\u590D\u5236":"\u590D\u5236"})]}),jsx3("pre",{...comment,children:jsx3("code",{...src,children:lines?jsx3(Highlighted,{lines}):code2})})]})}function Highlighted({lines}){return lines.map((line,i)=>jsxs3(Fragment2,{children:[i>0&&"\n",line.map((t,j)=>jsx3("span",{style:tokenStyle(t),children:t.text},j))]},i))}function MaterialText({ctx,source}){const[text4,setText]=useState3(null);const[error,setError]=useState3("");const[attempt,setAttempt]=useState3(0);useEffect3(()=>{const abort=new AbortController;setText(null);setError("");if(!source||materialViewer(source.attachment)!=="material-text"){setError("\u7F3A\u5C11\u7D20\u6750\u7248\u672C\u6765\u6E90\uFF0C\u8BF7\u5173\u95ED\u540E\u91CD\u65B0\u6253\u5F00");return}if(source.attachment.size>MATERIAL_TEXT_MAX_BYTES){setError("\u6587\u4EF6\u8F83\u5927\uFF0C\u7AD9\u5185\u6700\u591A\u67E5\u770B 2 MB \u6587\u672C\uFF0C\u8BF7\u4E0B\u8F7D\u539F\u6587\u4EF6");return}void readMaterialText(ctx,source,abort.signal).then(value=>{if(!abort.signal.aborted)setText(value)},error2=>{if(!abort.signal.aborted)setError(materialError(error2))});return()=>abort.abort()},[ctx,source,attempt]);if(error)return jsxs4("div",{className:"band-viewer-text",role:"alert",children:[jsx4("p",{children:error}),jsx4("button",{className:"btn sm",type:"button",onClick:()=>setAttempt(n=>n+1),children:"\u91CD\u8BD5"})]});if(text4===null||!source)return jsx4("output",{children:"\u6B63\u5728\u8BFB\u53D6\u7D20\u6750\u5185\u5BB9\u2026"});const active=/\.(html?|svg|xml|xhtml)$/i.test(source.attachment.name)||/html|xml|svg/i.test(source.attachment.mime);const markdown=!active&&(/\.(md|markdown)$/i.test(source.attachment.name)||source.attachment.mime==="text/markdown");const doc=parseDoc(text4,markdown?"markdown":"plain");const render=newRenderCtx({definitions:doc.definitions??new Map,footnotes:doc.footnotes??new Map,resolveFile:()=>null,fileUrl:async()=>{throw new Error("\u7D20\u6750\u4E0D\u80FD\u8BFB\u53D6\u5176\u4ED6\u6587\u4EF6")}});return jsx4("article",{className:`band-viewer-text ${doc.format==="plain"?"plain":""}`,tabIndex:0,"aria-label":"\u7D20\u6750\u6587\u6863",children:jsxs4("div",{className:"band-viewer-text-content",children:[doc.blocks.map((block,i)=>jsx4("section",{className:"band-viewer-text-block",children:renderNode(block.node,i,render)},block.start)),jsx4(FootnoteSection,{c:render})]})})}var src_default=definePlugin({surfaces:{"material-text":reactMount((ctx,props)=>jsx5(MaterialText,{ctx,source:props.owner.materialVersion})),text:reactMount((ctx,props,mount)=>jsx5(TextViewer,{ctx,mount,artifactId:props.owner.artifactId,compare:props.config.compare===true}))}});var TOOLBAR_SLOT="@kanyun-ai-infra/band-viewer-text/toolbar";var HEADING_SLOT="@kanyun-ai-infra/band-viewer-text/heading";var NARROW_QUERY="(pointer: coarse), (max-width: 599px)";function useNarrowText(){const[narrow,setNarrow]=useState4(()=>typeof window!=="undefined"&&window.matchMedia?.(NARROW_QUERY).matches===true);useEffect4(()=>{const media=window.matchMedia?.(NARROW_QUERY);if(!media)return;const changed=()=>setNarrow(media.matches);changed();media.addEventListener("change",changed);return()=>media.removeEventListener("change",changed)},[]);return narrow}function TextViewer(props){const[find,setFind]=useState4({open:false,seq:0,query:""});const focused=useRef2(0);if(props.compare)return jsx5(TextBody,{...props,find,setFind,focused});return jsxs5("div",{className:"band-viewer-text-frame",children:[jsx5(Toolbar,{ctx:props.ctx}),jsx5(TextBody,{...props,find,setFind,focused})]})}var FIND_KEY=typeof navigator!=="undefined"&&/Mac|iPhone|iPad/.test(navigator.platform)?"\u2318F":"Ctrl F";var REVEAL_TIMEOUT_MS=3e3;function TextBody({ctx,mount,artifactId,compare,find,setFind,focused}){const v=ctx.version.current();const paths=useMemo2(()=>v?textEntries(v):[],[v]);const[picked,setPicked]=useState4(null);const path2=picked&&paths.includes(picked)?picked:v?textEntry(v):null;const body2=useCtxData(ctx,async()=>{if(!v||!path2)return null;return{path:path2,text:new TextDecoder().decode(await ctx.version.readFile(path2))}},[v?.id,path2],"version.*");const threads=useCtxData(ctx,()=>ctx.threads.list({artifactId}),[artifactId],THREAD_EVENTS).data;const text4=body2.data&&body2.data.path===path2?body2.data.text:void 0;const format=v&&path2?dataFormat(v,path2):null;const doc=useMemo2(()=>typeof text4!=="string"||!v||!path2?null:format?{format:"plain",source:text4,blocks:[],definitions:new Map,footnotes:new Map}:parseDoc(text4,isMarkdown(v,path2)?"markdown":"plain"),[text4,v,path2,format]);const[showAll,setShowAll]=useState4(false);const fileUrl=useCallback2(p=>ctx.version.objectUrl(p),[ctx]);const count=doc?showAll?doc.blocks.length:initialBlockCount(doc):0;const place=useMemo2(()=>v&&path2?{versionId:v.id,path:path2,paths,legacyPath:legacyEntry(v)}:null,[v,path2,paths]);const shown=useRef2({state:"waiting"});shown.current=doc&&place?{state:"ready",doc,place,count}:{state:"waiting"};const role=useArtifactRole(ctx,artifactId);const narrow=useNarrowText();const canComment=!compare&&!format&&ctx.member.can("comment")&&role==="deliverable";const annotating=useSyncExternalStore(ctx.anchors.annotating.subscribe,ctx.anchors.annotating.get);const active=canComment&&annotating&&!narrow;const anchors=useAnchorHost(ctx,mount,shown,canComment&&!narrow,{showAll:()=>setShowAll(true),open:setPicked});const articleEl=useRef2(null);const articleRef=anchors.article;const setArticle=useCallback2(el=>{articleEl.current=el;articleRef(el)},[articleRef]);useEffect4(()=>{if(compare)return;const onKey=withImeGuard2(e=>{const el=articleEl.current;if(e.defaultPrevented||!el||!isFindKey(e)||!claimsFind(el,e.target))return;e.preventDefault();setFind(f=>({...f,open:true,seq:f.seq+1}))});document.addEventListener("keydown",onKey);return()=>document.removeEventListener("keydown",onKey)},[compare,setFind]);useEffect4(()=>{const el=articleEl.current;if(!el||!doc||!path2||!active)return;return bindCommentMode(el,doc.source,({start,end,text:text22})=>{const a=rangeAnchor(doc,path2,start,end,text22);ctx.threads.openAt(ctx.anchors.make("text-range",a.payload,a.snapshot))})},[ctx,doc,path2,active]);useEffect4(()=>{const el=articleEl.current;if(!el||!doc||!path2||!canComment||narrow)return;let reported=null;let key="";const offSelection=ctx.selection.subscribe(({source})=>{if(source!=="@kanyun-ai-infra/band-viewer-text"){reported=null;key=""}});const clear=()=>{const current=ctx.selection.get();if(reported&&current?.kind==="anchor"&&current.anchor.id===reported.id){ctx.selection.set(null)}reported=null;key=""};const update=()=>{const pick=readTextSelection(el,doc.source);if(!pick)return clear();const next=`${pick.start}:${pick.end}:${pick.text}`;if(next===key)return;const a=rangeAnchor(doc,path2,pick.start,pick.end,pick.text);reported=ctx.anchors.make("text-range",a.payload,a.snapshot);key=next;ctx.selection.set({kind:"anchor",anchor:reported})};el.ownerDocument.addEventListener("selectionchange",update);update();return()=>{el.ownerDocument.removeEventListener("selectionchange",update);clear();offSelection()}},[ctx,doc,path2,canComment,narrow]);const marks=useCompareLink(compare,artifactId,v,doc,articleEl);const expand=useCallback2(()=>setShowAll(true),[]);const headingCells=useSlotEntries(ctx,HEADING_SLOT);useShotScroll(ctx,compare?null:doc,count,anchors.blocks,expand);if(!v)return jsx5("div",{className:"band-viewer-text state",children:"\u6CA1\u6709\u53EF\u663E\u793A\u7684\u7248\u672C"});if(body2.error){return jsx5("div",{className:"band-viewer-text","data-band-guide-keep":"",children:jsx5(ErrorNote,{retry:body2.reload,children:body2.error})})}if(!path2||body2.data===null){return jsx5("div",{className:"band-viewer-text state",children:"\u8FD9\u4E2A\u7248\u672C\u91CC\u6CA1\u6709\u6587\u672C\u6761\u76EE"})}if(!doc){return jsx5("div",{className:"band-viewer-text state","aria-busy":"true",children:"\u52A0\u8F7D\u4E2D\u2026"})}const comment=i=>{const a=blockAnchor(doc,i,path2);ctx.threads.openAt(ctx.anchors.make("text-range",a.payload,a.snapshot))};const commentRange=(start,end,text22)=>{const a=rangeAnchor(doc,path2,start,end,text22);ctx.threads.openAt(ctx.anchors.make("text-range",a.payload,a.snapshot))};const rc=newRenderCtx({definitions:doc.definitions,footnotes:doc.footnotes,resolveFile:href=>{const p=resolvePath(path2,href);return p&&v.entries.some(e=>e.path===p)?p:null},openable:p=>paths.includes(p),openFile:setPicked,fileUrl});const hidden=doc.blocks.length-count;let hiddenThreads=0;if(hidden>0&&place){for(const t of threads??[]){if(t.status==="resolved")continue;const p=placeOf(t.anchor,doc,place);if(p.at==="block"&&p.block>=count)hiddenThreads++}}return jsxs5("article",{ref:setArticle,tabIndex:-1,className:`band-viewer-text ${doc.format==="plain"?"plain":""}`,"data-text-commenting":active?"true":void 0,"aria-label":"\u6587\u672C",children:[!compare&&jsx5("div",{className:"band-viewer-text-findlayer",children:find.open?jsx5(FindBar,{article:articleEl,query:find.query,onQuery:query=>setFind(f=>({...f,query})),foldedText:hidden>0&&text4!==void 0?text4.slice(doc.blocks[count]?.start??0):void 0,expand,focusSeq:find.seq,focused,onClose:()=>{setFind(f=>({...f,open:false}));articleEl.current?.focus()}}):jsx5("button",{type:"button",className:"band-viewer-text-findbtn","aria-label":"\u5728\u6587\u4E2D\u67E5\u627E",title:`\u5728\u6587\u4E2D\u67E5\u627E\uFF08${FIND_KEY}\uFF09`,onClick:()=>setFind(f=>({...f,open:true,seq:f.seq+1})),children:jsx5(SearchIcon,{})})}),paths.length>1&&jsx5("div",{className:"tabs plain band-viewer-text-files",role:"tablist","aria-label":"\u6587\u4EF6",children:paths.map(p=>jsx5("button",{type:"button",role:"tab","aria-selected":p===path2,title:p,onClick:()=>setPicked(p),children:p.split("/").pop()},p))}),format?jsx5(DataBody,{text:doc.source,format}):doc.blocks.length===0&&jsx5("p",{className:"band-viewer-text-empty",children:"\u8FD9\u4EFD\u6587\u4EF6\u662F\u7A7A\u7684"}),doc.blocks.slice(0,count).map((b,i)=>jsxs5("div",{className:"band-viewer-text-block",...marks.get(i)?{"data-compare":marks.get(i)}:{},children:[marks.get(i)&&jsx5("span",{className:"sr-only",children:marks.get(i)==="added"?"\u65B0\u589E\u6216\u6539\u52A8":"\u5DF2\u5220\u6539"}),canComment&&(narrow||active)&&jsx5("button",{type:"button",className:"band-viewer-text-add","aria-label":`\u5BF9\u7B2C ${i+1} \u6BB5\u8BC4\u8BBA`,title:"\u5BF9\u8FD9\u4E00\u6BB5\u8BC4\u8BBA",onClick:()=>comment(i),children:jsx5(PlusIcon,{})}),jsx5("div",{className:"band-viewer-text-content",ref:anchors.block(i),children:renderNode(b.node,i,rc)}),b.headingId&&!compare&&headingCells.length>0&&jsx5("div",{className:"band-viewer-text-aside",children:headingCells.map(e=>jsx5(Mount,{className:"band-viewer-text-aside-item","data-band-slot":HEADING_SLOT,"data-band-item":e.key,mount:el=>ctx.slots.mount(el,HEADING_SLOT,{key:e.key,version:v,owner:{artifactId,versionId:v.id,path:path2,id:b.headingId,text:b.text}}),deps:[ctx,e.key,artifactId,v.id,path2,b.headingId,b.text]},e.key))})]},`${b.start}:${b.end}`)),active&&jsx5(SelectionComment,{article:articleEl,blocks:anchors.blocks,doc,count,onComment:commentRange}),jsx5(AlignAdds,{article:articleEl,enabled:canComment&&(narrow||active)}),hidden>0?jsxs5("div",{className:"band-viewer-text-more",children:["\u6587\u4EF6\u8F83\u5927\uFF0C\u5148\u663E\u793A\u524D ",count," \u6BB5\uFF0C\u8FD8\u6709 ",hidden," \u6BB5",hiddenThreads>0?`\uFF08\u5176\u4E2D\u6709 ${hiddenThreads} \u6761\u610F\u89C1\uFF09`:"","\u3002",jsx5("button",{type:"button",className:"btn sm",onClick:()=>setShowAll(true),children:"\u663E\u793A\u5168\u90E8"})]}):jsx5(FootnoteSection,{c:rc})]})}function useShotScroll(ctx,doc,count,blocks,showAll){useEffect4(()=>{if(!doc)return;const go=sel=>{if(sel?.kind!=="entity"||sel.entityType!=="shot")return;const i=doc.blocks.findIndex(b=>b.headingId===sel.id);if(i<0)return;if(i>=count)return showAll();const el=blocks.current.get(i);if(!el)return;const still=window.matchMedia?.("(prefers-reduced-motion: reduce)").matches;scrollIntoPanel(el,{block:"start",behavior:still?"auto":"smooth"})};go(ctx.selection.get());return ctx.selection.subscribe(({value})=>go(value))},[ctx,doc,count,blocks,showAll])}function useCompareLink(compare,artifactId,v,doc,articleEl){const[tick,setTick]=useState4(0);const texts=useMemo2(()=>doc?doc.blocks.map(b=>b.text):null,[doc]);const state=useRef2({texts,tick:()=>{}});state.current.texts=texts;state.current.tick=()=>setTick(n=>n+1);const link=useRef2(null);const loaded=texts!==null;const versionId=v?.id;const createdAt=v?.createdAt;useEffect4(()=>{if(!compare||!loaded||versionId===void 0||createdAt===void 0)return;let echo=null;const el=()=>articleEl.current;const l=joinTextCompare(artifactId,{versionId,createdAt,blocks:()=>state.current.texts,scrollTo(ratio){const a2=el();if(!a2)return;const target=ratio*Math.max(0,a2.scrollHeight-a2.clientHeight);if(Math.abs(a2.scrollTop-target)<1)return;a2.scrollTop=target;echo=a2.scrollTop},changed:()=>state.current.tick()});link.current=l;state.current.tick();const a=el();const onScroll=()=>{const t=el();if(!t)return;if(echo!==null){const mine=echo;echo=null;if(Math.abs(t.scrollTop-mine)<1)return}const room=t.scrollHeight-t.clientHeight;l.scroll(room>0?t.scrollTop/room:0)};a?.addEventListener("scroll",onScroll,{passive:true});return()=>{a?.removeEventListener("scroll",onScroll);link.current=null;l.leave()}},[compare,artifactId,versionId,createdAt,articleEl,loaded]);useEffect4(()=>{if(texts)link.current?.notify()},[texts]);return useMemo2(()=>{void tick;if(!compare||!v||!link.current)return new Map;return marksAgainst({versionId:v.id,createdAt:v.createdAt},texts,link.current.others()[0])},[compare,v,texts,tick])}function useAnchorHost(ctx,mount,shown,annotate,act){const blocks=useRef2(new Map);const article=useRef2(null);const listeners=useRef2(new Set);const pending=useRef2(null);const actions=useRef2(act);actions.current=act;const notify=useCallback2(()=>{for(const fn of[...listeners.current])fn()},[]);const locate=useCallback2(anchor=>{const s=shown.current;if(s.state==="waiting")return{at:"pending"};const p=placeOf(anchor,s.doc,s.place);if(p.at!=="block")return p.at==="none"?{at:"none"}:{at:"elsewhere"};const first=p.block<s.count?blocks.current.get(p.block):void 0;if(!first)return{at:"elsewhere"};const els=[];for(let i=p.block;i<s.count&&(s.doc.blocks[i]?.start??p.end)<p.end;i++){const el=blocks.current.get(i);if(el)els.push(el)}const view=article.current?.getBoundingClientRect();const clip=view&&view.height>0;const visible=b=>{if(!clip)return b;const top=Math.max(b.top,view.top);const bottom=Math.min(b.bottom,view.bottom);return bottom>top?{...b,top,bottom}:null};let boxes=sourceToBoxes(els,s.doc.source,p.start,p.end);if(boxes.length===0){boxes=els.map(el=>{const r=el.getBoundingClientRect();return{left:r.left,top:r.top,right:r.right,bottom:r.bottom}})}const shownBoxes=boxes.map(visible).filter(b=>b!==null);const lead=shownBoxes[0];if(!lead)return{at:"elsewhere"};const m=mount.getBoundingClientRect();const rel=b=>({x:b.left-m.left,y:b.top-m.top,width:b.right-b.left,height:b.bottom-b.top});const corner={x:Math.min(first.getBoundingClientRect().right,m.right-1)-m.left,y:Math.max(lead.top,m.top+1)-m.top};const rects=[{...corner,width:0,height:0},...shownBoxes.map(rel)];return p.status==="moved"||p.status==="changed"?{at:"rects",rects,status:p.status}:{at:"rects",rects}},[mount,shown]);const tryReveal=useCallback2(()=>{const job=pending.current;const s=shown.current;if(!job||s.state==="waiting")return;const finish=ok3=>{pending.current=null;job.done(ok3)};const p=placeOf(job.anchor,s.doc,s.place);if(p.at==="none")return finish(false);if(p.at==="elsewhere"){if(job.switched)return finish(false);job.switched=true;actions.current.open(p.path);return}if(p.block>=s.count)return actions.current.showAll();const el=blocks.current.get(p.block);if(!el)return;const still=window.matchMedia?.("(prefers-reduced-motion: reduce)").matches;scrollIntoPanel(el,{behavior:still?"auto":"smooth"});finish(true)},[shown]);useEffect4(()=>{const off=ctx.anchors.host({kinds:["text-range"],annotate,locate,reveal:anchor=>new Promise(resolve=>{pending.current?.done(false);const timer=setTimeout(()=>{if(pending.current?.anchor===anchor){pending.current=null;resolve(false)}},REVEAL_TIMEOUT_MS);pending.current={anchor,switched:false,done:ok3=>{clearTimeout(timer);resolve(ok3)}};tryReveal()}),onLayout:fn=>{listeners.current.add(fn);return()=>listeners.current.delete(fn)}});void document.fonts?.ready.then(notify);return()=>{off();pending.current?.done(false);pending.current=null}},[ctx,locate,tryReveal,notify,annotate]);useEffect4(()=>{tryReveal();notify()});const observer=useRef2(null);const articleRef=useCallback2(el=>{if(article.current){article.current.removeEventListener("scroll",notify);article.current.removeEventListener("load",notify,true)}observer.current?.disconnect();article.current=el;if(!el)return;el.addEventListener("scroll",notify,{passive:true});el.addEventListener("load",notify,true);if(typeof ResizeObserver!=="undefined"){observer.current=new ResizeObserver(notify);observer.current.observe(el)}},[notify]);const block=useCallback2(i=>el=>{if(el)blocks.current.set(i,el);else blocks.current.delete(i)},[]);return{article:articleRef,block,blocks}}var COMMENT_KEY=FIND_KEY==="\u2318F"?"\u2318\u2325M":"Ctrl Alt M";function isCommentKey(e){return(e.metaKey||e.ctrlKey)&&e.altKey&&!e.shiftKey&&e.code==="KeyM"}var BUBBLE_H=30;function SelectionComment({article,blocks,doc,count,onComment}){const[picked,setPicked]=useState4(null);const[judged,setJudged]=useState4(null);const[tick,setTick]=useState4(0);const bubbleRef=useRef2(null);const commentRef=useRef2(onComment);commentRef.current=onComment;const dismissed=useRef2(null);const read=useCallback2(()=>{const el=article.current;const sel=el?.ownerDocument.getSelection();if(!el||!sel||sel.rangeCount===0||sel.isCollapsed)return null;const range=sel.getRangeAt(0);if(!el.contains(range.startContainer)&&!el.contains(range.endContainer))return null;const roots=[];for(let i=0;i<count;i++){const b=blocks.current.get(i);if(b)roots.push(b)}const src=selectionToSource(range,roots,doc.source);if(!src||!src.text.trim())return null;let last=0;for(let i=0;i<count&&(doc.blocks[i]?.start??src.end)<src.end;i++)last=i;const host=blocks.current.get(last)?.parentElement;const lines=[...range.getClientRects()].filter(r=>r.width>0&&r.height>0);const first=lines[0];const end=lines.at(-1);if(!host||!first||!end)return null;const box=host.getBoundingClientRect();const view=el.getBoundingClientRect();const roomAbove=view.height===0||first.top-BUBBLE_H-8>=view.top;const below2=window.matchMedia?.("(pointer: coarse)").matches===true||!roomAbove;const half=48;const centerOf=line=>Math.max(half,Math.min((line.left+line.right)/2-box.left,box.width-half));return{...src,host,aboveLeft:centerOf(first),belowLeft:centerOf(end),aboveTop:first.top-box.top-8,belowTop:end.bottom-box.top+8,below:below2}},[article,blocks,doc,count]);useEffect4(()=>{const el=article.current;if(!el)return;const owner=el.ownerDocument;let pressing=false;let frame=0;const update=()=>{if(frame)return;frame=requestAnimationFrame(()=>{frame=0;if(pressing)return;const p=read();if(!p)dismissed.current=null;setPicked(p&&dismissed.current!==`${p.start}:${p.end}`?p:null)})};const onDown=e=>{if(e.target?.closest?.("[data-selection-comment]"))return;pressing=true;dismissed.current=null;setPicked(null);setJudged(null)};const onUp=()=>{if(!pressing)return;pressing=false;update()};const onSelectKey=withImeGuard2(e=>{if(e.defaultPrevented)return;const bubble=el.querySelector("[data-selection-comment]");const at=owner.activeElement;if(e.key==="Tab"&&!e.shiftKey&&bubble&&at!==bubble&&el.contains(at)){e.preventDefault();bubble.focus();return}if(isCommentKey(e)&&!typing(e.target)){const p=read();if(!p)return;e.preventDefault();dismissed.current=`${p.start}:${p.end}`;setPicked(null);setJudged(null);commentRef.current(p.start,p.end,p.text)}});owner.addEventListener("selectionchange",update);el.addEventListener("pointerdown",onDown,true);owner.addEventListener("pointerup",onUp,true);owner.addEventListener("pointercancel",onUp,true);owner.addEventListener("keydown",onSelectKey);window.addEventListener("resize",update);update();return()=>{if(frame)cancelAnimationFrame(frame);owner.removeEventListener("selectionchange",update);el.removeEventListener("pointerdown",onDown,true);owner.removeEventListener("pointerup",onUp,true);owner.removeEventListener("pointercancel",onUp,true);owner.removeEventListener("keydown",onSelectKey);window.removeEventListener("resize",update)}},[article,read]);const label=picked?picked.text.replace(/\s+/g," ").trim():"";const short=label.length>20?`${label.slice(0,20)}\u2026`:label;const key=picked?`${picked.start}:${picked.end}`:null;const now=judged!==null&&judged.key===key&&judged.tick===tick?judged:null;const below=picked?picked.below||now?.side==="below":false;const phase=now?.phase??"design";useLayoutEffect(()=>{if(!picked||!key)return;const el=bubbleRef.current;const doc2=picked.host.ownerDocument;const point3=doc2.elementFromPoint?.bind(doc2);const view=doc2.defaultView;if(!el||!point3||!view)return;const rect=el.getBoundingClientRect();if(rect.width===0||rect.height===0)return;const host=picked.host.getBoundingClientRect();const frame=article.current?.getBoundingClientRect();const top=frame&&frame.height>0?frame.top:0;const bottom=frame&&frame.height>0?frame.bottom:view.innerHeight;const fitsView=y=>y>=top+8&&y+rect.height<=bottom-8;const hostTop=host.top;const otherFits=fitsView(below?hostTop+picked.aboveTop-rect.height:hostTop+picked.belowTop);const hit=point3(rect.left+rect.width/2,rect.top+rect.height/2);const occluded=hit!==null&&!el.contains(hit);const next=nextBubble({side:below?"below":"above",baseBelow:picked.below,occluded,otherFits,phase});if(next)setJudged({key,tick,side:next.side,phase:next.phase})},[article,picked,key,below,phase,tick]);useEffect4(()=>{if(!picked)return;let raf=0;let timer=0;const bump=()=>{if(raf||timer)return;raf=requestAnimationFrame(()=>{raf=0;timer=window.setTimeout(()=>{timer=0;setTick(t=>t+1);raf=requestAnimationFrame(()=>{raf=0;setTick(t=>t+1)})},0)})};window.addEventListener("scroll",bump,{passive:true,capture:true});window.addEventListener("resize",bump);return()=>{if(raf)cancelAnimationFrame(raf);if(timer)clearTimeout(timer);window.removeEventListener("scroll",bump,true);window.removeEventListener("resize",bump)}},[picked]);return jsxs5(Fragment3,{children:[jsx5("span",{className:"sr-only","aria-live":"polite",children:picked?`\u5DF2\u9009\u4E2D\u300C${short}\u300D\uFF0C\u6309 ${COMMENT_KEY} \u6216 Tab \u5230\u300C\u8BC4\u8BBA\u300D`:""}),picked&&createPortal(jsxs5("button",{ref:bubbleRef,type:"button",className:"btn sm primary band-viewer-text-bubble","data-selection-comment":"","data-below":below?"":void 0,style:{left:below?picked.belowLeft:picked.aboveLeft,top:below?picked.belowTop:picked.aboveTop},"aria-label":`\u5BF9\u9009\u4E2D\u7684\u300C${short}\u300D\u8BC4\u8BBA`,"aria-keyshortcuts":COMMENT_KEY==="\u2318\u2325M"?"Meta+Alt+M":"Control+Alt+M",title:`\u8BC4\u8BBA\uFF08${COMMENT_KEY}\uFF09`,onMouseDown:e=>e.preventDefault(),onKeyDown:withImeGuard2(e=>{if(e.key!=="Escape")return;e.preventDefault();dismissed.current=`${picked.start}:${picked.end}`;setPicked(null);setJudged(null);const sel=document.getSelection();const keep=sel&&sel.rangeCount>0?sel.getRangeAt(0).cloneRange():null;article.current?.focus({preventScroll:true});if(sel&&keep){sel.removeAllRanges();sel.addRange(keep)}}),onClick:()=>{dismissed.current=`${picked.start}:${picked.end}`;setPicked(null);setJudged(null);onComment(picked.start,picked.end,picked.text)},children:[jsx5(CommentIcon,{}),"\u8BC4\u8BBA"]}),picked.host)]})}function typing(target){if(!(target instanceof HTMLElement))return false;return target.isContentEditable||target instanceof HTMLInputElement||target instanceof HTMLTextAreaElement||target instanceof HTMLSelectElement}var ADD_SIZE=22;function AlignAdds({article,enabled}){useLayoutEffect(()=>{if(enabled&&article.current)alignAdds(article.current)});useEffect4(()=>{const el=article.current;if(!enabled||!el)return;const run=()=>alignAdds(el);const observer=typeof ResizeObserver==="undefined"?null:new ResizeObserver(run);observer?.observe(el);void document.fonts?.ready.then(run);return()=>observer?.disconnect()},[article,enabled]);return null}function alignAdds(article){const jobs=[];for(const add of article.querySelectorAll(".band-viewer-text-add")){const block=add.parentElement;const content3=add.nextElementSibling;if(!block||!content3)continue;const line=firstLine(content3);jobs.push([add,line?line.top+line.height/2-block.getBoundingClientRect().top:null])}for(const[add,mid]of jobs){add.style.top=mid===null?"":`${Math.round((mid-ADD_SIZE/2)*2)/2}px`}}function firstLine(content3){const doc=content3.ownerDocument;const walker=doc.createTreeWalker(content3,4);for(let n=walker.nextNode();n;n=walker.nextNode()){const t=n;const at=t.data.search(/\S/);if(at<0)continue;const r=doc.createRange();r.setStart(t,at);r.setEnd(t,at+1);const box2=r.getClientRects?.()[0];if(box2&&box2.height>0)return{top:box2.top,height:box2.height}}const box=content3.firstElementChild?.getBoundingClientRect();if(!box||box.height===0)return null;return{top:box.top,height:Math.min(box.height,ADD_SIZE)}}function PlusIcon(){return jsx5("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:jsx5("path",{d:"M8 3.5v9M3.5 8h9"})})}function CommentIcon(){return jsx5("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:jsx5("path",{d:"M3 3.5h10a1 1 0 0 1 1 1v6a1 1 0 0 1-1 1H7l-3 2.5v-2.5H3a1 1 0 0 1-1-1v-6a1 1 0 0 1 1-1z"})})}function Toolbar({ctx}){return jsx5(Mount,{className:"band-viewer-text-toolbar",mount:el=>{el.setAttribute("role","toolbar");el.setAttribute("aria-label","\u6587\u672C\u5DE5\u5177");return mountDockButtons(ctx,el,TOOLBAR_SLOT,"btn sm ghost")},deps:[ctx]})}export{HEADING_SLOT,TOOLBAR_SLOT,blockAnchor,src_default as default,parseDoc,placeOf,resolvePath,textEntries,textEntry};
1
+ import"../../chunks/chunk-NUFRM6SI.js";import{ccount,highlight,tokenStyle}from"../../chunks/chunk-PSLWCPAE.js";import{relocateTextRange}from"../../chunks/chunk-Z47EOZYW.js";import"../../chunks/chunk-NUFRM6SI.js";import{MATERIAL_TEXT_MAX_BYTES,materialError,materialViewer,readMaterialText}from"../../chunks/chunk-N6N56MWF.js";import{mountDockButtons}from"../../chunks/chunk-TWQQ2CCT.js";import{__export}from"../../chunks/chunk-JFPQMFKF.js";import{ErrorNote,Mount,THREAD_EVENTS,reactMount,scrollIntoPanel,useArtifactRole,useCtxData,useSlotEntries,withImeGuard as withImeGuard2}from"@kanyun-ai-infra/band-plugin-react";import{NARROW_QUERY,definePlugin}from"@kanyun-ai-infra/band-plugin-sdk";import{useCallback as useCallback2,useEffect as useEffect4,useLayoutEffect,useMemo as useMemo2,useRef as useRef2,useState as useState4,useSyncExternalStore}from"react";import{createPortal}from"react-dom";import{useMemo}from"react";import{Fragment,jsx,jsxs}from"react/jsx-runtime";var emptyOptions={};function toString(value,options){const settings=options||emptyOptions;const includeImageAlt=typeof settings.includeImageAlt==="boolean"?settings.includeImageAlt:true;const includeHtml=typeof settings.includeHtml==="boolean"?settings.includeHtml:true;return one(value,includeImageAlt,includeHtml)}function one(value,includeImageAlt,includeHtml){if(node(value)){if("value"in value){return value.type==="html"&&!includeHtml?"":value.value}if(includeImageAlt&&"alt"in value&&value.alt){return value.alt}if("children"in value){return all(value.children,includeImageAlt,includeHtml)}}if(Array.isArray(value)){return all(value,includeImageAlt,includeHtml)}return""}function all(values,includeImageAlt,includeHtml){const result=[];let index2=-1;while(++index2<values.length){result[index2]=one(values[index2],includeImageAlt,includeHtml)}return result.join("")}function node(value){return Boolean(value&&typeof value==="object")}var element=document.createElement("i");function decodeNamedCharacterReference(value){const characterReference2="&"+value+";";element.innerHTML=characterReference2;const character=element.textContent;if(character.charCodeAt(character.length-1)===59&&value!=="semi"){return false}return character===characterReference2?false:character}function splice(list2,start,remove,items){const end=list2.length;let chunkStart=0;let parameters;if(start<0){start=-start>end?0:end+start}else{start=start>end?end:start}remove=remove>0?remove:0;if(items.length<1e4){parameters=Array.from(items);parameters.unshift(start,remove);list2.splice(...parameters)}else{if(remove)list2.splice(start,remove);while(chunkStart<items.length){parameters=items.slice(chunkStart,chunkStart+1e4);parameters.unshift(start,0);list2.splice(...parameters);chunkStart+=1e4;start+=1e4}}}function push(list2,items){if(list2.length>0){splice(list2,list2.length,0,items);return list2}return items}var hasOwnProperty={}.hasOwnProperty;function combineExtensions(extensions){const all2={};let index2=-1;while(++index2<extensions.length){syntaxExtension(all2,extensions[index2])}return all2}function syntaxExtension(all2,extension2){let hook;for(hook in extension2){const maybe=hasOwnProperty.call(all2,hook)?all2[hook]:void 0;const left=maybe||(all2[hook]={});const right=extension2[hook];let code2;if(right){for(code2 in right){if(!hasOwnProperty.call(left,code2))left[code2]=[];const value=right[code2];constructs(left[code2],Array.isArray(value)?value:value?[value]:[])}}}}function constructs(existing,list2){let index2=-1;const before=[];while(++index2<list2.length){;(list2[index2].add==="after"?existing:before).push(list2[index2])}splice(existing,0,0,before)}function decodeNumericCharacterReference(value,base){const code2=Number.parseInt(value,base);if(code2<9||code2===11||code2>13&&code2<32||code2>126&&code2<160||code2>55295&&code2<57344||code2>64975&&code2<65008||(code2&65535)===65535||(code2&65535)===65534||code2>1114111){return"\uFFFD"}return String.fromCodePoint(code2)}function normalizeIdentifier(value){return value.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}var asciiAlpha=regexCheck(/[A-Za-z]/);var asciiAlphanumeric=regexCheck(/[\dA-Za-z]/);var asciiAtext=regexCheck(/[#-'*+\--9=?A-Z^-~]/);function asciiControl(code2){return code2!==null&&(code2<32||code2===127)}var asciiDigit=regexCheck(/\d/);var asciiHexDigit=regexCheck(/[\dA-Fa-f]/);var asciiPunctuation=regexCheck(/[!-/:-@[-`{-~]/);function markdownLineEnding(code2){return code2!==null&&code2<-2}function markdownLineEndingOrSpace(code2){return code2!==null&&(code2<0||code2===32)}function markdownSpace(code2){return code2===-2||code2===-1||code2===32}var unicodePunctuation=regexCheck(/\p{P}|\p{S}/u);var unicodeWhitespace=regexCheck(/\s/);function regexCheck(regex){return check;function check(code2){return code2!==null&&code2>-1&&regex.test(String.fromCharCode(code2))}}function normalizeUri(value){const result=[];let index2=-1;let start=0;let skip=0;while(++index2<value.length){const code2=value.charCodeAt(index2);let replace2="";if(code2===37&&asciiAlphanumeric(value.charCodeAt(index2+1))&&asciiAlphanumeric(value.charCodeAt(index2+2))){skip=2}else if(code2<128){if(!/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(code2))){replace2=String.fromCharCode(code2)}}else if(code2>55295&&code2<57344){const next=value.charCodeAt(index2+1);if(code2<56320&&next>56319&&next<57344){replace2=String.fromCharCode(code2,next);skip=1}else{replace2="\uFFFD"}}else{replace2=String.fromCharCode(code2)}if(replace2){result.push(value.slice(start,index2),encodeURIComponent(replace2));start=index2+skip+1;replace2=""}if(skip){index2+=skip;skip=0}}return result.join("")+value.slice(start)}function factorySpace(effects,ok3,type,max){const limit=max?max-1:Infinity;let size=0;return start;function start(code2){if(markdownSpace(code2)){effects.enter(type);return prefix(code2)}return ok3(code2)}function prefix(code2){if(markdownSpace(code2)&&size++<limit){effects.consume(code2);return prefix}effects.exit(type);return ok3(code2)}}function factorySpaceMinMax(effects,ok3,nok,type,min,max){let size=0;return start;function start(code2){if(max>0&&markdownSpace(code2)){effects.enter(type);return prefix(code2)}return after(code2)}function prefix(code2){if(markdownSpace(code2)&&size<max){effects.consume(code2);size++;return prefix}effects.exit(type);return after(code2)}function after(code2){return size>=min?ok3(code2):nok(code2)}}var content={tokenize:initializeContent};function initializeContent(effects){const contentStart=effects.attempt(this.parser.constructs.contentInitial,afterContentStartConstruct,paragraphInitial);let previous3;return contentStart;function afterContentStartConstruct(code2){if(code2===null){effects.consume(code2);return}effects.enter("lineEnding");effects.consume(code2);effects.exit("lineEnding");return factorySpace(effects,contentStart,"linePrefix")}function paragraphInitial(code2){effects.enter("paragraph");return lineStart(code2)}function lineStart(code2){const token=effects.enter("chunkText",{contentType:"text",previous:previous3});if(previous3){previous3.next=token}previous3=token;return data(code2)}function data(code2){if(code2===null){effects.exit("chunkText");effects.exit("paragraph");effects.consume(code2);return}if(markdownLineEnding(code2)){effects.consume(code2);effects.exit("chunkText");return lineStart}effects.consume(code2);return data}}var EditMap=class{constructor(){this.index=new Map;this.map=[]}add(index2,remove,add){addImplementation(this,index2,remove,add,false)}addBefore(index2,remove,add){addImplementation(this,index2,remove,add,true)}consume(events){this.map.sort(function(a,b){return a[0]-b[0]});if(this.map.length===0){return}let index2=this.map.length;const vecs=[];while(index2>0){index2-=1;vecs.push(events.slice(this.map[index2][0]+this.map[index2][1]),this.map[index2][2]);events.length=this.map[index2][0]}vecs.push(events.slice());events.length=0;let slice=vecs.pop();while(slice){for(const element2 of slice){events.push(element2)}slice=vecs.pop()}this.map.length=0;this.index.clear()}};function addImplementation(editMap,at,remove,add,before){if(remove===0&&add.length===0){return}const existing=editMap.index.get(at);if(existing){existing[1]+=remove;if(before){add.push(...existing[2]);existing[2]=add}else{existing[2].push(...add)}return}const change=[at,remove,add];editMap.map.push(change);editMap.index.set(at,change)}var document2={tokenize:initializeDocument};var containerConstruct={tokenize:tokenizeContainer};function initializeDocument(effects){const self=this;const stack=[];let continued=0;let childFlow;let childToken;let lineStartOffset;return start;function start(code2){if(continued<stack.length){const item=stack[continued];self.containerState=item[1];return effects.attempt(item[0].continuation,documentContinue,checkNewContainers)(code2)}return checkNewContainers(code2)}function documentContinue(code2){continued++;if(self.containerState._closeFlow){self.containerState._closeFlow=void 0;if(childFlow){closeFlow()}const indexBeforeExits=self.events.length;let indexBeforeFlow=indexBeforeExits;let point3;while(indexBeforeFlow--){if(self.events[indexBeforeFlow][0]==="exit"&&self.events[indexBeforeFlow][1].type==="chunkFlow"){point3=self.events[indexBeforeFlow][1].end;break}}exitContainers(continued);let index2=indexBeforeExits;while(index2<self.events.length){self.events[index2][1].end={...point3};index2++}const editMap=new EditMap;editMap.add(indexBeforeFlow+1,0,self.events.slice(indexBeforeExits));editMap.add(indexBeforeExits,index2-indexBeforeExits,[]);editMap.consume(self.events);return checkNewContainers(code2)}return start(code2)}function checkNewContainers(code2){if(continued===stack.length){if(!childFlow){return documentContinued(code2)}if(childFlow.currentConstruct&&childFlow.currentConstruct.concrete){return flowStart(code2)}self.interrupt=Boolean(childFlow.currentConstruct&&!childFlow._gfmTableDynamicInterruptHack)}self.containerState={};return effects.check(containerConstruct,thereIsANewContainer,thereIsNoNewContainer)(code2)}function thereIsANewContainer(code2){if(childFlow){closeFlow()}exitContainers(continued);return documentContinued(code2)}function thereIsNoNewContainer(code2){self.parser.lazy[self.now().line]=continued!==stack.length;lineStartOffset=self.now().offset;return flowStart(code2)}function documentContinued(code2){self.containerState={};return effects.attempt(containerConstruct,containerContinue,flowStart)(code2)}function containerContinue(code2){continued++;stack.push([self.currentConstruct,self.containerState]);return documentContinued(code2)}function flowStart(code2){if(code2===null){if(childFlow){closeFlow()}exitContainers(0);effects.consume(code2);return}childFlow=childFlow||self.parser.flow(self.now());effects.enter("chunkFlow",{_tokenizer:childFlow,contentType:"flow",previous:childToken});return flowContinue(code2)}function flowContinue(code2){if(code2===null){writeToChild(effects.exit("chunkFlow"),true);exitContainers(0);effects.consume(code2);return}if(markdownLineEnding(code2)){effects.consume(code2);writeToChild(effects.exit("chunkFlow"));continued=0;self.interrupt=void 0;return start}effects.consume(code2);return flowContinue}function writeToChild(token,endOfFile){const stream=self.sliceStream(token);if(endOfFile){stream.push(null)}token.previous=childToken;if(childToken){childToken.next=token}childToken=token;childFlow.defineSkip(token.start);childFlow.write(stream);if(self.parser.lazy[token.start.line]){let index2=childFlow.events.length;while(index2--){if(childFlow.events[index2][1].start.offset<lineStartOffset&&(!childFlow.events[index2][1].end||childFlow.events[index2][1].end.offset>lineStartOffset)){return}}const indexBeforeExits=self.events.length;let indexBeforeFlow=indexBeforeExits;let seen;let point3;while(indexBeforeFlow--){if(self.events[indexBeforeFlow][0]==="exit"&&self.events[indexBeforeFlow][1].type==="chunkFlow"){if(seen){point3=self.events[indexBeforeFlow][1].end;break}seen=true}}exitContainers(continued);index2=indexBeforeExits;while(index2<self.events.length){self.events[index2][1].end={...point3};index2++}const editMap=new EditMap;editMap.add(indexBeforeFlow+1,0,self.events.slice(indexBeforeExits));editMap.add(indexBeforeExits,index2-indexBeforeExits,[]);editMap.consume(self.events)}}function exitContainers(size){let index2=stack.length;while(index2-- >size){const entry=stack[index2];self.containerState=entry[1];entry[0].exit.call(self,effects)}stack.length=size}function closeFlow(){childFlow.write([null]);childToken=void 0;childFlow=void 0;self.containerState._closeFlow=void 0}}function tokenizeContainer(effects,ok3,nok){return factorySpace(effects,effects.attempt(this.parser.constructs.document,ok3,nok),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function classifyCharacter(code2){if(code2===null||markdownLineEndingOrSpace(code2)||unicodeWhitespace(code2)){return 1}if(unicodePunctuation(code2)){return 2}}function resolveAll(constructs2,events,context){const called=[];let index2=-1;while(++index2<constructs2.length){const resolve=constructs2[index2].resolveAll;if(resolve&&!called.includes(resolve)){events=resolve(events,context);called.push(resolve)}}return events}var attention={name:"attention",resolveAll:resolveAllAttention,tokenize:tokenizeAttention};function resolveAllAttention(events,context){let index2=-1;let nextEvents;while(++index2<events.length){if(events[index2][0]==="enter"&&events[index2][1].type==="attentionSequence"&&events[index2][1]._close){let open=index2;while(open--){if(events[open][0]==="exit"&&events[open][1].type==="attentionSequence"&&events[open][1]._open&&context.sliceSerialize(events[open][1]).charCodeAt(0)===context.sliceSerialize(events[index2][1]).charCodeAt(0)){if((events[open][1]._close||events[index2][1]._open)&&(events[index2][1].end.offset-events[index2][1].start.offset)%3&&!((events[open][1].end.offset-events[open][1].start.offset+events[index2][1].end.offset-events[index2][1].start.offset)%3)){continue}const use=events[open][1].end.offset-events[open][1].start.offset>1&&events[index2][1].end.offset-events[index2][1].start.offset>1?2:1;const start={...events[open][1].end};const end={...events[index2][1].start};movePoint(start,-use);movePoint(end,use);const openingSequence={type:use>1?"strongSequence":"emphasisSequence",start,end:{...events[open][1].end}};const closingSequence={type:use>1?"strongSequence":"emphasisSequence",start:{...events[index2][1].start},end};const text4={type:use>1?"strongText":"emphasisText",start:{...events[open][1].end},end:{...events[index2][1].start}};const group={type:use>1?"strong":"emphasis",start:{...openingSequence.start},end:{...closingSequence.end}};events[open][1].end={...openingSequence.start};events[index2][1].start={...closingSequence.end};nextEvents=[];if(events[open][1].end.offset-events[open][1].start.offset){nextEvents=push(nextEvents,[["enter",events[open][1],context],["exit",events[open][1],context]])}nextEvents=push(nextEvents,[["enter",group,context],["enter",openingSequence,context],["exit",openingSequence,context],["enter",text4,context]]);nextEvents=push(nextEvents,resolveAll(context.parser.constructs.insideSpan.null,events.slice(open+1,index2),context));nextEvents=push(nextEvents,[["exit",text4,context],["enter",closingSequence,context],["exit",closingSequence,context],["exit",group,context]]);let offset=0;if(events[index2][1].end.offset-events[index2][1].start.offset){offset=2;nextEvents=push(nextEvents,[["enter",events[index2][1],context],["exit",events[index2][1],context]])}splice(events,open-1,index2-open+3,nextEvents);index2=open+nextEvents.length-offset-2;break}}}}index2=-1;while(++index2<events.length){if(events[index2][1].type==="attentionSequence"){events[index2][1].type="data"}}return events}function tokenizeAttention(effects,ok3){const attentionMarkers2=this.parser.constructs.attentionMarkers.null;const previous3=this.previous;const before=classifyCharacter(previous3);let marker;return start;function start(code2){marker=code2;effects.enter("attentionSequence");return inside(code2)}function inside(code2){if(code2===marker){effects.consume(code2);return inside}const token=effects.exit("attentionSequence");const after=classifyCharacter(code2);const open=!after||after===2&&before||attentionMarkers2.includes(code2)&&code2!==42&&code2!==95;const close=!before||before===2&&after||attentionMarkers2.includes(previous3)&&previous3!==42&&previous3!==95;token._open=Boolean(marker===42?open:open&&(before||!close));token._close=Boolean(marker===42?close:close&&(after||!open));return ok3(code2)}}function movePoint(point3,offset){point3.column+=offset;point3.offset+=offset;point3._bufferIndex+=offset}var autolink={name:"autolink",tokenize:tokenizeAutolink};function tokenizeAutolink(effects,ok3,nok){let size=0;return start;function start(code2){effects.enter("autolink");effects.enter("autolinkMarker");effects.consume(code2);effects.exit("autolinkMarker");effects.enter("autolinkProtocol");return open}function open(code2){if(asciiAlpha(code2)){effects.consume(code2);return schemeOrEmailAtext}if(code2===64){return nok(code2)}return emailAtext(code2)}function schemeOrEmailAtext(code2){if(code2===43||code2===45||code2===46||asciiAlphanumeric(code2)){size=1;return schemeInsideOrEmailAtext(code2)}return emailAtext(code2)}function schemeInsideOrEmailAtext(code2){if(code2===58){effects.consume(code2);size=0;return urlInside}if((code2===43||code2===45||code2===46||asciiAlphanumeric(code2))&&size++<32){effects.consume(code2);return schemeInsideOrEmailAtext}size=0;return emailAtext(code2)}function urlInside(code2){if(code2===62){effects.exit("autolinkProtocol");effects.enter("autolinkMarker");effects.consume(code2);effects.exit("autolinkMarker");effects.exit("autolink");return ok3}if(code2===null||code2===32||code2===60||asciiControl(code2)){return nok(code2)}effects.consume(code2);return urlInside}function emailAtext(code2){if(code2===64){effects.consume(code2);return emailAtSignOrDot}if(asciiAtext(code2)){effects.consume(code2);return emailAtext}return nok(code2)}function emailAtSignOrDot(code2){return asciiAlphanumeric(code2)?emailLabel(code2):nok(code2)}function emailLabel(code2){if(code2===46){effects.consume(code2);size=0;return emailAtSignOrDot}if(code2===62){effects.exit("autolinkProtocol").type="autolinkEmail";effects.enter("autolinkMarker");effects.consume(code2);effects.exit("autolinkMarker");effects.exit("autolink");return ok3}return emailValue(code2)}function emailValue(code2){if((code2===45||asciiAlphanumeric(code2))&&size++<63){const next=code2===45?emailValue:emailLabel;effects.consume(code2);return next}return nok(code2)}}var blankLine={partial:true,tokenize:tokenizeBlankLine};function tokenizeBlankLine(effects,ok3,nok){return start;function start(code2){return markdownSpace(code2)?factorySpace(effects,after,"linePrefix")(code2):after(code2)}function after(code2){return code2===null||markdownLineEnding(code2)?ok3(code2):nok(code2)}}var blockQuote={continuation:{tokenize:tokenizeBlockQuoteContinuation},exit,name:"blockQuote",tokenize:tokenizeBlockQuoteStart};function tokenizeBlockQuoteStart(effects,ok3,nok){const self=this;return start;function start(code2){if(code2===62){const state=self.containerState;if(!state.open){effects.enter("blockQuote",{_container:true});state.open=true}effects.enter("blockQuotePrefix");effects.enter("blockQuoteMarker");effects.consume(code2);effects.exit("blockQuoteMarker");return after}return nok(code2)}function after(code2){if(markdownSpace(code2)){effects.enter("blockQuotePrefixWhitespace");effects.consume(code2);effects.exit("blockQuotePrefixWhitespace");effects.exit("blockQuotePrefix");return ok3}effects.exit("blockQuotePrefix");return ok3(code2)}}function tokenizeBlockQuoteContinuation(effects,ok3,nok){const self=this;return contStart;function contStart(code2){if(markdownSpace(code2)){return factorySpace(effects,contBefore,"linePrefix",self.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(code2)}return contBefore(code2)}function contBefore(code2){return effects.attempt(blockQuote,ok3,nok)(code2)}}function exit(effects){effects.exit("blockQuote")}var characterEscape={name:"characterEscape",tokenize:tokenizeCharacterEscape};function tokenizeCharacterEscape(effects,ok3,nok){return start;function start(code2){effects.enter("characterEscape");effects.enter("escapeMarker");effects.consume(code2);effects.exit("escapeMarker");return inside}function inside(code2){if(asciiPunctuation(code2)){effects.enter("characterEscapeValue");effects.consume(code2);effects.exit("characterEscapeValue");effects.exit("characterEscape");return ok3}return nok(code2)}}var characterReference={name:"characterReference",tokenize:tokenizeCharacterReference};function tokenizeCharacterReference(effects,ok3,nok){const self=this;let size=0;let max;let test;return start;function start(code2){effects.enter("characterReference");effects.enter("characterReferenceMarker");effects.consume(code2);effects.exit("characterReferenceMarker");return open}function open(code2){if(code2===35){effects.enter("characterReferenceMarkerNumeric");effects.consume(code2);effects.exit("characterReferenceMarkerNumeric");return numeric}effects.enter("characterReferenceValue");max=31;test=asciiAlphanumeric;return value(code2)}function numeric(code2){if(code2===88||code2===120){effects.enter("characterReferenceMarkerHexadecimal");effects.consume(code2);effects.exit("characterReferenceMarkerHexadecimal");effects.enter("characterReferenceValue");max=6;test=asciiHexDigit;return value}effects.enter("characterReferenceValue");max=7;test=asciiDigit;return value(code2)}function value(code2){if(code2===59&&size){const token=effects.exit("characterReferenceValue");if(test===asciiAlphanumeric&&!decodeNamedCharacterReference(self.sliceSerialize(token))){return nok(code2)}effects.enter("characterReferenceMarker");effects.consume(code2);effects.exit("characterReferenceMarker");effects.exit("characterReference");return ok3}if(test(code2)&&size++<max){effects.consume(code2);return value}return nok(code2)}}var nonLazyContinuation={partial:true,tokenize:tokenizeNonLazyContinuation};function tokenizeNonLazyContinuation(effects,ok3,nok){const self=this;return start;function start(code2){if(code2===null){return nok(code2)}effects.enter("lineEnding");effects.consume(code2);effects.exit("lineEnding");return after}function after(code2){return self.parser.lazy[self.now().line]?nok(code2):ok3(code2)}}var codeFenced={concrete:true,name:"codeFenced",tokenize:tokenizeCodeFenced};function tokenizeCodeFenced(effects,ok3,nok){const self=this;const closeStart={partial:true,tokenize:tokenizeCloseStart};let initialPrefix=0;let sizeOpen=0;let marker;return start;function start(code2){return beforeSequenceOpen(code2)}function beforeSequenceOpen(code2){const tail=self.events[self.events.length-1];initialPrefix=tail&&tail[1].type==="linePrefix"?tail[2].sliceSerialize(tail[1],true).length:0;marker=code2;effects.enter("codeFenced");effects.enter("codeFencedFence");effects.enter("codeFencedFenceSequence");return sequenceOpen(code2)}function sequenceOpen(code2){if(code2===marker){sizeOpen++;effects.consume(code2);return sequenceOpen}if(sizeOpen<3){return nok(code2)}effects.exit("codeFencedFenceSequence");return markdownSpace(code2)?factorySpace(effects,infoBefore,"whitespace")(code2):infoBefore(code2)}function infoBefore(code2){if(code2===null||markdownLineEnding(code2)){effects.exit("codeFencedFence");return self.interrupt?ok3(code2):effects.check(nonLazyContinuation,atNonLazyBreak,after)(code2)}effects.enter("codeFencedFenceInfo");effects.enter("chunkString",{contentType:"string"});return info(code2)}function info(code2){if(code2===null||markdownLineEnding(code2)){effects.exit("chunkString");effects.exit("codeFencedFenceInfo");return infoBefore(code2)}if(markdownSpace(code2)){effects.exit("chunkString");effects.exit("codeFencedFenceInfo");return factorySpace(effects,metaBefore,"whitespace")(code2)}if(code2===96&&code2===marker){return nok(code2)}effects.consume(code2);return info}function metaBefore(code2){if(code2===null||markdownLineEnding(code2)){return infoBefore(code2)}effects.enter("codeFencedFenceMeta");effects.enter("chunkString",{contentType:"string"});return meta(code2)}function meta(code2){if(code2===null||markdownLineEnding(code2)){effects.exit("chunkString");effects.exit("codeFencedFenceMeta");return infoBefore(code2)}if(code2===96&&code2===marker){return nok(code2)}effects.consume(code2);return meta}function atNonLazyBreak(code2){return effects.attempt(closeStart,after,contentBefore)(code2)}function contentBefore(code2){effects.enter("lineEnding");effects.consume(code2);effects.exit("lineEnding");return contentStart}function contentStart(code2){return initialPrefix>0&&markdownSpace(code2)?factorySpace(effects,beforeContentChunk,"linePrefix",initialPrefix+1)(code2):beforeContentChunk(code2)}function beforeContentChunk(code2){if(code2===null||markdownLineEnding(code2)){return effects.check(nonLazyContinuation,atNonLazyBreak,after)(code2)}effects.enter("codeFlowValue");return contentChunk(code2)}function contentChunk(code2){if(code2===null||markdownLineEnding(code2)){effects.exit("codeFlowValue");return beforeContentChunk(code2)}effects.consume(code2);return contentChunk}function after(code2){effects.exit("codeFenced");return ok3(code2)}function tokenizeCloseStart(effects2,ok4,nok2){let size=0;return startBefore;function startBefore(code2){effects2.enter("lineEnding");effects2.consume(code2);effects2.exit("lineEnding");return start2}function start2(code2){effects2.enter("codeFencedFence");return markdownSpace(code2)?factorySpace(effects2,beforeSequenceClose,"linePrefix",self.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(code2):beforeSequenceClose(code2)}function beforeSequenceClose(code2){if(code2===marker){effects2.enter("codeFencedFenceSequence");return sequenceClose(code2)}return nok2(code2)}function sequenceClose(code2){if(code2===marker){size++;effects2.consume(code2);return sequenceClose}if(size>=sizeOpen){effects2.exit("codeFencedFenceSequence");return markdownSpace(code2)?factorySpace(effects2,sequenceCloseAfter,"whitespace")(code2):sequenceCloseAfter(code2)}return nok2(code2)}function sequenceCloseAfter(code2){if(code2===null||markdownLineEnding(code2)){effects2.exit("codeFencedFence");return ok4(code2)}return nok2(code2)}}}var codeIndented={name:"codeIndented",tokenize:tokenizeCodeIndented};var furtherStart={partial:true,tokenize:tokenizeFurtherStart};function tokenizeCodeIndented(effects,ok3,nok){return start;function start(code2){effects.enter("codeIndented");return factorySpaceMinMax(effects,atBreak,nok,"linePrefix",4,4)(code2)}function atBreak(code2){if(code2===null){return after(code2)}if(markdownLineEnding(code2)){return effects.attempt(furtherStart,atBreak,after)(code2)}effects.enter("codeFlowValue");return inside(code2)}function inside(code2){if(code2===null||markdownLineEnding(code2)){effects.exit("codeFlowValue");return atBreak(code2)}effects.consume(code2);return inside}function after(code2){effects.exit("codeIndented");return ok3(code2)}}function tokenizeFurtherStart(effects,ok3,nok){const self=this;return furtherStart2;function furtherStart2(code2){if(self.parser.lazy[self.now().line]){return nok(code2)}if(markdownLineEnding(code2)){effects.enter("lineEnding");effects.consume(code2);effects.exit("lineEnding");return furtherStart2}return factorySpaceMinMax(effects,ok3,onNotEnoughPrefix,"linePrefix",4,4)(code2)}function onNotEnoughPrefix(code2){return markdownLineEnding(code2)?furtherStart2(code2):nok(code2)}}var codeText={name:"codeText",previous,resolve:resolveCodeText,tokenize:tokenizeCodeText};function resolveCodeText(events){let tailExitIndex=events.length-4;let headEnterIndex=3;let index2;let enter;if((events[headEnterIndex][1].type==="lineEnding"||events[headEnterIndex][1].type==="space")&&(events[tailExitIndex][1].type==="lineEnding"||events[tailExitIndex][1].type==="space")){index2=headEnterIndex;while(++index2<tailExitIndex){if(events[index2][1].type==="codeTextData"){events[headEnterIndex][1].type="codeTextPadding";events[tailExitIndex][1].type="codeTextPadding";headEnterIndex+=2;tailExitIndex-=2;break}}}index2=headEnterIndex-1;tailExitIndex++;while(++index2<=tailExitIndex){if(enter===void 0){if(index2!==tailExitIndex&&events[index2][1].type!=="lineEnding"){enter=index2}}else if(index2===tailExitIndex||events[index2][1].type==="lineEnding"){events[enter][1].type="codeTextData";if(index2!==enter+2){events[enter][1].end=events[index2-1][1].end;events.splice(enter+2,index2-enter-2);tailExitIndex-=index2-enter-2;index2=enter+2}enter=void 0}}return events}function previous(code2){return code2!==96||this.events[this.events.length-1][1].type==="characterEscape"}function tokenizeCodeText(effects,ok3,nok){const self=this;let sizeOpen=0;let size;let token;return start;function start(code2){effects.enter("codeText");effects.enter("codeTextSequence");return sequenceOpen(code2)}function sequenceOpen(code2){if(code2===96){effects.consume(code2);sizeOpen++;return sequenceOpen}effects.exit("codeTextSequence");return between(code2)}function between(code2){if(code2===null){return nok(code2)}if(code2===32){effects.enter("space");effects.consume(code2);effects.exit("space");return between}if(code2===96){token=effects.enter("codeTextSequence");size=0;return sequenceClose(code2)}if(markdownLineEnding(code2)){effects.enter("lineEnding");effects.consume(code2);effects.exit("lineEnding");return between}effects.enter("codeTextData");return data(code2)}function data(code2){if(code2===null||code2===32||code2===96||markdownLineEnding(code2)){effects.exit("codeTextData");return between(code2)}effects.consume(code2);return data}function sequenceClose(code2){if(code2===96){effects.consume(code2);size++;return sequenceClose}if(size===sizeOpen){effects.exit("codeTextSequence");effects.exit("codeText");return ok3(code2)}token.type="codeTextData";return data(code2)}}var SpliceBuffer=class{constructor(initial){this.left=initial?[...initial]:[];this.right=[]}get(index2){if(index2<0||index2>=this.left.length+this.right.length){throw new RangeError("Cannot access index `"+index2+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`")}if(index2<this.left.length)return this.left[index2];return this.right[this.right.length-index2+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){this.setCursor(0);return this.right.pop()}slice(start,end){const stop=end===null||end===void 0?Number.POSITIVE_INFINITY:end;if(stop<this.left.length){return this.left.slice(start,stop)}if(start>this.left.length){return this.right.slice(this.right.length-stop+this.left.length,this.right.length-start+this.left.length).reverse()}return this.left.slice(start).concat(this.right.slice(this.right.length-stop+this.left.length).reverse())}splice(start,deleteCount,items){const count=deleteCount||0;this.setCursor(Math.trunc(start));const removed=this.right.splice(this.right.length-count,Number.POSITIVE_INFINITY);if(items)chunkedPush(this.left,items);return removed.reverse()}pop(){this.setCursor(Number.POSITIVE_INFINITY);return this.left.pop()}push(item){this.setCursor(Number.POSITIVE_INFINITY);this.left.push(item)}pushMany(items){this.setCursor(Number.POSITIVE_INFINITY);chunkedPush(this.left,items)}unshift(item){this.setCursor(0);this.right.push(item)}unshiftMany(items){this.setCursor(0);chunkedPush(this.right,items.reverse())}setCursor(n){if(n===this.left.length||n>this.left.length&&this.right.length===0||n<0&&this.left.length===0)return;if(n<this.left.length){const removed=this.left.splice(n,Number.POSITIVE_INFINITY);chunkedPush(this.right,removed.reverse())}else{const removed=this.right.splice(this.left.length+this.right.length-n,Number.POSITIVE_INFINITY);chunkedPush(this.left,removed.reverse())}}};function chunkedPush(list2,right){let chunkStart=0;if(right.length<1e4){list2.push(...right)}else{while(chunkStart<right.length){list2.push(...right.slice(chunkStart,chunkStart+1e4));chunkStart+=1e4}}}function subtokenize(eventsArray){const jumps={};let index2=-1;let event;let lineIndex;let otherIndex;let otherEvent;let parameters;let subevents;let more;const events=new SpliceBuffer(eventsArray);while(++index2<events.length){while(index2 in jumps){index2=jumps[index2]}event=events.get(index2);if(index2&&event[1].type==="chunkFlow"&&events.get(index2-1)[1].type==="listItemPrefix"){subevents=event[1]._tokenizer.events;otherIndex=0;if(otherIndex<subevents.length&&subevents[otherIndex][1].type==="lineEndingBlank"){otherIndex+=2}if(otherIndex<subevents.length&&subevents[otherIndex][1].type==="content"){while(++otherIndex<subevents.length){if(subevents[otherIndex][1].type==="content"){break}if(subevents[otherIndex][1].type==="chunkText"){subevents[otherIndex][1]._isInFirstContentOfListItem=true;otherIndex++}}}}if(event[0]==="enter"){if(event[1].contentType){Object.assign(jumps,subcontent(events,index2));index2=jumps[index2];more=true}}else if(event[1]._container){otherIndex=index2;lineIndex=void 0;while(otherIndex--){otherEvent=events.get(otherIndex);if(otherEvent[1].type==="lineEnding"||otherEvent[1].type==="lineEndingBlank"){if(otherEvent[0]==="enter"){if(lineIndex){events.get(lineIndex)[1].type="lineEndingBlank"}otherEvent[1].type="lineEnding";lineIndex=otherIndex}}else if(otherEvent[1].type==="linePrefix"||otherEvent[1].type==="listItemIndent"){}else{break}}if(lineIndex){event[1].end={...events.get(lineIndex)[1].start};parameters=events.slice(lineIndex,index2);parameters.unshift(event);events.splice(lineIndex,index2-lineIndex+1,parameters)}}}splice(eventsArray,0,Number.POSITIVE_INFINITY,events.slice(0));return!more}function subcontent(events,eventIndex){const token=events.get(eventIndex)[1];const context=events.get(eventIndex)[2];let startPosition=eventIndex-1;const startPositions=[];let tokenizer=token._tokenizer;if(!tokenizer){tokenizer=context.parser[token.contentType](token.start);if(token._contentTypeTextTrailing){tokenizer._contentTypeTextTrailing=true}}const childEvents=tokenizer.events;const jumps=[];const gaps={};let stream;let previous3;let index2=-1;let current=token;let adjust=0;let start=0;const breaks=[start];while(current){while(events.get(++startPosition)[1]!==current){}startPositions.push(startPosition);if(!current._tokenizer){stream=context.sliceStream(current);if(!current.next){stream.push(null)}if(previous3){tokenizer.defineSkip(current.start)}if(current._isInFirstContentOfListItem){tokenizer._gfmTasklistFirstContentOfListItem=true}tokenizer.write(stream);if(current._isInFirstContentOfListItem){tokenizer._gfmTasklistFirstContentOfListItem=void 0}}previous3=current;current=current.next}current=token;while(++index2<childEvents.length){if(childEvents[index2][0]==="exit"&&childEvents[index2-1][0]==="enter"&&childEvents[index2][1].type===childEvents[index2-1][1].type&&childEvents[index2][1].start.line!==childEvents[index2][1].end.line){start=index2+1;breaks.push(start);current._tokenizer=void 0;current.previous=void 0;current=current.next}}tokenizer.events=[];if(current){current._tokenizer=void 0;current.previous=void 0}else{breaks.pop()}index2=breaks.length;while(index2--){const slice=childEvents.slice(breaks[index2],breaks[index2+1]);const start2=startPositions.pop();jumps.push([start2,start2+slice.length-1]);events.splice(start2,2,slice)}jumps.reverse();index2=-1;while(++index2<jumps.length){gaps[adjust+jumps[index2][0]]=adjust+jumps[index2][1];adjust+=jumps[index2][1]-jumps[index2][0]-1}return gaps}var content2={resolve:resolveContent,tokenize:tokenizeContent};var continuationConstruct={partial:true,tokenize:tokenizeContinuation};function resolveContent(events){subtokenize(events);return events}function tokenizeContent(effects,ok3){let previous3;return chunkStart;function chunkStart(code2){effects.enter("content");previous3=effects.enter("chunkContent",{contentType:"content"});return chunkInside(code2)}function chunkInside(code2){if(code2===null){return contentEnd(code2)}if(markdownLineEnding(code2)){return effects.check(continuationConstruct,contentContinue,contentEnd)(code2)}effects.consume(code2);return chunkInside}function contentEnd(code2){effects.exit("chunkContent");effects.exit("content");return ok3(code2)}function contentContinue(code2){effects.consume(code2);effects.exit("chunkContent");previous3.next=effects.enter("chunkContent",{contentType:"content",previous:previous3});previous3=previous3.next;return chunkInside}}function tokenizeContinuation(effects,ok3,nok){const self=this;return startLookahead;function startLookahead(code2){effects.exit("chunkContent");effects.enter("lineEnding");effects.consume(code2);effects.exit("lineEnding");return factorySpace(effects,prefixed,"linePrefix")}function prefixed(code2){if(code2===null||markdownLineEnding(code2)){return nok(code2)}const tail=self.events[self.events.length-1];if(!self.parser.constructs.disable.null.includes("codeIndented")&&tail&&tail[1].type==="linePrefix"&&tail[2].sliceSerialize(tail[1],true).length>=4){return ok3(code2)}return effects.interrupt(self.parser.constructs.flow,nok,ok3)(code2)}}function factoryDestination(effects,ok3,nok,type,literalType,literalMarkerType,rawType,stringType,max){const limit=max||Number.POSITIVE_INFINITY;let balance=0;return start;function start(code2){if(code2===60){effects.enter(type);effects.enter(literalType);effects.enter(literalMarkerType);effects.consume(code2);effects.exit(literalMarkerType);return enclosedBefore}if(code2===null||code2===32||code2===41||asciiControl(code2)){return nok(code2)}effects.enter(type);effects.enter(rawType);effects.enter(stringType);effects.enter("chunkString",{contentType:"string"});return raw(code2)}function enclosedBefore(code2){if(code2===62){effects.enter(literalMarkerType);effects.consume(code2);effects.exit(literalMarkerType);effects.exit(literalType);effects.exit(type);return ok3}effects.enter(stringType);effects.enter("chunkString",{contentType:"string"});return enclosed(code2)}function enclosed(code2){if(code2===62){effects.exit("chunkString");effects.exit(stringType);return enclosedBefore(code2)}if(code2===null||code2===60||markdownLineEnding(code2)){return nok(code2)}effects.consume(code2);return code2===92?enclosedEscape:enclosed}function enclosedEscape(code2){if(code2===60||code2===62||code2===92){effects.consume(code2);return enclosed}return enclosed(code2)}function raw(code2){if(!balance&&(code2===null||code2===41||markdownLineEndingOrSpace(code2))){effects.exit("chunkString");effects.exit(stringType);effects.exit(rawType);effects.exit(type);return ok3(code2)}if(balance<limit&&code2===40){effects.consume(code2);balance++;return raw}if(code2===41){effects.consume(code2);balance--;return raw}if(code2===null||code2===32||code2===40||asciiControl(code2)){return nok(code2)}effects.consume(code2);return code2===92?rawEscape:raw}function rawEscape(code2){if(code2===40||code2===41||code2===92){effects.consume(code2);return raw}return raw(code2)}}function factoryLabel(effects,ok3,nok,type,markerType,stringType){const self=this;let size=0;let seen;return start;function start(code2){effects.enter(type);effects.enter(markerType);effects.consume(code2);effects.exit(markerType);effects.enter(stringType);return atBreak}function atBreak(code2){if(size>999||code2===null||code2===91||code2===93&&!seen||code2===94&&!size&&"_hiddenFootnoteSupport"in self.parser.constructs){return nok(code2)}if(code2===93){effects.exit(stringType);effects.enter(markerType);effects.consume(code2);effects.exit(markerType);effects.exit(type);return ok3}if(markdownLineEnding(code2)){effects.enter("lineEnding");effects.consume(code2);effects.exit("lineEnding");return atBreak}effects.enter("chunkString",{contentType:"string"});return labelInside(code2)}function labelInside(code2){if(code2===null||code2===91||code2===93||markdownLineEnding(code2)||size++>999){effects.exit("chunkString");return atBreak(code2)}effects.consume(code2);if(!seen)seen=!markdownSpace(code2);return code2===92?labelEscape:labelInside}function labelEscape(code2){if(code2===91||code2===92||code2===93){effects.consume(code2);size++;return labelInside}return labelInside(code2)}}function factoryTitle(effects,ok3,nok,type,markerType,stringType){let marker;return start;function start(code2){if(code2===34||code2===39||code2===40){effects.enter(type);effects.enter(markerType);effects.consume(code2);effects.exit(markerType);marker=code2===40?41:code2;return begin}return nok(code2)}function begin(code2){if(code2===marker){effects.enter(markerType);effects.consume(code2);effects.exit(markerType);effects.exit(type);return ok3}effects.enter(stringType);return atBreak(code2)}function atBreak(code2){if(code2===marker){effects.exit(stringType);return begin(marker)}if(code2===null){return nok(code2)}if(markdownLineEnding(code2)){effects.enter("lineEnding");effects.consume(code2);effects.exit("lineEnding");return factorySpace(effects,atBreak,"linePrefix")}effects.enter("chunkString",{contentType:"string"});return inside(code2)}function inside(code2){if(code2===marker||code2===null||markdownLineEnding(code2)){effects.exit("chunkString");return atBreak(code2)}effects.consume(code2);return code2===92?escape:inside}function escape(code2){if(code2===marker||code2===92){effects.consume(code2);return inside}return inside(code2)}}function factoryWhitespace(effects,ok3){let seen;return start;function start(code2){if(markdownLineEnding(code2)){effects.enter("lineEnding");effects.consume(code2);effects.exit("lineEnding");seen=true;return start}if(markdownSpace(code2)){return factorySpace(effects,start,seen?"linePrefix":"lineSuffix")(code2)}return ok3(code2)}}var definition={name:"definition",tokenize:tokenizeDefinition};var titleBefore={partial:true,tokenize:tokenizeTitleBefore};function tokenizeDefinition(effects,ok3,nok){const self=this;let identifier;return start;function start(code2){effects.enter("definition");return before(code2)}function before(code2){return factoryLabel.call(self,effects,labelAfter,nok,"definitionLabel","definitionLabelMarker","definitionLabelString")(code2)}function labelAfter(code2){identifier=normalizeIdentifier(self.sliceSerialize(self.events[self.events.length-1][1]).slice(1,-1));if(code2===58){effects.enter("definitionMarker");effects.consume(code2);effects.exit("definitionMarker");return markerAfter}return nok(code2)}function markerAfter(code2){return markdownLineEndingOrSpace(code2)?factoryWhitespace(effects,destinationBefore)(code2):destinationBefore(code2)}function destinationBefore(code2){return factoryDestination(effects,destinationAfter,nok,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(code2)}function destinationAfter(code2){return effects.attempt(titleBefore,after,after)(code2)}function after(code2){return markdownSpace(code2)?factorySpace(effects,afterWhitespace,"whitespace")(code2):afterWhitespace(code2)}function afterWhitespace(code2){if(code2===null||markdownLineEnding(code2)){effects.exit("definition");self.parser.defined.push(identifier);return ok3(code2)}return nok(code2)}}function tokenizeTitleBefore(effects,ok3,nok){return titleBefore2;function titleBefore2(code2){return markdownLineEndingOrSpace(code2)?factoryWhitespace(effects,beforeMarker)(code2):nok(code2)}function beforeMarker(code2){return factoryTitle(effects,titleAfter,nok,"definitionTitle","definitionTitleMarker","definitionTitleString")(code2)}function titleAfter(code2){return markdownSpace(code2)?factorySpace(effects,titleAfterOptionalWhitespace,"whitespace")(code2):titleAfterOptionalWhitespace(code2)}function titleAfterOptionalWhitespace(code2){return code2===null||markdownLineEnding(code2)?ok3(code2):nok(code2)}}var hardBreakEscape={name:"hardBreakEscape",tokenize:tokenizeHardBreakEscape};function tokenizeHardBreakEscape(effects,ok3,nok){return start;function start(code2){effects.enter("hardBreakEscape");effects.consume(code2);return after}function after(code2){if(markdownLineEnding(code2)){effects.exit("hardBreakEscape");return ok3(code2)}return nok(code2)}}var headingAtx={name:"headingAtx",resolve:resolveHeadingAtx,tokenize:tokenizeHeadingAtx};function resolveHeadingAtx(events,context){let contentEnd=events.length-2;let contentStart=3;if(events[contentStart][1].type==="whitespace"){contentStart+=2}if(contentEnd-2>contentStart&&events[contentEnd][1].type==="whitespace"){contentEnd-=2}if(events[contentEnd][1].type==="atxHeadingSequence"&&(contentStart===contentEnd-1||contentEnd-4>contentStart&&events[contentEnd-2][1].type==="whitespace")){contentEnd-=contentStart+1===contentEnd?2:4}if(contentEnd>contentStart){const content3={type:"atxHeadingText",start:events[contentStart][1].start,end:events[contentEnd][1].end};const text4={type:"chunkText",start:events[contentStart][1].start,end:events[contentEnd][1].end,contentType:"text"};splice(events,contentStart,contentEnd-contentStart+1,[["enter",content3,context],["enter",text4,context],["exit",text4,context],["exit",content3,context]])}return events}function tokenizeHeadingAtx(effects,ok3,nok){let size=0;return start;function start(code2){effects.enter("atxHeading");return before(code2)}function before(code2){effects.enter("atxHeadingSequence");return sequenceOpen(code2)}function sequenceOpen(code2){if(code2===35&&size++<6){effects.consume(code2);return sequenceOpen}if(code2===null||markdownLineEndingOrSpace(code2)){effects.exit("atxHeadingSequence");return atBreak(code2)}return nok(code2)}function atBreak(code2){if(code2===35){effects.enter("atxHeadingSequence");return sequenceFurther(code2)}if(code2===null||markdownLineEnding(code2)){effects.exit("atxHeading");return ok3(code2)}if(markdownSpace(code2)){return factorySpace(effects,atBreak,"whitespace")(code2)}effects.enter("atxHeadingText");return data(code2)}function sequenceFurther(code2){if(code2===35){effects.consume(code2);return sequenceFurther}effects.exit("atxHeadingSequence");return atBreak(code2)}function data(code2){if(code2===null||code2===35||markdownLineEndingOrSpace(code2)){effects.exit("atxHeadingText");return atBreak(code2)}effects.consume(code2);return data}}var htmlBlockNames=["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"];var htmlRawNames=["pre","script","style","textarea"];var htmlFlow={concrete:true,name:"htmlFlow",resolveTo:resolveToHtmlFlow,tokenize:tokenizeHtmlFlow};var blankLineBefore={partial:true,tokenize:tokenizeBlankLineBefore};function resolveToHtmlFlow(events){let index2=events.length;while(index2--){if(events[index2][0]==="enter"&&events[index2][1].type==="htmlFlow"){break}}if(index2>1&&events[index2-2][1].type==="linePrefix"){events[index2][1].start=events[index2-2][1].start;events[index2+1][1].start=events[index2-2][1].start;events.splice(index2-2,2)}return events}function tokenizeHtmlFlow(effects,ok3,nok){const self=this;let marker;let closingTag;let buffer;let index2;let markerB;return start;function start(code2){return before(code2)}function before(code2){effects.enter("htmlFlow");effects.enter("htmlFlowData");effects.consume(code2);return open}function open(code2){if(code2===33){effects.consume(code2);return declarationOpen}if(code2===47){effects.consume(code2);closingTag=true;return tagCloseStart}if(code2===63){effects.consume(code2);marker=3;return self.interrupt?ok3:continuationDeclarationInside}if(asciiAlpha(code2)){effects.consume(code2);buffer=String.fromCharCode(code2);return tagName}return nok(code2)}function declarationOpen(code2){if(code2===45){effects.consume(code2);marker=2;return commentOpenInside}if(code2===91){effects.consume(code2);marker=5;index2=0;return cdataOpenInside}if(asciiAlpha(code2)){effects.consume(code2);marker=4;return self.interrupt?ok3:continuationDeclarationInside}return nok(code2)}function commentOpenInside(code2){if(code2===45){effects.consume(code2);return self.interrupt?ok3:continuationDeclarationInside}return nok(code2)}function cdataOpenInside(code2){const value="CDATA[";if(code2===value.charCodeAt(index2++)){effects.consume(code2);if(index2===value.length){return self.interrupt?ok3:continuation}return cdataOpenInside}return nok(code2)}function tagCloseStart(code2){if(asciiAlpha(code2)){effects.consume(code2);buffer=String.fromCharCode(code2);return tagName}return nok(code2)}function tagName(code2){if(code2===null||code2===47||code2===62||markdownLineEndingOrSpace(code2)){const slash=code2===47;const name=buffer.toLowerCase();if(!slash&&!closingTag&&htmlRawNames.includes(name)){marker=1;return self.interrupt?ok3(code2):continuation(code2)}if(htmlBlockNames.includes(buffer.toLowerCase())){marker=6;if(slash){effects.consume(code2);return basicSelfClosing}return self.interrupt?ok3(code2):continuation(code2)}marker=7;return self.interrupt&&!self.parser.lazy[self.now().line]?nok(code2):closingTag?completeClosingTagAfter(code2):completeAttributeNameBefore(code2)}if(code2===45||asciiAlphanumeric(code2)){effects.consume(code2);buffer+=String.fromCharCode(code2);return tagName}return nok(code2)}function basicSelfClosing(code2){if(code2===62){effects.consume(code2);return self.interrupt?ok3:continuation}return nok(code2)}function completeClosingTagAfter(code2){if(markdownSpace(code2)){effects.consume(code2);return completeClosingTagAfter}return completeEnd(code2)}function completeAttributeNameBefore(code2){if(code2===47){effects.consume(code2);return completeEnd}if(code2===58||code2===95||asciiAlpha(code2)){effects.consume(code2);return completeAttributeName}if(markdownSpace(code2)){effects.consume(code2);return completeAttributeNameBefore}return completeEnd(code2)}function completeAttributeName(code2){if(code2===45||code2===46||code2===58||code2===95||asciiAlphanumeric(code2)){effects.consume(code2);return completeAttributeName}return completeAttributeNameAfter(code2)}function completeAttributeNameAfter(code2){if(code2===61){effects.consume(code2);return completeAttributeValueBefore}if(markdownSpace(code2)){effects.consume(code2);return completeAttributeNameAfter}return completeAttributeNameBefore(code2)}function completeAttributeValueBefore(code2){if(code2===null||code2===60||code2===61||code2===62||code2===96){return nok(code2)}if(code2===34||code2===39){effects.consume(code2);markerB=code2;return completeAttributeValueQuoted}if(markdownSpace(code2)){effects.consume(code2);return completeAttributeValueBefore}return completeAttributeValueUnquoted(code2)}function completeAttributeValueQuoted(code2){if(code2===markerB){effects.consume(code2);markerB=null;return completeAttributeValueQuotedAfter}if(code2===null||markdownLineEnding(code2)){return nok(code2)}effects.consume(code2);return completeAttributeValueQuoted}function completeAttributeValueUnquoted(code2){if(code2===null||code2===34||code2===39||code2===47||code2===60||code2===61||code2===62||code2===96||markdownLineEndingOrSpace(code2)){return completeAttributeNameAfter(code2)}effects.consume(code2);return completeAttributeValueUnquoted}function completeAttributeValueQuotedAfter(code2){if(code2===47||code2===62||markdownSpace(code2)){return completeAttributeNameBefore(code2)}return nok(code2)}function completeEnd(code2){if(code2===62){effects.consume(code2);return completeAfter}return nok(code2)}function completeAfter(code2){if(code2===null||markdownLineEnding(code2)){return continuation(code2)}if(markdownSpace(code2)){effects.consume(code2);return completeAfter}return nok(code2)}function continuation(code2){if(code2===45&&marker===2){effects.consume(code2);return continuationCommentInside}if(code2===60&&marker===1){effects.consume(code2);return continuationRawTagOpen}if(code2===62&&marker===4){effects.consume(code2);return continuationClose}if(code2===63&&marker===3){effects.consume(code2);return continuationDeclarationInside}if(code2===93&&marker===5){effects.consume(code2);return continuationCdataInside}if(markdownLineEnding(code2)&&(marker===6||marker===7)){effects.exit("htmlFlowData");return effects.check(blankLineBefore,continuationAfter,continuationStart)(code2)}if(code2===null||markdownLineEnding(code2)){effects.exit("htmlFlowData");return continuationStart(code2)}effects.consume(code2);return continuation}function continuationStart(code2){return effects.check(nonLazyContinuation,continuationStartNonLazy,continuationAfter)(code2)}function continuationStartNonLazy(code2){effects.enter("lineEnding");effects.consume(code2);effects.exit("lineEnding");return continuationBefore}function continuationBefore(code2){if(code2===null||markdownLineEnding(code2)){return continuationStart(code2)}effects.enter("htmlFlowData");return continuation(code2)}function continuationCommentInside(code2){if(code2===45){effects.consume(code2);return continuationDeclarationInside}return continuation(code2)}function continuationRawTagOpen(code2){if(code2===47){effects.consume(code2);buffer="";return continuationRawEndTag}return continuation(code2)}function continuationRawEndTag(code2){if(code2===62){const name=buffer.toLowerCase();if(htmlRawNames.includes(name)){effects.consume(code2);return continuationClose}return continuation(code2)}if(asciiAlpha(code2)&&buffer.length<8){effects.consume(code2);buffer+=String.fromCharCode(code2);return continuationRawEndTag}return continuation(code2)}function continuationCdataInside(code2){if(code2===93){effects.consume(code2);return continuationDeclarationInside}return continuation(code2)}function continuationDeclarationInside(code2){if(code2===62){effects.consume(code2);return continuationClose}if(code2===45&&marker===2){effects.consume(code2);return continuationDeclarationInside}return continuation(code2)}function continuationClose(code2){if(code2===null||markdownLineEnding(code2)){effects.exit("htmlFlowData");return continuationAfter(code2)}effects.consume(code2);return continuationClose}function continuationAfter(code2){effects.exit("htmlFlow");return ok3(code2)}}function tokenizeBlankLineBefore(effects,ok3,nok){return start;function start(code2){effects.enter("lineEnding");effects.consume(code2);effects.exit("lineEnding");return effects.attempt(blankLine,ok3,nok)}}var htmlText={name:"htmlText",tokenize:tokenizeHtmlText};function tokenizeHtmlText(effects,ok3,nok){const self=this;let marker;let index2;let returnState;return start;function start(code2){effects.enter("htmlText");effects.enter("htmlTextData");effects.consume(code2);return open}function open(code2){if(code2===33){effects.consume(code2);return declarationOpen}if(code2===47){effects.consume(code2);return tagCloseStart}if(code2===63){effects.consume(code2);return instruction}if(asciiAlpha(code2)){effects.consume(code2);return tagOpen}return nok(code2)}function declarationOpen(code2){if(code2===45){effects.consume(code2);return commentOpenInside}if(code2===91){effects.consume(code2);index2=0;return cdataOpenInside}if(asciiAlpha(code2)){effects.consume(code2);return declaration}return nok(code2)}function commentOpenInside(code2){if(code2===45){effects.consume(code2);return commentEnd}return nok(code2)}function comment(code2){if(code2===null){return nok(code2)}if(code2===45){effects.consume(code2);return commentClose}if(markdownLineEnding(code2)){returnState=comment;return lineEndingBefore(code2)}effects.consume(code2);return comment}function commentClose(code2){if(code2===45){effects.consume(code2);return commentEnd}return comment(code2)}function commentEnd(code2){return code2===62?end(code2):code2===45?commentClose(code2):comment(code2)}function cdataOpenInside(code2){const value="CDATA[";if(code2===value.charCodeAt(index2++)){effects.consume(code2);return index2===value.length?cdata:cdataOpenInside}return nok(code2)}function cdata(code2){if(code2===null){return nok(code2)}if(code2===93){effects.consume(code2);return cdataClose}if(markdownLineEnding(code2)){returnState=cdata;return lineEndingBefore(code2)}effects.consume(code2);return cdata}function cdataClose(code2){if(code2===93){effects.consume(code2);return cdataEnd}return cdata(code2)}function cdataEnd(code2){if(code2===62){return end(code2)}if(code2===93){effects.consume(code2);return cdataEnd}return cdata(code2)}function declaration(code2){if(code2===null||code2===62){return end(code2)}if(markdownLineEnding(code2)){returnState=declaration;return lineEndingBefore(code2)}effects.consume(code2);return declaration}function instruction(code2){if(code2===null){return nok(code2)}if(code2===63){effects.consume(code2);return instructionClose}if(markdownLineEnding(code2)){returnState=instruction;return lineEndingBefore(code2)}effects.consume(code2);return instruction}function instructionClose(code2){return code2===62?end(code2):instruction(code2)}function tagCloseStart(code2){if(asciiAlpha(code2)){effects.consume(code2);return tagClose}return nok(code2)}function tagClose(code2){if(code2===45||asciiAlphanumeric(code2)){effects.consume(code2);return tagClose}return tagCloseBetween(code2)}function tagCloseBetween(code2){if(markdownLineEnding(code2)){returnState=tagCloseBetween;return lineEndingBefore(code2)}if(markdownSpace(code2)){effects.consume(code2);return tagCloseBetween}return end(code2)}function tagOpen(code2){if(code2===45||asciiAlphanumeric(code2)){effects.consume(code2);return tagOpen}if(code2===47||code2===62||markdownLineEndingOrSpace(code2)){return tagOpenBetween(code2)}return nok(code2)}function tagOpenBetween(code2){if(code2===47){effects.consume(code2);return end}if(code2===58||code2===95||asciiAlpha(code2)){effects.consume(code2);return tagOpenAttributeName}if(markdownLineEnding(code2)){returnState=tagOpenBetween;return lineEndingBefore(code2)}if(markdownSpace(code2)){effects.consume(code2);return tagOpenBetween}return end(code2)}function tagOpenAttributeName(code2){if(code2===45||code2===46||code2===58||code2===95||asciiAlphanumeric(code2)){effects.consume(code2);return tagOpenAttributeName}return tagOpenAttributeNameAfter(code2)}function tagOpenAttributeNameAfter(code2){if(code2===61){effects.consume(code2);return tagOpenAttributeValueBefore}if(markdownLineEnding(code2)){returnState=tagOpenAttributeNameAfter;return lineEndingBefore(code2)}if(markdownSpace(code2)){effects.consume(code2);return tagOpenAttributeNameAfter}return tagOpenBetween(code2)}function tagOpenAttributeValueBefore(code2){if(code2===null||code2===60||code2===61||code2===62||code2===96){return nok(code2)}if(code2===34||code2===39){effects.consume(code2);marker=code2;return tagOpenAttributeValueQuoted}if(markdownLineEnding(code2)){returnState=tagOpenAttributeValueBefore;return lineEndingBefore(code2)}if(markdownSpace(code2)){effects.consume(code2);return tagOpenAttributeValueBefore}effects.consume(code2);return tagOpenAttributeValueUnquoted}function tagOpenAttributeValueQuoted(code2){if(code2===marker){effects.consume(code2);marker=void 0;return tagOpenAttributeValueQuotedAfter}if(code2===null){return nok(code2)}if(markdownLineEnding(code2)){returnState=tagOpenAttributeValueQuoted;return lineEndingBefore(code2)}effects.consume(code2);return tagOpenAttributeValueQuoted}function tagOpenAttributeValueUnquoted(code2){if(code2===null||code2===34||code2===39||code2===60||code2===61||code2===96){return nok(code2)}if(code2===47||code2===62||markdownLineEndingOrSpace(code2)){return tagOpenBetween(code2)}effects.consume(code2);return tagOpenAttributeValueUnquoted}function tagOpenAttributeValueQuotedAfter(code2){if(code2===47||code2===62||markdownLineEndingOrSpace(code2)){return tagOpenBetween(code2)}return nok(code2)}function end(code2){if(code2===62){effects.consume(code2);effects.exit("htmlTextData");effects.exit("htmlText");return ok3}return nok(code2)}function lineEndingBefore(code2){effects.exit("htmlTextData");effects.enter("lineEnding");effects.consume(code2);effects.exit("lineEnding");return lineEndingAfter}function lineEndingAfter(code2){return markdownSpace(code2)?factorySpace(effects,lineEndingAfterPrefix,"linePrefix",self.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(code2):lineEndingAfterPrefix(code2)}function lineEndingAfterPrefix(code2){effects.enter("htmlTextData");return returnState(code2)}}var labelEnd={name:"labelEnd",resolveAll:resolveAllLabelEnd,resolveTo:resolveToLabelEnd,tokenize:tokenizeLabelEnd};var resourceConstruct={tokenize:tokenizeResource};var referenceFullConstruct={tokenize:tokenizeReferenceFull};var referenceCollapsedConstruct={tokenize:tokenizeReferenceCollapsed};function resolveAllLabelEnd(events){let index2=-1;const newEvents=[];while(++index2<events.length){const token=events[index2][1];newEvents.push(events[index2]);if(token.type==="labelImage"||token.type==="labelLink"||token.type==="labelEnd"){const offset=token.type==="labelImage"?4:2;token.type="data";index2+=offset}}if(events.length!==newEvents.length){splice(events,0,events.length,newEvents)}return events}function resolveToLabelEnd(events,context){let index2=events.length;let offset=0;let open;let close;let media;while(index2--){const token=events[index2][1];if(open){if(token.type==="link"||token.type==="labelLink"&&token._inactive){break}if(events[index2][0]==="enter"&&token.type==="labelLink"){token._inactive=true}}else if(close){if(events[index2][0]==="enter"&&(token.type==="labelImage"||token.type==="labelLink")&&!token._balanced){open=index2;if(token.type!=="labelLink"){offset=2;break}}}else if(token.type==="labelEnd"){close=index2}}const group={type:events[open][1].type==="labelLink"?"link":"image",start:{...events[open][1].start},end:{...events[events.length-1][1].end}};const label={type:"label",start:{...events[open][1].start},end:{...events[close][1].end}};const text4={type:"labelText",start:{...events[open+offset+2][1].end},end:{...events[close-2][1].start}};media=[["enter",group,context],["enter",label,context]];media=push(media,events.slice(open+1,open+offset+3));media=push(media,[["enter",text4,context]]);media=push(media,resolveAll(context.parser.constructs.insideSpan.null,events.slice(open+offset+4,close-3),context));media=push(media,[["exit",text4,context],events[close-2],events[close-1],["exit",label,context]]);media=push(media,events.slice(close+1));media=push(media,[["exit",group,context]]);splice(events,open,events.length,media);return events}function tokenizeLabelEnd(effects,ok3,nok){const self=this;const labelStarts=self._labelStarts;let labelStart;let defined;if(labelStarts){while(labelStarts.length>0&&labelStarts[labelStarts.length-1]._balanced){labelStarts.pop()}labelStart=labelStarts[labelStarts.length-1]}return start;function start(code2){if(!labelStart){return nok(code2)}if(labelStart._inactive){return labelEndNok(code2)}defined=self.parser.defined.includes(normalizeIdentifier(self.sliceSerialize({start:labelStart.end,end:self.now()})));effects.enter("labelEnd");effects.enter("labelMarker");effects.consume(code2);effects.exit("labelMarker");effects.exit("labelEnd");return after}function after(code2){if(code2===40){return effects.attempt(resourceConstruct,labelEndOk,defined?labelEndOk:labelEndNok)(code2)}if(code2===91){return effects.attempt(referenceFullConstruct,labelEndOk,defined?referenceNotFull:labelEndNok)(code2)}return defined?labelEndOk(code2):labelEndNok(code2)}function referenceNotFull(code2){return effects.attempt(referenceCollapsedConstruct,labelEndOk,labelEndNok)(code2)}function labelEndOk(code2){labelStarts.pop();return ok3(code2)}function labelEndNok(code2){labelStart._balanced=true;return nok(code2)}}function tokenizeResource(effects,ok3,nok){return resourceStart;function resourceStart(code2){effects.enter("resource");effects.enter("resourceMarker");effects.consume(code2);effects.exit("resourceMarker");return resourceBefore}function resourceBefore(code2){return markdownLineEndingOrSpace(code2)?factoryWhitespace(effects,resourceOpen)(code2):resourceOpen(code2)}function resourceOpen(code2){if(code2===41){return resourceEnd(code2)}return factoryDestination(effects,resourceDestinationAfter,resourceDestinationMissing,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(code2)}function resourceDestinationAfter(code2){return markdownLineEndingOrSpace(code2)?factoryWhitespace(effects,resourceBetween)(code2):resourceEnd(code2)}function resourceDestinationMissing(code2){return nok(code2)}function resourceBetween(code2){if(code2===34||code2===39||code2===40){return factoryTitle(effects,resourceTitleAfter,nok,"resourceTitle","resourceTitleMarker","resourceTitleString")(code2)}return resourceEnd(code2)}function resourceTitleAfter(code2){return markdownLineEndingOrSpace(code2)?factoryWhitespace(effects,resourceEnd)(code2):resourceEnd(code2)}function resourceEnd(code2){if(code2===41){effects.enter("resourceMarker");effects.consume(code2);effects.exit("resourceMarker");effects.exit("resource");return ok3}return nok(code2)}}function tokenizeReferenceFull(effects,ok3,nok){const self=this;return referenceFull;function referenceFull(code2){return factoryLabel.call(self,effects,referenceFullAfter,referenceFullMissing,"reference","referenceMarker","referenceString")(code2)}function referenceFullAfter(code2){return self.parser.defined.includes(normalizeIdentifier(self.sliceSerialize(self.events[self.events.length-1][1]).slice(1,-1)))?ok3(code2):nok(code2)}function referenceFullMissing(code2){return nok(code2)}}function tokenizeReferenceCollapsed(effects,ok3,nok){return referenceCollapsedStart;function referenceCollapsedStart(code2){effects.enter("reference");effects.enter("referenceMarker");effects.consume(code2);effects.exit("referenceMarker");return referenceCollapsedOpen}function referenceCollapsedOpen(code2){if(code2===93){effects.enter("referenceMarker");effects.consume(code2);effects.exit("referenceMarker");effects.exit("reference");return ok3}return nok(code2)}}var labelStartImage={name:"labelStartImage",resolveAll:labelEnd.resolveAll,tokenize:tokenizeLabelStartImage};function tokenizeLabelStartImage(effects,ok3,nok){const self=this;let labelImage;return start;function start(code2){effects.enter("labelImage");effects.enter("labelImageMarker");effects.consume(code2);effects.exit("labelImageMarker");return open}function open(code2){if(code2===91){effects.enter("labelMarker");effects.consume(code2);effects.exit("labelMarker");labelImage=effects.exit("labelImage");return after}return nok(code2)}function after(code2){if(code2===94&&"_hiddenFootnoteSupport"in self.parser.constructs){return nok(code2)}self._labelStarts=self._labelStarts||[];self._labelStarts.push(labelImage);return ok3(code2)}}var labelStartLink={name:"labelStartLink",resolveAll:labelEnd.resolveAll,tokenize:tokenizeLabelStartLink};function tokenizeLabelStartLink(effects,ok3,nok){const self=this;let labelLink;return start;function start(code2){effects.enter("labelLink");effects.enter("labelMarker");effects.consume(code2);effects.exit("labelMarker");labelLink=effects.exit("labelLink");return after}function after(code2){if(code2===94&&"_hiddenFootnoteSupport"in self.parser.constructs){return nok(code2)}self._labelStarts=self._labelStarts||[];self._labelStarts.push(labelLink);return ok3(code2)}}var lineEnding={name:"lineEnding",tokenize:tokenizeLineEnding};function tokenizeLineEnding(effects,ok3){return start;function start(code2){effects.enter("lineEnding");effects.consume(code2);effects.exit("lineEnding");return factorySpace(effects,ok3,"linePrefix")}}var thematicBreak={name:"thematicBreak",tokenize:tokenizeThematicBreak};function tokenizeThematicBreak(effects,ok3,nok){let size=0;let marker;return start;function start(code2){effects.enter("thematicBreak");return before(code2)}function before(code2){marker=code2;return atBreak(code2)}function atBreak(code2){if(code2===marker){effects.enter("thematicBreakSequence");return sequence(code2)}if(size>=3&&(code2===null||markdownLineEnding(code2))){effects.exit("thematicBreak");return ok3(code2)}return nok(code2)}function sequence(code2){if(code2===marker){effects.consume(code2);size++;return sequence}effects.exit("thematicBreakSequence");return markdownSpace(code2)?factorySpace(effects,atBreak,"whitespace")(code2):atBreak(code2)}}var list={continuation:{tokenize:tokenizeListContinuation},exit:tokenizeListEnd,name:"list",tokenize:tokenizeListStart};var listItemPrefixWhitespaceConstruct={partial:true,tokenize:tokenizeListItemPrefixWhitespace};var indentConstruct={partial:true,tokenize:tokenizeIndent};function tokenizeListStart(effects,ok3,nok){const self=this;const tail=self.events[self.events.length-1];let initialSize=tail&&tail[1].type==="linePrefix"?tail[2].sliceSerialize(tail[1],true).length:0;let size=0;return start;function start(code2){const kind=self.containerState.type||(code2===42||code2===43||code2===45?"listUnordered":"listOrdered");if(kind==="listUnordered"?!self.containerState.marker||code2===self.containerState.marker:asciiDigit(code2)){if(!self.containerState.type){self.containerState.type=kind;effects.enter(kind,{_container:true})}if(kind==="listUnordered"){effects.enter("listItemPrefix");return code2===42||code2===45?effects.check(thematicBreak,nok,atMarker)(code2):atMarker(code2)}if(!self.interrupt||code2===49){effects.enter("listItemPrefix");effects.enter("listItemValue");return inside(code2)}}return nok(code2)}function inside(code2){if(asciiDigit(code2)&&++size<10){effects.consume(code2);return inside}if((!self.interrupt||size<2)&&(self.containerState.marker?code2===self.containerState.marker:code2===41||code2===46)){effects.exit("listItemValue");return atMarker(code2)}return nok(code2)}function atMarker(code2){effects.enter("listItemMarker");effects.consume(code2);effects.exit("listItemMarker");self.containerState.marker=self.containerState.marker||code2;return effects.check(blankLine,self.interrupt?nok:onBlank,effects.attempt(listItemPrefixWhitespaceConstruct,endOfPrefix,otherPrefix))}function onBlank(code2){self.containerState.initialBlankLine=true;initialSize++;return endOfPrefix(code2)}function otherPrefix(code2){if(markdownSpace(code2)){effects.enter("listItemPrefixWhitespace");effects.consume(code2);effects.exit("listItemPrefixWhitespace");return endOfPrefix}return nok(code2)}function endOfPrefix(code2){self.containerState.size=initialSize+self.sliceSerialize(effects.exit("listItemPrefix"),true).length;return ok3(code2)}}function tokenizeListContinuation(effects,ok3,nok){const self=this;self.containerState._closeFlow=void 0;return effects.check(blankLine,onBlank,notBlank);function onBlank(code2){self.containerState.furtherBlankLines=self.containerState.furtherBlankLines||self.containerState.initialBlankLine;return factorySpace(effects,ok3,"listItemIndent",self.containerState.size+1)(code2)}function notBlank(code2){if(self.containerState.furtherBlankLines||!markdownSpace(code2)){self.containerState.furtherBlankLines=void 0;self.containerState.initialBlankLine=void 0;return notInCurrentItem(code2)}self.containerState.furtherBlankLines=void 0;self.containerState.initialBlankLine=void 0;return effects.attempt(indentConstruct,ok3,notInCurrentItem)(code2)}function notInCurrentItem(code2){self.containerState._closeFlow=true;self.interrupt=void 0;return factorySpace(effects,effects.attempt(list,ok3,nok),"linePrefix",self.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(code2)}}function tokenizeIndent(effects,ok3,nok){const self=this;return factorySpace(effects,afterPrefix,"listItemIndent",self.containerState.size+1);function afterPrefix(code2){const tail=self.events[self.events.length-1];return tail&&tail[1].type==="listItemIndent"&&tail[2].sliceSerialize(tail[1],true).length===self.containerState.size?ok3(code2):nok(code2)}}function tokenizeListEnd(effects){effects.exit(this.containerState.type)}function tokenizeListItemPrefixWhitespace(effects,ok3,nok){const self=this;return factorySpace(effects,afterPrefix,"listItemPrefixWhitespace",self.parser.constructs.disable.null.includes("codeIndented")?void 0:4+1);function afterPrefix(code2){const tail=self.events[self.events.length-1];return!markdownSpace(code2)&&tail&&tail[1].type==="listItemPrefixWhitespace"?ok3(code2):nok(code2)}}var setextUnderline={name:"setextUnderline",resolveTo:resolveToSetextUnderline,tokenize:tokenizeSetextUnderline};function resolveToSetextUnderline(events,context){const editMap=new EditMap;let index2=events.length;let content3;let text4;let definition2;while(index2--){if(events[index2][0]==="enter"){if(events[index2][1].type==="content"){content3=index2;break}if(events[index2][1].type==="paragraph"){text4=index2}}else{if(events[index2][1].type==="content"){editMap.add(index2,1,[])}if(!definition2&&events[index2][1].type==="definition"){definition2=index2}}}const heading={type:"setextHeading",start:{...events[content3][1].start},end:{...events[events.length-1][1].end}};events[text4][1].type="setextHeadingText";if(definition2){editMap.add(text4,0,[["enter",heading,context]]);editMap.add(definition2+1,0,[["exit",events[content3][1],context]]);events[content3][1].end={...events[definition2][1].end}}else{events[content3][1]=heading}editMap.add(events.length,0,[["exit",heading,context]]);editMap.consume(events);return events}function tokenizeSetextUnderline(effects,ok3,nok){const self=this;let marker;return start;function start(code2){let index2=self.events.length;let paragraph;while(index2--){if(self.events[index2][1].type!=="lineEnding"&&self.events[index2][1].type!=="linePrefix"&&self.events[index2][1].type!=="content"){paragraph=self.events[index2][1].type==="paragraph";break}}if(!self.parser.lazy[self.now().line]&&(self.interrupt||paragraph)){effects.enter("setextHeadingLine");marker=code2;return before(code2)}return nok(code2)}function before(code2){effects.enter("setextHeadingLineSequence");return inside(code2)}function inside(code2){if(code2===marker){effects.consume(code2);return inside}effects.exit("setextHeadingLineSequence");return markdownSpace(code2)?factorySpace(effects,after,"lineSuffix")(code2):after(code2)}function after(code2){if(code2===null||markdownLineEnding(code2)){effects.exit("setextHeadingLine");return ok3(code2)}return nok(code2)}}var flow={tokenize:initializeFlow};function initializeFlow(effects){const self=this;const initial=effects.attempt(blankLine,atBlankEnding,effects.attempt(this.parser.constructs.flowInitial,afterConstruct,factorySpace(effects,effects.attempt(this.parser.constructs.flow,afterConstruct,effects.attempt(content2,afterConstruct)),"linePrefix")));return initial;function atBlankEnding(code2){if(code2===null){effects.consume(code2);return}effects.enter("lineEndingBlank");effects.consume(code2);effects.exit("lineEndingBlank");self.currentConstruct=void 0;return initial}function afterConstruct(code2){if(code2===null){effects.consume(code2);return}effects.enter("lineEnding");effects.consume(code2);effects.exit("lineEnding");self.currentConstruct=void 0;return initial}}var resolver={resolveAll:createResolver()};var string=initializeFactory("string");var text=initializeFactory("text");function initializeFactory(field){return{resolveAll:createResolver(field==="text"?resolveAllLineSuffixes:void 0),tokenize:initializeText};function initializeText(effects){const self=this;const constructs2=this.parser.constructs[field];const text4=effects.attempt(constructs2,start,notText);return start;function start(code2){return atBreak(code2)?text4(code2):notText(code2)}function notText(code2){if(code2===null){effects.consume(code2);return}effects.enter("data");effects.consume(code2);return data}function data(code2){if(atBreak(code2)){effects.exit("data");return text4(code2)}effects.consume(code2);return data}function atBreak(code2){if(code2===null){return true}const list2=constructs2[code2];let index2=-1;if(list2){while(++index2<list2.length){const item=list2[index2];if(!item.previous||item.previous.call(self,self.previous)){return true}}}return false}}}function createResolver(extraResolver){return resolveAllText;function resolveAllText(events,context){let index2=-1;let enter;while(++index2<=events.length){if(enter===void 0){if(events[index2]&&events[index2][1].type==="data"){enter=index2;index2++}}else if(!events[index2]||events[index2][1].type!=="data"){if(index2!==enter+2){events[enter][1].end=events[index2-1][1].end;events.splice(enter+2,index2-enter-2);index2=enter+2}enter=void 0}}return extraResolver?extraResolver(events,context):events}}function resolveAllLineSuffixes(events,context){const editMap=new EditMap;let eventIndex=0;while(++eventIndex<=events.length){if((eventIndex===events.length||events[eventIndex][1].type==="lineEnding")&&events[eventIndex-1][1].type==="data"){const data=events[eventIndex-1][1];const chunks=context.sliceStream(data);let index2=chunks.length;let bufferIndex=-1;let size=0;let tabs;while(index2--){const chunk=chunks[index2];if(typeof chunk==="string"){bufferIndex=chunk.length;while(chunk.charCodeAt(bufferIndex-1)===32){size++;bufferIndex--}if(bufferIndex){break}bufferIndex=-1}else if(chunk===-2){tabs=true;size++}else if(chunk===-1){}else{index2++;break}}if(context._contentTypeTextTrailing&&eventIndex===events.length){size=0}if(size){const token={type:eventIndex===events.length||tabs||size<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:index2?bufferIndex:data.start._bufferIndex+bufferIndex,_index:data.start._index+index2,line:data.end.line,column:data.end.column-size,offset:data.end.offset-size},end:{...data.end}};data.end={...token.start};if(data.start.offset===data.end.offset){Object.assign(data,token)}else{editMap.add(eventIndex,0,[["enter",token,context],["exit",token,context]])}}eventIndex++}}editMap.consume(events);return events}var constructs_exports={};__export(constructs_exports,{attentionMarkers:()=>attentionMarkers,contentInitial:()=>contentInitial,disable:()=>disable,document:()=>document3,flow:()=>flow2,flowInitial:()=>flowInitial,insideSpan:()=>insideSpan,string:()=>string2,text:()=>text2});var document3={[42]:list,[43]:list,[45]:list,[48]:list,[49]:list,[50]:list,[51]:list,[52]:list,[53]:list,[54]:list,[55]:list,[56]:list,[57]:list,[62]:blockQuote};var contentInitial={[91]:definition};var flowInitial={[-2]:codeIndented,[-1]:codeIndented,[32]:codeIndented};var flow2={[35]:headingAtx,[42]:thematicBreak,[45]:[setextUnderline,thematicBreak],[60]:htmlFlow,[61]:setextUnderline,[95]:thematicBreak,[96]:codeFenced,[126]:codeFenced};var string2={[38]:characterReference,[92]:characterEscape};var text2={[-5]:lineEnding,[-4]:lineEnding,[-3]:lineEnding,[33]:labelStartImage,[38]:characterReference,[42]:attention,[60]:[autolink,htmlText],[91]:labelStartLink,[92]:[hardBreakEscape,characterEscape],[93]:labelEnd,[95]:attention,[96]:codeText};var insideSpan={null:[attention,resolver]};var attentionMarkers={null:[42,95]};var disable={null:[]};function createTokenizer(parser,initialize,from){let point3={_bufferIndex:-1,_index:0,line:from&&from.line||1,column:from&&from.column||1,offset:from&&from.offset||0};const columnStart={};const resolveAllConstructs=[];let chunks=[];let stack=[];let consumed=true;const effects={attempt:constructFactory(onsuccessfulconstruct),check:constructFactory(onsuccessfulcheck),consume,enter,exit:exit3,interrupt:constructFactory(onsuccessfulcheck,{interrupt:true})};const context={code:null,containerState:{},defineSkip,events:[],now,parser,previous:null,sliceSerialize,sliceStream,write};let state=initialize.tokenize.call(context,effects);let expectedCode;if(initialize.resolveAll){resolveAllConstructs.push(initialize)}return context;function write(slice){chunks=push(chunks,slice);main();if(chunks[chunks.length-1]!==null){return[]}addResult(initialize,0);context.events=resolveAll(resolveAllConstructs,context.events,context);return context.events}function sliceSerialize(token,expandTabs){return serializeChunks(sliceStream(token),expandTabs)}function sliceStream(token){return sliceChunks(chunks,token)}function now(){const{_bufferIndex,_index,line,column,offset}=point3;return{_bufferIndex,_index,line,column,offset}}function defineSkip(value){columnStart[value.line]=value.column;accountForPotentialSkip()}function main(){while(point3._index<chunks.length){const chunk=chunks[point3._index];if(typeof chunk==="string"){const chunkIndex=point3._index;if(point3._bufferIndex<0){point3._bufferIndex=0}while(point3._index===chunkIndex&&point3._bufferIndex<chunk.length){go(chunk.charCodeAt(point3._bufferIndex))}}else{go(chunk)}}}function go(code2){consumed=void 0;expectedCode=code2;state=state(code2)}function consume(code2){if(markdownLineEnding(code2)){point3.line++;point3.column=1;point3.offset+=code2===-3?2:1;accountForPotentialSkip()}else if(code2!==-1){point3.column++;point3.offset++}if(point3._bufferIndex<0){point3._index++}else{point3._bufferIndex++;if(point3._bufferIndex===chunks[point3._index].length){point3._bufferIndex=-1;point3._index++}}context.previous=code2;consumed=true}function enter(type,fields){const token=fields||{};token.type=type;token.start=now();context.events.push(["enter",token,context]);stack.push(token);return token}function exit3(type){const token=stack.pop();token.end=now();context.events.push(["exit",token,context]);return token}function onsuccessfulconstruct(construct,info){addResult(construct,info.from)}function onsuccessfulcheck(_,info){info.restore()}function constructFactory(onreturn,fields){return hook;function hook(constructs2,returnState,bogusState){let listOfConstructs;let constructIndex;let currentConstruct;let info;return Array.isArray(constructs2)?handleListOfConstructs(constructs2):"tokenize"in constructs2?handleListOfConstructs([constructs2]):handleMapOfConstructs(constructs2);function handleMapOfConstructs(map){return start;function start(code2){const left=code2!==null&&map[code2];const all2=code2!==null&&map.null;const list2=[...Array.isArray(left)?left:left?[left]:[],...Array.isArray(all2)?all2:all2?[all2]:[]];return handleListOfConstructs(list2)(code2)}}function handleListOfConstructs(list2){listOfConstructs=list2;constructIndex=0;if(list2.length===0){return bogusState}return handleConstruct(list2[constructIndex])}function handleConstruct(construct){return start;function start(code2){info=store();currentConstruct=construct;if(!construct.partial){context.currentConstruct=construct}if(construct.name&&context.parser.constructs.disable.null.includes(construct.name)){return nok(code2)}return construct.tokenize.call(fields?Object.assign(Object.create(context),fields):context,effects,ok3,nok)(code2)}}function ok3(code2){consumed=true;onreturn(currentConstruct,info);return returnState}function nok(code2){consumed=true;info.restore();if(++constructIndex<listOfConstructs.length){return handleConstruct(listOfConstructs[constructIndex])}return bogusState}}}function addResult(construct,from2){if(construct.resolveAll&&!resolveAllConstructs.includes(construct)){resolveAllConstructs.push(construct)}if(construct.resolve){splice(context.events,from2,context.events.length-from2,construct.resolve(context.events.slice(from2),context))}if(construct.resolveTo){context.events=construct.resolveTo(context.events,context)}}function store(){const startPoint=now();const startPrevious=context.previous;const startCurrentConstruct=context.currentConstruct;const startEventsIndex=context.events.length;const startStack=Array.from(stack);return{from:startEventsIndex,restore};function restore(){point3=startPoint;context.previous=startPrevious;context.currentConstruct=startCurrentConstruct;context.events.length=startEventsIndex;stack=startStack;accountForPotentialSkip()}}function accountForPotentialSkip(){if(point3.line in columnStart&&point3.column<2){point3.column=columnStart[point3.line];point3.offset+=columnStart[point3.line]-1}}}function sliceChunks(chunks,token){const startIndex=token.start._index;const startBufferIndex=token.start._bufferIndex;const endIndex=token.end._index;const endBufferIndex=token.end._bufferIndex;let view;if(startIndex===endIndex){view=[chunks[startIndex].slice(startBufferIndex,endBufferIndex)]}else{view=chunks.slice(startIndex,endIndex);if(startBufferIndex>-1){const head=view[0];if(typeof head==="string"){view[0]=head.slice(startBufferIndex)}else{view.shift()}}if(endBufferIndex>0){view.push(chunks[endIndex].slice(0,endBufferIndex))}}return view}function serializeChunks(chunks,expandTabs){let index2=-1;const result=[];let atTab;while(++index2<chunks.length){const chunk=chunks[index2];let value;if(typeof chunk==="string"){value=chunk}else{switch(chunk){case-5:{value="\r";break}case-4:{value="\n";break}case-3:{value="\r\n";break}case-2:{value=expandTabs?" ":" ";break}case-1:{if(!expandTabs&&atTab){continue}value=" ";break}default:{value=String.fromCharCode(chunk)}}}atTab=chunk===-2;result.push(value)}return result.join("")}function parse(options){const settings=options||{};const constructs2=combineExtensions([constructs_exports,...settings.extensions||[]]);const parser={constructs:constructs2,content:create(content),defined:[],document:create(document2),flow:create(flow),lazy:{},string:create(string),text:create(text)};return parser;function create(initial){return creator;function creator(from){return createTokenizer(parser,initial,from)}}}function postprocess(events){while(!subtokenize(events)){}return events}var search=/[\0\t\n\r]/g;function preprocess(){let column=1;let buffer="";let start=true;let atCarriageReturn;return preprocessor;function preprocessor(value,encoding,end){value=buffer+(typeof value==="string"?value.toString():new TextDecoder(encoding||void 0).decode(value));const chunks=[];let startPosition=0;buffer="";if(start){if(value.charCodeAt(0)===65279){startPosition++}start=void 0}while(startPosition<value.length){search.lastIndex=startPosition;const match=search.exec(value);const endPosition=match&&match.index!==void 0?match.index:value.length;const code2=value.charCodeAt(endPosition);if(!match){buffer=value.slice(startPosition);break}if(code2===10&&startPosition===endPosition&&atCarriageReturn){chunks.push(-3);atCarriageReturn=void 0}else{if(atCarriageReturn){chunks.push(-5);atCarriageReturn=void 0}if(startPosition<endPosition){chunks.push(value.slice(startPosition,endPosition));column+=endPosition-startPosition}switch(code2){case 0:{chunks.push(65533);column++;break}case 9:{const next=Math.ceil(column/4)*4;chunks.push(-2);while(column++<next){chunks.push(-1)}break}case 10:{chunks.push(-4);column=1;break}default:{atCarriageReturn=true;column=1}}}startPosition=endPosition+1}if(end){if(atCarriageReturn){chunks.push(-5)}if(buffer){chunks.push(buffer)}chunks.push(null)}return chunks}}var characterEscapeOrReference=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function decodeString(value){return value.replace(characterEscapeOrReference,decode)}function decode($0,$1,$2){if($1){return $1}const head=$2.charCodeAt(0);if(head===35){const head2=$2.charCodeAt(1);const hex=head2===120||head2===88;return decodeNumericCharacterReference($2.slice(hex?2:1),hex?16:10)}return decodeNamedCharacterReference($2)||$0}function stringifyPosition(value){if(!value||typeof value!=="object"){return""}if("position"in value||"type"in value){return position(value.position)}if("start"in value||"end"in value){return position(value)}if("line"in value||"column"in value){return point(value)}return""}function point(point3){return index(point3&&point3.line)+":"+index(point3&&point3.column)}function position(pos){return point(pos&&pos.start)+"-"+point(pos&&pos.end)}function index(value){return value&&typeof value==="number"?value:1}var own={}.hasOwnProperty;function fromMarkdown(value,encoding,options){if(encoding&&typeof encoding==="object"){options=encoding;encoding=void 0}return compiler(options)(postprocess(parse(options).document().write(preprocess()(value,encoding,true))))}function compiler(options){const config={afterExit:[],beforeEnter:[],transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:opener(link),autolinkProtocol:onenterdata,autolinkEmail:onenterdata,atxHeading:opener(heading),blockQuote:opener(blockQuote2),characterEscape:onenterdata,characterReference:onenterdata,codeFenced:opener(codeFlow),codeFencedFenceInfo:buffer,codeFencedFenceMeta:buffer,codeIndented:opener(codeFlow,buffer),codeText:opener(codeText2,buffer),codeTextData:onenterdata,data:onenterdata,codeFlowValue:onenterdata,definition:opener(definition2),definitionDestinationString:buffer,definitionLabelString:buffer,definitionTitleString:buffer,emphasis:opener(emphasis),hardBreakEscape:opener(hardBreak),hardBreakTrailing:opener(hardBreak),htmlFlow:opener(html,buffer),htmlFlowData:onenterdata,htmlText:opener(html,buffer),htmlTextData:onenterdata,image:opener(image),label:buffer,link:opener(link),listItem:opener(listItem),listItemValue:onenterlistitemvalue,listOrdered:opener(list2,onenterlistordered),listUnordered:opener(list2),paragraph:opener(paragraph),reference:onenterreference,referenceString:buffer,resourceDestinationString:buffer,resourceTitleString:buffer,setextHeading:opener(heading),strong:opener(strong),thematicBreak:opener(thematicBreak2)},exit:{atxHeading:closer(),atxHeadingSequence:onexitatxheadingsequence,autolink:closer(),autolinkEmail:onexitautolinkemail,autolinkProtocol:onexitautolinkprotocol,blockQuote:closer(),characterEscapeValue:onexitdata,characterReferenceMarkerHexadecimal:onexitcharacterreferencemarker,characterReferenceMarkerNumeric:onexitcharacterreferencemarker,characterReferenceValue:onexitcharacterreferencevalue,characterReference:onexitcharacterreference,codeFenced:closer(onexitcodefenced),codeFencedFence:onexitcodefencedfence,codeFencedFenceInfo:onexitcodefencedfenceinfo,codeFencedFenceMeta:onexitcodefencedfencemeta,codeFlowValue:onexitdata,codeIndented:closer(onexitcodeindented),codeText:closer(onexitcodetext),codeTextData:onexitdata,data:onexitdata,definition:closer(),definitionDestinationString:onexitdefinitiondestinationstring,definitionLabelString:onexitdefinitionlabelstring,definitionTitleString:onexitdefinitiontitlestring,emphasis:closer(),hardBreakEscape:closer(onexithardbreak),hardBreakTrailing:closer(onexithardbreak),htmlFlow:closer(onexithtmlflow),htmlFlowData:onexitdata,htmlText:closer(onexithtmltext),htmlTextData:onexitdata,image:closer(onexitimage),label:onexitlabel,labelText:onexitlabeltext,lineEnding:onexitlineending,link:closer(onexitlink),listItem:closer(),listOrdered:closer(),listUnordered:closer(),paragraph:closer(),referenceString:onexitreferencestring,resourceDestinationString:onexitresourcedestinationstring,resourceTitleString:onexitresourcetitlestring,resource:onexitresource,setextHeading:closer(onexitsetextheading),setextHeadingLineSequence:onexitsetextheadinglinesequence,setextHeadingText:onexitsetextheadingtext,strong:closer(),thematicBreak:closer()}};configure(config,(options||{}).mdastExtensions||[]);const data={};return compile;function compile(events){let tree={type:"root",children:[],position:void 0};const context={stack:[tree],tokenStack:[],config,enter,exit:exit3,buffer,resume,data};const listStack=[];const prepared=[];let index2=-1;while(++index2<events.length){prepared.push(events[index2]);if(events[index2][1].type==="listOrdered"||events[index2][1].type==="listUnordered"){if(events[index2][0]==="enter"){listStack.push(prepared.length-1)}else{const tail=listStack.pop();prepareList(prepared,tail)}}}events=prepared;index2=-1;while(++index2<events.length){const handler=config[events[index2][0]];if(events[index2][0]==="enter"&&config.beforeEnter.length>0){callListeners(config.beforeEnter,{...context,sliceSerialize:events[index2][2].sliceSerialize},events[index2][1])}if(own.call(handler,events[index2][1].type)){handler[events[index2][1].type].call({...context,sliceSerialize:events[index2][2].sliceSerialize},events[index2][1])}if(events[index2][0]==="exit"&&config.afterExit.length>0){callListeners(config.afterExit,{...context,sliceSerialize:events[index2][2].sliceSerialize},events[index2][1])}}if(context.tokenStack.length>0){const tail=context.tokenStack[context.tokenStack.length-1];const handler=tail[1]||defaultOnError;handler.call(context,void 0,tail[0])}tree.position={start:point2(events.length>0?events[0][1].start:{line:1,column:1,offset:0}),end:point2(events.length>0?events[events.length-2][1].end:{line:1,column:1,offset:0})};index2=-1;while(++index2<config.transforms.length){tree=config.transforms[index2](tree)||tree}return tree}function callListeners(listeners,context,token){let index2=-1;while(++index2<listeners.length){listeners[index2].call(context,token)}}function prepareList(events,start){const end=events.length-1;let index2=start-1;let containerBalance=-1;let listSpread=false;let listItem2;let lineIndex;let firstBlankLineIndex;let atMarker;const insertions=[];while(++index2<=end){const event=events[index2];switch(event[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{if(event[0]==="enter"){containerBalance++}else{containerBalance--}atMarker=void 0;break}case"lineEndingBlank":{if(event[0]==="enter"){if(listItem2&&!atMarker&&!containerBalance&&!firstBlankLineIndex){firstBlankLineIndex=index2}atMarker=void 0}break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":{break}default:{atMarker=void 0}}if(!containerBalance&&event[0]==="enter"&&event[1].type==="listItemPrefix"||containerBalance===-1&&event[0]==="exit"&&(event[1].type==="listUnordered"||event[1].type==="listOrdered")){if(listItem2){let tailIndex=index2;lineIndex=void 0;while(tailIndex--){const tailEvent=events[tailIndex];if(tailEvent[1].type==="lineEnding"||tailEvent[1].type==="lineEndingBlank"){if(tailEvent[0]==="exit")continue;if(lineIndex){events[lineIndex][1].type="lineEndingBlank";listSpread=true}tailEvent[1].type="lineEnding";lineIndex=tailIndex}else if(tailEvent[1].type==="linePrefix"||tailEvent[1].type==="blockQuotePrefix"||tailEvent[1].type==="blockQuotePrefixWhitespace"||tailEvent[1].type==="blockQuoteMarker"||tailEvent[1].type==="listItemIndent"){}else{break}}if(firstBlankLineIndex&&(!lineIndex||firstBlankLineIndex<lineIndex)){listItem2._spread=true}listItem2.end=Object.assign({},lineIndex?events[lineIndex][1].start:event[1].end);insertions.push({at:lineIndex||index2,event:["exit",listItem2,event[2]]})}if(event[1].type==="listItemPrefix"){const item={type:"listItem",_spread:false,start:Object.assign({},event[1].start),end:void 0};listItem2=item;insertions.push({at:index2,event:["enter",item,event[2]]});firstBlankLineIndex=void 0;atMarker=true}}}const listEvents=events.splice(start);let insertion=0;index2=-1;while(++index2<listEvents.length){while(insertion<insertions.length&&insertions[insertion].at===start+index2){events.push(insertions[insertion++].event)}events.push(listEvents[index2])}events[start][1]._spread=listSpread}function opener(create,and){return open;function open(token){enter.call(this,create(token),token);if(and)and.call(this,token)}}function buffer(){this.stack.push({type:"fragment",children:[]})}function enter(node2,token,errorHandler){const parent=this.stack[this.stack.length-1];const siblings=parent.children;siblings.push(node2);this.stack.push(node2);this.tokenStack.push([token,errorHandler||void 0]);node2.position={start:point2(token.start),end:void 0}}function closer(and){return close;function close(token){if(and)and.call(this,token);exit3.call(this,token)}}function exit3(token,onExitError){const node2=this.stack.pop();const open=this.tokenStack.pop();if(!open){throw new Error("Cannot close `"+token.type+"` ("+stringifyPosition({start:token.start,end:token.end})+"): it\u2019s not open")}if(open[0].type!==token.type){if(onExitError){onExitError.call(this,token,open[0])}else{const handler=open[1]||defaultOnError;handler.call(this,token,open[0])}}node2.position.end=point2(token.end)}function resume(){return toString(this.stack.pop())}function onenterlistordered(){this.data.expectingFirstListItemValue=true}function onenterlistitemvalue(token){if(this.data.expectingFirstListItemValue){const ancestor=this.stack[this.stack.length-2];ancestor.start=Number.parseInt(this.sliceSerialize(token),10);this.data.expectingFirstListItemValue=void 0}}function onexitcodefencedfenceinfo(){const data2=this.resume();const node2=this.stack[this.stack.length-1];node2.lang=data2}function onexitcodefencedfencemeta(){const data2=this.resume();const node2=this.stack[this.stack.length-1];node2.meta=data2}function onexitcodefencedfence(){if(this.data.flowCodeInside)return;this.buffer();this.data.flowCodeInside=true}function onexitcodefenced(){const data2=this.resume();const node2=this.stack[this.stack.length-1];node2.value=data2.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,"");this.data.flowCodeInside=void 0}function onexitcodeindented(){const data2=this.resume();const node2=this.stack[this.stack.length-1];node2.value=data2.replace(/(\r?\n|\r)$/g,"")}function onexitdefinitionlabelstring(token){const label=this.resume();const node2=this.stack[this.stack.length-1];node2.label=label;node2.identifier=normalizeIdentifier(this.sliceSerialize(token)).toLowerCase()}function onexitdefinitiontitlestring(){const data2=this.resume();const node2=this.stack[this.stack.length-1];node2.title=data2}function onexitdefinitiondestinationstring(){const data2=this.resume();const node2=this.stack[this.stack.length-1];node2.url=data2}function onexitatxheadingsequence(token){const node2=this.stack[this.stack.length-1];if(!node2.depth){const depth=this.sliceSerialize(token).length;node2.depth=depth}}function onexitsetextheadingtext(){this.data.setextHeadingSlurpLineEnding=true}function onexitsetextheadinglinesequence(token){const node2=this.stack[this.stack.length-1];node2.depth=this.sliceSerialize(token).codePointAt(0)===61?1:2}function onexitsetextheading(){this.data.setextHeadingSlurpLineEnding=void 0}function onenterdata(token){const node2=this.stack[this.stack.length-1];const siblings=node2.children;let tail=siblings[siblings.length-1];if(!tail||tail.type!=="text"){tail=text4();tail.position={start:point2(token.start),end:void 0};siblings.push(tail)}this.stack.push(tail)}function onexitdata(token){const tail=this.stack.pop();tail.value+=this.sliceSerialize(token);tail.position.end=point2(token.end)}function onexitlineending(token){const context=this.stack[this.stack.length-1];if(this.data.atHardBreak){const tail=context.children[context.children.length-1];tail.position.end=point2(token.end);this.data.atHardBreak=void 0;return}if(!this.data.setextHeadingSlurpLineEnding&&config.canContainEols.includes(context.type)){onenterdata.call(this,token);onexitdata.call(this,token)}}function onexithardbreak(){this.data.atHardBreak=true}function onexithtmlflow(){const data2=this.resume();const node2=this.stack[this.stack.length-1];node2.value=data2}function onexithtmltext(){const data2=this.resume();const node2=this.stack[this.stack.length-1];node2.value=data2}function onexitcodetext(){const data2=this.resume();const node2=this.stack[this.stack.length-1];node2.value=data2}function onexitlink(){const node2=this.stack[this.stack.length-1];if(this.data.inReference){const referenceType=this.data.referenceType||"shortcut";node2.type+="Reference";node2.referenceType=referenceType;delete node2.url;delete node2.title}else{delete node2.identifier;delete node2.label}this.data.referenceType=void 0}function onexitimage(){const node2=this.stack[this.stack.length-1];if(this.data.inReference){const referenceType=this.data.referenceType||"shortcut";node2.type+="Reference";node2.referenceType=referenceType;delete node2.url;delete node2.title}else{delete node2.identifier;delete node2.label}this.data.referenceType=void 0}function onexitlabeltext(token){const string3=this.sliceSerialize(token);const ancestor=this.stack[this.stack.length-2];ancestor.label=decodeString(string3);ancestor.identifier=normalizeIdentifier(string3).toLowerCase()}function onexitlabel(){const fragment=this.stack[this.stack.length-1];const value=this.resume();const node2=this.stack[this.stack.length-1];this.data.inReference=true;if(node2.type==="link"){const children=fragment.children;node2.children=children}else{node2.alt=value}}function onexitresourcedestinationstring(){const data2=this.resume();const node2=this.stack[this.stack.length-1];node2.url=data2}function onexitresourcetitlestring(){const data2=this.resume();const node2=this.stack[this.stack.length-1];node2.title=data2}function onexitresource(){this.data.inReference=void 0}function onenterreference(){this.data.referenceType="collapsed"}function onexitreferencestring(token){const label=this.resume();const node2=this.stack[this.stack.length-1];node2.label=label;node2.identifier=normalizeIdentifier(this.sliceSerialize(token)).toLowerCase();this.data.referenceType="full"}function onexitcharacterreferencemarker(token){this.data.characterReferenceType=token.type}function onexitcharacterreferencevalue(token){const data2=this.sliceSerialize(token);const type=this.data.characterReferenceType;let value;if(type){value=decodeNumericCharacterReference(data2,type==="characterReferenceMarkerNumeric"?10:16);this.data.characterReferenceType=void 0}else{const result=decodeNamedCharacterReference(data2);value=result}const tail=this.stack[this.stack.length-1];tail.value+=value}function onexitcharacterreference(token){const tail=this.stack.pop();tail.position.end=point2(token.end)}function onexitautolinkprotocol(token){onexitdata.call(this,token);const node2=this.stack[this.stack.length-1];node2.url=this.sliceSerialize(token)}function onexitautolinkemail(token){onexitdata.call(this,token);const node2=this.stack[this.stack.length-1];node2.url="mailto:"+this.sliceSerialize(token)}function blockQuote2(){return{type:"blockquote",children:[],position:void 0}}function codeFlow(){return{type:"code",lang:null,meta:null,value:"",position:void 0}}function codeText2(){return{type:"inlineCode",value:"",position:void 0}}function definition2(){return{type:"definition",identifier:"",label:null,title:null,url:"",position:void 0}}function emphasis(){return{type:"emphasis",children:[],position:void 0}}function heading(){return{type:"heading",depth:0,children:[],position:void 0}}function hardBreak(){return{type:"break",position:void 0}}function html(){return{type:"html",value:"",position:void 0}}function image(){return{type:"image",title:null,url:"",alt:null,position:void 0}}function link(){return{type:"link",title:null,url:"",children:[],position:void 0}}function list2(token){return{type:"list",ordered:token.type==="listOrdered",start:null,spread:token._spread,children:[],position:void 0}}function listItem(token){return{type:"listItem",spread:token._spread,checked:null,children:[],position:void 0}}function paragraph(){return{type:"paragraph",children:[],position:void 0}}function strong(){return{type:"strong",children:[],position:void 0}}function text4(){return{type:"text",value:"",position:void 0}}function thematicBreak2(){return{type:"thematicBreak",position:void 0}}}function point2(d){return{line:d.line,column:d.column,offset:d.offset}}function configure(combined,extensions){let index2=-1;while(++index2<extensions.length){const value=extensions[index2];if(Array.isArray(value)){configure(combined,value)}else{extension(combined,value)}}}function extension(combined,extension2){let key;for(key in extension2){if(own.call(extension2,key)){switch(key){case"canContainEols":{const right=extension2[key];if(right){combined[key].push(...right)}break}case"transforms":{const right=extension2[key];if(right){combined[key].push(...right)}break}case"afterExit":case"beforeEnter":{const right=extension2[key];if(right){combined[key].push(right)}break}case"enter":case"exit":{const right=extension2[key];if(right){Object.assign(combined[key],right)}break}}}}}function defaultOnError(left,right){if(left){throw new Error("Cannot close `"+left.type+"` ("+stringifyPosition({start:left.start,end:left.end})+"): a different token (`"+right.type+"`, "+stringifyPosition({start:right.start,end:right.end})+") is open")}throw new Error("Cannot close document, a token (`"+right.type+"`, "+stringifyPosition({start:right.start,end:right.end})+") is still open")}function ok(){}function escapeStringRegexp(string3){if(typeof string3!=="string"){throw new TypeError("Expected a string")}return string3.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}var convert=(function(test){if(test===null||test===void 0){return ok2}if(typeof test==="function"){return castFactory(test)}if(typeof test==="object"){return Array.isArray(test)?anyFactory(test):propertiesFactory(test)}if(typeof test==="string"){return typeFactory(test)}throw new Error("Expected function, string, or object as test")});function anyFactory(tests){const checks=[];let index2=-1;while(++index2<tests.length){checks[index2]=convert(tests[index2])}return castFactory(any);function any(...parameters){let index3=-1;while(++index3<checks.length){if(checks[index3].apply(this,parameters))return true}return false}}function propertiesFactory(check){const checkAsRecord=check;return castFactory(all2);function all2(node2){const nodeAsRecord=node2;let key;for(key in check){if(nodeAsRecord[key]!==checkAsRecord[key])return false}return true}}function typeFactory(check){return castFactory(type);function type(node2){return node2&&node2.type===check}}function castFactory(testFunction){return check;function check(value,index2,parent){return Boolean(looksLikeANode(value)&&testFunction.call(this,value,typeof index2==="number"?index2:void 0,parent||void 0))}}function ok2(){return true}function looksLikeANode(value){return value!==null&&typeof value==="object"&&"type"in value}function color(d){return d}var empty=[];var CONTINUE=true;var EXIT=false;var SKIP="skip";function visitParents(tree,test,visitor,reverse){let check;if(typeof test==="function"&&typeof visitor!=="function"){reverse=visitor;visitor=test}else{check=test}const is2=convert(check);const step2=reverse?-1:1;factory(tree,void 0,[])();function factory(node2,index2,parents){const value=node2&&typeof node2==="object"?node2:{};if(typeof value.type==="string"){const name=typeof value.tagName==="string"?value.tagName:typeof value.name==="string"?value.name:void 0;Object.defineProperty(visit,"name",{value:"node ("+color(node2.type+(name?"<"+name+">":""))+")"})}return visit;function visit(){let result=empty;let subresult;let offset;let grandparents;if(!test||is2(node2,index2,parents[parents.length-1]||void 0)){result=toResult(visitor(node2,parents));if(result[0]===EXIT){return result}}if("children"in node2&&node2.children){const nodeAsParent=node2;if(nodeAsParent.children&&result[0]!==SKIP){offset=(reverse?nodeAsParent.children.length:-1)+step2;grandparents=parents.concat(nodeAsParent);while(offset>-1&&offset<nodeAsParent.children.length){const child=nodeAsParent.children[offset];subresult=factory(child,offset,grandparents)();if(subresult[0]===EXIT){return subresult}offset=typeof subresult[1]==="number"?subresult[1]:offset+step2}}}return result}}}function toResult(value){if(Array.isArray(value)){return value}if(typeof value==="number"){return[CONTINUE,value]}return value===null||value===void 0?empty:[value]}function findAndReplace(tree,list2,options){const settings=options||{};const ignored=convert(settings.ignore||[]);const pairs=toPairs(list2);let pairIndex=-1;while(++pairIndex<pairs.length){visitParents(tree,"text",visitor)}function visitor(node2,parents){let index2=-1;let grandparent;while(++index2<parents.length){const parent=parents[index2];const siblings=grandparent?grandparent.children:void 0;if(ignored(parent,siblings?siblings.indexOf(parent):void 0,grandparent)){return}grandparent=parent}if(grandparent){return handler(node2,parents)}}function handler(node2,parents){const parent=parents[parents.length-1];const find=pairs[pairIndex][0];const replace2=pairs[pairIndex][1];let start=0;const siblings=parent.children;const index2=siblings.indexOf(node2);let change=false;let nodes=[];find.lastIndex=0;let match=find.exec(node2.value);while(match){const position2=match.index;const matchObject={index:match.index,input:match.input,stack:[...parents,node2]};let value=replace2(...match,matchObject);if(typeof value==="string"){value=value.length>0?{type:"text",value}:void 0}if(value===false){find.lastIndex=position2+1}else{if(start!==position2){add({type:"text",value:node2.value.slice(start,position2)})}if(Array.isArray(value)){for(const child of value)add(child)}else if(value){add(value)}start=position2+match[0].length;change=true}if(!find.global){break}match=find.exec(node2.value)}if(change){if(start<node2.value.length){add({type:"text",value:node2.value.slice(start)})}parent.children.splice(index2,1,...nodes)}else{nodes=[node2]}return index2+nodes.length;function add(child){const previous3=nodes[nodes.length-1];if(previous3&&previous3.type==="text"&&child.type==="text"){previous3.value+=child.value}else{nodes.push(child)}}}}function toPairs(tupleOrList){if(!Array.isArray(tupleOrList)){throw new TypeError("Expected find and replace tuple or list of tuples")}const result=[];const list2=!tupleOrList[0]||Array.isArray(tupleOrList[0])?tupleOrList:[tupleOrList];let index2=-1;while(++index2<list2.length){const tuple=list2[index2];result.push([toExpression(tuple[0]),toFunction(tuple[1])])}return result}function toExpression(find){return typeof find==="string"?new RegExp(escapeStringRegexp(find),"g"):find}function toFunction(replace2){return typeof replace2==="function"?replace2:function(){return replace2}}function gfmAutolinkLiteralFromMarkdown(){return{transforms:[transformGfmAutolinkLiterals],enter:{literalAutolink:enterLiteralAutolink,literalAutolinkEmail:enterLiteralAutolinkValue,literalAutolinkHttp:enterLiteralAutolinkValue,literalAutolinkWww:enterLiteralAutolinkValue},exit:{literalAutolink:exitLiteralAutolink,literalAutolinkEmail:exitLiteralAutolinkEmail,literalAutolinkHttp:exitLiteralAutolinkHttp,literalAutolinkWww:exitLiteralAutolinkWww}}}function enterLiteralAutolink(token){this.enter({type:"link",title:null,url:"",children:[]},token)}function enterLiteralAutolinkValue(token){this.config.enter.autolinkProtocol.call(this,token)}function exitLiteralAutolinkHttp(token){this.config.exit.autolinkProtocol.call(this,token)}function exitLiteralAutolinkWww(token){this.config.exit.data.call(this,token);const node2=this.stack[this.stack.length-1];ok(node2.type==="link");node2.url="http://"+this.sliceSerialize(token)}function exitLiteralAutolinkEmail(token){this.config.exit.autolinkEmail.call(this,token)}function exitLiteralAutolink(token){this.exit(token)}function transformGfmAutolinkLiterals(tree){findAndReplace(tree,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,findUrl],[/(?<=^|\s|\p{P}|\p{S})([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/gu,findEmail]],{ignore:["link","linkReference"]})}function findUrl(_,protocol,domain2,path2,match){let prefix="";if(!previous2(match)){return false}if(/^w/i.test(protocol)){domain2=protocol+domain2;protocol="";prefix="http://"}if(!isCorrectDomain(domain2)){return false}const parts=splitUrl(domain2+path2);if(!parts[0])return false;const result={type:"link",title:null,url:prefix+protocol+parts[0],children:[{type:"text",value:protocol+parts[0]}]};if(parts[1]){return[result,{type:"text",value:parts[1]}]}return result}function findEmail(_,atext,label,match){if(!previous2(match,true)||/[-\d_]$/.test(label)){return false}return{type:"link",title:null,url:"mailto:"+atext+"@"+label,children:[{type:"text",value:atext+"@"+label}]}}function isCorrectDomain(domain2){const parts=domain2.split(".");if(parts.length<2||parts[parts.length-1]&&(/_/.test(parts[parts.length-1])||!/[a-zA-Z\d]/.test(parts[parts.length-1]))||parts[parts.length-2]&&(/_/.test(parts[parts.length-2])||!/[a-zA-Z\d]/.test(parts[parts.length-2]))){return false}return true}function splitUrl(url){const trailExec=/[!"&'),.:;<>?\]}]+$/.exec(url);if(!trailExec){return[url,void 0]}url=url.slice(0,trailExec.index);let trail2=trailExec[0];let closingParenIndex=trail2.indexOf(")");const openingParens=ccount(url,"(");let closingParens=ccount(url,")");while(closingParenIndex!==-1&&openingParens>closingParens){url+=trail2.slice(0,closingParenIndex+1);trail2=trail2.slice(closingParenIndex+1);closingParenIndex=trail2.indexOf(")");closingParens++}return[url,trail2]}function previous2(match,email){const code2=match.input.charCodeAt(match.index-1);return(match.index===0||unicodeWhitespace(code2)||unicodePunctuation(code2))&&(!email||code2!==47)}footnoteReference.peek=footnoteReferencePeek;function enterFootnoteCallString(){this.buffer()}function enterFootnoteCall(token){this.enter({type:"footnoteReference",identifier:"",label:""},token)}function enterFootnoteDefinitionLabelString(){this.buffer()}function enterFootnoteDefinition(token){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},token)}function exitFootnoteCallString(token){const label=this.resume();const node2=this.stack[this.stack.length-1];ok(node2.type==="footnoteReference");node2.identifier=normalizeIdentifier(this.sliceSerialize(token)).toLowerCase();node2.label=label}function exitFootnoteCall(token){this.exit(token)}function exitFootnoteDefinitionLabelString(token){const label=this.resume();const node2=this.stack[this.stack.length-1];ok(node2.type==="footnoteDefinition");node2.identifier=normalizeIdentifier(this.sliceSerialize(token)).toLowerCase();node2.label=label}function exitFootnoteDefinition(token){this.exit(token)}function footnoteReferencePeek(){return"["}function footnoteReference(node2,_,state,info){const tracker=state.createTracker(info);let value=tracker.move("[^");const exit3=state.enter("footnoteReference");const subexit=state.enter("reference");value+=tracker.move(state.safe(state.associationId(node2),{after:"]",before:value}));subexit();exit3();value+=tracker.move("]");return value}function gfmFootnoteFromMarkdown(){return{enter:{gfmFootnoteCallString:enterFootnoteCallString,gfmFootnoteCall:enterFootnoteCall,gfmFootnoteDefinitionLabelString:enterFootnoteDefinitionLabelString,gfmFootnoteDefinition:enterFootnoteDefinition},exit:{gfmFootnoteCallString:exitFootnoteCallString,gfmFootnoteCall:exitFootnoteCall,gfmFootnoteDefinitionLabelString:exitFootnoteDefinitionLabelString,gfmFootnoteDefinition:exitFootnoteDefinition}}}handleDelete.attention=attentionDelete;handleDelete.peek=peekDelete;function gfmStrikethroughFromMarkdown(){return{canContainEols:["delete"],enter:{strikethrough:enterStrikethrough},exit:{strikethrough:exitStrikethrough}}}function enterStrikethrough(token){this.enter({type:"delete",children:[],position:void 0},token)}function exitStrikethrough(token){this.exit(token)}function handleDelete(node2,_,state,info){const tracker=state.createTracker(info);const sequence=state.stack.includes("strikethrough")?"~":"~~";const exit3=state.enter("strikethrough");let value=tracker.move(sequence);value+=state.containerPhrasing(node2,{...tracker.current(),before:value,after:"~"});value+=tracker.move(sequence);exit3();return value}function attentionDelete(){return{construct:"strikethrough",markers:["~"],sizes:[2,1]}}function peekDelete(){return"~"}function gfmTableFromMarkdown(){return{enter:{table:enterTable,tableData:enterCell,tableHeader:enterCell,tableRow:enterRow},exit:{codeText:exitCodeText,table:exitTable,tableData:exit2,tableHeader:exit2,tableRow:exit2}}}function enterTable(token){const align=token._align;ok(align,"expected `_align` on table");this.enter({type:"table",align:align.map(function(d){return d==="none"?null:d}),children:[]},token);this.data.inTable=true}function exitTable(token){this.exit(token);this.data.inTable=void 0}function enterRow(token){this.enter({type:"tableRow",children:[]},token)}function exit2(token){this.exit(token)}function enterCell(token){this.enter({type:"tableCell",children:[]},token)}function exitCodeText(token){let value=this.resume();if(this.data.inTable){value=value.replace(/\\([\\|])/g,replace)}const node2=this.stack[this.stack.length-1];ok(node2.type==="inlineCode");node2.value=value;this.exit(token)}function replace($0,$1){return $1==="|"?$1:$0}function gfmTaskListItemFromMarkdown(){return{exit:{taskListCheckValueChecked:exitCheck,taskListCheckValueUnchecked:exitCheck,paragraph:exitParagraphWithTaskListItem}}}function exitCheck(token){const node2=this.stack[this.stack.length-2];ok(node2.type==="listItem");node2.checked=token.type==="taskListCheckValueChecked"}function exitParagraphWithTaskListItem(token){const parent=this.stack[this.stack.length-2];if(parent&&parent.type==="listItem"&&typeof parent.checked==="boolean"){const node2=this.stack[this.stack.length-1];ok(node2.type==="paragraph");const head=node2.children[0];if(head&&head.type==="text"){const siblings=parent.children;let index2=-1;let firstParaghraph;while(++index2<siblings.length){const sibling=siblings[index2];if(sibling.type==="paragraph"){firstParaghraph=sibling;break}}if(firstParaghraph===node2){head.value=head.value.slice(1);if(head.value.length===0){node2.children.shift()}else if(node2.position&&head.position&&typeof head.position.start.offset==="number"){head.position.start.column++;head.position.start.offset++;node2.position.start=Object.assign({},head.position.start)}}}}this.exit(token)}function gfmFromMarkdown(){return[gfmAutolinkLiteralFromMarkdown(),gfmFootnoteFromMarkdown(),gfmStrikethroughFromMarkdown(),gfmTableFromMarkdown(),gfmTaskListItemFromMarkdown()]}var wwwPrefix={tokenize:tokenizeWwwPrefix,partial:true};var domain={tokenize:tokenizeDomain,partial:true};var path={tokenize:tokenizePath,partial:true};var trail={tokenize:tokenizeTrail,partial:true};var emailDomainDotTrail={tokenize:tokenizeEmailDomainDotTrail,partial:true};var wwwAutolink={name:"wwwAutolink",tokenize:tokenizeWwwAutolink,previous:previousWww};var protocolAutolink={name:"protocolAutolink",tokenize:tokenizeProtocolAutolink,previous:previousProtocol};var emailAutolink={name:"emailAutolink",tokenize:tokenizeEmailAutolink,previous:previousEmail};var text3={};function gfmAutolinkLiteral(){return{text:text3}}var code=48;while(code<123){text3[code]=emailAutolink;code++;if(code===58)code=65;else if(code===91)code=97}text3[43]=emailAutolink;text3[45]=emailAutolink;text3[46]=emailAutolink;text3[95]=emailAutolink;text3[72]=[emailAutolink,protocolAutolink];text3[104]=[emailAutolink,protocolAutolink];text3[87]=[emailAutolink,wwwAutolink];text3[119]=[emailAutolink,wwwAutolink];function tokenizeEmailAutolink(effects,ok3,nok){const self=this;let dot;let data;return start;function start(code2){if(!gfmAtext(code2)||!previousEmail.call(self,self.previous)||previousUnbalanced(self.events)){return nok(code2)}effects.enter("literalAutolink");effects.enter("literalAutolinkEmail");return atext(code2)}function atext(code2){if(gfmAtext(code2)){effects.consume(code2);return atext}if(code2===64){effects.consume(code2);return emailDomain}return nok(code2)}function emailDomain(code2){if(code2===46){return effects.check(emailDomainDotTrail,emailDomainAfter,emailDomainDot)(code2)}if(code2===45||code2===95||asciiAlphanumeric(code2)){data=true;effects.consume(code2);return emailDomain}return emailDomainAfter(code2)}function emailDomainDot(code2){effects.consume(code2);dot=true;return emailDomain}function emailDomainAfter(code2){if(data&&dot&&asciiAlpha(self.previous)){effects.exit("literalAutolinkEmail");effects.exit("literalAutolink");return ok3(code2)}return nok(code2)}}function tokenizeWwwAutolink(effects,ok3,nok){const self=this;return wwwStart;function wwwStart(code2){if(code2!==87&&code2!==119||!previousWww.call(self,self.previous)||previousUnbalanced(self.events)){return nok(code2)}effects.enter("literalAutolink");effects.enter("literalAutolinkWww");return effects.check(wwwPrefix,effects.attempt(domain,effects.attempt(path,wwwAfter),nok),nok)(code2)}function wwwAfter(code2){effects.exit("literalAutolinkWww");effects.exit("literalAutolink");return ok3(code2)}}function tokenizeProtocolAutolink(effects,ok3,nok){const self=this;let buffer="";let seen=false;return protocolStart;function protocolStart(code2){if((code2===72||code2===104)&&previousProtocol.call(self,self.previous)&&!previousUnbalanced(self.events)){effects.enter("literalAutolink");effects.enter("literalAutolinkHttp");buffer+=String.fromCodePoint(code2);effects.consume(code2);return protocolPrefixInside}return nok(code2)}function protocolPrefixInside(code2){if(asciiAlpha(code2)&&buffer.length<5){buffer+=String.fromCodePoint(code2);effects.consume(code2);return protocolPrefixInside}if(code2===58){const protocol=buffer.toLowerCase();if(protocol==="http"||protocol==="https"){effects.consume(code2);return protocolSlashesInside}}return nok(code2)}function protocolSlashesInside(code2){if(code2===47){effects.consume(code2);if(seen){return afterProtocol}seen=true;return protocolSlashesInside}return nok(code2)}function afterProtocol(code2){return code2===null||asciiControl(code2)||markdownLineEndingOrSpace(code2)||unicodeWhitespace(code2)||unicodePunctuation(code2)?nok(code2):effects.attempt(domain,effects.attempt(path,protocolAfter),nok)(code2)}function protocolAfter(code2){effects.exit("literalAutolinkHttp");effects.exit("literalAutolink");return ok3(code2)}}function tokenizeWwwPrefix(effects,ok3,nok){let size=0;return wwwPrefixInside;function wwwPrefixInside(code2){if((code2===87||code2===119)&&size<3){size++;effects.consume(code2);return wwwPrefixInside}if(code2===46&&size===3){effects.consume(code2);return wwwPrefixAfter}return nok(code2)}function wwwPrefixAfter(code2){return code2===null?nok(code2):ok3(code2)}}function tokenizeDomain(effects,ok3,nok){let underscoreInLastSegment;let underscoreInLastLastSegment;let seen;return domainInside;function domainInside(code2){if(code2===46||code2===95){return effects.check(trail,domainAfter,domainAtPunctuation)(code2)}if(code2===null||markdownLineEndingOrSpace(code2)||unicodeWhitespace(code2)||code2!==45&&unicodePunctuation(code2)){return domainAfter(code2)}seen=true;effects.consume(code2);return domainInside}function domainAtPunctuation(code2){if(code2===95){underscoreInLastSegment=true}else{underscoreInLastLastSegment=underscoreInLastSegment;underscoreInLastSegment=void 0}effects.consume(code2);return domainInside}function domainAfter(code2){if(underscoreInLastLastSegment||underscoreInLastSegment||!seen){return nok(code2)}return ok3(code2)}}function tokenizePath(effects,ok3){let sizeOpen=0;let sizeClose=0;return pathInside;function pathInside(code2){if(code2===40){sizeOpen++;effects.consume(code2);return pathInside}if(code2===41&&sizeClose<sizeOpen){return pathAtPunctuation(code2)}if(code2===33||code2===34||code2===38||code2===39||code2===41||code2===42||code2===44||code2===46||code2===58||code2===59||code2===60||code2===63||code2===93||code2===95||code2===126){return effects.check(trail,ok3,pathAtPunctuation)(code2)}if(code2===null||markdownLineEndingOrSpace(code2)||unicodeWhitespace(code2)){return ok3(code2)}effects.consume(code2);return pathInside}function pathAtPunctuation(code2){if(code2===41){sizeClose++}effects.consume(code2);return pathInside}}function tokenizeTrail(effects,ok3,nok){return trail2;function trail2(code2){if(code2===33||code2===34||code2===39||code2===41||code2===42||code2===44||code2===46||code2===58||code2===59||code2===63||code2===95||code2===126){effects.consume(code2);return trail2}if(code2===38){effects.consume(code2);return trailCharacterReferenceStart}if(code2===93){effects.consume(code2);return trailBracketAfter}if(code2===60||code2===null||markdownLineEndingOrSpace(code2)||unicodeWhitespace(code2)){return ok3(code2)}return nok(code2)}function trailBracketAfter(code2){if(code2===null||code2===40||code2===91||markdownLineEndingOrSpace(code2)||unicodeWhitespace(code2)){return ok3(code2)}return trail2(code2)}function trailCharacterReferenceStart(code2){return asciiAlpha(code2)?trailCharacterReferenceInside(code2):nok(code2)}function trailCharacterReferenceInside(code2){if(code2===59){effects.consume(code2);return trail2}if(asciiAlpha(code2)){effects.consume(code2);return trailCharacterReferenceInside}return nok(code2)}}function tokenizeEmailDomainDotTrail(effects,ok3,nok){return start;function start(code2){effects.consume(code2);return after}function after(code2){return asciiAlphanumeric(code2)?nok(code2):ok3(code2)}}function previousWww(code2){return code2===null||code2===40||code2===42||code2===95||code2===91||code2===93||code2===126||markdownLineEndingOrSpace(code2)}function previousProtocol(code2){return!asciiAlpha(code2)}function previousEmail(code2){return!(code2===47||gfmAtext(code2))}function gfmAtext(code2){return code2===43||code2===45||code2===46||code2===95||asciiAlphanumeric(code2)}function previousUnbalanced(events){let index2=events.length;let result=false;while(index2--){const token=events[index2][1];if((token.type==="labelLink"||token.type==="labelImage")&&!token._balanced){result=true;break}if(token._gfmAutolinkLiteralWalkedInto){result=false;break}}if(events.length>0&&!result){events[events.length-1][1]._gfmAutolinkLiteralWalkedInto=true}return result}var indent={tokenize:tokenizeIndent2,partial:true};function gfmFootnote(){return{document:{[91]:{name:"gfmFootnoteDefinition",tokenize:tokenizeDefinitionStart,continuation:{tokenize:tokenizeDefinitionContinuation},exit:gfmFootnoteDefinitionEnd}},text:{[91]:{name:"gfmFootnoteCall",tokenize:tokenizeGfmFootnoteCall},[93]:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:tokenizePotentialGfmFootnoteCall,resolveTo:resolveToPotentialGfmFootnoteCall}}}}function tokenizePotentialGfmFootnoteCall(effects,ok3,nok){const self=this;let index2=self.events.length;const defined=self.parser.gfmFootnotes||(self.parser.gfmFootnotes=[]);let labelStart;while(index2--){const token=self.events[index2][1];if(token.type==="labelImage"){labelStart=token;break}if(token.type==="gfmFootnoteCall"||token.type==="labelLink"||token.type==="label"||token.type==="image"||token.type==="link"){break}}return start;function start(code2){if(!labelStart||!labelStart._balanced){return nok(code2)}const id=normalizeIdentifier(self.sliceSerialize({start:labelStart.end,end:self.now()}));if(id.codePointAt(0)!==94||!defined.includes(id.slice(1))){return nok(code2)}effects.enter("gfmFootnoteCallLabelMarker");effects.consume(code2);effects.exit("gfmFootnoteCallLabelMarker");return ok3(code2)}}function resolveToPotentialGfmFootnoteCall(events,context){let index2=events.length;let labelStart;while(index2--){if(events[index2][1].type==="labelImage"&&events[index2][0]==="enter"){labelStart=events[index2][1];break}}events[index2+1][1].type="data";events[index2+3][1].type="gfmFootnoteCallLabelMarker";const call={type:"gfmFootnoteCall",start:Object.assign({},events[index2+3][1].start),end:Object.assign({},events[events.length-1][1].end)};const marker={type:"gfmFootnoteCallMarker",start:Object.assign({},events[index2+3][1].end),end:Object.assign({},events[index2+3][1].end)};marker.end.column++;marker.end.offset++;marker.end._bufferIndex++;const string3={type:"gfmFootnoteCallString",start:Object.assign({},marker.end),end:Object.assign({},events[events.length-1][1].start)};const chunk={type:"chunkString",contentType:"string",start:Object.assign({},string3.start),end:Object.assign({},string3.end)};const replacement=[events[index2+1],events[index2+2],["enter",call,context],events[index2+3],events[index2+4],["enter",marker,context],["exit",marker,context],["enter",string3,context],["enter",chunk,context],["exit",chunk,context],["exit",string3,context],events[events.length-2],events[events.length-1],["exit",call,context]];events.splice(index2,events.length-index2+1,...replacement);return events}function tokenizeGfmFootnoteCall(effects,ok3,nok){const self=this;const defined=self.parser.gfmFootnotes||(self.parser.gfmFootnotes=[]);let size=0;let data;return start;function start(code2){effects.enter("gfmFootnoteCall");effects.enter("gfmFootnoteCallLabelMarker");effects.consume(code2);effects.exit("gfmFootnoteCallLabelMarker");return callStart}function callStart(code2){if(code2!==94)return nok(code2);effects.enter("gfmFootnoteCallMarker");effects.consume(code2);effects.exit("gfmFootnoteCallMarker");effects.enter("gfmFootnoteCallString");effects.enter("chunkString").contentType="string";return callData}function callData(code2){if(size>999||code2===93&&!data||code2===null||code2===91||markdownLineEndingOrSpace(code2)){return nok(code2)}if(code2===93){effects.exit("chunkString");const token=effects.exit("gfmFootnoteCallString");if(!defined.includes(normalizeIdentifier(self.sliceSerialize(token)))){return nok(code2)}effects.enter("gfmFootnoteCallLabelMarker");effects.consume(code2);effects.exit("gfmFootnoteCallLabelMarker");effects.exit("gfmFootnoteCall");return ok3}if(!markdownLineEndingOrSpace(code2)){data=true}size++;effects.consume(code2);return code2===92?callEscape:callData}function callEscape(code2){if(code2===91||code2===92||code2===93){effects.consume(code2);size++;return callData}return callData(code2)}}function tokenizeDefinitionStart(effects,ok3,nok){const self=this;const defined=self.parser.gfmFootnotes||(self.parser.gfmFootnotes=[]);let identifier;let size=0;let data;return start;function start(code2){effects.enter("gfmFootnoteDefinition")._container=true;effects.enter("gfmFootnoteDefinitionLabel");effects.enter("gfmFootnoteDefinitionLabelMarker");effects.consume(code2);effects.exit("gfmFootnoteDefinitionLabelMarker");return labelAtMarker}function labelAtMarker(code2){if(code2===94){effects.enter("gfmFootnoteDefinitionMarker");effects.consume(code2);effects.exit("gfmFootnoteDefinitionMarker");effects.enter("gfmFootnoteDefinitionLabelString");effects.enter("chunkString").contentType="string";return labelInside}return nok(code2)}function labelInside(code2){if(size>999||code2===93&&!data||code2===null||code2===91||markdownLineEndingOrSpace(code2)){return nok(code2)}if(code2===93){effects.exit("chunkString");const token=effects.exit("gfmFootnoteDefinitionLabelString");identifier=normalizeIdentifier(self.sliceSerialize(token));effects.enter("gfmFootnoteDefinitionLabelMarker");effects.consume(code2);effects.exit("gfmFootnoteDefinitionLabelMarker");effects.exit("gfmFootnoteDefinitionLabel");return labelAfter}if(!markdownLineEndingOrSpace(code2)){data=true}size++;effects.consume(code2);return code2===92?labelEscape:labelInside}function labelEscape(code2){if(code2===91||code2===92||code2===93){effects.consume(code2);size++;return labelInside}return labelInside(code2)}function labelAfter(code2){if(code2===58){effects.enter("definitionMarker");effects.consume(code2);effects.exit("definitionMarker");if(!defined.includes(identifier)){defined.push(identifier)}return factorySpace(effects,whitespaceAfter,"gfmFootnoteDefinitionWhitespace")}return nok(code2)}function whitespaceAfter(code2){return ok3(code2)}}function tokenizeDefinitionContinuation(effects,ok3,nok){return effects.check(blankLine,ok3,effects.attempt(indent,ok3,nok))}function gfmFootnoteDefinitionEnd(effects){effects.exit("gfmFootnoteDefinition")}function tokenizeIndent2(effects,ok3,nok){const self=this;return factorySpace(effects,afterPrefix,"gfmFootnoteDefinitionIndent",4+1);function afterPrefix(code2){const tail=self.events[self.events.length-1];return tail&&tail[1].type==="gfmFootnoteDefinitionIndent"&&tail[2].sliceSerialize(tail[1],true).length===4?ok3(code2):nok(code2)}}function gfmStrikethrough(options){const options_=options||{};let single=options_.singleTilde;const tokenizer={name:"strikethrough",tokenize:tokenizeStrikethrough,resolveAll:resolveAllStrikethrough};if(single===null||single===void 0){single=true}return{text:{[126]:tokenizer},insideSpan:{null:[tokenizer]},attentionMarkers:{null:[126]}};function resolveAllStrikethrough(events,context){let index2=-1;while(++index2<events.length){if(events[index2][0]==="enter"&&events[index2][1].type==="strikethroughSequenceTemporary"&&events[index2][1]._close){let open=index2;while(open--){if(events[open][0]==="exit"&&events[open][1].type==="strikethroughSequenceTemporary"&&events[open][1]._open&&events[index2][1].end.offset-events[index2][1].start.offset===events[open][1].end.offset-events[open][1].start.offset){events[index2][1].type="strikethroughSequence";events[open][1].type="strikethroughSequence";const strikethrough={type:"strikethrough",start:Object.assign({},events[open][1].start),end:Object.assign({},events[index2][1].end)};const text4={type:"strikethroughText",start:Object.assign({},events[open][1].end),end:Object.assign({},events[index2][1].start)};const nextEvents=[["enter",strikethrough,context],["enter",events[open][1],context],["exit",events[open][1],context],["enter",text4,context]];const insideSpan2=context.parser.constructs.insideSpan.null;if(insideSpan2){splice(nextEvents,nextEvents.length,0,resolveAll(insideSpan2,events.slice(open+1,index2),context))}splice(nextEvents,nextEvents.length,0,[["exit",text4,context],["enter",events[index2][1],context],["exit",events[index2][1],context],["exit",strikethrough,context]]);splice(events,open-1,index2-open+3,nextEvents);index2=open+nextEvents.length-2;break}}}}index2=-1;while(++index2<events.length){if(events[index2][1].type==="strikethroughSequenceTemporary"){events[index2][1].type="data"}}return events}function tokenizeStrikethrough(effects,ok3,nok){const previous3=this.previous;const events=this.events;let size=0;return start;function start(code2){if(previous3===126&&events[events.length-1][1].type!=="characterEscape"){return nok(code2)}effects.enter("strikethroughSequenceTemporary");return more(code2)}function more(code2){const before=classifyCharacter(previous3);if(code2===126){if(size>1)return nok(code2);effects.consume(code2);size++;return more}if(size<2&&!single)return nok(code2);const token=effects.exit("strikethroughSequenceTemporary");const after=classifyCharacter(code2);token._open=!after||after===2&&Boolean(before);token._close=!before||before===2&&Boolean(after);return ok3(code2)}}}var EditMap2=class{constructor(){this.map=[];this.index=new Map}add(index2,remove,add){addImplementation2(this,index2,remove,add)}consume(events){this.map.sort(function(a,b){return a[0]-b[0]});if(this.map.length===0){return}let index2=this.map.length;const vecs=[];while(index2>0){index2-=1;vecs.push(events.slice(this.map[index2][0]+this.map[index2][1]),this.map[index2][2]);events.length=this.map[index2][0]}vecs.push(events.slice());events.length=0;let slice=vecs.pop();while(slice){for(const element2 of slice){events.push(element2)}slice=vecs.pop()}this.map.length=0;this.index.clear()}};function addImplementation2(editMap,at,remove,add){if(remove===0&&add.length===0){return}const existing=editMap.index.get(at);if(existing){existing[1]+=remove;existing[2].push(...add);return}const change=[at,remove,add];editMap.map.push(change);editMap.index.set(at,change)}function gfmTableAlign(events,index2){let inDelimiterRow=false;const align=[];while(index2<events.length){const event=events[index2];if(inDelimiterRow){if(event[0]==="enter"){if(event[1].type==="tableContent"){align.push(events[index2+1][1].type==="tableDelimiterMarker"?"left":"none")}}else if(event[1].type==="tableContent"){if(events[index2-1][1].type==="tableDelimiterMarker"){const alignIndex=align.length-1;align[alignIndex]=align[alignIndex]==="left"?"center":"right"}}else if(event[1].type==="tableDelimiterRow"){break}}else if(event[0]==="enter"&&event[1].type==="tableDelimiterRow"){inDelimiterRow=true}index2+=1}return align}function gfmTable(){return{flow:{null:{name:"table",tokenize:tokenizeTable,resolveAll:resolveTable}}}}function tokenizeTable(effects,ok3,nok){const self=this;let size=0;let sizeB=0;let seen;return start;function start(code2){let index2=self.events.length-1;while(index2>-1){const{type}=self.events[index2][1];if(type==="lineEnding"||type==="linePrefix"){index2--}else{break}}const tail=index2>-1?self.events[index2][1].type:null;const next=tail==="tableHead"||tail==="tableRow"?bodyRowStart:headRowBefore;if(next===bodyRowStart&&self.parser.lazy[self.now().line]){return nok(code2)}return next(code2)}function headRowBefore(code2){effects.enter("tableHead");effects.enter("tableRow");return headRowStart(code2)}function headRowStart(code2){if(code2===124){return headRowBreak(code2)}seen=true;sizeB+=1;return headRowBreak(code2)}function headRowBreak(code2){if(code2===null){return nok(code2)}if(markdownLineEnding(code2)){if(sizeB>1){sizeB=0;self.interrupt=true;effects.exit("tableRow");effects.enter("lineEnding");effects.consume(code2);effects.exit("lineEnding");return headDelimiterStart}return nok(code2)}if(markdownSpace(code2)){return factorySpace(effects,headRowBreak,"whitespace")(code2)}sizeB+=1;if(seen){seen=false;size+=1}if(code2===124){effects.enter("tableCellDivider");effects.consume(code2);effects.exit("tableCellDivider");seen=true;return headRowBreak}effects.enter("data");return headRowData(code2)}function headRowData(code2){if(code2===null||code2===124||markdownLineEndingOrSpace(code2)){effects.exit("data");return headRowBreak(code2)}effects.consume(code2);return code2===92?headRowEscape:headRowData}function headRowEscape(code2){if(code2===92||code2===124){effects.consume(code2);return headRowData}return headRowData(code2)}function headDelimiterStart(code2){self.interrupt=false;if(self.parser.lazy[self.now().line]){return nok(code2)}effects.enter("tableDelimiterRow");seen=false;if(markdownSpace(code2)){return factorySpace(effects,headDelimiterBefore,"linePrefix",self.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(code2)}return headDelimiterBefore(code2)}function headDelimiterBefore(code2){if(code2===45||code2===58){return headDelimiterValueBefore(code2)}if(code2===124){seen=true;effects.enter("tableCellDivider");effects.consume(code2);effects.exit("tableCellDivider");return headDelimiterCellBefore}return headDelimiterNok(code2)}function headDelimiterCellBefore(code2){if(markdownSpace(code2)){return factorySpace(effects,headDelimiterValueBefore,"whitespace")(code2)}return headDelimiterValueBefore(code2)}function headDelimiterValueBefore(code2){if(code2===58){sizeB+=1;seen=true;effects.enter("tableDelimiterMarker");effects.consume(code2);effects.exit("tableDelimiterMarker");return headDelimiterLeftAlignmentAfter}if(code2===45){sizeB+=1;return headDelimiterLeftAlignmentAfter(code2)}if(code2===null||markdownLineEnding(code2)){return headDelimiterCellAfter(code2)}return headDelimiterNok(code2)}function headDelimiterLeftAlignmentAfter(code2){if(code2===45){effects.enter("tableDelimiterFiller");return headDelimiterFiller(code2)}return headDelimiterNok(code2)}function headDelimiterFiller(code2){if(code2===45){effects.consume(code2);return headDelimiterFiller}if(code2===58){seen=true;effects.exit("tableDelimiterFiller");effects.enter("tableDelimiterMarker");effects.consume(code2);effects.exit("tableDelimiterMarker");return headDelimiterRightAlignmentAfter}effects.exit("tableDelimiterFiller");return headDelimiterRightAlignmentAfter(code2)}function headDelimiterRightAlignmentAfter(code2){if(markdownSpace(code2)){return factorySpace(effects,headDelimiterCellAfter,"whitespace")(code2)}return headDelimiterCellAfter(code2)}function headDelimiterCellAfter(code2){if(code2===124){return headDelimiterBefore(code2)}if(code2===null||markdownLineEnding(code2)){if(!seen||size!==sizeB){return headDelimiterNok(code2)}effects.exit("tableDelimiterRow");effects.exit("tableHead");return ok3(code2)}return headDelimiterNok(code2)}function headDelimiterNok(code2){return nok(code2)}function bodyRowStart(code2){effects.enter("tableRow");return bodyRowBreak(code2)}function bodyRowBreak(code2){if(code2===124){effects.enter("tableCellDivider");effects.consume(code2);effects.exit("tableCellDivider");return bodyRowBreak}if(code2===null||markdownLineEnding(code2)){effects.exit("tableRow");return ok3(code2)}if(markdownSpace(code2)){return factorySpace(effects,bodyRowBreak,"whitespace")(code2)}effects.enter("data");return bodyRowData(code2)}function bodyRowData(code2){if(code2===null||code2===124||markdownLineEndingOrSpace(code2)){effects.exit("data");return bodyRowBreak(code2)}effects.consume(code2);return code2===92?bodyRowEscape:bodyRowData}function bodyRowEscape(code2){if(code2===92||code2===124){effects.consume(code2);return bodyRowData}return bodyRowData(code2)}}function resolveTable(events,context){let index2=-1;let inFirstCellAwaitingPipe=true;let rowKind=0;let lastCell=[0,0,0,0];let cell=[0,0,0,0];let afterHeadAwaitingFirstBodyRow=false;let lastTableEnd=0;let currentTable;let currentBody;let currentCell;const map=new EditMap2;while(++index2<events.length){const event=events[index2];const token=event[1];if(event[0]==="enter"){if(token.type==="tableHead"){afterHeadAwaitingFirstBodyRow=false;if(lastTableEnd!==0){flushTableEnd(map,context,lastTableEnd,currentTable,currentBody);currentBody=void 0;lastTableEnd=0}currentTable={type:"table",start:Object.assign({},token.start),end:Object.assign({},token.end)};map.add(index2,0,[["enter",currentTable,context]])}else if(token.type==="tableRow"||token.type==="tableDelimiterRow"){inFirstCellAwaitingPipe=true;currentCell=void 0;lastCell=[0,0,0,0];cell=[0,index2+1,0,0];if(afterHeadAwaitingFirstBodyRow){afterHeadAwaitingFirstBodyRow=false;currentBody={type:"tableBody",start:Object.assign({},token.start),end:Object.assign({},token.end)};map.add(index2,0,[["enter",currentBody,context]])}rowKind=token.type==="tableDelimiterRow"?2:currentBody?3:1}else if(rowKind&&(token.type==="data"||token.type==="tableDelimiterMarker"||token.type==="tableDelimiterFiller")){inFirstCellAwaitingPipe=false;if(cell[2]===0){if(lastCell[1]!==0){cell[0]=cell[1];currentCell=flushCell(map,context,lastCell,rowKind,void 0,currentCell);lastCell=[0,0,0,0]}cell[2]=index2}}else if(token.type==="tableCellDivider"){if(inFirstCellAwaitingPipe){inFirstCellAwaitingPipe=false}else{if(lastCell[1]!==0){cell[0]=cell[1];currentCell=flushCell(map,context,lastCell,rowKind,void 0,currentCell)}lastCell=cell;cell=[lastCell[1],index2,0,0]}}}else if(token.type==="tableHead"){afterHeadAwaitingFirstBodyRow=true;lastTableEnd=index2}else if(token.type==="tableRow"||token.type==="tableDelimiterRow"){lastTableEnd=index2;if(lastCell[1]!==0){cell[0]=cell[1];currentCell=flushCell(map,context,lastCell,rowKind,index2,currentCell)}else if(cell[1]!==0){currentCell=flushCell(map,context,cell,rowKind,index2,currentCell)}rowKind=0}else if(rowKind&&(token.type==="data"||token.type==="tableDelimiterMarker"||token.type==="tableDelimiterFiller")){cell[3]=index2}}if(lastTableEnd!==0){flushTableEnd(map,context,lastTableEnd,currentTable,currentBody)}map.consume(context.events);index2=-1;while(++index2<context.events.length){const event=context.events[index2];if(event[0]==="enter"&&event[1].type==="table"){event[1]._align=gfmTableAlign(context.events,index2)}}return events}function flushCell(map,context,range,rowKind,rowEnd,previousCell){const groupName=rowKind===1?"tableHeader":rowKind===2?"tableDelimiter":"tableData";const valueName="tableContent";if(range[0]!==0){previousCell.end=Object.assign({},getPoint(context.events,range[0]));map.add(range[0],0,[["exit",previousCell,context]])}const now=getPoint(context.events,range[1]);previousCell={type:groupName,start:Object.assign({},now),end:Object.assign({},now)};map.add(range[1],0,[["enter",previousCell,context]]);if(range[2]!==0){const relatedStart=getPoint(context.events,range[2]);const relatedEnd=getPoint(context.events,range[3]);const valueToken={type:valueName,start:Object.assign({},relatedStart),end:Object.assign({},relatedEnd)};map.add(range[2],0,[["enter",valueToken,context]]);if(rowKind!==2){const start=context.events[range[2]];const end=context.events[range[3]];start[1].end=Object.assign({},end[1].end);start[1].type="chunkText";start[1].contentType="text";if(range[3]>range[2]+1){const a=range[2]+1;const b=range[3]-range[2]-1;map.add(a,b,[])}}map.add(range[3]+1,0,[["exit",valueToken,context]])}if(rowEnd!==void 0){previousCell.end=Object.assign({},getPoint(context.events,rowEnd));map.add(rowEnd,0,[["exit",previousCell,context]]);previousCell=void 0}return previousCell}function flushTableEnd(map,context,index2,table,tableBody){const exits=[];const related=getPoint(context.events,index2);if(tableBody){tableBody.end=Object.assign({},related);exits.push(["exit",tableBody,context])}table.end=Object.assign({},related);exits.push(["exit",table,context]);map.add(index2+1,0,exits)}function getPoint(events,index2){const event=events[index2];const side=event[0]==="enter"?"start":"end";return event[1][side]}var tasklistCheck={name:"tasklistCheck",tokenize:tokenizeTasklistCheck};function gfmTaskListItem(){return{text:{[91]:tasklistCheck}}}function tokenizeTasklistCheck(effects,ok3,nok){const self=this;return open;function open(code2){if(self.previous!==null||!self._gfmTasklistFirstContentOfListItem){return nok(code2)}effects.enter("taskListCheck");effects.enter("taskListCheckMarker");effects.consume(code2);effects.exit("taskListCheckMarker");return inside}function inside(code2){if(markdownLineEndingOrSpace(code2)){effects.enter("taskListCheckValueUnchecked");effects.consume(code2);effects.exit("taskListCheckValueUnchecked");return close}if(code2===88||code2===120){effects.enter("taskListCheckValueChecked");effects.consume(code2);effects.exit("taskListCheckValueChecked");return close}return nok(code2)}function close(code2){if(code2===93){effects.enter("taskListCheckMarker");effects.consume(code2);effects.exit("taskListCheckMarker");effects.exit("taskListCheck");return after}return nok(code2)}function after(code2){if(markdownLineEnding(code2)){return ok3(code2)}if(markdownSpace(code2)){return effects.check({tokenize:spaceThenNonSpace},ok3,nok)(code2)}return nok(code2)}}function spaceThenNonSpace(effects,ok3,nok){return factorySpace(effects,after,"whitespace");function after(code2){return code2===null?nok(code2):ok3(code2)}}function gfm(options){return combineExtensions([gfmAutolinkLiteral(),gfmFootnote(),gfmStrikethrough(options),gfmTable(),gfmTaskListItem()])}var codes={carriageReturn:-5,lineFeed:-4,carriageReturnLineFeed:-3,horizontalTab:-2,virtualSpace:-1,eof:null,nul:0,soh:1,stx:2,etx:3,eot:4,enq:5,ack:6,bel:7,bs:8,ht:9,lf:10,vt:11,ff:12,cr:13,so:14,si:15,dle:16,dc1:17,dc2:18,dc3:19,dc4:20,nak:21,syn:22,etb:23,can:24,em:25,sub:26,esc:27,fs:28,gs:29,rs:30,us:31,space:32,exclamationMark:33,quotationMark:34,numberSign:35,dollarSign:36,percentSign:37,ampersand:38,apostrophe:39,leftParenthesis:40,rightParenthesis:41,asterisk:42,plusSign:43,comma:44,dash:45,dot:46,slash:47,digit0:48,digit1:49,digit2:50,digit3:51,digit4:52,digit5:53,digit6:54,digit7:55,digit8:56,digit9:57,colon:58,semicolon:59,lessThan:60,equalsTo:61,greaterThan:62,questionMark:63,atSign:64,uppercaseA:65,uppercaseB:66,uppercaseC:67,uppercaseD:68,uppercaseE:69,uppercaseF:70,uppercaseG:71,uppercaseH:72,uppercaseI:73,uppercaseJ:74,uppercaseK:75,uppercaseL:76,uppercaseM:77,uppercaseN:78,uppercaseO:79,uppercaseP:80,uppercaseQ:81,uppercaseR:82,uppercaseS:83,uppercaseT:84,uppercaseU:85,uppercaseV:86,uppercaseW:87,uppercaseX:88,uppercaseY:89,uppercaseZ:90,leftSquareBracket:91,backslash:92,rightSquareBracket:93,caret:94,underscore:95,graveAccent:96,lowercaseA:97,lowercaseB:98,lowercaseC:99,lowercaseD:100,lowercaseE:101,lowercaseF:102,lowercaseG:103,lowercaseH:104,lowercaseI:105,lowercaseJ:106,lowercaseK:107,lowercaseL:108,lowercaseM:109,lowercaseN:110,lowercaseO:111,lowercaseP:112,lowercaseQ:113,lowercaseR:114,lowercaseS:115,lowercaseT:116,lowercaseU:117,lowercaseV:118,lowercaseW:119,lowercaseX:120,lowercaseY:121,lowercaseZ:122,leftCurlyBrace:123,verticalBar:124,rightCurlyBrace:125,tilde:126,del:127,byteOrderMarker:65279,replacementCharacter:65533};var constants={attentionSideAfter:2,attentionSideBefore:1,atxHeadingOpeningFenceSizeMax:6,autolinkDomainSizeMax:63,autolinkSchemeSizeMax:32,cdataOpeningString:"CDATA[",characterGroupPunctuation:2,characterGroupWhitespace:1,characterReferenceDecimalSizeMax:7,characterReferenceHexadecimalSizeMax:6,characterReferenceNamedSizeMax:31,codeFencedSequenceSizeMin:3,contentTypeContent:"content",contentTypeDocument:"document",contentTypeFlow:"flow",contentTypeString:"string",contentTypeText:"text",hardBreakPrefixSizeMin:2,htmlBasic:6,htmlCdata:5,htmlComment:2,htmlComplete:7,htmlDeclaration:4,htmlInstruction:3,htmlRawSizeMax:8,htmlRaw:1,linkResourceDestinationBalanceMax:32,linkReferenceSizeMax:999,listItemValueSizeMax:10,numericBaseDecimal:10,numericBaseHexadecimal:16,tabSize:4,thematicBreakMarkerCountMin:3,v8MaxSafeChunkSize:1e4};import{useSettledText,withImeGuard}from"@kanyun-ai-infra/band-plugin-react";import{useCallback,useEffect,useRef,useState}from"react";import{jsx as jsx2,jsxs as jsxs2}from"react/jsx-runtime";import{useEffect as useEffect3,useState as useState3}from"react";import{Fragment as Fragment2,createElement,useEffect as useEffect2,useState as useState2}from"react";import{jsx as jsx3,jsxs as jsxs3}from"react/jsx-runtime";import{jsx as jsx4,jsxs as jsxs4}from"react/jsx-runtime";import{Fragment as Fragment3,jsx as jsx5,jsxs as jsxs5}from"react/jsx-runtime";if(typeof document!=="undefined"&&document.head){const css='/* src/viewer-text.css */\n.band-viewer-text {\n height: 100%;\n overflow: auto;\n overscroll-behavior: contain;\n padding: 20px 24px 32px 30px;\n background: var(--panel);\n border-radius: 10px;\n line-height: 1.75;\n font-size: var(--fs-lead);\n}\n.band-viewer-text:where(.state) {\n font-size: var(--fs-meta);\n color: var(--muted);\n}\n.band-viewer-text-frame {\n display: flex;\n flex-direction: column;\n height: 100%;\n min-height: 0;\n}\n.band-viewer-text-frame > :where(.band-viewer-text) {\n flex: 1;\n min-height: 0;\n}\n.band-viewer-text-findbtn {\n display: grid;\n place-items: center;\n width: 28px;\n height: 28px;\n margin-top: -8px;\n margin-right: -10px;\n border: 0;\n border-radius: var(--r-sm);\n background: var(--panel);\n color: var(--muted);\n cursor: pointer;\n}\n.band-viewer-text-findbtn:hover {\n background: var(--fill-2);\n color: var(--ink);\n}\n.band-viewer-text-findbtn:focus-visible {\n outline: 2px solid var(--accent);\n outline-offset: -2px;\n}\n.band-viewer-text-findbtn svg,\n.band-viewer-text-find svg {\n width: 15px;\n height: 15px;\n display: block;\n fill: none;\n stroke: currentColor;\n stroke-width: 1.5;\n stroke-linecap: round;\n stroke-linejoin: round;\n}\n.band-viewer-text:focus {\n outline: none;\n}\n.band-viewer-text-findlayer {\n position: sticky;\n top: -12px;\n z-index: 3;\n height: 0;\n display: flex;\n justify-content: flex-end;\n align-items: flex-start;\n}\n.band-viewer-text-find {\n display: flex;\n align-items: center;\n gap: 2px;\n width: min(340px, 100%);\n box-sizing: border-box;\n margin-top: -12px;\n margin-right: -14px;\n padding: 4px 4px 4px 10px;\n border-radius: var(--r);\n background: var(--panel);\n box-shadow: var(--shadow-pop);\n font-size: var(--fs-ui);\n line-height: 1.4;\n color: var(--muted);\n animation: band-viewer-text-find-in var(--sixteenth) var(--ease);\n}\n@keyframes band-viewer-text-find-in {\n from {\n opacity: 0;\n transform: translateY(-4px);\n }\n}\n.band-viewer-text-find input {\n flex: 1;\n min-width: 0;\n margin-left: 6px;\n border: 0;\n padding: 4px 0;\n background: none;\n color: var(--ink);\n font: inherit;\n outline: none;\n}\n.band-viewer-text-find input::placeholder {\n color: var(--muted);\n}\n.band-viewer-text-find output {\n flex: none;\n padding: 0 6px;\n font-variant-numeric: tabular-nums;\n color: var(--muted);\n}\n.band-viewer-text-find output.none {\n color: var(--bad);\n}\n.band-viewer-text-find-btn {\n flex: none;\n display: grid;\n place-items: center;\n width: 26px;\n height: 26px;\n border: 0;\n border-radius: var(--r-sm);\n background: none;\n color: var(--muted);\n cursor: pointer;\n}\n.band-viewer-text-find-btn:hover:not(:disabled) {\n background: var(--fill);\n color: var(--ink);\n}\n.band-viewer-text-find-btn:focus-visible {\n outline: 2px solid var(--accent);\n outline-offset: -2px;\n}\n.band-viewer-text-find-btn:disabled {\n color: var(--muted);\n opacity: 0.5;\n cursor: default;\n}\n::highlight(band-viewer-text-find) {\n background-color: var(--warn-soft);\n}\n::highlight(band-viewer-text-find-current) {\n background-color: var(--warn);\n color: var(--panel);\n}\n@media (prefers-reduced-motion: reduce) {\n .band-viewer-text-find {\n animation: none;\n }\n}\n.band-viewer-text-toolbar {\n display: flex;\n justify-content: flex-end;\n flex-wrap: wrap;\n gap: 4px;\n padding-bottom: 6px;\n}\n.band-viewer-text-toolbar:where([hidden]) {\n display: none;\n}\n.band-viewer-text-block {\n position: relative;\n max-width: 68ch;\n padding: 2px 0;\n}\n.band-viewer-text-aside {\n display: flex;\n flex-wrap: wrap;\n gap: 4px 12px;\n}\n.band-viewer-text-aside:has(> .band-viewer-text-aside-item:not(:empty)) {\n margin: -2px 0 6px;\n}\n.band-viewer-text-aside-item {\n min-width: 0;\n max-width: 100%;\n}\n.band-viewer-text-aside-item:empty {\n display: none;\n}\n.band-viewer-text-content {\n min-width: 0;\n}\n.band-viewer-text-content > :where(*) {\n margin: 6px 0;\n}\n.band-viewer-text-content h1 {\n font-size: var(--fs-h2);\n line-height: 1.35;\n font-weight: 600;\n}\n.band-viewer-text-content :where(h2) {\n margin-top: 18px;\n font-size: var(--fs-lead);\n font-weight: 600;\n}\n.band-viewer-text-content :where(h3, h4, h5, h6) {\n margin-top: 12px;\n font-size: var(--fs-body);\n font-weight: 600;\n}\n.band-viewer-text-content :where(h5, h6) {\n color: var(--muted);\n}\n.band-viewer-text-content blockquote {\n padding-left: 12px;\n border-left: 3px solid var(--rule-strong);\n color: var(--muted);\n}\n.band-viewer-text-content :where(ul, ol) {\n padding-left: 1.5em;\n}\n.band-viewer-text-content :where(li + li, li > ul, li > ol) {\n margin-top: 2px;\n}\n.band-viewer-text-tasks {\n list-style: none;\n}\n.band-viewer-text-content :where(.band-viewer-text-tasks) {\n padding-left: 0.25em;\n}\n.band-viewer-text-task {\n display: flex;\n gap: 8px;\n align-items: baseline;\n}\n.band-viewer-text-content hr {\n height: 0;\n margin: 16px 0;\n border: 0;\n border-top: var(--hairline) solid var(--rule-strong);\n}\n.band-viewer-text-content :where(:not(pre) > code) {\n padding: 0 4px;\n border-radius: 4px;\n background: var(--fill);\n font-family: var(--mono);\n font-size: 0.9em;\n}\n.band-viewer-text-a {\n padding: 0;\n border: 0;\n background: none;\n color: var(--accent-text);\n font: inherit;\n text-decoration: none;\n cursor: pointer;\n}\n.band-viewer-text-a:where(:hover) {\n text-decoration: underline;\n}\n.band-viewer-text-a:where(:focus-visible) {\n outline: none;\n border-radius: 3px;\n box-shadow: 0 0 0 2px var(--accent);\n}\n.band-viewer-text-img {\n display: block;\n max-width: 100%;\n height: auto;\n border-radius: 8px;\n}\n.band-viewer-text-imgalt,\n.band-viewer-text-imglink {\n font-size: var(--fs-ui);\n}\n.band-viewer-text-imgalt {\n color: var(--muted);\n}\n.band-viewer-text-table {\n max-width: 100%;\n overflow-x: auto;\n border-radius: 6px;\n}\n.band-viewer-text-table:where(:focus-visible) {\n outline: none;\n box-shadow: 0 0 0 2px var(--accent);\n}\n.band-viewer-text-table table {\n width: max-content;\n min-width: 100%;\n border-collapse: collapse;\n font-size: var(--fs-body);\n line-height: 1.6;\n}\n.band-viewer-text-table :where(th, td) {\n max-width: 32ch;\n overflow-wrap: break-word;\n padding: 6px 12px;\n border-bottom: var(--hairline) solid var(--rule-strong);\n text-align: left;\n vertical-align: top;\n}\n.band-viewer-text-table :where(th) {\n font-weight: 600;\n white-space: nowrap;\n}\n.band-viewer-text-code {\n margin: 8px 0;\n border-radius: 8px;\n background: var(--sunk);\n box-shadow: inset 0 0 0 1px var(--rule);\n overflow: hidden;\n}\n.band-viewer-text-code figcaption {\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: 2px 4px 0 12px;\n font-size: var(--fs-meta);\n color: var(--muted);\n}\n.band-viewer-text-code pre {\n margin: 0;\n padding: 4px 12px 10px;\n overflow: auto;\n font-family: var(--mono);\n font-size: var(--fs-ui);\n line-height: 1.6;\n}\n.band-viewer-text-fnref {\n font-size: var(--fs-meta);\n color: var(--accent-text);\n}\n.band-viewer-text-footnotes {\n margin-top: 20px;\n padding-top: 8px;\n border-top: var(--hairline) solid var(--rule);\n font-size: var(--fs-ui);\n color: var(--muted);\n}\n.band-viewer-text-footnotes ol {\n padding-left: 1.5em;\n}\n:where(.band-viewer-text.plain) .band-viewer-text-content p {\n white-space: pre-wrap;\n font-family: var(--mono);\n font-size: var(--fs-ui);\n}\n.band-viewer-text-files {\n display: flex;\n flex-wrap: wrap;\n margin-bottom: 12px;\n}\n.band-viewer-text-empty {\n font-size: var(--fs-ui);\n color: var(--muted);\n}\n.band-viewer-text-more {\n display: flex;\n flex-wrap: wrap;\n gap: 8px;\n align-items: center;\n margin-top: 16px;\n font-size: var(--fs-ui);\n color: var(--muted);\n}\n.band-viewer-text-add {\n position: absolute;\n top: 4px;\n left: -27px;\n display: grid;\n place-items: center;\n box-sizing: border-box;\n width: 22px;\n height: 22px;\n padding: 0;\n border: 1px solid var(--rule);\n border-radius: 50%;\n background: var(--panel);\n color: var(--muted);\n cursor: pointer;\n opacity: 0;\n}\n.band-viewer-text-add svg,\n.band-viewer-text-bubble svg {\n display: block;\n width: 14px;\n height: 14px;\n fill: none;\n stroke: currentColor;\n stroke-width: 1.5;\n stroke-linecap: round;\n stroke-linejoin: round;\n}\n.band-viewer-text-add:where(:hover) {\n border-color: var(--rule-strong);\n color: var(--ink);\n}\n.band-viewer-text-add:where(:focus-visible) {\n outline: 2px solid var(--accent);\n outline-offset: 1px;\n}\n.band-viewer-text-bubble {\n position: absolute;\n z-index: 4;\n translate: -50% -100%;\n box-shadow: var(--shadow-pop);\n animation: band-viewer-text-bubble-in var(--sixteenth) var(--ease);\n}\n.band-viewer-text-bubble:where([data-below]) {\n translate: -50% 0;\n}\n@keyframes band-viewer-text-bubble-in {\n from {\n opacity: 0;\n }\n}\n@media (prefers-reduced-motion: reduce) {\n .band-viewer-text-bubble {\n animation: none;\n }\n}\n@media (hover: none) {\n .band-viewer-text-add {\n opacity: 0.6;\n }\n}\n:where(.band-viewer-text-block:hover) .band-viewer-text-add,\n.band-viewer-text-add:where(:focus-visible) {\n opacity: 1;\n}\n.band-viewer-text-block:where([data-compare])::before {\n content: "";\n position: absolute;\n inset: 2px auto 2px -10px;\n width: 3px;\n border-radius: 2px;\n background: var(--muted);\n}\n.band-viewer-text-block:where([data-compare=added])::before {\n background: var(--accent);\n}\n.band-viewer-text[data-text-commenting=true] [data-text-comment-start] {\n cursor: crosshair;\n}\n.band-viewer-text [data-text-comment-hover] {\n outline: 1.5px solid var(--accent);\n outline-offset: 3px;\n border-radius: 3px;\n background: color-mix(in srgb, var(--accent) 9%, transparent);\n}\n.band-viewer-text-data {\n margin: 0;\n white-space: pre-wrap;\n overflow-wrap: anywhere;\n font-family: var(--mono);\n font-size: var(--fs-ui);\n line-height: 1.6;\n}\n.band-viewer-text-csv :where(td) {\n white-space: pre-wrap;\n}\n';let el=document.head.querySelector('style[data-band-style="@kanyun-ai-infra/band-viewer-text"]');if(!el){el=document.createElement("style");el.setAttribute("data-band-style","@kanyun-ai-infra/band-viewer-text");document.head.prepend(el)}el.textContent=css}function nextBubble(j){if(j.phase==="done")return null;if(j.baseBelow)return null;if(!j.occluded)return null;if(j.phase==="design"){return j.otherFits?{side:"below",phase:"flipped"}:{side:"above",phase:"done"}}return{side:"above",phase:"done"}}var SRC_START="data-src-start";var SRC_END="data-src-end";function srcProps(node2){const s=node2.position?.start.offset;const e=node2.position?.end.offset;return typeof s==="number"&&typeof e==="number"?{[SRC_START]:s,[SRC_END]:e}:{}}var WINDOW=16;function alignOffsets(text4,source,base){const at=source.indexOf(text4);if(at>=0)return Array.from({length:text4.length+1},(_,i)=>base+at+i);const map=[];let j=0;for(let i=0;i<text4.length;i++){const limit=Math.min(source.length,j+WINDOW);let k=j;while(k<limit&&source[k]!==text4[i])k++;if(k<limit){map.push(base+k);j=k+1}else map.push(base+j)}map.push(base+j);return map}var cache=new WeakMap;function segOf(el,source){const start=Number(el.getAttribute(SRC_START));const end=Number(el.getAttribute(SRC_END));if(!Number.isInteger(start)||!Number.isInteger(end)||end<start)return null;const text4=el.textContent??"";const hit=cache.get(el);if(hit&&hit.source===source&&hit.seg.text===text4&&hit.seg.start===start)return hit.seg;const seg={el,start,end,text:text4,map:alignOffsets(text4,source.slice(start,end),start)};cache.set(el,{source,seg});return seg}function segmentsIn(roots,source){const out=[];for(const root of roots){for(const el of root.querySelectorAll(`[${SRC_START}]`)){const seg=segOf(el,source);if(seg)out.push(seg)}}return out}function charIndex(seg,node2,offset){const r=seg.el.ownerDocument.createRange();r.selectNodeContents(seg.el);r.setEnd(node2,offset);return r.toString().length}function selectionToSource(range,roots,source){let first=null;let last=null;for(const seg of segmentsIn(roots,source)){if(!range.intersectsNode(seg.el))continue;const a=seg.el.contains(range.startContainer)?charIndex(seg,range.startContainer,range.startOffset):0;const b=seg.el.contains(range.endContainer)?charIndex(seg,range.endContainer,range.endOffset):seg.text.length;if(b<=a)continue;if(!first)first={seg,a};last={seg,b}}if(!first||!last)return null;const start=first.a>0?first.seg.map[first.a-1]+1:first.seg.map[0];const end=last.seg.map[last.b-1]+1;if(end<=start)return null;return{start,end,text:range.toString()}}function pieces(seg,a,b){const doc=seg.el.ownerDocument;const walker=doc.createTreeWalker(seg.el,4);const out=[];let at=0;for(let n=walker.nextNode();n;n=walker.nextNode()){const len=n.data.length;const s=Math.max(a,at);const e=Math.min(b,at+len);if(e>s){const r=doc.createRange();r.setStart(n,s-at);r.setEnd(n,e-at);out.push(r)}at+=len;if(at>=b)break}return out}function firstAtOrAfter(map,x){const n=map.length-1;for(let i=0;i<n;i++)if(map[i]>=x)return i;return n}function sourceToBoxes(roots,source,start,end){const rects=[];for(const seg of segmentsIn(roots,source)){if(seg.end<=start||seg.start>=end)continue;const a=firstAtOrAfter(seg.map,start);const b=firstAtOrAfter(seg.map,end);for(const r of pieces(seg,a,b)){for(const box of r.getClientRects?.()??[]){if(box.width>0&&box.height>0)rects.push(box)}}}return mergeLines(rects)}function mergeLines(rects){const out=[];for(const r of rects){const prev=out.at(-1);if(prev){const overlap=Math.min(prev.bottom,r.bottom)-Math.max(prev.top,r.top);const minH=Math.min(prev.bottom-prev.top,r.bottom-r.top);const gap=r.left-prev.right;if(overlap>minH/2&&gap<=2&&gap>=-(prev.right-prev.left)){out[out.length-1]={left:Math.min(prev.left,r.left),top:Math.min(prev.top,r.top),right:Math.max(prev.right,r.right),bottom:Math.max(prev.bottom,r.bottom)};continue}}out.push({left:r.left,top:r.top,right:r.right,bottom:r.bottom})}return out}var COMMENT_START="data-text-comment-start";var COMMENT_END="data-text-comment-end";var HOVER="data-text-comment-hover";function commentProps(node2){const start=node2.position?.start.offset;const end=node2.position?.end.offset;return typeof start==="number"&&typeof end==="number"?{[COMMENT_START]:start,[COMMENT_END]:end}:{}}function readTextSelection(article,source){const sel=article.ownerDocument.getSelection();if(!sel||sel.isCollapsed||!sel.rangeCount)return null;const range=sel.getRangeAt(0);const roots=[...article.querySelectorAll(".band-viewer-text-content")];if(![range.startContainer,range.endContainer].every(n=>roots.some(r=>r.contains(n))))return null;const pick=selectionToSource(range,roots,source);return pick?.text.trim()?pick:null}function bindCommentMode(article,source,comment){let hovered=null;let saved=null;let pressed=null;const targetOf=target=>{if(!(target instanceof Element))return null;const block=target.closest(`[${COMMENT_START}]`);return block&&article.contains(block)&&block.closest(".band-viewer-text-content")?block:null};const selection=()=>readTextSelection(article,source);const hover=event=>{const next=targetOf(event.target);if(next===hovered)return;hovered?.removeAttribute(HOVER);hovered=next;hovered?.setAttribute(HOVER,"")};const leave=()=>{hovered?.removeAttribute(HOVER);hovered=null};const down=event=>{saved=selection();pressed={x:event.clientX,y:event.clientY}};const cancel=()=>{pressed=null;saved=null};const click=event=>{const block=targetOf(event.target);if(!block||event.button!==0)return;const pointer=event.detail>0;const dragged=pointer&&pressed&&Math.hypot(event.clientX-pressed.x,event.clientY-pressed.y)>=4;pressed=null;if(dragged){saved=null;return}const start=Number(block.getAttribute(COMMENT_START));const end=Number(block.getAttribute(COMMENT_END));const selected=selection()??(pointer?saved:null);const pick=selected&&selected.start<end&&selected.end>start?selected:{start,end,text:block.textContent??""};saved=null;if(!Number.isInteger(pick.start)||!Number.isInteger(pick.end)||pick.end<=pick.start)return;event.preventDefault();event.stopPropagation();leave();article.ownerDocument.getSelection()?.removeAllRanges();comment(pick)};article.addEventListener("pointerover",hover);article.addEventListener("pointerleave",leave);article.addEventListener("pointerdown",down,true);article.ownerDocument.addEventListener("pointercancel",cancel,true);article.addEventListener("click",click,true);return()=>{leave();article.removeEventListener("pointerover",hover);article.removeEventListener("pointerleave",leave);article.removeEventListener("pointerdown",down,true);article.ownerDocument.removeEventListener("pointercancel",cancel,true);article.removeEventListener("click",click,true)}}var MAX_DIFF_BLOCKS=2500;var norm=s=>s.replace(/\s+/g," ").trim();function diffBlocks(a,b){if(a.length>MAX_DIFF_BLOCKS||b.length>MAX_DIFF_BLOCKS)return null;const x=a.map(norm);const y=b.map(norm);const w=y.length+1;const dp=new Uint32Array((x.length+1)*w);for(let i2=x.length-1;i2>=0;i2--){for(let j2=y.length-1;j2>=0;j2--){dp[i2*w+j2]=x[i2]===y[j2]?(dp[(i2+1)*w+j2+1]??0)+1:Math.max(dp[(i2+1)*w+j2]??0,dp[i2*w+j2+1]??0)}}const removed=new Set;const added=new Set;let i=0;let j=0;while(i<x.length&&j<y.length){if(x[i]===y[j]){i++;j++}else if((dp[(i+1)*w+j]??0)>=(dp[i*w+j+1]??0)){removed.add(i++)}else{added.add(j++)}}while(i<x.length)removed.add(i++);while(j<y.length)added.add(j++);return{removed,added}}var groups=new Map;function joinTextCompare(artifactId,peer){let group=groups.get(artifactId);if(!group){group=new Set;groups.set(artifactId,group)}const members=group;members.add(peer);const others=()=>[...members].filter(p=>p!==peer);for(const p of others())p.changed();return{others,notify(){for(const p of others())p.changed()},scroll(ratio){for(const p of others())p.scrollTo(ratio)},leave(){members.delete(peer);if(members.size===0&&groups.get(artifactId)===members)groups.delete(artifactId);for(const p of members)p.changed()}}}function marksAgainst(me,mine,other){const out=new Map;const theirs=other?.blocks()??null;if(!mine||!theirs||!other||other.versionId===me.versionId)return out;const iAmNew=me.createdAt>other.createdAt;const d=iAmNew?diffBlocks(theirs,mine):diffBlocks(mine,theirs);if(!d)return out;for(const i of iAmNew?d.added:d.removed)out.set(i,iAmNew?"added":"removed");return out}var BOM=String.fromCharCode(65279);var stripBom=s=>s.startsWith(BOM)?s.slice(1):s;function formatJson(src){const s=stripBom(src);try{JSON.parse(s)}catch{return null}let out="";let depth=0;const newline=()=>`
2
+ ${" ".repeat(depth)}`;for(let i=0;i<s.length;i++){const c=s[i];if(c==='"'){let j=i+1;while(j<s.length&&s[j]!=='"')j+=s[j]==="\\"?2:1;out+=s.slice(i,j+1);i=j}else if(c==="{"||c==="["){let j=i+1;while(j<s.length&&/\s/.test(s[j]))j++;if(s[j]===(c==="{"?"}":"]")){out+=c==="{"?"{}":"[]";i=j}else{depth++;out+=c+newline()}}else if(c==="}"||c==="]"){depth--;out+=newline()+c}else if(c===","){out+=`,${newline()}`}else if(c===":"){out+=": "}else if(!/\s/.test(c)){out+=c}}return out}function parseCsv(src){const s=stripBom(src);const rows=[];let row=[];let at=0;const n=s.length;if(n===0)return rows;for(;;){let field="";if(s[at]==='"'){at++;for(;;){const q=s.indexOf('"',at);if(q<0)return null;field+=s.slice(at,q);if(s[q+1]==='"'){field+='"';at=q+2}else{at=q+1;break}}if(at<n&&s[at]!==","&&s[at]!=="\n"&&s[at]!=="\r")return null}else{let end=at;while(end<n&&s[end]!==","&&s[end]!=="\n"&&s[end]!=="\r")end++;field=s.slice(at,end);at=end}row.push(field);if(at>=n)break;if(s[at]===","){at++;continue}at+=s[at]==="\r"&&s[at+1]==="\n"?2:1;rows.push(row);row=[];if(at>=n)return rows}rows.push(row);return rows}var DATA_LIMIT=2e5;function DataBody({text:text4,format}){const content3=useMemo(()=>body(text4,format),[text4,format]);return jsx("div",{className:"band-viewer-text-content",children:content3})}function body(text4,format){if(text4.length>DATA_LIMIT)return jsxs(Fragment,{children:[jsxs("p",{className:"band-viewer-text-empty",children:["\u6587\u4EF6\u8F83\u5927\uFF0C\u53EA\u663E\u793A\u5F00\u5934 ",DATA_LIMIT/1e4," \u4E07\u5B57\u7684\u539F\u6587\uFF0C\u4E0D\u6392\u7248"]}),jsx("pre",{className:"band-viewer-text-data",children:text4.slice(0,DATA_LIMIT)})]});if(format==="csv"){const rows=parseCsv(text4);if(rows&&rows.length>0)return jsx(CsvTable,{rows})}else{const pretty=formatJson(text4);if(pretty!==null)return jsx("pre",{className:"band-viewer-text-data",children:pretty})}if(!text4.trim())return jsx("p",{className:"band-viewer-text-empty",children:"\u8FD9\u4EFD\u6587\u4EF6\u662F\u7A7A\u7684"});return jsx("pre",{className:"band-viewer-text-data",children:text4})}function CsvTable({rows}){const cols=rows.reduce((n,r)=>Math.max(n,r.length),0);const cells=(r,Tag)=>Array.from({length:cols},(_,i)=>jsx(Tag,{children:r[i]??""},i));const[head=[],...rest]=rows;return jsx("div",{className:"band-viewer-text-table band-viewer-text-csv",tabIndex:0,children:jsxs("table",{children:[jsx("thead",{children:jsx("tr",{children:cells(head,"th")})}),rest.length>0&&jsx("tbody",{children:rest.map((r,i)=>jsx("tr",{children:cells(r,"td")},i))})]})})}var cjkCharacter=new RegExp(["\\p{Script_Extensions=Han}","\\p{Script_Extensions=Hiragana}","\\p{Script_Extensions=Katakana}","\\p{Script_Extensions=Hangul}","\\p{Script_Extensions=Bopomofo}"].join("|"),"u");function isCjkCharacter(code2){return code2!==null&&code2>=0&&cjkCharacter.test(String.fromCodePoint(code2))}var tokenizeCjkFriendlyAttention=function(effects,ok3,nok){const configuredAttentionMarkers=this.parser.constructs.attentionMarkers.null;if(configuredAttentionMarkers===void 0){throw new Error("micromark CommonMark attention markers are unavailable")}const attentionMarkers2=configuredAttentionMarkers;const previous3=this.previous;const before=classifyCharacter(previous3);let marker=codes.eof;return start;function start(code2){if(code2!==codes.asterisk)return nok(code2);marker=code2;effects.enter("attentionSequence");return inside(code2)}function inside(code2){if(code2===marker){effects.consume(code2);return inside}const token=effects.exit("attentionSequence");const after=classifyCharacter(code2);const open=!after||after===constants.characterGroupPunctuation&&Boolean(before)||attentionMarkers2.includes(code2);const commonMarkClose=!before||before===constants.characterGroupPunctuation&&Boolean(after)||attentionMarkers2.includes(previous3);const markerCount=token.end.offset-token.start.offset;const cjkStrongClose=markerCount>=2&&unicodePunctuation(previous3)&&isCjkCharacter(code2);const close=commonMarkClose||cjkStrongClose;token._open=open;token._close=close;return ok3(code2)}};var cjkFriendlyAttention={name:"cjkFriendlyAttention",resolveAll:attention.resolveAll,tokenize:tokenizeCjkFriendlyAttention};var cjkFriendlyStrongExtension={text:{[codes.asterisk]:cjkFriendlyAttention}};function cjkFriendlyStrong(){return cjkFriendlyStrongExtension}var TEXT_MIME=/^text\/(markdown|plain)/;var TEXT_EXT=/\.(md|markdown|txt)$/i;var MARKDOWN=(path2,mime)=>/^text\/markdown/.test(mime)||/\.(md|markdown)$/i.test(path2);var DATA_MIME=/^(application\/json|text\/csv)\b/;var DATA_EXT=/\.(json|csv)$/i;var isText=e=>TEXT_MIME.test(e.mime)||TEXT_EXT.test(e.path);var isData=e=>!isText(e)&&(DATA_MIME.test(e.mime)||DATA_EXT.test(e.path));function textEntries(v){return[...v.entries.filter(isText),...v.entries.filter(isData)].map(e=>e.path)}function dataFormat(v,path2){const e=v.entries.find(x=>x.path===path2);if(!e||!isData(e))return null;if(/^application\/json\b/.test(e.mime))return"json";if(/^text\/csv\b/.test(e.mime))return"csv";return/\.json$/i.test(e.path)?"json":"csv"}function textEntry(v){const all2=textEntries(v);const named=all2.filter(p=>/(^|\/)(readme|index)\.(md|markdown)$/i.test(p)).sort((a,b)=>a.split("/").length-b.split("/").length);return named[0]??all2[0]??null}function legacyEntry(v){return v.entries.find(e=>TEXT_MIME.test(e.mime))?.path??v.entries.find(e=>TEXT_EXT.test(e.path))?.path??null}function isMarkdown(v,path2){const e=v.entries.find(x=>x.path===path2);return MARKDOWN(path2,e?.mime??"")}function parseDoc(src,format){if(format==="plain")return{format,source:src,...plainBlocks(src)};const root=fromMarkdown(src,{extensions:[gfm(),cjkFriendlyStrong()],mdastExtensions:[gfmFromMarkdown()]});const definitions=new Map;const footnotes=new Map;collectTargets(root.children,definitions,footnotes);const blocks=[];for(const node2 of root.children){if(node2.type==="definition"||node2.type==="footnoteDefinition")continue;const start=node2.position?.start.offset??0;const end=node2.position?.end.offset??start;const headingId=node2.type==="heading"?takeHeadingId(node2,src):void 0;const text4=node2.type==="html"?node2.value:toString(node2);blocks.push({node:node2,start,end,text:lf(text4).trim(),...headingId?{headingId}:{}})}return{format,source:src,blocks,definitions,footnotes}}var lf=s=>s.replace(/\r\n?/g,"\n");var HEADING_ID=/[ \t]*\{#([a-z0-9][a-z0-9-]{0,63})\}$/;function takeHeadingId(node2,src){const last=node2.children.at(-1);if(last?.type!=="text")return void 0;const m=HEADING_ID.exec(last.value);const end=last.position?.end.offset;if(!m||typeof end!=="number"||!last.position)return void 0;const tail=m[0];if(src.slice(end-tail.length,end)!==tail)return void 0;last.value=last.value.slice(0,-tail.length);last.position={start:last.position.start,end:{...last.position.end,offset:end-tail.length,column:last.position.end.column-tail.length}};if(last.value==="")node2.children.pop();return m[1]}function plainBlocks(src){const blocks=[];let start=-1;let end=0;const flush=()=>{if(start<0)return;const value=lf(src.slice(start,end));const position2={start:{line:1,column:1,offset:start},end:{line:1,column:1,offset:end}};blocks.push({node:{type:"paragraph",position:position2,children:[{type:"text",value,position:position2}]},start,end,text:value.trim()});start=-1};for(let at=0;at<=src.length;){const nl=src.indexOf("\n",at);const lineEnd=nl<0?src.length:nl;const contentEnd=lineEnd>at&&src[lineEnd-1]==="\r"?lineEnd-1:lineEnd;if(src.slice(at,contentEnd).trim()){if(start<0)start=at;end=contentEnd}else flush();if(nl<0)break;at=nl+1}flush();return{blocks,definitions:new Map,footnotes:new Map}}function collectTargets(nodes,definitions,footnotes){for(const node2 of nodes){if(node2.type==="definition"){const id=node2.identifier.toUpperCase();if(!definitions.has(id))definitions.set(id,node2)}else if(node2.type==="footnoteDefinition"){const id=node2.identifier.toUpperCase();if(!footnotes.has(id))footnotes.set(id,node2)}if("children"in node2)collectTargets(node2.children,definitions,footnotes)}}var CONTEXT=32;function blockAnchor(doc,i,path2){const b=doc.blocks[i];if(!b)throw new Error(`\u6CA1\u6709\u7B2C ${i} \u5757`);return rangeAnchor(doc,path2,b.start,b.end,b.text,`\u7B2C ${i+1} \u5757`)}var LABEL_MAX=40;function rangeAnchor(doc,path2,start,end,shown,fallback="\u9009\u4E2D\u7684\u6587\u5B57"){let s=start;let e=end;while(s<e&&/\s/.test(doc.source[s]??""))s++;while(e>s&&/\s/.test(doc.source[e-1]??""))e--;if(s===e)[s,e]=[start,end];const exact=doc.source.slice(s,e);const prefix=doc.source.slice(Math.max(0,s-CONTEXT),s);const suffix=doc.source.slice(e,e+CONTEXT);const text4=lf(shown).trim();return{payload:{path:path2,label:text4.replace(/\s+/g," ").slice(0,LABEL_MAX)||fallback,quote:{exact,...prefix?{prefix}:{},...suffix?{suffix}:{}},pos:{start:s,end:e}},snapshot:text4}}function blockAt(doc,at){const i=doc.blocks.findIndex(b=>b.start<=at&&at<b.end);return i<0?null:i}function placeOf(anchor,doc,ctx){if(anchor.kind!=="text-range")return{at:"none"};const p=anchor.payload;const file=typeof p.path==="string"?p.path:ctx.legacyPath??ctx.path;if(file!==ctx.path){return ctx.paths.includes(file)?{at:"elsewhere",path:file}:{at:"none"}}const quote=p.quote;if(quote&&typeof quote.exact==="string"){const pos=p.pos;const placed=relocateTextRange({quote:{exact:quote.exact,...typeof quote.prefix==="string"?{prefix:quote.prefix}:{},...typeof quote.suffix==="string"?{suffix:quote.suffix}:{}},...typeof pos?.start==="number"&&typeof pos.end==="number"?{pos:{start:pos.start,end:pos.end}}:{}},doc.source,at=>blockAt(doc,at)!==null);if(placed.status==="orphan")return{at:"none"};const block=blockAt(doc,placed.start);return block===null?{at:"none"}:{at:"block",block,start:placed.start,end:placed.end,status:placed.status}}const n=typeof p.block==="number"?p.block:null;const whole=i=>{const b=doc.blocks[i];return{at:"block",block:i,start:b.start,end:b.end}};if(anchor.snapshot===void 0){return anchor.versionId===ctx.versionId&&n!==null&&doc.blocks[n]?whole(n):{at:"none"}}const snap=lf(anchor.snapshot).trim();const from=n??0;let best=null;doc.blocks.forEach((b,i)=>{if(b.text!==snap&&lf(doc.source.slice(b.start,b.end)).trim()!==snap)return;if(best===null||Math.abs(i-from)<Math.abs(best-from))best=i});return best===null?{at:"none"}:whole(best)}function resolvePath(from,href){const clean=href.split(/[?#]/)[0]??"";if(!clean)return null;let decoded;try{decoded=decodeURIComponent(clean)}catch{return null}const parts=decoded.startsWith("/")?[]:from.split("/").slice(0,-1);for(const seg of decoded.split("/")){if(seg===""||seg===".")continue;if(seg===".."){if(parts.length===0)return null;parts.pop()}else parts.push(seg)}return parts.join("/")||null}var RENDER_LIMIT=1e6;function initialBlockCount(doc){const n=doc.blocks.findIndex(b=>b.end>RENDER_LIMIT);return n<0?doc.blocks.length:Math.max(1,n)}var FIND_SKIP="data-find-skip";function textNodes(root){const out=[];const walker=root.ownerDocument.createTreeWalker(root,4);for(let n=walker.nextNode();n;n=walker.nextNode()){if(n.parentElement?.closest(`[${FIND_SKIP}]`))continue;out.push(n)}return out}function fold(s){let out="";for(const ch of s){const low=ch.toLowerCase();out+=low.length===ch.length?low:ch}return out}function findRanges(roots,query){const q=fold(query);if(q.trim()==="")return[];const out=[];for(const root of roots){const nodes=textNodes(root);const text4=fold(nodes.map(t=>t.data).join(""));let n=0;let base=0;const at=(pos,end)=>{while(n<nodes.length){const t=nodes[n];const next=base+t.data.length;if(pos<next||end&&pos===next)return[t,pos-base];base=next;n++}return null};for(let i=text4.indexOf(q);i!==-1;i=text4.indexOf(q,i+q.length)){const start=at(i,false);const stop=start&&at(i+q.length,true);if(!start||!stop)break;const range=root.ownerDocument.createRange();range.setStart(...start);range.setEnd(...stop);out.push(range)}}return out}function step(index2,total,dir){if(total===0)return 0;return(index2+dir+total)%total}function isFindKey(e){return(e.metaKey||e.ctrlKey)&&!e.shiftKey&&!e.altKey&&e.key.toLowerCase()==="f"}function claimsFind(frame,target){const doc=frame.ownerDocument;const node2=target!==null&&typeof target.nodeType==="number"?target:null;const idle=!node2||node2===doc.body||node2===doc.documentElement;const modal=doc.querySelector("dialog[open][data-band-layer='dialog'], [role='dialog'][aria-modal='true']");if(modal)return modal.contains(frame)&&(idle||modal.contains(node2));return idle||frame.contains(node2)}var ALL="band-viewer-text-find";var CURRENT="band-viewer-text-find-current";function registry(){return typeof Highlight==="function"&&typeof CSS!=="undefined"&&CSS.highlights?CSS.highlights:null}function usePaint(){const mine=useRef({});const paint=useCallback((ranges,current)=>{const reg=registry();if(!reg)return;const all2=new Highlight(...ranges);reg.set(ALL,all2);mine.current.all=all2;if(current){const cur=new Highlight(current);reg.set(CURRENT,cur);mine.current.current=cur}else if(reg.get(CURRENT)===mine.current.current)reg.delete(CURRENT)},[]);const unpaint=useCallback(()=>{const reg=registry();if(!reg)return;if(mine.current.all&&reg.get(ALL)===mine.current.all)reg.delete(ALL);if(mine.current.current&&reg.get(CURRENT)===mine.current.current)reg.delete(CURRENT);mine.current={}},[]);return{paint,unpaint}}function reveal(article,range){if(typeof range.getBoundingClientRect!=="function")return;const r=range.getBoundingClientRect();const view=article.getBoundingClientRect();if(r.height===0&&r.width===0)return;if(r.top>=view.top+48&&r.bottom<=view.bottom-24)return;article.scrollTop+=r.top-view.top-view.height/2+r.height/2}var ROOTS=".band-viewer-text-content";function SearchIcon(){return jsxs2("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[jsx2("circle",{cx:"7",cy:"7",r:"4.5"}),jsx2("path",{d:"M10.5 10.5 14 14"})]})}function FindBar({article,query,onQuery,foldedText,expand,focusSeq,focused,onClose}){const[index2,setIndex]=useState(0);const[ranges,setRanges]=useState([]);const input=useRef(null);const{paint,unpaint}=usePaint();const{settled:term,imeProps}=useSettledText(query);useEffect(()=>{if(focused.current===focusSeq)return;focused.current=focusSeq;input.current?.focus();input.current?.select()},[focusSeq,focused]);useEffect(()=>{if(foldedText===void 0||term.trim()==="")return;if(fold(foldedText).includes(fold(term)))expand()},[foldedText,term,expand]);useEffect(()=>{const el=article.current;if(!el)return;const run=()=>{const next=findRanges([...el.querySelectorAll(ROOTS)],term);setRanges(next);setIndex(i=>i<next.length?i:0)};run();if(typeof MutationObserver==="undefined")return;let frame=0;const observer=new MutationObserver(records=>{const own2=r=>(r.target instanceof Element?r.target:r.target.parentElement)?.closest(".band-viewer-text-findlayer");if(records.every(own2))return;cancelAnimationFrame(frame);frame=requestAnimationFrame(run)});observer.observe(el,{childList:true,subtree:true,characterData:true});return()=>{cancelAnimationFrame(frame);observer.disconnect()}},[article,term]);useEffect(()=>{const current=ranges[index2]??null;paint(ranges,current);const el=article.current;if(el&&current)reveal(el,current)},[article,ranges,index2,paint]);useEffect(()=>unpaint,[unpaint]);const onEscape=withImeGuard(e=>{if(e.key!=="Escape")return;e.preventDefault();e.stopPropagation();onClose()});const total=ranges.length;const go=dir=>setIndex(i=>step(i,total,dir));const empty2=term.trim()==="";const status=empty2?"":total===0?"\u65E0\u7ED3\u679C":`${index2+1}/${total}`;return jsxs2("div",{className:"band-viewer-text-find",role:"search",onKeyDown:onEscape,children:[jsx2(SearchIcon,{}),jsx2("input",{ref:input,type:"text","aria-label":"\u5728\u6587\u4E2D\u67E5\u627E",placeholder:"\u5728\u6587\u4E2D\u67E5\u627E",value:query,onChange:e=>{onQuery(e.target.value);setIndex(0)},...imeProps,onKeyDown:withImeGuard(e=>{if(e.key==="Enter"){e.preventDefault();go(e.shiftKey?-1:1)}})}),jsx2("output",{className:total===0&&!empty2?"none":void 0,"aria-live":"polite",children:status}),jsx2("button",{type:"button",className:"band-viewer-text-find-btn","aria-label":"\u4E0A\u4E00\u5904",title:"\u4E0A\u4E00\u5904\uFF08Shift \u56DE\u8F66\uFF09",disabled:total===0,onClick:()=>go(-1),children:jsx2("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:jsx2("path",{d:"M4 10l4-4 4 4"})})}),jsx2("button",{type:"button",className:"band-viewer-text-find-btn","aria-label":"\u4E0B\u4E00\u5904",title:"\u4E0B\u4E00\u5904\uFF08\u56DE\u8F66\uFF09",disabled:total===0,onClick:()=>go(1),children:jsx2("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:jsx2("path",{d:"M4 6l4 4 4-4"})})}),jsx2("button",{type:"button",className:"band-viewer-text-find-btn","aria-label":"\u5173\u95ED\u67E5\u627E",title:"\u5173\u95ED\uFF08Esc\uFF09",onClick:onClose,children:jsx2("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:jsx2("path",{d:"M4.5 4.5l7 7M11.5 4.5l-7 7"})})})]})}function newRenderCtx(base){return{...base,footnoteOrder:[],footnoteCounts:new Map}}var SAFE_PROTOCOLS=new Set(["http:","https:","mailto:"]);function safeExternal(url){try{return SAFE_PROTOCOLS.has(new URL(url).protocol)?url:null}catch{return null}}function isAbsolute(url){return/^[a-z][a-z0-9+.-]*:/i.test(url)||url.startsWith("//")}function renderNode(node2,key,c){switch(node2.type){case"text":return jsx3("span",{...srcProps(node2),children:node2.value},key);case"paragraph":return jsx3("p",{...commentProps(node2),children:renderChildren(node2.children,c)},key);case"heading":return createElement(`h${node2.depth}`,{key,...commentProps(node2)},...renderChildren(node2.children,c));case"blockquote":return jsx3("blockquote",{children:renderChildren(node2.children,c)},key);case"thematicBreak":return jsx3("hr",{},key);case"break":return jsx3("br",{},key);case"strong":return jsx3("strong",{children:renderChildren(node2.children,c)},key);case"emphasis":return jsx3("em",{children:renderChildren(node2.children,c)},key);case"delete":return jsx3("del",{children:renderChildren(node2.children,c)},key);case"inlineCode":return jsx3("code",{...srcProps(node2),children:node2.value.replace(/\r?\n|\r/g," ")},key);case"html":return jsx3("span",{...srcProps(node2),children:node2.value},key);case"code":return jsx3(CodeBlock,{code:node2.value,lang:node2.lang??void 0,src:srcProps(node2),comment:commentProps(node2)},key);case"list":return renderList(node2,key,c);case"listItem":return renderListItem(node2,listItemLoose(node2),key,c);case"table":return renderTable(node2,key,c);case"link":return renderLink(node2.url,renderChildren(node2.children,{...c,inLink:true}),key,c);case"linkReference":{const d=c.definitions.get(node2.identifier.toUpperCase());if(!d)return jsxs3("span",{children:["[",renderChildren(node2.children,c),"]"]},key);return renderLink(d.url,renderChildren(node2.children,{...c,inLink:true}),key,c)}case"image":return jsx3(MarkdownImage,{url:node2.url,alt:node2.alt??"",c},`${key}:${node2.url}`);case"imageReference":{const d=c.definitions.get(node2.identifier.toUpperCase());if(!d)return`![${node2.alt??""}]`;return jsx3(MarkdownImage,{url:d.url,alt:node2.alt??"",c},`${key}:${d.url}`)}case"footnoteReference":return renderFootnoteReference(node2,key,c);default:return null}}function renderChildren(nodes,c){return nodes.map((n,i)=>renderNode(n,i,c))}function renderLink(url,children,key,c){const href=normalizeUri(url);const external=safeExternal(href);if(external){return jsx3("a",{className:"band-viewer-text-a",href:external,target:"_blank",rel:"noopener noreferrer",children},key)}const path2=isAbsolute(url)||url.startsWith("#")?null:c.resolveFile(url);if(path2&&c.openFile&&c.openable?.(path2)){const open=c.openFile;return jsx3("button",{type:"button",className:"band-viewer-text-a band-viewer-text-filelink",title:path2,onClick:()=>open(path2),children},key)}return jsx3("span",{children},key)}function MarkdownImage({url,alt,c}){const path2=isAbsolute(url)?null:c.resolveFile(url);const{fileUrl}=c;const[state,setState]=useState2(path2?"loading":"failed");useEffect2(()=>{if(!path2)return;let live=true;setState("loading");fileUrl(path2).then(src=>live&&setState({src}),()=>live&&setState("failed"));return()=>{live=false}},[path2,fileUrl]);const label=alt||url.split("/").pop()||"\u56FE\u7247";if(!path2){const external=safeExternal(normalizeUri(url));if(external&&!c.inLink){return jsxs3("a",{className:"band-viewer-text-a band-viewer-text-imglink",href:external,target:"_blank",rel:"noopener noreferrer",title:"\u5916\u94FE\u56FE\u7247\u4E0D\u81EA\u52A8\u52A0\u8F7D\uFF0C\u70B9\u5F00\u5728\u65B0\u6807\u7B7E\u9875\u67E5\u770B",children:["\u56FE\u7247\uFF1A",label]})}return jsxs3("span",{className:"band-viewer-text-imgalt",children:["\u56FE\u7247\uFF1A",label]})}if(state==="loading"){return jsxs3("span",{className:"band-viewer-text-imgalt","aria-busy":"true",children:["\u56FE\u7247\u52A0\u8F7D\u4E2D\uFF1A",label]})}if(state==="failed"){return jsxs3("span",{className:"band-viewer-text-imgalt",children:["\u56FE\u7247\u6253\u4E0D\u5F00\uFF1A",label]})}return jsx3("img",{className:"band-viewer-text-img",src:state.src,alt,loading:"lazy",decoding:"async",onError:()=>setState("failed")})}function listItemLoose(item){return item.spread??item.children.length>1}function renderList(node2,key,c){const loose=(node2.spread??false)||node2.children.some(listItemLoose);const task=node2.children.some(it=>typeof it.checked==="boolean");const props={key};if(typeof node2.start==="number"&&node2.start!==1)props.start=node2.start;if(task)props.className="band-viewer-text-tasks";return createElement(node2.ordered?"ol":"ul",props,...node2.children.map((it,i)=>renderListItem(it,loose,i,c)))}function renderListItem(item,loose,key,c){const parts=item.children.map((child,i)=>child.type==="paragraph"&&!loose?jsx3("span",{children:renderChildren(child.children,c)},i):renderNode(child,i,c));if(typeof item.checked!=="boolean")return jsx3("li",{...commentProps(item),children:parts},key);return jsxs3("li",{className:"band-viewer-text-task",...commentProps(item),children:[jsx3("input",{type:"checkbox",className:"checkbox",checked:item.checked,disabled:true,"aria-label":item.checked?"\u5DF2\u5B8C\u6210":"\u672A\u5B8C\u6210"}),jsx3("div",{children:parts})]},key)}function renderTable(node2,key,c){const align=node2.align??[];const[head,...body2]=node2.children;const cols=Math.max(align.length,head?.children.length??0);const row=(r,tag,k)=>{const cells=[];for(let i=0;i<cols;i++){const cell=r.children[i];const a=align[i];cells.push(createElement(tag,{key:i,style:a?{textAlign:a}:void 0},...cell?renderChildren(cell.children,c):[]))}return jsx3("tr",{...commentProps(r),children:cells},k)};return jsx3("div",{className:"band-viewer-text-table",tabIndex:0,children:jsxs3("table",{children:[head&&jsx3("thead",{children:row(head,"th",0)}),body2.length>0&&jsx3("tbody",{children:body2.map((r,i)=>row(r,"td",i+1))})]})},key)}function renderFootnoteReference(node2,key,c){const id=node2.identifier.toUpperCase();const seen=c.footnoteCounts.get(id);if(seen===void 0)c.footnoteOrder.push(id);c.footnoteCounts.set(id,(seen??0)+1);return jsx3("sup",{className:"band-viewer-text-fnref",children:c.footnoteOrder.indexOf(id)+1},key)}function FootnoteSection({c}){const items=[];for(let i=0;i<c.footnoteOrder.length;i++){const id=c.footnoteOrder[i];const d=c.footnotes.get(id);if(d)items.push(jsx3("li",{children:renderChildren(d.children,c)},id))}if(items.length===0)return null;return jsx3("section",{className:"band-viewer-text-footnotes","aria-label":"\u811A\u6CE8",children:jsx3("ol",{children:items})})}var COPIED_MS=1600;function CodeBlock({code:code2,lang,src,comment}){const[copied,setCopied]=useState2(false);const label=lang?/^[\w+#-]+/.exec(lang)?.[0]:void 0;const[lines,setLines]=useState2(null);useEffect2(()=>{let live=true;setLines(null);highlight(code2,label).then(l=>live&&setLines(l));return()=>{live=false}},[code2,label]);useEffect2(()=>{if(!copied)return;const t=setTimeout(()=>setCopied(false),COPIED_MS);return()=>clearTimeout(t)},[copied]);const copy=()=>{navigator.clipboard?.writeText(code2).then(()=>setCopied(true),()=>{})};return jsxs3("figure",{className:"band-viewer-text-code",children:[jsxs3("figcaption",{children:[jsx3("span",{children:label??"\u4EE3\u7801"}),jsx3("button",{type:"button",className:"btn sm ghost",onClick:copy,"aria-live":"polite","data-find-skip":"",children:copied?"\u5DF2\u590D\u5236":"\u590D\u5236"})]}),jsx3("pre",{...comment,children:jsx3("code",{...src,children:lines?jsx3(Highlighted,{lines}):code2})})]})}function Highlighted({lines}){return lines.map((line,i)=>jsxs3(Fragment2,{children:[i>0&&"\n",line.map((t,j)=>jsx3("span",{style:tokenStyle(t),children:t.text},j))]},i))}function MaterialText({ctx,source}){const[text4,setText]=useState3(null);const[error,setError]=useState3("");const[attempt,setAttempt]=useState3(0);useEffect3(()=>{const abort=new AbortController;setText(null);setError("");if(!source||materialViewer(source.attachment)!=="material-text"){setError("\u7F3A\u5C11\u7D20\u6750\u7248\u672C\u6765\u6E90\uFF0C\u8BF7\u5173\u95ED\u540E\u91CD\u65B0\u6253\u5F00");return}if(source.attachment.size>MATERIAL_TEXT_MAX_BYTES){setError("\u6587\u4EF6\u8F83\u5927\uFF0C\u7AD9\u5185\u6700\u591A\u67E5\u770B 2 MB \u6587\u672C\uFF0C\u8BF7\u4E0B\u8F7D\u539F\u6587\u4EF6");return}void readMaterialText(ctx,source,abort.signal).then(value=>{if(!abort.signal.aborted)setText(value)},error2=>{if(!abort.signal.aborted)setError(materialError(error2))});return()=>abort.abort()},[ctx,source,attempt]);if(error)return jsxs4("div",{className:"band-viewer-text",role:"alert",children:[jsx4("p",{children:error}),jsx4("button",{className:"btn sm",type:"button",onClick:()=>setAttempt(n=>n+1),children:"\u91CD\u8BD5"})]});if(text4===null||!source)return jsx4("output",{children:"\u6B63\u5728\u8BFB\u53D6\u7D20\u6750\u5185\u5BB9\u2026"});const active=/\.(html?|svg|xml|xhtml)$/i.test(source.attachment.name)||/html|xml|svg/i.test(source.attachment.mime);const markdown=!active&&(/\.(md|markdown)$/i.test(source.attachment.name)||source.attachment.mime==="text/markdown");const doc=parseDoc(text4,markdown?"markdown":"plain");const render=newRenderCtx({definitions:doc.definitions??new Map,footnotes:doc.footnotes??new Map,resolveFile:()=>null,fileUrl:async()=>{throw new Error("\u7D20\u6750\u4E0D\u80FD\u8BFB\u53D6\u5176\u4ED6\u6587\u4EF6")}});return jsx4("article",{className:`band-viewer-text ${doc.format==="plain"?"plain":""}`,tabIndex:0,"aria-label":"\u7D20\u6750\u6587\u6863",children:jsxs4("div",{className:"band-viewer-text-content",children:[doc.blocks.map((block,i)=>jsx4("section",{className:"band-viewer-text-block",children:renderNode(block.node,i,render)},block.start)),jsx4(FootnoteSection,{c:render})]})})}var src_default=definePlugin({surfaces:{"material-text":reactMount((ctx,props)=>jsx5(MaterialText,{ctx,source:props.owner.materialVersion})),text:reactMount((ctx,props,mount)=>jsx5(TextViewer,{ctx,mount,artifactId:props.owner.artifactId,compare:props.config.compare===true}))}});var TOOLBAR_SLOT="@kanyun-ai-infra/band-viewer-text/toolbar";var HEADING_SLOT="@kanyun-ai-infra/band-viewer-text/heading";function useNarrowText(){const[narrow,setNarrow]=useState4(()=>typeof window!=="undefined"&&window.matchMedia?.(NARROW_QUERY).matches===true);useEffect4(()=>{const media=window.matchMedia?.(NARROW_QUERY);if(!media)return;const changed=()=>setNarrow(media.matches);changed();media.addEventListener("change",changed);return()=>media.removeEventListener("change",changed)},[]);return narrow}function TextViewer(props){const[find,setFind]=useState4({open:false,seq:0,query:""});const focused=useRef2(0);if(props.compare)return jsx5(TextBody,{...props,find,setFind,focused});return jsxs5("div",{className:"band-viewer-text-frame",children:[jsx5(Toolbar,{ctx:props.ctx}),jsx5(TextBody,{...props,find,setFind,focused})]})}var FIND_KEY=typeof navigator!=="undefined"&&/Mac|iPhone|iPad/.test(navigator.platform)?"\u2318F":"Ctrl F";var REVEAL_TIMEOUT_MS=3e3;function TextBody({ctx,mount,artifactId,compare,find,setFind,focused}){const v=ctx.version.current();const paths=useMemo2(()=>v?textEntries(v):[],[v]);const[picked,setPicked]=useState4(null);const path2=picked&&paths.includes(picked)?picked:v?textEntry(v):null;const body2=useCtxData(ctx,async()=>{if(!v||!path2)return null;return{path:path2,text:new TextDecoder().decode(await ctx.version.readFile(path2))}},[v?.id,path2],"version.*");const threads=useCtxData(ctx,()=>ctx.threads.list({artifactId}),[artifactId],THREAD_EVENTS).data;const text4=body2.data&&body2.data.path===path2?body2.data.text:void 0;const format=v&&path2?dataFormat(v,path2):null;const doc=useMemo2(()=>typeof text4!=="string"||!v||!path2?null:format?{format:"plain",source:text4,blocks:[],definitions:new Map,footnotes:new Map}:parseDoc(text4,isMarkdown(v,path2)?"markdown":"plain"),[text4,v,path2,format]);const[showAll,setShowAll]=useState4(false);const fileUrl=useCallback2(p=>ctx.version.objectUrl(p),[ctx]);const count=doc?showAll?doc.blocks.length:initialBlockCount(doc):0;const place=useMemo2(()=>v&&path2?{versionId:v.id,path:path2,paths,legacyPath:legacyEntry(v)}:null,[v,path2,paths]);const shown=useRef2({state:"waiting"});shown.current=doc&&place?{state:"ready",doc,place,count}:{state:"waiting"};const role=useArtifactRole(ctx,artifactId);const narrow=useNarrowText();const canComment=!compare&&!format&&ctx.member.can("comment")&&role==="deliverable";const annotating=useSyncExternalStore(ctx.anchors.annotating.subscribe,ctx.anchors.annotating.get);const active=canComment&&annotating&&!narrow;const anchors=useAnchorHost(ctx,mount,shown,canComment&&!narrow,{showAll:()=>setShowAll(true),open:setPicked});const articleEl=useRef2(null);const articleRef=anchors.article;const setArticle=useCallback2(el=>{articleEl.current=el;articleRef(el)},[articleRef]);useEffect4(()=>{if(compare)return;const onKey=withImeGuard2(e=>{const el=articleEl.current;if(e.defaultPrevented||!el||!isFindKey(e)||!claimsFind(el,e.target))return;e.preventDefault();setFind(f=>({...f,open:true,seq:f.seq+1}))});document.addEventListener("keydown",onKey);return()=>document.removeEventListener("keydown",onKey)},[compare,setFind]);useEffect4(()=>{const el=articleEl.current;if(!el||!doc||!path2||!active)return;return bindCommentMode(el,doc.source,({start,end,text:text22})=>{const a=rangeAnchor(doc,path2,start,end,text22);ctx.threads.openAt(ctx.anchors.make("text-range",a.payload,a.snapshot))})},[ctx,doc,path2,active]);useEffect4(()=>{const el=articleEl.current;if(!el||!doc||!path2||!canComment||narrow)return;let reported=null;let key="";const offSelection=ctx.selection.subscribe(({source})=>{if(source!=="@kanyun-ai-infra/band-viewer-text"){reported=null;key=""}});const clear=()=>{const current=ctx.selection.get();if(reported&&current?.kind==="anchor"&&current.anchor.id===reported.id){ctx.selection.set(null)}reported=null;key=""};const update=()=>{const pick=readTextSelection(el,doc.source);if(!pick)return clear();const next=`${pick.start}:${pick.end}:${pick.text}`;if(next===key)return;const a=rangeAnchor(doc,path2,pick.start,pick.end,pick.text);reported=ctx.anchors.make("text-range",a.payload,a.snapshot);key=next;ctx.selection.set({kind:"anchor",anchor:reported})};el.ownerDocument.addEventListener("selectionchange",update);update();return()=>{el.ownerDocument.removeEventListener("selectionchange",update);clear();offSelection()}},[ctx,doc,path2,canComment,narrow]);const marks=useCompareLink(compare,artifactId,v,doc,articleEl);const expand=useCallback2(()=>setShowAll(true),[]);const headingCells=useSlotEntries(ctx,HEADING_SLOT);useShotScroll(ctx,compare?null:doc,count,anchors.blocks,expand);if(!v)return jsx5("div",{className:"band-viewer-text state",children:"\u6CA1\u6709\u53EF\u663E\u793A\u7684\u7248\u672C"});if(body2.error){return jsx5("div",{className:"band-viewer-text","data-band-guide-keep":"",children:jsx5(ErrorNote,{retry:body2.reload,children:body2.error})})}if(!path2||body2.data===null){return jsx5("div",{className:"band-viewer-text state",children:"\u8FD9\u4E2A\u7248\u672C\u91CC\u6CA1\u6709\u6587\u672C\u6761\u76EE"})}if(!doc){return jsx5("div",{className:"band-viewer-text state","aria-busy":"true",children:"\u52A0\u8F7D\u4E2D\u2026"})}const comment=i=>{const a=blockAnchor(doc,i,path2);ctx.threads.openAt(ctx.anchors.make("text-range",a.payload,a.snapshot))};const commentRange=(start,end,text22)=>{const a=rangeAnchor(doc,path2,start,end,text22);ctx.threads.openAt(ctx.anchors.make("text-range",a.payload,a.snapshot))};const rc=newRenderCtx({definitions:doc.definitions,footnotes:doc.footnotes,resolveFile:href=>{const p=resolvePath(path2,href);return p&&v.entries.some(e=>e.path===p)?p:null},openable:p=>paths.includes(p),openFile:setPicked,fileUrl});const hidden=doc.blocks.length-count;let hiddenThreads=0;if(hidden>0&&place){for(const t of threads??[]){if(t.status==="resolved")continue;const p=placeOf(t.anchor,doc,place);if(p.at==="block"&&p.block>=count)hiddenThreads++}}return jsxs5("article",{ref:setArticle,tabIndex:-1,className:`band-viewer-text ${doc.format==="plain"?"plain":""}`,"data-text-commenting":active?"true":void 0,"aria-label":"\u6587\u672C",children:[!compare&&jsx5("div",{className:"band-viewer-text-findlayer",children:find.open?jsx5(FindBar,{article:articleEl,query:find.query,onQuery:query=>setFind(f=>({...f,query})),foldedText:hidden>0&&text4!==void 0?text4.slice(doc.blocks[count]?.start??0):void 0,expand,focusSeq:find.seq,focused,onClose:()=>{setFind(f=>({...f,open:false}));articleEl.current?.focus()}}):jsx5("button",{type:"button",className:"band-viewer-text-findbtn","aria-label":"\u5728\u6587\u4E2D\u67E5\u627E",title:`\u5728\u6587\u4E2D\u67E5\u627E\uFF08${FIND_KEY}\uFF09`,onClick:()=>setFind(f=>({...f,open:true,seq:f.seq+1})),children:jsx5(SearchIcon,{})})}),paths.length>1&&jsx5("div",{className:"tabs plain band-viewer-text-files",role:"tablist","aria-label":"\u6587\u4EF6",children:paths.map(p=>jsx5("button",{type:"button",role:"tab","aria-selected":p===path2,title:p,onClick:()=>setPicked(p),children:p.split("/").pop()},p))}),format?jsx5(DataBody,{text:doc.source,format}):doc.blocks.length===0&&jsx5("p",{className:"band-viewer-text-empty",children:"\u8FD9\u4EFD\u6587\u4EF6\u662F\u7A7A\u7684"}),doc.blocks.slice(0,count).map((b,i)=>jsxs5("div",{className:"band-viewer-text-block",...marks.get(i)?{"data-compare":marks.get(i)}:{},children:[marks.get(i)&&jsx5("span",{className:"sr-only",children:marks.get(i)==="added"?"\u65B0\u589E\u6216\u6539\u52A8":"\u5DF2\u5220\u6539"}),canComment&&(narrow||active)&&jsx5("button",{type:"button",className:"band-viewer-text-add","aria-label":`\u5BF9\u7B2C ${i+1} \u6BB5\u8BC4\u8BBA`,title:"\u5BF9\u8FD9\u4E00\u6BB5\u8BC4\u8BBA",onClick:()=>comment(i),children:jsx5(PlusIcon,{})}),jsx5("div",{className:"band-viewer-text-content",ref:anchors.block(i),children:renderNode(b.node,i,rc)}),b.headingId&&!compare&&headingCells.length>0&&jsx5("div",{className:"band-viewer-text-aside",children:headingCells.map(e=>jsx5(Mount,{className:"band-viewer-text-aside-item","data-band-slot":HEADING_SLOT,"data-band-item":e.key,mount:el=>ctx.slots.mount(el,HEADING_SLOT,{key:e.key,version:v,owner:{artifactId,versionId:v.id,path:path2,id:b.headingId,text:b.text}}),deps:[ctx,e.key,artifactId,v.id,path2,b.headingId,b.text]},e.key))})]},`${b.start}:${b.end}`)),active&&jsx5(SelectionComment,{article:articleEl,blocks:anchors.blocks,doc,count,onComment:commentRange}),jsx5(AlignAdds,{article:articleEl,enabled:canComment&&(narrow||active)}),hidden>0?jsxs5("div",{className:"band-viewer-text-more",children:["\u6587\u4EF6\u8F83\u5927\uFF0C\u5148\u663E\u793A\u524D ",count," \u6BB5\uFF0C\u8FD8\u6709 ",hidden," \u6BB5",hiddenThreads>0?`\uFF08\u5176\u4E2D\u6709 ${hiddenThreads} \u6761\u610F\u89C1\uFF09`:"","\u3002",jsx5("button",{type:"button",className:"btn sm",onClick:()=>setShowAll(true),children:"\u663E\u793A\u5168\u90E8"})]}):jsx5(FootnoteSection,{c:rc})]})}function useShotScroll(ctx,doc,count,blocks,showAll){useEffect4(()=>{if(!doc)return;const go=sel=>{if(sel?.kind!=="entity"||sel.entityType!=="shot")return;const i=doc.blocks.findIndex(b=>b.headingId===sel.id);if(i<0)return;if(i>=count)return showAll();const el=blocks.current.get(i);if(!el)return;const still=window.matchMedia?.("(prefers-reduced-motion: reduce)").matches;scrollIntoPanel(el,{block:"start",behavior:still?"auto":"smooth"})};go(ctx.selection.get());return ctx.selection.subscribe(({value})=>go(value))},[ctx,doc,count,blocks,showAll])}function useCompareLink(compare,artifactId,v,doc,articleEl){const[tick,setTick]=useState4(0);const texts=useMemo2(()=>doc?doc.blocks.map(b=>b.text):null,[doc]);const state=useRef2({texts,tick:()=>{}});state.current.texts=texts;state.current.tick=()=>setTick(n=>n+1);const link=useRef2(null);const loaded=texts!==null;const versionId=v?.id;const createdAt=v?.createdAt;useEffect4(()=>{if(!compare||!loaded||versionId===void 0||createdAt===void 0)return;let echo=null;const el=()=>articleEl.current;const l=joinTextCompare(artifactId,{versionId,createdAt,blocks:()=>state.current.texts,scrollTo(ratio){const a2=el();if(!a2)return;const target=ratio*Math.max(0,a2.scrollHeight-a2.clientHeight);if(Math.abs(a2.scrollTop-target)<1)return;a2.scrollTop=target;echo=a2.scrollTop},changed:()=>state.current.tick()});link.current=l;state.current.tick();const a=el();const onScroll=()=>{const t=el();if(!t)return;if(echo!==null){const mine=echo;echo=null;if(Math.abs(t.scrollTop-mine)<1)return}const room=t.scrollHeight-t.clientHeight;l.scroll(room>0?t.scrollTop/room:0)};a?.addEventListener("scroll",onScroll,{passive:true});return()=>{a?.removeEventListener("scroll",onScroll);link.current=null;l.leave()}},[compare,artifactId,versionId,createdAt,articleEl,loaded]);useEffect4(()=>{if(texts)link.current?.notify()},[texts]);return useMemo2(()=>{void tick;if(!compare||!v||!link.current)return new Map;return marksAgainst({versionId:v.id,createdAt:v.createdAt},texts,link.current.others()[0])},[compare,v,texts,tick])}function useAnchorHost(ctx,mount,shown,annotate,act){const blocks=useRef2(new Map);const article=useRef2(null);const listeners=useRef2(new Set);const pending=useRef2(null);const actions=useRef2(act);actions.current=act;const notify=useCallback2(()=>{for(const fn of[...listeners.current])fn()},[]);const locate=useCallback2(anchor=>{const s=shown.current;if(s.state==="waiting")return{at:"pending"};const p=placeOf(anchor,s.doc,s.place);if(p.at!=="block")return p.at==="none"?{at:"none"}:{at:"elsewhere"};const first=p.block<s.count?blocks.current.get(p.block):void 0;if(!first)return{at:"elsewhere"};const els=[];for(let i=p.block;i<s.count&&(s.doc.blocks[i]?.start??p.end)<p.end;i++){const el=blocks.current.get(i);if(el)els.push(el)}const view=article.current?.getBoundingClientRect();const clip=view&&view.height>0;const visible=b=>{if(!clip)return b;const top=Math.max(b.top,view.top);const bottom=Math.min(b.bottom,view.bottom);return bottom>top?{...b,top,bottom}:null};let boxes=sourceToBoxes(els,s.doc.source,p.start,p.end);if(boxes.length===0){boxes=els.map(el=>{const r=el.getBoundingClientRect();return{left:r.left,top:r.top,right:r.right,bottom:r.bottom}})}const shownBoxes=boxes.map(visible).filter(b=>b!==null);const lead=shownBoxes[0];if(!lead)return{at:"elsewhere"};const m=mount.getBoundingClientRect();const rel=b=>({x:b.left-m.left,y:b.top-m.top,width:b.right-b.left,height:b.bottom-b.top});const corner={x:Math.min(first.getBoundingClientRect().right,m.right-1)-m.left,y:Math.max(lead.top,m.top+1)-m.top};const rects=[{...corner,width:0,height:0},...shownBoxes.map(rel)];return p.status==="moved"||p.status==="changed"?{at:"rects",rects,status:p.status}:{at:"rects",rects}},[mount,shown]);const tryReveal=useCallback2(()=>{const job=pending.current;const s=shown.current;if(!job||s.state==="waiting")return;const finish=ok3=>{pending.current=null;job.done(ok3)};const p=placeOf(job.anchor,s.doc,s.place);if(p.at==="none")return finish(false);if(p.at==="elsewhere"){if(job.switched)return finish(false);job.switched=true;actions.current.open(p.path);return}if(p.block>=s.count)return actions.current.showAll();const el=blocks.current.get(p.block);if(!el)return;const still=window.matchMedia?.("(prefers-reduced-motion: reduce)").matches;scrollIntoPanel(el,{behavior:still?"auto":"smooth"});finish(true)},[shown]);useEffect4(()=>{const off=ctx.anchors.host({kinds:["text-range"],annotate,locate,reveal:anchor=>new Promise(resolve=>{pending.current?.done(false);const timer=setTimeout(()=>{if(pending.current?.anchor===anchor){pending.current=null;resolve(false)}},REVEAL_TIMEOUT_MS);pending.current={anchor,switched:false,done:ok3=>{clearTimeout(timer);resolve(ok3)}};tryReveal()}),onLayout:fn=>{listeners.current.add(fn);return()=>listeners.current.delete(fn)}});void document.fonts?.ready.then(notify);return()=>{off();pending.current?.done(false);pending.current=null}},[ctx,locate,tryReveal,notify,annotate]);useEffect4(()=>{tryReveal();notify()});const observer=useRef2(null);const articleRef=useCallback2(el=>{if(article.current){article.current.removeEventListener("scroll",notify);article.current.removeEventListener("load",notify,true)}observer.current?.disconnect();article.current=el;if(!el)return;el.addEventListener("scroll",notify,{passive:true});el.addEventListener("load",notify,true);if(typeof ResizeObserver!=="undefined"){observer.current=new ResizeObserver(notify);observer.current.observe(el)}},[notify]);const block=useCallback2(i=>el=>{if(el)blocks.current.set(i,el);else blocks.current.delete(i)},[]);return{article:articleRef,block,blocks}}var COMMENT_KEY=FIND_KEY==="\u2318F"?"\u2318\u2325M":"Ctrl Alt M";function isCommentKey(e){return(e.metaKey||e.ctrlKey)&&e.altKey&&!e.shiftKey&&e.code==="KeyM"}var BUBBLE_H=30;function SelectionComment({article,blocks,doc,count,onComment}){const[picked,setPicked]=useState4(null);const[judged,setJudged]=useState4(null);const[tick,setTick]=useState4(0);const bubbleRef=useRef2(null);const commentRef=useRef2(onComment);commentRef.current=onComment;const dismissed=useRef2(null);const read=useCallback2(()=>{const el=article.current;const sel=el?.ownerDocument.getSelection();if(!el||!sel||sel.rangeCount===0||sel.isCollapsed)return null;const range=sel.getRangeAt(0);if(!el.contains(range.startContainer)&&!el.contains(range.endContainer))return null;const roots=[];for(let i=0;i<count;i++){const b=blocks.current.get(i);if(b)roots.push(b)}const src=selectionToSource(range,roots,doc.source);if(!src||!src.text.trim())return null;let last=0;for(let i=0;i<count&&(doc.blocks[i]?.start??src.end)<src.end;i++)last=i;const host=blocks.current.get(last)?.parentElement;const lines=[...range.getClientRects()].filter(r=>r.width>0&&r.height>0);const first=lines[0];const end=lines.at(-1);if(!host||!first||!end)return null;const box=host.getBoundingClientRect();const view=el.getBoundingClientRect();const roomAbove=view.height===0||first.top-BUBBLE_H-8>=view.top;const below2=window.matchMedia?.("(pointer: coarse)").matches===true||!roomAbove;const half=48;const centerOf=line=>Math.max(half,Math.min((line.left+line.right)/2-box.left,box.width-half));return{...src,host,aboveLeft:centerOf(first),belowLeft:centerOf(end),aboveTop:first.top-box.top-8,belowTop:end.bottom-box.top+8,below:below2}},[article,blocks,doc,count]);useEffect4(()=>{const el=article.current;if(!el)return;const owner=el.ownerDocument;let pressing=false;let frame=0;const update=()=>{if(frame)return;frame=requestAnimationFrame(()=>{frame=0;if(pressing)return;const p=read();if(!p)dismissed.current=null;setPicked(p&&dismissed.current!==`${p.start}:${p.end}`?p:null)})};const onDown=e=>{if(e.target?.closest?.("[data-selection-comment]"))return;pressing=true;dismissed.current=null;setPicked(null);setJudged(null)};const onUp=()=>{if(!pressing)return;pressing=false;update()};const onSelectKey=withImeGuard2(e=>{if(e.defaultPrevented)return;const bubble=el.querySelector("[data-selection-comment]");const at=owner.activeElement;if(e.key==="Tab"&&!e.shiftKey&&bubble&&at!==bubble&&el.contains(at)){e.preventDefault();bubble.focus();return}if(isCommentKey(e)&&!typing(e.target)){const p=read();if(!p)return;e.preventDefault();dismissed.current=`${p.start}:${p.end}`;setPicked(null);setJudged(null);commentRef.current(p.start,p.end,p.text)}});owner.addEventListener("selectionchange",update);el.addEventListener("pointerdown",onDown,true);owner.addEventListener("pointerup",onUp,true);owner.addEventListener("pointercancel",onUp,true);owner.addEventListener("keydown",onSelectKey);window.addEventListener("resize",update);update();return()=>{if(frame)cancelAnimationFrame(frame);owner.removeEventListener("selectionchange",update);el.removeEventListener("pointerdown",onDown,true);owner.removeEventListener("pointerup",onUp,true);owner.removeEventListener("pointercancel",onUp,true);owner.removeEventListener("keydown",onSelectKey);window.removeEventListener("resize",update)}},[article,read]);const label=picked?picked.text.replace(/\s+/g," ").trim():"";const short=label.length>20?`${label.slice(0,20)}\u2026`:label;const key=picked?`${picked.start}:${picked.end}`:null;const now=judged!==null&&judged.key===key&&judged.tick===tick?judged:null;const below=picked?picked.below||now?.side==="below":false;const phase=now?.phase??"design";useLayoutEffect(()=>{if(!picked||!key)return;const el=bubbleRef.current;const doc2=picked.host.ownerDocument;const point3=doc2.elementFromPoint?.bind(doc2);const view=doc2.defaultView;if(!el||!point3||!view)return;const rect=el.getBoundingClientRect();if(rect.width===0||rect.height===0)return;const host=picked.host.getBoundingClientRect();const frame=article.current?.getBoundingClientRect();const top=frame&&frame.height>0?frame.top:0;const bottom=frame&&frame.height>0?frame.bottom:view.innerHeight;const fitsView=y=>y>=top+8&&y+rect.height<=bottom-8;const hostTop=host.top;const otherFits=fitsView(below?hostTop+picked.aboveTop-rect.height:hostTop+picked.belowTop);const hit=point3(rect.left+rect.width/2,rect.top+rect.height/2);const occluded=hit!==null&&!el.contains(hit);const next=nextBubble({side:below?"below":"above",baseBelow:picked.below,occluded,otherFits,phase});if(next)setJudged({key,tick,side:next.side,phase:next.phase})},[article,picked,key,below,phase,tick]);useEffect4(()=>{if(!picked)return;let raf=0;let timer=0;const bump=()=>{if(raf||timer)return;raf=requestAnimationFrame(()=>{raf=0;timer=window.setTimeout(()=>{timer=0;setTick(t=>t+1);raf=requestAnimationFrame(()=>{raf=0;setTick(t=>t+1)})},0)})};window.addEventListener("scroll",bump,{passive:true,capture:true});window.addEventListener("resize",bump);return()=>{if(raf)cancelAnimationFrame(raf);if(timer)clearTimeout(timer);window.removeEventListener("scroll",bump,true);window.removeEventListener("resize",bump)}},[picked]);return jsxs5(Fragment3,{children:[jsx5("span",{className:"sr-only","aria-live":"polite",children:picked?`\u5DF2\u9009\u4E2D\u300C${short}\u300D\uFF0C\u6309 ${COMMENT_KEY} \u6216 Tab \u5230\u300C\u8BC4\u8BBA\u300D`:""}),picked&&createPortal(jsxs5("button",{ref:bubbleRef,type:"button",className:"btn sm primary band-viewer-text-bubble","data-selection-comment":"","data-below":below?"":void 0,style:{left:below?picked.belowLeft:picked.aboveLeft,top:below?picked.belowTop:picked.aboveTop},"aria-label":`\u5BF9\u9009\u4E2D\u7684\u300C${short}\u300D\u8BC4\u8BBA`,"aria-keyshortcuts":COMMENT_KEY==="\u2318\u2325M"?"Meta+Alt+M":"Control+Alt+M",title:`\u8BC4\u8BBA\uFF08${COMMENT_KEY}\uFF09`,onMouseDown:e=>e.preventDefault(),onKeyDown:withImeGuard2(e=>{if(e.key!=="Escape")return;e.preventDefault();dismissed.current=`${picked.start}:${picked.end}`;setPicked(null);setJudged(null);const sel=document.getSelection();const keep=sel&&sel.rangeCount>0?sel.getRangeAt(0).cloneRange():null;article.current?.focus({preventScroll:true});if(sel&&keep){sel.removeAllRanges();sel.addRange(keep)}}),onClick:()=>{dismissed.current=`${picked.start}:${picked.end}`;setPicked(null);setJudged(null);onComment(picked.start,picked.end,picked.text)},children:[jsx5(CommentIcon,{}),"\u8BC4\u8BBA"]}),picked.host)]})}function typing(target){if(!(target instanceof HTMLElement))return false;return target.isContentEditable||target instanceof HTMLInputElement||target instanceof HTMLTextAreaElement||target instanceof HTMLSelectElement}var ADD_SIZE=22;function AlignAdds({article,enabled}){useLayoutEffect(()=>{if(enabled&&article.current)alignAdds(article.current)});useEffect4(()=>{const el=article.current;if(!enabled||!el)return;const run=()=>alignAdds(el);const observer=typeof ResizeObserver==="undefined"?null:new ResizeObserver(run);observer?.observe(el);void document.fonts?.ready.then(run);return()=>observer?.disconnect()},[article,enabled]);return null}function alignAdds(article){const jobs=[];for(const add of article.querySelectorAll(".band-viewer-text-add")){const block=add.parentElement;const content3=add.nextElementSibling;if(!block||!content3)continue;const line=firstLine(content3);jobs.push([add,line?line.top+line.height/2-block.getBoundingClientRect().top:null])}for(const[add,mid]of jobs){add.style.top=mid===null?"":`${Math.round((mid-ADD_SIZE/2)*2)/2}px`}}function firstLine(content3){const doc=content3.ownerDocument;const walker=doc.createTreeWalker(content3,4);for(let n=walker.nextNode();n;n=walker.nextNode()){const t=n;const at=t.data.search(/\S/);if(at<0)continue;const r=doc.createRange();r.setStart(t,at);r.setEnd(t,at+1);const box2=r.getClientRects?.()[0];if(box2&&box2.height>0)return{top:box2.top,height:box2.height}}const box=content3.firstElementChild?.getBoundingClientRect();if(!box||box.height===0)return null;return{top:box.top,height:Math.min(box.height,ADD_SIZE)}}function PlusIcon(){return jsx5("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:jsx5("path",{d:"M8 3.5v9M3.5 8h9"})})}function CommentIcon(){return jsx5("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:jsx5("path",{d:"M3 3.5h10a1 1 0 0 1 1 1v6a1 1 0 0 1-1 1H7l-3 2.5v-2.5H3a1 1 0 0 1-1-1v-6a1 1 0 0 1 1-1z"})})}function Toolbar({ctx}){return jsx5(Mount,{className:"band-viewer-text-toolbar",mount:el=>{el.setAttribute("role","toolbar");el.setAttribute("aria-label","\u6587\u672C\u5DE5\u5177");return mountDockButtons(ctx,el,TOOLBAR_SLOT,"btn sm ghost")},deps:[ctx]})}export{HEADING_SLOT,TOOLBAR_SLOT,blockAnchor,src_default as default,parseDoc,placeOf,resolvePath,textEntries,textEntry};