=0&&a[f]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+f+'".')}}u.setExtensions(s),u.setPlugins(a),u.parse(r,i)}parseAsync(e,n){const r=this;return new Promise(function(i,o){r.parse(e,n,i,o)})}}function rf(){let t={};return{get:function(e){return t[e]},add:function(e,n){t[e]=n},remove:function(e){delete t[e]},removeAll:function(){t={}}}}const he={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_DISPERSION:"KHR_materials_dispersion",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_MATERIALS_BUMP:"EXT_materials_bump",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};class of{constructor(e){this.parser=e,this.name=he.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const e=this.parser,n=this.parser.json.nodes||[];for(let r=0,i=n.length;r=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return n.loadTextureImage(e,o.source,s)}}class vf{constructor(e){this.parser=e,this.name=he.EXT_TEXTURE_WEBP,this.isSupported=null}loadTexture(e){const n=this.name,r=this.parser,i=r.json,o=i.textures[e];if(!o.extensions||!o.extensions[n])return null;const s=o.extensions[n],a=i.images[s.source];let l=r.textureLoader;if(a.uri){const u=r.options.manager.getHandler(a.uri);u!==null&&(l=u)}return this.detectSupport().then(function(u){if(u)return r.loadTextureImage(e,s.source,l);if(i.extensionsRequired&&i.extensionsRequired.indexOf(n)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return r.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){const n=new Image;n.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",n.onload=n.onerror=function(){e(n.height===1)}})),this.isSupported}}class bf{constructor(e){this.parser=e,this.name=he.EXT_TEXTURE_AVIF,this.isSupported=null}loadTexture(e){const n=this.name,r=this.parser,i=r.json,o=i.textures[e];if(!o.extensions||!o.extensions[n])return null;const s=o.extensions[n],a=i.images[s.source];let l=r.textureLoader;if(a.uri){const u=r.options.manager.getHandler(a.uri);u!==null&&(l=u)}return this.detectSupport().then(function(u){if(u)return r.loadTextureImage(e,s.source,l);if(i.extensionsRequired&&i.extensionsRequired.indexOf(n)>=0)throw new Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");return r.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){const n=new Image;n.src="data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI=",n.onload=n.onerror=function(){e(n.height===1)}})),this.isSupported}}class wf{constructor(e){this.name=he.EXT_MESHOPT_COMPRESSION,this.parser=e}loadBufferView(e){const n=this.parser.json,r=n.bufferViews[e];if(r.extensions&&r.extensions[this.name]){const i=r.extensions[this.name],o=this.parser.getDependency("buffer",i.buffer),s=this.parser.options.meshoptDecoder;if(!s||!s.supported){if(n.extensionsRequired&&n.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return o.then(function(a){const l=i.byteOffset||0,u=i.byteLength||0,c=i.count,f=i.byteStride,p=new Uint8Array(a,l,u);return s.decodeGltfBufferAsync?s.decodeGltfBufferAsync(c,f,p,i.mode,i.filter).then(function(d){return d.buffer}):s.ready.then(function(){const d=new ArrayBuffer(c*f);return s.decodeGltfBuffer(new Uint8Array(d),c,f,p,i.mode,i.filter),d})})}else return null}}class Tf{constructor(e){this.name=he.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){const n=this.parser.json,r=n.nodes[e];if(!r.extensions||!r.extensions[this.name]||r.mesh===void 0)return null;const i=n.meshes[r.mesh];for(const u of i.primitives)if(u.mode!==nt.TRIANGLES&&u.mode!==nt.TRIANGLE_STRIP&&u.mode!==nt.TRIANGLE_FAN&&u.mode!==void 0)return null;const s=r.extensions[this.name].attributes,a=[],l={};for(const u in s)a.push(this.parser.getDependency("accessor",s[u]).then(c=>(l[u]=c,l[u])));return a.length<1?null:(a.push(this.parser.createNodeMesh(e)),Promise.all(a).then(u=>{const c=u.pop(),f=c.isGroup?c.children:[c],p=u[0].count,d=[];for(const b of f){const x=new xt,v=new se,T=new zn,I=new se(1,1,1),A=new fl(b.geometry,b.material,p);for(let C=0;C0||t.search(/^data\:image\/jpeg/)===0?"image/jpeg":t.search(/\.webp($|\?)/i)>0||t.search(/^data\:image\/webp/)===0?"image/webp":t.search(/\.ktx2($|\?)/i)>0||t.search(/^data\:image\/ktx2/)===0?"image/ktx2":"image/png"}const Df=new xt;class Of{constructor(e={},n={}){this.json=e,this.extensions={},this.plugins={},this.options=n,this.cache=new rf,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let r=!1,i=-1,o=!1,s=-1;if(typeof navigator<"u"){const a=navigator.userAgent;r=/^((?!chrome|android).)*safari/i.test(a)===!0;const l=a.match(/Version\/(\d+)/);i=r&&l?parseInt(l[1],10):-1,o=a.indexOf("Firefox")>-1,s=o?a.match(/Firefox\/([0-9]+)\./)[1]:-1}typeof createImageBitmap>"u"||r&&i<17||o&&s<98?this.textureLoader=new pl(this.options.manager):this.textureLoader=new hl(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new us(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),this.options.crossOrigin==="use-credentials"&&this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,n){const r=this,i=this.json,o=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(s){return s._markDefs&&s._markDefs()}),Promise.all(this._invokeAll(function(s){return s.beforeRoot&&s.beforeRoot()})).then(function(){return Promise.all([r.getDependencies("scene"),r.getDependencies("animation"),r.getDependencies("camera")])}).then(function(s){const a={scene:s[0][i.scene||0],scenes:s[0],animations:s[1],cameras:s[2],asset:i.asset,parser:r,userData:{}};return Rt(o,a,i),gt(a,i),Promise.all(r._invokeAll(function(l){return l.afterRoot&&l.afterRoot(a)})).then(function(){for(const l of a.scenes)l.updateMatrixWorld();e(a)})}).catch(n)}_markDefs(){const e=this.json.nodes||[],n=this.json.skins||[],r=this.json.meshes||[];for(let i=0,o=n.length;i{const l=this.associations.get(s);l!=null&&this.associations.set(a,l);for(const[u,c]of s.children.entries())o(c,a.children[u])};return o(r,i),i.name+="_instance_"+e.uses[n]++,i}_invokeOne(e){const n=Object.values(this.plugins);n.push(this);for(let r=0;r=2&&v.setY(g,h[S*l+1]),l>=3&&v.setZ(g,h[S*l+2]),l>=4&&v.setW(g,h[S*l+3]),l>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}v.normalized=b}return v})}loadTexture(e){const n=this.json,r=this.options,o=n.textures[e].source,s=n.images[o];let a=this.textureLoader;if(s.uri){const l=r.manager.getHandler(s.uri);l!==null&&(a=l)}return this.loadTextureImage(e,o,a)}loadTextureImage(e,n,r){const i=this,o=this.json,s=o.textures[e],a=o.images[n],l=(a.uri||a.bufferView)+":"+s.sampler;if(this.textureCache[l])return this.textureCache[l];const u=this.loadImageSource(n,r).then(function(c){c.flipY=!1,c.name=s.name||a.name||"",c.name===""&&typeof a.uri=="string"&&a.uri.startsWith("data:image/")===!1&&(c.name=a.uri);const p=(o.samplers||{})[s.sampler]||{};return c.magFilter=fo[p.magFilter]||Bn,c.minFilter=fo[p.minFilter]||oi,c.wrapS=po[p.wrapS]||Un,c.wrapT=po[p.wrapT]||Un,c.generateMipmaps=!c.isCompressedTexture&&c.minFilter!==Lt&&c.minFilter!==Bn,i.associations.set(c,{textures:e}),c}).catch(function(){return null});return this.textureCache[l]=u,u}loadImageSource(e,n){const r=this,i=this.json,o=this.options;if(this.sourceCache[e]!==void 0)return this.sourceCache[e].then(f=>f.clone());const s=i.images[e],a=self.URL||self.webkitURL;let l=s.uri||"",u=!1;if(s.bufferView!==void 0)l=r.getDependency("bufferView",s.bufferView).then(function(f){u=!0;const p=new Blob([f],{type:s.mimeType});return l=a.createObjectURL(p),l});else if(s.uri===void 0)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");const c=Promise.resolve(l).then(function(f){return new Promise(function(p,d){let b=p;n.isImageBitmapLoader===!0&&(b=function(x){const v=new Fn(x);v.needsUpdate=!0,p(v)}),n.load(cn.resolveURL(f,o.path),b,void 0,d)})}).then(function(f){return u===!0&&a.revokeObjectURL(l),gt(f,s),f.userData.mimeType=s.mimeType||Pf(s.uri),f}).catch(function(f){throw console.error("THREE.GLTFLoader: Couldn't load texture",l),f});return this.sourceCache[e]=c,c}assignTexture(e,n,r,i){const o=this;return this.getDependency("texture",r.index).then(function(s){if(!s)return null;if(r.texCoord!==void 0&&r.texCoord>0&&(s=s.clone(),s.channel=r.texCoord),o.extensions[he.KHR_TEXTURE_TRANSFORM]){const a=r.extensions!==void 0?r.extensions[he.KHR_TEXTURE_TRANSFORM]:void 0;if(a){const l=o.associations.get(s);s=o.extensions[he.KHR_TEXTURE_TRANSFORM].extendTexture(s,a),o.associations.set(s,l)}}return i!==void 0&&(s.colorSpace=i),e[n]=s,s})}assignFinalMaterial(e){const n=e.geometry;let r=e.material;const i=n.attributes.tangent===void 0,o=n.attributes.color!==void 0,s=n.attributes.normal===void 0;if(e.isPoints){const a="PointsMaterial:"+r.uuid;let l=this.cache.get(a);l||(l=new ml,nr.prototype.copy.call(l,r),l.color.copy(r.color),l.map=r.map,l.sizeAttenuation=!1,this.cache.add(a,l)),r=l}else if(e.isLine){const a="LineBasicMaterial:"+r.uuid;let l=this.cache.get(a);l||(l=new gl,nr.prototype.copy.call(l,r),l.color.copy(r.color),l.map=r.map,this.cache.add(a,l)),r=l}if(i||o||s){let a="ClonedMaterial:"+r.uuid+":";i&&(a+="derivative-tangents:"),o&&(a+="vertex-colors:"),s&&(a+="flat-shading:");let l=this.cache.get(a);l||(l=r.clone(),o&&(l.vertexColors=!0),s&&(l.flatShading=!0),i&&(l.normalScale&&(l.normalScale.y*=-1),l.clearcoatNormalScale&&(l.clearcoatNormalScale.y*=-1)),this.cache.add(a,l),this.associations.set(l,this.associations.get(r))),r=l}e.material=r}getMaterialType(){return cs}loadMaterial(e){const n=this,r=this.json,i=this.extensions,o=r.materials[e];let s;const a={},l=o.extensions||{},u=[];if(l[he.KHR_MATERIALS_UNLIT]){const f=i[he.KHR_MATERIALS_UNLIT];s=f.getMaterialType(),u.push(f.extendParams(a,o,n))}else{const f=o.pbrMetallicRoughness||{};if(a.color=new Fe(1,1,1),a.opacity=1,Array.isArray(f.baseColorFactor)){const p=f.baseColorFactor;a.color.setRGB(p[0],p[1],p[2],vt),a.opacity=p[3]}f.baseColorTexture!==void 0&&u.push(n.assignTexture(a,"map",f.baseColorTexture,mn)),a.metalness=f.metallicFactor!==void 0?f.metallicFactor:1,a.roughness=f.roughnessFactor!==void 0?f.roughnessFactor:1,f.metallicRoughnessTexture!==void 0&&(u.push(n.assignTexture(a,"metalnessMap",f.metallicRoughnessTexture)),u.push(n.assignTexture(a,"roughnessMap",f.metallicRoughnessTexture))),s=this._invokeOne(function(p){return p.getMaterialType&&p.getMaterialType(e)}),u.push(Promise.all(this._invokeAll(function(p){return p.extendMaterialParams&&p.extendMaterialParams(e,a)})))}o.doubleSided===!0&&(a.side=Yn);const c=o.alphaMode||xr.OPAQUE;if(c===xr.BLEND?(a.transparent=!0,a.depthWrite=!1):(a.transparent=!1,c===xr.MASK&&(a.alphaTest=o.alphaCutoff!==void 0?o.alphaCutoff:.5)),o.normalTexture!==void 0&&s!==Vt&&(u.push(n.assignTexture(a,"normalMap",o.normalTexture)),a.normalScale=new Pe(1,1),o.normalTexture.scale!==void 0)){const f=o.normalTexture.scale;a.normalScale.set(f,f)}if(o.occlusionTexture!==void 0&&s!==Vt&&(u.push(n.assignTexture(a,"aoMap",o.occlusionTexture)),o.occlusionTexture.strength!==void 0&&(a.aoMapIntensity=o.occlusionTexture.strength)),o.emissiveFactor!==void 0&&s!==Vt){const f=o.emissiveFactor;a.emissive=new Fe().setRGB(f[0],f[1],f[2],vt)}return o.emissiveTexture!==void 0&&s!==Vt&&u.push(n.assignTexture(a,"emissiveMap",o.emissiveTexture,mn)),Promise.all(u).then(function(){const f=new s(a);return o.name&&(f.name=o.name),gt(f,o),n.associations.set(f,{materials:e}),o.extensions&&Rt(i,f,o),f})}createUniqueName(e){const n=hn.sanitizeNodeName(e||"");return n in this.nodeNamesUsed?n+"_"+ ++this.nodeNamesUsed[n]:(this.nodeNamesUsed[n]=0,n)}loadGeometries(e){const n=this,r=this.extensions,i=this.primitiveCache;function o(a){return r[he.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(a,n).then(function(l){return ho(l,a,n)})}const s=[];for(let a=0,l=e.length;a0&&Nf(T,o),T.name=n.createUniqueName(o.name||"mesh_"+e),gt(T,o),v.extensions&&Rt(i,T,v),n.assignFinalMaterial(T),f.push(T)}for(let d=0,b=f.length;d1?c=new rr:u.length===1?c=u[0]:c=new si,c!==u[0])for(let f=0,p=u.length;f{const f=new Map;for(const[p,d]of i.associations)(p instanceof nr||p instanceof Fn)&&f.set(p,d);return c.traverse(p=>{const d=i.associations.get(p);d!=null&&f.set(p,d)}),f};return i.associations=u(o),o})}_createAnimationTracks(e,n,r,i,o){const s=[],a=e.name?e.name:e.uuid,l=[];Tt[o.path]===Tt.weights?e.traverse(function(p){p.morphTargetInfluences&&l.push(p.name?p.name:p.uuid)}):l.push(a);let u;switch(Tt[o.path]){case Tt.weights:u=Ni;break;case Tt.rotation:u=Li;break;case Tt.translation:case Tt.scale:u=Ci;break;default:switch(r.itemSize){case 1:u=Ni;break;case 2:case 3:default:u=Ci;break}break}const c=i.interpolation!==void 0?If[i.interpolation]:ti,f=this._getArrayFromAccessor(r);for(let p=0,d=l.length;pnew _a(t)),Ct.register(t=>new Aa(t)),Ct)}async function Ff(t){const r=(await Fs().loadAsync(t)).userData;if(!r.vrmAnimations){console.warn("No VRM animations found in the .vrma file");return}if(r.vrmAnimations.length===0){console.warn("No VRM animations found in the .vrma file");return}return r.vrmAnimations[0]}async function Bf(t,e){if(!t){console.warn("No VRM found");return}if(e)return Ea(e,t)}function Uf(){const t=W(!1),e=W(0),n=W(0),r=.2,i=1,o=6,s=W(Math.random()*(o-i)+i);function a(l,u){if(l!=null&&l.expressionManager&&(n.value+=u,!t.value&&n.value>=s.value&&(t.value=!0,e.value=0),t.value)){e.value+=u/r;const c=Math.sin(Math.PI*e.value);l.expressionManager.setValue("blink",c),e.value>=1&&(t.value=!1,n.value=0,l.expressionManager.setValue("blink",0),s.value=Math.random()*(o-i)+i)}}return{update:a}}function jf(){let t=-1,e,n=0;function r(){e?e.set(on(-.25,.25),on(-.2,.15),-.65):e=new se(on(-.25,.25),on(-.2,.15),-.65)}function i(o,s){var a;!(o!=null&&o.expressionManager)||!o.lookAt||(n>=t?(r(),n=0,t=Ma()/1e3):e||r(),o.lookAt.target||(o.lookAt.target=new si),o.lookAt.target.position.lerp(e,on(.2,.5)),(a=o.lookAt)==null||a.update(s),n+=s)}return{update:i}}async function Vf(t,e){const i=(await Fs().loadAsync(t,s=>{var a;return(a=e==null?void 0:e.onProgress)==null?void 0:a.call(e,s)})).userData;if(!i.vrm)return;const o=i.vrm;if(Nr.removeUnnecessaryVertices(o.scene),Nr.combineSkeletons(o.scene),o.scene.traverse(s=>{s.frustumCulled=!1}),o.lookAt){const s=new Sa(o.lookAt);s.name="lookAtQuaternionProxy",o.scene.add(s)}return e!=null&&e.scene&&e.scene.add(o.scene),e!=null&&e.position&&o.scene.position.set(...e.position),o}function Hf(t){const e=W(null),n=W(!1),r=W(0),i=W(new Map),o=W(new Map),s=W(),a=(T,I,A)=>T+(I-T)*A,l=T=>T<.5?4*T*T*T:1-(-2*T+2)**3/2,u=new Map([["happy",{expression:[{name:"happy",value:1,duration:.3},{name:"aa",value:.3}],blendDuration:.3}],["sad",{expression:[{name:"sad",value:1},{name:"oh",value:.2}],blendDuration:.3}],["angry",{expression:[{name:"angry",value:1},{name:"ee",value:.4}],blendDuration:.2}],["surprised",{expression:[{name:"Surprised",value:1},{name:"oh",value:.6}],blendDuration:.1}],["neutral",{expression:[{name:"neutral",value:1}],blendDuration:.5}]]),c=()=>{s.value&&(clearTimeout(s.value),s.value=void 0)},f=T=>{var A;if(c(),!u.has(T)){console.warn(`Emotion ${T} not found`);return}const I=u.get(T);if(e.value=T,n.value=!0,r.value=0,t.expressionManager){const C=Object.keys(t.expressionManager.expressionMap);for(const P of C)t.expressionManager.setValue(P,0)}i.value.clear(),o.value.clear();for(const C of I.expression||[]){const P=((A=t.expressionManager)==null?void 0:A.getValue(C.name))||0;i.value.set(C.name,P),o.value.set(C.name,C.value)}};return{currentEmotion:e,isTransitioning:n,setEmotion:f,setEmotionWithResetAfter:(T,I)=>{c(),f(T),s.value=setTimeout(()=>{f("neutral"),s.value=void 0},I)},update:T=>{var C;if(!n.value||!e.value)return;const A=u.get(e.value).blendDuration||.3;r.value+=T/A,r.value>=1&&(r.value=1,n.value=!1);for(const[P,h]of o.value){const S=i.value.get(P)||0,y=a(S,h,l(r.value));(C=t.expressionManager)==null||C.setValue(P,y)}},addEmotionState:(T,I)=>{u.set(T,I)},removeEmotionState:T=>{u.delete(T)},dispose:()=>{c()}}}const Gf=ze({__name:"Model",props:{model:null,idleAnimation:null,loadAnimations:null,position:null,paused:{type:Boolean}},emits:["loadModelProgress","error"],setup(t,{expose:e,emit:n}){const r=t,i=n;let o;const s=W(),a=W(),{scene:l}=qn(),{onBeforeRender:u}=On(),c=Uf(),f=jf(),p=W();je(()=>r.position,([x,v,T])=>{s.value&&s.value.scene.position.set(x,v,T)}),pn(async()=>{if(l.value)try{const x=await Vf(r.model,{scene:l.value,lookAt:!0,position:r.position,onProgress:I=>i("loadModelProgress",Number.parseFloat((100*(I.loaded/I.total)).toFixed(2)))});if(!x){console.warn("No VRM model loaded");return}const v=await Ff(r.idleAnimation),T=await Bf(x,v);if(!T){console.warn("No VRM animation loaded");return}a.value=new Ml(x.scene),a.value.clipAction(T).play(),p.value=Hf(x),s.value=x,o=u(({delta:I})=>{var A,C,P;(A=a.value)==null||A.update(I),(C=s.value)==null||C.update(I),c.update(s.value,I),f.update(s.value,I),(P=p.value)==null||P.update(I)}).off}catch(x){i("error",x)}}),Ot(()=>{o==null||o(),s.value&&(s.value.scene.removeFromParent(),Nr.deepDispose(s.value.scene))}),e({setExpression(x){var v;(v=p.value)==null||v.setEmotionWithResetAfter(x,1e3)}});const{pause:d,resume:b}=On();return je(()=>r.paused,x=>{x?d():b()}),(x,v)=>gn(x.$slots,"default")}}),$f=["position"],qf={absolute:"",bottom:"3",right:"3"},Yf={flex:"~ row","cursor-pointer":""},Kf=["checked","aria-checked"],Wf={key:0,"min-w":"50vw",z:"{var x;(x=p.value)==null||x.setExpression(b)}}),(b,x)=>(ee(),Xt(ys,{relative:""},{default:Be(({height:v,width:T})=>[ke(H(Sl),{alpha:!0,antialias:!0,width:T,height:v},{default:Be(()=>[ke(H(Cc)),z("TresPerspectiveCamera",{position:[s.value,a.value,l.value]},null,8,$f),x[14]||(x[14]=z("TresDirectionalLight",{color:16777215,intensity:1.2,position:[1,1,1]},null,-1)),x[15]||(x[15]=z("TresAmbientLight",{color:16777215,intensity:1.5},null,-1)),ke(Gf,{ref_key:"modelRef",ref:p,model:r.model,"idle-animation":r.idleAnimation,position:[u.value,c.value,f.value],paused:r.paused,onLoadModelProgress:x[0]||(x[0]=I=>i("loadModelProgress",I)),onError:x[1]||(x[1]=I=>i("error",I))},null,8,["model","idle-animation","position","paused"])]),_:2},1032,["width","height"]),z("div",qf,[z("div",Yf,[z("label",{class:at([o.value?"bg-zinc-300 dark:bg-zinc-200":"bg-zinc-100 dark:bg-zinc-700"]),transition:"all ease-in-out duration-500",text:"lg zinc-500 dark:zinc-400","m-1":"","h-fit":"","w-fit":"","cursor-pointer":"","appearance-none":"","gap-1":"","rounded-lg":"","rounded-md":"","border-none":"","p-2":"","outline-none":""},[At(z("input",{"onUpdate:modelValue":x[2]||(x[2]=I=>o.value=I),checked:o.value,"aria-checked":o.value,name:"showLive2DViewerInspector",type:"checkbox",hidden:"","appearance-none":"","outline-none":""},null,8,Kf),[[Jr,o.value]]),x[16]||(x[16]=z("div",{"select-none":""},[z("div",{"i-solar:bug-bold-duotone":""})],-1))],2)]),ke(ci,null,{default:Be(()=>[o.value?(ee(),ie("div",Wf,[z("div",Xf,[z("div",Zf,[z("span",null,ge(H(d)("stage.viewers.debug-menu.vrm.model.title")),1)]),ke(Oi,{"h-fit":"","w-full":"",flex:"~ col",border:"~ gray/25 rounded-lg",divide:"y dashed gray/25","of-clip":"","shadow-sm":""},{label:Be(()=>[z("span",Qf,ge(H(d)("stage.viewers.debug-menu.vrm.camera")),1)]),default:Be(()=>[z("div",Jf,[x[17]||(x[17]=z("div",{text:"zinc-400 dark:zinc-500"},[z("span",null,"X")],-1)),z("label",ed,[ke(Ut,{modelValue:s.value,"onUpdate:modelValue":x[3]||(x[3]=I=>s.value=I),min:-10,max:10,step:.01},null,8,["modelValue"])]),z("div",td,[z("span",null,ge(s.value),1)]),x[18]||(x[18]=z("div",{text:"zinc-400 dark:zinc-500"},[z("span",null,"Y")],-1)),z("label",nd,[ke(Ut,{modelValue:a.value,"onUpdate:modelValue":x[4]||(x[4]=I=>a.value=I),min:-10,max:10,step:.01},null,8,["modelValue"])]),z("div",rd,[z("span",null,ge(a.value),1)]),x[19]||(x[19]=z("div",{text:"zinc-400 dark:zinc-500"},[z("span",null,"Z")],-1)),z("label",id,[ke(Ut,{modelValue:l.value,"onUpdate:modelValue":x[5]||(x[5]=I=>l.value=I),min:-10,max:10,step:.01},null,8,["modelValue"])]),z("div",od,[z("span",null,ge(l.value),1)])])]),_:1}),ke(Oi,{"h-fit":"","w-full":"",flex:"~ col",border:"~ gray/25 rounded-lg",divide:"y dashed gray/25","of-clip":"","shadow-sm":""},{label:Be(()=>[z("span",sd,ge(H(d)("stage.viewers.debug-menu.vrm.model.title")),1)]),default:Be(()=>[z("div",ad,[x[20]||(x[20]=z("div",{text:"zinc-400 dark:zinc-500"},[z("span",null,"X")],-1)),z("label",ld,[ke(Ut,{modelValue:u.value,"onUpdate:modelValue":x[6]||(x[6]=I=>u.value=I),min:-10,max:10,step:.01},null,8,["modelValue"])]),z("div",ud,[z("span",null,ge(u.value),1)]),x[21]||(x[21]=z("div",{text:"zinc-400 dark:zinc-500"},[z("span",null,"Y")],-1)),z("label",cd,[ke(Ut,{modelValue:c.value,"onUpdate:modelValue":x[7]||(x[7]=I=>c.value=I),min:-10,max:10,step:.01},null,8,["modelValue"])]),z("div",fd,[z("span",null,ge(c.value),1)]),x[22]||(x[22]=z("div",{text:"zinc-400 dark:zinc-500"},[z("span",null,"Z")],-1)),z("label",dd,[ke(Ut,{modelValue:f.value,"onUpdate:modelValue":x[8]||(x[8]=I=>f.value=I),min:-10,max:10,step:.01},null,8,["modelValue"])]),z("div",pd,[z("span",null,ge(f.value),1)])])]),_:1}),z("div",hd,[z("span",null,ge(H(d)("stage.viewers.debug-menu.emotions")),1)]),z("div",md,[z("button",{"rounded-lg":"",bg:"zinc-100/70 dark:zinc-800/50","px-2":"","py-1":"","backdrop-blur-sm":"",onClick:x[9]||(x[9]=I=>{var A;return(A=p.value)==null?void 0:A.setExpression("neutral")})},ge(H(d)("stage.viewers.debug-menu.emotions-btn.neutral")),1),z("button",{"rounded-lg":"",bg:"zinc-100/70 dark:zinc-800/50","px-2":"","py-1":"","backdrop-blur-sm":"",onClick:x[10]||(x[10]=I=>{var A;return(A=p.value)==null?void 0:A.setExpression("surprised")})},ge(H(d)("stage.viewers.debug-menu.emotions-btn.surprised")),1),z("button",{"rounded-lg":"",bg:"zinc-100/70 dark:zinc-800/50","px-2":"","py-1":"","backdrop-blur-sm":"",onClick:x[11]||(x[11]=I=>{var A;return(A=p.value)==null?void 0:A.setExpression("sad")})},ge(H(d)("stage.viewers.debug-menu.emotions-btn.sad")),1),z("button",{"rounded-lg":"",bg:"zinc-100/70 dark:zinc-800/50","px-2":"","py-1":"","backdrop-blur-sm":"",onClick:x[12]||(x[12]=I=>{var A;return(A=p.value)==null?void 0:A.setExpression("angry")})},ge(H(d)("stage.viewers.debug-menu.emotions-btn.angry")),1),z("button",{"rounded-lg":"",bg:"zinc-100/70 dark:zinc-800/50","px-2":"","py-1":"","backdrop-blur-sm":"",onClick:x[13]||(x[13]=I=>{var A;return(A=p.value)==null?void 0:A.setExpression("happy")})},ge(H(d)("stage.viewers.debug-menu.emotions-btn.happy")),1)])])])):it("",!0)]),_:1})])]),_:1}))}}),yd=["area","base","basefont","bgsound","br","col","command","embed","frame","hr","image","img","input","keygen","link","meta","param","source","track","wbr"];class bn{constructor(e,n,r){this.normal=n,this.property=e,r&&(this.space=r)}}bn.prototype.normal={};bn.prototype.property={};bn.prototype.space=void 0;function Bs(t,e){const n={},r={};for(const i of t)Object.assign(n,i.property),Object.assign(r,i.normal);return new bn(n,r,e)}function Hr(t){return t.toLowerCase()}class We{constructor(e,n){this.attribute=n,this.property=e}}We.prototype.attribute="";We.prototype.booleanish=!1;We.prototype.boolean=!1;We.prototype.commaOrSpaceSeparated=!1;We.prototype.commaSeparated=!1;We.prototype.defined=!1;We.prototype.mustUseProperty=!1;We.prototype.number=!1;We.prototype.overloadedBoolean=!1;We.prototype.property="";We.prototype.spaceSeparated=!1;We.prototype.space=void 0;let xd=0;const fe=zt(),Le=zt(),Us=zt(),$=zt(),Re=zt(),Yt=zt(),Qe=zt();function zt(){return 2**++xd}const Gr=Object.freeze(Object.defineProperty({__proto__:null,boolean:fe,booleanish:Le,commaOrSpaceSeparated:Qe,commaSeparated:Yt,number:$,overloadedBoolean:Us,spaceSeparated:Re},Symbol.toStringTag,{value:"Module"})),br=Object.keys(Gr);class hi extends We{constructor(e,n,r,i){let o=-1;if(super(e,n),mo(this,"space",i),typeof r=="number")for(;++o4&&n.slice(0,4)==="data"&&Td.test(e)){if(e.charAt(4)==="-"){const o=e.slice(5).replace(go,Ad);r="data"+o.charAt(0).toUpperCase()+o.slice(1)}else{const o=e.slice(4);if(!go.test(o)){let s=o.replace(wd,_d);s.charAt(0)!=="-"&&(s="-"+s),e="data"+s}}i=hi}return new i(r,e)}function _d(t){return"-"+t.toLowerCase()}function Ad(t){return t.charAt(1).toUpperCase()}const Ed=Bs([js,vd,Gs,$s,qs],"html"),Ys=Bs([js,bd,Gs,$s,qs],"svg"),yo={}.hasOwnProperty;function Md(t,e){const n=e||{};function r(i,...o){let s=r.invalid;const a=r.handlers;if(i&&yo.call(i,t)){const l=String(i[t]);s=yo.call(a,l)?a[l]:r.unknown}if(s)return s.call(this,i,...o)}return r.handlers=n.handlers||{},r.invalid=n.invalid,r.unknown=n.unknown,r}const Sd=/^>|^->||--!>|"],Rd=["<",">"];function Cd(t,e,n,r){return r.settings.bogusComments?""+$t(t.value,Object.assign({},r.settings.characterReferences,{subset:Id}))+">":"";function i(o){return $t(o,Object.assign({},r.settings.characterReferences,{subset:Rd}))}}function Nd(t,e,n,r){return""}function Ld(t,e){const n=e||{};return(t[t.length-1]===""?[...t,""]:t).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}function Pd(t){return t.join(" ").trim()}const Dd=/[ \t\n\f\r]/g;function mi(t){return typeof t=="object"?t.type==="text"?xo(t.value):!1:xo(t)}function xo(t){return t.replace(Dd,"")===""}const De=Ws(1),Ks=Ws(-1),Od=[];function Ws(t){return e;function e(n,r,i){const o=n?n.children:Od;let s=(r||0)+t,a=o[s];if(!i)for(;a&&mi(a);)s+=t,a=o[s];return a}}const zd={}.hasOwnProperty;function Xs(t){return e;function e(n,r,i){return zd.call(t,n.tagName)&&t[n.tagName](n,r,i)}}const gi=Xs({body:Bd,caption:wr,colgroup:wr,dd:Hd,dt:Vd,head:wr,html:Fd,li:jd,optgroup:Gd,option:$d,p:Ud,rp:vo,rt:vo,tbody:Yd,td:bo,tfoot:Kd,th:bo,thead:qd,tr:Wd});function wr(t,e,n){const r=De(n,e,!0);return!r||r.type!=="comment"&&!(r.type==="text"&&mi(r.value.charAt(0)))}function Fd(t,e,n){const r=De(n,e);return!r||r.type!=="comment"}function Bd(t,e,n){const r=De(n,e);return!r||r.type!=="comment"}function Ud(t,e,n){const r=De(n,e);return r?r.type==="element"&&(r.tagName==="address"||r.tagName==="article"||r.tagName==="aside"||r.tagName==="blockquote"||r.tagName==="details"||r.tagName==="div"||r.tagName==="dl"||r.tagName==="fieldset"||r.tagName==="figcaption"||r.tagName==="figure"||r.tagName==="footer"||r.tagName==="form"||r.tagName==="h1"||r.tagName==="h2"||r.tagName==="h3"||r.tagName==="h4"||r.tagName==="h5"||r.tagName==="h6"||r.tagName==="header"||r.tagName==="hgroup"||r.tagName==="hr"||r.tagName==="main"||r.tagName==="menu"||r.tagName==="nav"||r.tagName==="ol"||r.tagName==="p"||r.tagName==="pre"||r.tagName==="section"||r.tagName==="table"||r.tagName==="ul"):!n||!(n.type==="element"&&(n.tagName==="a"||n.tagName==="audio"||n.tagName==="del"||n.tagName==="ins"||n.tagName==="map"||n.tagName==="noscript"||n.tagName==="video"))}function jd(t,e,n){const r=De(n,e);return!r||r.type==="element"&&r.tagName==="li"}function Vd(t,e,n){const r=De(n,e);return!!(r&&r.type==="element"&&(r.tagName==="dt"||r.tagName==="dd"))}function Hd(t,e,n){const r=De(n,e);return!r||r.type==="element"&&(r.tagName==="dt"||r.tagName==="dd")}function vo(t,e,n){const r=De(n,e);return!r||r.type==="element"&&(r.tagName==="rp"||r.tagName==="rt")}function Gd(t,e,n){const r=De(n,e);return!r||r.type==="element"&&r.tagName==="optgroup"}function $d(t,e,n){const r=De(n,e);return!r||r.type==="element"&&(r.tagName==="option"||r.tagName==="optgroup")}function qd(t,e,n){const r=De(n,e);return!!(r&&r.type==="element"&&(r.tagName==="tbody"||r.tagName==="tfoot"))}function Yd(t,e,n){const r=De(n,e);return!r||r.type==="element"&&(r.tagName==="tbody"||r.tagName==="tfoot")}function Kd(t,e,n){return!De(n,e)}function Wd(t,e,n){const r=De(n,e);return!r||r.type==="element"&&r.tagName==="tr"}function bo(t,e,n){const r=De(n,e);return!r||r.type==="element"&&(r.tagName==="td"||r.tagName==="th")}const Xd=Xs({body:Jd,colgroup:ep,head:Qd,html:Zd,tbody:tp});function Zd(t){const e=De(t,-1);return!e||e.type!=="comment"}function Qd(t){const e=new Set;for(const r of t.children)if(r.type==="element"&&(r.tagName==="base"||r.tagName==="title")){if(e.has(r.tagName))return!1;e.add(r.tagName)}const n=t.children[0];return!n||n.type==="element"}function Jd(t){const e=De(t,-1,!0);return!e||e.type!=="comment"&&!(e.type==="text"&&mi(e.value.charAt(0)))&&!(e.type==="element"&&(e.tagName==="meta"||e.tagName==="link"||e.tagName==="script"||e.tagName==="style"||e.tagName==="template"))}function ep(t,e,n){const r=Ks(n,e),i=De(t,-1,!0);return n&&r&&r.type==="element"&&r.tagName==="colgroup"&&gi(r,n.children.indexOf(r),n)?!1:!!(i&&i.type==="element"&&i.tagName==="col")}function tp(t,e,n){const r=Ks(n,e),i=De(t,-1);return n&&r&&r.type==="element"&&(r.tagName==="thead"||r.tagName==="tbody")&&gi(r,n.children.indexOf(r),n)?!1:!!(i&&i.type==="element"&&i.tagName==="tr")}const In={name:[[`
\f\r &/=>`.split(""),`
\f\r "&'/=>\``.split("")],[`\0
\f\r "&'/<=>`.split(""),`\0
@@ -516,18 +516,18 @@ void main() {
\f\r &>`.split(""),`\0
\f\r "&'<=>\``.split("")],[`\0
\f\r "&'<=>\``.split(""),`\0
-\f\r "&'<=>\``.split("")]],single:[["&'".split(""),"\"&'`".split("")],["\0&'".split(""),"\0\"&'`".split("")]],double:[['"&'.split(""),"\"&'`".split("")],['\0"&'.split(""),"\0\"&'`".split("")]]};function ep(t,e,n,r){const i=r.schema,o=i.space==="svg"?!1:r.settings.omitOptionalTags;let s=i.space==="svg"?r.settings.closeEmptyElements:r.settings.voids.includes(t.tagName.toLowerCase());const a=[];let l;i.space==="html"&&t.tagName==="svg"&&(r.schema=Ys);const u=tp(r,t.properties),c=r.all(i.space==="html"&&t.tagName==="template"?t.content:t);return r.schema=i,c&&(s=!1),(u||!o||!Kd(t,e,n))&&(a.push("<",t.tagName,u?" "+u:""),s&&(i.space==="svg"||r.settings.closeSelfClosing)&&(l=u.charAt(u.length-1),(!r.settings.tightSelfClosing||l==="/"||l&&l!=='"'&&l!=="'")&&a.push(" "),a.push("/")),a.push(">")),a.push(c),!s&&(!o||!gi(t,e,n))&&a.push(""+t.tagName+">"),a.join("")}function tp(t,e){const n=[];let r=-1,i;if(e){for(i in e)if(e[i]!==null&&e[i]!==void 0){const o=np(t,i,e[i]);o&&n.push(o)}}for(;++rDi(n,t.alternative)&&(s=t.alternative),a=s+$t(n,Object.assign({},t.settings.characterReferences,{subset:(s==="'"?In.single:In.double)[i][o],attribute:!0}))+s),l+(a&&"="+a))}const rp=["<","&"];function Qs(t,e,n,r){return n&&n.type==="element"&&(n.tagName==="script"||n.tagName==="style")?t.value:$t(t.value,Object.assign({},r.settings.characterReferences,{subset:rp}))}function ip(t,e,n,r){return r.settings.allowDangerousHtml?t.value:Qs(t,e,n,r)}function op(t,e,n,r){return r.all(t)}const sp=Ad("type",{invalid:ap,unknown:lp,handlers:{comment:Id,doctype:Rd,element:ep,raw:ip,root:op,text:Qs}});function ap(t){throw new Error("Expected node, not `"+t+"`")}function lp(t){const e=t;throw new Error("Cannot compile unknown node `"+e.type+"`")}const up={},cp={},fp=[];function dp(t,e){const n=e||up,r=n.quote||'"',i=r==='"'?"'":'"';if(r!=='"'&&r!=="'")throw new Error("Invalid quote `"+r+"`, expected `'` or `\"`");return{one:pp,all:hp,settings:{omitOptionalTags:n.omitOptionalTags||!1,allowParseErrors:n.allowParseErrors||!1,allowDangerousCharacters:n.allowDangerousCharacters||!1,quoteSmart:n.quoteSmart||!1,preferUnquoted:n.preferUnquoted||!1,tightAttributes:n.tightAttributes||!1,upperDoctype:n.upperDoctype||!1,tightDoctype:n.tightDoctype||!1,bogusComments:n.bogusComments||!1,tightCommaSeparatedLists:n.tightCommaSeparatedLists||!1,tightSelfClosing:n.tightSelfClosing||!1,collapseEmptyAttributes:n.collapseEmptyAttributes||!1,allowDangerousHtml:n.allowDangerousHtml||!1,voids:n.voids||md,characterReferences:n.characterReferences||cp,closeSelfClosing:n.closeSelfClosing||!1,closeEmptyElements:n.closeEmptyElements||!1},schema:n.space==="svg"?Ys:_d,quote:r,alternative:i}.one(Array.isArray(t)?{type:"root",children:t}:t,void 0,void 0)}function pp(t,e,n){return sp(t,e,n,this)}function hp(t){const e=[],n=t&&t.children||fp;let r=-1;for(;++ri?0:i+e:e=e>i?i:e,n=n>0?n:0,r.length<1e4)s=Array.from(r),s.unshift(e,n),t.splice(...s);else for(n&&t.splice(e,n);o0?(ct(t,t.length,0,e),t):e}const ko={}.hasOwnProperty;function vp(t){const e={};let n=-1;for(;++n13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function Kt(t){return t.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const ut=It(/[A-Za-z]/),et=It(/[\dA-Za-z]/),Tp=It(/[#-'*+\--9=?A-Z^-~]/);function $r(t){return t!==null&&(t<32||t===127)}const qr=It(/\d/),kp=It(/[\dA-Fa-f]/),_p=It(/[!-/:-@[-`{-~]/);function ae(t){return t!==null&&t<-2}function Ke(t){return t!==null&&(t<0||t===32)}function Ae(t){return t===-2||t===-1||t===32}const Ap=It(new RegExp("\\p{P}|\\p{S}","u")),Ep=It(/\s/);function It(t){return e;function e(n){return n!==null&&n>-1&&t.test(String.fromCharCode(n))}}function Jt(t){const e=[];let n=-1,r=0,i=0;for(;++n55295&&o<57344){const a=t.charCodeAt(n+1);o<56320&&a>56319&&a<57344?(s=String.fromCharCode(o,a),i=1):s="�"}else s=String.fromCharCode(o);s&&(e.push(t.slice(r,n),encodeURIComponent(s)),r=n+i+1,s=""),i&&(n+=i,i=0)}return e.join("")+t.slice(r)}function Ce(t,e,n,r){const i=r?r-1:Number.POSITIVE_INFINITY;let o=0;return s;function s(l){return Ae(l)?(t.enter(n),a(l)):e(l)}function a(l){return Ae(l)&&o++s))return;const S=e.events.length;let y=S,g,m;for(;y--;)if(e.events[y][0]==="exit"&&e.events[y][1].type==="chunkFlow"){if(g){m=e.events[y][1].end;break}g=!0}for(T(r),h=S;hA;){const P=n[C];e.containerState=P[1],P[0].exit.call(e,t)}n.length=A}function I(){i.write([null]),o=void 0,i=void 0,e.containerState._closeFlow=void 0}}function Cp(t,e,n){return Ce(t,t.attempt(this.parser.constructs.document,e,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Ao(t){if(t===null||Ke(t)||Ep(t))return 1;if(Ap(t))return 2}function xi(t,e,n){const r=[];let i=-1;for(;++i1&&t[n][1].end.offset-t[n][1].start.offset>1?2:1;const f={...t[r][1].end},p={...t[n][1].start};Eo(f,-l),Eo(p,l),s={type:l>1?"strongSequence":"emphasisSequence",start:f,end:{...t[r][1].end}},a={type:l>1?"strongSequence":"emphasisSequence",start:{...t[n][1].start},end:p},o={type:l>1?"strongText":"emphasisText",start:{...t[r][1].end},end:{...t[n][1].start}},i={type:l>1?"strong":"emphasis",start:{...s.start},end:{...a.end}},t[r][1].end={...s.start},t[n][1].start={...a.end},u=[],t[r][1].end.offset-t[r][1].start.offset&&(u=rt(u,[["enter",t[r][1],e],["exit",t[r][1],e]])),u=rt(u,[["enter",i,e],["enter",s,e],["exit",s,e],["enter",o,e]]),u=rt(u,xi(e.parser.constructs.insideSpan.null,t.slice(r+1,n),e)),u=rt(u,[["exit",o,e],["enter",a,e],["exit",a,e],["exit",i,e]]),t[n][1].end.offset-t[n][1].start.offset?(c=2,u=rt(u,[["enter",t[n][1],e],["exit",t[n][1],e]])):c=0,ct(t,r-1,n-r+3,u),n=r+u.length-c-2;break}}for(n=-1;++n0&&Ae(h)?Ce(t,I,"linePrefix",o+1)(h):I(h)}function I(h){return h===null||ae(h)?t.check(Mo,x,C)(h):(t.enter("codeFlowValue"),A(h))}function A(h){return h===null||ae(h)?(t.exit("codeFlowValue"),I(h)):(t.consume(h),A)}function C(h){return t.exit("codeFenced"),e(h)}function P(h,S,y){let g=0;return m;function m(D){return h.enter("lineEnding"),h.consume(D),h.exit("lineEnding"),k}function k(D){return h.enter("codeFencedFence"),Ae(D)?Ce(h,E,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(D):E(D)}function E(D){return D===a?(h.enter("codeFencedFenceSequence"),O(D)):y(D)}function O(D){return D===a?(g++,h.consume(D),O):g>=s?(h.exit("codeFencedFenceSequence"),Ae(D)?Ce(h,F,"whitespace")(D):F(D)):y(D)}function F(D){return D===null||ae(D)?(h.exit("codeFencedFence"),S(D)):y(D)}}}function Hp(t,e,n){const r=this;return i;function i(s){return s===null?n(s):(t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),o)}function o(s){return r.parser.lazy[r.now().line]?n(s):e(s)}}const Tr={name:"codeIndented",tokenize:$p},Gp={partial:!0,tokenize:qp};function $p(t,e,n){const r=this;return i;function i(u){return t.enter("codeIndented"),Ce(t,o,"linePrefix",5)(u)}function o(u){const c=r.events[r.events.length-1];return c&&c[1].type==="linePrefix"&&c[2].sliceSerialize(c[1],!0).length>=4?s(u):n(u)}function s(u){return u===null?l(u):ae(u)?t.attempt(Gp,s,l)(u):(t.enter("codeFlowValue"),a(u))}function a(u){return u===null||ae(u)?(t.exit("codeFlowValue"),s(u)):(t.consume(u),a)}function l(u){return t.exit("codeIndented"),e(u)}}function qp(t,e,n){const r=this;return i;function i(s){return r.parser.lazy[r.now().line]?n(s):ae(s)?(t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),i):Ce(t,o,"linePrefix",5)(s)}function o(s){const a=r.events[r.events.length-1];return a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?e(s):ae(s)?i(s):n(s)}}const Yp={name:"codeText",previous:Wp,resolve:Kp,tokenize:Xp};function Kp(t){let e=t.length-4,n=3,r,i;if((t[n][1].type==="lineEnding"||t[n][1].type==="space")&&(t[e][1].type==="lineEnding"||t[e][1].type==="space")){for(r=n;++r=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return ethis.left.length)return this.right.slice(this.right.length-r+this.left.length,this.right.length-e+this.left.length).reverse();const i=this.left.slice(e);return i.push(...this.right.slice(this.right.length-r+this.left.length).reverse()),i}splice(e,n,r){const i=n||0;this.setCursor(Math.trunc(e));const o=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);return r&&an(this.left,r),o.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(e){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(e)}pushMany(e){this.setCursor(Number.POSITIVE_INFINITY),an(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),an(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0))if(e=4?e(s):t.interrupt(r.parser.constructs.flow,n,e)(s)}}function ia(t,e,n,r,i,o,s,a,l){const u=l||Number.POSITIVE_INFINITY;let c=0;return f;function f(T){return T===60?(t.enter(r),t.enter(i),t.enter(o),t.consume(T),t.exit(o),p):T===null||T===32||T===41||$r(T)?n(T):(t.enter(r),t.enter(s),t.enter(a),t.enter("chunkString",{contentType:"string"}),x(T))}function p(T){return T===62?(t.enter(o),t.consume(T),t.exit(o),t.exit(i),t.exit(r),e):(t.enter(a),t.enter("chunkString",{contentType:"string"}),d(T))}function d(T){return T===62?(t.exit("chunkString"),t.exit(a),p(T)):T===null||T===60||ae(T)?n(T):(t.consume(T),T===92?b:d)}function b(T){return T===60||T===62||T===92?(t.consume(T),d):d(T)}function x(T){return!c&&(T===null||T===41||Ke(T))?(t.exit("chunkString"),t.exit(a),t.exit(s),t.exit(r),e(T)):c999||d===null||d===91||d===93&&!l||d===94&&!a&&"_hiddenFootnoteSupport"in s.parser.constructs?n(d):d===93?(t.exit(o),t.enter(i),t.consume(d),t.exit(i),t.exit(r),e):ae(d)?(t.enter("lineEnding"),t.consume(d),t.exit("lineEnding"),c):(t.enter("chunkString",{contentType:"string"}),f(d))}function f(d){return d===null||d===91||d===93||ae(d)||a++>999?(t.exit("chunkString"),c(d)):(t.consume(d),l||(l=!Ae(d)),d===92?p:f)}function p(d){return d===91||d===92||d===93?(t.consume(d),a++,f):f(d)}}function sa(t,e,n,r,i,o){let s;return a;function a(p){return p===34||p===39||p===40?(t.enter(r),t.enter(i),t.consume(p),t.exit(i),s=p===40?41:p,l):n(p)}function l(p){return p===s?(t.enter(i),t.consume(p),t.exit(i),t.exit(r),e):(t.enter(o),u(p))}function u(p){return p===s?(t.exit(o),l(s)):p===null?n(p):ae(p)?(t.enter("lineEnding"),t.consume(p),t.exit("lineEnding"),Ce(t,u,"linePrefix")):(t.enter("chunkString",{contentType:"string"}),c(p))}function c(p){return p===s||p===null||ae(p)?(t.exit("chunkString"),u(p)):(t.consume(p),p===92?f:c)}function f(p){return p===s||p===92?(t.consume(p),c):c(p)}}function fn(t,e){let n;return r;function r(i){return ae(i)?(t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),n=!0,r):Ae(i)?Ce(t,r,n?"linePrefix":"lineSuffix")(i):e(i)}}const ih={name:"definition",tokenize:sh},oh={partial:!0,tokenize:ah};function sh(t,e,n){const r=this;let i;return o;function o(d){return t.enter("definition"),s(d)}function s(d){return oa.call(r,t,a,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(d)}function a(d){return i=Kt(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),d===58?(t.enter("definitionMarker"),t.consume(d),t.exit("definitionMarker"),l):n(d)}function l(d){return Ke(d)?fn(t,u)(d):u(d)}function u(d){return ia(t,c,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(d)}function c(d){return t.attempt(oh,f,f)(d)}function f(d){return Ae(d)?Ce(t,p,"whitespace")(d):p(d)}function p(d){return d===null||ae(d)?(t.exit("definition"),r.parser.defined.push(i),e(d)):n(d)}}function ah(t,e,n){return r;function r(a){return Ke(a)?fn(t,i)(a):n(a)}function i(a){return sa(t,o,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(a)}function o(a){return Ae(a)?Ce(t,s,"whitespace")(a):s(a)}function s(a){return a===null||ae(a)?e(a):n(a)}}const lh={name:"hardBreakEscape",tokenize:uh};function uh(t,e,n){return r;function r(o){return t.enter("hardBreakEscape"),t.consume(o),i}function i(o){return ae(o)?(t.exit("hardBreakEscape"),e(o)):n(o)}}const ch={name:"headingAtx",resolve:fh,tokenize:dh};function fh(t,e){let n=t.length-2,r=3,i,o;return t[r][1].type==="whitespace"&&(r+=2),n-2>r&&t[n][1].type==="whitespace"&&(n-=2),t[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&t[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(i={type:"atxHeadingText",start:t[r][1].start,end:t[n][1].end},o={type:"chunkText",start:t[r][1].start,end:t[n][1].end,contentType:"text"},ct(t,r,n-r+1,[["enter",i,e],["enter",o,e],["exit",o,e],["exit",i,e]])),t}function dh(t,e,n){let r=0;return i;function i(c){return t.enter("atxHeading"),o(c)}function o(c){return t.enter("atxHeadingSequence"),s(c)}function s(c){return c===35&&r++<6?(t.consume(c),s):c===null||Ke(c)?(t.exit("atxHeadingSequence"),a(c)):n(c)}function a(c){return c===35?(t.enter("atxHeadingSequence"),l(c)):c===null||ae(c)?(t.exit("atxHeading"),e(c)):Ae(c)?Ce(t,a,"whitespace")(c):(t.enter("atxHeadingText"),u(c))}function l(c){return c===35?(t.consume(c),l):(t.exit("atxHeadingSequence"),a(c))}function u(c){return c===null||c===35||Ke(c)?(t.exit("atxHeadingText"),a(c)):(t.consume(c),u)}}const ph=["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"],Io=["pre","script","style","textarea"],hh={concrete:!0,name:"htmlFlow",resolveTo:yh,tokenize:xh},mh={partial:!0,tokenize:bh},gh={partial:!0,tokenize:vh};function yh(t){let e=t.length;for(;e--&&!(t[e][0]==="enter"&&t[e][1].type==="htmlFlow"););return e>1&&t[e-2][1].type==="linePrefix"&&(t[e][1].start=t[e-2][1].start,t[e+1][1].start=t[e-2][1].start,t.splice(e-2,2)),t}function xh(t,e,n){const r=this;let i,o,s,a,l;return u;function u(R){return c(R)}function c(R){return t.enter("htmlFlow"),t.enter("htmlFlowData"),t.consume(R),f}function f(R){return R===33?(t.consume(R),p):R===47?(t.consume(R),o=!0,x):R===63?(t.consume(R),i=3,r.interrupt?e:_):ut(R)?(t.consume(R),s=String.fromCharCode(R),v):n(R)}function p(R){return R===45?(t.consume(R),i=2,d):R===91?(t.consume(R),i=5,a=0,b):ut(R)?(t.consume(R),i=4,r.interrupt?e:_):n(R)}function d(R){return R===45?(t.consume(R),r.interrupt?e:_):n(R)}function b(R){const pe="CDATA[";return R===pe.charCodeAt(a++)?(t.consume(R),a===pe.length?r.interrupt?e:E:b):n(R)}function x(R){return ut(R)?(t.consume(R),s=String.fromCharCode(R),v):n(R)}function v(R){if(R===null||R===47||R===62||Ke(R)){const pe=R===47,ye=s.toLowerCase();return!pe&&!o&&Io.includes(ye)?(i=1,r.interrupt?e(R):E(R)):ph.includes(s.toLowerCase())?(i=6,pe?(t.consume(R),T):r.interrupt?e(R):E(R)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(R):o?I(R):A(R))}return R===45||et(R)?(t.consume(R),s+=String.fromCharCode(R),v):n(R)}function T(R){return R===62?(t.consume(R),r.interrupt?e:E):n(R)}function I(R){return Ae(R)?(t.consume(R),I):m(R)}function A(R){return R===47?(t.consume(R),m):R===58||R===95||ut(R)?(t.consume(R),C):Ae(R)?(t.consume(R),A):m(R)}function C(R){return R===45||R===46||R===58||R===95||et(R)?(t.consume(R),C):P(R)}function P(R){return R===61?(t.consume(R),h):Ae(R)?(t.consume(R),P):A(R)}function h(R){return R===null||R===60||R===61||R===62||R===96?n(R):R===34||R===39?(t.consume(R),l=R,S):Ae(R)?(t.consume(R),h):y(R)}function S(R){return R===l?(t.consume(R),l=null,g):R===null||ae(R)?n(R):(t.consume(R),S)}function y(R){return R===null||R===34||R===39||R===47||R===60||R===61||R===62||R===96||Ke(R)?P(R):(t.consume(R),y)}function g(R){return R===47||R===62||Ae(R)?A(R):n(R)}function m(R){return R===62?(t.consume(R),k):n(R)}function k(R){return R===null||ae(R)?E(R):Ae(R)?(t.consume(R),k):n(R)}function E(R){return R===45&&i===2?(t.consume(R),B):R===60&&i===1?(t.consume(R),X):R===62&&i===4?(t.consume(R),te):R===63&&i===3?(t.consume(R),_):R===93&&i===5?(t.consume(R),Q):ae(R)&&(i===6||i===7)?(t.exit("htmlFlowData"),t.check(mh,ce,O)(R)):R===null||ae(R)?(t.exit("htmlFlowData"),O(R)):(t.consume(R),E)}function O(R){return t.check(gh,F,ce)(R)}function F(R){return t.enter("lineEnding"),t.consume(R),t.exit("lineEnding"),D}function D(R){return R===null||ae(R)?O(R):(t.enter("htmlFlowData"),E(R))}function B(R){return R===45?(t.consume(R),_):E(R)}function X(R){return R===47?(t.consume(R),s="",Z):E(R)}function Z(R){if(R===62){const pe=s.toLowerCase();return Io.includes(pe)?(t.consume(R),te):E(R)}return ut(R)&&s.length<8?(t.consume(R),s+=String.fromCharCode(R),Z):E(R)}function Q(R){return R===93?(t.consume(R),_):E(R)}function _(R){return R===62?(t.consume(R),te):R===45&&i===2?(t.consume(R),_):E(R)}function te(R){return R===null||ae(R)?(t.exit("htmlFlowData"),ce(R)):(t.consume(R),te)}function ce(R){return t.exit("htmlFlow"),e(R)}}function vh(t,e,n){const r=this;return i;function i(s){return ae(s)?(t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),o):n(s)}function o(s){return r.parser.lazy[r.now().line]?n(s):e(s)}}function bh(t,e,n){return r;function r(i){return t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),t.attempt(Qn,e,n)}}const wh={name:"htmlText",tokenize:Th};function Th(t,e,n){const r=this;let i,o,s;return a;function a(_){return t.enter("htmlText"),t.enter("htmlTextData"),t.consume(_),l}function l(_){return _===33?(t.consume(_),u):_===47?(t.consume(_),P):_===63?(t.consume(_),A):ut(_)?(t.consume(_),y):n(_)}function u(_){return _===45?(t.consume(_),c):_===91?(t.consume(_),o=0,b):ut(_)?(t.consume(_),I):n(_)}function c(_){return _===45?(t.consume(_),d):n(_)}function f(_){return _===null?n(_):_===45?(t.consume(_),p):ae(_)?(s=f,X(_)):(t.consume(_),f)}function p(_){return _===45?(t.consume(_),d):f(_)}function d(_){return _===62?B(_):_===45?p(_):f(_)}function b(_){const te="CDATA[";return _===te.charCodeAt(o++)?(t.consume(_),o===te.length?x:b):n(_)}function x(_){return _===null?n(_):_===93?(t.consume(_),v):ae(_)?(s=x,X(_)):(t.consume(_),x)}function v(_){return _===93?(t.consume(_),T):x(_)}function T(_){return _===62?B(_):_===93?(t.consume(_),T):x(_)}function I(_){return _===null||_===62?B(_):ae(_)?(s=I,X(_)):(t.consume(_),I)}function A(_){return _===null?n(_):_===63?(t.consume(_),C):ae(_)?(s=A,X(_)):(t.consume(_),A)}function C(_){return _===62?B(_):A(_)}function P(_){return ut(_)?(t.consume(_),h):n(_)}function h(_){return _===45||et(_)?(t.consume(_),h):S(_)}function S(_){return ae(_)?(s=S,X(_)):Ae(_)?(t.consume(_),S):B(_)}function y(_){return _===45||et(_)?(t.consume(_),y):_===47||_===62||Ke(_)?g(_):n(_)}function g(_){return _===47?(t.consume(_),B):_===58||_===95||ut(_)?(t.consume(_),m):ae(_)?(s=g,X(_)):Ae(_)?(t.consume(_),g):B(_)}function m(_){return _===45||_===46||_===58||_===95||et(_)?(t.consume(_),m):k(_)}function k(_){return _===61?(t.consume(_),E):ae(_)?(s=k,X(_)):Ae(_)?(t.consume(_),k):g(_)}function E(_){return _===null||_===60||_===61||_===62||_===96?n(_):_===34||_===39?(t.consume(_),i=_,O):ae(_)?(s=E,X(_)):Ae(_)?(t.consume(_),E):(t.consume(_),F)}function O(_){return _===i?(t.consume(_),i=void 0,D):_===null?n(_):ae(_)?(s=O,X(_)):(t.consume(_),O)}function F(_){return _===null||_===34||_===39||_===60||_===61||_===96?n(_):_===47||_===62||Ke(_)?g(_):(t.consume(_),F)}function D(_){return _===47||_===62||Ke(_)?g(_):n(_)}function B(_){return _===62?(t.consume(_),t.exit("htmlTextData"),t.exit("htmlText"),e):n(_)}function X(_){return t.exit("htmlTextData"),t.enter("lineEnding"),t.consume(_),t.exit("lineEnding"),Z}function Z(_){return Ae(_)?Ce(t,Q,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(_):Q(_)}function Q(_){return t.enter("htmlTextData"),s(_)}}const vi={name:"labelEnd",resolveAll:Eh,resolveTo:Mh,tokenize:Sh},kh={tokenize:Ih},_h={tokenize:Rh},Ah={tokenize:Ch};function Eh(t){let e=-1;const n=[];for(;++e=3&&(u===null||ae(u))?(t.exit("thematicBreak"),e(u)):n(u)}function l(u){return u===i?(t.consume(u),r++,l):(t.exit("thematicBreakSequence"),Ae(u)?Ce(t,a,"whitespace")(u):a(u))}}const qe={continuation:{tokenize:jh},exit:Hh,name:"list",tokenize:Uh},Fh={partial:!0,tokenize:Gh},Bh={partial:!0,tokenize:Vh};function Uh(t,e,n){const r=this,i=r.events[r.events.length-1];let o=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,s=0;return a;function a(d){const b=r.containerState.type||(d===42||d===43||d===45?"listUnordered":"listOrdered");if(b==="listUnordered"?!r.containerState.marker||d===r.containerState.marker:qr(d)){if(r.containerState.type||(r.containerState.type=b,t.enter(b,{_container:!0})),b==="listUnordered")return t.enter("listItemPrefix"),d===42||d===45?t.check(Dn,n,u)(d):u(d);if(!r.interrupt||d===49)return t.enter("listItemPrefix"),t.enter("listItemValue"),l(d)}return n(d)}function l(d){return qr(d)&&++s<10?(t.consume(d),l):(!r.interrupt||s<2)&&(r.containerState.marker?d===r.containerState.marker:d===41||d===46)?(t.exit("listItemValue"),u(d)):n(d)}function u(d){return t.enter("listItemMarker"),t.consume(d),t.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||d,t.check(Qn,r.interrupt?n:c,t.attempt(Fh,p,f))}function c(d){return r.containerState.initialBlankLine=!0,o++,p(d)}function f(d){return Ae(d)?(t.enter("listItemPrefixWhitespace"),t.consume(d),t.exit("listItemPrefixWhitespace"),p):n(d)}function p(d){return r.containerState.size=o+r.sliceSerialize(t.exit("listItemPrefix"),!0).length,e(d)}}function jh(t,e,n){const r=this;return r.containerState._closeFlow=void 0,t.check(Qn,i,o);function i(a){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Ce(t,e,"listItemIndent",r.containerState.size+1)(a)}function o(a){return r.containerState.furtherBlankLines||!Ae(a)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,s(a)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,t.attempt(Bh,e,s)(a))}function s(a){return r.containerState._closeFlow=!0,r.interrupt=void 0,Ce(t,t.attempt(qe,e,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a)}}function Vh(t,e,n){const r=this;return Ce(t,i,"listItemIndent",r.containerState.size+1);function i(o){const s=r.events[r.events.length-1];return s&&s[1].type==="listItemIndent"&&s[2].sliceSerialize(s[1],!0).length===r.containerState.size?e(o):n(o)}}function Hh(t){t.exit(this.containerState.type)}function Gh(t,e,n){const r=this;return Ce(t,i,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(o){const s=r.events[r.events.length-1];return!Ae(o)&&s&&s[1].type==="listItemPrefixWhitespace"?e(o):n(o)}}const Ro={name:"setextUnderline",resolveTo:$h,tokenize:qh};function $h(t,e){let n=t.length,r,i,o;for(;n--;)if(t[n][0]==="enter"){if(t[n][1].type==="content"){r=n;break}t[n][1].type==="paragraph"&&(i=n)}else t[n][1].type==="content"&&t.splice(n,1),!o&&t[n][1].type==="definition"&&(o=n);const s={type:"setextHeading",start:{...t[i][1].start},end:{...t[t.length-1][1].end}};return t[i][1].type="setextHeadingText",o?(t.splice(i,0,["enter",s,e]),t.splice(o+1,0,["exit",t[r][1],e]),t[r][1].end={...t[o][1].end}):t[r][1]=s,t.push(["exit",s,e]),t}function qh(t,e,n){const r=this;let i;return o;function o(u){let c=r.events.length,f;for(;c--;)if(r.events[c][1].type!=="lineEnding"&&r.events[c][1].type!=="linePrefix"&&r.events[c][1].type!=="content"){f=r.events[c][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||f)?(t.enter("setextHeadingLine"),i=u,s(u)):n(u)}function s(u){return t.enter("setextHeadingLineSequence"),a(u)}function a(u){return u===i?(t.consume(u),a):(t.exit("setextHeadingLineSequence"),Ae(u)?Ce(t,l,"lineSuffix")(u):l(u))}function l(u){return u===null||ae(u)?(t.exit("setextHeadingLine"),e(u)):n(u)}}const Yh={tokenize:Kh};function Kh(t){const e=this,n=t.attempt(Qn,r,t.attempt(this.parser.constructs.flowInitial,i,Ce(t,t.attempt(this.parser.constructs.flow,i,t.attempt(Jp,i)),"linePrefix")));return n;function r(o){if(o===null){t.consume(o);return}return t.enter("lineEndingBlank"),t.consume(o),t.exit("lineEndingBlank"),e.currentConstruct=void 0,n}function i(o){if(o===null){t.consume(o);return}return t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),e.currentConstruct=void 0,n}}const Wh={resolveAll:la()},Xh=aa("string"),Qh=aa("text");function aa(t){return{resolveAll:la(t==="text"?Zh:void 0),tokenize:e};function e(n){const r=this,i=this.parser.constructs[t],o=n.attempt(i,s,a);return s;function s(c){return u(c)?o(c):a(c)}function a(c){if(c===null){n.consume(c);return}return n.enter("data"),n.consume(c),l}function l(c){return u(c)?(n.exit("data"),o(c)):(n.consume(c),l)}function u(c){if(c===null)return!0;const f=i[c];let p=-1;if(f)for(;++p-1){const a=s[0];typeof a=="string"?s[0]=a.slice(r):s.shift()}o>0&&s.push(t[i].slice(0,o))}return s}function fm(t,e){let n=-1;const r=[];let i;for(;++n\``.split("")]],single:[["&'".split(""),"\"&'`".split("")],["\0&'".split(""),"\0\"&'`".split("")]],double:[['"&'.split(""),"\"&'`".split("")],['\0"&'.split(""),"\0\"&'`".split("")]]};function np(t,e,n,r){const i=r.schema,o=i.space==="svg"?!1:r.settings.omitOptionalTags;let s=i.space==="svg"?r.settings.closeEmptyElements:r.settings.voids.includes(t.tagName.toLowerCase());const a=[];let l;i.space==="html"&&t.tagName==="svg"&&(r.schema=Ys);const u=rp(r,t.properties),c=r.all(i.space==="html"&&t.tagName==="template"?t.content:t);return r.schema=i,c&&(s=!1),(u||!o||!Xd(t,e,n))&&(a.push("<",t.tagName,u?" "+u:""),s&&(i.space==="svg"||r.settings.closeSelfClosing)&&(l=u.charAt(u.length-1),(!r.settings.tightSelfClosing||l==="/"||l&&l!=='"'&&l!=="'")&&a.push(" "),a.push("/")),a.push(">")),a.push(c),!s&&(!o||!gi(t,e,n))&&a.push(""+t.tagName+">"),a.join("")}function rp(t,e){const n=[];let r=-1,i;if(e){for(i in e)if(e[i]!==null&&e[i]!==void 0){const o=ip(t,i,e[i]);o&&n.push(o)}}for(;++rDi(n,t.alternative)&&(s=t.alternative),a=s+$t(n,Object.assign({},t.settings.characterReferences,{subset:(s==="'"?In.single:In.double)[i][o],attribute:!0}))+s),l+(a&&"="+a))}const op=["<","&"];function Zs(t,e,n,r){return n&&n.type==="element"&&(n.tagName==="script"||n.tagName==="style")?t.value:$t(t.value,Object.assign({},r.settings.characterReferences,{subset:op}))}function sp(t,e,n,r){return r.settings.allowDangerousHtml?t.value:Zs(t,e,n,r)}function ap(t,e,n,r){return r.all(t)}const lp=Md("type",{invalid:up,unknown:cp,handlers:{comment:Cd,doctype:Nd,element:np,raw:sp,root:ap,text:Zs}});function up(t){throw new Error("Expected node, not `"+t+"`")}function cp(t){const e=t;throw new Error("Cannot compile unknown node `"+e.type+"`")}const fp={},dp={},pp=[];function hp(t,e){const n=e||fp,r=n.quote||'"',i=r==='"'?"'":'"';if(r!=='"'&&r!=="'")throw new Error("Invalid quote `"+r+"`, expected `'` or `\"`");return{one:mp,all:gp,settings:{omitOptionalTags:n.omitOptionalTags||!1,allowParseErrors:n.allowParseErrors||!1,allowDangerousCharacters:n.allowDangerousCharacters||!1,quoteSmart:n.quoteSmart||!1,preferUnquoted:n.preferUnquoted||!1,tightAttributes:n.tightAttributes||!1,upperDoctype:n.upperDoctype||!1,tightDoctype:n.tightDoctype||!1,bogusComments:n.bogusComments||!1,tightCommaSeparatedLists:n.tightCommaSeparatedLists||!1,tightSelfClosing:n.tightSelfClosing||!1,collapseEmptyAttributes:n.collapseEmptyAttributes||!1,allowDangerousHtml:n.allowDangerousHtml||!1,voids:n.voids||yd,characterReferences:n.characterReferences||dp,closeSelfClosing:n.closeSelfClosing||!1,closeEmptyElements:n.closeEmptyElements||!1},schema:n.space==="svg"?Ys:Ed,quote:r,alternative:i}.one(Array.isArray(t)?{type:"root",children:t}:t,void 0,void 0)}function mp(t,e,n){return lp(t,e,n,this)}function gp(t){const e=[],n=t&&t.children||pp;let r=-1;for(;++ri?0:i+e:e=e>i?i:e,n=n>0?n:0,r.length<1e4)s=Array.from(r),s.unshift(e,n),t.splice(...s);else for(n&&t.splice(e,n);o0?(ct(t,t.length,0,e),t):e}const ko={}.hasOwnProperty;function wp(t){const e={};let n=-1;for(;++n13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function Kt(t){return t.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const ut=It(/[A-Za-z]/),et=It(/[\dA-Za-z]/),_p=It(/[#-'*+\--9=?A-Z^-~]/);function $r(t){return t!==null&&(t<32||t===127)}const qr=It(/\d/),Ap=It(/[\dA-Fa-f]/),Ep=It(/[!-/:-@[-`{-~]/);function ae(t){return t!==null&&t<-2}function Ke(t){return t!==null&&(t<0||t===32)}function Ae(t){return t===-2||t===-1||t===32}const Mp=It(new RegExp("\\p{P}|\\p{S}","u")),Sp=It(/\s/);function It(t){return e;function e(n){return n!==null&&n>-1&&t.test(String.fromCharCode(n))}}function Jt(t){const e=[];let n=-1,r=0,i=0;for(;++n55295&&o<57344){const a=t.charCodeAt(n+1);o<56320&&a>56319&&a<57344?(s=String.fromCharCode(o,a),i=1):s="�"}else s=String.fromCharCode(o);s&&(e.push(t.slice(r,n),encodeURIComponent(s)),r=n+i+1,s=""),i&&(n+=i,i=0)}return e.join("")+t.slice(r)}function Ce(t,e,n,r){const i=r?r-1:Number.POSITIVE_INFINITY;let o=0;return s;function s(l){return Ae(l)?(t.enter(n),a(l)):e(l)}function a(l){return Ae(l)&&o++s))return;const S=e.events.length;let y=S,g,m;for(;y--;)if(e.events[y][0]==="exit"&&e.events[y][1].type==="chunkFlow"){if(g){m=e.events[y][1].end;break}g=!0}for(T(r),h=S;hA;){const P=n[C];e.containerState=P[1],P[0].exit.call(e,t)}n.length=A}function I(){i.write([null]),o=void 0,i=void 0,e.containerState._closeFlow=void 0}}function Lp(t,e,n){return Ce(t,t.attempt(this.parser.constructs.document,e,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Ao(t){if(t===null||Ke(t)||Sp(t))return 1;if(Mp(t))return 2}function xi(t,e,n){const r=[];let i=-1;for(;++i1&&t[n][1].end.offset-t[n][1].start.offset>1?2:1;const f={...t[r][1].end},p={...t[n][1].start};Eo(f,-l),Eo(p,l),s={type:l>1?"strongSequence":"emphasisSequence",start:f,end:{...t[r][1].end}},a={type:l>1?"strongSequence":"emphasisSequence",start:{...t[n][1].start},end:p},o={type:l>1?"strongText":"emphasisText",start:{...t[r][1].end},end:{...t[n][1].start}},i={type:l>1?"strong":"emphasis",start:{...s.start},end:{...a.end}},t[r][1].end={...s.start},t[n][1].start={...a.end},u=[],t[r][1].end.offset-t[r][1].start.offset&&(u=rt(u,[["enter",t[r][1],e],["exit",t[r][1],e]])),u=rt(u,[["enter",i,e],["enter",s,e],["exit",s,e],["enter",o,e]]),u=rt(u,xi(e.parser.constructs.insideSpan.null,t.slice(r+1,n),e)),u=rt(u,[["exit",o,e],["enter",a,e],["exit",a,e],["exit",i,e]]),t[n][1].end.offset-t[n][1].start.offset?(c=2,u=rt(u,[["enter",t[n][1],e],["exit",t[n][1],e]])):c=0,ct(t,r-1,n-r+3,u),n=r+u.length-c-2;break}}for(n=-1;++n0&&Ae(h)?Ce(t,I,"linePrefix",o+1)(h):I(h)}function I(h){return h===null||ae(h)?t.check(Mo,x,C)(h):(t.enter("codeFlowValue"),A(h))}function A(h){return h===null||ae(h)?(t.exit("codeFlowValue"),I(h)):(t.consume(h),A)}function C(h){return t.exit("codeFenced"),e(h)}function P(h,S,y){let g=0;return m;function m(D){return h.enter("lineEnding"),h.consume(D),h.exit("lineEnding"),k}function k(D){return h.enter("codeFencedFence"),Ae(D)?Ce(h,E,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(D):E(D)}function E(D){return D===a?(h.enter("codeFencedFenceSequence"),O(D)):y(D)}function O(D){return D===a?(g++,h.consume(D),O):g>=s?(h.exit("codeFencedFenceSequence"),Ae(D)?Ce(h,F,"whitespace")(D):F(D)):y(D)}function F(D){return D===null||ae(D)?(h.exit("codeFencedFence"),S(D)):y(D)}}}function $p(t,e,n){const r=this;return i;function i(s){return s===null?n(s):(t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),o)}function o(s){return r.parser.lazy[r.now().line]?n(s):e(s)}}const Tr={name:"codeIndented",tokenize:Yp},qp={partial:!0,tokenize:Kp};function Yp(t,e,n){const r=this;return i;function i(u){return t.enter("codeIndented"),Ce(t,o,"linePrefix",5)(u)}function o(u){const c=r.events[r.events.length-1];return c&&c[1].type==="linePrefix"&&c[2].sliceSerialize(c[1],!0).length>=4?s(u):n(u)}function s(u){return u===null?l(u):ae(u)?t.attempt(qp,s,l)(u):(t.enter("codeFlowValue"),a(u))}function a(u){return u===null||ae(u)?(t.exit("codeFlowValue"),s(u)):(t.consume(u),a)}function l(u){return t.exit("codeIndented"),e(u)}}function Kp(t,e,n){const r=this;return i;function i(s){return r.parser.lazy[r.now().line]?n(s):ae(s)?(t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),i):Ce(t,o,"linePrefix",5)(s)}function o(s){const a=r.events[r.events.length-1];return a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?e(s):ae(s)?i(s):n(s)}}const Wp={name:"codeText",previous:Zp,resolve:Xp,tokenize:Qp};function Xp(t){let e=t.length-4,n=3,r,i;if((t[n][1].type==="lineEnding"||t[n][1].type==="space")&&(t[e][1].type==="lineEnding"||t[e][1].type==="space")){for(r=n;++r=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return ethis.left.length)return this.right.slice(this.right.length-r+this.left.length,this.right.length-e+this.left.length).reverse();const i=this.left.slice(e);return i.push(...this.right.slice(this.right.length-r+this.left.length).reverse()),i}splice(e,n,r){const i=n||0;this.setCursor(Math.trunc(e));const o=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);return r&&an(this.left,r),o.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(e){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(e)}pushMany(e){this.setCursor(Number.POSITIVE_INFINITY),an(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),an(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0))if(e=4?e(s):t.interrupt(r.parser.constructs.flow,n,e)(s)}}function ia(t,e,n,r,i,o,s,a,l){const u=l||Number.POSITIVE_INFINITY;let c=0;return f;function f(T){return T===60?(t.enter(r),t.enter(i),t.enter(o),t.consume(T),t.exit(o),p):T===null||T===32||T===41||$r(T)?n(T):(t.enter(r),t.enter(s),t.enter(a),t.enter("chunkString",{contentType:"string"}),x(T))}function p(T){return T===62?(t.enter(o),t.consume(T),t.exit(o),t.exit(i),t.exit(r),e):(t.enter(a),t.enter("chunkString",{contentType:"string"}),d(T))}function d(T){return T===62?(t.exit("chunkString"),t.exit(a),p(T)):T===null||T===60||ae(T)?n(T):(t.consume(T),T===92?b:d)}function b(T){return T===60||T===62||T===92?(t.consume(T),d):d(T)}function x(T){return!c&&(T===null||T===41||Ke(T))?(t.exit("chunkString"),t.exit(a),t.exit(s),t.exit(r),e(T)):c999||d===null||d===91||d===93&&!l||d===94&&!a&&"_hiddenFootnoteSupport"in s.parser.constructs?n(d):d===93?(t.exit(o),t.enter(i),t.consume(d),t.exit(i),t.exit(r),e):ae(d)?(t.enter("lineEnding"),t.consume(d),t.exit("lineEnding"),c):(t.enter("chunkString",{contentType:"string"}),f(d))}function f(d){return d===null||d===91||d===93||ae(d)||a++>999?(t.exit("chunkString"),c(d)):(t.consume(d),l||(l=!Ae(d)),d===92?p:f)}function p(d){return d===91||d===92||d===93?(t.consume(d),a++,f):f(d)}}function sa(t,e,n,r,i,o){let s;return a;function a(p){return p===34||p===39||p===40?(t.enter(r),t.enter(i),t.consume(p),t.exit(i),s=p===40?41:p,l):n(p)}function l(p){return p===s?(t.enter(i),t.consume(p),t.exit(i),t.exit(r),e):(t.enter(o),u(p))}function u(p){return p===s?(t.exit(o),l(s)):p===null?n(p):ae(p)?(t.enter("lineEnding"),t.consume(p),t.exit("lineEnding"),Ce(t,u,"linePrefix")):(t.enter("chunkString",{contentType:"string"}),c(p))}function c(p){return p===s||p===null||ae(p)?(t.exit("chunkString"),u(p)):(t.consume(p),p===92?f:c)}function f(p){return p===s||p===92?(t.consume(p),c):c(p)}}function fn(t,e){let n;return r;function r(i){return ae(i)?(t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),n=!0,r):Ae(i)?Ce(t,r,n?"linePrefix":"lineSuffix")(i):e(i)}}const sh={name:"definition",tokenize:lh},ah={partial:!0,tokenize:uh};function lh(t,e,n){const r=this;let i;return o;function o(d){return t.enter("definition"),s(d)}function s(d){return oa.call(r,t,a,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(d)}function a(d){return i=Kt(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),d===58?(t.enter("definitionMarker"),t.consume(d),t.exit("definitionMarker"),l):n(d)}function l(d){return Ke(d)?fn(t,u)(d):u(d)}function u(d){return ia(t,c,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(d)}function c(d){return t.attempt(ah,f,f)(d)}function f(d){return Ae(d)?Ce(t,p,"whitespace")(d):p(d)}function p(d){return d===null||ae(d)?(t.exit("definition"),r.parser.defined.push(i),e(d)):n(d)}}function uh(t,e,n){return r;function r(a){return Ke(a)?fn(t,i)(a):n(a)}function i(a){return sa(t,o,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(a)}function o(a){return Ae(a)?Ce(t,s,"whitespace")(a):s(a)}function s(a){return a===null||ae(a)?e(a):n(a)}}const ch={name:"hardBreakEscape",tokenize:fh};function fh(t,e,n){return r;function r(o){return t.enter("hardBreakEscape"),t.consume(o),i}function i(o){return ae(o)?(t.exit("hardBreakEscape"),e(o)):n(o)}}const dh={name:"headingAtx",resolve:ph,tokenize:hh};function ph(t,e){let n=t.length-2,r=3,i,o;return t[r][1].type==="whitespace"&&(r+=2),n-2>r&&t[n][1].type==="whitespace"&&(n-=2),t[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&t[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(i={type:"atxHeadingText",start:t[r][1].start,end:t[n][1].end},o={type:"chunkText",start:t[r][1].start,end:t[n][1].end,contentType:"text"},ct(t,r,n-r+1,[["enter",i,e],["enter",o,e],["exit",o,e],["exit",i,e]])),t}function hh(t,e,n){let r=0;return i;function i(c){return t.enter("atxHeading"),o(c)}function o(c){return t.enter("atxHeadingSequence"),s(c)}function s(c){return c===35&&r++<6?(t.consume(c),s):c===null||Ke(c)?(t.exit("atxHeadingSequence"),a(c)):n(c)}function a(c){return c===35?(t.enter("atxHeadingSequence"),l(c)):c===null||ae(c)?(t.exit("atxHeading"),e(c)):Ae(c)?Ce(t,a,"whitespace")(c):(t.enter("atxHeadingText"),u(c))}function l(c){return c===35?(t.consume(c),l):(t.exit("atxHeadingSequence"),a(c))}function u(c){return c===null||c===35||Ke(c)?(t.exit("atxHeadingText"),a(c)):(t.consume(c),u)}}const mh=["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"],Io=["pre","script","style","textarea"],gh={concrete:!0,name:"htmlFlow",resolveTo:vh,tokenize:bh},yh={partial:!0,tokenize:Th},xh={partial:!0,tokenize:wh};function vh(t){let e=t.length;for(;e--&&!(t[e][0]==="enter"&&t[e][1].type==="htmlFlow"););return e>1&&t[e-2][1].type==="linePrefix"&&(t[e][1].start=t[e-2][1].start,t[e+1][1].start=t[e-2][1].start,t.splice(e-2,2)),t}function bh(t,e,n){const r=this;let i,o,s,a,l;return u;function u(R){return c(R)}function c(R){return t.enter("htmlFlow"),t.enter("htmlFlowData"),t.consume(R),f}function f(R){return R===33?(t.consume(R),p):R===47?(t.consume(R),o=!0,x):R===63?(t.consume(R),i=3,r.interrupt?e:_):ut(R)?(t.consume(R),s=String.fromCharCode(R),v):n(R)}function p(R){return R===45?(t.consume(R),i=2,d):R===91?(t.consume(R),i=5,a=0,b):ut(R)?(t.consume(R),i=4,r.interrupt?e:_):n(R)}function d(R){return R===45?(t.consume(R),r.interrupt?e:_):n(R)}function b(R){const pe="CDATA[";return R===pe.charCodeAt(a++)?(t.consume(R),a===pe.length?r.interrupt?e:E:b):n(R)}function x(R){return ut(R)?(t.consume(R),s=String.fromCharCode(R),v):n(R)}function v(R){if(R===null||R===47||R===62||Ke(R)){const pe=R===47,ye=s.toLowerCase();return!pe&&!o&&Io.includes(ye)?(i=1,r.interrupt?e(R):E(R)):mh.includes(s.toLowerCase())?(i=6,pe?(t.consume(R),T):r.interrupt?e(R):E(R)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(R):o?I(R):A(R))}return R===45||et(R)?(t.consume(R),s+=String.fromCharCode(R),v):n(R)}function T(R){return R===62?(t.consume(R),r.interrupt?e:E):n(R)}function I(R){return Ae(R)?(t.consume(R),I):m(R)}function A(R){return R===47?(t.consume(R),m):R===58||R===95||ut(R)?(t.consume(R),C):Ae(R)?(t.consume(R),A):m(R)}function C(R){return R===45||R===46||R===58||R===95||et(R)?(t.consume(R),C):P(R)}function P(R){return R===61?(t.consume(R),h):Ae(R)?(t.consume(R),P):A(R)}function h(R){return R===null||R===60||R===61||R===62||R===96?n(R):R===34||R===39?(t.consume(R),l=R,S):Ae(R)?(t.consume(R),h):y(R)}function S(R){return R===l?(t.consume(R),l=null,g):R===null||ae(R)?n(R):(t.consume(R),S)}function y(R){return R===null||R===34||R===39||R===47||R===60||R===61||R===62||R===96||Ke(R)?P(R):(t.consume(R),y)}function g(R){return R===47||R===62||Ae(R)?A(R):n(R)}function m(R){return R===62?(t.consume(R),k):n(R)}function k(R){return R===null||ae(R)?E(R):Ae(R)?(t.consume(R),k):n(R)}function E(R){return R===45&&i===2?(t.consume(R),B):R===60&&i===1?(t.consume(R),X):R===62&&i===4?(t.consume(R),te):R===63&&i===3?(t.consume(R),_):R===93&&i===5?(t.consume(R),Z):ae(R)&&(i===6||i===7)?(t.exit("htmlFlowData"),t.check(yh,ce,O)(R)):R===null||ae(R)?(t.exit("htmlFlowData"),O(R)):(t.consume(R),E)}function O(R){return t.check(xh,F,ce)(R)}function F(R){return t.enter("lineEnding"),t.consume(R),t.exit("lineEnding"),D}function D(R){return R===null||ae(R)?O(R):(t.enter("htmlFlowData"),E(R))}function B(R){return R===45?(t.consume(R),_):E(R)}function X(R){return R===47?(t.consume(R),s="",Q):E(R)}function Q(R){if(R===62){const pe=s.toLowerCase();return Io.includes(pe)?(t.consume(R),te):E(R)}return ut(R)&&s.length<8?(t.consume(R),s+=String.fromCharCode(R),Q):E(R)}function Z(R){return R===93?(t.consume(R),_):E(R)}function _(R){return R===62?(t.consume(R),te):R===45&&i===2?(t.consume(R),_):E(R)}function te(R){return R===null||ae(R)?(t.exit("htmlFlowData"),ce(R)):(t.consume(R),te)}function ce(R){return t.exit("htmlFlow"),e(R)}}function wh(t,e,n){const r=this;return i;function i(s){return ae(s)?(t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),o):n(s)}function o(s){return r.parser.lazy[r.now().line]?n(s):e(s)}}function Th(t,e,n){return r;function r(i){return t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),t.attempt(Zn,e,n)}}const kh={name:"htmlText",tokenize:_h};function _h(t,e,n){const r=this;let i,o,s;return a;function a(_){return t.enter("htmlText"),t.enter("htmlTextData"),t.consume(_),l}function l(_){return _===33?(t.consume(_),u):_===47?(t.consume(_),P):_===63?(t.consume(_),A):ut(_)?(t.consume(_),y):n(_)}function u(_){return _===45?(t.consume(_),c):_===91?(t.consume(_),o=0,b):ut(_)?(t.consume(_),I):n(_)}function c(_){return _===45?(t.consume(_),d):n(_)}function f(_){return _===null?n(_):_===45?(t.consume(_),p):ae(_)?(s=f,X(_)):(t.consume(_),f)}function p(_){return _===45?(t.consume(_),d):f(_)}function d(_){return _===62?B(_):_===45?p(_):f(_)}function b(_){const te="CDATA[";return _===te.charCodeAt(o++)?(t.consume(_),o===te.length?x:b):n(_)}function x(_){return _===null?n(_):_===93?(t.consume(_),v):ae(_)?(s=x,X(_)):(t.consume(_),x)}function v(_){return _===93?(t.consume(_),T):x(_)}function T(_){return _===62?B(_):_===93?(t.consume(_),T):x(_)}function I(_){return _===null||_===62?B(_):ae(_)?(s=I,X(_)):(t.consume(_),I)}function A(_){return _===null?n(_):_===63?(t.consume(_),C):ae(_)?(s=A,X(_)):(t.consume(_),A)}function C(_){return _===62?B(_):A(_)}function P(_){return ut(_)?(t.consume(_),h):n(_)}function h(_){return _===45||et(_)?(t.consume(_),h):S(_)}function S(_){return ae(_)?(s=S,X(_)):Ae(_)?(t.consume(_),S):B(_)}function y(_){return _===45||et(_)?(t.consume(_),y):_===47||_===62||Ke(_)?g(_):n(_)}function g(_){return _===47?(t.consume(_),B):_===58||_===95||ut(_)?(t.consume(_),m):ae(_)?(s=g,X(_)):Ae(_)?(t.consume(_),g):B(_)}function m(_){return _===45||_===46||_===58||_===95||et(_)?(t.consume(_),m):k(_)}function k(_){return _===61?(t.consume(_),E):ae(_)?(s=k,X(_)):Ae(_)?(t.consume(_),k):g(_)}function E(_){return _===null||_===60||_===61||_===62||_===96?n(_):_===34||_===39?(t.consume(_),i=_,O):ae(_)?(s=E,X(_)):Ae(_)?(t.consume(_),E):(t.consume(_),F)}function O(_){return _===i?(t.consume(_),i=void 0,D):_===null?n(_):ae(_)?(s=O,X(_)):(t.consume(_),O)}function F(_){return _===null||_===34||_===39||_===60||_===61||_===96?n(_):_===47||_===62||Ke(_)?g(_):(t.consume(_),F)}function D(_){return _===47||_===62||Ke(_)?g(_):n(_)}function B(_){return _===62?(t.consume(_),t.exit("htmlTextData"),t.exit("htmlText"),e):n(_)}function X(_){return t.exit("htmlTextData"),t.enter("lineEnding"),t.consume(_),t.exit("lineEnding"),Q}function Q(_){return Ae(_)?Ce(t,Z,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(_):Z(_)}function Z(_){return t.enter("htmlTextData"),s(_)}}const vi={name:"labelEnd",resolveAll:Sh,resolveTo:Ih,tokenize:Rh},Ah={tokenize:Ch},Eh={tokenize:Nh},Mh={tokenize:Lh};function Sh(t){let e=-1;const n=[];for(;++e=3&&(u===null||ae(u))?(t.exit("thematicBreak"),e(u)):n(u)}function l(u){return u===i?(t.consume(u),r++,l):(t.exit("thematicBreakSequence"),Ae(u)?Ce(t,a,"whitespace")(u):a(u))}}const qe={continuation:{tokenize:Hh},exit:$h,name:"list",tokenize:Vh},Uh={partial:!0,tokenize:qh},jh={partial:!0,tokenize:Gh};function Vh(t,e,n){const r=this,i=r.events[r.events.length-1];let o=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,s=0;return a;function a(d){const b=r.containerState.type||(d===42||d===43||d===45?"listUnordered":"listOrdered");if(b==="listUnordered"?!r.containerState.marker||d===r.containerState.marker:qr(d)){if(r.containerState.type||(r.containerState.type=b,t.enter(b,{_container:!0})),b==="listUnordered")return t.enter("listItemPrefix"),d===42||d===45?t.check(Dn,n,u)(d):u(d);if(!r.interrupt||d===49)return t.enter("listItemPrefix"),t.enter("listItemValue"),l(d)}return n(d)}function l(d){return qr(d)&&++s<10?(t.consume(d),l):(!r.interrupt||s<2)&&(r.containerState.marker?d===r.containerState.marker:d===41||d===46)?(t.exit("listItemValue"),u(d)):n(d)}function u(d){return t.enter("listItemMarker"),t.consume(d),t.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||d,t.check(Zn,r.interrupt?n:c,t.attempt(Uh,p,f))}function c(d){return r.containerState.initialBlankLine=!0,o++,p(d)}function f(d){return Ae(d)?(t.enter("listItemPrefixWhitespace"),t.consume(d),t.exit("listItemPrefixWhitespace"),p):n(d)}function p(d){return r.containerState.size=o+r.sliceSerialize(t.exit("listItemPrefix"),!0).length,e(d)}}function Hh(t,e,n){const r=this;return r.containerState._closeFlow=void 0,t.check(Zn,i,o);function i(a){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Ce(t,e,"listItemIndent",r.containerState.size+1)(a)}function o(a){return r.containerState.furtherBlankLines||!Ae(a)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,s(a)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,t.attempt(jh,e,s)(a))}function s(a){return r.containerState._closeFlow=!0,r.interrupt=void 0,Ce(t,t.attempt(qe,e,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a)}}function Gh(t,e,n){const r=this;return Ce(t,i,"listItemIndent",r.containerState.size+1);function i(o){const s=r.events[r.events.length-1];return s&&s[1].type==="listItemIndent"&&s[2].sliceSerialize(s[1],!0).length===r.containerState.size?e(o):n(o)}}function $h(t){t.exit(this.containerState.type)}function qh(t,e,n){const r=this;return Ce(t,i,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(o){const s=r.events[r.events.length-1];return!Ae(o)&&s&&s[1].type==="listItemPrefixWhitespace"?e(o):n(o)}}const Ro={name:"setextUnderline",resolveTo:Yh,tokenize:Kh};function Yh(t,e){let n=t.length,r,i,o;for(;n--;)if(t[n][0]==="enter"){if(t[n][1].type==="content"){r=n;break}t[n][1].type==="paragraph"&&(i=n)}else t[n][1].type==="content"&&t.splice(n,1),!o&&t[n][1].type==="definition"&&(o=n);const s={type:"setextHeading",start:{...t[i][1].start},end:{...t[t.length-1][1].end}};return t[i][1].type="setextHeadingText",o?(t.splice(i,0,["enter",s,e]),t.splice(o+1,0,["exit",t[r][1],e]),t[r][1].end={...t[o][1].end}):t[r][1]=s,t.push(["exit",s,e]),t}function Kh(t,e,n){const r=this;let i;return o;function o(u){let c=r.events.length,f;for(;c--;)if(r.events[c][1].type!=="lineEnding"&&r.events[c][1].type!=="linePrefix"&&r.events[c][1].type!=="content"){f=r.events[c][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||f)?(t.enter("setextHeadingLine"),i=u,s(u)):n(u)}function s(u){return t.enter("setextHeadingLineSequence"),a(u)}function a(u){return u===i?(t.consume(u),a):(t.exit("setextHeadingLineSequence"),Ae(u)?Ce(t,l,"lineSuffix")(u):l(u))}function l(u){return u===null||ae(u)?(t.exit("setextHeadingLine"),e(u)):n(u)}}const Wh={tokenize:Xh};function Xh(t){const e=this,n=t.attempt(Zn,r,t.attempt(this.parser.constructs.flowInitial,i,Ce(t,t.attempt(this.parser.constructs.flow,i,t.attempt(th,i)),"linePrefix")));return n;function r(o){if(o===null){t.consume(o);return}return t.enter("lineEndingBlank"),t.consume(o),t.exit("lineEndingBlank"),e.currentConstruct=void 0,n}function i(o){if(o===null){t.consume(o);return}return t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),e.currentConstruct=void 0,n}}const Zh={resolveAll:la()},Qh=aa("string"),Jh=aa("text");function aa(t){return{resolveAll:la(t==="text"?em:void 0),tokenize:e};function e(n){const r=this,i=this.parser.constructs[t],o=n.attempt(i,s,a);return s;function s(c){return u(c)?o(c):a(c)}function a(c){if(c===null){n.consume(c);return}return n.enter("data"),n.consume(c),l}function l(c){return u(c)?(n.exit("data"),o(c)):(n.consume(c),l)}function u(c){if(c===null)return!0;const f=i[c];let p=-1;if(f)for(;++p-1){const a=s[0];typeof a=="string"?s[0]=a.slice(r):s.shift()}o>0&&s.push(t[i].slice(0,o))}return s}function pm(t,e){let n=-1;const r=[];let i;for(;++n0){const He=oe.tokenStack[oe.tokenStack.length-1];(He[1]||Po).call(oe,void 0,He[0])}for(K.position={start:kt(j.length>0?j[0][1].start:{line:1,column:1,offset:0}),end:kt(j.length>0?j[j.length-2][1].end:{line:1,column:1,offset:0})},we=-1;++we1?"-"+a:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(s)}]};t.patch(e,l);const u={type:"element",tagName:"sup",properties:{},children:[l]};return t.patch(e,u),t.applyData(e,u)}function Sm(t,e){const n={type:"element",tagName:"h"+e.depth,properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function Im(t,e){if(t.options.allowDangerousHtml){const n={type:"raw",value:e.value};return t.patch(e,n),t.applyData(e,n)}}function fa(t,e){const n=e.referenceType;let r="]";if(n==="collapsed"?r+="[]":n==="full"&&(r+="["+(e.label||e.identifier)+"]"),e.type==="imageReference")return[{type:"text",value:"!["+e.alt+r}];const i=t.all(e),o=i[0];o&&o.type==="text"?o.value="["+o.value:i.unshift({type:"text",value:"["});const s=i[i.length-1];return s&&s.type==="text"?s.value+=r:i.push({type:"text",value:r}),i}function Rm(t,e){const n=String(e.identifier).toUpperCase(),r=t.definitionById.get(n);if(!r)return fa(t,e);const i={src:Jt(r.url||""),alt:e.alt};r.title!==null&&r.title!==void 0&&(i.title=r.title);const o={type:"element",tagName:"img",properties:i,children:[]};return t.patch(e,o),t.applyData(e,o)}function Cm(t,e){const n={src:Jt(e.url)};e.alt!==null&&e.alt!==void 0&&(n.alt=e.alt),e.title!==null&&e.title!==void 0&&(n.title=e.title);const r={type:"element",tagName:"img",properties:n,children:[]};return t.patch(e,r),t.applyData(e,r)}function Nm(t,e){const n={type:"text",value:e.value.replace(/\r?\n|\r/g," ")};t.patch(e,n);const r={type:"element",tagName:"code",properties:{},children:[n]};return t.patch(e,r),t.applyData(e,r)}function Lm(t,e){const n=String(e.identifier).toUpperCase(),r=t.definitionById.get(n);if(!r)return fa(t,e);const i={href:Jt(r.url||"")};r.title!==null&&r.title!==void 0&&(i.title=r.title);const o={type:"element",tagName:"a",properties:i,children:t.all(e)};return t.patch(e,o),t.applyData(e,o)}function Pm(t,e){const n={href:Jt(e.url)};e.title!==null&&e.title!==void 0&&(n.title=e.title);const r={type:"element",tagName:"a",properties:n,children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}function Dm(t,e,n){const r=t.all(e),i=n?Om(n):da(e),o={},s=[];if(typeof e.checked=="boolean"){const c=r[0];let f;c&&c.type==="element"&&c.tagName==="p"?f=c:(f={type:"element",tagName:"p",properties:{},children:[]},r.unshift(f)),f.children.length>0&&f.children.unshift({type:"text",value:" "}),f.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:e.checked,disabled:!0},children:[]}),o.className=["task-list-item"]}let a=-1;for(;++a0){const He=oe.tokenStack[oe.tokenStack.length-1];(He[1]||Po).call(oe,void 0,He[0])}for(K.position={start:kt(j.length>0?j[0][1].start:{line:1,column:1,offset:0}),end:kt(j.length>0?j[j.length-2][1].end:{line:1,column:1,offset:0})},we=-1;++we1?"-"+a:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(s)}]};t.patch(e,l);const u={type:"element",tagName:"sup",properties:{},children:[l]};return t.patch(e,u),t.applyData(e,u)}function Rm(t,e){const n={type:"element",tagName:"h"+e.depth,properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function Cm(t,e){if(t.options.allowDangerousHtml){const n={type:"raw",value:e.value};return t.patch(e,n),t.applyData(e,n)}}function fa(t,e){const n=e.referenceType;let r="]";if(n==="collapsed"?r+="[]":n==="full"&&(r+="["+(e.label||e.identifier)+"]"),e.type==="imageReference")return[{type:"text",value:"!["+e.alt+r}];const i=t.all(e),o=i[0];o&&o.type==="text"?o.value="["+o.value:i.unshift({type:"text",value:"["});const s=i[i.length-1];return s&&s.type==="text"?s.value+=r:i.push({type:"text",value:r}),i}function Nm(t,e){const n=String(e.identifier).toUpperCase(),r=t.definitionById.get(n);if(!r)return fa(t,e);const i={src:Jt(r.url||""),alt:e.alt};r.title!==null&&r.title!==void 0&&(i.title=r.title);const o={type:"element",tagName:"img",properties:i,children:[]};return t.patch(e,o),t.applyData(e,o)}function Lm(t,e){const n={src:Jt(e.url)};e.alt!==null&&e.alt!==void 0&&(n.alt=e.alt),e.title!==null&&e.title!==void 0&&(n.title=e.title);const r={type:"element",tagName:"img",properties:n,children:[]};return t.patch(e,r),t.applyData(e,r)}function Pm(t,e){const n={type:"text",value:e.value.replace(/\r?\n|\r/g," ")};t.patch(e,n);const r={type:"element",tagName:"code",properties:{},children:[n]};return t.patch(e,r),t.applyData(e,r)}function Dm(t,e){const n=String(e.identifier).toUpperCase(),r=t.definitionById.get(n);if(!r)return fa(t,e);const i={href:Jt(r.url||"")};r.title!==null&&r.title!==void 0&&(i.title=r.title);const o={type:"element",tagName:"a",properties:i,children:t.all(e)};return t.patch(e,o),t.applyData(e,o)}function Om(t,e){const n={href:Jt(e.url)};e.title!==null&&e.title!==void 0&&(n.title=e.title);const r={type:"element",tagName:"a",properties:n,children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}function zm(t,e,n){const r=t.all(e),i=n?Fm(n):da(e),o={},s=[];if(typeof e.checked=="boolean"){const c=r[0];let f;c&&c.type==="element"&&c.tagName==="p"?f=c:(f={type:"element",tagName:"p",properties:{},children:[]},r.unshift(f)),f.children.length>0&&f.children.unshift({type:"text",value:" "}),f.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:e.checked,disabled:!0},children:[]}),o.className=["task-list-item"]}let a=-1;for(;++a1}function zm(t,e){const n={},r=t.all(e);let i=-1;for(typeof e.start=="number"&&e.start!==1&&(n.start=e.start);++i0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function jm(t){const e=ha(t),n=pa(t);if(e&&n)return{start:e,end:n}}function Vm(t,e){const n=t.all(e),r=n.shift(),i=[];if(r){const s={type:"element",tagName:"thead",properties:{},children:t.wrap([r],!0)};t.patch(e.children[0],s),i.push(s)}if(n.length>0){const s={type:"element",tagName:"tbody",properties:{},children:t.wrap(n,!0)},a=ha(e.children[1]),l=pa(e.children[e.children.length-1]);a&&l&&(s.position={start:a,end:l}),i.push(s)}const o={type:"element",tagName:"table",properties:{},children:t.wrap(i,!0)};return t.patch(e,o),t.applyData(e,o)}function Hm(t,e,n){const r=n?n.children:void 0,o=(r?r.indexOf(e):1)===0?"th":"td",s=n&&n.type==="table"?n.align:void 0,a=s?s.length:e.children.length;let l=-1;const u=[];for(;++l0,!0),r[0]),i=r.index+r[0].length,r=n.exec(e);return o.push(zo(e.slice(i),i>0,!1)),o.join("")}function zo(t,e,n){let r=0,i=t.length;if(e){let o=t.codePointAt(r);for(;o===Do||o===Oo;)r++,o=t.codePointAt(r)}if(n){let o=t.codePointAt(i-1);for(;o===Do||o===Oo;)i--,o=t.codePointAt(i-1)}return i>r?t.slice(r,i):""}function qm(t,e){const n={type:"text",value:$m(String(e.value))};return t.patch(e,n),t.applyData(e,n)}function Ym(t,e){const n={type:"element",tagName:"hr",properties:{},children:[]};return t.patch(e,n),t.applyData(e,n)}const Km={blockquote:Tm,break:km,code:_m,delete:Am,emphasis:Em,footnoteReference:Mm,heading:Sm,html:Im,imageReference:Rm,image:Cm,inlineCode:Nm,linkReference:Lm,link:Pm,listItem:Dm,list:zm,paragraph:Fm,root:Bm,strong:Um,table:Vm,tableCell:Gm,tableRow:Hm,text:qm,thematicBreak:Ym,toml:Rn,yaml:Rn,definition:Rn,footnoteDefinition:Rn};function Rn(){}const ga=-1,Zn=0,Vn=1,Hn=2,bi=3,wi=4,Ti=5,ki=6,ya=7,xa=8,Fo=typeof self=="object"?self:globalThis,Wm=(t,e)=>{const n=(i,o)=>(t.set(o,i),i),r=i=>{if(t.has(i))return t.get(i);const[o,s]=e[i];switch(o){case Zn:case ga:return n(s,i);case Vn:{const a=n([],i);for(const l of s)a.push(r(l));return a}case Hn:{const a=n({},i);for(const[l,u]of s)a[r(l)]=r(u);return a}case bi:return n(new Date(s),i);case wi:{const{source:a,flags:l}=s;return n(new RegExp(a,l),i)}case Ti:{const a=n(new Map,i);for(const[l,u]of s)a.set(r(l),r(u));return a}case ki:{const a=n(new Set,i);for(const l of s)a.add(r(l));return a}case ya:{const{name:a,message:l}=s;return n(new Fo[a](l),i)}case xa:return n(BigInt(s),i);case"BigInt":return n(Object(BigInt(s)),i)}return n(new Fo[o](s),i)};return r},Bo=t=>Wm(new Map,t)(0),jt="",{toString:Xm}={},{keys:Qm}=Object,ln=t=>{const e=typeof t;if(e!=="object"||!t)return[Zn,e];const n=Xm.call(t).slice(8,-1);switch(n){case"Array":return[Vn,jt];case"Object":return[Hn,jt];case"Date":return[bi,jt];case"RegExp":return[wi,jt];case"Map":return[Ti,jt];case"Set":return[ki,jt]}return n.includes("Array")?[Vn,n]:n.includes("Error")?[ya,n]:[Hn,n]},Cn=([t,e])=>t===Zn&&(e==="function"||e==="symbol"),Zm=(t,e,n,r)=>{const i=(s,a)=>{const l=r.push(s)-1;return n.set(a,l),l},o=s=>{if(n.has(s))return n.get(s);let[a,l]=ln(s);switch(a){case Zn:{let c=s;switch(l){case"bigint":a=xa,c=s.toString();break;case"function":case"symbol":if(t)throw new TypeError("unable to serialize "+l);c=null;break;case"undefined":return i([ga],s)}return i([a,c],s)}case Vn:{if(l)return i([l,[...s]],s);const c=[],f=i([a,c],s);for(const p of s)c.push(o(p));return f}case Hn:{if(l)switch(l){case"BigInt":return i([l,s.toString()],s);case"Boolean":case"Number":case"String":return i([l,s.valueOf()],s)}if(e&&"toJSON"in s)return o(s.toJSON());const c=[],f=i([a,c],s);for(const p of Qm(s))(t||!Cn(ln(s[p])))&&c.push([o(p),o(s[p])]);return f}case bi:return i([a,s.toISOString()],s);case wi:{const{source:c,flags:f}=s;return i([a,{source:c,flags:f}],s)}case Ti:{const c=[],f=i([a,c],s);for(const[p,d]of s)(t||!(Cn(ln(p))||Cn(ln(d))))&&c.push([o(p),o(d)]);return f}case ki:{const c=[],f=i([a,c],s);for(const p of s)(t||!Cn(ln(p)))&&c.push(o(p));return f}}const{message:u}=s;return i([a,{name:l,message:u}],s)};return o},Uo=(t,{json:e,lossy:n}={})=>{const r=[];return Zm(!(e||n),!!e,new Map,r)(t),r},Gn=typeof structuredClone=="function"?(t,e)=>e&&("json"in e||"lossy"in e)?Bo(Uo(t,e)):structuredClone(t):(t,e)=>Bo(Uo(t,e));function Jm(t,e){const n=[{type:"text",value:"↩"}];return e>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(e)}]}),n}function eg(t,e){return"Back to reference "+(t+1)+(e>1?"-"+e:"")}function tg(t){const e=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",n=t.options.footnoteBackContent||Jm,r=t.options.footnoteBackLabel||eg,i=t.options.footnoteLabel||"Footnotes",o=t.options.footnoteLabelTagName||"h2",s=t.options.footnoteLabelProperties||{className:["sr-only"]},a=[];let l=-1;for(;++l0&&b.push({type:"text",value:" "});let I=typeof n=="string"?n:n(l,d);typeof I=="string"&&(I={type:"text",value:I}),b.push({type:"element",tagName:"a",properties:{href:"#"+e+"fnref-"+p+(d>1?"-"+d:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(l,d),className:["data-footnote-backref"]},children:Array.isArray(I)?I:[I]})}const v=c[c.length-1];if(v&&v.type==="element"&&v.tagName==="p"){const I=v.children[v.children.length-1];I&&I.type==="text"?I.value+=" ":v.children.push({type:"text",value:" "}),v.children.push(...b)}else c.push(...b);const T={type:"element",tagName:"li",properties:{id:e+"fn-"+p},children:t.wrap(c,!0)};t.patch(u,T),a.push(T)}if(a.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:o,properties:{...Gn(s),id:"footnote-label"},children:[{type:"text",value:i}]},{type:"text",value:`
+`});const u={type:"element",tagName:"li",properties:o,children:s};return t.patch(e,u),t.applyData(e,u)}function Fm(t){let e=!1;if(t.type==="list"){e=t.spread||!1;const n=t.children;let r=-1;for(;!e&&++r1}function Bm(t,e){const n={},r=t.all(e);let i=-1;for(typeof e.start=="number"&&e.start!==1&&(n.start=e.start);++i0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function Hm(t){const e=ha(t),n=pa(t);if(e&&n)return{start:e,end:n}}function Gm(t,e){const n=t.all(e),r=n.shift(),i=[];if(r){const s={type:"element",tagName:"thead",properties:{},children:t.wrap([r],!0)};t.patch(e.children[0],s),i.push(s)}if(n.length>0){const s={type:"element",tagName:"tbody",properties:{},children:t.wrap(n,!0)},a=ha(e.children[1]),l=pa(e.children[e.children.length-1]);a&&l&&(s.position={start:a,end:l}),i.push(s)}const o={type:"element",tagName:"table",properties:{},children:t.wrap(i,!0)};return t.patch(e,o),t.applyData(e,o)}function $m(t,e,n){const r=n?n.children:void 0,o=(r?r.indexOf(e):1)===0?"th":"td",s=n&&n.type==="table"?n.align:void 0,a=s?s.length:e.children.length;let l=-1;const u=[];for(;++l