@multiplayer-app/ai-agent-react 0.4.2-beta.2 → 0.4.2-beta.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -8293,7 +8293,7 @@
|
|
|
8293
8293
|
}`}),t]})},O3=()=>j.useContext(R3),v2="mp-agent-selected-model",ra="__auto__";function L3(e){return e.mode==="direct"?`${v2}-${e.mode}-${e.provider}`:`${v2}-${e.mode}`}function _2(e,t){try{const n=L3(e);localStorage.setItem(n,t)}catch(n){console.warn("Failed to save selected model to localStorage:",n)}}function _7e(e){try{const t=L3(e);return localStorage.getItem(t)}catch(t){return console.warn("Failed to load selected model from localStorage:",t),null}}function D3(e,t){return!e||e.length===0?[]:t.mode==="direct"&&t.provider!=="custom"?e.filter(n=>n.provider?n.provider===t.provider:!0):e}function x7e(e,t,n){const r=_7e(t);if(r){if(r===ra)return;if(D3(e,t).some(i=>i.id===r))return r}}const w7e="mp-agents-last-active-chat";function z3(e){return`${w7e}-${e}`}function $3(e){return typeof e=="string"&&e.length>0&&e.length<256}function E7e(e){if(typeof window>"u")return null;try{const t=localStorage.getItem(z3(e));return t&&$3(t)?t:null}catch{return null}}function M7e(e,t){if(!(typeof window>"u"))try{const n=z3(e);t&&$3(t)?localStorage.setItem(n,t):localStorage.removeItem(n)}catch{}}const vn=Object.create(null);vn.open="0";vn.close="1";vn.ping="2";vn.pong="3";vn.message="4";vn.upgrade="5";vn.noop="6";const vi=Object.create(null);Object.keys(vn).forEach(e=>{vi[vn[e]]=e});const dd={type:"error",data:"parser error"},F3=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",P3=typeof ArrayBuffer=="function",q3=e=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,fp=({type:e,data:t},n,r)=>F3&&t instanceof Blob?n?r(t):x2(t,r):P3&&(t instanceof ArrayBuffer||q3(t))?n?r(t):x2(new Blob([t]),r):r(vn[e]+(t||"")),x2=(e,t)=>{const n=new FileReader;return n.onload=function(){const r=n.result.split(",")[1];t("b"+(r||""))},n.readAsDataURL(e)};function w2(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}let is;function S7e(e,t){if(F3&&e.data instanceof Blob)return e.data.arrayBuffer().then(w2).then(t);if(P3&&(e.data instanceof ArrayBuffer||q3(e.data)))return t(w2(e.data));fp(e,!1,n=>{is||(is=new TextEncoder),t(is.encode(n))})}const E2="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",aa=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let e=0;e<E2.length;e++)aa[E2.charCodeAt(e)]=e;const N7e=e=>{let t=e.length*.75,n=e.length,r,a=0,i,o,s,l;e[e.length-1]==="="&&(t--,e[e.length-2]==="="&&t--);const u=new ArrayBuffer(t),d=new Uint8Array(u);for(r=0;r<n;r+=4)i=aa[e.charCodeAt(r)],o=aa[e.charCodeAt(r+1)],s=aa[e.charCodeAt(r+2)],l=aa[e.charCodeAt(r+3)],d[a++]=i<<2|o>>4,d[a++]=(o&15)<<4|s>>2,d[a++]=(s&3)<<6|l&63;return u},A7e=typeof ArrayBuffer=="function",gp=(e,t)=>{if(typeof e!="string")return{type:"message",data:B3(e,t)};const n=e.charAt(0);return n==="b"?{type:"message",data:T7e(e.substring(1),t)}:vi[n]?e.length>1?{type:vi[n],data:e.substring(1)}:{type:vi[n]}:dd},T7e=(e,t)=>{if(A7e){const n=N7e(e);return B3(n,t)}else return{base64:!0,data:e}},B3=(e,t)=>{switch(t){case"blob":return e instanceof Blob?e:new Blob([e]);case"arraybuffer":default:return e instanceof ArrayBuffer?e:e.buffer}},U3="",C7e=(e,t)=>{const n=e.length,r=new Array(n);let a=0;e.forEach((i,o)=>{fp(i,!1,s=>{r[o]=s,++a===n&&t(r.join(U3))})})},R7e=(e,t)=>{const n=e.split(U3),r=[];for(let a=0;a<n.length;a++){const i=gp(n[a],t);if(r.push(i),i.type==="error")break}return r};function I7e(){return new TransformStream({transform(e,t){S7e(e,n=>{const r=n.length;let a;if(r<126)a=new Uint8Array(1),new DataView(a.buffer).setUint8(0,r);else if(r<65536){a=new Uint8Array(3);const i=new DataView(a.buffer);i.setUint8(0,126),i.setUint16(1,r)}else{a=new Uint8Array(9);const i=new DataView(a.buffer);i.setUint8(0,127),i.setBigUint64(1,BigInt(r))}e.data&&typeof e.data!="string"&&(a[0]|=128),t.enqueue(a),t.enqueue(n)})}})}let os;function Wa(e){return e.reduce((t,n)=>t+n.length,0)}function Ka(e,t){if(e[0].length===t)return e.shift();const n=new Uint8Array(t);let r=0;for(let a=0;a<t;a++)n[a]=e[0][r++],r===e[0].length&&(e.shift(),r=0);return e.length&&r<e[0].length&&(e[0]=e[0].slice(r)),n}function O7e(e,t){os||(os=new TextDecoder);const n=[];let r=0,a=-1,i=!1;return new TransformStream({transform(o,s){for(n.push(o);;){if(r===0){if(Wa(n)<1)break;const l=Ka(n,1);i=(l[0]&128)===128,a=l[0]&127,a<126?r=3:a===126?r=1:r=2}else if(r===1){if(Wa(n)<2)break;const l=Ka(n,2);a=new DataView(l.buffer,l.byteOffset,l.length).getUint16(0),r=3}else if(r===2){if(Wa(n)<8)break;const l=Ka(n,8),u=new DataView(l.buffer,l.byteOffset,l.length),d=u.getUint32(0);if(d>Math.pow(2,21)-1){s.enqueue(dd);break}a=d*Math.pow(2,32)+u.getUint32(4),r=3}else{if(Wa(n)<a)break;const l=Ka(n,a);s.enqueue(gp(i?l:os.decode(l),t)),r=0}if(a===0||a>e){s.enqueue(dd);break}}}})}const H3=4;function ut(e){if(e)return L7e(e)}function L7e(e){for(var t in ut.prototype)e[t]=ut.prototype[t];return e}ut.prototype.on=ut.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this};ut.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this};ut.prototype.off=ut.prototype.removeListener=ut.prototype.removeAllListeners=ut.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var n=this._callbacks["$"+e];if(!n)return this;if(arguments.length==1)return delete this._callbacks["$"+e],this;for(var r,a=0;a<n.length;a++)if(r=n[a],r===t||r.fn===t){n.splice(a,1);break}return n.length===0&&delete this._callbacks["$"+e],this};ut.prototype.emit=function(e){this._callbacks=this._callbacks||{};for(var t=new Array(arguments.length-1),n=this._callbacks["$"+e],r=1;r<arguments.length;r++)t[r-1]=arguments[r];if(n){n=n.slice(0);for(var r=0,a=n.length;r<a;++r)n[r].apply(this,t)}return this};ut.prototype.emitReserved=ut.prototype.emit;ut.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks["$"+e]||[]};ut.prototype.hasListeners=function(e){return!!this.listeners(e).length};const bo=typeof Promise=="function"&&typeof Promise.resolve=="function"?t=>Promise.resolve().then(t):(t,n)=>n(t,0),Qt=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),D7e="arraybuffer";function j3(e,...t){return t.reduce((n,r)=>(e.hasOwnProperty(r)&&(n[r]=e[r]),n),{})}const z7e=Qt.setTimeout,$7e=Qt.clearTimeout;function ko(e,t){t.useNativeTimers?(e.setTimeoutFn=z7e.bind(Qt),e.clearTimeoutFn=$7e.bind(Qt)):(e.setTimeoutFn=Qt.setTimeout.bind(Qt),e.clearTimeoutFn=Qt.clearTimeout.bind(Qt))}const F7e=1.33;function P7e(e){return typeof e=="string"?q7e(e):Math.ceil((e.byteLength||e.size)*F7e)}function q7e(e){let t=0,n=0;for(let r=0,a=e.length;r<a;r++)t=e.charCodeAt(r),t<128?n+=1:t<2048?n+=2:t<55296||t>=57344?n+=3:(r++,n+=4);return n}function V3(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function B7e(e){let t="";for(let n in e)e.hasOwnProperty(n)&&(t.length&&(t+="&"),t+=encodeURIComponent(n)+"="+encodeURIComponent(e[n]));return t}function U7e(e){let t={},n=e.split("&");for(let r=0,a=n.length;r<a;r++){let i=n[r].split("=");t[decodeURIComponent(i[0])]=decodeURIComponent(i[1])}return t}class H7e extends Error{constructor(t,n,r){super(t),this.description=n,this.context=r,this.type="TransportError"}}class yp extends ut{constructor(t){super(),this.writable=!1,ko(this,t),this.opts=t,this.query=t.query,this.socket=t.socket,this.supportsBinary=!t.forceBase64}onError(t,n,r){return super.emitReserved("error",new H7e(t,n,r)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(t){this.readyState==="open"&&this.write(t)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(t){const n=gp(t,this.socket.binaryType);this.onPacket(n)}onPacket(t){super.emitReserved("packet",t)}onClose(t){this.readyState="closed",super.emitReserved("close",t)}pause(t){}createUri(t,n={}){return t+"://"+this._hostname()+this._port()+this.opts.path+this._query(n)}_hostname(){const t=this.opts.hostname;return t.indexOf(":")===-1?t:"["+t+"]"}_port(){return this.opts.port&&(this.opts.secure&&Number(this.opts.port)!==443||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(t){const n=B7e(t);return n.length?"?"+n:""}}class j7e extends yp{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(t){this.readyState="pausing";const n=()=>{this.readyState="paused",t()};if(this._polling||!this.writable){let r=0;this._polling&&(r++,this.once("pollComplete",function(){--r||n()})),this.writable||(r++,this.once("drain",function(){--r||n()}))}else n()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(t){const n=r=>{if(this.readyState==="opening"&&r.type==="open"&&this.onOpen(),r.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(r)};R7e(t,this.socket.binaryType).forEach(n),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){const t=()=>{this.write([{type:"close"}])};this.readyState==="open"?t():this.once("open",t)}write(t){this.writable=!1,C7e(t,n=>{this.doWrite(n,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const t=this.opts.secure?"https":"http",n=this.query||{};return this.opts.timestampRequests!==!1&&(n[this.opts.timestampParam]=V3()),!this.supportsBinary&&!n.sid&&(n.b64=1),this.createUri(t,n)}}let G3=!1;try{G3=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const V7e=G3;function G7e(){}class W7e extends j7e{constructor(t){if(super(t),typeof location<"u"){const n=location.protocol==="https:";let r=location.port;r||(r=n?"443":"80"),this.xd=typeof location<"u"&&t.hostname!==location.hostname||r!==t.port}}doWrite(t,n){const r=this.request({method:"POST",data:t});r.on("success",n),r.on("error",(a,i)=>{this.onError("xhr post error",a,i)})}doPoll(){const t=this.request();t.on("data",this.onData.bind(this)),t.on("error",(n,r)=>{this.onError("xhr poll error",n,r)}),this.pollXhr=t}}class kn extends ut{constructor(t,n,r){super(),this.createRequest=t,ko(this,r),this._opts=r,this._method=r.method||"GET",this._uri=n,this._data=r.data!==void 0?r.data:null,this._create()}_create(){var t;const n=j3(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");n.xdomain=!!this._opts.xd;const r=this._xhr=this.createRequest(n);try{r.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){r.setDisableHeaderCheck&&r.setDisableHeaderCheck(!0);for(let a in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(a)&&r.setRequestHeader(a,this._opts.extraHeaders[a])}}catch{}if(this._method==="POST")try{r.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{r.setRequestHeader("Accept","*/*")}catch{}(t=this._opts.cookieJar)===null||t===void 0||t.addCookies(r),"withCredentials"in r&&(r.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(r.timeout=this._opts.requestTimeout),r.onreadystatechange=()=>{var a;r.readyState===3&&((a=this._opts.cookieJar)===null||a===void 0||a.parseCookies(r.getResponseHeader("set-cookie"))),r.readyState===4&&(r.status===200||r.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof r.status=="number"?r.status:0)},0))},r.send(this._data)}catch(a){this.setTimeoutFn(()=>{this._onError(a)},0);return}typeof document<"u"&&(this._index=kn.requestsCount++,kn.requests[this._index]=this)}_onError(t){this.emitReserved("error",t,this._xhr),this._cleanup(!0)}_cleanup(t){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=G7e,t)try{this._xhr.abort()}catch{}typeof document<"u"&&delete kn.requests[this._index],this._xhr=null}}_onLoad(){const t=this._xhr.responseText;t!==null&&(this.emitReserved("data",t),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}}kn.requestsCount=0;kn.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",M2);else if(typeof addEventListener=="function"){const e="onpagehide"in Qt?"pagehide":"unload";addEventListener(e,M2,!1)}}function M2(){for(let e in kn.requests)kn.requests.hasOwnProperty(e)&&kn.requests[e].abort()}const K7e=function(){const e=W3({xdomain:!1});return e&&e.responseType!==null}();class Y7e extends W7e{constructor(t){super(t);const n=t&&t.forceBase64;this.supportsBinary=K7e&&!n}request(t={}){return Object.assign(t,{xd:this.xd},this.opts),new kn(W3,this.uri(),t)}}function W3(e){const t=e.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!t||V7e))return new XMLHttpRequest}catch{}if(!t)try{return new Qt[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const K3=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class Z7e extends yp{get name(){return"websocket"}doOpen(){const t=this.uri(),n=this.opts.protocols,r=K3?{}:j3(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(r.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(t,n,r)}catch(a){return this.emitReserved("error",a)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=t=>this.onClose({description:"websocket connection closed",context:t}),this.ws.onmessage=t=>this.onData(t.data),this.ws.onerror=t=>this.onError("websocket error",t)}write(t){this.writable=!1;for(let n=0;n<t.length;n++){const r=t[n],a=n===t.length-1;fp(r,this.supportsBinary,i=>{try{this.doWrite(r,i)}catch{}a&&bo(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const t=this.opts.secure?"wss":"ws",n=this.query||{};return this.opts.timestampRequests&&(n[this.opts.timestampParam]=V3()),this.supportsBinary||(n.b64=1),this.createUri(t,n)}}const ss=Qt.WebSocket||Qt.MozWebSocket;class X7e extends Z7e{createSocket(t,n,r){return K3?new ss(t,n,r):n?new ss(t,n):new ss(t)}doWrite(t,n){this.ws.send(n)}}class Q7e extends yp{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(t){return this.emitReserved("error",t)}this._transport.closed.then(()=>{this.onClose()}).catch(t=>{this.onError("webtransport error",t)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(t=>{const n=O7e(Number.MAX_SAFE_INTEGER,this.socket.binaryType),r=t.readable.pipeThrough(n).getReader(),a=I7e();a.readable.pipeTo(t.writable),this._writer=a.writable.getWriter();const i=()=>{r.read().then(({done:s,value:l})=>{s||(this.onPacket(l),i())}).catch(s=>{})};i();const o={type:"open"};this.query.sid&&(o.data=`{"sid":"${this.query.sid}"}`),this._writer.write(o).then(()=>this.onOpen())})})}write(t){this.writable=!1;for(let n=0;n<t.length;n++){const r=t[n],a=n===t.length-1;this._writer.write(r).then(()=>{a&&bo(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var t;(t=this._transport)===null||t===void 0||t.close()}}const J7e={websocket:X7e,webtransport:Q7e,polling:Y7e},e_e=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,t_e=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function pd(e){if(e.length>8e3)throw"URI too long";const t=e,n=e.indexOf("["),r=e.indexOf("]");n!=-1&&r!=-1&&(e=e.substring(0,n)+e.substring(n,r).replace(/:/g,";")+e.substring(r,e.length));let a=e_e.exec(e||""),i={},o=14;for(;o--;)i[t_e[o]]=a[o]||"";return n!=-1&&r!=-1&&(i.source=t,i.host=i.host.substring(1,i.host.length-1).replace(/;/g,":"),i.authority=i.authority.replace("[","").replace("]","").replace(/;/g,":"),i.ipv6uri=!0),i.pathNames=n_e(i,i.path),i.queryKey=r_e(i,i.query),i}function n_e(e,t){const n=/\/{2,9}/g,r=t.replace(n,"/").split("/");return(t.slice(0,1)=="/"||t.length===0)&&r.splice(0,1),t.slice(-1)=="/"&&r.splice(r.length-1,1),r}function r_e(e,t){const n={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(r,a,i){a&&(n[a]=i)}),n}const hd=typeof addEventListener=="function"&&typeof removeEventListener=="function",_i=[];hd&&addEventListener("offline",()=>{_i.forEach(e=>e())},!1);class Xn extends ut{constructor(t,n){if(super(),this.binaryType=D7e,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,t&&typeof t=="object"&&(n=t,t=null),t){const r=pd(t);n.hostname=r.host,n.secure=r.protocol==="https"||r.protocol==="wss",n.port=r.port,r.query&&(n.query=r.query)}else n.host&&(n.hostname=pd(n.host).host);ko(this,n),this.secure=n.secure!=null?n.secure:typeof location<"u"&&location.protocol==="https:",n.hostname&&!n.port&&(n.port=this.secure?"443":"80"),this.hostname=n.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=n.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},n.transports.forEach(r=>{const a=r.prototype.name;this.transports.push(a),this._transportsByName[a]=r}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},n),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=U7e(this.opts.query)),hd&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},_i.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(t){const n=Object.assign({},this.opts.query);n.EIO=H3,n.transport=t,this.id&&(n.sid=this.id);const r=Object.assign({},this.opts,{query:n,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[t]);return new this._transportsByName[t](r)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}const t=this.opts.rememberUpgrade&&Xn.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";const n=this.createTransport(t);n.open(),this.setTransport(n)}setTransport(t){this.transport&&this.transport.removeAllListeners(),this.transport=t,t.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",n=>this._onClose("transport close",n))}onOpen(){this.readyState="open",Xn.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(t){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",t),this.emitReserved("heartbeat"),t.type){case"open":this.onHandshake(JSON.parse(t.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const n=new Error("server error");n.code=t.data,this._onError(n);break;case"message":this.emitReserved("data",t.data),this.emitReserved("message",t.data);break}}onHandshake(t){this.emitReserved("handshake",t),this.id=t.sid,this.transport.query.sid=t.sid,this._pingInterval=t.pingInterval,this._pingTimeout=t.pingTimeout,this._maxPayload=t.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const t=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+t,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},t),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const t=this._getWritablePackets();this.transport.send(t),this._prevBufferLen=t.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let n=1;for(let r=0;r<this.writeBuffer.length;r++){const a=this.writeBuffer[r].data;if(a&&(n+=P7e(a)),r>0&&n>this._maxPayload)return this.writeBuffer.slice(0,r);n+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const t=Date.now()>this._pingTimeoutTime;return t&&(this._pingTimeoutTime=0,bo(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),t}write(t,n,r){return this._sendPacket("message",t,n,r),this}send(t,n,r){return this._sendPacket("message",t,n,r),this}_sendPacket(t,n,r,a){if(typeof n=="function"&&(a=n,n=void 0),typeof r=="function"&&(a=r,r=null),this.readyState==="closing"||this.readyState==="closed")return;r=r||{},r.compress=r.compress!==!1;const i={type:t,data:n,options:r};this.emitReserved("packetCreate",i),this.writeBuffer.push(i),a&&this.once("flush",a),this.flush()}close(){const t=()=>{this._onClose("forced close"),this.transport.close()},n=()=>{this.off("upgrade",n),this.off("upgradeError",n),t()},r=()=>{this.once("upgrade",n),this.once("upgradeError",n)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?r():t()}):this.upgrading?r():t()),this}_onError(t){if(Xn.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",t),this._onClose("transport error",t)}_onClose(t,n){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),hd&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const r=_i.indexOf(this._offlineEventListener);r!==-1&&_i.splice(r,1)}this.readyState="closed",this.id=null,this.emitReserved("close",t,n),this.writeBuffer=[],this._prevBufferLen=0}}}Xn.protocol=H3;class a_e extends Xn{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let t=0;t<this._upgrades.length;t++)this._probe(this._upgrades[t])}_probe(t){let n=this.createTransport(t),r=!1;Xn.priorWebsocketSuccess=!1;const a=()=>{r||(n.send([{type:"ping",data:"probe"}]),n.once("packet",p=>{if(!r)if(p.type==="pong"&&p.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",n),!n)return;Xn.priorWebsocketSuccess=n.name==="websocket",this.transport.pause(()=>{r||this.readyState!=="closed"&&(d(),this.setTransport(n),n.send([{type:"upgrade"}]),this.emitReserved("upgrade",n),n=null,this.upgrading=!1,this.flush())})}else{const h=new Error("probe error");h.transport=n.name,this.emitReserved("upgradeError",h)}}))};function i(){r||(r=!0,d(),n.close(),n=null)}const o=p=>{const h=new Error("probe error: "+p);h.transport=n.name,i(),this.emitReserved("upgradeError",h)};function s(){o("transport closed")}function l(){o("socket closed")}function u(p){n&&p.name!==n.name&&i()}const d=()=>{n.removeListener("open",a),n.removeListener("error",o),n.removeListener("close",s),this.off("close",l),this.off("upgrading",u)};n.once("open",a),n.once("error",o),n.once("close",s),this.once("close",l),this.once("upgrading",u),this._upgrades.indexOf("webtransport")!==-1&&t!=="webtransport"?this.setTimeoutFn(()=>{r||n.open()},200):n.open()}onHandshake(t){this._upgrades=this._filterUpgrades(t.upgrades),super.onHandshake(t)}_filterUpgrades(t){const n=[];for(let r=0;r<t.length;r++)~this.transports.indexOf(t[r])&&n.push(t[r]);return n}}let i_e=class extends a_e{constructor(t,n={}){const r=typeof t=="object",a=r?{...t}:{...n};(!a.transports||a.transports&&typeof a.transports[0]=="string")&&(a.transports=(a.transports||["polling","websocket","webtransport"]).map(i=>J7e[i]).filter(i=>!!i)),super(r?a:t,a)}};function o_e(e,t="",n){let r=e;n=n||typeof location<"u"&&location,e==null&&(e=n.protocol+"//"+n.host),typeof e=="string"&&(e.charAt(0)==="/"&&(e.charAt(1)==="/"?e=n.protocol+e:e=n.host+e),/^(https?|wss?):\/\//.test(e)||(typeof n<"u"?e=n.protocol+"//"+e:e="https://"+e),r=pd(e)),r.port||(/^(http|ws)$/.test(r.protocol)?r.port="80":/^(http|ws)s$/.test(r.protocol)&&(r.port="443")),r.path=r.path||"/";const i=r.host.indexOf(":")!==-1?"["+r.host+"]":r.host;return r.id=r.protocol+"://"+i+":"+r.port+t,r.href=r.protocol+"://"+i+(n&&n.port===r.port?"":":"+r.port),r}const s_e=typeof ArrayBuffer=="function",l_e=e=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer,Y3=Object.prototype.toString,c_e=typeof Blob=="function"||typeof Blob<"u"&&Y3.call(Blob)==="[object BlobConstructor]",u_e=typeof File=="function"||typeof File<"u"&&Y3.call(File)==="[object FileConstructor]";function bp(e){return s_e&&(e instanceof ArrayBuffer||l_e(e))||c_e&&e instanceof Blob||u_e&&e instanceof File}function xi(e,t){if(!e||typeof e!="object")return!1;if(Array.isArray(e)){for(let n=0,r=e.length;n<r;n++)if(xi(e[n]))return!0;return!1}if(bp(e))return!0;if(e.toJSON&&typeof e.toJSON=="function"&&arguments.length===1)return xi(e.toJSON(),!0);for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&xi(e[n]))return!0;return!1}function d_e(e){const t=[],n=e.data,r=e;return r.data=wi(n,t),r.attachments=t.length,{packet:r,buffers:t}}function wi(e,t,n){if(!e)return e;if(bp(e)){const r={_placeholder:!0,num:t.length};return t.push(e),r}else if(Array.isArray(e)){const r=new Array(e.length);for(let a=0;a<e.length;a++)r[a]=wi(e[a],t);return r}else if(typeof e=="object"&&!(e instanceof Date)){if(e.toJSON&&typeof e.toJSON=="function"&&!n)return wi(e.toJSON(),t,!0);const r={};for(const a in e)Object.prototype.hasOwnProperty.call(e,a)&&(r[a]=wi(e[a],t));return r}return e}function p_e(e,t){return e.data=md(e.data,t),delete e.attachments,e}function md(e,t){if(!e)return e;if(e&&e._placeholder===!0){if(typeof e.num=="number"&&e.num>=0&&e.num<t.length)return t[e.num];throw new Error("illegal attachments")}else if(Array.isArray(e))for(let n=0;n<e.length;n++)e[n]=md(e[n],t);else if(typeof e=="object")for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(e[n]=md(e[n],t));return e}const h_e=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"];var Ue;(function(e){e[e.CONNECT=0]="CONNECT",e[e.DISCONNECT=1]="DISCONNECT",e[e.EVENT=2]="EVENT",e[e.ACK=3]="ACK",e[e.CONNECT_ERROR=4]="CONNECT_ERROR",e[e.BINARY_EVENT=5]="BINARY_EVENT",e[e.BINARY_ACK=6]="BINARY_ACK"})(Ue||(Ue={}));class m_e{constructor(t){this.replacer=t}encode(t){return(t.type===Ue.EVENT||t.type===Ue.ACK)&&xi(t)?this.encodeAsBinary({type:t.type===Ue.EVENT?Ue.BINARY_EVENT:Ue.BINARY_ACK,nsp:t.nsp,data:t.data,id:t.id}):[this.encodeAsString(t)]}encodeAsString(t){let n=""+t.type;return(t.type===Ue.BINARY_EVENT||t.type===Ue.BINARY_ACK)&&(n+=t.attachments+"-"),t.nsp&&t.nsp!=="/"&&(n+=t.nsp+","),t.id!=null&&(n+=t.id),t.data!=null&&(n+=JSON.stringify(t.data,this.replacer)),n}encodeAsBinary(t){const n=d_e(t),r=this.encodeAsString(n.packet),a=n.buffers;return a.unshift(r),a}}class kp extends ut{constructor(t){super(),this.opts=Object.assign({reviver:void 0,maxAttachments:10},typeof t=="function"?{reviver:t}:t)}add(t){let n;if(typeof t=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");n=this.decodeString(t);const r=n.type===Ue.BINARY_EVENT;r||n.type===Ue.BINARY_ACK?(n.type=r?Ue.EVENT:Ue.ACK,this.reconstructor=new f_e(n)):super.emitReserved("decoded",n)}else if(bp(t)||t.base64)if(this.reconstructor)n=this.reconstructor.takeBinaryData(t),n&&(this.reconstructor=null,super.emitReserved("decoded",n));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+t)}decodeString(t){let n=0;const r={type:Number(t.charAt(0))};if(Ue[r.type]===void 0)throw new Error("unknown packet type "+r.type);if(r.type===Ue.BINARY_EVENT||r.type===Ue.BINARY_ACK){const i=n+1;for(;t.charAt(++n)!=="-"&&n!=t.length;);const o=t.substring(i,n);if(o!=Number(o)||t.charAt(n)!=="-")throw new Error("Illegal attachments");const s=Number(o);if(!g_e(s)||s<1)throw new Error("Illegal attachments");if(s>this.opts.maxAttachments)throw new Error("too many attachments");r.attachments=s}if(t.charAt(n+1)==="/"){const i=n+1;for(;++n&&!(t.charAt(n)===","||n===t.length););r.nsp=t.substring(i,n)}else r.nsp="/";const a=t.charAt(n+1);if(a!==""&&Number(a)==a){const i=n+1;for(;++n;){const o=t.charAt(n);if(o==null||Number(o)!=o){--n;break}if(n===t.length)break}r.id=Number(t.substring(i,n+1))}if(t.charAt(++n)){const i=this.tryParse(t.substr(n));if(kp.isPayloadValid(r.type,i))r.data=i;else throw new Error("invalid payload")}return r}tryParse(t){try{return JSON.parse(t,this.opts.reviver)}catch{return!1}}static isPayloadValid(t,n){switch(t){case Ue.CONNECT:return S2(n);case Ue.DISCONNECT:return n===void 0;case Ue.CONNECT_ERROR:return typeof n=="string"||S2(n);case Ue.EVENT:case Ue.BINARY_EVENT:return Array.isArray(n)&&(typeof n[0]=="number"||typeof n[0]=="string"&&h_e.indexOf(n[0])===-1);case Ue.ACK:case Ue.BINARY_ACK:return Array.isArray(n)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class f_e{constructor(t){this.packet=t,this.buffers=[],this.reconPack=t}takeBinaryData(t){if(this.buffers.push(t),this.buffers.length===this.reconPack.attachments){const n=p_e(this.reconPack,this.buffers);return this.finishedReconstruction(),n}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const g_e=Number.isInteger||function(e){return typeof e=="number"&&isFinite(e)&&Math.floor(e)===e};function S2(e){return Object.prototype.toString.call(e)==="[object Object]"}const y_e=Object.freeze(Object.defineProperty({__proto__:null,Decoder:kp,Encoder:m_e,get PacketType(){return Ue}},Symbol.toStringTag,{value:"Module"}));function sn(e,t,n){return e.on(t,n),function(){e.off(t,n)}}const b_e=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class Z3 extends ut{constructor(t,n,r){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=t,this.nsp=n,r&&r.auth&&(this.auth=r.auth),this._opts=Object.assign({},r),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const t=this.io;this.subs=[sn(t,"open",this.onopen.bind(this)),sn(t,"packet",this.onpacket.bind(this)),sn(t,"error",this.onerror.bind(this)),sn(t,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...t){return t.unshift("message"),this.emit.apply(this,t),this}emit(t,...n){var r,a,i;if(b_e.hasOwnProperty(t))throw new Error('"'+t.toString()+'" is a reserved event name');if(n.unshift(t),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(n),this;const o={type:Ue.EVENT,data:n};if(o.options={},o.options.compress=this.flags.compress!==!1,typeof n[n.length-1]=="function"){const d=this.ids++,p=n.pop();this._registerAckCallback(d,p),o.id=d}const s=(a=(r=this.io.engine)===null||r===void 0?void 0:r.transport)===null||a===void 0?void 0:a.writable,l=this.connected&&!(!((i=this.io.engine)===null||i===void 0)&&i._hasPingExpired());return this.flags.volatile&&!s||(l?(this.notifyOutgoingListeners(o),this.packet(o)):this.sendBuffer.push(o)),this.flags={},this}_registerAckCallback(t,n){var r;const a=(r=this.flags.timeout)!==null&&r!==void 0?r:this._opts.ackTimeout;if(a===void 0){this.acks[t]=n;return}const i=this.io.setTimeoutFn(()=>{delete this.acks[t];for(let s=0;s<this.sendBuffer.length;s++)this.sendBuffer[s].id===t&&this.sendBuffer.splice(s,1);n.call(this,new Error("operation has timed out"))},a),o=(...s)=>{this.io.clearTimeoutFn(i),n.apply(this,s)};o.withError=!0,this.acks[t]=o}emitWithAck(t,...n){return new Promise((r,a)=>{const i=(o,s)=>o?a(o):r(s);i.withError=!0,n.push(i),this.emit(t,...n)})}_addToQueue(t){let n;typeof t[t.length-1]=="function"&&(n=t.pop());const r={id:this._queueSeq++,tryCount:0,pending:!1,args:t,flags:Object.assign({fromQueue:!0},this.flags)};t.push((a,...i)=>(this._queue[0],a!==null?r.tryCount>this._opts.retries&&(this._queue.shift(),n&&n(a)):(this._queue.shift(),n&&n(null,...i)),r.pending=!1,this._drainQueue())),this._queue.push(r),this._drainQueue()}_drainQueue(t=!1){if(!this.connected||this._queue.length===0)return;const n=this._queue[0];n.pending&&!t||(n.pending=!0,n.tryCount++,this.flags=n.flags,this.emit.apply(this,n.args))}packet(t){t.nsp=this.nsp,this.io._packet(t)}onopen(){typeof this.auth=="function"?this.auth(t=>{this._sendConnectPacket(t)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(t){this.packet({type:Ue.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},t):t})}onerror(t){this.connected||this.emitReserved("connect_error",t)}onclose(t,n){this.connected=!1,delete this.id,this.emitReserved("disconnect",t,n),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(t=>{if(!this.sendBuffer.some(r=>String(r.id)===t)){const r=this.acks[t];delete this.acks[t],r.withError&&r.call(this,new Error("socket has been disconnected"))}})}onpacket(t){if(t.nsp===this.nsp)switch(t.type){case Ue.CONNECT:t.data&&t.data.sid?this.onconnect(t.data.sid,t.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case Ue.EVENT:case Ue.BINARY_EVENT:this.onevent(t);break;case Ue.ACK:case Ue.BINARY_ACK:this.onack(t);break;case Ue.DISCONNECT:this.ondisconnect();break;case Ue.CONNECT_ERROR:this.destroy();const r=new Error(t.data.message);r.data=t.data.data,this.emitReserved("connect_error",r);break}}onevent(t){const n=t.data||[];t.id!=null&&n.push(this.ack(t.id)),this.connected?this.emitEvent(n):this.receiveBuffer.push(Object.freeze(n))}emitEvent(t){if(this._anyListeners&&this._anyListeners.length){const n=this._anyListeners.slice();for(const r of n)r.apply(this,t)}super.emit.apply(this,t),this._pid&&t.length&&typeof t[t.length-1]=="string"&&(this._lastOffset=t[t.length-1])}ack(t){const n=this;let r=!1;return function(...a){r||(r=!0,n.packet({type:Ue.ACK,id:t,data:a}))}}onack(t){const n=this.acks[t.id];typeof n=="function"&&(delete this.acks[t.id],n.withError&&t.data.unshift(null),n.apply(this,t.data))}onconnect(t,n){this.id=t,this.recovered=n&&this._pid===n,this._pid=n,this.connected=!0,this.emitBuffered(),this._drainQueue(!0),this.emitReserved("connect")}emitBuffered(){this.receiveBuffer.forEach(t=>this.emitEvent(t)),this.receiveBuffer=[],this.sendBuffer.forEach(t=>{this.notifyOutgoingListeners(t),this.packet(t)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(t=>t()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:Ue.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(t){return this.flags.compress=t,this}get volatile(){return this.flags.volatile=!0,this}timeout(t){return this.flags.timeout=t,this}onAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(t),this}prependAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(t),this}offAny(t){if(!this._anyListeners)return this;if(t){const n=this._anyListeners;for(let r=0;r<n.length;r++)if(t===n[r])return n.splice(r,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(t){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(t),this}prependAnyOutgoing(t){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(t),this}offAnyOutgoing(t){if(!this._anyOutgoingListeners)return this;if(t){const n=this._anyOutgoingListeners;for(let r=0;r<n.length;r++)if(t===n[r])return n.splice(r,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(t){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const n=this._anyOutgoingListeners.slice();for(const r of n)r.apply(this,t.data)}}}function Vr(e){e=e||{},this.ms=e.min||100,this.max=e.max||1e4,this.factor=e.factor||2,this.jitter=e.jitter>0&&e.jitter<=1?e.jitter:0,this.attempts=0}Vr.prototype.duration=function(){var e=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),n=Math.floor(t*this.jitter*e);e=Math.floor(t*10)&1?e+n:e-n}return Math.min(e,this.max)|0};Vr.prototype.reset=function(){this.attempts=0};Vr.prototype.setMin=function(e){this.ms=e};Vr.prototype.setMax=function(e){this.max=e};Vr.prototype.setJitter=function(e){this.jitter=e};class fd extends ut{constructor(t,n){var r;super(),this.nsps={},this.subs=[],t&&typeof t=="object"&&(n=t,t=void 0),n=n||{},n.path=n.path||"/socket.io",this.opts=n,ko(this,n),this.reconnection(n.reconnection!==!1),this.reconnectionAttempts(n.reconnectionAttempts||1/0),this.reconnectionDelay(n.reconnectionDelay||1e3),this.reconnectionDelayMax(n.reconnectionDelayMax||5e3),this.randomizationFactor((r=n.randomizationFactor)!==null&&r!==void 0?r:.5),this.backoff=new Vr({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(n.timeout==null?2e4:n.timeout),this._readyState="closed",this.uri=t;const a=n.parser||y_e;this.encoder=new a.Encoder,this.decoder=new a.Decoder,this._autoConnect=n.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(t){return arguments.length?(this._reconnection=!!t,t||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(t){return t===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=t,this)}reconnectionDelay(t){var n;return t===void 0?this._reconnectionDelay:(this._reconnectionDelay=t,(n=this.backoff)===null||n===void 0||n.setMin(t),this)}randomizationFactor(t){var n;return t===void 0?this._randomizationFactor:(this._randomizationFactor=t,(n=this.backoff)===null||n===void 0||n.setJitter(t),this)}reconnectionDelayMax(t){var n;return t===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=t,(n=this.backoff)===null||n===void 0||n.setMax(t),this)}timeout(t){return arguments.length?(this._timeout=t,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(t){if(~this._readyState.indexOf("open"))return this;this.engine=new i_e(this.uri,this.opts);const n=this.engine,r=this;this._readyState="opening",this.skipReconnect=!1;const a=sn(n,"open",function(){r.onopen(),t&&t()}),i=s=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",s),t?t(s):this.maybeReconnectOnOpen()},o=sn(n,"error",i);if(this._timeout!==!1){const s=this._timeout,l=this.setTimeoutFn(()=>{a(),i(new Error("timeout")),n.close()},s);this.opts.autoUnref&&l.unref(),this.subs.push(()=>{this.clearTimeoutFn(l)})}return this.subs.push(a),this.subs.push(o),this}connect(t){return this.open(t)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const t=this.engine;this.subs.push(sn(t,"ping",this.onping.bind(this)),sn(t,"data",this.ondata.bind(this)),sn(t,"error",this.onerror.bind(this)),sn(t,"close",this.onclose.bind(this)),sn(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(t){try{this.decoder.add(t)}catch(n){this.onclose("parse error",n)}}ondecoded(t){bo(()=>{this.emitReserved("packet",t)},this.setTimeoutFn)}onerror(t){this.emitReserved("error",t)}socket(t,n){let r=this.nsps[t];return r?this._autoConnect&&!r.active&&r.connect():(r=new Z3(this,t,n),this.nsps[t]=r),r}_destroy(t){const n=Object.keys(this.nsps);for(const r of n)if(this.nsps[r].active)return;this._close()}_packet(t){const n=this.encoder.encode(t);for(let r=0;r<n.length;r++)this.engine.write(n[r],t.options)}cleanup(){this.subs.forEach(t=>t()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(t,n){var r;this.cleanup(),(r=this.engine)===null||r===void 0||r.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",t,n),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const t=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const n=this.backoff.duration();this._reconnecting=!0;const r=this.setTimeoutFn(()=>{t.skipReconnect||(this.emitReserved("reconnect_attempt",t.backoff.attempts),!t.skipReconnect&&t.open(a=>{a?(t._reconnecting=!1,t.reconnect(),this.emitReserved("reconnect_error",a)):t.onreconnect()}))},n);this.opts.autoUnref&&r.unref(),this.subs.push(()=>{this.clearTimeoutFn(r)})}}onreconnect(){const t=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",t)}}const Xr={};function Ei(e,t){typeof e=="object"&&(t=e,e=void 0),t=t||{};const n=o_e(e,t.path||"/socket.io"),r=n.source,a=n.id,i=n.path,o=Xr[a]&&i in Xr[a].nsps,s=t.forceNew||t["force new connection"]||t.multiplex===!1||o;let l;return s?l=new fd(r,t):(Xr[a]||(Xr[a]=new fd(r,t)),l=Xr[a]),n.query&&!t.query&&(t.query=n.queryKey),l.socket(n.path,t)}Object.assign(Ei,{Manager:fd,Socket:Z3,io:Ei,connect:Ei});const k_e=j.createContext(null),v_e=({children:e})=>{const t=$e(),n=fe(k=>k.upsertChat),r=fe(k=>k.upsertChatState),a=fe(k=>k.contextKey),i=fe(k=>k.activeChatId),o=j.useMemo(()=>t.config.user?.id??jr(),[t.config.user?.id]),s=t.config.transport,[l,u]=j.useState(null),[d,p]=j.useState(void 0),h=j.useRef(a),m=j.useRef(n),f=j.useRef(r),g=j.useRef(void 0);j.useEffect(()=>{h.current=a,m.current=n,f.current=r},[a,n,r]),j.useEffect(()=>{if(s.mode!=="proxy"){u(null),p(void 0),t.setSocketClient(null),t.transport instanceof Lr&&t.transport.setSocketId(void 0);return}const k=s.baseUrl,b=new URL(k,window.location.origin),x=`${b.protocol}//${b.host}`,M=s.socketNamespace,N=M?`${x}${M}`:x,E={},D=s;D.headers&&Object.assign(E,D.headers);const P={},C=D.apiKey&&`Bearer ${D.apiKey}`||D.headers?.Authorization;C&&(P.authorization=C,E.Authorization=C);const I=s.socketPath??Ri.Path,q=Ei(N,{path:I,auth:P,transports:["websocket","polling"],withCredentials:!0,...Object.keys(E).length>0&&{extraHeaders:E}});t.setSocketClient(q),u(q);const Z=()=>{p(q.id),t.transport instanceof Lr&&t.transport.setSocketId(q.id)},X=()=>{p(void 0),t.transport instanceof Lr&&t.transport.setSocketId(void 0)},K=G=>{if(G.contextKey===h.current){m.current(G);const z=t.store.getState(),V=De(z,G.id);f.current(G.id,{...V,status:ka(G.status)})}},R=G=>{const z=t.store.getState(),V=De(z,G.chat),A=V.messages.findIndex(Y=>Y.id===G.id);if(A>=0){const Y=[...V.messages];Y[A]=G,f.current(G.chat,{...V,messages:Y});return}f.current(G.chat,{...V,messages:[...V.messages,G]})},H=G=>{m.current(G);const z=t.store.getState(),V=De(z,G.id);f.current(G.id,{...V,status:ka(G.status)})};return q.on("connect",Z),q.on("disconnect",X),q.on("connect_error",G=>{console.error("Socket.IO connection error:",G.message)}),q.on(yi.ChatNew,K),q.on(yi.MessageNew,R),q.on(yi.ChatUpdate,H),()=>{t.transport instanceof Lr&&t.transport.setSocketId(void 0),t.setSocketClient(null),p(void 0),u(null),q.disconnect()}},[t,t.transport,s.mode,s.mode==="proxy"?s.baseUrl:void 0,s.mode==="proxy"?s.apiKey:void 0,s.mode==="proxy"?s.socketPath:void 0,s.mode==="proxy"?s.socketNamespace:void 0,s.mode==="proxy"?JSON.stringify(s.headers??{}):"",o]),j.useEffect(()=>{if(!l)return;const k=g.current;k&&k!==i&&l.emit("chat:unsubscribe",{chatId:k}),i&&i!==k&&(l.emit("chat:subscribe",{chatId:i}),g.current=i),i||(g.current=void 0)},[l,i]);const _=j.useMemo(()=>({socket:l,socketId:d}),[l,d]);return w.jsx(k_e.Provider,{value:_,children:e})},vp=j.createContext(null),__e=({config:e,children:t})=>{const n=j.useRef();n.current||(n.current=new T3(e));const[,r]=j.useState(0);j.useEffect(()=>{const o=n.current,s=()=>r(l=>l+1);return o.events.addEventListener("runtime:transport-config-changed",s),()=>{o.events.removeEventListener("runtime:transport-config-changed",s)}},[]);const a=j.useRef();if(!a.current){const o=n.current.defaultContextKey??n.current.config.contextKeys[0]?.key??"default";a.current=c7e(o),n.current.attachStore(a.current);const s=x7e(n.current.config.models,n.current.config.transport);a.current.getState().setComposerOptions({model:s})}const i=j.useMemo(()=>({runtime:n.current,store:a.current}),[]);return j.useEffect(()=>{const o=a.current;if(!o)return;let s=o.getState().activeChatId;return o.subscribe(()=>{const l=o.getState().activeChatId;if(l===s)return;s=l;const u=n.current?.config.user?.id??jr();M7e(u,l)})},[]),w.jsx(vp.Provider,{value:i,children:w.jsx(xt.QueryClientProvider,{client:i.runtime.queryClient,children:w.jsx(I3,{value:i.runtime.config.theme,children:w.jsx(v_e,{children:t})})})})},$e=()=>{const e=j.useContext(vp);if(!e)throw new Error("useAgentRuntime must be used inside <AgentProvider />");return e.runtime},fe=e=>{const t=j.useContext(vp);if(!t)throw new Error("useAgentStore must be used inside <AgentProvider />");return u5.useStore(t.store,e)},x_e=({initialSystemPrompt:e,composerFormRef:t,multiUser:n=!1,participantIds:r=[]})=>{const a=$e(),{composer:i,contextKey:o,activeChatId:s,draftChatKey:l,queuedMessages:u,activeChatStatus:d,upsertChat:p,setChatStatus:h,setActiveChat:m,setComposerError:f,moveChatKeyState:g,removeQueuedMessage:_,setPendingAssistant:k,enqueueQueuedMessage:b,appendMessagesToChat:x,commitPendingAssistant:M,setPageContextDismissed:N}=fe(V=>{const A=V.activeChatId??V.draftChatKey,Y=De(V,A);return{composer:V.composer,contextKey:V.contextKey,activeChatId:V.activeChatId,draftChatKey:V.draftChatKey,queuedMessages:Y.messageQueue,activeChatStatus:Y.status,upsertChat:V.upsertChat,setActiveChat:V.setActiveChat,setChatStatus:V.setChatStatus,setComposerError:V.setComposerError,moveChatKeyState:V.moveChatKeyState,setPendingAssistant:V.setPendingAssistant,removeQueuedMessage:V.removeQueuedMessage,enqueueQueuedMessage:V.enqueueQueuedMessage,appendMessagesToChat:V.appendMessagesToChat,commitPendingAssistant:V.commitPendingAssistant,setPageContextDismissed:V.setPageContextDismissed}}),E=j.useCallback(V=>!V||V.length===0?!1:V.some(A=>A.type===exports.AgentAttachmentType.Context&&A?.metadata?.kind==="pageContext"),[]),D=j.useRef(!1),P=j.useRef(!1),C=j.useRef(void 0),I=j.useRef(new Set),q=s??l,Z=j.useCallback(async(V,A)=>{if(!a.transport.generateTitle)return;const Y=a.config.features?.titleGeneration==="llm"?"llm":"local";let ee;try{ee=await a.transport.generateTitle({userId:A,content:V,strategy:Y,contextKey:o})}catch{}return ee},[a.transport,a.config.features?.titleGeneration,o]),X=j.useCallback(async(V,A=[])=>{const Y=a.config.user?.id??"guest",ee=!s,L=s??l,se={current:L};C.current=L;const ye={value:V,attachments:A};f(se.current,void 0);let ke;if(ee){const pe=await Z(V,Y);pe&&pe.trim().length>0&&(ke={...ke??{},title:pe})}const Ie=a.getChatMetadata({contextKey:o});Ie&&(ke={...ke??{},...Ie});const Pe=a.store.getState(),Ke=s?Pe.chats[s]:void 0,nt=(s?Pe.chatState[s]:void 0)?.messages??[],mt=A.filter(pe=>X3(pe)?!w_e(nt,pe):!0),Ye=Ke?.model,ie=i.model!==Ye;let xe,we=!1;ie?(xe=i.model,we=!0):Ye?(xe=Ye,we=!1):(xe=void 0,we=!1);const Ve=E_e(V),ue={userId:Y,content:V,metadata:ke,contextKey:o,...ee?{}:{chatId:s},...we?{model:xe??""}:{},...mt.length>0?{attachments:mt}:{},...n?{mentions:Ve,participantIds:Array.from(new Set([Y,...r])),senderDisplayName:a.config.user?.displayName,senderAvatarUrl:a.config.user?.avatarUrl}:{}},Le=()=>{k(se.current,void 0)},Be=pe=>{if(pe?.name==="AbortError"){const be=C.current??se.current;return I.current.has(be)?(M(se.current),I.current.delete(be)):(Le(),t.current?.setDraft(ye)),{type:"aborted"}}throw pe},Ce=async()=>{h(se.current,ct.Sending);try{if(!a.transport.sendMultiUserMessage)throw new Error("Multi-user chat requires a transport that supports sendMultiUserMessage");const pe=await a.transport.sendMultiUserMessage(ue);return p(pe.chat),ee&&(g(se.current,pe.chat.id),se.current=pe.chat.id,C.current=pe.chat.id,m(pe.chat.id)),x(pe.chat.id,[pe.message]),h(pe.chat.id,ka(pe.chat.status)),Le(),{type:"success"}}catch(pe){return Be(pe)}},ve=async()=>{let pe=`pending-${Date.now()}`,be="",Re;h(se.current,ct.Streaming),k(se.current,{id:pe,content:"",reasoning:"",toolCalls:[],attachments:[],chat:s||"",role:exports.MessageRole.Assistant,createdAt:new Date().toISOString()});try{let B=s;const Q=re=>{if(re.type===exports.StreamChunkType.Chat&&re.chat){p(re.chat),B=re.chat.id,ee&&(C.current=re.chat.id,g(se.current,re.chat.id),se.current=re.chat.id,m(re.chat.id));return}if(re.type===exports.StreamChunkType.Reasoning&&re.reasoning){be+=re.reasoning,Re={...Re??{id:pe,chat:B,role:exports.MessageRole.Assistant,content:"",createdAt:new Date().toISOString()},reasoning:be},k(se.current,Re);return}if(re.type===exports.StreamChunkType.Error&&re.error){const _e=typeof re.error=="string"?re.error:String(re.error),qe=Re??{id:pe,chat:B||se.current,role:exports.MessageRole.Assistant,content:_e,createdAt:new Date().toISOString()};x(se.current,[{...qe,content:_e}]),h(se.current,ct.Idle),Le();return}if(re.message&&re.message.role===exports.MessageRole.User){x(re.message.chat,[re.message]);return}re.message&&(pe=re.message.id,Re={...re.message,reasoning:be||re.message.reasoning},k(se.current,Re)),re.done&&(Re&&x(se.current,[Re]),h(se.current,ct.Idle),Le())},oe=await a.transport.streamMessage(ue,Q,{streamKey:C.current});if(oe){const re=oe.messages.map(it=>Re&&it.id===Re.id&&it.role===exports.MessageRole.Assistant?{...it,reasoning:be}:it);x(oe.id,re);const _e=a.store.getState();return(_e.activeChatId??_e.draftChatKey)===se.current&&m(oe.id),Le(),{type:"success"}}return Le(),{type:"success"}}catch(B){return Be(B)}};try{const pe=await(n?Ce():ve());return pe.type==="success"&&(D.current=!1),pe}catch(pe){Le();const be=pe?.chat;be&&(p(be),m(be.id));const Re=pe instanceof Error?pe:new Error("Failed to send message");return f(se.current,Re.message||"Failed to send message"),h(se.current,ct.Idle),t.current?.setDraft(ye),D.current=!1,{type:"error",error:Re}}finally{P.current=!1,n||h(se.current,ct.Idle),C.current=void 0}},[s,o,i.model,n,r,a.transport,a.config.user?.displayName,a.config.user?.avatarUrl,a.config.user?.id,p,m,k,h,Z,e,g,t,f]),K=j.useCallback(async()=>{if(d!==ct.Idle||P.current||!u.length||D.current)return;const V=u[0];P.current=!0,_(q,V.id);try{await X(V.content,V.attachments)}finally{P.current=!1}},[d,u,q,X,_]);j.useEffect(()=>{K()},[K]);const R=j.useCallback(async V=>{if(P.current)return;const A=u.find(Y=>Y.id===V);if(A){D.current=!1,P.current=!0,_(q,V);try{await X(A.content,A.attachments)}finally{P.current=!1}}},[u,q,_,X]),H=j.useCallback(async V=>{const Y=t.current.getDraft().attachments;if(!n&&d!==ct.Idle){b(q,V,Y),t.current?.clearDraft();return}D.current=!1,t.current?.clearDraft(),await X(V,Y)},[d,n,b,q,X,t,E,N]),G=j.useCallback(()=>{D.current=!0;const V=C.current??q;I.current.add(V),a.transport.cancelStream?.(V),M(V),h(V,ct.Idle)},[q,a.transport,M,h]),z=j.useCallback(async V=>{d===ct.Streaming&&G(),await R(V)},[d,G,R]);return{pendingKey:q,queuedMessages:u,activeChatStatus:d,activeChatId:s,removeQueuedMessage:_,handleSubmit:H,handleStop:G,handleQueuedClick:z}},w_e=(e,t)=>{const n=JSON.stringify(t.metadata?.data);let r;for(let a=e.length-1;a>=0;a--){const o=e[a].attachments?.find(X3);if(o){r=o;break}}return!r||r.url!==t.url?!1:JSON.stringify(r.metadata?.data)===n},X3=e=>e.type===exports.AgentAttachmentType.Context&&e.metadata?.kind==="pageContext",E_e=e=>{const t=e.matchAll(/(^|[\s([{])@([a-zA-Z0-9_.-]+)/g),n=new Set,r=[];for(const a of t){const i=a[2],o=i.toLowerCase();n.has(o)||(n.add(o),r.push({type:o==="agent"?"agent":"user",name:i}))}return r.length>0?r:void 0},M_e=({queuedMessages:e,onSendQueued:t,onRemoveQueued:n})=>e.length?w.jsxs("div",{className:"mp-agent-composer-queue",children:[w.jsx("div",{className:"mp-agent-composer-queue-header",children:w.jsxs("span",{children:[e.length," message",e.length>1?"s":""," queued"]})}),w.jsx("div",{className:"mp-agent-composer-queue-items",children:e.map(r=>w.jsxs("div",{className:"mp-agent-composer-queue-item",children:[w.jsxs("span",{className:"mp-agent-composer-queue-item-text",children:[r.content,r.attachments?.length?w.jsxs("span",{style:{marginLeft:8,opacity:.7,display:"inline-flex",alignItems:"center",gap:4},children:[w.jsx(ro,{size:12}),r.attachments.length]}):null]}),w.jsxs("div",{className:"mp-agent-composer-queue-item-actions",children:[w.jsx("button",{type:"button",className:"mp-agent-composer-queue-button",onClick:()=>t(r.id),"aria-label":"Send queued message",children:w.jsx(Vd,{size:12})}),w.jsx("button",{type:"button",className:"mp-agent-composer-queue-button",onClick:()=>n(r.id),"aria-label":"Remove queued message",children:w.jsx(O5,{size:12})})]})]},r.id))})]}):null;function S_e(e,t){return e.size>t.maxFileSize?{type:"size",message:`File "${e.name}" exceeds maximum size of ${_p(t.maxFileSize)}`,fileName:e.name}:null}function N_e(e,t,n){if(e.length+t.filter(s=>s.type==="file").length>n.maxFilesPerMessage)return{type:"count",message:`Maximum ${n.maxFilesPerMessage} files per message allowed`};for(const s of e){const l=S_e(s,n);if(l)return l}const a=t.filter(s=>s.type==="file").reduce((s,l)=>{const u=l.metadata?.size||l.size||0;return s+u},0),i=e.reduce((s,l)=>s+l.size,0);return a+i>n.maxTotalAttachmentsSize?{type:"totalSize",message:`Total attachment size exceeds maximum of ${_p(n.maxTotalAttachmentsSize)}`}:null}function _p(e){if(e===0)return"0 Bytes";const t=1024,n=["Bytes","KB","MB","GB"],r=Math.floor(Math.log(e)/Math.log(t));return Math.round(e/Math.pow(t,r)*100)/100+" "+n[r]}function A_e(){return{maxFileSize:10*1024*1024,maxTotalAttachmentsSize:50*1024*1024,maxFilesPerMessage:10,allowedMimeTypes:void 0}}const Q3=(e,t)=>{switch(e.type){case exports.AgentAttachmentType.Link:return w.jsx(A5,{size:12});case exports.AgentAttachmentType.Artifact:return w.jsx(ro,{size:12});case exports.AgentAttachmentType.Context:{const n=e?.metadata?.kind;if(n&&t?.[n])return t[n];switch(n){case"pageContext":return w.jsx(Yd,{size:12});case"formSnapshot":case"formField":return w.jsx(N5,{size:12});default:return w.jsx(Zd,{size:12})}}case exports.AgentAttachmentType.File:default:return w.jsx(S5,{size:12})}},T_e=({attachments:e})=>{const{config:t}=$e();return!e||e.length===0?null:w.jsx("div",{className:"mp-agent-message-attachments","aria-label":"Message attachments",children:e.map((n,r)=>{const a=w.jsxs(w.Fragment,{children:[w.jsx("span",{className:"mp-agent-message-attachment-icon",children:Q3(n,t.contextAttachmentIcons)}),w.jsx("span",{className:"mp-agent-message-attachment-name",children:n.name})]});return n.url?w.jsx("a",{className:"mp-agent-message-attachment",href:n.url,target:"_blank",rel:"noreferrer",title:n.url,children:a},n.id||r):w.jsx("span",{className:"mp-agent-message-attachment",title:n.mimeType??n.name,children:a},n.id||r)})})},C_e=({attachments:e,onRemove:t,uploadProgress:n,uploadErrors:r})=>{const a=Wt(),{config:i}=$e();return!e||e.length===0?null:w.jsx("div",{className:"mp-agent-composer-attachments","aria-label":a.attachments,children:e.map(o=>{const s=n?.get(o.id),l=r?.get(o.name),u=o.metadata?.size||o.size,d=u?` (${_p(u)})`:"";return w.jsxs("span",{className:`mp-agent-attachment-chip ${l?"mp-agent-attachment-chip-error":""} ${s?.status==="uploading"?"mp-agent-attachment-chip-uploading":""}`,title:l||o.name,children:[w.jsx("span",{className:"mp-agent-attachment-chip-icon",children:Q3(o,i.contextAttachmentIcons)}),w.jsxs("span",{className:"mp-agent-attachment-chip-name",title:o.name,children:[o.name,d]}),s?.status==="uploading"&&w.jsxs("span",{className:"mp-agent-attachment-chip-progress",children:[s.progress,"%"]}),l&&w.jsx("span",{className:"mp-agent-attachment-chip-error-text",title:l,children:"⚠"}),t?w.jsx(un,{size:"sm",icon:"X",type:"button",onClick:p=>{p.preventDefault(),p.stopPropagation(),t(o.id)},"aria-label":`Remove attachment ${o.name}`}):null]},o.id)})})},R_e=e=>{const t=e.trim();if(!t||/\s/.test(t))return;const n=i=>i.replace(/[)\].,;:!?]+$/,"");if(!/^https?:\/\//i.test(t))return;const r=i=>{try{const o=new URL(i);return o.protocol!=="http:"&&o.protocol!=="https:"?void 0:o.toString()}catch{return}},a=n(t);return r(a)},I_e=e=>{try{const t=new URL(e);return t.hostname+(t.pathname&&t.pathname!=="/"?t.pathname:"")}catch{return e}},gd="mp-agent:locationchange",N2="__mp_agent_history_patched__",A2=()=>{try{window.dispatchEvent(new Event(gd))}catch{}},O_e=()=>{if(typeof window>"u")return;const e=window;if(!e[N2]){e[N2]=!0;try{const t=history.pushState;history.pushState=function(...n){const r=t.apply(this,n);return A2(),r}}catch{}try{const t=history.replaceState;history.replaceState=function(...n){const r=t.apply(this,n);return A2(),r}}catch{}}},L_e=e=>{if(typeof window>"u")return()=>{};O_e();const t=()=>e();return window.addEventListener("popstate",t),window.addEventListener("hashchange",t),window.addEventListener(gd,t),()=>{window.removeEventListener("popstate",t),window.removeEventListener("hashchange",t),window.removeEventListener(gd,t)}};async function D_e(e,t,n,r){const a=await fetch(r.presignedUrlEndpoint,{method:"POST",credentials:"include",headers:{"Content-Type":"application/json",...r.getAuthHeaders?.()||{}},body:JSON.stringify({filename:e.name,mimeType:e.type||"application/octet-stream",size:e.size,chatId:t,userId:n})});if(!a.ok){const o=await a.text();throw new Error(`Failed to get presigned URL: ${a.status} ${o}`)}const i=await a.json();return{url:i.url,key:i.key}}async function z_e(e,t,n){return new Promise((r,a)=>{const i=new XMLHttpRequest;i.upload.addEventListener("progress",o=>{if(o.lengthComputable&&n){const s=Math.round(o.loaded/o.total*100);n(s)}}),i.addEventListener("load",()=>{i.status>=200&&i.status<300?r():a(new Error(`Upload failed: ${i.status} ${i.statusText}`))}),i.addEventListener("error",()=>{a(new Error("Upload failed: network error"))}),i.addEventListener("abort",()=>{a(new Error("Upload aborted"))}),i.open("PUT",t),i.setRequestHeader("Content-Type",e.type||"application/octet-stream"),i.send(e)})}async function $_e(e,t,n){const r=vt.nanoid(),a={fileId:r,fileName:e.name,progress:0,status:"pending"};try{n.onProgress?.({...a,status:"uploading",progress:0});const{url:i,key:o}=await D_e(e,n.chatId,n.userId,t);return await z_e(e,i,s=>{n.onProgress?.({...a,status:"uploading",progress:s})}),n.onProgress?.({...a,status:"completed",progress:100}),{id:r,type:exports.AgentAttachmentType.File,name:e.name,mimeType:e.type||void 0,size:e.size,metadata:{uploadedAt:new Date().toISOString(),s3Key:o,processingStatus:"pending",size:e.size,lastModified:e.lastModified}}}catch(i){const o=i instanceof Error?i.message:"Unknown error";throw n.onProgress?.({...a,status:"error",error:o}),i}}async function F_e(e,t,n){const r=await Promise.allSettled(e.map(o=>$_e(o,t,n))),a=[],i=[];if(r.forEach((o,s)=>{o.status==="fulfilled"?a.push(o.value):i.push(new Error(`Failed to process ${e[s].name}: ${o.reason}`))}),i.length>0&&a.length===0)throw i[0];return i.length>0&&console.warn("Some files failed to upload:",i),a}const P_e=({options:e,value:t,onChange:n,placeholder:r="Select...",disabled:a=!1,className:i="",triggerClassName:o="",placement:s="bottom-start",searchable:l=!1,searchPlaceholder:u="Search...",searchFilter:d})=>{const[p,h]=j.useState(!1),[m,f]=j.useState(null),[g,_]=j.useState(""),k=j.useRef([]),b=j.useRef(null),{refs:x,floatingStyles:M,context:N,isPositioned:E}=lp({open:p,onOpenChange:h,placement:s,strategy:"absolute",whileElementsMounted:np,middleware:[rp(8),ip({fallbackPlacements:["top-start","bottom-start","top-end","bottom-end"]}),ap({padding:8})]}),D=o3(N,{enabled:!a}),P=sp(N),C=up(N),q=X8e(N,{listRef:k,activeIndex:m,onNavigate:f,enabled:p&&!l,virtual:!1}),{getReferenceProps:Z,getFloatingProps:X,getItemProps:K}=cp(l?[D,P,C]:[D,P,C,q]),R=e.findIndex(Y=>Y.value===t),H=R>=0?e[R]:void 0,G=j.useMemo(()=>{const Y=g.trim().toLowerCase();if(!l||!Y)return e;const L=d?se=>d(se,Y):se=>`${se.label} ${se.description??""}`.toLowerCase().includes(Y);return e.filter(L)},[e,g,l,d]);j.useEffect(()=>{if(!p){f(null),_("");return}l&&setTimeout(()=>b.current?.focus(),0);const Y=G.findIndex(ee=>ee.value===t);f(Y>=0?Y:0)},[p,l,t,G]),j.useEffect(()=>{p&&f(G.length>0?0:null)},[g,G.length,p]);const z=Y=>G.length===0?null:Y<0?G.length-1:Y>=G.length?0:Y,V=Y=>{Y!=null&&k.current[Y]?.scrollIntoView({block:"nearest"})},A=Y=>{n(Y),h(!1),f(null),_("")};return w.jsxs("div",{className:`mp-agent-dropdown ${i}`,children:[w.jsxs("button",{ref:x.setReference,type:"button",className:`mp-agent-dropdown-trigger ${o}`,disabled:a,"aria-expanded":p,"aria-haspopup":"listbox",...Z(),children:[w.jsx("span",{className:"mp-agent-dropdown-trigger-content",children:H?w.jsxs(w.Fragment,{children:[H.icon&&w.jsx("span",{className:"mp-agent-dropdown-trigger-icon",children:H.icon}),w.jsx("span",{className:"mp-agent-dropdown-trigger-label",children:H.label})]}):w.jsx("span",{className:"mp-agent-dropdown-trigger-placeholder",children:r})}),w.jsx(no,{size:16,className:`mp-agent-dropdown-chevron ${p?"open":""}`})]}),p&&w.jsxs("div",{role:"listbox",ref:x.setFloating,style:{...M,opacity:E?1:0,pointerEvents:E?"auto":"none",transition:E?"opacity 0.15s ease-out":"none"},className:"mp-agent-dropdown-menu",...X(),children:[l&&w.jsx("div",{className:"mp-agent-dropdown-search",onKeyDown:Y=>Y.stopPropagation(),children:w.jsx("input",{ref:b,className:"mp-agent-dropdown-search-input",value:g,placeholder:u,onChange:Y=>_(Y.target.value),onKeyDown:Y=>{if(Y.key==="Escape"){Y.preventDefault(),h(!1),_("");return}if(Y.key==="ArrowDown"||Y.key==="ArrowUp"){Y.preventDefault();const ee=Y.key==="ArrowDown"?1:-1,L=m??(ee>0?-1:0),se=z(L+ee);f(se),V(se);return}if(Y.key==="Enter"){if(m==null)return;const ee=G[m];if(!ee)return;Y.preventDefault(),A(ee.value)}}})}),w.jsxs("div",{className:"mp-agent-dropdown-list",children:[G.map((Y,ee)=>w.jsxs("button",{ref:L=>{k.current[ee]=L},type:"button",className:`mp-agent-dropdown-item ${t===Y.value?"selected":""} ${m===ee?"active":""}`,role:"option","aria-selected":t===Y.value,...K({onClick:()=>A(Y.value),onMouseEnter:()=>{f(ee)},onKeyDown:L=>{(L.key==="Enter"||L.key===" ")&&(L.preventDefault(),A(Y.value))}}),children:[Y.icon&&w.jsx("span",{className:"mp-agent-dropdown-item-icon",children:Y.icon}),w.jsxs("span",{className:"mp-agent-dropdown-item-content",children:[w.jsx("span",{className:"mp-agent-dropdown-item-label",children:Y.label}),Y.description&&w.jsx("span",{className:"mp-agent-dropdown-item-description",children:Y.description})]})]},Y.value)),l&&G.length===0&&w.jsx("div",{className:"mp-agent-dropdown-empty","aria-label":"No results",children:"No results"})]})]})]})},q_e=j.memo(()=>{const e=$e(),t=fe(p=>p.composer),n=fe(p=>p.contextKey),r=fe(p=>p.setComposerOptions),a=e.config.models,{data:i,isLoading:o}=f3(),s=j.useMemo(()=>{const p=i&&i.length>0?i:a;return D3(p,e.config.transport).filter(m=>!m.contexts?.length||m.contexts.includes(n))},[i,a,e.config.transport,n]),l=j.useMemo(()=>{const p=s.slice().sort((h,m)=>h.label.localeCompare(m.label,void 0,{sensitivity:"base"})).map(h=>({value:h.id,label:h.label}));return[{value:ra,label:"Auto"},...p]},[s]),u=j.useMemo(()=>t.model!==void 0?t.model:ra,[t.model]),d=j.useCallback(p=>{p===ra?(r({model:void 0}),_2(e.config.transport,ra)):(r({model:p}),_2(e.config.transport,p))},[r,e.config.transport]);return o&&!a?.length||l.length===0?null:w.jsx(P_e,{options:l,value:u,onChange:d,placeholder:"Select model...",searchable:!0,searchPlaceholder:"Search models...",placement:"top-start",triggerClassName:"mp-agent-model-selector-trigger"})}),B_e=e=>{if(!e)return"";let t=e.replace(/[_-]+/g," ");return t=t.replace(/([a-z0-9])([A-Z])/g,"$1 $2"),t=t.trim().replace(/\s+/g," "),t?t.charAt(0).toUpperCase()+t.slice(1):""},U_e=({checked:e,disabled:t,onChange:n,className:r="",...a})=>{const i=o=>{o.preventDefault(),!t&&n(!e)};return w.jsx("button",{type:"button",role:"switch","aria-checked":e,disabled:t,className:`mp-agent-switch ${e?"on":"off"} ${r}`.trim(),onClick:i,...a,children:w.jsx("span",{className:"mp-agent-switch-thumb"})})},T2=e=>e.reduce((t,n)=>(t[n.agentName]={...n.tools},t),{}),J3=({preferences:e,disabled:t})=>{const n=Wt(),{upsertSingle:r}=_3(),[a,i]=j.useState(()=>T2(e)),[o,s]=j.useState({});j.useEffect(()=>{i(T2(e))},[e]);const l=r.error?.message,u=j.useMemo(()=>e.some(p=>Object.keys(p.tools).length>0),[e]),d=(p,h,m)=>{i(f=>{const g=f[p]??{},_=g,k={...g,[h]:m},b={...f,[p]:k};return s(x=>({...x,[p]:{...x[p]??{},[h]:!0}})),r.mutate({agentName:p,input:{tools:k}},{onError:()=>{i(x=>({...x,[p]:_}))},onSettled:()=>{s(x=>{const M={...x[p]??{}};if(delete M[h],Object.keys(M).length===0){const{[p]:N,...E}=x;return E}return{...x,[p]:M}})}}),b})};return w.jsxs("div",{className:"mp-agent-preferences-panel",children:[!u&&w.jsx("div",{className:"mp-agent-preferences-empty",children:n.agentSettingsNoConfigurableTools}),e.map(p=>{const h=a[p.agentName]??{},m=Object.entries(h);return w.jsxs("div",{className:"mp-agent-preferences-agent",children:[w.jsx("div",{className:"mp-agent-preferences-agent-header",children:w.jsx("strong",{children:p.agentName})}),m.length===0?w.jsx("div",{className:"mp-agent-preferences-empty",children:n.agentSettingsNoToolsForAgent}):w.jsx("div",{className:"mp-agent-preferences-tools",children:m.map(([f,g])=>{const _=!!o[p.agentName]?.[f];return w.jsxs("label",{className:"mp-agent-preferences-tool",children:[w.jsx("span",{className:"mp-agent-preferences-tool-label",children:B_e(f)}),w.jsx(U_e,{checked:g,onChange:k=>d(p.agentName,f,k),disabled:!!t||_})]},`${p.agentName}:${f}`)})})]},p.agentName)}),l&&w.jsx("div",{className:"mp-agent-preferences-error",children:l})]})};function H_e(e){return e.map(t=>{const n=(t.tools??[]).reduce((r,a)=>(a.userConfigurable&&(r[a.title]=!a.disabledByDefault),r),{});return{agentName:t.name,tools:n}})}const j_e=()=>{const e=Wt(),t=$e(),n=fe(l=>l.contextKey),{data:r,isLoading:a,isError:i}=b3(n),o=j.useMemo(()=>H_e(r??[]),[r]),s=!!t.transport.upsertAgentPreferences&&!!t.transport.upsertAgentPreferencesBatch;return a?w.jsx(w.Fragment,{children:e.agentSettingsLoading}):i?w.jsx(w.Fragment,{children:e.agentSettingsError}):w.jsx(J3,{preferences:o,disabled:!s})},V_e=()=>{const[e,t]=j.useState(!1),n=Wt(),{refs:r,floatingStyles:a,context:i,isPositioned:o}=lp({open:e,onOpenChange:t,placement:"top-start",strategy:"absolute",whileElementsMounted:np,middleware:[rp(8),ip({fallbackPlacements:["bottom-start","top-end","bottom-end"]}),ap({padding:8})]}),s=o3(i),l=sp(i),u=up(i),{getReferenceProps:d,getFloatingProps:p}=cp([s,l,u]);return w.jsxs("div",{className:"mp-agent-tool-config-dropdown",children:[w.jsx(Tn,{content:n.agentSettingsTooltip,children:w.jsx("button",{ref:r.setReference,type:"button",className:"mp-agent-composer-button mp-agent-composer-tool-button","aria-label":n.agentSettingsTooltip,...d(),children:w.jsx(C5,{size:16})})}),e&&w.jsx("div",{ref:r.setFloating,style:{...a,opacity:o?1:0,pointerEvents:o?"auto":"none",transition:o?"opacity 0.15s ease-out":"none"},className:"mp-agent-tool-config-panel",...p(),children:w.jsx(j_e,{})})]})},G_e=j.forwardRef(({autoFocus:e,activeChatId:t,status:n,onStop:r,onSubmit:a},i)=>{const o=Wt(),s=$e(),l=j.useRef(null),u=j.useRef(null),d=fe(ie=>ie.activeChatId??ie.draftChatKey),p=fe(ie=>De(ie,d).composerDraft),h=fe(ie=>De(ie,d).composerError),m=fe(ie=>De(ie,d).pageContextDismissed),f=fe(ie=>ie.setComposerValue),g=fe(ie=>ie.setComposerDraft),_=fe(ie=>ie.clearComposerDraft),k=fe(ie=>ie.setComposerError),b=fe(ie=>ie.addComposerAttachments),x=fe(ie=>ie.removeComposerAttachment),M=fe(ie=>ie.setPageContextDismissed),N=p.value,E=p.attachments,[D,P]=j.useState(new Map),[C,I]=j.useState(new Map),q=j.useRef(N),Z=j.useRef(E),X=j.useRef(m),K=s.config.features?.pageContextAttachments!==!1,R=s.config.composerAttachmentActions,G=`Attach ${s.config.pageContext?.name?.trim()||"Page context"}`,z=s.config.contextAttachmentIcons?.pageContext??w.jsx(Yd,{size:16}),V=ie=>ie.type===exports.AgentAttachmentType.Context&&ie?.metadata?.kind==="pageContext",A=E.some(V),Y=()=>{if(K)return s.buildPageContextAttachment()};j.useEffect(()=>{Z.current=E},[E]),j.useEffect(()=>{q.current=N},[N]),j.useEffect(()=>{X.current=m},[m]),j.useEffect(()=>{if(!K||m||A)return;const ie=Y();ie&&b(d,[ie])},[K,m,A,d,b]),j.useEffect(()=>{if(K&&!(typeof window>"u"))return L_e(()=>{if(X.current)return;const ie=Z.current,xe=ie.find(V);if(!xe)return;const we=Y();if(!we)return;const Ve={...we,id:xe.id},ue=ie.map(Le=>Le.id===xe.id?Ve:Le);g(d,{value:q.current,attachments:ue})})},[K,d,g]),j.useImperativeHandle(i,()=>({setValue:ie=>{f(d,ie)},getDraft:()=>({value:N,attachments:E}),setDraft:ie=>{g(d,{value:ie.value,attachments:ie.attachments??[]})},clearDraft:()=>{_(d)},buildPageContextAttachment:()=>Y()})),j.useEffect(()=>{const ie=l.current;ie&&(ie.style.height="auto",ie.style.height=`${Math.min(ie.scrollHeight,200)}px`)},[N]);const ee=async ie=>{if(!ie||ie.length===0)return;const xe=Array.from(ie),we=A_e(),Ve=N_e(xe,E,we);if(Ve){I(ue=>{const Le=new Map(ue);return xe.forEach(Be=>{Le.set(Be.name,Ve.message)}),Le});return}I(ue=>{const Le=new Map(ue);return xe.forEach(Be=>Le.delete(Be.name)),Le});try{const ue=s.config.transport;if(ue.mode!=="proxy")throw new Error("File uploads are only supported with proxy transport");const Le={presignedUrlEndpoint:`${ue.baseUrl}/files/upload/presigned`,getAuthHeaders:()=>{const Ce={};return ue.headers?ue.headers:(ue.apiKey&&(Ce.Authorization=`Bearer ${ue.apiKey}`),Ce)}},Be=await F_e(xe,Le,{chatId:t,userId:s.config.user?.id,onProgress:Ce=>{P(ve=>{const pe=new Map(ve);return pe.set(Ce.fileId,Ce),pe})}});b(d,Be),setTimeout(()=>{P(Ce=>{const ve=new Map(Ce);return Be.forEach(pe=>ve.delete(pe.id)),ve})},2e3)}catch(ue){const Le=ue instanceof Error?ue.message:"Failed to upload files";I(Be=>{const Ce=new Map(Be);return xe.forEach(ve=>{Ce.set(ve.name,Le)}),Ce})}},L=()=>{u.current?.click()},se=ie=>{const xe=R_e(ie);if(!xe)return!1;if(E.some(ue=>ue.type===exports.AgentAttachmentType.Link&&ue.url===xe))return!0;const we=I_e(xe),Ve={id:vt.nanoid(),url:xe,name:we,type:exports.AgentAttachmentType.Link};return b(d,[Ve]),!0},ye=async ie=>{await ee(ie.target.files),ie.target.value=""},ke=ie=>{const xe=E.find(we=>we.id===ie);xe&&V(xe)&&M(d,!0),x(d,ie)},Ie=()=>{if(typeof window>"u"||typeof document>"u")return!1;const ie=A3(),xe=ie?.selectedText??window.getSelection?.()?.toString()?.trim()??"";if(!xe)return!1;const we=window.location?.href,Ve=xe.slice(0,20),ue=xe.length>20?Ve+"...":xe,Le=yo({kind:"webSnippet",url:we,title:ue,selectedText:xe,source:{app:"browser",url:we},...ie?.target?{target:ie.target}:{}});return b(d,[Le]),!0},Pe=ie=>{ie.preventDefault();const xe=N.trim();xe&&(k(d,void 0),a(xe))},Ke=ie=>{ie.key==="Enter"&&!ie.shiftKey&&(ie.preventDefault(),Pe(ie))},Ge=ie=>{h&&k(d,void 0),f(d,ie.target.value)},nt=ie=>{if(ie.nativeEvent.shiftKey)return;const xe=ie.clipboardData?.getData("text/plain")??"";if(!xe)return;se(xe)&&ie.preventDefault()},Ye=!!N.trim();return w.jsxs(w.Fragment,{children:[w.jsxs("form",{onSubmit:Pe,className:"mp-agent-composer-input-wrapper",id:"composer-form",children:[w.jsx("input",{ref:u,type:"file",multiple:!0,style:{display:"none"},onChange:ye}),w.jsx(C_e,{attachments:E,onRemove:ke,uploadProgress:D,uploadErrors:C}),w.jsx("textarea",{rows:2,name:"message",ref:l,value:N,autoFocus:e,className:"mp-agent-composer-textarea",placeholder:t?o.followUp:o.newChat,onChange:Ge,onKeyDown:Ke,onPaste:nt})]}),w.jsxs("div",{className:"mp-agent-composer-actions",children:[w.jsxs("div",{className:"mp-agent-composer-actions-left",children:[s.config.features?.modelSwitching&&w.jsx(q_e,{}),s.config.features?.toolConfiguration&&w.jsx(V_e,{}),s.config.features?.fileAttachments&&w.jsx(Tn,{content:o.attachFiles,children:w.jsx("button",{type:"button",className:"mp-agent-composer-button mp-agent-composer-tool-button",onClick:L,"aria-label":o.attachFiles,children:w.jsx(ro,{size:16})})}),s.config.features?.selectionAttachments&&w.jsx(Tn,{content:o.attachSelectionToContext,children:w.jsx("button",{type:"button",className:"mp-agent-composer-button mp-agent-composer-tool-button",onClick:()=>{Ie()},"aria-label":o.attachSelectionToContext,children:w.jsx(Zd,{size:16})})}),K&&!A&&w.jsx(Tn,{content:G,children:w.jsx("button",{type:"button",className:"mp-agent-composer-button mp-agent-composer-tool-button",onClick:()=>{M(d,!1);const ie=Y();ie&&b(d,[ie])},"aria-label":G,children:z})}),R&&w.jsx(R,{chatKey:d,activeChatId:t,attachments:E,addAttachments:ie=>b(d,ie),removeAttachment:ke})]}),w.jsx("div",{className:"mp-agent-composer-actions-right",children:n===ct.Streaming&&!Ye?w.jsx(Tn,{content:o.stopStreaming,children:w.jsx("button",{type:"button",onClick:r,"aria-label":o.stopStreaming,className:"mp-agent-composer-button mp-agent-composer-send-button",children:w.jsx(I5,{size:12})})}):w.jsx(Tn,{content:Ye?o.sendMessage:o.typeMessageToSend,children:w.jsx("button",{type:"submit",form:"composer-form",disabled:!Ye,"aria-label":o.sendMessage,className:"mp-agent-composer-button mp-agent-composer-send-button",children:w.jsx(Vd,{size:16})})})})]})]})}),ev=({autoFocus:e,multiUser:t=!1,participantIds:n})=>{const r=j.useRef({setValue:()=>{},getDraft:()=>({value:"",attachments:[]}),setDraft:()=>{},clearDraft:()=>{}}),{pendingKey:a,queuedMessages:i,activeChatStatus:o,activeChatId:s,handleSubmit:l,handleStop:u,handleQueuedClick:d,removeQueuedMessage:p}=x_e({composerFormRef:r,multiUser:t,participantIds:n});return w.jsx("div",{className:"mp-agent-composer-wrapper",children:w.jsxs("div",{className:"mp-agent-composer",children:[w.jsx(M_e,{queuedMessages:i,onSendQueued:d,onRemoveQueued:h=>p(a,h)}),w.jsx(G_e,{status:o,ref:r,autoFocus:e,activeChatId:s,onStop:u,onSubmit:l})]})})};function W_e(e,t,n){const r=new Array(e);return new Proxy(r,{get(a,i,o){if(typeof i=="string"){const s=i.charCodeAt(0);if(s>=48&&s<=57){const l=+i;if(Number.isInteger(l)&&l>=0&&l<e){let u=a[l];if(!u){const d=t[l*2];u=a[l]={index:l,key:n(l),start:d,size:t[l*2+1],end:d+t[l*2+1],lane:0}}return u}}if(i==="length")return e}return Reflect.get(a,i,o)}})}function Mr(e,t,n){let r=n.initialDeps??[],a,i=!0;function o(){var s;const l=process.env.NODE_ENV!=="production"&&!!n.key&&!!((s=n.debug)!=null&&s.call(n));let u=0;l&&(u=Date.now());const d=e();if(!(d.length!==r.length||d.some((m,f)=>r[f]!==m)))return a;r=d;let h=0;if(l&&(h=Date.now()),a=t(...d),l){const m=Math.round((Date.now()-u)*100)/100,f=Math.round((Date.now()-h)*100)/100,g=f/16,_=(k,b)=>{for(k=String(k);k.length<b;)k=" "+k;return k};console.info(`%c⏱ ${_(f,5)} /${_(m,5)} ms`,`
|
|
8294
8294
|
font-size: .6rem;
|
|
8295
8295
|
font-weight: bold;
|
|
8296
|
-
color: hsl(${Math.max(0,Math.min(120-120*g,120))}deg 100% 31%);`,n?.key)}return n?.onChange&&!(i&&n.skipInitialOnChange)&&n.onChange(a),i=!1,a}return o.updateDeps=s=>{r=s},o}function C2(e,t){if(e===void 0)throw new Error("Unexpected undefined");return e}const K_e=(e,t)=>Math.abs(e-t)<1.01,Y_e=(e,t,n)=>{let r;return function(...a){e.clearTimeout(r),r=e.setTimeout(()=>t.apply(this,a),n)}};let Qr;const ls=()=>{if(Qr!==void 0)return Qr;if(typeof navigator>"u")return Qr=!1;if(/iP(hone|od|ad)/.test(navigator.userAgent))return Qr=!0;const e=navigator.maxTouchPoints;return Qr=navigator.platform==="MacIntel"&&e!==void 0&&e>0},R2=e=>{const{offsetWidth:t,offsetHeight:n}=e;return{width:t,height:n}},Z_e=e=>e,X_e=e=>{const t=Math.max(e.startIndex-e.overscan,0),r=Math.min(e.endIndex+e.overscan,e.count-1)-t+1,a=new Array(r);for(let i=0;i<r;i++)a[i]=t+i;return a},Q_e=(e,t)=>{const n=e.scrollElement;if(!n)return;const r=e.targetWindow;if(!r)return;const a=o=>{const{width:s,height:l}=o;t({width:Math.round(s),height:Math.round(l)})};if(a(R2(n)),!r.ResizeObserver)return()=>{};const i=new r.ResizeObserver(o=>{const s=()=>{const l=o[0];if(l?.borderBoxSize){const u=l.borderBoxSize[0];if(u){a({width:u.inlineSize,height:u.blockSize});return}}a(R2(n))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(s):s()});return i.observe(n,{box:"border-box"}),()=>{i.unobserve(n)}},Pi={passive:!0},J_e=typeof window>"u"?!0:"onscrollend"in window,exe=(e,t,n)=>{const r=e.scrollElement;if(!r)return;const a=e.targetWindow;if(!a)return;const i=e.options.useScrollendEvent&&J_e;let o=0;const s=i?null:Y_e(a,()=>t(o,!1),e.options.isScrollingResetDelay),l=p=>()=>{o=n(r),s?.(),t(o,p)},u=l(!0),d=l(!1);return r.addEventListener("scroll",u,Pi),i&&r.addEventListener("scrollend",d,Pi),()=>{r.removeEventListener("scroll",u),i&&r.removeEventListener("scrollend",d)}},txe=(e,t)=>exe(e,t,n=>{const{horizontal:r,isRtl:a}=e.options;return r?n.scrollLeft*(a&&-1||1):n.scrollTop}),nxe=(e,t,n)=>{if(n.options.useCachedMeasurements){const r=n.indexFromElement(e),a=n.options.getItemKey(r);return n.itemSizeCache.get(a)??n.options.estimateSize(r)}if(t?.borderBoxSize){const r=t.borderBoxSize[0];if(r)return Math.round(r[n.options.horizontal?"inlineSize":"blockSize"])}if(!t){const r=n.indexFromElement(e),a=n.options.getItemKey(r),i=n.itemSizeCache.get(a);if(i!==void 0)return i}return e[n.options.horizontal?"offsetWidth":"offsetHeight"]},rxe=(e,{adjustments:t=0,behavior:n},r)=>{var a,i;(i=(a=r.scrollElement)==null?void 0:a.scrollTo)==null||i.call(a,{[r.options.horizontal?"left":"top"]:e+t,behavior:n})},axe=rxe;class ixe{constructor(t){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this._flatMeasurements=null,this.itemSizeCache=new Map,this.itemSizeCacheVersion=0,this.laneAssignments=new Map,this.pendingMin=null,this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.pendingScrollAnchor=null,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this._iosDeferredAdjustment=0,this._iosTouching=!1,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._intendedScrollOffset=null,this.elementsCache=new Map,this.now=()=>{var n,r,a;return((a=(r=(n=this.targetWindow)==null?void 0:n.performance)==null?void 0:r.now)==null?void 0:a.call(r))??Date.now()},this.observer=(()=>{let n=null;const r=()=>n||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:n=new this.targetWindow.ResizeObserver(a=>{a.forEach(i=>{const o=()=>{const s=i.target,l=this.indexFromElement(s);if(!s.isConnected){this.observer.unobserve(s);for(const[u,d]of this.elementsCache)if(d===s){this.elementsCache.delete(u);break}return}this.shouldMeasureDuringScroll(l)&&this.resizeItem(l,this.options.measureElement(s,i,this))};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(o):o()})}));return{disconnect:()=>{var a;(a=r())==null||a.disconnect(),n=null},observe:a=>{var i;return(i=r())==null?void 0:i.observe(a,{box:"border-box"})},unobserve:a=>{var i;return(i=r())==null?void 0:i.unobserve(a)}}})(),this.range=null,this.setOptions=n=>{var r,a;const i={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:Z_e,rangeExtractor:X_e,onChange:()=>{},measureElement:nxe,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,anchorTo:"start",followOnAppend:!1,scrollEndThreshold:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,laneAssignmentMode:"estimate",useCachedMeasurements:!1};for(const h in n){const m=n[h];m!==void 0&&(i[h]=m)}const o=this.options;let s=null,l=null,u=!1;if(o!==void 0&&o.enabled&&i.enabled&&i.anchorTo==="end"&&this.scrollElement!==null){const h=o.count,m=i.count,f=this.getMeasurements(),g=h>0?((r=f[0])==null?void 0:r.key)??o.getItemKey(0):null,_=h>0?((a=f[h-1])==null?void 0:a.key)??o.getItemKey(h-1):null;if(m!==h||h>0&&m>0&&(i.getItemKey(0)!==g||i.getItemKey(m-1)!==_)){u=!0;const x=h>0?this.getVirtualItemForOffset(this.getScrollOffset())??f[0]:null;x&&(s=[x.key,this.getScrollOffset()-x.start]);const M=i.followOnAppend===!0?"auto":i.followOnAppend||null;M&&m>h&&this.isAtEnd(o.scrollEndThreshold)&&(h===0||i.getItemKey(m-1)!==_)&&(l=M)}}this.options=i,u&&(this.pendingMin=0,this.itemSizeCacheVersion++);let d=!1,p=0;if(s&&this.scrollOffset!==null){const[h,m]=s,f=this.getMeasurements(),{count:g,getItemKey:_}=this.options;let k=0;for(;k<g&&_(k)!==h;)k++;if(k<g){const b=f[k];if(b){const x=Math.max(0,b.start+m);x!==this.scrollOffset&&(p=x-this.scrollOffset,this.scrollOffset=x,d=!0)}}}(d||l)&&(this.pendingScrollAnchor=[d?s[0]:null,d?s[1]:0,l,p])},this.notify=n=>{var r,a;(a=(r=this.options).onChange)==null||a.call(r,this,n)},this.maybeNotify=Mr(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),n=>{this.notify(n)},{key:process.env.NODE_ENV!=="production"&&"maybeNotify",debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(n=>n()),this.unsubs=[],this.observer.disconnect(),this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this._iosDeferredAdjustment=0,this._iosTouching=!1,this._iosJustTouchEnded=!1,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var n;const r=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==r){if(this.cleanup(),!r){this.maybeNotify();return}if(this.scrollElement=r,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((n=this.scrollElement)==null?void 0:n.window)??null,this.elementsCache.forEach(i=>{this.observer.observe(i)}),this.unsubs.push(this.options.observeElementRect(this,i=>{this.scrollRect=i,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(i,o)=>{if(o&&this._intendedScrollOffset===null&&i===this.scrollOffset)return;this._intendedScrollOffset!==null&&Math.abs(i-this._intendedScrollOffset)<1.5&&(i=this._intendedScrollOffset),this._intendedScrollOffset=null,this.scrollAdjustments=0;const s=this.getScrollOffset();this.scrollDirection=o?s===i?this.scrollDirection:s<i?"forward":"backward":null,this.scrollOffset=i,this.isScrolling=o,this._flushIosDeferredIfReady(),this.scrollState&&this.scheduleScrollReconcile(),this.maybeNotify()})),"addEventListener"in this.scrollElement){const i=this.scrollElement,o=()=>{this._iosTouching=!0,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)},s=()=>{this._iosTouching=!1,!(!ls()||this.targetWindow==null)&&(this._iosJustTouchEnded=!0,this._iosTouchEndTimerId=this.targetWindow.setTimeout(()=>{this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._flushIosDeferredIfReady()},150))};i.addEventListener("touchstart",o,Pi),i.addEventListener("touchend",s,Pi),this.unsubs.push(()=>{i.removeEventListener("touchstart",o),i.removeEventListener("touchend",s),this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)})}this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}const a=this.pendingScrollAnchor;if(this.pendingScrollAnchor=null,a&&this.scrollElement&&this.options.enabled){const[i,o,s,l]=a;i!==null&&!s&&(ls()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?l!==0&&(this._iosDeferredAdjustment+=l):this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})),s&&this.scrollToEnd({behavior:s})}},this._flushIosDeferredIfReady=()=>{if(this._iosDeferredAdjustment===0||this.isScrolling||this._iosTouching||this._iosJustTouchEnded)return;const n=this.getScrollOffset(),r=this.getMaxScrollOffset();if(n<0||n>r)return;if(this._iosDeferredAdjustment<0&&n>=r-1){this._iosDeferredAdjustment=0;return}const a=this._iosDeferredAdjustment;this._iosDeferredAdjustment=0,this._scrollToOffset(n,{adjustments:this.scrollAdjustments+=a,behavior:void 0})},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getMeasurementOptions=Mr(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes,this.options.laneAssignmentMode,this.options.gap],(n,r,a,i,o,s,l,u)=>(this.prevLanes!==void 0&&this.prevLanes!==s&&(this.lanesChangedFlag=!0),this.prevLanes=s,this.pendingMin=null,{count:n,paddingStart:r,scrollMargin:a,getItemKey:i,enabled:o,lanes:s,laneAssignmentMode:l,gap:u}),{key:!1}),this.getMeasurements=Mr(()=>[this.getMeasurementOptions(),this.itemSizeCacheVersion],({count:n,paddingStart:r,scrollMargin:a,getItemKey:i,enabled:o,lanes:s,laneAssignmentMode:l,gap:u},d)=>{const p=this.itemSizeCache;if(!o)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>n)for(const k of this.laneAssignments.keys())k>=n&&this.laneAssignments.delete(k);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMin=null),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(k=>{this.itemSizeCache.set(k.key,k.size)}));const h=this.lanesSettling?0:this.pendingMin??0;if(this.pendingMin=null,this.lanesSettling&&this.measurementsCache.length===n&&(this.lanesSettling=!1),s===1){const k=n*2;let b=this._flatMeasurements;if(!b||b.length<k){const N=new Float64Array(k);b&&h>0&&N.set(b.subarray(0,h*2)),b=N,this._flatMeasurements=b}let x;if(h===0)x=r+a;else{const N=h-1;x=b[N*2]+b[N*2+1]+u}for(let N=h;N<n;N++){const E=i(N),D=p.get(E),P=typeof D=="number"?D:this.options.estimateSize(N);b[N*2]=x,b[N*2+1]=P,x+=P+u}const M=W_e(n,b,i);return this.measurementsCache=M,M}const m=this.measurementsCache.slice(0,h),f=new Array(s).fill(void 0),g=new Float64Array(s);let _=0;for(let k=0;k<h;k++){const b=m[k];b&&(f[b.lane]===void 0&&_++,f[b.lane]=k,g[b.lane]=b.end)}for(let k=h;k<n;k++){const b=i(k),x=this.laneAssignments.get(k);let M,N;const E=l==="estimate"||p.has(b);if(x!==void 0&&this.options.lanes>1){M=x;const I=f[M],q=I!==void 0?m[I]:void 0;N=q?q.end+u:r+a}else if(_===s){let I=0,q=g[0],Z=f[0];for(let X=1;X<s;X++){const K=g[X];(K<q||K===q&&f[X]<Z)&&(I=X,q=K,Z=f[X])}M=I,N=q+u,E&&this.laneAssignments.set(k,M)}else M=k%this.options.lanes,N=r+a,E&&this.laneAssignments.set(k,M);const D=p.get(b),P=typeof D=="number"?D:this.options.estimateSize(k),C=N+P;m[k]={index:k,start:N,size:P,end:C,key:b,lane:M},f[M]===void 0&&_++,f[M]=k,g[M]=C}return this.measurementsCache=m,m},{key:process.env.NODE_ENV!=="production"&&"getMeasurements",debug:()=>this.options.debug}),this.calculateRange=Mr(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(n,r,a,i)=>n.length===0||r===0?(this.range=null,null):(this.range=sxe(n,r,a,i,i===1&&this._flatMeasurements!=null?this._flatMeasurements:null),this.range),{key:process.env.NODE_ENV!=="production"&&"calculateRange",debug:()=>this.options.debug}),this.getVirtualIndexes=Mr(()=>{let n=null,r=null;const a=this.calculateRange();return a&&(n=a.startIndex,r=a.endIndex),this.maybeNotify.updateDeps([this.isScrolling,n,r]),[this.options.rangeExtractor,this.options.overscan,this.options.count,n,r]},(n,r,a,i,o)=>i===null||o===null?[]:n({startIndex:i,endIndex:o,overscan:r,count:a}),{key:process.env.NODE_ENV!=="production"&&"getVirtualIndexes",debug:()=>this.options.debug}),this.indexFromElement=n=>{const r=this.options.indexAttribute,a=n.getAttribute(r);return a?parseInt(a,10):(console.warn(`Missing attribute name '${r}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=n=>{var r;if(!this.scrollState||this.scrollState.behavior!=="smooth")return!0;const a=this.scrollState.index??((r=this.getVirtualItemForOffset(this.scrollState.lastTargetOffset))==null?void 0:r.index);if(a!==void 0&&this.range){const i=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),o=Math.max(0,a-i),s=Math.min(this.options.count-1,a+i);return n>=o&&n<=s}return!0},this.measureElement=n=>{if(!n){this.elementsCache.forEach((o,s)=>{o.isConnected||(this.observer.unobserve(o),this.elementsCache.delete(s))});return}const r=this.indexFromElement(n),a=this.options.getItemKey(r),i=this.elementsCache.get(a);i!==n&&(i&&this.observer.unobserve(i),this.observer.observe(n),this.elementsCache.set(a,n)),(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(r)&&this.resizeItem(r,this.options.measureElement(n,void 0,this))},this.resizeItem=(n,r)=>{var a,i;if(n<0||n>=this.options.count)return;let o,s,l;const u=this._flatMeasurements;if(this.options.lanes===1&&u!==null)l=this.options.getItemKey(n),s=u[n*2],o=u[n*2+1];else{const h=this.measurementsCache[n];if(!h)return;l=h.key,s=h.start,o=h.size}const d=this.itemSizeCache.get(l)??o,p=r-d;if(p!==0){const h=this.options.anchorTo==="end"&&((a=this.scrollState)==null?void 0:a.behavior)!=="smooth"&&this.getVirtualDistanceFromEnd()<=this.options.scrollEndThreshold,m=h?this.getTotalSize():0,f=this.getScrollOffset()+this.scrollAdjustments,_=!this.itemSizeCache.has(l)?s<f:s+d<=f&&this.scrollDirection!=="backward",k=((i=this.scrollState)==null?void 0:i.behavior)!=="smooth"&&(this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(this.measurementsCache[n]??{index:n,key:l,start:s,size:o,end:s+o,lane:0},p,this):_);(this.pendingMin===null||n<this.pendingMin)&&(this.pendingMin=n),this.itemSizeCache.set(l,r),this.itemSizeCacheVersion++;let b=!1;h?b=this.applyScrollAdjustment(this.getTotalSize()-m):k&&(b=this.applyScrollAdjustment(p)),this.notify(b)}},this.getVirtualItems=Mr(()=>[this.getVirtualIndexes(),this.getMeasurements()],(n,r)=>{const a=[];for(let i=0,o=n.length;i<o;i++){const s=n[i],l=r[s];a.push(l)}return a},{key:process.env.NODE_ENV!=="production"&&"getVirtualItems",debug:()=>this.options.debug}),this.getVirtualItemForOffset=n=>{const r=this.getMeasurements();if(r.length===0)return;const a=this._flatMeasurements,i=this.options.lanes===1&&a!=null,o=tv(0,r.length-1,i?s=>a[s*2]:s=>C2(r[s]).start,n);return C2(r[o])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if("scrollHeight"in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{const n=this.scrollElement.document.documentElement;return this.options.horizontal?n.scrollWidth-this.scrollElement.innerWidth:n.scrollHeight-this.scrollElement.innerHeight}},this.getVirtualDistanceFromEnd=()=>Math.max(this.getTotalSize()-this.getSize()-this.getScrollOffset(),0),this.getDistanceFromEnd=()=>Math.max(this.getMaxScrollOffset()-this.getScrollOffset(),0),this.isAtEnd=(n=this.options.scrollEndThreshold)=>this.getDistanceFromEnd()<=n,this.getOffsetForAlignment=(n,r,a=0)=>{if(!this.scrollElement)return 0;const i=this.getSize(),o=this.getScrollOffset();r==="auto"&&(r=n>=o+i?"end":"start"),r==="center"?n+=(a-i)/2:r==="end"&&(n-=i);const s=this.getMaxScrollOffset();return Math.max(Math.min(s,n),0)},this.getOffsetForIndex=(n,r="auto")=>{n=Math.max(0,Math.min(n,this.options.count-1));const a=this.getSize(),i=this.getScrollOffset(),o=this.measurementsCache[n];if(!o)return;if(r==="auto")if(o.end>=i+a-this.options.scrollPaddingEnd)r="end";else if(o.start<=i+this.options.scrollPaddingStart)r="start";else return[i,r];if(r==="end"&&n===this.options.count-1)return[this.getMaxScrollOffset(),r];const s=r==="end"?o.end+this.options.scrollPaddingEnd:o.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(s,r,o.size),r]},this.scrollToOffset=(n,{align:r="start",behavior:a="auto"}={})=>{this._iosDeferredAdjustment=0;const i=this.getOffsetForAlignment(n,r),o=this.now();this.scrollState={index:null,align:r,behavior:a,startedAt:o,lastTargetOffset:i,stableFrames:0},this._scrollToOffset(i,{adjustments:void 0,behavior:a}),this.scheduleScrollReconcile()},this.scrollToIndex=(n,{align:r="auto",behavior:a="auto"}={})=>{this._iosDeferredAdjustment=0,n=Math.max(0,Math.min(n,this.options.count-1));const i=this.getOffsetForIndex(n,r);if(!i)return;const[o,s]=i,l=this.now();this.scrollState={index:n,align:s,behavior:a,startedAt:l,lastTargetOffset:o,stableFrames:0},this._scrollToOffset(o,{adjustments:void 0,behavior:a}),this.scheduleScrollReconcile()},this.scrollBy=(n,{behavior:r="auto"}={})=>{const a=this.getScrollOffset()+n,i=this.now();this.scrollState={index:null,align:"start",behavior:r,startedAt:i,lastTargetOffset:a,stableFrames:0},this._scrollToOffset(a,{adjustments:void 0,behavior:r}),this.scheduleScrollReconcile()},this.scrollToEnd=({behavior:n="auto"}={})=>{if(this.options.count>0){this.scrollToIndex(this.options.count-1,{align:"end",behavior:n});return}this.scrollToOffset(Math.max(this.getTotalSize()-this.getSize(),0),{behavior:n})},this.getTotalSize=()=>{var n;const r=this.getMeasurements();let a;if(r.length===0)a=this.options.paddingStart;else if(this.options.lanes===1){const i=r.length-1,o=this._flatMeasurements;o!=null?a=o[i*2]+o[i*2+1]:a=((n=r[i])==null?void 0:n.end)??0}else{const i=Array(this.options.lanes).fill(null);let o=r.length-1;for(;o>=0&&i.some(s=>s===null);){const s=r[o];i[s.lane]===null&&(i[s.lane]=s.end),o--}a=Math.max(...i.filter(s=>s!==null))}return Math.max(a-this.options.scrollMargin+this.options.paddingEnd,0)},this.takeSnapshot=()=>{const n=[];if(this.itemSizeCache.size===0)return n;const r=this.getMeasurements();for(const a of r)a&&this.itemSizeCache.has(a.key)&&n.push({index:a.index,key:a.key,start:a.start,size:a.size,end:a.end,lane:a.lane});return n},this._scrollToOffset=(n,{adjustments:r,behavior:a})=>{this._intendedScrollOffset=n+(r??0),this.options.scrollToFn(n,{behavior:a,adjustments:r},this)},this.measure=()=>{this.pendingMin=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),this.itemSizeCacheVersion++,this.notify(!1)},this.setOptions(t)}applyScrollAdjustment(t,n){return t===0?!1:(process.env.NODE_ENV!=="production"&&this.options.debug&&console.info("correction",t),ls()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?(this._iosDeferredAdjustment+=t,!1):(this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=t,behavior:n}),this.scrollOffset!==null&&(this.scrollOffset+=this.scrollAdjustments,this.scrollOffset<0&&(this.scrollOffset=0),this.scrollAdjustments=0),!0))}scheduleScrollReconcile(){if(!this.targetWindow){this.scrollState=null;return}this.rafId==null&&(this.rafId=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()}))}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}const r=this.scrollState.index!=null?this.getOffsetForIndex(this.scrollState.index,this.scrollState.align):void 0,a=r?r[0]:this.scrollState.lastTargetOffset,i=1,o=a!==this.scrollState.lastTargetOffset;if(!o&&K_e(a,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=i){this.getScrollOffset()!==a&&this._scrollToOffset(a,{adjustments:void 0,behavior:"auto"}),this.scrollState=null;return}}else if(this.scrollState.stableFrames=0,o){const s=this.getSize()||600,l=Math.abs(a-this.getScrollOffset()),u=this.scrollState.behavior==="smooth"&&l>s;this.scrollState.lastTargetOffset=a,u||(this.scrollState.behavior="auto"),this._scrollToOffset(a,{adjustments:void 0,behavior:u?"smooth":"auto"})}this.scheduleScrollReconcile()}}const tv=(e,t,n,r)=>{for(;e<=t;){const a=(e+t)/2|0,i=n(a);if(i<r)e=a+1;else if(i>r)t=a-1;else return a}return e>0?e-1:0};function oxe(e,t,n){let r=0;for(;r<=t;){const a=(r+t)/2|0,i=e[a*2];if(i<n)r=a+1;else if(i>n)t=a-1;else return a}return r>0?r-1:0}function sxe(e,t,n,r,a){const i=e.length-1;if(e.length<=r)return{startIndex:0,endIndex:i};if(r===1&&a!==null){const u=oxe(a,i,n);let d=u;const p=n+t;for(;d<i&&a[d*2]+a[d*2+1]<p;)d++;return{startIndex:u,endIndex:d}}let s=tv(0,i,u=>e[u].start,n),l=s;if(r===1)for(;l<i&&e[l].end<n+t;)l++;else if(r>1){const u=Array(r).fill(0);for(;l<i&&u.some(p=>p<n+t);){const p=e[l];u[p.lane]=p.end,l++}const d=Array(r).fill(n+t);for(;s>=0&&d.some(p=>p>=n);){const p=e[s];d[p.lane]=p.start,s--}s=Math.max(0,s-s%r),l=Math.min(i,l+(r-1-l%r))}return{startIndex:s,endIndex:l}}const cs=typeof document<"u"?te.useLayoutEffect:te.useEffect;function lxe({useFlushSync:e=!0,directDomUpdates:t=!1,directDomUpdatesMode:n="transform",...r}){const a=te.useReducer(d=>d+1,0)[1],i=te.useRef({enabled:t,mode:n,container:null,lastSize:null,lastPositions:new WeakMap,prevRange:null});i.current.enabled=t,i.current.mode=n;const o=d=>{const p=i.current;if(!p.enabled||!p.container)return;const h=d.getTotalSize();if(h!==p.lastSize){p.lastSize=h;const m=d.options.horizontal?"width":"height";p.container.style[m]=`${h}px`}},s=d=>{const p=i.current;if(!p.enabled||!p.container)return;o(d);const h=!!d.options.horizontal,m=p.mode==="transform",f=h?"left":"top",g=d.options.scrollMargin,_=d.getVirtualItems();for(const k of _){const b=k.start-g,x=d.elementsCache.get(k.key);x&&p.lastPositions.get(x)!==b&&(p.lastPositions.set(x,b),m?x.style.transform=h?`translate3d(${b}px, 0, 0)`:`translate3d(0, ${b}px, 0)`:x.style[f]=`${b}px`)}},l={...r,onChange:(d,p)=>{var h;const m=i.current;let f=!0;if(m.enabled){s(d);const g=d.range,_=m.prevRange;f=!_||_.isScrolling!==d.isScrolling||_.startIndex!==g?.startIndex||_.endIndex!==g?.endIndex,f&&(m.prevRange=g?{startIndex:g.startIndex,endIndex:g.endIndex,isScrolling:d.isScrolling}:null)}f&&(e&&p?d5.flushSync(a):a()),(h=r.onChange)==null||h.call(r,d,p)}},[u]=te.useState(()=>{const d=new ixe(l);return Object.assign(d,{containerRef:p=>{const h=i.current;if(h.container=p,h.lastSize=null,p&&h.enabled){const m=d.getTotalSize();h.lastSize=m;const f=d.options.horizontal?"width":"height";p.style[f]=`${m}px`}}})});return u.setOptions(l),cs(()=>u._didMount(),[]),cs(()=>(o(u),u._willUpdate())),cs(()=>{s(u)}),u}function cxe(e){return lxe({observeElementRect:Q_e,observeElementOffset:txe,scrollToFn:axe,...e})}const nv=j.memo(()=>{const e=fe(n=>n.activeChatId??n.draftChatKey),t=fe(n=>De(n,e).composerError);return t?w.jsx("div",{className:"mp-agent-composer-error",children:t}):null});nv.displayName="ComposerError";const uxe=(e,t)=>{switch(e.status){case exports.AgentToolCallStatus.Running:return`Running ${t}...`;case exports.AgentToolCallStatus.Succeeded:return`Completed ${t}`;case exports.AgentToolCallStatus.Failed:return`Failed to run ${t}`;case exports.AgentToolCallStatus.Pending:return`Preparing ${t}...`;default:return`Running ${t}...`}},us=e=>{if(e===void 0)return"undefined";try{return JSON.stringify(e,null,2)??"undefined"}catch{try{return String(e)}catch{return"[unserializable]"}}},I2=({call:e})=>$e().config.debug?w.jsxs("details",{className:"mp-agent-tool-debug-details",children:[w.jsx("summary",{className:"mp-agent-tool-debug-summary",children:"Details"}),w.jsxs("div",{className:"mp-agent-tool-debug-body",children:[w.jsxs("div",{className:"mp-agent-tool-debug-row",children:[w.jsx("div",{className:"mp-agent-tool-debug-label",children:"Tool"}),w.jsx("div",{className:"mp-agent-tool-debug-value",children:e.name})]}),w.jsxs("div",{className:"mp-agent-tool-debug-row",children:[w.jsx("div",{className:"mp-agent-tool-debug-label",children:"Status"}),w.jsx("div",{className:"mp-agent-tool-debug-value",children:e.status})]}),w.jsxs("details",{className:"mp-agent-tool-debug-section",children:[w.jsx("summary",{className:"mp-agent-tool-debug-section-summary",children:"Input"}),w.jsx("pre",{className:"mp-agent-tool-debug-code",children:w.jsx("code",{children:us(e.input)})})]}),w.jsxs("details",{className:"mp-agent-tool-debug-section",children:[w.jsx("summary",{className:"mp-agent-tool-debug-section-summary",children:"Output"}),w.jsx("pre",{className:"mp-agent-tool-debug-code",children:w.jsx("code",{children:us(e.output)})})]}),e.error&&w.jsxs("details",{className:"mp-agent-tool-debug-section",children:[w.jsx("summary",{className:"mp-agent-tool-debug-section-summary",children:"Error"}),w.jsx("pre",{className:"mp-agent-tool-debug-code",children:w.jsx("code",{children:us(e.error)})})]})]})]}):null,rv=j.memo(({call:e})=>{const t=$e(),n=e.status===exports.AgentToolCallStatus.Succeeded||e.status===exports.AgentToolCallStatus.Failed;if(!t.config.debug||n)return null;const a=t.tools.get(e.name)?.label??e.name;return w.jsx("div",{className:"mp-agent-tool-header",children:w.jsx("div",{className:"mp-agent-tool-simple-message",children:uxe(e,a)})})});rv.displayName="ToolCallHeader";function dxe(e){try{const t=JSON.parse(e);return{question:typeof t.question=="string"?t.question:void 0,selectedOptions:Array.isArray(t.selectedOptions)?t.selectedOptions:void 0,freeText:typeof t.freeText=="string"?t.freeText:void 0}}catch{return e}}const av=({call:e})=>{if(e.approved===void 0)return null;const t=e.userResponse?dxe(e.userResponse):null,n=()=>{if(!t)return null;if(typeof t=="string")return w.jsx("span",{className:"mp-agent-tool-approval-response",children:t});const r=t.freeText??t.selectedOptions?.map(a=>a.label).join(", ");return!t.question&&!r?null:w.jsxs("div",{className:"mp-agent-tool-approval-result",children:[t.question&&w.jsx("span",{className:"mp-agent-tool-approval-question",children:t.question}),r&&w.jsx("span",{className:"mp-agent-tool-approval-response",children:r})]})};return w.jsxs("div",{className:"mp-agent-tool-approval-status-inline",children:[e.approved&&n(),e.approved?w.jsx("div",{className:"mp-agent-tool-approved",children:w.jsx("span",{children:"✓ Approved"})}):w.jsx("span",{className:"mp-agent-tool-denied",children:"✗ Denied"})]})},pxe=e=>{if(!e||typeof e!="object"||Array.isArray(e))return null;const t=e.question,n=e.selectionMode,r=e.options,a=e.allowFreeText;if(typeof t!="string"||t.trim().length<1||n!=="single"&&n!=="multiple"||!Array.isArray(r)||r.length<2||r.length>6)return null;const i=r.map(o=>{if(!o||typeof o!="object"||Array.isArray(o))return null;const s=o.id,l=o.label,u=o.description;return typeof s!="string"||s.trim().length<1||typeof l!="string"||l.trim().length<1||u!==void 0&&typeof u!="string"?null:{id:s,label:l,...typeof u=="string"?{description:u}:{}}}).filter(o=>o!==null);return i.length!==r.length?null:{question:t,selectionMode:n,options:i,allowFreeText:typeof a=="boolean"?a:!1}},hxe=({callId:e,input:t,isSubmitting:n,onSubmit:r})=>{const[a,i]=j.useState([]),[o,s]=j.useState(""),[l,u]=j.useState(void 0),d=j.useMemo(()=>pxe(t),[t]);j.useEffect(()=>{i([]),s(""),u(void 0)},[e,t]);const p=m=>{if(d){if(u(void 0),d.selectionMode==="single"){i([m]);return}i(f=>f.includes(m)?f.filter(g=>g!==m):[...f,m])}},h=async()=>{if(!d)return;const m=o.trim(),f=a.length>0,g=d.allowFreeText&&m.length>0;if(!f&&!g){u(d.allowFreeText?"Select at least one option or provide a custom response.":"Select at least one option before submitting.");return}const _=d.options.filter(b=>a.includes(b.id)).map(({id:b,label:x,description:M})=>({id:b,label:x,...M?{description:M}:{}})),k={question:d.question,selectionMode:d.selectionMode,selectedOptionIds:a,selectedOptions:_,...m?{freeText:m}:{}};await r(JSON.stringify(k))};return d?w.jsxs("div",{className:"mp-agent-tool-user-action-form",children:[w.jsx("div",{className:"mp-agent-tool-user-action-question",children:d.question}),w.jsx("div",{className:"mp-agent-tool-user-action-options",children:d.options.map(m=>{const f=`${e}-${m.id}`,g=a.includes(m.id);return w.jsxs("label",{htmlFor:f,className:"mp-agent-tool-user-action-option",children:[w.jsx("input",{id:f,type:d.selectionMode==="single"?"radio":"checkbox",name:`mp-agent-tool-user-action-${e}`,checked:g,onChange:()=>p(m.id),disabled:n}),w.jsxs("span",{className:"mp-agent-tool-user-action-option-content",children:[w.jsx("span",{className:"mp-agent-tool-user-action-option-label",children:m.label}),m.description?w.jsx("span",{className:"mp-agent-tool-user-action-option-description",children:m.description}):null]})]},m.id)})}),d.allowFreeText?w.jsx("textarea",{className:"mp-agent-tool-user-action-free-text",value:o,onChange:m=>{s(m.target.value),l&&u(void 0)},placeholder:"Optional custom response",rows:3,disabled:n}):null,l?w.jsx("div",{className:"mp-agent-tool-input-error",children:l}):null,w.jsx("div",{className:"mp-agent-tool-approval-actions",children:w.jsx("button",{className:"mp-agent-tool-approve-button",onClick:h,disabled:n,children:n?"Submitting...":"Submit response"})})]}):w.jsx("div",{className:"mp-agent-tool-user-action-form",children:w.jsx("div",{className:"mp-agent-tool-input-error",children:"Invalid user action input schema in tool call."})})},mxe=({call:e,messageId:t,chatId:n,onApprovalSent:r})=>{const a=$e(),i=a.tools.get(e.name)?.label??e.name,o=fe(q=>q.appendMessagesToChat),s=fe(q=>q.setChatMessages),l=fe(q=>q.setChatStatus),u=fe(q=>q.setPendingAssistant),[d,p]=j.useState(!1),[h,m]=j.useState(!1),[f,g]=j.useState(!1),[_,k]=j.useState(JSON.stringify(e.input??{},null,2)),[b,x]=j.useState(void 0),M=a.config.user?.id??"guest",N=e.requiresUserAction;j.useEffect(()=>{h||(k(JSON.stringify(e.input??{},null,2)),x(void 0))},[e.id,e.input,h]);const E=()=>{k(JSON.stringify(e.input??{},null,2)),x(void 0),m(!0)},D=()=>{k(JSON.stringify(e.input??{},null,2)),x(void 0),m(!1)},P=async()=>{if(!(!a.transport.updateToolCall||f||d)){x(void 0),g(!0);try{const q=JSON.parse(_);if(!q||typeof q!="object"||Array.isArray(q))throw new Error("Tool input must be a JSON object.");const Z=await a.transport.updateToolCall({chatId:n,messageId:t,toolCallId:e.id,input:q});o(n,[Z]),m(!1)}catch(q){x(q instanceof Error?q.message:"Failed to update tool input.")}finally{g(!1)}}},C=q=>{s(n,Z=>Z.map(X=>X.id===t?{...X,toolCalls:(X.toolCalls??[]).map(K=>K.id===e.id?{...K,...q}:K)}:X))},I=async(q,Z)=>{if(!(!e.approvalId||d||f||h)){p(!0),C({approved:q,...Z?{userResponse:Z}:{}}),l(n,ct.Streaming),u(n,{id:`pending-approval-${e.id}`,chat:n,role:exports.MessageRole.Assistant,content:"",reasoning:"",toolCalls:[],attachments:[],createdAt:new Date().toISOString()});try{const X={chatId:n,messageId:t,approvalId:e.approvalId,approved:q,...Z?{userResponse:Z}:{},userId:M},K=await a.transport.streamMessage(X,R=>{R.type===exports.StreamChunkType.Message&&R.message&&(R.message.id!==t&&u(n,void 0),o(n,[R.message]))},{streamKey:n});K&&o(K.id,K.messages),await r()}catch(X){console.error("Failed to send approval:",X),C({approved:void 0,userResponse:void 0}),l(n,ct.Idle)}finally{u(n,void 0),p(!1)}}};return e.approved!==void 0?w.jsx(av,{call:e}):N?w.jsx(hxe,{callId:e.id,input:e.input,isSubmitting:d,onSubmit:q=>I(!0,q)}):w.jsxs("div",{className:"mp-agent-tool-approval-buttons",children:[w.jsxs("div",{className:"mp-agent-tool-approval-request-message",children:["Agent wants to execute tool ",i,"."]}),w.jsxs("div",{className:"mp-agent-tool-input-card",children:[w.jsxs("div",{className:"mp-agent-tool-input-card-header",children:[w.jsx("span",{className:"mp-agent-tool-input-card-title",children:"Tool input"}),h?w.jsxs("div",{className:"mp-agent-tool-input-actions",children:[w.jsx(un,{icon:"Check",size:"sm",tooltip:"Save tool input",onClick:P,disabled:f||d,"aria-label":"Save tool input"}),w.jsx(un,{icon:"X",size:"sm",tooltip:"Cancel input edit",onClick:D,disabled:f||d,"aria-label":"Cancel tool input edit"})]}):w.jsx(un,{icon:"Pencil",size:"sm",tooltip:"Edit tool input",onClick:E,disabled:d||f,"aria-label":"Edit tool input"})]}),h?w.jsx("textarea",{className:"mp-agent-tool-input-editor",value:_,onChange:q=>{k(q.target.value),b&&x(void 0)},rows:8,spellCheck:!1,disabled:f||d}):w.jsx("pre",{className:"mp-agent-tool-input-preview",children:JSON.stringify(e.input??{},null,2)}),b&&w.jsx("div",{className:"mp-agent-tool-input-error",children:b})]}),w.jsxs("div",{className:"mp-agent-tool-approval-actions",children:[w.jsx("button",{className:"mp-agent-tool-approve-button",onClick:()=>I(!0),disabled:d||h||f,children:d?"Processing...":"Approve"}),w.jsx("button",{className:"mp-agent-tool-deny-button",onClick:()=>I(!1),disabled:d||f,children:d?"Processing...":"Deny"})]})]})},O2=({call:e,messageId:t,chatId:n})=>{const r=$e(),a=fe(p=>p.upsertChat),i=fe(p=>p.setChatStatus),o=r.config.debug&&!!e.approvalId,s=e.requiresConfirmation&&e.approvalId||o,l=s&&e.approved===void 0,u=s&&e.approved!==void 0,d=async()=>{try{const p=await r.transport.getChat(n);a(p),i(n,ka(p.status))}catch(p){console.error("Failed to refresh chat after approval:",p),i(n,ct.Idle)}};return!l&&!u?null:w.jsxs("div",{className:"mp-agent-tool-approval",children:[l&&w.jsx(mxe,{call:e,messageId:t,chatId:n,onApprovalSent:d}),u&&w.jsx(av,{call:e})]})},iv=j.memo(({chatId:e,isExpanded:t})=>{const n=$e(),r=fe(d=>De(d,e).messages),a=fe(d=>De(d,e).pendingAssistant),i=fe(d=>d.chats[e]?.contextKey??d.contextKey),[o,s]=j.useState(t);t&&!o&&s(!0);const l=mp(e,{requireRegisteredChat:!1,enabled:o}),u=j.useMemo(()=>{const d=[...r].sort((h,m)=>h.createdAt.localeCompare(m.createdAt));if(n.config.debug)return d;const p=d.findIndex(h=>h.role===exports.MessageRole.User);return p===-1?d:d.filter((h,m)=>m!==p)},[r,n.config.debug]);return t?w.jsx("div",{className:"mp-agent-subagent-preview",children:w.jsx("div",{className:"mp-agent-subagent-preview-body",children:u.length===0&&!a?w.jsx("div",{className:"mp-agent-subagent-preview-empty",children:l.isLoading?"Loading subagent chat...":"Subagent chat started."}):w.jsxs(w.Fragment,{children:[u.map(d=>w.jsx(eo,{message:d,contextKey:i,showParticipantChrome:!0},d.id)),a&&w.jsx(eo,{message:a,contextKey:i,isStreaming:!0,showParticipantChrome:!0})]})})}):null});iv.displayName="SubagentChatPreview";const fxe=e=>{switch(e){case exports.AgentToolCallStatus.Succeeded:return{key:"succeeded",label:"Done",icon:w.jsx(Gd,{size:12})};case exports.AgentToolCallStatus.Failed:return{key:"failed",label:"Failed",icon:w.jsx(L5,{size:12})};case exports.AgentToolCallStatus.Pending:return{key:"running",label:"Preparing",icon:w.jsx(ma,{size:12,className:"mp-agent-subagent-spinner"})};default:return{key:"running",label:"Running",icon:w.jsx(ma,{size:12,className:"mp-agent-subagent-spinner"})}}},ov=j.memo(({call:e,subagentChatId:t})=>{const[n,r]=j.useState(()=>e.status===exports.AgentToolCallStatus.Running||e.status===exports.AgentToolCallStatus.Pending),a=fe(o=>{const{messages:s,pendingAssistant:l}=De(o,t),u=s.find(d=>d.agentName||d.sender?.type==="agent")??l;return u?.agentName||u?.sender?.displayName||void 0}),i=fxe(e.status);return w.jsxs("div",{className:"mp-agent-subagent",children:[w.jsxs("button",{className:"mp-agent-subagent-row",type:"button",onClick:()=>r(o=>!o),"aria-expanded":n,children:[w.jsx("span",{className:"mp-agent-subagent-row-icon",children:w.jsx(v5,{size:14})}),w.jsx("span",{className:"mp-agent-subagent-row-title",children:a?w.jsxs(w.Fragment,{children:[w.jsx("span",{className:"mp-agent-subagent-row-label",children:"Subagent:"})," ",a]}):"Subagent"}),w.jsxs("span",{className:`mp-agent-subagent-row-status is-${i.key}`,children:[i.icon,i.label]}),w.jsx("span",{className:"mp-agent-subagent-row-chevron",children:n?w.jsx(Wd,{size:14}):w.jsx(no,{size:14})})]}),w.jsx(iv,{chatId:t,isExpanded:n})]})});ov.displayName="SubagentToolCall";const xp=j.memo(({call:e,contextKey:t,messageId:n,chatId:r})=>{const a=$e(),i=e.subagentChatId||(typeof e.input?.subagentChatId=="string"?e.input.subagentChatId:void 0),o=j.useMemo(()=>a.getToolRenderer(e),[a,e.name]),s=i?w.jsx(ov,{call:e,subagentChatId:i}):null;if(!o){const l=!!(e.requiresConfirmation&&e.approvalId);return!!i||a.config.debug||l?w.jsxs("div",{className:"mp-agent-tool-panel",children:[w.jsx(rv,{call:e}),w.jsx(O2,{call:e,messageId:n,chatId:r}),w.jsx(I2,{call:e}),s]}):null}return w.jsxs("div",{className:"mp-agent-tool-panel",children:[w.jsx(o,{call:e,contextKey:t,chatId:r}),w.jsx(O2,{call:e,messageId:n,chatId:r}),w.jsx(I2,{call:e}),s]})});xp.displayName="ToolCallCard";const gxe=e=>{const t=e.sender?.displayName||e.sender?.id||e.agentName;if(!t)return e.role===exports.MessageRole.User?"You":"AI";const n=t.split(/\s+/).filter(Boolean);return n.length>=2?`${n[0][0]}${n[1][0]}`.toUpperCase():t.slice(0,2).toUpperCase()},wp=j.memo(({message:e})=>{const t=e.role===exports.MessageRole.User;return w.jsx("div",{className:`mp-agent-message-avatar ${t?"mp-agent-message-avatar-user":""}`,children:e.sender?.avatarUrl?w.jsx("img",{className:"mp-agent-message-avatar-image",src:e.sender.avatarUrl,alt:""}):w.jsx("div",{className:"mp-agent-message-avatar-icon",children:gxe(e)})})});wp.displayName="MessageAvatar";const yxe=e=>e?new Date(e).toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit"}):"",bxe=e=>e.sender?.displayName?e.sender.displayName:e.sender?.id&&e.sender.id!=="guest"?e.sender.id:e.agentName?e.agentName:e.role===exports.MessageRole.User?"You":"Assistant",Ep=j.memo(({message:e})=>{const t=bxe(e);return w.jsxs("div",{className:"mp-agent-message-header",children:[w.jsx("span",{className:"mp-agent-message-role",children:t}),w.jsx("span",{className:"mp-agent-message-time",children:yxe(e.createdAt)})]})});Ep.displayName="MessageHeader";function L2(e){const t=[],n=String(e||"");let r=n.indexOf(","),a=0,i=!1;for(;!i;){r===-1&&(r=n.length,i=!0);const o=n.slice(a,r).trim();(o||!i)&&t.push(o),a=r+1,r=n.indexOf(",",a)}return t}function kxe(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const vxe=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,_xe=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,xxe={};function D2(e,t){return(xxe.jsx?_xe:vxe).test(e)}const wxe=/[ \t\n\f\r]/g;function Exe(e){return typeof e=="object"?e.type==="text"?z2(e.value):!1:z2(e)}function z2(e){return e.replace(wxe,"")===""}let La=class{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}};La.prototype.normal={};La.prototype.property={};La.prototype.space=void 0;function sv(e,t){const n={},r={};for(const a of e)Object.assign(n,a.property),Object.assign(r,a.normal);return new La(n,r,t)}function va(e){return e.toLowerCase()}let Ft=class{constructor(t,n){this.attribute=n,this.property=t}};Ft.prototype.attribute="";Ft.prototype.booleanish=!1;Ft.prototype.boolean=!1;Ft.prototype.commaOrSpaceSeparated=!1;Ft.prototype.commaSeparated=!1;Ft.prototype.defined=!1;Ft.prototype.mustUseProperty=!1;Ft.prototype.number=!1;Ft.prototype.overloadedBoolean=!1;Ft.prototype.property="";Ft.prototype.spaceSeparated=!1;Ft.prototype.space=void 0;let Mxe=0;const Te=kr(),lt=kr(),yd=kr(),le=kr(),Ze=kr(),fr=kr(),Ut=kr();function kr(){return 2**++Mxe}const bd=Object.freeze(Object.defineProperty({__proto__:null,boolean:Te,booleanish:lt,commaOrSpaceSeparated:Ut,commaSeparated:fr,number:le,overloadedBoolean:yd,spaceSeparated:Ze},Symbol.toStringTag,{value:"Module"})),ds=Object.keys(bd);let Mp=class extends Ft{constructor(t,n,r,a){let i=-1;if(super(t,n),$2(this,"space",a),typeof r=="number")for(;++i<ds.length;){const o=ds[i];$2(this,ds[i],(r&bd[o])===bd[o])}}};Mp.prototype.defined=!0;function $2(e,t,n){n&&(e[t]=n)}function Gr(e){const t={},n={};for(const[r,a]of Object.entries(e.properties)){const i=new Mp(r,e.transform(e.attributes||{},r),a,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(i.mustUseProperty=!0),t[r]=i,n[va(r)]=r,n[va(i.attribute)]=r}return new La(t,n,e.space)}const lv=Gr({properties:{ariaActiveDescendant:null,ariaAtomic:lt,ariaAutoComplete:null,ariaBusy:lt,ariaChecked:lt,ariaColCount:le,ariaColIndex:le,ariaColSpan:le,ariaControls:Ze,ariaCurrent:null,ariaDescribedBy:Ze,ariaDetails:null,ariaDisabled:lt,ariaDropEffect:Ze,ariaErrorMessage:null,ariaExpanded:lt,ariaFlowTo:Ze,ariaGrabbed:lt,ariaHasPopup:null,ariaHidden:lt,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Ze,ariaLevel:le,ariaLive:null,ariaModal:lt,ariaMultiLine:lt,ariaMultiSelectable:lt,ariaOrientation:null,ariaOwns:Ze,ariaPlaceholder:null,ariaPosInSet:le,ariaPressed:lt,ariaReadOnly:lt,ariaRelevant:null,ariaRequired:lt,ariaRoleDescription:Ze,ariaRowCount:le,ariaRowIndex:le,ariaRowSpan:le,ariaSelected:lt,ariaSetSize:le,ariaSort:null,ariaValueMax:le,ariaValueMin:le,ariaValueNow:le,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function cv(e,t){return t in e?e[t]:t}function uv(e,t){return cv(e,t.toLowerCase())}const Sxe=Gr({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:fr,acceptCharset:Ze,accessKey:Ze,action:null,allow:null,allowFullScreen:Te,allowPaymentRequest:Te,allowUserMedia:Te,alpha:Te,alt:null,as:null,async:Te,autoCapitalize:null,autoComplete:Ze,autoFocus:Te,autoPlay:Te,blocking:Ze,capture:null,charSet:null,checked:Te,cite:null,className:Ze,closedBy:null,colorSpace:null,cols:le,colSpan:le,command:null,commandFor:null,content:null,contentEditable:lt,controls:Te,controlsList:Ze,coords:le|fr,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Te,defer:Te,dir:null,dirName:null,disabled:Te,download:yd,draggable:lt,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Te,formTarget:null,headers:Ze,height:le,hidden:yd,high:le,href:null,hrefLang:null,htmlFor:Ze,httpEquiv:Ze,id:null,imageSizes:null,imageSrcSet:null,inert:Te,inputMode:null,integrity:null,is:null,isMap:Te,itemId:null,itemProp:Ze,itemRef:Ze,itemScope:Te,itemType:Ze,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Te,low:le,manifest:null,max:null,maxLength:le,media:null,method:null,min:null,minLength:le,multiple:Te,muted:Te,name:null,nonce:null,noModule:Te,noValidate:Te,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:Te,optimum:le,pattern:null,ping:Ze,placeholder:null,playsInline:Te,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Te,referrerPolicy:null,rel:Ze,required:Te,reversed:Te,rows:le,rowSpan:le,sandbox:Ze,scope:null,scoped:Te,seamless:Te,selected:Te,shadowRootClonable:Te,shadowRootCustomElementRegistry:Te,shadowRootDelegatesFocus:Te,shadowRootMode:null,shadowRootSerializable:Te,shape:null,size:le,sizes:null,slot:null,span:le,spellCheck:lt,src:null,srcDoc:null,srcLang:null,srcSet:null,start:le,step:null,style:null,tabIndex:le,target:null,title:null,translate:null,type:null,typeMustMatch:Te,useMap:null,value:lt,width:le,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Ze,axis:null,background:null,bgColor:null,border:le,borderColor:null,bottomMargin:le,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Te,declare:Te,event:null,face:null,frame:null,frameBorder:null,hSpace:le,leftMargin:le,link:null,longDesc:null,lowSrc:null,marginHeight:le,marginWidth:le,noResize:Te,noHref:Te,noShade:Te,noWrap:Te,object:null,profile:null,prompt:null,rev:null,rightMargin:le,rules:null,scheme:null,scrolling:lt,standby:null,summary:null,text:null,topMargin:le,valueType:null,version:null,vAlign:null,vLink:null,vSpace:le,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:Te,disablePictureInPicture:Te,disableRemotePlayback:Te,exportParts:fr,part:Ze,prefix:null,property:null,results:le,security:null,unselectable:null},space:"html",transform:uv}),Nxe=Gr({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",maskType:"mask-type",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:Ut,accentHeight:le,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:le,amplitude:le,arabicForm:null,ascent:le,attributeName:null,attributeType:null,azimuth:le,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:le,by:null,calcMode:null,capHeight:le,className:Ze,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:le,diffuseConstant:le,direction:null,display:null,dur:null,divisor:le,dominantBaseline:null,download:Te,dx:null,dy:null,edgeMode:null,editable:null,elevation:le,enableBackground:null,end:null,event:null,exponent:le,externalResourcesRequired:null,fill:null,fillOpacity:le,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:fr,g2:fr,glyphName:fr,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:le,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:le,horizOriginX:le,horizOriginY:le,id:null,ideographic:le,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:le,k:le,k1:le,k2:le,k3:le,k4:le,kernelMatrix:Ut,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:le,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskType:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:le,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:le,overlineThickness:le,paintOrder:null,panose1:null,path:null,pathLength:le,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Ze,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:le,pointsAtY:le,pointsAtZ:le,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Ut,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Ut,rev:Ut,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Ut,requiredFeatures:Ut,requiredFonts:Ut,requiredFormats:Ut,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:le,specularExponent:le,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:le,strikethroughThickness:le,string:null,stroke:null,strokeDashArray:Ut,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:le,strokeOpacity:le,strokeWidth:null,style:null,surfaceScale:le,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Ut,tabIndex:le,tableValues:null,target:null,targetX:le,targetY:le,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Ut,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:le,underlineThickness:le,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:le,values:null,vAlphabetic:le,vMathematical:le,vectorEffect:null,vHanging:le,vIdeographic:le,version:null,vertAdvY:le,vertOriginX:le,vertOriginY:le,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:le,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:cv}),dv=Gr({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),pv=Gr({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:uv}),hv=Gr({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),Axe={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},Txe=/[A-Z]/g,F2=/-[a-z]/g,Cxe=/^data[-\w.:]+$/i;function mv(e,t){const n=va(t);let r=t,a=Ft;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&Cxe.test(t)){if(t.charAt(4)==="-"){const i=t.slice(5).replace(F2,Ixe);r="data"+i.charAt(0).toUpperCase()+i.slice(1)}else{const i=t.slice(4);if(!F2.test(i)){let o=i.replace(Txe,Rxe);o.charAt(0)!=="-"&&(o="-"+o),t="data"+o}}a=Mp}return new a(r,t)}function Rxe(e){return"-"+e.toLowerCase()}function Ixe(e){return e.charAt(1).toUpperCase()}const fv=sv([lv,Sxe,dv,pv,hv],"html"),vo=sv([lv,Nxe,dv,pv,hv],"svg");function P2(e){const t=String(e||"").trim();return t?t.split(/[ \t\n\r\f]+/g):[]}function Oxe(e){return e.join(" ").trim()}var Jn=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function _o(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Sp={},q2=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,Lxe=/\n/g,Dxe=/^\s*/,zxe=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,$xe=/^:\s*/,Fxe=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,Pxe=/^[;\s]*/,qxe=/^\s+|\s+$/g,Bxe=`
|
|
8296
|
+
color: hsl(${Math.max(0,Math.min(120-120*g,120))}deg 100% 31%);`,n?.key)}return n?.onChange&&!(i&&n.skipInitialOnChange)&&n.onChange(a),i=!1,a}return o.updateDeps=s=>{r=s},o}function C2(e,t){if(e===void 0)throw new Error("Unexpected undefined");return e}const K_e=(e,t)=>Math.abs(e-t)<1.01,Y_e=(e,t,n)=>{let r;return function(...a){e.clearTimeout(r),r=e.setTimeout(()=>t.apply(this,a),n)}};let Qr;const ls=()=>{if(Qr!==void 0)return Qr;if(typeof navigator>"u")return Qr=!1;if(/iP(hone|od|ad)/.test(navigator.userAgent))return Qr=!0;const e=navigator.maxTouchPoints;return Qr=navigator.platform==="MacIntel"&&e!==void 0&&e>0},R2=e=>{const{offsetWidth:t,offsetHeight:n}=e;return{width:t,height:n}},Z_e=e=>e,X_e=e=>{const t=Math.max(e.startIndex-e.overscan,0),r=Math.min(e.endIndex+e.overscan,e.count-1)-t+1,a=new Array(r);for(let i=0;i<r;i++)a[i]=t+i;return a},Q_e=(e,t)=>{const n=e.scrollElement;if(!n)return;const r=e.targetWindow;if(!r)return;const a=o=>{const{width:s,height:l}=o;t({width:Math.round(s),height:Math.round(l)})};if(a(R2(n)),!r.ResizeObserver)return()=>{};const i=new r.ResizeObserver(o=>{const s=()=>{const l=o[0];if(l?.borderBoxSize){const u=l.borderBoxSize[0];if(u){a({width:u.inlineSize,height:u.blockSize});return}}a(R2(n))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(s):s()});return i.observe(n,{box:"border-box"}),()=>{i.unobserve(n)}},Pi={passive:!0},J_e=typeof window>"u"?!0:"onscrollend"in window,exe=(e,t,n)=>{const r=e.scrollElement;if(!r)return;const a=e.targetWindow;if(!a)return;const i=e.options.useScrollendEvent&&J_e;let o=0;const s=i?null:Y_e(a,()=>t(o,!1),e.options.isScrollingResetDelay),l=p=>()=>{o=n(r),s?.(),t(o,p)},u=l(!0),d=l(!1);return r.addEventListener("scroll",u,Pi),i&&r.addEventListener("scrollend",d,Pi),()=>{r.removeEventListener("scroll",u),i&&r.removeEventListener("scrollend",d)}},txe=(e,t)=>exe(e,t,n=>{const{horizontal:r,isRtl:a}=e.options;return r?n.scrollLeft*(a&&-1||1):n.scrollTop}),nxe=(e,t,n)=>{if(n.options.useCachedMeasurements){const r=n.indexFromElement(e),a=n.options.getItemKey(r);return n.itemSizeCache.get(a)??n.options.estimateSize(r)}if(t?.borderBoxSize){const r=t.borderBoxSize[0];if(r)return Math.round(r[n.options.horizontal?"inlineSize":"blockSize"])}if(!t){const r=n.indexFromElement(e),a=n.options.getItemKey(r),i=n.itemSizeCache.get(a);if(i!==void 0)return i}return e[n.options.horizontal?"offsetWidth":"offsetHeight"]},rxe=(e,{adjustments:t=0,behavior:n},r)=>{var a,i;(i=(a=r.scrollElement)==null?void 0:a.scrollTo)==null||i.call(a,{[r.options.horizontal?"left":"top"]:e+t,behavior:n})},axe=rxe;class ixe{constructor(t){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this._flatMeasurements=null,this.itemSizeCache=new Map,this.itemSizeCacheVersion=0,this.laneAssignments=new Map,this.pendingMin=null,this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.pendingScrollAnchor=null,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this._iosDeferredAdjustment=0,this._iosTouching=!1,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._intendedScrollOffset=null,this.elementsCache=new Map,this.now=()=>{var n,r,a;return((a=(r=(n=this.targetWindow)==null?void 0:n.performance)==null?void 0:r.now)==null?void 0:a.call(r))??Date.now()},this.observer=(()=>{let n=null;const r=()=>n||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:n=new this.targetWindow.ResizeObserver(a=>{a.forEach(i=>{const o=()=>{const s=i.target,l=this.indexFromElement(s);if(!s.isConnected){this.observer.unobserve(s);for(const[u,d]of this.elementsCache)if(d===s){this.elementsCache.delete(u);break}return}this.shouldMeasureDuringScroll(l)&&this.resizeItem(l,this.options.measureElement(s,i,this))};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(o):o()})}));return{disconnect:()=>{var a;(a=r())==null||a.disconnect(),n=null},observe:a=>{var i;return(i=r())==null?void 0:i.observe(a,{box:"border-box"})},unobserve:a=>{var i;return(i=r())==null?void 0:i.unobserve(a)}}})(),this.range=null,this.setOptions=n=>{var r,a;const i={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:Z_e,rangeExtractor:X_e,onChange:()=>{},measureElement:nxe,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,anchorTo:"start",followOnAppend:!1,scrollEndThreshold:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,laneAssignmentMode:"estimate",useCachedMeasurements:!1};for(const h in n){const m=n[h];m!==void 0&&(i[h]=m)}const o=this.options;let s=null,l=null,u=!1;if(o!==void 0&&o.enabled&&i.enabled&&i.anchorTo==="end"&&this.scrollElement!==null){const h=o.count,m=i.count,f=this.getMeasurements(),g=h>0?((r=f[0])==null?void 0:r.key)??o.getItemKey(0):null,_=h>0?((a=f[h-1])==null?void 0:a.key)??o.getItemKey(h-1):null;if(m!==h||h>0&&m>0&&(i.getItemKey(0)!==g||i.getItemKey(m-1)!==_)){u=!0;const x=h>0?this.getVirtualItemForOffset(this.getScrollOffset())??f[0]:null;x&&(s=[x.key,this.getScrollOffset()-x.start]);const M=i.followOnAppend===!0?"auto":i.followOnAppend||null;M&&m>h&&this.isAtEnd(o.scrollEndThreshold)&&(h===0||i.getItemKey(m-1)!==_)&&(l=M)}}this.options=i,u&&(this.pendingMin=0,this.itemSizeCacheVersion++);let d=!1,p=0;if(s&&this.scrollOffset!==null){const[h,m]=s,f=this.getMeasurements(),{count:g,getItemKey:_}=this.options;let k=0;for(;k<g&&_(k)!==h;)k++;if(k<g){const b=f[k];if(b){const x=Math.max(0,b.start+m);x!==this.scrollOffset&&(p=x-this.scrollOffset,this.scrollOffset=x,d=!0)}}}(d||l)&&(this.pendingScrollAnchor=[d?s[0]:null,d?s[1]:0,l,p])},this.notify=n=>{var r,a;(a=(r=this.options).onChange)==null||a.call(r,this,n)},this.maybeNotify=Mr(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),n=>{this.notify(n)},{key:process.env.NODE_ENV!=="production"&&"maybeNotify",debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(n=>n()),this.unsubs=[],this.observer.disconnect(),this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this._iosDeferredAdjustment=0,this._iosTouching=!1,this._iosJustTouchEnded=!1,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var n;const r=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==r){if(this.cleanup(),!r){this.maybeNotify();return}if(this.scrollElement=r,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((n=this.scrollElement)==null?void 0:n.window)??null,this.elementsCache.forEach(i=>{this.observer.observe(i)}),this.unsubs.push(this.options.observeElementRect(this,i=>{this.scrollRect=i,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(i,o)=>{if(o&&this._intendedScrollOffset===null&&i===this.scrollOffset)return;this._intendedScrollOffset!==null&&Math.abs(i-this._intendedScrollOffset)<1.5&&(i=this._intendedScrollOffset),this._intendedScrollOffset=null,this.scrollAdjustments=0;const s=this.getScrollOffset();this.scrollDirection=o?s===i?this.scrollDirection:s<i?"forward":"backward":null,this.scrollOffset=i,this.isScrolling=o,this._flushIosDeferredIfReady(),this.scrollState&&this.scheduleScrollReconcile(),this.maybeNotify()})),"addEventListener"in this.scrollElement){const i=this.scrollElement,o=()=>{this._iosTouching=!0,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)},s=()=>{this._iosTouching=!1,!(!ls()||this.targetWindow==null)&&(this._iosJustTouchEnded=!0,this._iosTouchEndTimerId=this.targetWindow.setTimeout(()=>{this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._flushIosDeferredIfReady()},150))};i.addEventListener("touchstart",o,Pi),i.addEventListener("touchend",s,Pi),this.unsubs.push(()=>{i.removeEventListener("touchstart",o),i.removeEventListener("touchend",s),this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)})}this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}const a=this.pendingScrollAnchor;if(this.pendingScrollAnchor=null,a&&this.scrollElement&&this.options.enabled){const[i,o,s,l]=a;i!==null&&!s&&(ls()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?l!==0&&(this._iosDeferredAdjustment+=l):this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})),s&&this.scrollToEnd({behavior:s})}},this._flushIosDeferredIfReady=()=>{if(this._iosDeferredAdjustment===0||this.isScrolling||this._iosTouching||this._iosJustTouchEnded)return;const n=this.getScrollOffset(),r=this.getMaxScrollOffset();if(n<0||n>r)return;if(this._iosDeferredAdjustment<0&&n>=r-1){this._iosDeferredAdjustment=0;return}const a=this._iosDeferredAdjustment;this._iosDeferredAdjustment=0,this._scrollToOffset(n,{adjustments:this.scrollAdjustments+=a,behavior:void 0})},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getMeasurementOptions=Mr(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes,this.options.laneAssignmentMode,this.options.gap],(n,r,a,i,o,s,l,u)=>(this.prevLanes!==void 0&&this.prevLanes!==s&&(this.lanesChangedFlag=!0),this.prevLanes=s,this.pendingMin=null,{count:n,paddingStart:r,scrollMargin:a,getItemKey:i,enabled:o,lanes:s,laneAssignmentMode:l,gap:u}),{key:!1}),this.getMeasurements=Mr(()=>[this.getMeasurementOptions(),this.itemSizeCacheVersion],({count:n,paddingStart:r,scrollMargin:a,getItemKey:i,enabled:o,lanes:s,laneAssignmentMode:l,gap:u},d)=>{const p=this.itemSizeCache;if(!o)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>n)for(const k of this.laneAssignments.keys())k>=n&&this.laneAssignments.delete(k);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMin=null),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(k=>{this.itemSizeCache.set(k.key,k.size)}));const h=this.lanesSettling?0:this.pendingMin??0;if(this.pendingMin=null,this.lanesSettling&&this.measurementsCache.length===n&&(this.lanesSettling=!1),s===1){const k=n*2;let b=this._flatMeasurements;if(!b||b.length<k){const N=new Float64Array(k);b&&h>0&&N.set(b.subarray(0,h*2)),b=N,this._flatMeasurements=b}let x;if(h===0)x=r+a;else{const N=h-1;x=b[N*2]+b[N*2+1]+u}for(let N=h;N<n;N++){const E=i(N),D=p.get(E),P=typeof D=="number"?D:this.options.estimateSize(N);b[N*2]=x,b[N*2+1]=P,x+=P+u}const M=W_e(n,b,i);return this.measurementsCache=M,M}const m=this.measurementsCache.slice(0,h),f=new Array(s).fill(void 0),g=new Float64Array(s);let _=0;for(let k=0;k<h;k++){const b=m[k];b&&(f[b.lane]===void 0&&_++,f[b.lane]=k,g[b.lane]=b.end)}for(let k=h;k<n;k++){const b=i(k),x=this.laneAssignments.get(k);let M,N;const E=l==="estimate"||p.has(b);if(x!==void 0&&this.options.lanes>1){M=x;const I=f[M],q=I!==void 0?m[I]:void 0;N=q?q.end+u:r+a}else if(_===s){let I=0,q=g[0],Z=f[0];for(let X=1;X<s;X++){const K=g[X];(K<q||K===q&&f[X]<Z)&&(I=X,q=K,Z=f[X])}M=I,N=q+u,E&&this.laneAssignments.set(k,M)}else M=k%this.options.lanes,N=r+a,E&&this.laneAssignments.set(k,M);const D=p.get(b),P=typeof D=="number"?D:this.options.estimateSize(k),C=N+P;m[k]={index:k,start:N,size:P,end:C,key:b,lane:M},f[M]===void 0&&_++,f[M]=k,g[M]=C}return this.measurementsCache=m,m},{key:process.env.NODE_ENV!=="production"&&"getMeasurements",debug:()=>this.options.debug}),this.calculateRange=Mr(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(n,r,a,i)=>n.length===0||r===0?(this.range=null,null):(this.range=sxe(n,r,a,i,i===1&&this._flatMeasurements!=null?this._flatMeasurements:null),this.range),{key:process.env.NODE_ENV!=="production"&&"calculateRange",debug:()=>this.options.debug}),this.getVirtualIndexes=Mr(()=>{let n=null,r=null;const a=this.calculateRange();return a&&(n=a.startIndex,r=a.endIndex),this.maybeNotify.updateDeps([this.isScrolling,n,r]),[this.options.rangeExtractor,this.options.overscan,this.options.count,n,r]},(n,r,a,i,o)=>i===null||o===null?[]:n({startIndex:i,endIndex:o,overscan:r,count:a}),{key:process.env.NODE_ENV!=="production"&&"getVirtualIndexes",debug:()=>this.options.debug}),this.indexFromElement=n=>{const r=this.options.indexAttribute,a=n.getAttribute(r);return a?parseInt(a,10):(console.warn(`Missing attribute name '${r}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=n=>{var r;if(!this.scrollState||this.scrollState.behavior!=="smooth")return!0;const a=this.scrollState.index??((r=this.getVirtualItemForOffset(this.scrollState.lastTargetOffset))==null?void 0:r.index);if(a!==void 0&&this.range){const i=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),o=Math.max(0,a-i),s=Math.min(this.options.count-1,a+i);return n>=o&&n<=s}return!0},this.measureElement=n=>{if(!n){this.elementsCache.forEach((o,s)=>{o.isConnected||(this.observer.unobserve(o),this.elementsCache.delete(s))});return}const r=this.indexFromElement(n),a=this.options.getItemKey(r),i=this.elementsCache.get(a);i!==n&&(i&&this.observer.unobserve(i),this.observer.observe(n),this.elementsCache.set(a,n)),(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(r)&&this.resizeItem(r,this.options.measureElement(n,void 0,this))},this.resizeItem=(n,r)=>{var a,i;if(n<0||n>=this.options.count)return;let o,s,l;const u=this._flatMeasurements;if(this.options.lanes===1&&u!==null)l=this.options.getItemKey(n),s=u[n*2],o=u[n*2+1];else{const h=this.measurementsCache[n];if(!h)return;l=h.key,s=h.start,o=h.size}const d=this.itemSizeCache.get(l)??o,p=r-d;if(p!==0){const h=this.options.anchorTo==="end"&&((a=this.scrollState)==null?void 0:a.behavior)!=="smooth"&&this.getVirtualDistanceFromEnd()<=this.options.scrollEndThreshold,m=h?this.getTotalSize():0,f=this.getScrollOffset()+this.scrollAdjustments,_=!this.itemSizeCache.has(l)?s<f:s+d<=f&&this.scrollDirection!=="backward",k=((i=this.scrollState)==null?void 0:i.behavior)!=="smooth"&&(this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(this.measurementsCache[n]??{index:n,key:l,start:s,size:o,end:s+o,lane:0},p,this):_);(this.pendingMin===null||n<this.pendingMin)&&(this.pendingMin=n),this.itemSizeCache.set(l,r),this.itemSizeCacheVersion++;let b=!1;h?b=this.applyScrollAdjustment(this.getTotalSize()-m):k&&(b=this.applyScrollAdjustment(p)),this.notify(b)}},this.getVirtualItems=Mr(()=>[this.getVirtualIndexes(),this.getMeasurements()],(n,r)=>{const a=[];for(let i=0,o=n.length;i<o;i++){const s=n[i],l=r[s];a.push(l)}return a},{key:process.env.NODE_ENV!=="production"&&"getVirtualItems",debug:()=>this.options.debug}),this.getVirtualItemForOffset=n=>{const r=this.getMeasurements();if(r.length===0)return;const a=this._flatMeasurements,i=this.options.lanes===1&&a!=null,o=tv(0,r.length-1,i?s=>a[s*2]:s=>C2(r[s]).start,n);return C2(r[o])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if("scrollHeight"in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{const n=this.scrollElement.document.documentElement;return this.options.horizontal?n.scrollWidth-this.scrollElement.innerWidth:n.scrollHeight-this.scrollElement.innerHeight}},this.getVirtualDistanceFromEnd=()=>Math.max(this.getTotalSize()-this.getSize()-this.getScrollOffset(),0),this.getDistanceFromEnd=()=>Math.max(this.getMaxScrollOffset()-this.getScrollOffset(),0),this.isAtEnd=(n=this.options.scrollEndThreshold)=>this.getDistanceFromEnd()<=n,this.getOffsetForAlignment=(n,r,a=0)=>{if(!this.scrollElement)return 0;const i=this.getSize(),o=this.getScrollOffset();r==="auto"&&(r=n>=o+i?"end":"start"),r==="center"?n+=(a-i)/2:r==="end"&&(n-=i);const s=this.getMaxScrollOffset();return Math.max(Math.min(s,n),0)},this.getOffsetForIndex=(n,r="auto")=>{n=Math.max(0,Math.min(n,this.options.count-1));const a=this.getSize(),i=this.getScrollOffset(),o=this.measurementsCache[n];if(!o)return;if(r==="auto")if(o.end>=i+a-this.options.scrollPaddingEnd)r="end";else if(o.start<=i+this.options.scrollPaddingStart)r="start";else return[i,r];if(r==="end"&&n===this.options.count-1)return[this.getMaxScrollOffset(),r];const s=r==="end"?o.end+this.options.scrollPaddingEnd:o.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(s,r,o.size),r]},this.scrollToOffset=(n,{align:r="start",behavior:a="auto"}={})=>{this._iosDeferredAdjustment=0;const i=this.getOffsetForAlignment(n,r),o=this.now();this.scrollState={index:null,align:r,behavior:a,startedAt:o,lastTargetOffset:i,stableFrames:0},this._scrollToOffset(i,{adjustments:void 0,behavior:a}),this.scheduleScrollReconcile()},this.scrollToIndex=(n,{align:r="auto",behavior:a="auto"}={})=>{this._iosDeferredAdjustment=0,n=Math.max(0,Math.min(n,this.options.count-1));const i=this.getOffsetForIndex(n,r);if(!i)return;const[o,s]=i,l=this.now();this.scrollState={index:n,align:s,behavior:a,startedAt:l,lastTargetOffset:o,stableFrames:0},this._scrollToOffset(o,{adjustments:void 0,behavior:a}),this.scheduleScrollReconcile()},this.scrollBy=(n,{behavior:r="auto"}={})=>{const a=this.getScrollOffset()+n,i=this.now();this.scrollState={index:null,align:"start",behavior:r,startedAt:i,lastTargetOffset:a,stableFrames:0},this._scrollToOffset(a,{adjustments:void 0,behavior:r}),this.scheduleScrollReconcile()},this.scrollToEnd=({behavior:n="auto"}={})=>{if(this.options.count>0){this.scrollToIndex(this.options.count-1,{align:"end",behavior:n});return}this.scrollToOffset(Math.max(this.getTotalSize()-this.getSize(),0),{behavior:n})},this.getTotalSize=()=>{var n;const r=this.getMeasurements();let a;if(r.length===0)a=this.options.paddingStart;else if(this.options.lanes===1){const i=r.length-1,o=this._flatMeasurements;o!=null?a=o[i*2]+o[i*2+1]:a=((n=r[i])==null?void 0:n.end)??0}else{const i=Array(this.options.lanes).fill(null);let o=r.length-1;for(;o>=0&&i.some(s=>s===null);){const s=r[o];i[s.lane]===null&&(i[s.lane]=s.end),o--}a=Math.max(...i.filter(s=>s!==null))}return Math.max(a-this.options.scrollMargin+this.options.paddingEnd,0)},this.takeSnapshot=()=>{const n=[];if(this.itemSizeCache.size===0)return n;const r=this.getMeasurements();for(const a of r)a&&this.itemSizeCache.has(a.key)&&n.push({index:a.index,key:a.key,start:a.start,size:a.size,end:a.end,lane:a.lane});return n},this._scrollToOffset=(n,{adjustments:r,behavior:a})=>{this._intendedScrollOffset=n+(r??0),this.options.scrollToFn(n,{behavior:a,adjustments:r},this)},this.measure=()=>{this.pendingMin=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),this.itemSizeCacheVersion++,this.notify(!1)},this.setOptions(t)}applyScrollAdjustment(t,n){return t===0?!1:(process.env.NODE_ENV!=="production"&&this.options.debug&&console.info("correction",t),ls()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?(this._iosDeferredAdjustment+=t,!1):(this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=t,behavior:n}),this.scrollOffset!==null&&(this.scrollOffset+=this.scrollAdjustments,this.scrollOffset<0&&(this.scrollOffset=0),this.scrollAdjustments=0),!0))}scheduleScrollReconcile(){if(!this.targetWindow){this.scrollState=null;return}this.rafId==null&&(this.rafId=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()}))}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}const r=this.scrollState.index!=null?this.getOffsetForIndex(this.scrollState.index,this.scrollState.align):void 0,a=r?r[0]:this.scrollState.lastTargetOffset,i=1,o=a!==this.scrollState.lastTargetOffset;if(!o&&K_e(a,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=i){this.getScrollOffset()!==a&&this._scrollToOffset(a,{adjustments:void 0,behavior:"auto"}),this.scrollState=null;return}}else if(this.scrollState.stableFrames=0,o){const s=this.getSize()||600,l=Math.abs(a-this.getScrollOffset()),u=this.scrollState.behavior==="smooth"&&l>s;this.scrollState.lastTargetOffset=a,u||(this.scrollState.behavior="auto"),this._scrollToOffset(a,{adjustments:void 0,behavior:u?"smooth":"auto"})}this.scheduleScrollReconcile()}}const tv=(e,t,n,r)=>{for(;e<=t;){const a=(e+t)/2|0,i=n(a);if(i<r)e=a+1;else if(i>r)t=a-1;else return a}return e>0?e-1:0};function oxe(e,t,n){let r=0;for(;r<=t;){const a=(r+t)/2|0,i=e[a*2];if(i<n)r=a+1;else if(i>n)t=a-1;else return a}return r>0?r-1:0}function sxe(e,t,n,r,a){const i=e.length-1;if(e.length<=r)return{startIndex:0,endIndex:i};if(r===1&&a!==null){const u=oxe(a,i,n);let d=u;const p=n+t;for(;d<i&&a[d*2]+a[d*2+1]<p;)d++;return{startIndex:u,endIndex:d}}let s=tv(0,i,u=>e[u].start,n),l=s;if(r===1)for(;l<i&&e[l].end<n+t;)l++;else if(r>1){const u=Array(r).fill(0);for(;l<i&&u.some(p=>p<n+t);){const p=e[l];u[p.lane]=p.end,l++}const d=Array(r).fill(n+t);for(;s>=0&&d.some(p=>p>=n);){const p=e[s];d[p.lane]=p.start,s--}s=Math.max(0,s-s%r),l=Math.min(i,l+(r-1-l%r))}return{startIndex:s,endIndex:l}}const cs=typeof document<"u"?te.useLayoutEffect:te.useEffect;function lxe({useFlushSync:e=!0,directDomUpdates:t=!1,directDomUpdatesMode:n="transform",...r}){const a=te.useReducer(d=>d+1,0)[1],i=te.useRef({enabled:t,mode:n,container:null,lastSize:null,lastPositions:new WeakMap,prevRange:null});i.current.enabled=t,i.current.mode=n;const o=d=>{const p=i.current;if(!p.enabled||!p.container)return;const h=d.getTotalSize();if(h!==p.lastSize){p.lastSize=h;const m=d.options.horizontal?"width":"height";p.container.style[m]=`${h}px`}},s=d=>{const p=i.current;if(!p.enabled||!p.container)return;o(d);const h=!!d.options.horizontal,m=p.mode==="transform",f=h?"left":"top",g=d.options.scrollMargin,_=d.getVirtualItems();for(const k of _){const b=k.start-g,x=d.elementsCache.get(k.key);x&&p.lastPositions.get(x)!==b&&(p.lastPositions.set(x,b),m?x.style.transform=h?`translate3d(${b}px, 0, 0)`:`translate3d(0, ${b}px, 0)`:x.style[f]=`${b}px`)}},l={...r,onChange:(d,p)=>{var h;const m=i.current;let f=!0;if(m.enabled){s(d);const g=d.range,_=m.prevRange;f=!_||_.isScrolling!==d.isScrolling||_.startIndex!==g?.startIndex||_.endIndex!==g?.endIndex,f&&(m.prevRange=g?{startIndex:g.startIndex,endIndex:g.endIndex,isScrolling:d.isScrolling}:null)}f&&(e&&p?d5.flushSync(a):a()),(h=r.onChange)==null||h.call(r,d,p)}},[u]=te.useState(()=>{const d=new ixe(l);return Object.assign(d,{containerRef:p=>{const h=i.current;if(h.container=p,h.lastSize=null,p&&h.enabled){const m=d.getTotalSize();h.lastSize=m;const f=d.options.horizontal?"width":"height";p.style[f]=`${m}px`}}})});return u.setOptions(l),cs(()=>u._didMount(),[]),cs(()=>(o(u),u._willUpdate())),cs(()=>{s(u)}),u}function cxe(e){return lxe({observeElementRect:Q_e,observeElementOffset:txe,scrollToFn:axe,...e})}const nv=j.memo(()=>{const e=fe(n=>n.activeChatId??n.draftChatKey),t=fe(n=>De(n,e).composerError);return t?w.jsx("div",{className:"mp-agent-composer-error",children:t}):null});nv.displayName="ComposerError";const uxe=(e,t)=>{switch(e.status){case exports.AgentToolCallStatus.Running:return`Running ${t}...`;case exports.AgentToolCallStatus.Succeeded:return`Completed ${t}`;case exports.AgentToolCallStatus.Failed:return`Failed to run ${t}`;case exports.AgentToolCallStatus.Pending:return`Preparing ${t}...`;default:return`Running ${t}...`}},us=e=>{if(e===void 0)return"undefined";try{return JSON.stringify(e,null,2)??"undefined"}catch{try{return String(e)}catch{return"[unserializable]"}}},I2=({call:e})=>$e().config.debug?w.jsxs("details",{className:"mp-agent-tool-debug-details",children:[w.jsx("summary",{className:"mp-agent-tool-debug-summary",children:"Details"}),w.jsxs("div",{className:"mp-agent-tool-debug-body",children:[w.jsxs("div",{className:"mp-agent-tool-debug-row",children:[w.jsx("div",{className:"mp-agent-tool-debug-label",children:"Tool"}),w.jsx("div",{className:"mp-agent-tool-debug-value",children:e.name})]}),w.jsxs("div",{className:"mp-agent-tool-debug-row",children:[w.jsx("div",{className:"mp-agent-tool-debug-label",children:"Status"}),w.jsx("div",{className:"mp-agent-tool-debug-value",children:e.status})]}),w.jsxs("details",{className:"mp-agent-tool-debug-section",children:[w.jsx("summary",{className:"mp-agent-tool-debug-section-summary",children:"Input"}),w.jsx("pre",{className:"mp-agent-tool-debug-code",children:w.jsx("code",{children:us(e.input)})})]}),w.jsxs("details",{className:"mp-agent-tool-debug-section",children:[w.jsx("summary",{className:"mp-agent-tool-debug-section-summary",children:"Output"}),w.jsx("pre",{className:"mp-agent-tool-debug-code",children:w.jsx("code",{children:us(e.output)})})]}),e.error&&w.jsxs("details",{className:"mp-agent-tool-debug-section",children:[w.jsx("summary",{className:"mp-agent-tool-debug-section-summary",children:"Error"}),w.jsx("pre",{className:"mp-agent-tool-debug-code",children:w.jsx("code",{children:us(e.error)})})]})]})]}):null,rv=j.memo(({call:e})=>{const t=$e(),n=e.status===exports.AgentToolCallStatus.Succeeded||e.status===exports.AgentToolCallStatus.Failed;if(!t.config.debug||n)return null;const a=t.tools.get(e.name)?.label??e.name;return w.jsx("div",{className:"mp-agent-tool-header",children:w.jsx("div",{className:"mp-agent-tool-simple-message",children:uxe(e,a)})})});rv.displayName="ToolCallHeader";function dxe(e){try{const t=JSON.parse(e);return{question:typeof t.question=="string"?t.question:void 0,selectedOptions:Array.isArray(t.selectedOptions)?t.selectedOptions:void 0,freeText:typeof t.freeText=="string"?t.freeText:void 0}}catch{return e}}const av=({call:e})=>{if(e.approved===void 0)return null;const t=e.userResponse?dxe(e.userResponse):null,n=()=>{if(!t)return null;if(typeof t=="string")return w.jsx("span",{className:"mp-agent-tool-approval-response",children:t});const r=t.freeText??t.selectedOptions?.map(a=>a.label).join(", ");return!t.question&&!r?null:w.jsxs("div",{className:"mp-agent-tool-approval-result",children:[t.question&&w.jsx("span",{className:"mp-agent-tool-approval-question",children:t.question}),r&&w.jsx("span",{className:"mp-agent-tool-approval-response",children:r})]})};return w.jsxs("div",{className:"mp-agent-tool-approval-status-inline",children:[e.approved&&n(),e.approved?w.jsx("div",{className:"mp-agent-tool-approved",children:w.jsx("span",{children:"✓ Approved"})}):w.jsx("span",{className:"mp-agent-tool-denied",children:"✗ Denied"})]})},pxe=e=>{if(!e||typeof e!="object"||Array.isArray(e))return null;const t=e.question,n=e.selectionMode,r=e.options,a=e.allowFreeText;if(typeof t!="string"||t.trim().length<1||n!=="single"&&n!=="multiple"||!Array.isArray(r)||r.length<2||r.length>6)return null;const i=r.map(o=>{if(!o||typeof o!="object"||Array.isArray(o))return null;const s=o.id,l=o.label,u=o.description;return typeof s!="string"||s.trim().length<1||typeof l!="string"||l.trim().length<1||u!==void 0&&typeof u!="string"?null:{id:s,label:l,...typeof u=="string"?{description:u}:{}}}).filter(o=>o!==null);return i.length!==r.length?null:{question:t,selectionMode:n,options:i,allowFreeText:typeof a=="boolean"?a:!1}},hxe=({callId:e,input:t,isSubmitting:n,onSubmit:r})=>{const[a,i]=j.useState([]),[o,s]=j.useState(""),[l,u]=j.useState(void 0),d=j.useMemo(()=>pxe(t),[t]);j.useEffect(()=>{i([]),s(""),u(void 0)},[e,t]);const p=m=>{if(d){if(u(void 0),d.selectionMode==="single"){i([m]);return}i(f=>f.includes(m)?f.filter(g=>g!==m):[...f,m])}},h=async()=>{if(!d)return;const m=o.trim(),f=a.length>0,g=d.allowFreeText&&m.length>0;if(!f&&!g){u(d.allowFreeText?"Select at least one option or provide a custom response.":"Select at least one option before submitting.");return}const _=d.options.filter(b=>a.includes(b.id)).map(({id:b,label:x,description:M})=>({id:b,label:x,...M?{description:M}:{}})),k={question:d.question,selectionMode:d.selectionMode,selectedOptionIds:a,selectedOptions:_,...m?{freeText:m}:{}};await r(JSON.stringify(k))};return d?w.jsxs("div",{className:"mp-agent-tool-user-action-form",children:[w.jsx("div",{className:"mp-agent-tool-user-action-question",children:d.question}),w.jsx("div",{className:"mp-agent-tool-user-action-options",children:d.options.map(m=>{const f=`${e}-${m.id}`,g=a.includes(m.id);return w.jsxs("label",{htmlFor:f,className:"mp-agent-tool-user-action-option",children:[w.jsx("input",{id:f,type:d.selectionMode==="single"?"radio":"checkbox",name:`mp-agent-tool-user-action-${e}`,checked:g,onChange:()=>p(m.id),disabled:n}),w.jsxs("span",{className:"mp-agent-tool-user-action-option-content",children:[w.jsx("span",{className:"mp-agent-tool-user-action-option-label",children:m.label}),m.description?w.jsx("span",{className:"mp-agent-tool-user-action-option-description",children:m.description}):null]})]},m.id)})}),d.allowFreeText?w.jsx("textarea",{className:"mp-agent-tool-user-action-free-text",value:o,onChange:m=>{s(m.target.value),l&&u(void 0)},placeholder:"Optional custom response",rows:3,disabled:n}):null,l?w.jsx("div",{className:"mp-agent-tool-input-error",children:l}):null,w.jsx("div",{className:"mp-agent-tool-approval-actions",children:w.jsx("button",{className:"mp-agent-tool-approve-button",onClick:h,disabled:n,children:n?"Submitting...":"Submit response"})})]}):w.jsx("div",{className:"mp-agent-tool-user-action-form",children:w.jsx("div",{className:"mp-agent-tool-input-error",children:"Invalid user action input schema in tool call."})})},mxe=({call:e,messageId:t,chatId:n,onApprovalSent:r})=>{const a=$e(),i=a.tools.get(e.name)?.label??e.name,o=fe(q=>q.appendMessagesToChat),s=fe(q=>q.setChatMessages),l=fe(q=>q.setChatStatus),u=fe(q=>q.setPendingAssistant),[d,p]=j.useState(!1),[h,m]=j.useState(!1),[f,g]=j.useState(!1),[_,k]=j.useState(JSON.stringify(e.input??{},null,2)),[b,x]=j.useState(void 0),M=a.config.user?.id??"guest",N=e.requiresUserAction;j.useEffect(()=>{h||(k(JSON.stringify(e.input??{},null,2)),x(void 0))},[e.id,e.input,h]);const E=()=>{k(JSON.stringify(e.input??{},null,2)),x(void 0),m(!0)},D=()=>{k(JSON.stringify(e.input??{},null,2)),x(void 0),m(!1)},P=async()=>{if(!(!a.transport.updateToolCall||f||d)){x(void 0),g(!0);try{const q=JSON.parse(_);if(!q||typeof q!="object"||Array.isArray(q))throw new Error("Tool input must be a JSON object.");const Z=await a.transport.updateToolCall({chatId:n,messageId:t,toolCallId:e.id,input:q});o(n,[Z]),m(!1)}catch(q){x(q instanceof Error?q.message:"Failed to update tool input.")}finally{g(!1)}}},C=q=>{s(n,Z=>Z.map(X=>X.id===t?{...X,toolCalls:(X.toolCalls??[]).map(K=>K.id===e.id?{...K,...q}:K)}:X))},I=async(q,Z)=>{if(!(!e.approvalId||d||f||h)){p(!0),C({approved:q,...Z?{userResponse:Z}:{}}),l(n,ct.Streaming),u(n,{id:`pending-approval-${e.id}`,chat:n,role:exports.MessageRole.Assistant,content:"",reasoning:"",toolCalls:[],attachments:[],createdAt:new Date().toISOString()});try{const X={chatId:n,messageId:t,approvalId:e.approvalId,approved:q,...Z?{userResponse:Z}:{},userId:M},K=await a.transport.streamMessage(X,R=>{R.type===exports.StreamChunkType.Message&&R.message&&(R.message.id!==t&&u(n,void 0),o(n,[R.message]))},{streamKey:n});K&&o(K.id,K.messages),await r()}catch(X){console.error("Failed to send approval:",X),C({approved:void 0,userResponse:void 0}),l(n,ct.Idle)}finally{u(n,void 0),p(!1)}}};return e.approved!==void 0?w.jsx(av,{call:e}):N?w.jsx(hxe,{callId:e.id,input:e.input,isSubmitting:d,onSubmit:q=>I(!0,q)}):w.jsxs("div",{className:"mp-agent-tool-approval-buttons",children:[w.jsxs("div",{className:"mp-agent-tool-approval-request-message",children:["Agent wants to execute tool ",i,"."]}),w.jsxs("div",{className:"mp-agent-tool-input-card",children:[w.jsxs("div",{className:"mp-agent-tool-input-card-header",children:[w.jsx("span",{className:"mp-agent-tool-input-card-title",children:"Tool input"}),h?w.jsxs("div",{className:"mp-agent-tool-input-actions",children:[w.jsx(un,{icon:"Check",size:"sm",tooltip:"Save tool input",onClick:P,disabled:f||d,"aria-label":"Save tool input"}),w.jsx(un,{icon:"X",size:"sm",tooltip:"Cancel input edit",onClick:D,disabled:f||d,"aria-label":"Cancel tool input edit"})]}):w.jsx(un,{icon:"Pencil",size:"sm",tooltip:"Edit tool input",onClick:E,disabled:d||f,"aria-label":"Edit tool input"})]}),h?w.jsx("textarea",{className:"mp-agent-tool-input-editor",value:_,onChange:q=>{k(q.target.value),b&&x(void 0)},rows:8,spellCheck:!1,disabled:f||d}):w.jsx("pre",{className:"mp-agent-tool-input-preview",children:JSON.stringify(e.input??{},null,2)}),b&&w.jsx("div",{className:"mp-agent-tool-input-error",children:b})]}),w.jsxs("div",{className:"mp-agent-tool-approval-actions",children:[w.jsx("button",{className:"mp-agent-tool-approve-button",onClick:()=>I(!0),disabled:d||h||f,children:d?"Processing...":"Approve"}),w.jsx("button",{className:"mp-agent-tool-deny-button",onClick:()=>I(!1),disabled:d||f,children:d?"Processing...":"Deny"})]})]})},O2=({call:e,messageId:t,chatId:n})=>{const r=$e(),a=fe(p=>p.upsertChat),i=fe(p=>p.setChatStatus),o=r.config.debug&&!!e.approvalId,s=e.requiresConfirmation&&e.approvalId||o,l=s&&e.approved===void 0,u=s&&e.approved!==void 0,d=async()=>{try{const p=await r.transport.getChat(n);a(p),i(n,ka(p.status))}catch(p){console.error("Failed to refresh chat after approval:",p),i(n,ct.Idle)}};return!l&&!u?null:w.jsxs("div",{className:"mp-agent-tool-approval",children:[l&&w.jsx(mxe,{call:e,messageId:t,chatId:n,onApprovalSent:d}),u&&w.jsx(av,{call:e})]})},iv=j.memo(({chatId:e,isExpanded:t})=>{const n=$e(),r=fe(d=>De(d,e).messages),a=fe(d=>De(d,e).pendingAssistant),i=fe(d=>d.chats[e]?.contextKey??d.contextKey),[o,s]=j.useState(t);t&&!o&&s(!0);const l=mp(e,{requireRegisteredChat:!1,enabled:o}),u=j.useMemo(()=>{const d=[...r].sort((h,m)=>h.createdAt.localeCompare(m.createdAt));if(n.config.debug)return d;const p=d.findIndex(h=>h.role===exports.MessageRole.User);return p===-1?d:d.filter((h,m)=>m!==p)},[r,n.config.debug]);return t?w.jsx("div",{className:"mp-agent-subagent-preview",children:w.jsx("div",{className:"mp-agent-subagent-preview-body",children:u.length===0&&!a?w.jsx("div",{className:"mp-agent-subagent-preview-empty",children:l.isLoading?"Loading subagent chat...":"Subagent chat started."}):w.jsxs(w.Fragment,{children:[u.map(d=>w.jsx(eo,{message:d,contextKey:i,showParticipantChrome:!0},d.id)),a&&w.jsx(eo,{message:a,contextKey:i,isStreaming:!0,showParticipantChrome:!0})]})})}):null});iv.displayName="SubagentChatPreview";const fxe=e=>{switch(e){case exports.AgentToolCallStatus.Succeeded:return{key:"succeeded",label:"Done",icon:w.jsx(Gd,{size:12})};case exports.AgentToolCallStatus.Failed:return{key:"failed",label:"Failed",icon:w.jsx(L5,{size:12})};case exports.AgentToolCallStatus.Pending:return{key:"running",label:"Preparing",icon:w.jsx(ma,{size:12,className:"mp-agent-subagent-spinner"})};default:return{key:"running",label:"Running",icon:w.jsx(ma,{size:12,className:"mp-agent-subagent-spinner"})}}},ov=j.memo(({call:e,subagentChatId:t})=>{const[n,r]=j.useState(!1),a=fe(o=>{const{messages:s,pendingAssistant:l}=De(o,t),u=s.find(d=>d.agentName||d.sender?.type==="agent")??l;return u?.agentName||u?.sender?.displayName||void 0}),i=fxe(e.status);return w.jsxs("div",{className:"mp-agent-subagent",children:[w.jsxs("button",{className:"mp-agent-subagent-row",type:"button",onClick:()=>r(o=>!o),"aria-expanded":n,children:[w.jsx("span",{className:"mp-agent-subagent-row-icon",children:w.jsx(v5,{size:14})}),w.jsx("span",{className:"mp-agent-subagent-row-title",children:a?w.jsxs(w.Fragment,{children:[w.jsx("span",{className:"mp-agent-subagent-row-label",children:"Subagent:"})," ",a]}):"Subagent"}),w.jsxs("span",{className:`mp-agent-subagent-row-status is-${i.key}`,children:[i.icon,i.label]}),w.jsx("span",{className:"mp-agent-subagent-row-chevron",children:n?w.jsx(Wd,{size:14}):w.jsx(no,{size:14})})]}),w.jsx(iv,{chatId:t,isExpanded:n})]})});ov.displayName="SubagentToolCall";const xp=j.memo(({call:e,contextKey:t,messageId:n,chatId:r})=>{const a=$e(),i=e.subagentChatId||(typeof e.input?.subagentChatId=="string"?e.input.subagentChatId:void 0),o=j.useMemo(()=>a.getToolRenderer(e),[a,e.name]),s=i?w.jsx(ov,{call:e,subagentChatId:i}):null;if(!o){const l=!!(e.requiresConfirmation&&e.approvalId);return!!i||a.config.debug||l?w.jsxs("div",{className:"mp-agent-tool-panel",children:[w.jsx(rv,{call:e}),w.jsx(O2,{call:e,messageId:n,chatId:r}),w.jsx(I2,{call:e}),s]}):null}return w.jsxs("div",{className:"mp-agent-tool-panel",children:[w.jsx(o,{call:e,contextKey:t,chatId:r}),w.jsx(O2,{call:e,messageId:n,chatId:r}),w.jsx(I2,{call:e}),s]})});xp.displayName="ToolCallCard";const gxe=e=>{const t=e.sender?.displayName||e.sender?.id||e.agentName;if(!t)return e.role===exports.MessageRole.User?"You":"AI";const n=t.split(/\s+/).filter(Boolean);return n.length>=2?`${n[0][0]}${n[1][0]}`.toUpperCase():t.slice(0,2).toUpperCase()},wp=j.memo(({message:e})=>{const t=e.role===exports.MessageRole.User;return w.jsx("div",{className:`mp-agent-message-avatar ${t?"mp-agent-message-avatar-user":""}`,children:e.sender?.avatarUrl?w.jsx("img",{className:"mp-agent-message-avatar-image",src:e.sender.avatarUrl,alt:""}):w.jsx("div",{className:"mp-agent-message-avatar-icon",children:gxe(e)})})});wp.displayName="MessageAvatar";const yxe=e=>e?new Date(e).toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit"}):"",bxe=e=>e.sender?.displayName?e.sender.displayName:e.sender?.id&&e.sender.id!=="guest"?e.sender.id:e.agentName?e.agentName:e.role===exports.MessageRole.User?"You":"Assistant",Ep=j.memo(({message:e})=>{const t=bxe(e);return w.jsxs("div",{className:"mp-agent-message-header",children:[w.jsx("span",{className:"mp-agent-message-role",children:t}),w.jsx("span",{className:"mp-agent-message-time",children:yxe(e.createdAt)})]})});Ep.displayName="MessageHeader";function L2(e){const t=[],n=String(e||"");let r=n.indexOf(","),a=0,i=!1;for(;!i;){r===-1&&(r=n.length,i=!0);const o=n.slice(a,r).trim();(o||!i)&&t.push(o),a=r+1,r=n.indexOf(",",a)}return t}function kxe(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const vxe=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,_xe=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,xxe={};function D2(e,t){return(xxe.jsx?_xe:vxe).test(e)}const wxe=/[ \t\n\f\r]/g;function Exe(e){return typeof e=="object"?e.type==="text"?z2(e.value):!1:z2(e)}function z2(e){return e.replace(wxe,"")===""}let La=class{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}};La.prototype.normal={};La.prototype.property={};La.prototype.space=void 0;function sv(e,t){const n={},r={};for(const a of e)Object.assign(n,a.property),Object.assign(r,a.normal);return new La(n,r,t)}function va(e){return e.toLowerCase()}let Ft=class{constructor(t,n){this.attribute=n,this.property=t}};Ft.prototype.attribute="";Ft.prototype.booleanish=!1;Ft.prototype.boolean=!1;Ft.prototype.commaOrSpaceSeparated=!1;Ft.prototype.commaSeparated=!1;Ft.prototype.defined=!1;Ft.prototype.mustUseProperty=!1;Ft.prototype.number=!1;Ft.prototype.overloadedBoolean=!1;Ft.prototype.property="";Ft.prototype.spaceSeparated=!1;Ft.prototype.space=void 0;let Mxe=0;const Te=kr(),lt=kr(),yd=kr(),le=kr(),Ze=kr(),fr=kr(),Ut=kr();function kr(){return 2**++Mxe}const bd=Object.freeze(Object.defineProperty({__proto__:null,boolean:Te,booleanish:lt,commaOrSpaceSeparated:Ut,commaSeparated:fr,number:le,overloadedBoolean:yd,spaceSeparated:Ze},Symbol.toStringTag,{value:"Module"})),ds=Object.keys(bd);let Mp=class extends Ft{constructor(t,n,r,a){let i=-1;if(super(t,n),$2(this,"space",a),typeof r=="number")for(;++i<ds.length;){const o=ds[i];$2(this,ds[i],(r&bd[o])===bd[o])}}};Mp.prototype.defined=!0;function $2(e,t,n){n&&(e[t]=n)}function Gr(e){const t={},n={};for(const[r,a]of Object.entries(e.properties)){const i=new Mp(r,e.transform(e.attributes||{},r),a,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(i.mustUseProperty=!0),t[r]=i,n[va(r)]=r,n[va(i.attribute)]=r}return new La(t,n,e.space)}const lv=Gr({properties:{ariaActiveDescendant:null,ariaAtomic:lt,ariaAutoComplete:null,ariaBusy:lt,ariaChecked:lt,ariaColCount:le,ariaColIndex:le,ariaColSpan:le,ariaControls:Ze,ariaCurrent:null,ariaDescribedBy:Ze,ariaDetails:null,ariaDisabled:lt,ariaDropEffect:Ze,ariaErrorMessage:null,ariaExpanded:lt,ariaFlowTo:Ze,ariaGrabbed:lt,ariaHasPopup:null,ariaHidden:lt,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Ze,ariaLevel:le,ariaLive:null,ariaModal:lt,ariaMultiLine:lt,ariaMultiSelectable:lt,ariaOrientation:null,ariaOwns:Ze,ariaPlaceholder:null,ariaPosInSet:le,ariaPressed:lt,ariaReadOnly:lt,ariaRelevant:null,ariaRequired:lt,ariaRoleDescription:Ze,ariaRowCount:le,ariaRowIndex:le,ariaRowSpan:le,ariaSelected:lt,ariaSetSize:le,ariaSort:null,ariaValueMax:le,ariaValueMin:le,ariaValueNow:le,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function cv(e,t){return t in e?e[t]:t}function uv(e,t){return cv(e,t.toLowerCase())}const Sxe=Gr({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:fr,acceptCharset:Ze,accessKey:Ze,action:null,allow:null,allowFullScreen:Te,allowPaymentRequest:Te,allowUserMedia:Te,alpha:Te,alt:null,as:null,async:Te,autoCapitalize:null,autoComplete:Ze,autoFocus:Te,autoPlay:Te,blocking:Ze,capture:null,charSet:null,checked:Te,cite:null,className:Ze,closedBy:null,colorSpace:null,cols:le,colSpan:le,command:null,commandFor:null,content:null,contentEditable:lt,controls:Te,controlsList:Ze,coords:le|fr,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Te,defer:Te,dir:null,dirName:null,disabled:Te,download:yd,draggable:lt,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Te,formTarget:null,headers:Ze,height:le,hidden:yd,high:le,href:null,hrefLang:null,htmlFor:Ze,httpEquiv:Ze,id:null,imageSizes:null,imageSrcSet:null,inert:Te,inputMode:null,integrity:null,is:null,isMap:Te,itemId:null,itemProp:Ze,itemRef:Ze,itemScope:Te,itemType:Ze,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Te,low:le,manifest:null,max:null,maxLength:le,media:null,method:null,min:null,minLength:le,multiple:Te,muted:Te,name:null,nonce:null,noModule:Te,noValidate:Te,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:Te,optimum:le,pattern:null,ping:Ze,placeholder:null,playsInline:Te,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Te,referrerPolicy:null,rel:Ze,required:Te,reversed:Te,rows:le,rowSpan:le,sandbox:Ze,scope:null,scoped:Te,seamless:Te,selected:Te,shadowRootClonable:Te,shadowRootCustomElementRegistry:Te,shadowRootDelegatesFocus:Te,shadowRootMode:null,shadowRootSerializable:Te,shape:null,size:le,sizes:null,slot:null,span:le,spellCheck:lt,src:null,srcDoc:null,srcLang:null,srcSet:null,start:le,step:null,style:null,tabIndex:le,target:null,title:null,translate:null,type:null,typeMustMatch:Te,useMap:null,value:lt,width:le,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Ze,axis:null,background:null,bgColor:null,border:le,borderColor:null,bottomMargin:le,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Te,declare:Te,event:null,face:null,frame:null,frameBorder:null,hSpace:le,leftMargin:le,link:null,longDesc:null,lowSrc:null,marginHeight:le,marginWidth:le,noResize:Te,noHref:Te,noShade:Te,noWrap:Te,object:null,profile:null,prompt:null,rev:null,rightMargin:le,rules:null,scheme:null,scrolling:lt,standby:null,summary:null,text:null,topMargin:le,valueType:null,version:null,vAlign:null,vLink:null,vSpace:le,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:Te,disablePictureInPicture:Te,disableRemotePlayback:Te,exportParts:fr,part:Ze,prefix:null,property:null,results:le,security:null,unselectable:null},space:"html",transform:uv}),Nxe=Gr({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",maskType:"mask-type",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:Ut,accentHeight:le,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:le,amplitude:le,arabicForm:null,ascent:le,attributeName:null,attributeType:null,azimuth:le,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:le,by:null,calcMode:null,capHeight:le,className:Ze,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:le,diffuseConstant:le,direction:null,display:null,dur:null,divisor:le,dominantBaseline:null,download:Te,dx:null,dy:null,edgeMode:null,editable:null,elevation:le,enableBackground:null,end:null,event:null,exponent:le,externalResourcesRequired:null,fill:null,fillOpacity:le,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:fr,g2:fr,glyphName:fr,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:le,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:le,horizOriginX:le,horizOriginY:le,id:null,ideographic:le,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:le,k:le,k1:le,k2:le,k3:le,k4:le,kernelMatrix:Ut,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:le,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskType:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:le,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:le,overlineThickness:le,paintOrder:null,panose1:null,path:null,pathLength:le,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Ze,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:le,pointsAtY:le,pointsAtZ:le,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Ut,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Ut,rev:Ut,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Ut,requiredFeatures:Ut,requiredFonts:Ut,requiredFormats:Ut,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:le,specularExponent:le,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:le,strikethroughThickness:le,string:null,stroke:null,strokeDashArray:Ut,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:le,strokeOpacity:le,strokeWidth:null,style:null,surfaceScale:le,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Ut,tabIndex:le,tableValues:null,target:null,targetX:le,targetY:le,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Ut,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:le,underlineThickness:le,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:le,values:null,vAlphabetic:le,vMathematical:le,vectorEffect:null,vHanging:le,vIdeographic:le,version:null,vertAdvY:le,vertOriginX:le,vertOriginY:le,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:le,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:cv}),dv=Gr({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),pv=Gr({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:uv}),hv=Gr({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),Axe={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},Txe=/[A-Z]/g,F2=/-[a-z]/g,Cxe=/^data[-\w.:]+$/i;function mv(e,t){const n=va(t);let r=t,a=Ft;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&Cxe.test(t)){if(t.charAt(4)==="-"){const i=t.slice(5).replace(F2,Ixe);r="data"+i.charAt(0).toUpperCase()+i.slice(1)}else{const i=t.slice(4);if(!F2.test(i)){let o=i.replace(Txe,Rxe);o.charAt(0)!=="-"&&(o="-"+o),t="data"+o}}a=Mp}return new a(r,t)}function Rxe(e){return"-"+e.toLowerCase()}function Ixe(e){return e.charAt(1).toUpperCase()}const fv=sv([lv,Sxe,dv,pv,hv],"html"),vo=sv([lv,Nxe,dv,pv,hv],"svg");function P2(e){const t=String(e||"").trim();return t?t.split(/[ \t\n\r\f]+/g):[]}function Oxe(e){return e.join(" ").trim()}var Jn=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function _o(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Sp={},q2=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,Lxe=/\n/g,Dxe=/^\s*/,zxe=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,$xe=/^:\s*/,Fxe=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,Pxe=/^[;\s]*/,qxe=/^\s+|\s+$/g,Bxe=`
|
|
8297
8297
|
`,B2="/",U2="*",hr="",Uxe="comment",Hxe="declaration";function jxe(e,t){if(typeof e!="string")throw new TypeError("First argument must be a string");if(!e)return[];t=t||{};var n=1,r=1;function a(f){var g=f.match(Lxe);g&&(n+=g.length);var _=f.lastIndexOf(Bxe);r=~_?f.length-_:r+f.length}function i(){var f={line:n,column:r};return function(g){return g.position=new o(f),u(),g}}function o(f){this.start=f,this.end={line:n,column:r},this.source=t.source}o.prototype.content=e;function s(f){var g=new Error(t.source+":"+n+":"+r+": "+f);if(g.reason=f,g.filename=t.source,g.line=n,g.column=r,g.source=e,!t.silent)throw g}function l(f){var g=f.exec(e);if(g){var _=g[0];return a(_),e=e.slice(_.length),g}}function u(){l(Dxe)}function d(f){var g;for(f=f||[];g=p();)g!==!1&&f.push(g);return f}function p(){var f=i();if(!(B2!=e.charAt(0)||U2!=e.charAt(1))){for(var g=2;hr!=e.charAt(g)&&(U2!=e.charAt(g)||B2!=e.charAt(g+1));)++g;if(g+=2,hr===e.charAt(g-1))return s("End of comment missing");var _=e.slice(2,g-2);return r+=2,a(_),e=e.slice(g),r+=2,f({type:Uxe,comment:_})}}function h(){var f=i(),g=l(zxe);if(g){if(p(),!l($xe))return s("property missing ':'");var _=l(Fxe),k=f({type:Hxe,property:H2(g[0].replace(q2,hr)),value:_?H2(_[0].replace(q2,hr)):hr});return l(Pxe),k}}function m(){var f=[];d(f);for(var g;g=h();)g!==!1&&(f.push(g),d(f));return f}return u(),m()}function H2(e){return e?e.replace(qxe,hr):hr}var Vxe=jxe,Gxe=Jn&&Jn.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Sp,"__esModule",{value:!0});Sp.default=Kxe;const Wxe=Gxe(Vxe);function Kxe(e,t){let n=null;if(!e||typeof e!="string")return n;const r=(0,Wxe.default)(e),a=typeof t=="function";return r.forEach(i=>{if(i.type!=="declaration")return;const{property:o,value:s}=i;a?t(o,s,i):s&&(n=n||{},n[o]=s)}),n}var xo={};Object.defineProperty(xo,"__esModule",{value:!0});xo.camelCase=void 0;var Yxe=/^--[a-zA-Z0-9_-]+$/,Zxe=/-([a-z])/g,Xxe=/^[^-]+$/,Qxe=/^-(webkit|moz|ms|o|khtml)-/,Jxe=/^-(ms)-/,ewe=function(e){return!e||Xxe.test(e)||Yxe.test(e)},twe=function(e,t){return t.toUpperCase()},j2=function(e,t){return"".concat(t,"-")},nwe=function(e,t){return t===void 0&&(t={}),ewe(e)?e:(e=e.toLowerCase(),t.reactCompat?e=e.replace(Jxe,j2):e=e.replace(Qxe,j2),e.replace(Zxe,twe))};xo.camelCase=nwe;var rwe=Jn&&Jn.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},awe=rwe(Sp),iwe=xo;function kd(e,t){var n={};return!e||typeof e!="string"||(0,awe.default)(e,function(r,a){r&&a&&(n[(0,iwe.camelCase)(r,t)]=a)}),n}kd.default=kd;var owe=kd;const swe=_o(owe),gv=yv("end"),Np=yv("start");function yv(e){return t;function t(n){const r=n&&n.position&&n.position[e]||{};if(typeof r.line=="number"&&r.line>0&&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 lwe(e){const t=Np(e),n=gv(e);if(t&&n)return{start:t,end:n}}function ua(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?V2(e.position):"start"in e||"end"in e?V2(e):"line"in e||"column"in e?vd(e):""}function vd(e){return G2(e&&e.line)+":"+G2(e&&e.column)}function V2(e){return vd(e&&e.start)+"-"+vd(e&&e.end)}function G2(e){return e&&typeof e=="number"?e:1}class wt extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let a="",i={},o=!1;if(n&&("line"in n&&"column"in n?i={place:n}:"start"in n&&"end"in n?i={place:n}:"type"in n?i={ancestors:[n],place:n.position}:i={...n}),typeof t=="string"?a=t:!i.cause&&t&&(o=!0,a=t.message,i.cause=t),!i.ruleId&&!i.source&&typeof r=="string"){const l=r.indexOf(":");l===-1?i.ruleId=r:(i.source=r.slice(0,l),i.ruleId=r.slice(l+1))}if(!i.place&&i.ancestors&&i.ancestors){const l=i.ancestors[i.ancestors.length-1];l&&(i.place=l.position)}const s=i.place&&"start"in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=s?s.column:void 0,this.fatal=void 0,this.file="",this.message=a,this.line=s?s.line:void 0,this.name=ua(i.place)||"1:1",this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=o&&i.cause&&typeof i.cause.stack=="string"?i.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}wt.prototype.file="";wt.prototype.name="";wt.prototype.reason="";wt.prototype.message="";wt.prototype.stack="";wt.prototype.column=void 0;wt.prototype.line=void 0;wt.prototype.ancestors=void 0;wt.prototype.cause=void 0;wt.prototype.fatal=void 0;wt.prototype.place=void 0;wt.prototype.ruleId=void 0;wt.prototype.source=void 0;const Ap={}.hasOwnProperty,cwe=new Map,uwe=/[A-Z]/g,dwe=new Set(["table","tbody","thead","tfoot","tr"]),pwe=new Set(["td","th"]),bv="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function hwe(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let r;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=_we(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=vwe(n,t.jsx,t.jsxs)}const a={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?vo:fv,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},i=kv(a,e,void 0);return i&&typeof i!="string"?i:a.create(e,a.Fragment,{children:i||void 0},void 0)}function kv(e,t,n){if(t.type==="element")return mwe(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return fwe(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return ywe(e,t,n);if(t.type==="mdxjsEsm")return gwe(e,t);if(t.type==="root")return bwe(e,t,n);if(t.type==="text")return kwe(e,t)}function mwe(e,t,n){const r=e.schema;let a=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(a=vo,e.schema=a),e.ancestors.push(t);const i=_v(e,t.tagName,!1),o=xwe(e,t);let s=Cp(e,t);return dwe.has(t.tagName)&&(s=s.filter(function(l){return typeof l=="string"?!Exe(l):!0})),vv(e,o,i,t),Tp(o,s),e.ancestors.pop(),e.schema=r,e.create(t,i,o,n)}function fwe(e,t){if(t.data&&t.data.estree&&e.evaluater){const r=t.data.estree.body[0];return r.type,e.evaluater.evaluateExpression(r.expression)}_a(e,t.position)}function gwe(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);_a(e,t.position)}function ywe(e,t,n){const r=e.schema;let a=r;t.name==="svg"&&r.space==="html"&&(a=vo,e.schema=a),e.ancestors.push(t);const i=t.name===null?e.Fragment:_v(e,t.name,!0),o=wwe(e,t),s=Cp(e,t);return vv(e,o,i,t),Tp(o,s),e.ancestors.pop(),e.schema=r,e.create(t,i,o,n)}function bwe(e,t,n){const r={};return Tp(r,Cp(e,t)),e.create(t,e.Fragment,r,n)}function kwe(e,t){return t.value}function vv(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function Tp(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function vwe(e,t,n){return r;function r(a,i,o,s){const u=Array.isArray(o.children)?n:t;return s?u(i,o,s):u(i,o)}}function _we(e,t){return n;function n(r,a,i,o){const s=Array.isArray(i.children),l=Np(r);return t(a,i,o,s,{columnNumber:l?l.column-1:void 0,fileName:e,lineNumber:l?l.line:void 0},void 0)}}function xwe(e,t){const n={};let r,a;for(a in t.properties)if(a!=="children"&&Ap.call(t.properties,a)){const i=Ewe(e,a,t.properties[a]);if(i){const[o,s]=i;e.tableCellAlignToStyle&&o==="align"&&typeof s=="string"&&pwe.has(t.tagName)?r=s:n[o]=s}}if(r){const i=n.style||(n.style={});i[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function wwe(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const i=r.data.estree.body[0];i.type;const o=i.expression;o.type;const s=o.properties[0];s.type,Object.assign(n,e.evaluater.evaluateExpression(s.argument))}else _a(e,t.position);else{const a=r.name;let i;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const s=r.value.data.estree.body[0];s.type,i=e.evaluater.evaluateExpression(s.expression)}else _a(e,t.position);else i=r.value===null?!0:r.value;n[a]=i}return n}function Cp(e,t){const n=[];let r=-1;const a=e.passKeys?new Map:cwe;for(;++r<t.children.length;){const i=t.children[r];let o;if(e.passKeys){const l=i.type==="element"?i.tagName:i.type==="mdxJsxFlowElement"||i.type==="mdxJsxTextElement"?i.name:void 0;if(l){const u=a.get(l)||0;o=l+"-"+u,a.set(l,u+1)}}const s=kv(e,i,o);s!==void 0&&n.push(s)}return n}function Ewe(e,t,n){const r=mv(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?kxe(n):Oxe(n)),r.property==="style"){let a=typeof n=="object"?n:Mwe(e,String(n));return e.stylePropertyNameCase==="css"&&(a=Swe(a)),["style",a]}return[e.elementAttributeNameCase==="react"&&r.space?Axe[r.property]||r.property:r.attribute,n]}}function Mwe(e,t){try{return swe(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const r=n,a=new wt("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw a.file=e.filePath||void 0,a.url=bv+"#cannot-parse-style-attribute",a}}function _v(e,t,n){let r;if(!n)r={type:"Literal",value:t};else if(t.includes(".")){const a=t.split(".");let i=-1,o;for(;++i<a.length;){const s=D2(a[i])?{type:"Identifier",name:a[i]}:{type:"Literal",value:a[i]};o=o?{type:"MemberExpression",object:o,property:s,computed:!!(i&&s.type==="Literal"),optional:!1}:s}r=o}else r=D2(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const a=r.value;return Ap.call(e.components,a)?e.components[a]:a}if(e.evaluater)return e.evaluater.evaluateExpression(r);_a(e)}function _a(e,t){const n=new wt("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=bv+"#cannot-handle-mdx-estrees-without-createevaluater",n}function Swe(e){const t={};let n;for(n in e)Ap.call(e,n)&&(t[Nwe(n)]=e[n]);return t}function Nwe(e){let t=e.replace(uwe,Awe);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function Awe(e){return"-"+e.toLowerCase()}const ps={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},Twe={};function Rp(e,t){const n=Twe,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,a=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return xv(e,r,a)}function xv(e,t,n){if(Cwe(e)){if("value"in e)return e.type==="html"&&!n?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return W2(e.children,t,n)}return Array.isArray(e)?W2(e,t,n):""}function W2(e,t,n){const r=[];let a=-1;for(;++a<e.length;)r[a]=xv(e[a],t,n);return r.join("")}function Cwe(e){return!!(e&&typeof e=="object")}const K2=document.createElement("i");function xa(e){const t="&"+e+";";K2.innerHTML=t;const n=K2.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function Gt(e,t,n,r){const a=e.length;let i=0,o;if(t<0?t=-t>a?0:a+t:t=t>a?a:t,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(t,n),e.splice(...o);else for(n&&e.splice(t,n);i<r.length;)o=r.slice(i,i+1e4),o.unshift(t,0),e.splice(...o),i+=1e4,t+=1e4}function Jt(e,t){return e.length>0?(Gt(e,e.length,0,t),e):t}const Y2={}.hasOwnProperty;function wv(e){const t={};let n=-1;for(;++n<e.length;)Rwe(t,e[n]);return t}function Rwe(e,t){let n;for(n in t){const a=(Y2.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n];let o;if(i)for(o in i){Y2.call(a,o)||(a[o]=[]);const s=i[o];Iwe(a[o],Array.isArray(s)?s:s?[s]:[])}}}function Iwe(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);Gt(e,0,0,r)}function Ev(e,t){const n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function dn(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const At=ar(/[A-Za-z]/),_t=ar(/[\dA-Za-z]/),Owe=ar(/[#-'*+\--9=?A-Z^-~]/);function qi(e){return e!==null&&(e<32||e===127)}const _d=ar(/\d/),Lwe=ar(/[\dA-Fa-f]/),Dwe=ar(/[!-/:-@[-`{-~]/);function he(e){return e!==null&&e<-2}function He(e){return e!==null&&(e<0||e===32)}function ze(e){return e===-2||e===-1||e===32}const er=ar(/\p{P}|\p{S}/u),hn=ar(/\s/);function ar(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function Wr(e){const t=[];let n=-1,r=0,a=0;for(;++n<e.length;){const i=e.charCodeAt(n);let o="";if(i===37&&_t(e.charCodeAt(n+1))&&_t(e.charCodeAt(n+2)))a=2;else if(i<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(i))||(o=String.fromCharCode(i));else if(i>55295&&i<57344){const s=e.charCodeAt(n+1);i<56320&&s>56319&&s<57344?(o=String.fromCharCode(i,s),a=1):o="�"}else o=String.fromCharCode(i);o&&(t.push(e.slice(r,n),encodeURIComponent(o)),r=n+a+1,o=""),a&&(n+=a,a=0)}return t.join("")+e.slice(r)}function Ae(e,t,n,r){const a=r?r-1:Number.POSITIVE_INFINITY;let i=0;return o;function o(l){return ze(l)?(e.enter(n),s(l)):t(l)}function s(l){return ze(l)&&i++<a?(e.consume(l),s):(e.exit(n),t(l))}}const zwe={tokenize:$we};function $we(e){const t=e.attempt(this.parser.constructs.contentInitial,r,a);let n;return t;function r(s){if(s===null){e.consume(s);return}return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),Ae(e,t,"linePrefix")}function a(s){return e.enter("paragraph"),i(s)}function i(s){const l=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=l),n=l,o(s)}function o(s){if(s===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(s);return}return he(s)?(e.consume(s),e.exit("chunkText"),i):(e.consume(s),o)}}const Fwe={tokenize:Pwe},Z2={tokenize:qwe};function Pwe(e){const t=this,n=[];let r=0,a,i,o;return s;function s(x){if(r<n.length){const M=n[r];return t.containerState=M[1],e.attempt(M[0].continuation,l,u)(x)}return u(x)}function l(x){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,a&&b();const M=t.events.length;let N=M,E;for(;N--;)if(t.events[N][0]==="exit"&&t.events[N][1].type==="chunkFlow"){E=t.events[N][1].end;break}k(r);let D=M;for(;D<t.events.length;)t.events[D][1].end={...E},D++;return Gt(t.events,N+1,0,t.events.slice(M)),t.events.length=D,u(x)}return s(x)}function u(x){if(r===n.length){if(!a)return h(x);if(a.currentConstruct&&a.currentConstruct.concrete)return f(x);t.interrupt=!!(a.currentConstruct&&!a._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(Z2,d,p)(x)}function d(x){return a&&b(),k(r),h(x)}function p(x){return t.parser.lazy[t.now().line]=r!==n.length,o=t.now().offset,f(x)}function h(x){return t.containerState={},e.attempt(Z2,m,f)(x)}function m(x){return r++,n.push([t.currentConstruct,t.containerState]),h(x)}function f(x){if(x===null){a&&b(),k(0),e.consume(x);return}return a=a||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:a,contentType:"flow",previous:i}),g(x)}function g(x){if(x===null){_(e.exit("chunkFlow"),!0),k(0),e.consume(x);return}return he(x)?(e.consume(x),_(e.exit("chunkFlow")),r=0,t.interrupt=void 0,s):(e.consume(x),g)}function _(x,M){const N=t.sliceStream(x);if(M&&N.push(null),x.previous=i,i&&(i.next=x),i=x,a.defineSkip(x.start),a.write(N),t.parser.lazy[x.start.line]){let E=a.events.length;for(;E--;)if(a.events[E][1].start.offset<o&&(!a.events[E][1].end||a.events[E][1].end.offset>o))return;const D=t.events.length;let P=D,C,I;for(;P--;)if(t.events[P][0]==="exit"&&t.events[P][1].type==="chunkFlow"){if(C){I=t.events[P][1].end;break}C=!0}for(k(r),E=D;E<t.events.length;)t.events[E][1].end={...I},E++;Gt(t.events,P+1,0,t.events.slice(D)),t.events.length=E}}function k(x){let M=n.length;for(;M-- >x;){const N=n[M];t.containerState=N[1],N[0].exit.call(t,e)}n.length=x}function b(){a.write([null]),i=void 0,a=void 0,t.containerState._closeFlow=void 0}}function qwe(e,t,n){return Ae(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function qr(e){if(e===null||He(e)||hn(e))return 1;if(er(e))return 2}function wo(e,t,n){const r=[];let a=-1;for(;++a<e.length;){const i=e[a].resolveAll;i&&!r.includes(i)&&(t=i(t,n),r.push(i))}return t}const xd={name:"attention",resolveAll:Bwe,tokenize:Uwe};function Bwe(e,t){let n=-1,r,a,i,o,s,l,u,d;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(r=n;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;l=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const p={...e[r][1].end},h={...e[n][1].start};X2(p,-l),X2(h,l),o={type:l>1?"strongSequence":"emphasisSequence",start:p,end:{...e[r][1].end}},s={type:l>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:h},i={type:l>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},a={type:l>1?"strong":"emphasis",start:{...o.start},end:{...s.end}},e[r][1].end={...o.start},e[n][1].start={...s.end},u=[],e[r][1].end.offset-e[r][1].start.offset&&(u=Jt(u,[["enter",e[r][1],t],["exit",e[r][1],t]])),u=Jt(u,[["enter",a,t],["enter",o,t],["exit",o,t],["enter",i,t]]),u=Jt(u,wo(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),u=Jt(u,[["exit",i,t],["enter",s,t],["exit",s,t],["exit",a,t]]),e[n][1].end.offset-e[n][1].start.offset?(d=2,u=Jt(u,[["enter",e[n][1],t],["exit",e[n][1],t]])):d=0,Gt(e,r-1,n-r+3,u),n=r+u.length-d-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function Uwe(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,a=qr(r);let i;return o;function o(l){return i=l,e.enter("attentionSequence"),s(l)}function s(l){if(l===i)return e.consume(l),s;const u=e.exit("attentionSequence"),d=qr(l),p=!d||d===2&&a||n.includes(l),h=!a||a===2&&d||n.includes(r);return u._open=!!(i===42?p:p&&(a||!h)),u._close=!!(i===42?h:h&&(d||!p)),t(l)}}function X2(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const Hwe={name:"autolink",tokenize:jwe};function jwe(e,t,n){let r=0;return a;function a(m){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(m),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),i}function i(m){return At(m)?(e.consume(m),o):m===64?n(m):u(m)}function o(m){return m===43||m===45||m===46||_t(m)?(r=1,s(m)):u(m)}function s(m){return m===58?(e.consume(m),r=0,l):(m===43||m===45||m===46||_t(m))&&r++<32?(e.consume(m),s):(r=0,u(m))}function l(m){return m===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(m),e.exit("autolinkMarker"),e.exit("autolink"),t):m===null||m===32||m===60||qi(m)?n(m):(e.consume(m),l)}function u(m){return m===64?(e.consume(m),d):Owe(m)?(e.consume(m),u):n(m)}function d(m){return _t(m)?p(m):n(m)}function p(m){return m===46?(e.consume(m),r=0,d):m===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(m),e.exit("autolinkMarker"),e.exit("autolink"),t):h(m)}function h(m){if((m===45||_t(m))&&r++<63){const f=m===45?h:p;return e.consume(m),f}return n(m)}}const Da={partial:!0,tokenize:Vwe};function Vwe(e,t,n){return r;function r(i){return ze(i)?Ae(e,a,"linePrefix")(i):a(i)}function a(i){return i===null||he(i)?t(i):n(i)}}const Mv={continuation:{tokenize:Wwe},exit:Kwe,name:"blockQuote",tokenize:Gwe};function Gwe(e,t,n){const r=this;return a;function a(o){if(o===62){const s=r.containerState;return s.open||(e.enter("blockQuote",{_container:!0}),s.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(o),e.exit("blockQuoteMarker"),i}return n(o)}function i(o){return ze(o)?(e.enter("blockQuotePrefixWhitespace"),e.consume(o),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(o))}}function Wwe(e,t,n){const r=this;return a;function a(o){return ze(o)?Ae(e,i,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o):i(o)}function i(o){return e.attempt(Mv,t,n)(o)}}function Kwe(e){e.exit("blockQuote")}const Sv={name:"characterEscape",tokenize:Ywe};function Ywe(e,t,n){return r;function r(i){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(i),e.exit("escapeMarker"),a}function a(i){return Dwe(i)?(e.enter("characterEscapeValue"),e.consume(i),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(i)}}const Nv={name:"characterReference",tokenize:Zwe};function Zwe(e,t,n){const r=this;let a=0,i,o;return s;function s(p){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(p),e.exit("characterReferenceMarker"),l}function l(p){return p===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(p),e.exit("characterReferenceMarkerNumeric"),u):(e.enter("characterReferenceValue"),i=31,o=_t,d(p))}function u(p){return p===88||p===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(p),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),i=6,o=Lwe,d):(e.enter("characterReferenceValue"),i=7,o=_d,d(p))}function d(p){if(p===59&&a){const h=e.exit("characterReferenceValue");return o===_t&&!xa(r.sliceSerialize(h))?n(p):(e.enter("characterReferenceMarker"),e.consume(p),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return o(p)&&a++<i?(e.consume(p),d):n(p)}}const Q2={partial:!0,tokenize:Qwe},J2={concrete:!0,name:"codeFenced",tokenize:Xwe};function Xwe(e,t,n){const r=this,a={partial:!0,tokenize:N};let i=0,o=0,s;return l;function l(E){return u(E)}function u(E){const D=r.events[r.events.length-1];return i=D&&D[1].type==="linePrefix"?D[2].sliceSerialize(D[1],!0).length:0,s=E,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),d(E)}function d(E){return E===s?(o++,e.consume(E),d):o<3?n(E):(e.exit("codeFencedFenceSequence"),ze(E)?Ae(e,p,"whitespace")(E):p(E))}function p(E){return E===null||he(E)?(e.exit("codeFencedFence"),r.interrupt?t(E):e.check(Q2,g,M)(E)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),h(E))}function h(E){return E===null||he(E)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),p(E)):ze(E)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Ae(e,m,"whitespace")(E)):E===96&&E===s?n(E):(e.consume(E),h)}function m(E){return E===null||he(E)?p(E):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),f(E))}function f(E){return E===null||he(E)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),p(E)):E===96&&E===s?n(E):(e.consume(E),f)}function g(E){return e.attempt(a,M,_)(E)}function _(E){return e.enter("lineEnding"),e.consume(E),e.exit("lineEnding"),k}function k(E){return i>0&&ze(E)?Ae(e,b,"linePrefix",i+1)(E):b(E)}function b(E){return E===null||he(E)?e.check(Q2,g,M)(E):(e.enter("codeFlowValue"),x(E))}function x(E){return E===null||he(E)?(e.exit("codeFlowValue"),b(E)):(e.consume(E),x)}function M(E){return e.exit("codeFenced"),t(E)}function N(E,D,P){let C=0;return I;function I(R){return E.enter("lineEnding"),E.consume(R),E.exit("lineEnding"),q}function q(R){return E.enter("codeFencedFence"),ze(R)?Ae(E,Z,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(R):Z(R)}function Z(R){return R===s?(E.enter("codeFencedFenceSequence"),X(R)):P(R)}function X(R){return R===s?(C++,E.consume(R),X):C>=o?(E.exit("codeFencedFenceSequence"),ze(R)?Ae(E,K,"whitespace")(R):K(R)):P(R)}function K(R){return R===null||he(R)?(E.exit("codeFencedFence"),D(R)):P(R)}}}function Qwe(e,t,n){const r=this;return a;function a(o){return o===null?n(o):(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),i)}function i(o){return r.parser.lazy[r.now().line]?n(o):t(o)}}const hs={name:"codeIndented",tokenize:e9e},Jwe={partial:!0,tokenize:t9e};function e9e(e,t,n){const r=this;return a;function a(u){return e.enter("codeIndented"),Ae(e,i,"linePrefix",5)(u)}function i(u){const d=r.events[r.events.length-1];return d&&d[1].type==="linePrefix"&&d[2].sliceSerialize(d[1],!0).length>=4?o(u):n(u)}function o(u){return u===null?l(u):he(u)?e.attempt(Jwe,o,l)(u):(e.enter("codeFlowValue"),s(u))}function s(u){return u===null||he(u)?(e.exit("codeFlowValue"),o(u)):(e.consume(u),s)}function l(u){return e.exit("codeIndented"),t(u)}}function t9e(e,t,n){const r=this;return a;function a(o){return r.parser.lazy[r.now().line]?n(o):he(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),a):Ae(e,i,"linePrefix",5)(o)}function i(o){const s=r.events[r.events.length-1];return s&&s[1].type==="linePrefix"&&s[2].sliceSerialize(s[1],!0).length>=4?t(o):he(o)?a(o):n(o)}}const n9e={name:"codeText",previous:a9e,resolve:r9e,tokenize:i9e};function r9e(e){let t=e.length-4,n=3,r,a;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(r=n;++r<t;)if(e[r][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)a===void 0?r!==t&&e[r][1].type!=="lineEnding"&&(a=r):(r===t||e[r][1].type==="lineEnding")&&(e[a][1].type="codeTextData",r!==a+2&&(e[a][1].end=e[r-1][1].end,e.splice(a+2,r-a-2),t-=r-a-2,r=a+2),a=void 0);return e}function a9e(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function i9e(e,t,n){let r=0,a,i;return o;function o(p){return e.enter("codeText"),e.enter("codeTextSequence"),s(p)}function s(p){return p===96?(e.consume(p),r++,s):(e.exit("codeTextSequence"),l(p))}function l(p){return p===null?n(p):p===32?(e.enter("space"),e.consume(p),e.exit("space"),l):p===96?(i=e.enter("codeTextSequence"),a=0,d(p)):he(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),l):(e.enter("codeTextData"),u(p))}function u(p){return p===null||p===32||p===96||he(p)?(e.exit("codeTextData"),l(p)):(e.consume(p),u)}function d(p){return p===96?(e.consume(p),a++,d):a===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(p)):(i.type="codeTextData",u(p))}}class o9e{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const r=n??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(t,r):t>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,n,r){const a=n||0;this.setCursor(Math.trunc(t));const i=this.right.splice(this.right.length-a,Number.POSITIVE_INFINITY);return r&&Jr(this.left,r),i.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),Jr(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Jr(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const n=this.left.splice(t,Number.POSITIVE_INFINITY);Jr(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Jr(this.left,n.reverse())}}}function Jr(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function Av(e){const t={};let n=-1,r,a,i,o,s,l,u;const d=new o9e(e);for(;++n<d.length;){for(;n in t;)n=t[n];if(r=d.get(n),n&&r[1].type==="chunkFlow"&&d.get(n-1)[1].type==="listItemPrefix"&&(l=r[1]._tokenizer.events,i=0,i<l.length&&l[i][1].type==="lineEndingBlank"&&(i+=2),i<l.length&&l[i][1].type==="content"))for(;++i<l.length&&l[i][1].type!=="content";)l[i][1].type==="chunkText"&&(l[i][1]._isInFirstContentOfListItem=!0,i++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,s9e(d,n)),n=t[n],u=!0);else if(r[1]._container){for(i=n,a=void 0;i--;)if(o=d.get(i),o[1].type==="lineEnding"||o[1].type==="lineEndingBlank")o[0]==="enter"&&(a&&(d.get(a)[1].type="lineEndingBlank"),o[1].type="lineEnding",a=i);else if(!(o[1].type==="linePrefix"||o[1].type==="listItemIndent"))break;a&&(r[1].end={...d.get(a)[1].start},s=d.slice(a,n),s.unshift(r),d.splice(a,n-a+1,s))}}return Gt(e,0,Number.POSITIVE_INFINITY,d.slice(0)),!u}function s9e(e,t){const n=e.get(t)[1],r=e.get(t)[2];let a=t-1;const i=[];let o=n._tokenizer;o||(o=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));const s=o.events,l=[],u={};let d,p,h=-1,m=n,f=0,g=0;const _=[g];for(;m;){for(;e.get(++a)[1]!==m;);i.push(a),m._tokenizer||(d=r.sliceStream(m),m.next||d.push(null),p&&o.defineSkip(m.start),m._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(d),m._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),p=m,m=m.next}for(m=n;++h<s.length;)s[h][0]==="exit"&&s[h-1][0]==="enter"&&s[h][1].type===s[h-1][1].type&&s[h][1].start.line!==s[h][1].end.line&&(g=h+1,_.push(g),m._tokenizer=void 0,m.previous=void 0,m=m.next);for(o.events=[],m?(m._tokenizer=void 0,m.previous=void 0):_.pop(),h=_.length;h--;){const k=s.slice(_[h],_[h+1]),b=i.pop();l.push([b,b+k.length-1]),e.splice(b,2,k)}for(l.reverse(),h=-1;++h<l.length;)u[f+l[h][0]]=f+l[h][1],f+=l[h][1]-l[h][0]-1;return u}const l9e={resolve:u9e,tokenize:d9e},c9e={partial:!0,tokenize:p9e};function u9e(e){return Av(e),e}function d9e(e,t){let n;return r;function r(s){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),a(s)}function a(s){return s===null?i(s):he(s)?e.check(c9e,o,i)(s):(e.consume(s),a)}function i(s){return e.exit("chunkContent"),e.exit("content"),t(s)}function o(s){return e.consume(s),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,a}}function p9e(e,t,n){const r=this;return a;function a(o){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),Ae(e,i,"linePrefix")}function i(o){if(o===null||he(o))return n(o);const s=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&s&&s[1].type==="linePrefix"&&s[2].sliceSerialize(s[1],!0).length>=4?t(o):e.interrupt(r.parser.constructs.flow,n,t)(o)}}function Tv(e,t,n,r,a,i,o,s,l){const u=l||Number.POSITIVE_INFINITY;let d=0;return p;function p(k){return k===60?(e.enter(r),e.enter(a),e.enter(i),e.consume(k),e.exit(i),h):k===null||k===32||k===41||qi(k)?n(k):(e.enter(r),e.enter(o),e.enter(s),e.enter("chunkString",{contentType:"string"}),g(k))}function h(k){return k===62?(e.enter(i),e.consume(k),e.exit(i),e.exit(a),e.exit(r),t):(e.enter(s),e.enter("chunkString",{contentType:"string"}),m(k))}function m(k){return k===62?(e.exit("chunkString"),e.exit(s),h(k)):k===null||k===60||he(k)?n(k):(e.consume(k),k===92?f:m)}function f(k){return k===60||k===62||k===92?(e.consume(k),m):m(k)}function g(k){return!d&&(k===null||k===41||He(k))?(e.exit("chunkString"),e.exit(s),e.exit(o),e.exit(r),t(k)):d<u&&k===40?(e.consume(k),d++,g):k===41?(e.consume(k),d--,g):k===null||k===32||k===40||qi(k)?n(k):(e.consume(k),k===92?_:g)}function _(k){return k===40||k===41||k===92?(e.consume(k),g):g(k)}}function Cv(e,t,n,r,a,i){const o=this;let s=0,l;return u;function u(m){return e.enter(r),e.enter(a),e.consume(m),e.exit(a),e.enter(i),d}function d(m){return s>999||m===null||m===91||m===93&&!l||m===94&&!s&&"_hiddenFootnoteSupport"in o.parser.constructs?n(m):m===93?(e.exit(i),e.enter(a),e.consume(m),e.exit(a),e.exit(r),t):he(m)?(e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),d):(e.enter("chunkString",{contentType:"string"}),p(m))}function p(m){return m===null||m===91||m===93||he(m)||s++>999?(e.exit("chunkString"),d(m)):(e.consume(m),l||(l=!ze(m)),m===92?h:p)}function h(m){return m===91||m===92||m===93?(e.consume(m),s++,p):p(m)}}function Rv(e,t,n,r,a,i){let o;return s;function s(h){return h===34||h===39||h===40?(e.enter(r),e.enter(a),e.consume(h),e.exit(a),o=h===40?41:h,l):n(h)}function l(h){return h===o?(e.enter(a),e.consume(h),e.exit(a),e.exit(r),t):(e.enter(i),u(h))}function u(h){return h===o?(e.exit(i),l(o)):h===null?n(h):he(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),Ae(e,u,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),d(h))}function d(h){return h===o||h===null||he(h)?(e.exit("chunkString"),u(h)):(e.consume(h),h===92?p:d)}function p(h){return h===o||h===92?(e.consume(h),d):d(h)}}function Cn(e,t){let n;return r;function r(a){return he(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),n=!0,r):ze(a)?Ae(e,r,n?"linePrefix":"lineSuffix")(a):t(a)}}const h9e={name:"definition",tokenize:f9e},m9e={partial:!0,tokenize:g9e};function f9e(e,t,n){const r=this;let a;return i;function i(m){return e.enter("definition"),o(m)}function o(m){return Cv.call(r,e,s,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(m)}function s(m){return a=dn(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),m===58?(e.enter("definitionMarker"),e.consume(m),e.exit("definitionMarker"),l):n(m)}function l(m){return He(m)?Cn(e,u)(m):u(m)}function u(m){return Tv(e,d,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(m)}function d(m){return e.attempt(m9e,p,p)(m)}function p(m){return ze(m)?Ae(e,h,"whitespace")(m):h(m)}function h(m){return m===null||he(m)?(e.exit("definition"),r.parser.defined.push(a),t(m)):n(m)}}function g9e(e,t,n){return r;function r(s){return He(s)?Cn(e,a)(s):n(s)}function a(s){return Rv(e,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(s)}function i(s){return ze(s)?Ae(e,o,"whitespace")(s):o(s)}function o(s){return s===null||he(s)?t(s):n(s)}}const y9e={name:"hardBreakEscape",tokenize:b9e};function b9e(e,t,n){return r;function r(i){return e.enter("hardBreakEscape"),e.consume(i),a}function a(i){return he(i)?(e.exit("hardBreakEscape"),t(i)):n(i)}}const k9e={name:"headingAtx",resolve:v9e,tokenize:_9e};function v9e(e,t){let n=e.length-2,r=3,a,i;return e[r][1].type==="whitespace"&&(r+=2),n-2>r&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&e[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(a={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},i={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},Gt(e,r,n-r+1,[["enter",a,t],["enter",i,t],["exit",i,t],["exit",a,t]])),e}function _9e(e,t,n){let r=0;return a;function a(d){return e.enter("atxHeading"),i(d)}function i(d){return e.enter("atxHeadingSequence"),o(d)}function o(d){return d===35&&r++<6?(e.consume(d),o):d===null||He(d)?(e.exit("atxHeadingSequence"),s(d)):n(d)}function s(d){return d===35?(e.enter("atxHeadingSequence"),l(d)):d===null||he(d)?(e.exit("atxHeading"),t(d)):ze(d)?Ae(e,s,"whitespace")(d):(e.enter("atxHeadingText"),u(d))}function l(d){return d===35?(e.consume(d),l):(e.exit("atxHeadingSequence"),s(d))}function u(d){return d===null||d===35||He(d)?(e.exit("atxHeadingText"),s(d)):(e.consume(d),u)}}const x9e=["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"],em=["pre","script","style","textarea"],w9e={concrete:!0,name:"htmlFlow",resolveTo:S9e,tokenize:N9e},E9e={partial:!0,tokenize:T9e},M9e={partial:!0,tokenize:A9e};function S9e(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function N9e(e,t,n){const r=this;let a,i,o,s,l;return u;function u(L){return d(L)}function d(L){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(L),p}function p(L){return L===33?(e.consume(L),h):L===47?(e.consume(L),i=!0,g):L===63?(e.consume(L),a=3,r.interrupt?t:A):At(L)?(e.consume(L),o=String.fromCharCode(L),_):n(L)}function h(L){return L===45?(e.consume(L),a=2,m):L===91?(e.consume(L),a=5,s=0,f):At(L)?(e.consume(L),a=4,r.interrupt?t:A):n(L)}function m(L){return L===45?(e.consume(L),r.interrupt?t:A):n(L)}function f(L){const se="CDATA[";return L===se.charCodeAt(s++)?(e.consume(L),s===se.length?r.interrupt?t:Z:f):n(L)}function g(L){return At(L)?(e.consume(L),o=String.fromCharCode(L),_):n(L)}function _(L){if(L===null||L===47||L===62||He(L)){const se=L===47,ye=o.toLowerCase();return!se&&!i&&em.includes(ye)?(a=1,r.interrupt?t(L):Z(L)):x9e.includes(o.toLowerCase())?(a=6,se?(e.consume(L),k):r.interrupt?t(L):Z(L)):(a=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(L):i?b(L):x(L))}return L===45||_t(L)?(e.consume(L),o+=String.fromCharCode(L),_):n(L)}function k(L){return L===62?(e.consume(L),r.interrupt?t:Z):n(L)}function b(L){return ze(L)?(e.consume(L),b):I(L)}function x(L){return L===47?(e.consume(L),I):L===58||L===95||At(L)?(e.consume(L),M):ze(L)?(e.consume(L),x):I(L)}function M(L){return L===45||L===46||L===58||L===95||_t(L)?(e.consume(L),M):N(L)}function N(L){return L===61?(e.consume(L),E):ze(L)?(e.consume(L),N):x(L)}function E(L){return L===null||L===60||L===61||L===62||L===96?n(L):L===34||L===39?(e.consume(L),l=L,D):ze(L)?(e.consume(L),E):P(L)}function D(L){return L===l?(e.consume(L),l=null,C):L===null||he(L)?n(L):(e.consume(L),D)}function P(L){return L===null||L===34||L===39||L===47||L===60||L===61||L===62||L===96||He(L)?N(L):(e.consume(L),P)}function C(L){return L===47||L===62||ze(L)?x(L):n(L)}function I(L){return L===62?(e.consume(L),q):n(L)}function q(L){return L===null||he(L)?Z(L):ze(L)?(e.consume(L),q):n(L)}function Z(L){return L===45&&a===2?(e.consume(L),H):L===60&&a===1?(e.consume(L),G):L===62&&a===4?(e.consume(L),Y):L===63&&a===3?(e.consume(L),A):L===93&&a===5?(e.consume(L),V):he(L)&&(a===6||a===7)?(e.exit("htmlFlowData"),e.check(E9e,ee,X)(L)):L===null||he(L)?(e.exit("htmlFlowData"),X(L)):(e.consume(L),Z)}function X(L){return e.check(M9e,K,ee)(L)}function K(L){return e.enter("lineEnding"),e.consume(L),e.exit("lineEnding"),R}function R(L){return L===null||he(L)?X(L):(e.enter("htmlFlowData"),Z(L))}function H(L){return L===45?(e.consume(L),A):Z(L)}function G(L){return L===47?(e.consume(L),o="",z):Z(L)}function z(L){if(L===62){const se=o.toLowerCase();return em.includes(se)?(e.consume(L),Y):Z(L)}return At(L)&&o.length<8?(e.consume(L),o+=String.fromCharCode(L),z):Z(L)}function V(L){return L===93?(e.consume(L),A):Z(L)}function A(L){return L===62?(e.consume(L),Y):L===45&&a===2?(e.consume(L),A):Z(L)}function Y(L){return L===null||he(L)?(e.exit("htmlFlowData"),ee(L)):(e.consume(L),Y)}function ee(L){return e.exit("htmlFlow"),t(L)}}function A9e(e,t,n){const r=this;return a;function a(o){return he(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),i):n(o)}function i(o){return r.parser.lazy[r.now().line]?n(o):t(o)}}function T9e(e,t,n){return r;function r(a){return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),e.attempt(Da,t,n)}}const C9e={name:"htmlText",tokenize:R9e};function R9e(e,t,n){const r=this;let a,i,o;return s;function s(A){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(A),l}function l(A){return A===33?(e.consume(A),u):A===47?(e.consume(A),N):A===63?(e.consume(A),x):At(A)?(e.consume(A),P):n(A)}function u(A){return A===45?(e.consume(A),d):A===91?(e.consume(A),i=0,f):At(A)?(e.consume(A),b):n(A)}function d(A){return A===45?(e.consume(A),m):n(A)}function p(A){return A===null?n(A):A===45?(e.consume(A),h):he(A)?(o=p,G(A)):(e.consume(A),p)}function h(A){return A===45?(e.consume(A),m):p(A)}function m(A){return A===62?H(A):A===45?h(A):p(A)}function f(A){const Y="CDATA[";return A===Y.charCodeAt(i++)?(e.consume(A),i===Y.length?g:f):n(A)}function g(A){return A===null?n(A):A===93?(e.consume(A),_):he(A)?(o=g,G(A)):(e.consume(A),g)}function _(A){return A===93?(e.consume(A),k):g(A)}function k(A){return A===62?H(A):A===93?(e.consume(A),k):g(A)}function b(A){return A===null||A===62?H(A):he(A)?(o=b,G(A)):(e.consume(A),b)}function x(A){return A===null?n(A):A===63?(e.consume(A),M):he(A)?(o=x,G(A)):(e.consume(A),x)}function M(A){return A===62?H(A):x(A)}function N(A){return At(A)?(e.consume(A),E):n(A)}function E(A){return A===45||_t(A)?(e.consume(A),E):D(A)}function D(A){return he(A)?(o=D,G(A)):ze(A)?(e.consume(A),D):H(A)}function P(A){return A===45||_t(A)?(e.consume(A),P):A===47||A===62||He(A)?C(A):n(A)}function C(A){return A===47?(e.consume(A),H):A===58||A===95||At(A)?(e.consume(A),I):he(A)?(o=C,G(A)):ze(A)?(e.consume(A),C):H(A)}function I(A){return A===45||A===46||A===58||A===95||_t(A)?(e.consume(A),I):q(A)}function q(A){return A===61?(e.consume(A),Z):he(A)?(o=q,G(A)):ze(A)?(e.consume(A),q):C(A)}function Z(A){return A===null||A===60||A===61||A===62||A===96?n(A):A===34||A===39?(e.consume(A),a=A,X):he(A)?(o=Z,G(A)):ze(A)?(e.consume(A),Z):(e.consume(A),K)}function X(A){return A===a?(e.consume(A),a=void 0,R):A===null?n(A):he(A)?(o=X,G(A)):(e.consume(A),X)}function K(A){return A===null||A===34||A===39||A===60||A===61||A===96?n(A):A===47||A===62||He(A)?C(A):(e.consume(A),K)}function R(A){return A===47||A===62||He(A)?C(A):n(A)}function H(A){return A===62?(e.consume(A),e.exit("htmlTextData"),e.exit("htmlText"),t):n(A)}function G(A){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(A),e.exit("lineEnding"),z}function z(A){return ze(A)?Ae(e,V,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(A):V(A)}function V(A){return e.enter("htmlTextData"),o(A)}}const Ip={name:"labelEnd",resolveAll:D9e,resolveTo:z9e,tokenize:$9e},I9e={tokenize:F9e},O9e={tokenize:P9e},L9e={tokenize:q9e};function D9e(e){let t=-1;const n=[];for(;++t<e.length;){const r=e[t][1];if(n.push(e[t]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){const a=r.type==="labelImage"?4:2;r.type="data",t+=a}}return e.length!==n.length&&Gt(e,0,e.length,n),e}function z9e(e,t){let n=e.length,r=0,a,i,o,s;for(;n--;)if(a=e[n][1],i){if(a.type==="link"||a.type==="labelLink"&&a._inactive)break;e[n][0]==="enter"&&a.type==="labelLink"&&(a._inactive=!0)}else if(o){if(e[n][0]==="enter"&&(a.type==="labelImage"||a.type==="labelLink")&&!a._balanced&&(i=n,a.type!=="labelLink")){r=2;break}}else a.type==="labelEnd"&&(o=n);const l={type:e[i][1].type==="labelLink"?"link":"image",start:{...e[i][1].start},end:{...e[e.length-1][1].end}},u={type:"label",start:{...e[i][1].start},end:{...e[o][1].end}},d={type:"labelText",start:{...e[i+r+2][1].end},end:{...e[o-2][1].start}};return s=[["enter",l,t],["enter",u,t]],s=Jt(s,e.slice(i+1,i+r+3)),s=Jt(s,[["enter",d,t]]),s=Jt(s,wo(t.parser.constructs.insideSpan.null,e.slice(i+r+4,o-3),t)),s=Jt(s,[["exit",d,t],e[o-2],e[o-1],["exit",u,t]]),s=Jt(s,e.slice(o+1)),s=Jt(s,[["exit",l,t]]),Gt(e,i,e.length,s),e}function $9e(e,t,n){const r=this;let a=r.events.length,i,o;for(;a--;)if((r.events[a][1].type==="labelImage"||r.events[a][1].type==="labelLink")&&!r.events[a][1]._balanced){i=r.events[a][1];break}return s;function s(h){return i?i._inactive?p(h):(o=r.parser.defined.includes(dn(r.sliceSerialize({start:i.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(h),e.exit("labelMarker"),e.exit("labelEnd"),l):n(h)}function l(h){return h===40?e.attempt(I9e,d,o?d:p)(h):h===91?e.attempt(O9e,d,o?u:p)(h):o?d(h):p(h)}function u(h){return e.attempt(L9e,d,p)(h)}function d(h){return t(h)}function p(h){return i._balanced=!0,n(h)}}function F9e(e,t,n){return r;function r(p){return e.enter("resource"),e.enter("resourceMarker"),e.consume(p),e.exit("resourceMarker"),a}function a(p){return He(p)?Cn(e,i)(p):i(p)}function i(p){return p===41?d(p):Tv(e,o,s,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(p)}function o(p){return He(p)?Cn(e,l)(p):d(p)}function s(p){return n(p)}function l(p){return p===34||p===39||p===40?Rv(e,u,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(p):d(p)}function u(p){return He(p)?Cn(e,d)(p):d(p)}function d(p){return p===41?(e.enter("resourceMarker"),e.consume(p),e.exit("resourceMarker"),e.exit("resource"),t):n(p)}}function P9e(e,t,n){const r=this;return a;function a(s){return Cv.call(r,e,i,o,"reference","referenceMarker","referenceString")(s)}function i(s){return r.parser.defined.includes(dn(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(s):n(s)}function o(s){return n(s)}}function q9e(e,t,n){return r;function r(i){return e.enter("reference"),e.enter("referenceMarker"),e.consume(i),e.exit("referenceMarker"),a}function a(i){return i===93?(e.enter("referenceMarker"),e.consume(i),e.exit("referenceMarker"),e.exit("reference"),t):n(i)}}const B9e={name:"labelStartImage",resolveAll:Ip.resolveAll,tokenize:U9e};function U9e(e,t,n){const r=this;return a;function a(s){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(s),e.exit("labelImageMarker"),i}function i(s){return s===91?(e.enter("labelMarker"),e.consume(s),e.exit("labelMarker"),e.exit("labelImage"),o):n(s)}function o(s){return s===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(s):t(s)}}const H9e={name:"labelStartLink",resolveAll:Ip.resolveAll,tokenize:j9e};function j9e(e,t,n){const r=this;return a;function a(o){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(o),e.exit("labelMarker"),e.exit("labelLink"),i}function i(o){return o===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(o):t(o)}}const ms={name:"lineEnding",tokenize:V9e};function V9e(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),Ae(e,t,"linePrefix")}}const Mi={name:"thematicBreak",tokenize:G9e};function G9e(e,t,n){let r=0,a;return i;function i(u){return e.enter("thematicBreak"),o(u)}function o(u){return a=u,s(u)}function s(u){return u===a?(e.enter("thematicBreakSequence"),l(u)):r>=3&&(u===null||he(u))?(e.exit("thematicBreak"),t(u)):n(u)}function l(u){return u===a?(e.consume(u),r++,l):(e.exit("thematicBreakSequence"),ze(u)?Ae(e,s,"whitespace")(u):s(u))}}const Dt={continuation:{tokenize:Z9e},exit:Q9e,name:"list",tokenize:Y9e},W9e={partial:!0,tokenize:J9e},K9e={partial:!0,tokenize:X9e};function Y9e(e,t,n){const r=this,a=r.events[r.events.length-1];let i=a&&a[1].type==="linePrefix"?a[2].sliceSerialize(a[1],!0).length:0,o=0;return s;function s(m){const f=r.containerState.type||(m===42||m===43||m===45?"listUnordered":"listOrdered");if(f==="listUnordered"?!r.containerState.marker||m===r.containerState.marker:_d(m)){if(r.containerState.type||(r.containerState.type=f,e.enter(f,{_container:!0})),f==="listUnordered")return e.enter("listItemPrefix"),m===42||m===45?e.check(Mi,n,u)(m):u(m);if(!r.interrupt||m===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),l(m)}return n(m)}function l(m){return _d(m)&&++o<10?(e.consume(m),l):(!r.interrupt||o<2)&&(r.containerState.marker?m===r.containerState.marker:m===41||m===46)?(e.exit("listItemValue"),u(m)):n(m)}function u(m){return e.enter("listItemMarker"),e.consume(m),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||m,e.check(Da,r.interrupt?n:d,e.attempt(W9e,h,p))}function d(m){return r.containerState.initialBlankLine=!0,i++,h(m)}function p(m){return ze(m)?(e.enter("listItemPrefixWhitespace"),e.consume(m),e.exit("listItemPrefixWhitespace"),h):n(m)}function h(m){return r.containerState.size=i+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(m)}}function Z9e(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(Da,a,i);function a(s){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Ae(e,t,"listItemIndent",r.containerState.size+1)(s)}function i(s){return r.containerState.furtherBlankLines||!ze(s)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(s)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(K9e,t,o)(s))}function o(s){return r.containerState._closeFlow=!0,r.interrupt=void 0,Ae(e,e.attempt(Dt,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(s)}}function X9e(e,t,n){const r=this;return Ae(e,a,"listItemIndent",r.containerState.size+1);function a(i){const o=r.events[r.events.length-1];return o&&o[1].type==="listItemIndent"&&o[2].sliceSerialize(o[1],!0).length===r.containerState.size?t(i):n(i)}}function Q9e(e){e.exit(this.containerState.type)}function J9e(e,t,n){const r=this;return Ae(e,a,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function a(i){const o=r.events[r.events.length-1];return!ze(i)&&o&&o[1].type==="listItemPrefixWhitespace"?t(i):n(i)}}const tm={name:"setextUnderline",resolveTo:eEe,tokenize:tEe};function eEe(e,t){let n=e.length,r,a,i;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(a=n)}else e[n][1].type==="content"&&e.splice(n,1),!i&&e[n][1].type==="definition"&&(i=n);const o={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[a][1].type="setextHeadingText",i?(e.splice(a,0,["enter",o,t]),e.splice(i+1,0,["exit",e[r][1],t]),e[r][1].end={...e[i][1].end}):e[r][1]=o,e.push(["exit",o,t]),e}function tEe(e,t,n){const r=this;let a;return i;function i(u){let d=r.events.length,p;for(;d--;)if(r.events[d][1].type!=="lineEnding"&&r.events[d][1].type!=="linePrefix"&&r.events[d][1].type!=="content"){p=r.events[d][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||p)?(e.enter("setextHeadingLine"),a=u,o(u)):n(u)}function o(u){return e.enter("setextHeadingLineSequence"),s(u)}function s(u){return u===a?(e.consume(u),s):(e.exit("setextHeadingLineSequence"),ze(u)?Ae(e,l,"lineSuffix")(u):l(u))}function l(u){return u===null||he(u)?(e.exit("setextHeadingLine"),t(u)):n(u)}}const nEe={tokenize:rEe};function rEe(e){const t=this,n=e.attempt(Da,r,e.attempt(this.parser.constructs.flowInitial,a,Ae(e,e.attempt(this.parser.constructs.flow,a,e.attempt(l9e,a)),"linePrefix")));return n;function r(i){if(i===null){e.consume(i);return}return e.enter("lineEndingBlank"),e.consume(i),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function a(i){if(i===null){e.consume(i);return}return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const aEe={resolveAll:Ov()},iEe=Iv("string"),oEe=Iv("text");function Iv(e){return{resolveAll:Ov(e==="text"?sEe:void 0),tokenize:t};function t(n){const r=this,a=this.parser.constructs[e],i=n.attempt(a,o,s);return o;function o(d){return u(d)?i(d):s(d)}function s(d){if(d===null){n.consume(d);return}return n.enter("data"),n.consume(d),l}function l(d){return u(d)?(n.exit("data"),i(d)):(n.consume(d),l)}function u(d){if(d===null)return!0;const p=a[d];let h=-1;if(p)for(;++h<p.length;){const m=p[h];if(!m.previous||m.previous.call(r,r.previous))return!0}return!1}}}function Ov(e){return t;function t(n,r){let a=-1,i;for(;++a<=n.length;)i===void 0?n[a]&&n[a][1].type==="data"&&(i=a,a++):(!n[a]||n[a][1].type!=="data")&&(a!==i+2&&(n[i][1].end=n[a-1][1].end,n.splice(i+2,a-i-2),a=i+2),i=void 0);return e?e(n,r):n}}function sEe(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const r=e[n-1][1],a=t.sliceStream(r);let i=a.length,o=-1,s=0,l;for(;i--;){const u=a[i];if(typeof u=="string"){for(o=u.length;u.charCodeAt(o-1)===32;)s++,o--;if(o)break;o=-1}else if(u===-2)l=!0,s++;else if(u!==-1){i++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(s=0),s){const u={type:n===e.length||l||s<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:i?o:r.start._bufferIndex+o,_index:r.start._index+i,line:r.end.line,column:r.end.column-s,offset:r.end.offset-s},end:{...r.end}};r.end={...u.start},r.start.offset===r.end.offset?Object.assign(r,u):(e.splice(n,0,["enter",u,t],["exit",u,t]),n+=2)}n++}return e}const lEe={42:Dt,43:Dt,45:Dt,48:Dt,49:Dt,50:Dt,51:Dt,52:Dt,53:Dt,54:Dt,55:Dt,56:Dt,57:Dt,62:Mv},cEe={91:h9e},uEe={[-2]:hs,[-1]:hs,32:hs},dEe={35:k9e,42:Mi,45:[tm,Mi],60:w9e,61:tm,95:Mi,96:J2,126:J2},pEe={38:Nv,92:Sv},hEe={[-5]:ms,[-4]:ms,[-3]:ms,33:B9e,38:Nv,42:xd,60:[Hwe,C9e],91:H9e,92:[y9e,Sv],93:Ip,95:xd,96:n9e},mEe={null:[xd,aEe]},fEe={null:[42,95]},gEe={null:[]},yEe=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:fEe,contentInitial:cEe,disable:gEe,document:lEe,flow:dEe,flowInitial:uEe,insideSpan:mEe,string:pEe,text:hEe},Symbol.toStringTag,{value:"Module"}));function bEe(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const a={},i=[];let o=[],s=[];const l={attempt:D(N),check:D(E),consume:b,enter:x,exit:M,interrupt:D(E,{interrupt:!0})},u={code:null,containerState:{},defineSkip:g,events:[],now:f,parser:e,previous:null,sliceSerialize:h,sliceStream:m,write:p};let d=t.tokenize.call(u,l);return t.resolveAll&&i.push(t),u;function p(q){return o=Jt(o,q),_(),o[o.length-1]!==null?[]:(P(t,0),u.events=wo(i,u.events,u),u.events)}function h(q,Z){return vEe(m(q),Z)}function m(q){return kEe(o,q)}function f(){const{_bufferIndex:q,_index:Z,line:X,column:K,offset:R}=r;return{_bufferIndex:q,_index:Z,line:X,column:K,offset:R}}function g(q){a[q.line]=q.column,I()}function _(){let q;for(;r._index<o.length;){const Z=o[r._index];if(typeof Z=="string")for(q=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===q&&r._bufferIndex<Z.length;)k(Z.charCodeAt(r._bufferIndex));else k(Z)}}function k(q){d=d(q)}function b(q){he(q)?(r.line++,r.column=1,r.offset+=q===-3?2:1,I()):q!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===o[r._index].length&&(r._bufferIndex=-1,r._index++)),u.previous=q}function x(q,Z){const X=Z||{};return X.type=q,X.start=f(),u.events.push(["enter",X,u]),s.push(X),X}function M(q){const Z=s.pop();return Z.end=f(),u.events.push(["exit",Z,u]),Z}function N(q,Z){P(q,Z.from)}function E(q,Z){Z.restore()}function D(q,Z){return X;function X(K,R,H){let G,z,V,A;return Array.isArray(K)?ee(K):"tokenize"in K?ee([K]):Y(K);function Y(ke){return Ie;function Ie(Pe){const Ke=Pe!==null&&ke[Pe],Ge=Pe!==null&&ke.null,nt=[...Array.isArray(Ke)?Ke:Ke?[Ke]:[],...Array.isArray(Ge)?Ge:Ge?[Ge]:[]];return ee(nt)(Pe)}}function ee(ke){return G=ke,z=0,ke.length===0?H:L(ke[z])}function L(ke){return Ie;function Ie(Pe){return A=C(),V=ke,ke.partial||(u.currentConstruct=ke),ke.name&&u.parser.constructs.disable.null.includes(ke.name)?ye():ke.tokenize.call(Z?Object.assign(Object.create(u),Z):u,l,se,ye)(Pe)}}function se(ke){return q(V,A),R}function ye(ke){return A.restore(),++z<G.length?L(G[z]):H}}}function P(q,Z){q.resolveAll&&!i.includes(q)&&i.push(q),q.resolve&&Gt(u.events,Z,u.events.length-Z,q.resolve(u.events.slice(Z),u)),q.resolveTo&&(u.events=q.resolveTo(u.events,u))}function C(){const q=f(),Z=u.previous,X=u.currentConstruct,K=u.events.length,R=Array.from(s);return{from:K,restore:H};function H(){r=q,u.previous=Z,u.currentConstruct=X,u.events.length=K,s=R,I()}}function I(){r.line in a&&r.column<2&&(r.column=a[r.line],r.offset+=a[r.line]-1)}}function kEe(e,t){const n=t.start._index,r=t.start._bufferIndex,a=t.end._index,i=t.end._bufferIndex;let o;if(n===a)o=[e[n].slice(r,i)];else{if(o=e.slice(n,a),r>-1){const s=o[0];typeof s=="string"?o[0]=s.slice(r):o.shift()}i>0&&o.push(e[a].slice(0,i))}return o}function vEe(e,t){let n=-1;const r=[];let a;for(;++n<e.length;){const i=e[n];let o;if(typeof i=="string")o=i;else switch(i){case-5:{o="\r";break}case-4:{o=`
|
|
8298
8298
|
`;break}case-3:{o=`\r
|
|
8299
8299
|
`;break}case-2:{o=t?" ":" ";break}case-1:{if(!t&&a)continue;o=" ";break}default:o=String.fromCharCode(i)}a=i===-2,r.push(o)}return r.join("")}function _Ee(e){const r={constructs:wv([yEe,...(e||{}).extensions||[]]),content:a(zwe),defined:[],document:a(Fwe),flow:a(nEe),lazy:{},string:a(iEe),text:a(oEe)};return r;function a(i){return o;function o(s){return bEe(r,i,s)}}}function xEe(e){for(;!Av(e););return e}const nm=/[\0\t\n\r]/g;function wEe(){let e=1,t="",n=!0,r;return a;function a(i,o,s){const l=[];let u,d,p,h,m;for(i=t+(typeof i=="string"?i.toString():new TextDecoder(o||void 0).decode(i)),p=0,t="",n&&(i.charCodeAt(0)===65279&&p++,n=void 0);p<i.length;){if(nm.lastIndex=p,u=nm.exec(i),h=u&&u.index!==void 0?u.index:i.length,m=i.charCodeAt(h),!u){t=i.slice(p);break}if(m===10&&p===h&&r)l.push(-3),r=void 0;else switch(r&&(l.push(-5),r=void 0),p<h&&(l.push(i.slice(p,h)),e+=h-p),m){case 0:{l.push(65533),e++;break}case 9:{for(d=Math.ceil(e/4)*4,l.push(-2);e++<d;)l.push(-1);break}case 10:{l.push(-4),e=1;break}default:r=!0,e=1}p=h+1}return s&&(r&&l.push(-5),t&&l.push(t),l.push(null)),l}}const EEe=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function MEe(e){return e.replace(EEe,SEe)}function SEe(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const a=n.charCodeAt(1),i=a===120||a===88;return Ev(n.slice(i?2:1),i?16:10)}return xa(n)||e}const Lv={}.hasOwnProperty;function NEe(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),AEe(n)(xEe(_Ee(n).document().write(wEe()(e,t,!0))))}function AEe(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:i(Le),autolinkProtocol:C,autolinkEmail:C,atxHeading:i(xe),blockQuote:i(Ge),characterEscape:C,characterReference:C,codeFenced:i(nt),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:i(nt,o),codeText:i(mt,o),codeTextData:C,data:C,codeFlowValue:C,definition:i(Ye),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:i(ie),hardBreakEscape:i(we),hardBreakTrailing:i(we),htmlFlow:i(Ve,o),htmlFlowData:C,htmlText:i(Ve,o),htmlTextData:C,image:i(ue),label:o,link:i(Le),listItem:i(Ce),listItemValue:h,listOrdered:i(Be,p),listUnordered:i(Be),paragraph:i(ve),reference:L,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:i(xe),strong:i(pe),thematicBreak:i(Re)},exit:{atxHeading:l(),atxHeadingSequence:N,autolink:l(),autolinkEmail:Ke,autolinkProtocol:Pe,blockQuote:l(),characterEscapeValue:I,characterReferenceMarkerHexadecimal:ye,characterReferenceMarkerNumeric:ye,characterReferenceValue:ke,characterReference:Ie,codeFenced:l(_),codeFencedFence:g,codeFencedFenceInfo:m,codeFencedFenceMeta:f,codeFlowValue:I,codeIndented:l(k),codeText:l(R),codeTextData:I,data:I,definition:l(),definitionDestinationString:M,definitionLabelString:b,definitionTitleString:x,emphasis:l(),hardBreakEscape:l(Z),hardBreakTrailing:l(Z),htmlFlow:l(X),htmlFlowData:I,htmlText:l(K),htmlTextData:I,image:l(G),label:V,labelText:z,lineEnding:q,link:l(H),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:se,resourceDestinationString:A,resourceTitleString:Y,resource:ee,setextHeading:l(P),setextHeadingLineSequence:D,setextHeadingText:E,strong:l(),thematicBreak:l()}};Dv(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(B){let Q={type:"root",children:[]};const oe={stack:[Q],tokenStack:[],config:t,enter:s,exit:u,buffer:o,resume:d,data:n},re=[];let _e=-1;for(;++_e<B.length;)if(B[_e][1].type==="listOrdered"||B[_e][1].type==="listUnordered")if(B[_e][0]==="enter")re.push(_e);else{const qe=re.pop();_e=a(B,qe,_e)}for(_e=-1;++_e<B.length;){const qe=t[B[_e][0]];Lv.call(qe,B[_e][1].type)&&qe[B[_e][1].type].call(Object.assign({sliceSerialize:B[_e][2].sliceSerialize},oe),B[_e][1])}if(oe.tokenStack.length>0){const qe=oe.tokenStack[oe.tokenStack.length-1];(qe[1]||rm).call(oe,void 0,qe[0])}for(Q.position={start:Un(B.length>0?B[0][1].start:{line:1,column:1,offset:0}),end:Un(B.length>0?B[B.length-2][1].end:{line:1,column:1,offset:0})},_e=-1;++_e<t.transforms.length;)Q=t.transforms[_e](Q)||Q;return Q}function a(B,Q,oe){let re=Q-1,_e=-1,qe=!1,it,bt,qn,Bn;for(;++re<=oe;){const ft=B[re];switch(ft[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{ft[0]==="enter"?_e++:_e--,Bn=void 0;break}case"lineEndingBlank":{ft[0]==="enter"&&(it&&!Bn&&!_e&&!qn&&(qn=re),Bn=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Bn=void 0}if(!_e&&ft[0]==="enter"&&ft[1].type==="listItemPrefix"||_e===-1&&ft[0]==="exit"&&(ft[1].type==="listUnordered"||ft[1].type==="listOrdered")){if(it){let Et=re;for(bt=void 0;Et--;){const It=B[Et];if(It[1].type==="lineEnding"||It[1].type==="lineEndingBlank"){if(It[0]==="exit")continue;bt&&(B[bt][1].type="lineEndingBlank",qe=!0),It[1].type="lineEnding",bt=Et}else if(!(It[1].type==="linePrefix"||It[1].type==="blockQuotePrefix"||It[1].type==="blockQuotePrefixWhitespace"||It[1].type==="blockQuoteMarker"||It[1].type==="listItemIndent"))break}qn&&(!bt||qn<bt)&&(it._spread=!0),it.end=Object.assign({},bt?B[bt][1].start:ft[1].end),B.splice(bt||re,0,["exit",it,ft[2]]),re++,oe++}if(ft[1].type==="listItemPrefix"){const Et={type:"listItem",_spread:!1,start:Object.assign({},ft[1].start),end:void 0};it=Et,B.splice(re,0,["enter",Et,ft[2]]),re++,oe++,qn=void 0,Bn=!0}}}return B[Q][1]._spread=qe,oe}function i(B,Q){return oe;function oe(re){s.call(this,B(re),re),Q&&Q.call(this,re)}}function o(){this.stack.push({type:"fragment",children:[]})}function s(B,Q,oe){this.stack[this.stack.length-1].children.push(B),this.stack.push(B),this.tokenStack.push([Q,oe||void 0]),B.position={start:Un(Q.start),end:void 0}}function l(B){return Q;function Q(oe){B&&B.call(this,oe),u.call(this,oe)}}function u(B,Q){const oe=this.stack.pop(),re=this.tokenStack.pop();if(re)re[0].type!==B.type&&(Q?Q.call(this,B,re[0]):(re[1]||rm).call(this,B,re[0]));else throw new Error("Cannot close `"+B.type+"` ("+ua({start:B.start,end:B.end})+"): it’s not open");oe.position.end=Un(B.end)}function d(){return Rp(this.stack.pop())}function p(){this.data.expectingFirstListItemValue=!0}function h(B){if(this.data.expectingFirstListItemValue){const Q=this.stack[this.stack.length-2];Q.start=Number.parseInt(this.sliceSerialize(B),10),this.data.expectingFirstListItemValue=void 0}}function m(){const B=this.resume(),Q=this.stack[this.stack.length-1];Q.lang=B}function f(){const B=this.resume(),Q=this.stack[this.stack.length-1];Q.meta=B}function g(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function _(){const B=this.resume(),Q=this.stack[this.stack.length-1];Q.value=B.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function k(){const B=this.resume(),Q=this.stack[this.stack.length-1];Q.value=B.replace(/(\r?\n|\r)$/g,"")}function b(B){const Q=this.resume(),oe=this.stack[this.stack.length-1];oe.label=Q,oe.identifier=dn(this.sliceSerialize(B)).toLowerCase()}function x(){const B=this.resume(),Q=this.stack[this.stack.length-1];Q.title=B}function M(){const B=this.resume(),Q=this.stack[this.stack.length-1];Q.url=B}function N(B){const Q=this.stack[this.stack.length-1];if(!Q.depth){const oe=this.sliceSerialize(B).length;Q.depth=oe}}function E(){this.data.setextHeadingSlurpLineEnding=!0}function D(B){const Q=this.stack[this.stack.length-1];Q.depth=this.sliceSerialize(B).codePointAt(0)===61?1:2}function P(){this.data.setextHeadingSlurpLineEnding=void 0}function C(B){const oe=this.stack[this.stack.length-1].children;let re=oe[oe.length-1];(!re||re.type!=="text")&&(re=be(),re.position={start:Un(B.start),end:void 0},oe.push(re)),this.stack.push(re)}function I(B){const Q=this.stack.pop();Q.value+=this.sliceSerialize(B),Q.position.end=Un(B.end)}function q(B){const Q=this.stack[this.stack.length-1];if(this.data.atHardBreak){const oe=Q.children[Q.children.length-1];oe.position.end=Un(B.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(Q.type)&&(C.call(this,B),I.call(this,B))}function Z(){this.data.atHardBreak=!0}function X(){const B=this.resume(),Q=this.stack[this.stack.length-1];Q.value=B}function K(){const B=this.resume(),Q=this.stack[this.stack.length-1];Q.value=B}function R(){const B=this.resume(),Q=this.stack[this.stack.length-1];Q.value=B}function H(){const B=this.stack[this.stack.length-1];if(this.data.inReference){const Q=this.data.referenceType||"shortcut";B.type+="Reference",B.referenceType=Q,delete B.url,delete B.title}else delete B.identifier,delete B.label;this.data.referenceType=void 0}function G(){const B=this.stack[this.stack.length-1];if(this.data.inReference){const Q=this.data.referenceType||"shortcut";B.type+="Reference",B.referenceType=Q,delete B.url,delete B.title}else delete B.identifier,delete B.label;this.data.referenceType=void 0}function z(B){const Q=this.sliceSerialize(B),oe=this.stack[this.stack.length-2];oe.label=MEe(Q),oe.identifier=dn(Q).toLowerCase()}function V(){const B=this.stack[this.stack.length-1],Q=this.resume(),oe=this.stack[this.stack.length-1];if(this.data.inReference=!0,oe.type==="link"){const re=B.children;oe.children=re}else oe.alt=Q}function A(){const B=this.resume(),Q=this.stack[this.stack.length-1];Q.url=B}function Y(){const B=this.resume(),Q=this.stack[this.stack.length-1];Q.title=B}function ee(){this.data.inReference=void 0}function L(){this.data.referenceType="collapsed"}function se(B){const Q=this.resume(),oe=this.stack[this.stack.length-1];oe.label=Q,oe.identifier=dn(this.sliceSerialize(B)).toLowerCase(),this.data.referenceType="full"}function ye(B){this.data.characterReferenceType=B.type}function ke(B){const Q=this.sliceSerialize(B),oe=this.data.characterReferenceType;let re;oe?(re=Ev(Q,oe==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):re=xa(Q);const _e=this.stack[this.stack.length-1];_e.value+=re}function Ie(B){const Q=this.stack.pop();Q.position.end=Un(B.end)}function Pe(B){I.call(this,B);const Q=this.stack[this.stack.length-1];Q.url=this.sliceSerialize(B)}function Ke(B){I.call(this,B);const Q=this.stack[this.stack.length-1];Q.url="mailto:"+this.sliceSerialize(B)}function Ge(){return{type:"blockquote",children:[]}}function nt(){return{type:"code",lang:null,meta:null,value:""}}function mt(){return{type:"inlineCode",value:""}}function Ye(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function ie(){return{type:"emphasis",children:[]}}function xe(){return{type:"heading",depth:0,children:[]}}function we(){return{type:"break"}}function Ve(){return{type:"html",value:""}}function ue(){return{type:"image",title:null,url:"",alt:null}}function Le(){return{type:"link",title:null,url:"",children:[]}}function Be(B){return{type:"list",ordered:B.type==="listOrdered",start:null,spread:B._spread,children:[]}}function Ce(B){return{type:"listItem",spread:B._spread,checked:null,children:[]}}function ve(){return{type:"paragraph",children:[]}}function pe(){return{type:"strong",children:[]}}function be(){return{type:"text",value:""}}function Re(){return{type:"thematicBreak"}}}function Un(e){return{line:e.line,column:e.column,offset:e.offset}}function Dv(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?Dv(e,r):TEe(e,r)}}function TEe(e,t){let n;for(n in t)if(Lv.call(t,n))switch(n){case"canContainEols":{const r=t[n];r&&e[n].push(...r);break}case"transforms":{const r=t[n];r&&e[n].push(...r);break}case"enter":case"exit":{const r=t[n];r&&Object.assign(e[n],r);break}}}function rm(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+ua({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+ua({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+ua({start:t.start,end:t.end})+") is still open")}function CEe(e){const t=this;t.parser=n;function n(r){return NEe(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function REe(e,t){const n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function IEe(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
|