=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 tf(){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 nf{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 yf{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 xf{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 vf{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 bf{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 Lf=new xt;class Pf{constructor(e={},n={}){this.json=e,this.extensions={},this.plugins={},this.options=n,this.cache=new tf,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||Nf(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&&Rf(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?Mf[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 Of(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 zf(t,e){if(!t){console.warn("No VRM found");return}if(e)return Ea(e,t)}function Ff(){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 Bf(){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 Uf(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 jf(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 Vf=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=Ff(),f=Bf(),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 Uf(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 Of(r.idleAnimation),T=await zf(x,v);if(!T){console.warn("No VRM animation loaded");return}a.value=new Ml(x.scene),a.value.clipAction(T).play(),p.value=jf(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")}}),Hf=["position"],Gf={absolute:"",bottom:"3",right:"3"},$f={flex:"~ row","cursor-pointer":""},qf=["checked","aria-checked"],Yf={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(Ic)),z("TresPerspectiveCamera",{position:[s.value,a.value,l.value]},null,8,Hf),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(Vf,{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",Gf,[z("div",$f,[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,qf),[[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",Yf,[z("div",Kf,[z("div",Wf,[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",Xf,ge(H(d)("stage.viewers.debug-menu.vrm.camera")),1)]),default:Be(()=>[z("div",Qf,[x[17]||(x[17]=z("div",{text:"zinc-400 dark:zinc-500"},[z("span",null,"X")],-1)),z("label",Zf,[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",Jf,[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",ed,[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",td,[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",nd,[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",rd,[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",id,ge(H(d)("stage.viewers.debug-menu.vrm.model.title")),1)]),default:Be(()=>[z("div",od,[x[20]||(x[20]=z("div",{text:"zinc-400 dark:zinc-500"},[z("span",null,"X")],-1)),z("label",sd,[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",ad,[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",ld,[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",ud,[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",cd,[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",fd,[z("span",null,ge(f.value),1)])])]),_:1}),z("div",dd,[z("span",null,ge(H(d)("stage.viewers.debug-menu.emotions")),1)]),z("div",pd,[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}))}}),md=["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 gd=0;const fe=zt(),Le=zt(),Us=zt(),$=zt(),Re=zt(),Yt=zt(),Ze=zt();function zt(){return 2**++gd}const Gr=Object.freeze(Object.defineProperty({__proto__:null,boolean:fe,booleanish:Le,commaOrSpaceSeparated:Ze,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"&&bd.test(e)){if(e.charAt(4)==="-"){const o=e.slice(5).replace(go,kd);r="data"+o.charAt(0).toUpperCase()+o.slice(1)}else{const o=e.slice(4);if(!go.test(o)){let s=o.replace(vd,Td);s.charAt(0)!=="-"&&(s="-"+s),e="data"+s}}i=hi}return new i(r,e)}function Td(t){return"-"+t.toLowerCase()}function kd(t){return t.charAt(1).toUpperCase()}const _d=Bs([js,yd,Gs,$s,qs],"html"),Ys=Bs([js,xd,Gs,$s,qs],"svg"),yo={}.hasOwnProperty;function Ad(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 Ed=/^>|^->||--!>|"],Sd=["<",">"];function Id(t,e,n,r){return r.settings.bogusComments?""+$t(t.value,Object.assign({},r.settings.characterReferences,{subset:Md}))+">":"";function i(o){return $t(o,Object.assign({},r.settings.characterReferences,{subset:Sd}))}}function Rd(t,e,n,r){return""}function Cd(t,e){const n=e||{};return(t[t.length-1]===""?[...t,""]:t).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}function Nd(t){return t.join(" ").trim()}const Ld=/[ \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(Ld,"")===""}const De=Ws(1),Ks=Ws(-1),Pd=[];function Ws(t){return e;function e(n,r,i){const o=n?n.children:Pd;let s=(r||0)+t,a=o[s];if(!i)for(;a&&mi(a);)s+=t,a=o[s];return a}}const Dd={}.hasOwnProperty;function Xs(t){return e;function e(n,r,i){return Dd.call(t,n.tagName)&&t[n.tagName](n,r,i)}}const gi=Xs({body:zd,caption:wr,colgroup:wr,dd:jd,dt:Ud,head:wr,html:Od,li:Bd,optgroup:Vd,option:Hd,p:Fd,rp:vo,rt:vo,tbody:$d,td:bo,tfoot:qd,th:bo,thead:Gd,tr:Yd});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 Od(t,e,n){const r=De(n,e);return!r||r.type!=="comment"}function zd(t,e,n){const r=De(n,e);return!r||r.type!=="comment"}function Fd(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 Bd(t,e,n){const r=De(n,e);return!r||r.type==="element"&&r.tagName==="li"}function Ud(t,e,n){const r=De(n,e);return!!(r&&r.type==="element"&&(r.tagName==="dt"||r.tagName==="dd"))}function jd(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 Vd(t,e,n){const r=De(n,e);return!r||r.type==="element"&&r.tagName==="optgroup"}function Hd(t,e,n){const r=De(n,e);return!r||r.type==="element"&&(r.tagName==="option"||r.tagName==="optgroup")}function Gd(t,e,n){const r=De(n,e);return!!(r&&r.type==="element"&&(r.tagName==="tbody"||r.tagName==="tfoot"))}function $d(t,e,n){const r=De(n,e);return!r||r.type==="element"&&(r.tagName==="tbody"||r.tagName==="tfoot")}function qd(t,e,n){return!De(n,e)}function Yd(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 Kd=Xs({body:Qd,colgroup:Zd,head:Xd,html:Wd,tbody:Jd});function Wd(t){const e=De(t,-1);return!e||e.type!=="comment"}function Xd(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 Qd(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 Zd(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 Jd(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 a=i.space==="svg"?r.settings.closeEmptyElements:r.settings.voids.includes(t.tagName.toLowerCase());const s=[];let l;i.space==="html"&&t.tagName==="svg"&&(r.schema=Ya);const u=tp(r,t.properties),c=r.all(i.space==="html"&&t.tagName==="template"?t.content:t);return r.schema=i,c&&(a=!1),(u||!o||!Kd(t,e,n))&&(s.push("<",t.tagName,u?" "+u:""),a&&(i.space==="svg"||r.settings.closeSelfClosing)&&(l=u.charAt(u.length-1),(!r.settings.tightSelfClosing||l==="/"||l&&l!=='"'&&l!=="'")&&s.push(" "),s.push("/")),s.push(">")),s.push(c),!a&&(!o||!gi(t,e,n))&&s.push(""+t.tagName+">"),s.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)&&(a=t.alternative),s=a+$t(n,Object.assign({},t.settings.characterReferences,{subset:(a==="'"?In.single:In.double)[i][o],attribute:!0}))+a),l+(s&&"="+s))}const rp=["<","&"];function Qa(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:Qa(t,e,n,r)}function op(t,e,n,r){return r.all(t)}const ap=Ad("type",{invalid:sp,unknown:lp,handlers:{comment:Id,doctype:Rd,element:ep,raw:ip,root:op,text:Qa}});function sp(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"?Ya:_d,quote:r,alternative:i}.one(Array.isArray(t)?{type:"root",children:t}:t,void 0,void 0)}function pp(t,e,n){return ap(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)a=Array.from(r),a.unshift(e,n),t.splice(...a);else for(n&&t.splice(e,n);o0?(ct(t,t.length,0,e),t):e}const ko={}.hasOwnProperty;function xp(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 se(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 s=t.charCodeAt(n+1);o<56320&&s>56319&&s<57344?(a=String.fromCharCode(o,s),i=1):a="�"}else a=String.fromCharCode(o);a&&(e.push(t.slice(r,n),encodeURIComponent(a)),r=n+i+1,a=""),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 a;function a(l){return Ae(l)?(t.enter(n),s(l)):e(l)}function s(l){return Ae(l)&&o++a))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 vi(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),a={type:l>1?"strongSequence":"emphasisSequence",start:f,end:{...t[r][1].end}},s={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:{...a.start},end:{...s.end}},t[r][1].end={...a.start},t[n][1].start={...s.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",a,e],["exit",a,e],["enter",o,e]]),u=rt(u,vi(e.parser.constructs.insideSpan.null,t.slice(r+1,n),e)),u=rt(u,[["exit",o,e],["enter",s,e],["exit",s,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||se(h)?t.check(Mo,v,C)(h):(t.enter("codeFlowValue"),A(h))}function A(h){return h===null||se(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===s?(h.enter("codeFencedFenceSequence"),O(D)):y(D)}function O(D){return D===s?(g++,h.consume(D),O):g>=a?(h.exit("codeFencedFenceSequence"),Ae(D)?Ce(h,F,"whitespace")(D):F(D)):y(D)}function F(D){return D===null||se(D)?(h.exit("codeFencedFence"),S(D)):y(D)}}}function Hp(t,e,n){const r=this;return i;function i(a){return a===null?n(a):(t.enter("lineEnding"),t.consume(a),t.exit("lineEnding"),o)}function o(a){return r.parser.lazy[r.now().line]?n(a):e(a)}}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?a(u):n(u)}function a(u){return u===null?l(u):se(u)?t.attempt(Gp,a,l)(u):(t.enter("codeFlowValue"),s(u))}function s(u){return u===null||se(u)?(t.exit("codeFlowValue"),a(u)):(t.consume(u),s)}function l(u){return t.exit("codeIndented"),e(u)}}function qp(t,e,n){const r=this;return i;function i(a){return r.parser.lazy[r.now().line]?n(a):se(a)?(t.enter("lineEnding"),t.consume(a),t.exit("lineEnding"),i):Ce(t,o,"linePrefix",5)(a)}function o(a){const s=r.events[r.events.length-1];return s&&s[1].type==="linePrefix"&&s[2].sliceSerialize(s[1],!0).length>=4?e(a):se(a)?i(a):n(a)}}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&&sn(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),sn(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),sn(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(a):t.interrupt(r.parser.constructs.flow,n,e)(a)}}function is(t,e,n,r,i,o,a,s,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(a),t.enter(s),t.enter("chunkString",{contentType:"string"}),v(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(s),t.enter("chunkString",{contentType:"string"}),d(T))}function d(T){return T===62?(t.exit("chunkString"),t.exit(s),p(T)):T===null||T===60||se(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 v(T){return!c&&(T===null||T===41||Ke(T))?(t.exit("chunkString"),t.exit(s),t.exit(a),t.exit(r),e(T)):c999||d===null||d===91||d===93&&!l||d===94&&!s&&"_hiddenFootnoteSupport"in a.parser.constructs?n(d):d===93?(t.exit(o),t.enter(i),t.consume(d),t.exit(i),t.exit(r),e):se(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||se(d)||s++>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),s++,f):f(d)}}function as(t,e,n,r,i,o){let a;return s;function s(p){return p===34||p===39||p===40?(t.enter(r),t.enter(i),t.consume(p),t.exit(i),a=p===40?41:p,l):n(p)}function l(p){return p===a?(t.enter(i),t.consume(p),t.exit(i),t.exit(r),e):(t.enter(o),u(p))}function u(p){return p===a?(t.exit(o),l(a)):p===null?n(p):se(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===a||p===null||se(p)?(t.exit("chunkString"),u(p)):(t.consume(p),p===92?f:c)}function f(p){return p===a||p===92?(t.consume(p),c):c(p)}}function fn(t,e){let n;return r;function r(i){return se(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:ah},oh={partial:!0,tokenize:sh};function ah(t,e,n){const r=this;let i;return o;function o(d){return t.enter("definition"),a(d)}function a(d){return os.call(r,t,s,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(d)}function s(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 is(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||se(d)?(t.exit("definition"),r.parser.defined.push(i),e(d)):n(d)}}function sh(t,e,n){return r;function r(s){return Ke(s)?fn(t,i)(s):n(s)}function i(s){return as(t,o,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(s)}function o(s){return Ae(s)?Ce(t,a,"whitespace")(s):a(s)}function a(s){return s===null||se(s)?e(s):n(s)}}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 se(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"),a(c)}function a(c){return c===35&&r++<6?(t.consume(c),a):c===null||Ke(c)?(t.exit("atxHeadingSequence"),s(c)):n(c)}function s(c){return c===35?(t.enter("atxHeadingSequence"),l(c)):c===null||se(c)?(t.exit("atxHeading"),e(c)):Ae(c)?Ce(t,s,"whitespace")(c):(t.enter("atxHeadingText"),u(c))}function l(c){return c===35?(t.consume(c),l):(t.exit("atxHeadingSequence"),s(c))}function u(c){return c===null||c===35||Ke(c)?(t.exit("atxHeadingText"),s(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:vh},mh={partial:!0,tokenize:bh},gh={partial:!0,tokenize:xh};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 vh(t,e,n){const r=this;let i,o,a,s,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,v):R===63?(t.consume(R),i=3,r.interrupt?e:_):ut(R)?(t.consume(R),a=String.fromCharCode(R),x):n(R)}function p(R){return R===45?(t.consume(R),i=2,d):R===91?(t.consume(R),i=5,s=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(s++)?(t.consume(R),s===pe.length?r.interrupt?e:E:b):n(R)}function v(R){return ut(R)?(t.consume(R),a=String.fromCharCode(R),x):n(R)}function x(R){if(R===null||R===47||R===62||Ke(R)){const pe=R===47,ye=a.toLowerCase();return!pe&&!o&&Io.includes(ye)?(i=1,r.interrupt?e(R):E(R)):ph.includes(a.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),a+=String.fromCharCode(R),x):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||se(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||se(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):se(R)&&(i===6||i===7)?(t.exit("htmlFlowData"),t.check(mh,ce,O)(R)):R===null||se(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||se(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),a="",Z):E(R)}function Z(R){if(R===62){const pe=a.toLowerCase();return Io.includes(pe)?(t.consume(R),te):E(R)}return ut(R)&&a.length<8?(t.consume(R),a+=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||se(R)?(t.exit("htmlFlowData"),ce(R)):(t.consume(R),te)}function ce(R){return t.exit("htmlFlow"),e(R)}}function xh(t,e,n){const r=this;return i;function i(a){return se(a)?(t.enter("lineEnding"),t.consume(a),t.exit("lineEnding"),o):n(a)}function o(a){return r.parser.lazy[r.now().line]?n(a):e(a)}}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,a;return s;function s(_){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):se(_)?(a=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?v:b):n(_)}function v(_){return _===null?n(_):_===93?(t.consume(_),x):se(_)?(a=v,X(_)):(t.consume(_),v)}function x(_){return _===93?(t.consume(_),T):v(_)}function T(_){return _===62?B(_):_===93?(t.consume(_),T):v(_)}function I(_){return _===null||_===62?B(_):se(_)?(a=I,X(_)):(t.consume(_),I)}function A(_){return _===null?n(_):_===63?(t.consume(_),C):se(_)?(a=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 se(_)?(a=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):se(_)?(a=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):se(_)?(a=k,X(_)):Ae(_)?(t.consume(_),k):g(_)}function E(_){return _===null||_===60||_===61||_===62||_===96?n(_):_===34||_===39?(t.consume(_),i=_,O):se(_)?(a=E,X(_)):Ae(_)?(t.consume(_),E):(t.consume(_),F)}function O(_){return _===i?(t.consume(_),i=void 0,D):_===null?n(_):se(_)?(a=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"),a(_)}}const xi={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||se(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,s,"whitespace")(u):s(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,a=0;return s;function s(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)&&++a<10?(t.consume(d),l):(!r.interrupt||a<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(s){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Ce(t,e,"listItemIndent",r.containerState.size+1)(s)}function o(s){return r.containerState.furtherBlankLines||!Ae(s)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,a(s)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,t.attempt(Bh,e,a)(s))}function a(s){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)(s)}}function Vh(t,e,n){const r=this;return Ce(t,i,"listItemIndent",r.containerState.size+1);function i(o){const a=r.events[r.events.length-1];return a&&a[1].type==="listItemIndent"&&a[2].sliceSerialize(a[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 a=r.events[r.events.length-1];return!Ae(o)&&a&&a[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 a={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",a,e]),t.splice(o+1,0,["exit",t[r][1],e]),t[r][1].end={...t[o][1].end}):t[r][1]=a,t.push(["exit",a,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,a(u)):n(u)}function a(u){return t.enter("setextHeadingLineSequence"),s(u)}function s(u){return u===i?(t.consume(u),s):(t.exit("setextHeadingLineSequence"),Ae(u)?Ce(t,l,"lineSuffix")(u):l(u))}function l(u){return u===null||se(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:ls()},Xh=ss("string"),Qh=ss("text");function ss(t){return{resolveAll:ls(t==="text"?Zh:void 0),tokenize:e};function e(n){const r=this,i=this.parser.constructs[t],o=n.attempt(i,a,s);return a;function a(c){return u(c)?o(c):s(c)}function s(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 s=a[0];typeof s=="string"?a[0]=s.slice(r):a.shift()}o>0&&a.push(t[i].slice(0,o))}return a}function fm(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;++we\``.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(;++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?"-"+s:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(a)}]};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 fs(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 a=i[i.length-1];return a&&a.type==="text"?a.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 fs(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 fs(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):ds(e),o={},a=[];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 s=-1;for(;++s1}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=hs(t),n=ps(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 a={type:"element",tagName:"thead",properties:{},children:t.wrap([r],!0)};t.patch(e.children[0],a),i.push(a)}if(n.length>0){const a={type:"element",tagName:"tbody",properties:{},children:t.wrap(n,!0)},s=hs(e.children[1]),l=ps(e.children[e.children.length-1]);s&&l&&(a.position={start:s,end:l}),i.push(a)}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",a=n&&n.type==="table"?n.align:void 0,s=a?a.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 gs=-1,Zn=0,Vn=1,Hn=2,bi=3,wi=4,Ti=5,ki=6,ys=7,vs=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,a]=e[i];switch(o){case Zn:case gs:return n(a,i);case Vn:{const s=n([],i);for(const l of a)s.push(r(l));return s}case Hn:{const s=n({},i);for(const[l,u]of a)s[r(l)]=r(u);return s}case bi:return n(new Date(a),i);case wi:{const{source:s,flags:l}=a;return n(new RegExp(s,l),i)}case Ti:{const s=n(new Map,i);for(const[l,u]of a)s.set(r(l),r(u));return s}case ki:{const s=n(new Set,i);for(const l of a)s.add(r(l));return s}case ys:{const{name:s,message:l}=a;return n(new Fo[s](l),i)}case vs:return n(BigInt(a),i);case"BigInt":return n(Object(BigInt(a)),i)}return n(new Fo[o](a),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")?[ys,n]:[Hn,n]},Cn=([t,e])=>t===Zn&&(e==="function"||e==="symbol"),Zm=(t,e,n,r)=>{const i=(a,s)=>{const l=r.push(a)-1;return n.set(s,l),l},o=a=>{if(n.has(a))return n.get(a);let[s,l]=ln(a);switch(s){case Zn:{let c=a;switch(l){case"bigint":s=vs,c=a.toString();break;case"function":case"symbol":if(t)throw new TypeError("unable to serialize "+l);c=null;break;case"undefined":return i([gs],a)}return i([s,c],a)}case Vn:{if(l)return i([l,[...a]],a);const c=[],f=i([s,c],a);for(const p of a)c.push(o(p));return f}case Hn:{if(l)switch(l){case"BigInt":return i([l,a.toString()],a);case"Boolean":case"Number":case"String":return i([l,a.valueOf()],a)}if(e&&"toJSON"in a)return o(a.toJSON());const c=[],f=i([s,c],a);for(const p of Qm(a))(t||!Cn(ln(a[p])))&&c.push([o(p),o(a[p])]);return f}case bi:return i([s,a.toISOString()],a);case wi:{const{source:c,flags:f}=a;return i([s,{source:c,flags:f}],a)}case Ti:{const c=[],f=i([s,c],a);for(const[p,d]of a)(t||!(Cn(ln(p))||Cn(ln(d))))&&c.push([o(p),o(d)]);return f}case ki:{const c=[],f=i([s,c],a);for(const p of a)(t||!Cn(ln(p)))&&c.push(o(p));return f}}const{message:u}=a;return i([s,{name:l,message:u}],a)};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",a=t.options.footnoteLabelProperties||{className:["sr-only"]},s=[];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 x=c[c.length-1];if(x&&x.type==="element"&&x.tagName==="p"){const I=x.children[x.children.length-1];I&&I.type==="text"?I.value+=" ":x.children.push({type:"text",value:" "}),x.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),s.push(T)}if(s.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:o,properties:{...Gn(a),id:"footnote-label"},children:[{type:"text",value:i}]},{type:"text",value:`
-`},{type:"element",tagName:"ol",properties:{},children:t.wrap(s,!0)},{type:"text",value:`
-`}]}}const xs=function(t){if(t==null)return og;if(typeof t=="function")return Jn(t);if(typeof t=="object")return Array.isArray(t)?ng(t):rg(t);if(typeof t=="string")return ig(t);throw new Error("Expected function, string, or object as test")};function ng(t){const e=[];let n=-1;for(;++n":""))+")"})}return p;function p(){let d=bs,b,v,x;if((!e||o(l,u,c[c.length-1]||void 0))&&(d=cg(n(l,c)),d[0]===jo))return d;if("children"in l&&l.children){const T=l;if(T.children&&d[0]!==lg)for(v=(r?T.children.length:-1)+a,x=c.concat(T);v>-1&&v1?"-"+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(;++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:`
+`},{type:"element",tagName:"ol",properties:{},children:t.wrap(a,!0)},{type:"text",value:`
+`}]}}const va=function(t){if(t==null)return og;if(typeof t=="function")return Jn(t);if(typeof t=="object")return Array.isArray(t)?ng(t):rg(t);if(typeof t=="string")return ig(t);throw new Error("Expected function, string, or object as test")};function ng(t){const e=[];let n=-1;for(;++n":""))+")"})}return p;function p(){let d=ba,b,x,v;if((!e||o(l,u,c[c.length-1]||void 0))&&(d=cg(n(l,c)),d[0]===jo))return d;if("children"in l&&l.children){const T=l;if(T.children&&d[0]!==lg)for(x=(r?T.children.length:-1)+s,v=c.concat(T);x>-1&&x0&&n.push({type:"text",value:`
`}),n}function Vo(t){let e=0,n=t.charCodeAt(e);for(;n===9||n===32;)e++,n=t.charCodeAt(e);return t.slice(e)}function Ho(t,e){const n=pg(t,e),r=n.one(t,void 0),i=tg(n),o=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return i&&o.children.push({type:"text",value:`
-`},i),o}function vg(t,e){return t&&"run"in t?async function(n,r){const i=Ho(n,{file:r,...e});await t.run(i,r)}:function(n,r){return Ho(n,{file:r,...t||e})}}function Go(t){if(t)throw t}var _r,$o;function xg(){if($o)return _r;$o=1;var t=Object.prototype.hasOwnProperty,e=Object.prototype.toString,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=function(u){return typeof Array.isArray=="function"?Array.isArray(u):e.call(u)==="[object Array]"},o=function(u){if(!u||e.call(u)!=="[object Object]")return!1;var c=t.call(u,"constructor"),f=u.constructor&&u.constructor.prototype&&t.call(u.constructor.prototype,"isPrototypeOf");if(u.constructor&&!c&&!f)return!1;var p;for(p in u);return typeof p>"u"||t.call(u,p)},a=function(u,c){n&&c.name==="__proto__"?n(u,c.name,{enumerable:!0,configurable:!0,value:c.newValue,writable:!0}):u[c.name]=c.newValue},s=function(u,c){if(c==="__proto__")if(t.call(u,c)){if(r)return r(u,c).value}else return;return u[c]};return _r=function l(){var u,c,f,p,d,b,v=arguments[0],x=1,T=arguments.length,I=!1;for(typeof v=="boolean"&&(I=v,v=arguments[1]||{},x=2),(v==null||typeof v!="object"&&typeof v!="function")&&(v={});xa.length;let l;s&&a.push(i);try{l=t.apply(this,a)}catch(u){const c=u;if(s&&n)throw c;return i(c)}s||(l&&l.then&&typeof l.then=="function"?l.then(o,i):l instanceof Error?i(l):o(l))}function i(a,...s){n||(n=!0,e(a,...s))}function o(a){i(null,a)}}class Xe extends Error{constructor(e,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let i="",o={},a=!1;if(n&&("line"in n&&"column"in n?o={place:n}:"start"in n&&"end"in n?o={place:n}:"type"in n?o={ancestors:[n],place:n.position}:o={...n}),typeof e=="string"?i=e:!o.cause&&e&&(a=!0,i=e.message,o.cause=e),!o.ruleId&&!o.source&&typeof r=="string"){const l=r.indexOf(":");l===-1?o.ruleId=r:(o.source=r.slice(0,l),o.ruleId=r.slice(l+1))}if(!o.place&&o.ancestors&&o.ancestors){const l=o.ancestors[o.ancestors.length-1];l&&(o.place=l.position)}const s=o.place&&"start"in o.place?o.place.start:o.place;this.ancestors=o.ancestors||void 0,this.cause=o.cause||void 0,this.column=s?s.column:void 0,this.fatal=void 0,this.file,this.message=i,this.line=s?s.line:void 0,this.name=dn(o.place)||"1:1",this.place=o.place||void 0,this.reason=this.message,this.ruleId=o.ruleId||void 0,this.source=o.source||void 0,this.stack=a&&o.cause&&typeof o.cause.stack=="string"?o.cause.stack:"",this.actual,this.expected,this.note,this.url}}Xe.prototype.file="";Xe.prototype.name="";Xe.prototype.reason="";Xe.prototype.message="";Xe.prototype.stack="";Xe.prototype.column=void 0;Xe.prototype.line=void 0;Xe.prototype.ancestors=void 0;Xe.prototype.cause=void 0;Xe.prototype.fatal=void 0;Xe.prototype.place=void 0;Xe.prototype.ruleId=void 0;Xe.prototype.source=void 0;const lt={basename:kg,dirname:_g,extname:Ag,join:Eg,sep:"/"};function kg(t,e){if(e!==void 0&&typeof e!="string")throw new TypeError('"ext" argument must be a string');wn(t);let n=0,r=-1,i=t.length,o;if(e===void 0||e.length===0||e.length>t.length){for(;i--;)if(t.codePointAt(i)===47){if(o){n=i+1;break}}else r<0&&(o=!0,r=i+1);return r<0?"":t.slice(n,r)}if(e===t)return"";let a=-1,s=e.length-1;for(;i--;)if(t.codePointAt(i)===47){if(o){n=i+1;break}}else a<0&&(o=!0,a=i+1),s>-1&&(t.codePointAt(i)===e.codePointAt(s--)?s<0&&(r=i):(s=-1,r=a));return n===r?r=a:r<0&&(r=t.length),t.slice(n,r)}function _g(t){if(wn(t),t.length===0)return".";let e=-1,n=t.length,r;for(;--n;)if(t.codePointAt(n)===47){if(r){e=n;break}}else r||(r=!0);return e<0?t.codePointAt(0)===47?"/":".":e===1&&t.codePointAt(0)===47?"//":t.slice(0,e)}function Ag(t){wn(t);let e=t.length,n=-1,r=0,i=-1,o=0,a;for(;e--;){const s=t.codePointAt(e);if(s===47){if(a){r=e+1;break}continue}n<0&&(a=!0,n=e+1),s===46?i<0?i=e:o!==1&&(o=1):i>-1&&(o=-1)}return i<0||n<0||o===0||o===1&&i===n-1&&i===r+1?"":t.slice(i,n)}function Eg(...t){let e=-1,n;for(;++e0&&t.codePointAt(t.length-1)===47&&(n+="/"),e?"/"+n:n}function Sg(t,e){let n="",r=0,i=-1,o=0,a=-1,s,l;for(;++a<=t.length;){if(a2){if(l=n.lastIndexOf("/"),l!==n.length-1){l<0?(n="",r=0):(n=n.slice(0,l),r=n.length-1-n.lastIndexOf("/")),i=a,o=0;continue}}else if(n.length>0){n="",r=0,i=a,o=0;continue}}e&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+t.slice(i+1,a):n=t.slice(i+1,a),r=a-i-1;i=a,o=0}else s===46&&o>-1?o++:o=-1}return n}function wn(t){if(typeof t!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(t))}const Ig={cwd:Rg};function Rg(){return"/"}function Qr(t){return!!(t!==null&&typeof t=="object"&&"href"in t&&t.href&&"protocol"in t&&t.protocol&&t.auth===void 0)}function Cg(t){if(typeof t=="string")t=new URL(t);else if(!Qr(t)){const e=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+t+"`");throw e.code="ERR_INVALID_ARG_TYPE",e}if(t.protocol!=="file:"){const e=new TypeError("The URL must be of scheme file");throw e.code="ERR_INVALID_URL_SCHEME",e}return Ng(t)}function Ng(t){if(t.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const e=t.pathname;let n=-1;for(;++n0){let[d,...b]=c;const v=r[p][1];Xr(v)&&Xr(d)&&(d=Ar(!0,v,d)),r[p]=[u,d,...b]}}}}const zg=new _i().freeze();function Ir(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `parser`")}function Rr(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `compiler`")}function Cr(t,e){if(e)throw new Error("Cannot call `"+t+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function Yo(t){if(!Xr(t)||typeof t.type!="string")throw new TypeError("Expected node, got `"+t+"`")}function Ko(t,e,n){if(!n)throw new Error("`"+t+"` finished async. Use `"+e+"` instead")}function Nn(t){return Fg(t)?t:new Lg(t)}function Fg(t){return!!(t&&typeof t=="object"&&"message"in t&&"messages"in t)}function Bg(t){return typeof t=="string"||Ug(t)}function Ug(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}function Ai(){const t=zg().use(wm).use(vg).use(mp);return{process:e=>t.processSync(e).toString()}}const jg={relative:""},Vg={"h-full":"","w-full":""},Hg={key:0,class:"animate-stripe",absolute:"",left:"1/2",bottom:"20%",z:"20","rounded-2xl":"",text:"primary-600","px-2":"","py-2":"",transform:"translate-x--1/2"},Gg={bg:"primary-50","rounded-xl":"","px-10":"","py-6":""},$g=["innerHTML"],qg=ze({__name:"Stage",props:{paused:{type:Boolean,default:!1}},setup(t){const e=W(),n=W(),{stageView:r}=Ye(Wt()),{mouthOpenSize:i}=Ye(iu()),{audioContext:o,calculateVolume:a}=ga(),{onBeforeMessageComposed:s,onBeforeSend:l,onTokenLiteral:u,onTokenSpecial:c,onStreamEnd:f,streamingMessage:p,onAssistantResponseEnd:d}=St(),{process:b}=Ai(),v=ui(),x=W(),T=W(!1),I=W(!1),A=or({handlers:[_=>new Promise(te=>{const ce=o.createBufferSource();ce.buffer=_.data.audioBuffer,ce.connect(o.destination),ce.connect(x.value),T.value=!0,ce.start(0),ce.onended=()=>{T.value=!1,te()}})]}),C=Fl(),{ssmlEnabled:P,activeSpeechProvider:h,activeSpeechModel:S,activeSpeechVoice:y,pitch:g}=Ye(C);async function m(_){try{if(!h.value){console.warn("No active speech provider configured");return}if(!y.value){console.warn("No active speech voice configured");return}const te=v.getProviderInstance(h.value);if(!te){console.error("Failed to initialize speech provider");return}const ce=v.getProviderConfig(h.value),R=P.value?C.generateSSML(_.data,y.value,{...ce,pitch:g.value}):_.data,pe=await Bl({...te.speech(S.value,ce),input:R,voice:y.value.id}),ye=await o.decodeAudioData(pe);await A.add({audioBuffer:ye,text:_.data})}catch(te){console.error("Speech generation failed:",te)}}const k=or({handlers:[m]});k.on("add",_=>{console.debug("ttsQueue added",_)});const E=Ul(k),{live2dCurrentMotion:O}=Ye(Wt()),F=or({handlers:[async _=>{if(r.value==="3d"){const te=Ls[_.data];if(!te)return;await n.value.setExpression(te)}else r.value==="2d"&&(O.value={group:Ps[_.data]})}]}),D=jl(F);D.onHandlerEvent("emotion",_=>{console.debug("emotion detected",_)});const B=Vl();B.onHandlerEvent("delay",_=>{console.debug("delay detected",_)});function X(){requestAnimationFrame(X),T.value&&(i.value=a(x.value,"linear"))}function Z(){I.value||(X(),o.resume(),I.value=!0)}function Q(){x.value||(x.value=o.createAnalyser())}return s(async()=>{Q(),Z()}),l(async()=>{O.value={group:Si}}),u(async _=>{await E.add(_)}),c(async _=>{await B.add(_),await D.add(_)}),f(async()=>{await B.add(Hl)}),d(async _=>{}),Ot(()=>{var te,ce,R;I.value=!1;const _=window;(te=_.electron)==null||te.ipcRenderer.removeAllListeners("before-hide"),(ce=_.electron)==null||ce.ipcRenderer.removeAllListeners("after-show"),(R=_.electron)==null||R.ipcRenderer.removeAllListeners("before-quit")}),pn(()=>{var te,ce,R;const _=window;(te=_.electron)==null||te.ipcRenderer.on("before-hide",()=>{O.value={group:Is}}),(ce=_.electron)==null||ce.ipcRenderer.on("after-show",()=>{O.value={group:Rs}}),(R=_.electron)==null||R.ipcRenderer.on("before-quit",()=>{O.value={group:Si}})}),pn(async()=>{e.value=Cs("duckdb-wasm://?bundles=import-url"),await e.value.execute(Ns`CREATE TABLE memory_test (vec FLOAT[768]);`)}),(_,te)=>(ee(),ie("div",jg,[z("div",Vg,[H(r)==="2d"?(ee(),Xt(bu,{key:0,"mouth-open-size":H(i),"min-w":"50% (ee(),ie("header",Zg,[z("div",Jg,[ke(Jl)]),ke(H(Rl),{class:"m-1 block max-h-[10lh] min-h-[1lh] rounded-lg bg-zinc-100 p-2 text-lg text-zinc-500 outline-none dark:bg-zinc-800 dark:text-zinc-400",to:"/settings"},{default:Be(()=>n[0]||(n[0]=[z("div",{"i-solar:settings-minimalistic-bold-duotone":""},null,-1)])),_:1})]))}});function ws(t,e){const n=fa(e??{},{...zi.getDefaultRealTimeVADOptions("v5"),preSpeechPadFrames:30,positiveSpeechThreshold:.5,negativeSpeechThreshold:.35,minSpeechFrames:30,auto:!0}),r=W(),i=Cl("microphone");async function o(){if(r.value&&(r.value.destroy(),r.value=void 0,console.warn("existing MicVAD destroyed")),!i.value)return;const a=H(t);if(!a)return;const s=await navigator.mediaDevices.getUserMedia({audio:{deviceId:a}});r.value=await zi.MicVAD.new({...n,stream:s}),n.auto&&r.value.start()}return je(i,o,{immediate:!0}),je(Nl(t),o,{immediate:!0}),Ll(o),Ot(()=>{r.value&&(r.value.destroy(),r.value=void 0)}),{destroy:()=>{r.value&&(r.value.destroy(),r.value=void 0)},start:()=>{r.value&&r.value.start()}}}function ty(t,e){const n=fa(e,{onLoading:()=>{},onInitiate:()=>{},onProgress:()=>{},onDone:()=>{},onReady:()=>{},onStart:()=>{},onUpdate:()=>{},onComplete:()=>{}}),{post:r,data:i,terminate:o}=Pl(t,{type:"module"}),a=W(null),s=W(""),l=W([]),u=W(!1),c=W(0),f=W("");return je(i,p=>{var d,b,v,x,T,I,A,C;switch(p.status){case"loading":a.value="loading",s.value=p.data,(d=n.onLoading)==null||d.call(n,p.data);break;case"initiate":l.value.push(p),(b=n.onInitiate)==null||b.call(n,p);break;case"progress":l.value=l.value.map(P=>P.file===p.file?{...P,...p}:P),(v=n.onProgress)==null||v.call(n,p);break;case"done":l.value=l.value.filter(P=>P.file!==p.file),(x=n.onDone)==null||x.call(n,p);break;case"ready":a.value="ready",(T=n.onReady)==null||T.call(n);break;case"start":u.value=!0,(I=n.onStart)==null||I.call(n);break;case"update":c.value=p.tps,(A=n.onUpdate)==null||A.call(n,p.tps);break;case"complete":u.value=!1,f.value=p.output[0]||"",console.debug("Whisper result:",f.value),(C=n.onComplete)==null||C.call(n,p.output[0]);break}}),Ot(()=>{o()}),{transcribe:p=>r(p),status:a,loadingMessage:s,loadingProgress:l,transcribing:u,tps:c,result:f,load:()=>r({type:"load"}),terminate:o}}const ny="/assets/worker-D9VCBMJ0.js";async function ry(t,e){const n=new ArrayBuffer(44+t.length*2),r=new DataView(n);Ln(r,0,"RIFF"),r.setUint32(4,36+t.length*2,!0),Ln(r,8,"WAVE"),Ln(r,12,"fmt "),r.setUint32(16,16,!0),r.setUint16(20,1,!0),r.setUint16(22,1,!0),r.setUint32(24,e,!0),r.setUint32(28,e*2,!0),r.setUint16(32,2,!0),r.setUint16(34,16,!0),Ln(r,36,"data"),r.setUint32(40,t.length*2,!0),iy(r,44,t);const i=new Blob([r],{type:"audio/wav"});return new Promise((o,a)=>{const s=new FileReader;s.onload=()=>{const l=s.result.split(",")[1];o(l)},s.onerror=a,s.readAsDataURL(i)})}function Ln(t,e,n){for(let r=0;r{jn().then(()=>{i.update(),o.value=i.height.value})}),u(async()=>{jn().then(()=>{i.update(),o.value=i.height.value})}),(c,f)=>{const p=pa("auto-animate");return ee(),ie("div",oy,[f[2]||(f[2]=z("div",{"flex-1":""},null,-1)),At((ee(),ie("div",{ref_key:"chatHistoryRef",ref:e,"h-full":"","w-full":"",flex:"~ col","overflow-scroll":""},[f[1]||(f[1]=z("div",{"flex-1":""},null,-1)),(ee(!0),ie(si,null,li(H(n),(d,b)=>(ee(),ie("div",{key:b,"mb-2":""},[d.role==="error"?(ee(),ie("div",ay,[z("div",sy,[z("div",ly,[z("div",uy,[z("span",cy,ge(H(a)("stage.chat.message.character-name.core-system")),1)]),f[0]||(f[0]=z("div",{"i-solar:danger-triangle-bold-duotone":"","text-violet-500":""},null,-1))]),H(r)?(ee(),ie("div",fy)):(ee(),ie("div",{key:1,class:"markdown-content break-words text-violet-500",text:"base